1c0a50de02
Merge tag 'platform-drivers-x86-v6.8-4' into pdx86/for-next
...
Merge tag 'platform-drivers-x86-v6.8-4' fixes into pdx86/for-next to
resolve amd/pmf conflicts.
2024-03-12 12:51:10 +02:00
8362e862fb
platform/x86/amd/pmf: Update sps power thermals according to the platform-profiles
...
Update power thermals according to the platform-profiles selected by the
user.
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 >
Link: https://lore.kernel.org/r/20240306114415.3267603-8-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:34 +02:00
3eecb434d7
platform/x86/amd/pmf: Add support to get sps default APTS index values
...
During the driver probe, the default cache values for the static slider
would be obtained by evaluating the APTS method. Add support to use
these values as the thermal settings to be updated on the system based
on the changing platform-profiles.
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 >
Link: https://lore.kernel.org/r/20240306114415.3267603-7-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:32 +02:00
48d38f5692
platform/x86/amd/pmf: Add support to get APTS index numbers for static slider
...
APMF spec has a newer section called the APTS (AMD Performance and
Thermal State) information, where each slider/power mode is associated
with an index number.
Add support to get these indices for the Static Slider.
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.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 >
Link: https://lore.kernel.org/r/20240306114415.3267603-6-Shyam-sundar.S-k@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:30 +02:00
6262938eef
platform/x86/amd/pmf: Add support to notify sbios heart beat event
...
Add support for newer revision of the heart beat notify events.
This event is used to notify to the OEM BIOS on driver
load/unload/suspend/resume scenarios.
If OEM BIOS does not receive the heart beat event from PMF driver, OEM
BIOS shall conclude that PMF driver is no more active and BIOS will
update to the legacy system power thermals.
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.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 >
Link: https://lore.kernel.org/r/20240306114415.3267603-5-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:28 +02:00
5fdc8b82aa
platform/x86/amd/pmf: Add support to get sbios requests in PMF driver
...
Update the APMF function index 2 for family 1Ah, that gets the
information of SBIOS requests (like the pending requests from BIOS,
custom notifications, updation of power limits etc).
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 >
Link: https://lore.kernel.org/r/20240306114415.3267603-4-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:27 +02:00
233f78e11e
platform/x86/amd/pmf: Disable debugfs support for querying power thermals
...
The GET interface to receive the active power thermal information from
the PMFW has been deprecated. Hence drop the debugfs support from
version2 onwards.
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.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 >
Link: https://lore.kernel.org/r/20240306114415.3267603-3-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:25 +02:00
a33e9e1066
platform/x86/amd/pmf: Differentiate PMF ACPI versions
...
For family 1AH, certain PMF features have been enhanced - leading to a
newer APMF (AMD PMF) spec (BIOS and PMF driver interface) called v2.
This information would be fed into the if_version field of the
verify_interface method of the APMF call from the BIOS.
Use this information to store the version number to differentiate
between v1 or v2 and also store the information into the PMF private
data structure, as this information would be required for further code
branching to support the latest silicon.
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.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 >
Link: https://lore.kernel.org/r/20240306114415.3267603-2-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:23 +02:00
8c9be42172
platform/x86/amd/pmf: Fix possible out-of-bound memory accesses
...
The length of the policy buffer is not validated before accessing it,
which means that multiple out-of-bounds memory accesses can occur.
This is especially bad since userspace can load policy binaries over
debugfs.
Compile-tested only.
Fixes: 7c45534afa
("platform/x86/amd/pmf: Add support for PMF Policy Binary")
Signed-off-by: Armin Wolf <W_Armin@gmx.de >
Reviewed-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Link: https://lore.kernel.org/r/20240304205005.10078-5-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:07 +02:00
9ced197640
platform/x86/amd/pmf: Use struct for cookie header
...
The cookie header consists of a sign field and a length field.
Combine both in a single struct to make accesses simpler.
Compile-tested only.
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Armin Wolf <W_Armin@gmx.de >
Reviewed-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Link: https://lore.kernel.org/r/20240304205005.10078-4-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:05 +02:00
e42dddce83
platform/x86/amd/pmf: Do not use readl() for policy buffer access
...
The policy buffer is allocated using normal memory allocation
functions, so readl() should not be used on it.
Compile-tested only.
Fixes: 7c45534afa
("platform/x86/amd/pmf: Add support for PMF Policy Binary")
Signed-off-by: Armin Wolf <W_Armin@gmx.de >
Reviewed-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Link: https://lore.kernel.org/r/20240304205005.10078-3-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:03 +02:00
d1e33cd666
platform/x86/amd/pmf: Fix return value of amd_pmf_start_policy_engine()
...
amd_pmf_start_policy_engine() returns an negative error code upon
failure, so the TA_PMF_* error codes cannot be used here.
Return -EIO instead. Also stop shadowing the return code in
amd_pmf_get_pb_data().
Compile-tested only.
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Fixes: 7c45534afa
("platform/x86/amd/pmf: Add support for PMF Policy Binary")
Signed-off-by: Armin Wolf <W_Armin@gmx.de >
Reviewed-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Link: https://lore.kernel.org/r/20240304205005.10078-2-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:48:02 +02:00
bb05226c84
platform/x86/amd/pmf: Add missing __iomem attribute to policy_base
...
The value of policy_base is the return value of a devm_ioremap call,
which returns a __iomem pointer instead of an regular pointer.
Add the missing __iomem attribute.
Compile-tested only.
Signed-off-by: Armin Wolf <W_Armin@gmx.de >
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com >
Link: https://lore.kernel.org/r/20240223163901.13504-1-W_Armin@gmx.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-03-12 12:47:42 +02:00
0314cebb29
platform/x86/amd/pmf: Fix missing error code in amd_pmf_init_smart_pc()
...
On the error path, assign -ENOMEM to ret when memory allocation of
"dev->prev_data" fails.
Fixes: e709615058
("platform/x86/amd/pmf: Fixup error handling for amd_pmf_init_smart_pc()")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20240226144011.2100804-1-harshit.m.mogalapalli@oracle.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-03-05 10:17:07 +01:00
76d41fb063
platform/x86/amd/pmf: Fix a potential race with policy binary sideload
...
The debugfs `update_policy` file is created before
amd_pmf_start_policy_engine() has completed, and thus there could be
a possible (albeit unlikely) race between sideloading a policy and the
BIOS policy getting setup.
Move the debugfs file creation after all BIOS policy is setup.
Fixes: 10817f28e5
("platform/x86/amd/pmf: Add capability to sideload of policy binary")
Reported-by: Hans de Goede <hdegoede@redhat.com >
Closes: https://lore.kernel.org/platform-driver-x86/15df7d02-b0aa-457a-954a-9d280a592843@redhat.com/T/#m2c445f135e5ef9b53184be7fc9df84e15f89d4d9
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20240217015642.113806-1-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-02-19 13:39:44 +01:00
e709615058
platform/x86/amd/pmf: Fixup error handling for amd_pmf_init_smart_pc()
...
amd_pmf_init_smart_pc() calls out to amd_pmf_get_bios_buffer() but
the error handling flow doesn't clean everything up allocated
memory.
As amd_pmf_get_bios_buffer() is only called by amd_pmf_init_smart_pc(),
fold it into the function and add labels to clean up any step that
can fail along the way. Explicitly set everything allocated to NULL as
there are other features that may access some of the same variables.
Fixes: 7c45534afa
("platform/x86/amd/pmf: Add support for PMF Policy Binary")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20240217014107.113749-3-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-02-19 13:39:44 +01:00
20545af302
platform/x86/amd/pmf: Add debugging message for missing policy data
...
If a machine advertises Smart PC support but is missing policy data
show a debugging message to help clarify why Smart PC wasn't enabled.
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20240217014107.113749-2-mario.limonciello@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-02-19 13:39:40 +01:00
b2b6fa6f5c
platform/x86/amd/pmf: Fix a suspend hang on Framework 13
...
The buffer is cleared in the suspend handler but used in
the delayed work for amd_pmf_get_metrics().
Stop clearing it to fix the hang.
Reported-by: Trolli Schmittlauch <t.schmittlauch@orlives.de >
Closes: https://lore.kernel.org/regressions/ed2226ff-257b-4cfd-afd6-bf3be9785474@localhost/
Closes: https://community.frame.work/t/kernel-6-8-rc-system-freezes-after-resuming-from-suspend-reproducers-wanted/45381
Fixes: 2b3a7f06ca
("platform/x86/amd/pmf: Change return type of amd_pmf_set_dram_addr()")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20240217005216.113408-1-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-02-19 13:36:46 +01:00
11e298f354
platform/x86/amd/pmf: Fix TEE enact command failure after suspend and resume
...
TEE enact command failures are seen after each suspend/resume cycle;
fix this by cancelling the policy builder workqueue before going into
suspend and reschedule the workqueue after resume.
[ 629.516792] ccp 0000:c2:00.2: tee: command 0x5 timed out, disabling PSP
[ 629.516835] amd-pmf AMDI0102:00: TEE enact cmd failed. err: ffff000e, ret:0
[ 630.550464] amd-pmf AMDI0102:00: AMD_PMF_REGISTER_RESPONSE:1
[ 630.550511] amd-pmf AMDI0102:00: AMD_PMF_REGISTER_ARGUMENT:7
[ 630.550548] amd-pmf AMDI0102:00: AMD_PMF_REGISTER_MESSAGE:16
Fixes: ae82cef7d9
("platform/x86/amd/pmf: Add support for PMF-TA interaction")
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: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20240216064112.962582-2-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-02-19 13:30:06 +01:00
3da01394c0
platform/x86/amd/pmf: Remove smart_pc_status enum
...
Improve code readability by removing smart_pc_status enum, as the same
can be done with a simple true/false check; Update the code checks
accordingly.
Also add a missing return on amd_pmf_init_smart_pc() success,
to skip trying to setup the auto / slider modes which should
not be used in this case.
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20240216064112.962582-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-02-19 13:30:01 +01:00
d16c9a3d97
Merge tag 'platform-drivers-x86-v6.8-2' into pdx/for-next
...
Merge tag 'platform-drivers-x86-v6.8-2' fixes into pdf86/for-next
because of WMI fixes. The WMI changes done in for-next already created
a minor conflict with the fixes and WMI is actively being improved
currently so besides resolving the current conflict, this is also to
avoid further conflicts.
2024-02-08 13:49:31 +02:00
2b703fbe4e
platform/x86/amd/hsmp: Change devm_kzalloc() to devm_kcalloc()
...
Use the standard array allocation variant of devm memory allocation
APIs.
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Link: https://lore.kernel.org/r/20240125125401.597617-1-suma.hegde@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-31 10:31:18 +02:00
202574971d
platform/x86/amd/hsmp: Remove extra parenthesis and add a space
...
Remove unnecessary parenthesis around hsmp_get_tbl_dram_base().
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-11-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-31 10:31:12 +02:00
ef6e98177f
platform/x86/amd/hsmp: Check num_sockets against MAX_AMD_SOCKETS
...
AMD supports connecting up to 8 AMD EPYCs in a system.
Hence, verify the num_sockets returned from amd_nb_num().
Also remove the WARN_ON() since the num_sockets is already verified.
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Reviewed-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-9-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-31 10:31:07 +02:00
d2bf115115
platform/x86/amd/hsmp: Non-ACPI support for AMD F1A_M00~0Fh
...
AMD EPYC family 0x1A and Model 0x0-0xF are having different
mailbox message ID offset compared to previous
platforms. In case of ACPI based BIOS, this information will be read
from ACPI table, for non-ACPI BIOS, this needs to be #defined.
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-8-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-31 10:30:59 +02:00
ba8dcff0e9
platform/x86/amd/hsmp: Add support for ACPI based probing
...
ACPI table provides mailbox base address and register offset
information. The base address is provided as part of CRS method
and mailbox offsets are provided through DSD table.
Sockets are differentiated by UIDs.
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-7-suma.hegde@amd.com
[ij: Removed extra parenthesis.]
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-31 10:30:48 +02:00
ca511e7631
platform/x86/amd/hsmp: Restructure sysfs group creation
...
Split the creation of array of attribute groups and array of attributes
into different functions. This will ease the ACPI support.
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-6-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-31 10:26:43 +02:00
ce08d3570a
platform/x86/amd/hsmp: Move dev from platdev to hsmp_socket
...
On an ACPI enabled platforms the probe is called for each socket
and the struct dev is different for each socket. This change
will help in handling both ACPI and non-ACPI platforms.
Also change pr_err() to dev_err() API.
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-5-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-31 10:26:12 +02:00
a692a86efe
platform/x86/amd/pmf: Fix memory leak in amd_pmf_get_pb_data()
...
amd_pmf_get_pb_data() will allocate memory for the policy buffer,
but does not free it if copy_from_user() fails. This leads to a memory
leak.
Fixes: 10817f28e5
("platform/x86/amd/pmf: Add capability to sideload of policy binary")
Reviewed-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Signed-off-by: Cong Liu <liucong2@kylinos.cn >
Link: https://lore.kernel.org/r/20240124012939.6550-1-liucong2@kylinos.cn
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-26 20:12:16 +01:00
cedecdba60
platform/x86/amd/pmf: Get ambient light information from AMD SFH driver
...
AMD SFH driver has APIs defined to export the ambient light information;
use this within the PMF driver to send inputs to the PMF TA, so that PMF
driver can enact to the actions coming from the TA.
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20240123141458.3715211-2-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-26 20:12:05 +01:00
118063f380
platform/x86/amd/pmf: Get Human presence information from AMD SFH driver
...
AMD SFH driver has APIs defined to export the human presence information;
use this within the PMF driver to send inputs to the PMF TA, so that PMF
driver can enact to the actions coming from the TA.
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20240123141458.3715211-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-26 20:09:41 +01:00
17998b3e52
platform/x86/amd/hsmp: Define a struct to hold mailbox regs
...
Define struct hsmp_mbaddr_info with register offsets and populate
them during probe, which avoids the usage of macros in core functions.
During ACPI probe, the same fields can be populated from ACPI table.
Also move plat dev init to a static function.
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-4-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-25 14:51:22 +02:00
e76064e34a
platform/x86/amd/hsmp: Create static func to handle platdev
...
Create a static function and call platform device alloc and add device,
which will simplify handling acpi and plat device probing.
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-3-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-25 14:51:17 +02:00
287a821c76
platform/x86/amd/hsmp: Cache pci_dev in struct hsmp_socket
...
Cache pci_dev obj during probe as part of struct hsmp_socket
and use in amd_hsmp_rdwr(). This change will make it easier to
support both non-ACPI and ACPI devices.
Also add a check for sock_index agsint number of sockets
in the hsmp_send_message().
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-2-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-25 14:51:12 +02:00
e6100ef3c0
platform/x86/amd/hsmp: Move hsmp_test to probe
...
This is in advance to supporting ACPI based probe.
In case of non-ACPI driver, hsmp_test() can be
performed either in plat init() or in probe().
however, in case of ACPI probing, hsmp_test() cannot
be called in init(), as the mailbox reg offsets and
base addresses are read from ACPI table in the probe().
Hence, move hsmp_test() to probe as preparation for
ACPI support.
Also use hsmp_send_message() directly in hsmp_test()
as the semaphore is already initialized in probe.
Signed-off-by: Suma Hegde <suma.hegde@amd.com >
Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com >
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20240106022532.1746932-1-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2024-01-25 14:51:05 +02:00
236f7d8034
platform/x86/amd/pmc: Modify SMU message port for latest AMD platform
...
The latest platforms use a different SMU message port(0x938) from the one
currently being used (0x538). Make code changes to adapt to this new
information.
Signed-off-by: Sanket Goswami <Sanket.Goswami@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://lore.kernel.org/r/20231228102104.1785383-7-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-02 13:40:31 +01:00
d33e992ec8
platform/x86/amd/pmc: Add 1Ah family series to STB support list
...
AMD newer platforms, (AMDI000A or family 1Ah series) also supports the STB
functionality. Add this to amd_pmc_is_stb_supported().
Signed-off-by: Sanket Goswami <Sanket.Goswami@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://lore.kernel.org/r/20231228102104.1785383-6-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-02 13:40:29 +01:00
9ae57d8860
platform/x86/amd/pmc: Add idlemask support for 1Ah family
...
Idlemask is an indication of each IP block current state (i.e. whether it
is running or idle) during s2idle transistion. The newer 1Ah family
supports this feature, add it to the support list.
Signed-off-by: Sanket Goswami <Sanket.Goswami@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://lore.kernel.org/r/20231228102104.1785383-5-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-02 13:40:27 +01:00
13313c1352
platform/x86/amd/pmc: call amd_pmc_get_ip_info() during driver probe
...
In the current code, amd_pmc_get_ip_info() is being called from
amd_pmc_s2d_init() and that code block gets enabled only when the STB is
being enabled.
But the information from amd_pmc_get_ip_info() will be required outside of
STB usecase. Hence move this call into driver probe sequence.
Signed-off-by: Sanket Goswami <Sanket.Goswami@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://lore.kernel.org/r/20231228102104.1785383-4-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-02 13:40:24 +01:00
d8fb50fe6c
platform/x86/amd/pmc: Add VPE information for AMDI000A platform
...
Latest AMD SoCs has VPE (Video Processing Engine) IP block and the
statistics related to this IP can be obtained as a part of metrics table
information that the PMFW propogates. Add this support for 1Ah family
series.
Signed-off-by: Sanket Goswami <Sanket.Goswami@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://lore.kernel.org/r/20231228102104.1785383-3-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-02 13:40:22 +01:00
9efa2a04ce
platform/x86/amd/pmc: Send OS_HINT command for AMDI000A platform
...
To initiate the HW deep state transistion the OS_HINT command has to be
sent the PMFW. Add this support to the platforms that has AMDI000A
support.
Signed-off-by: Sanket Goswami <Sanket.Goswami@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://lore.kernel.org/r/20231228102104.1785383-2-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-02 13:40:13 +01:00
4527898e30
platform/x86/amd/pmf: Return a status code only as a constant in two functions
...
Return a status code without storing it in an intermediate variable.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net >
Link: https://lore.kernel.org/r/0d0c4876-37d7-4bee-912e-56324495454f@web.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-02 13:32:22 +01:00
9dd3f1ef40
platform/x86/amd/pmf: Return directly after a failed apmf_if_call() in apmf_sbios_heartbeat_notify()
...
The kfree() function was called in one case by
the apmf_sbios_heartbeat_notify() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.
* Thus return directly after a call of the function “apmf_if_call” failed
at the beginning.
* Delete the label “out” which became unnecessary with this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net >
Link: https://lore.kernel.org/r/362ee824-fc53-4e19-9529-8b621657635b@web.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2024-01-02 13:32:14 +01:00
2ad815797e
Merge tag 'platform-drivers-x86-v6.7-6' into pdx86/for-next
...
Merge the 'platform-drivers-x86-v6.7-6' fixes into pdx86/for-next
so that the "Intel PMC GBE LTR regression" fixes can also be
applied to the new Arrow Lake and Lunar Lake platform support
code in pdx86/for-next .
2024-01-02 13:13:01 +01:00
a55bdad5df
platform/x86/amd/pmc: Disable keyboard wakeup on AMD Framework 13
...
The Laptop 13 (AMD Ryzen 7040Series) BIOS 03.03 has a workaround
included in the EC firmware that will cause the EC to emit a "spurious"
keypress during the resume from s0i3 [1].
This series of keypress events can be observed in the kernel log on
resume.
```
atkbd serio0: Unknown key pressed (translated set 2, code 0x6b on isa0060/serio0).
atkbd serio0: Use 'setkeycodes 6b <keycode>' to make it known.
atkbd serio0: Unknown key released (translated set 2, code 0x6b on isa0060/serio0).
atkbd serio0: Use 'setkeycodes 6b <keycode>' to make it known.
```
In some user flows this is harmless, but if a user has specifically
suspended the laptop and then closed the lid it will cause the laptop
to wakeup. The laptop wakes up because the ACPI SCI triggers when
the lid is closed and when the kernel sees that IRQ1 is "also" active.
The kernel can't distinguish from a real keyboard keypress and wakes the
system.
Add the model into the list of quirks to disable keyboard wakeup source.
This is intentionally only matching the production BIOS version in hopes
that a newer EC firmware included in a newer BIOS can avoid this behavior.
Cc: Kieran Levin <ktl@framework.net >
Link: https://github.com/FrameworkComputer/EmbeddedController/blob/lotus-zephyr/zephyr/program/lotus/azalea/src/power_sequence.c#L313 [1]
Link: https://community.frame.work/t/amd-wont-sleep-properly/41755
Link: https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20231212045006.97581-5-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2023-12-18 15:08:19 +02:00
b614a4bd73
platform/x86/amd/pmc: Move keyboard wakeup disablement detection to pmc-quirks
...
Other platforms may need to disable keyboard wakeup besides Cezanne,
so move the detection into amd_pmc_quirks_init() where it may be applied
to multiple platforms.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20231212045006.97581-4-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2023-12-18 15:08:17 +02:00
2d53c0ab61
platform/x86/amd/pmc: Only run IRQ1 firmware version check on Cezanne
...
amd_pmc_wa_czn_irq1() only runs on Cezanne platforms currently but
may be extended to other platforms in the future. Rename the function
and only check platform firmware version when it's called for a Cezanne
based platform.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20231212045006.97581-3-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2023-12-18 15:08:16 +02:00
85980669a8
platform/x86/amd/pmc: Move platform defines to header
...
The platform defines will be used by the quirks in the future,
so move them to the common header to allow use by both source
files.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com >
Link: https://lore.kernel.org/r/20231212045006.97581-2-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
2023-12-18 15:08:13 +02:00
f533fa1422
platform/x86/amd/pmf: dump policy binary data
...
Sometimes policy binary retrieved from the BIOS maybe incorrect that can
end up in failing to enable the Smart PC solution feature.
Use print_hex_dump_debug() to dump the policy binary in hex, so that we
debug the issues related to the binary even before sending that to TA.
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Link: https://lore.kernel.org/r/20231212014705.2017474-13-Shyam-sundar.S-k@amd.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2023-12-18 13:01:01 +01:00
10817f28e5
platform/x86/amd/pmf: Add capability to sideload of policy binary
...
A policy binary is OS agnostic, and the same policies are expected to work
across the OSes. At times it becomes difficult to debug when the policies
inside the policy binaries starts to misbehave. Add a way to sideload such
policies independently to debug them via a debugfs entry.
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com >
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com >
Link: https://lore.kernel.org/r/20231212014705.2017474-12-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com >
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
2023-12-18 13:00:16 +01:00