diff mbox series

[V4,4/7] cpufreq: Add a notification message that the highest perf has changed

Message ID 20230829064340.1136448-5-li.meng@amd.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series AMD Pstate Preferred Core | expand

Commit Message

Meng, Li (Jassmine) Aug. 29, 2023, 6:43 a.m. UTC
ACPI 6.5 section 8.4.6.1.1.1 specifies that Notify event 0x85 can be
emmitted to cause the the OSPM to re-evaluate the highest performance
register. Add support for this event.

Signed-off-by: Meng Li <li.meng@amd.com>
Link: https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html?highlight=cppc#cpc-continuous-performance-control
---
 drivers/acpi/processor_driver.c |  6 ++++++
 drivers/cpufreq/cpufreq.c       | 13 +++++++++++++
 include/linux/cpufreq.h         |  4 ++++
 3 files changed, 23 insertions(+)

Comments

kernel test robot Aug. 29, 2023, 4:27 p.m. UTC | #1
Hi Meng,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on linus/master v6.5 next-20230829]
[cannot apply to tip/x86/core]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Meng-Li/x86-Drop-CPU_SUP_INTEL-from-SCHED_MC_PRIO-for-the-expansion/20230829-144723
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20230829064340.1136448-5-li.meng%40amd.com
patch subject: [PATCH V4 4/7] cpufreq: Add a notification message that the highest perf has changed
config: i386-randconfig-r031-20230829 (https://download.01.org/0day-ci/archive/20230830/202308300057.ASUJQpsV-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230830/202308300057.ASUJQpsV-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308300057.ASUJQpsV-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/acpi/processor_driver.c:88:3: error: call to undeclared function 'cpufreq_update_highest_perf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                   cpufreq_update_highest_perf(pr->id);
                   ^
   1 error generated.


vim +/cpufreq_update_highest_perf +88 drivers/acpi/processor_driver.c

    53	
    54	static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
    55	{
    56		struct acpi_device *device = data;
    57		struct acpi_processor *pr;
    58		int saved;
    59	
    60		if (device->handle != handle)
    61			return;
    62	
    63		pr = acpi_driver_data(device);
    64		if (!pr)
    65			return;
    66	
    67		switch (event) {
    68		case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
    69			saved = pr->performance_platform_limit;
    70			acpi_processor_ppc_has_changed(pr, 1);
    71			if (saved == pr->performance_platform_limit)
    72				break;
    73			acpi_bus_generate_netlink_event(device->pnp.device_class,
    74							  dev_name(&device->dev), event,
    75							  pr->performance_platform_limit);
    76			break;
    77		case ACPI_PROCESSOR_NOTIFY_POWER:
    78			acpi_processor_power_state_has_changed(pr);
    79			acpi_bus_generate_netlink_event(device->pnp.device_class,
    80							  dev_name(&device->dev), event, 0);
    81			break;
    82		case ACPI_PROCESSOR_NOTIFY_THROTTLING:
    83			acpi_processor_tstate_has_changed(pr);
    84			acpi_bus_generate_netlink_event(device->pnp.device_class,
    85							  dev_name(&device->dev), event, 0);
    86			break;
    87		case ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED:
  > 88			cpufreq_update_highest_perf(pr->id);
    89			acpi_bus_generate_netlink_event(device->pnp.device_class,
    90							  dev_name(&device->dev), event, 0);
    91			break;
    92		default:
    93			acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
    94			break;
    95		}
    96	
    97		return;
    98	}
    99
diff mbox series

Patch

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 4bd16b3f0781..29b2fb68a35d 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -27,6 +27,7 @@ 
 #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
 #define ACPI_PROCESSOR_NOTIFY_POWER	0x81
 #define ACPI_PROCESSOR_NOTIFY_THROTTLING	0x82
+#define ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED	0x85
 
 MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION("ACPI Processor Driver");
@@ -83,6 +84,11 @@  static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
 		acpi_bus_generate_netlink_event(device->pnp.device_class,
 						  dev_name(&device->dev), event, 0);
 		break;
+	case ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED:
+		cpufreq_update_highest_perf(pr->id);
+		acpi_bus_generate_netlink_event(device->pnp.device_class,
+						  dev_name(&device->dev), event, 0);
+		break;
 	default:
 		acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
 		break;
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 50bbc969ffe5..842357abfae6 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2675,6 +2675,19 @@  void cpufreq_update_limits(unsigned int cpu)
 }
 EXPORT_SYMBOL_GPL(cpufreq_update_limits);
 
+/**
+ * cpufreq_update_highest_perf - Update highest performance for a given CPU.
+ * @cpu: CPU to update the highest performance for.
+ *
+ * Invoke the driver's ->update_highest_perf callback if present
+ */
+void cpufreq_update_highest_perf(unsigned int cpu)
+{
+	if (cpufreq_driver->update_highest_perf)
+		cpufreq_driver->update_highest_perf(cpu);
+}
+EXPORT_SYMBOL_GPL(cpufreq_update_highest_perf);
+
 /*********************************************************************
  *               BOOST						     *
  *********************************************************************/
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 9bf94ae08158..58106b3d9183 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -232,6 +232,7 @@  int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
 void refresh_frequency_limits(struct cpufreq_policy *policy);
 void cpufreq_update_policy(unsigned int cpu);
 void cpufreq_update_limits(unsigned int cpu);
+void cpufreq_update_highest_perf(unsigned int cpu);
 bool have_governor_per_policy(void);
 bool cpufreq_supports_freq_invariance(void);
 struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
@@ -377,6 +378,9 @@  struct cpufreq_driver {
 	/* Called to update policy limits on firmware notifications. */
 	void		(*update_limits)(unsigned int cpu);
 
+	/* Called to update highest performance on firmware notifications. */
+	void		(*update_highest_perf)(unsigned int cpu);
+
 	/* optional */
 	int		(*bios_limit)(int cpu, unsigned int *limit);