diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux-6.6/linux-yocto-6.6/0066-ACPI-Add-perf-low-power-callback.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux-6.6/linux-yocto-6.6/0066-ACPI-Add-perf-low-power-callback.patch | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux-6.6/linux-yocto-6.6/0066-ACPI-Add-perf-low-power-callback.patch b/meta-amd-bsp/recipes-kernel/linux-6.6/linux-yocto-6.6/0066-ACPI-Add-perf-low-power-callback.patch new file mode 100644 index 00000000..7c94617c --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux-6.6/linux-yocto-6.6/0066-ACPI-Add-perf-low-power-callback.patch @@ -0,0 +1,106 @@ +From 39c93781d2b6f3f1b5d695fd74bf0ddca720fdea Mon Sep 17 00:00:00 2001 +From: Stephane Eranian <eranian@google.com> +Date: Tue, 22 Mar 2022 15:15:12 -0700 +Subject: [PATCH 66/86] ACPI: Add perf low power callback + +commit 2a606a18cd672a16343d146a126721b34cc6adbd upstream + +Add an optional callback needed by some PMU features, e.g., AMD +BRS, to give a chance to the perf_events code to change its state before +a CPU goes to low power and after it comes back. + +The callback is void when the PERF_NEEDS_LOPWR_CB flag is not set. +This flag must be set in arch specific perf_event.h header whenever needed. +When not set, there is no impact on the ACPI code. + +Signed-off-by: Stephane Eranian <eranian@google.com> +[peterz: build fix] +Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> +Link: https://lore.kernel.org/r/20220322221517.2510440-9-eranian@google.com +Signed-off-by: Zhaolong Zhang <zhaolong.zhang@windriver.com> +--- + drivers/acpi/acpi_pad.c | 7 +++++++ + drivers/acpi/processor_idle.c | 5 +++++ + include/linux/perf_event.h | 6 ++++++ + 3 files changed, 18 insertions(+) + +diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c +index f45979aa2d64..ec0e22a1e25d 100644 +--- a/drivers/acpi/acpi_pad.c ++++ b/drivers/acpi/acpi_pad.c +@@ -17,6 +17,7 @@ + #include <linux/tick.h> + #include <linux/slab.h> + #include <linux/acpi.h> ++#include <linux/perf_event.h> + #include <asm/mwait.h> + #include <xen/xen.h> + +@@ -164,6 +165,9 @@ static int power_saving_thread(void *data) + tsc_marked_unstable = 1; + } + local_irq_disable(); ++ ++ perf_lopwr_cb(true); ++ + tick_broadcast_enable(); + tick_broadcast_enter(); + stop_critical_timings(); +@@ -172,6 +176,9 @@ static int power_saving_thread(void *data) + + start_critical_timings(); + tick_broadcast_exit(); ++ ++ perf_lopwr_cb(false); ++ + local_irq_enable(); + + if (time_before(expire_time, jiffies)) { +diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c +index fdd0ce789cc8..c8b651eca333 100644 +--- a/drivers/acpi/processor_idle.c ++++ b/drivers/acpi/processor_idle.c +@@ -21,6 +21,7 @@ + #include <linux/cpuidle.h> + #include <linux/cpu.h> + #include <linux/minmax.h> ++#include <linux/perf_event.h> + #include <acpi/processor.h> + + /* +@@ -544,6 +545,8 @@ static void wait_for_freeze(void) + */ + static void __cpuidle acpi_idle_do_entry(struct acpi_processor_cx *cx) + { ++ perf_lopwr_cb(true); ++ + if (cx->entry_method == ACPI_CSTATE_FFH) { + /* Call into architectural FFH based C-state */ + acpi_processor_ffh_cstate_enter(cx); +@@ -554,6 +557,8 @@ static void __cpuidle acpi_idle_do_entry(struct acpi_processor_cx *cx) + inb(cx->address); + wait_for_freeze(); + } ++ ++ perf_lopwr_cb(false); + } + + /** +diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h +index 5d65aa186c1a..24f7c2e7423b 100644 +--- a/include/linux/perf_event.h ++++ b/include/linux/perf_event.h +@@ -1664,4 +1664,10 @@ typedef int (perf_snapshot_branch_stack_t)(struct perf_branch_entry *entries, + unsigned int cnt); + DECLARE_STATIC_CALL(perf_snapshot_branch_stack, perf_snapshot_branch_stack_t); + ++#ifndef PERF_NEEDS_LOPWR_CB ++static inline void perf_lopwr_cb(bool mode) ++{ ++} ++#endif ++ + #endif /* _LINUX_PERF_EVENT_H */ +-- +2.37.3 + |