Browse Source

added the cpu core parking/pinning settings

added the cpu core parking/pinning settings to gamemode-config.c
Henrik Holst 1 year ago
parent
commit
32a0b5b636
1 changed files with 28 additions and 0 deletions
  1. 28 0
      daemon/gamemode-config.c

+ 28 - 0
daemon/gamemode-config.c

@@ -106,6 +106,9 @@ struct GameModeConfig {
 		long nv_powermizer_mode;
 		char amd_performance_level[CONFIG_VALUE_MAX];
 
+		char cpu_park_cores[CONFIG_VALUE_MAX];
+		char cpu_pin_cores[CONFIG_VALUE_MAX];
+
 		long require_supervisor;
 		char supervisor_whitelist[CONFIG_LIST_MAX][CONFIG_VALUE_MAX];
 		char supervisor_blacklist[CONFIG_LIST_MAX][CONFIG_VALUE_MAX];
@@ -296,6 +299,12 @@ static int inih_handler(void *user, const char *section, const char *name, const
 		} else if (strcmp(name, "amd_performance_level") == 0) {
 			valid = get_string_value(value, self->values.amd_performance_level);
 		}
+	} else if (strcmp(section, "cpu") == 0) {
+		if (strcmp(name, "park_cores") == 0) {
+			valid = get_string_value(value, self->values.cpu_park_cores);
+		} else if (strcmp(name, "pin_cores") == 0) {
+			valid = get_string_value(value, self->values.cpu_pin_cores);
+		}
 	} else if (strcmp(section, "supervisor") == 0) {
 		/* Supervisor subsection */
 		if (strcmp(name, "supervisor_whitelist") == 0) {
@@ -794,6 +803,25 @@ void config_get_amd_performance_level(GameModeConfig *self, char value[CONFIG_VA
 */
 DEFINE_CONFIG_GET(require_supervisor)
 
+/*
+ * Get various config info for cpu optimisations
+ */
+void config_get_cpu_park_cores(GameModeConfig *self, char value[CONFIG_VALUE_MAX])
+{
+	memcpy_locked_config(self,
+	                     value,
+	                     &self->values.cpu_park_cores,
+	                     sizeof(self->values.cpu_park_cores));
+}
+
+void config_get_cpu_pin_cores(GameModeConfig *self, char value[CONFIG_VALUE_MAX])
+{
+	memcpy_locked_config(self,
+	                     value,
+	                     &self->values.cpu_pin_cores,
+	                     sizeof(self->values.cpu_pin_cores));
+}
+
 /*
  * Checks if the supervisor is whitelisted
  */