]> git.ipfire.org Git - thirdparty/linux.git/commit
platform/x86/amd/pmf: Use ring buffer to store custom BIOS input values
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Tue, 2 Dec 2025 04:22:19 +0000 (09:52 +0530)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 23 Dec 2025 09:44:58 +0000 (11:44 +0200)
commit2a2c085de1f3f54a6222fbef5b45f1d3c40e98e3
tree731a179567c01042066fb50db5d4448f376cc620
parentdd0a2d47cfc4c5ffb3e866c94a80c03ff5ecdd70
platform/x86/amd/pmf: Use ring buffer to store custom BIOS input values

Custom BIOS input values can be updated by multiple sources, such as power
mode changes and sensor events, each triggering a custom BIOS input event.
When these events occur in rapid succession, new data may overwrite
previous values before they are processed, resulting in lost updates.

To address this, introduce a fixed-size, power-of-two ring buffer to
capture every custom BIOS input event, storing both the pending request
and its associated input values. Access to the ring buffer is synchronized
using a mutex.

The previous use of memset() to clear the pending request structure after
each event is removed, as each BIOS input value is now copied into the
buffer as a snapshot. Consumers now process entries directly from the ring
buffer, making explicit clearing of the pending request structure
unnecessary.

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Tested-by: Yijun Shen <Yijun.Shen@Dell.com>
Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://patch.msgid.link/20251202042219.245173-1-Shyam-sundar.S-k@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmf/acpi.c
drivers/platform/x86/amd/pmf/core.c
drivers/platform/x86/amd/pmf/pmf.h
drivers/platform/x86/amd/pmf/spc.c
drivers/platform/x86/amd/pmf/tee-if.c