JIRA: https://issues.redhat.com/browse/RHEL-43368
commit 77f1972bdcf7513293e8bbe376b9fe837310ee9c
Author: Suma Hegde <suma.hegde@amd.com>
Date: Mon Jun 3 08:15:12 2024 +0000
platform/x86/amd/hsmp: Check HSMP support on AMD family of processors
HSMP interface is supported only on few x86 processors from AMD.
Accessing HSMP registers on rest of the platforms might cause
unexpected behaviour. So add a check.
Also unavailability of this interface on rest of the processors
is not an error. Hence, use pr_info() instead of the pr_err() to
log the message.
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Link: https://lore.kernel.org/r/20240603081512.142909-1-suma.hegde@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit 33b0e895aa318c58f54fc2f0b6034c531610e8f0
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Wed Mar 27 09:08:33 2024 +0100
platform/x86/amd/hsmp: switch to use device_add_groups()
devm_device_add_groups() is being removed from the kernel, so move the
hsmp driver to use device_add_groups() instead. The logic is identical,
when the device is removed the driver core will properly clean up and
remove the groups, and the memory used by the attribute groups will be
freed because it was created with dev_* calls, so this is functionally
identical overall.
Cc: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Cc: Carlos Bilbao <carlos.bilbao@amd.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/2024032732-thigh-smite-f5dd@gregkh
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit ef6e98177f8d331cdcbe18125a1e2da82f6ede34
Author: Suma Hegde <suma.hegde@amd.com>
Date: Sat Jan 6 02:25:30 2024 +0000
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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit d2bf115115d556a5a50cec9dd63cb5f64f10de87
Author: Suma Hegde <suma.hegde@amd.com>
Date: Sat Jan 6 02:25:29 2024 +0000
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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit ba8dcff0e9c4f8fa6a46315126fb837acb0f98fc
Author: Suma Hegde <suma.hegde@amd.com>
Date: Sat Jan 6 02:25:28 2024 +0000
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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit ca511e7631e76e02c95cce6cf934e165e0e93a21
Author: Suma Hegde <suma.hegde@amd.com>
Date: Sat Jan 6 02:25:27 2024 +0000
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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit ce08d3570ae0ef3e8b011d8bd4722b7b413c476b
Author: Suma Hegde <suma.hegde@amd.com>
Date: Sat Jan 6 02:25:26 2024 +0000
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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit 17998b3e529bf161bb6ab52c7aafb8a9e2270a7f
Author: Suma Hegde <suma.hegde@amd.com>
Date: Sat Jan 6 02:25:25 2024 +0000
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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit e76064e34a371731e3f0da13ffbda16f6e51a202
Author: Suma Hegde <suma.hegde@amd.com>
Date: Sat Jan 6 02:25:24 2024 +0000
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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit 287a821c76be80d69d9a82a94147d0daa5232a4b
Author: Suma Hegde <suma.hegde@amd.com>
Date: Sat Jan 6 02:25:23 2024 +0000
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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-43368
commit e6100ef3c0bf52e801d08d247cea93cfa73a0d31
Author: Suma Hegde <suma.hegde@amd.com>
Date: Sat Jan 6 02:25:22 2024 +0000
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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-16017
commit 02a258ac3ebf8a530d340ec24a694c13ac9d25c0
Author: Armin Wolf <W_Armin@gmx.de>
Date: Thu Oct 19 15:51:22 2023 +0200
platform/x86/amd/hsmp: Fix iomem handling
Since the metrics table is marked as io memory, use memcpy_fromio()
when copying its contents.
Compile-tested only.
Fixes: 5150542b8ec5 ("platform/x86/amd/hsmp: add support for metrics tbl")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20231019135122.21774-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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-16017
commit 48173b0003c5dc556e262e1b57c25efc36db1c6a
Author: Suma Hegde <suma.hegde@amd.com>
Date: Tue Oct 10 12:03:10 2023 +0000
platform/x86/amd/hsmp: improve the error log
1. Change print message during platform init to a more meaningful
clear message.
2. Return the error code returned by hsmp_test() itself, rather then
returning a common EOPNOTSUPP error.
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <nchatrad@amd.com>
Link: https://lore.kernel.org/r/20231010120310.3464066-3-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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-16017
commit 5150542b8ec5fb561be080ed0ef3bab8598154c3
Author: Suma Hegde <suma.hegde@amd.com>
Date: Tue Oct 10 12:03:09 2023 +0000
platform/x86/amd/hsmp: add support for metrics tbl
AMD MI300 MCM provides GET_METRICS_TABLE message to retrieve
all the system management information from SMU.
The metrics table is made available as hexadecimal sysfs binary file
under per socket sysfs directory created at
/sys/devices/platform/amd_hsmp/socket%d/metrics_bin
Metrics table definitions will be documented as part of Public PPR.
The same is defined in the amd_hsmp.h header.
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <nchatrad@amd.com>
Link: https://lore.kernel.org/r/20231010120310.3464066-2-suma.hegde@amd.com
[ij: lseek -> lseek(), dram -> DRAM in dev_err()]
[ij: added period to terminate a documentation sentence]
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-16017
commit 01d2adcfe0f1bc0f08d822a04b2c354c106d4d2f
Author: Suma Hegde <suma.hegde@amd.com>
Date: Tue Oct 10 12:03:08 2023 +0000
platform/x86/amd/hsmp: create plat specific struct
Having a separate platform device structure helps in future, to
contain platform specific variables and other data.
Also, define macros for dev nodes
Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <nchatrad@amd.com>
Link: https://lore.kernel.org/r/20231010120310.3464066-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>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-16017
commit 5454b36274fd63e40935975fbd13f4abbb5c5270
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Thu Mar 2 15:47:06 2023 +0100
platform/x86: amd: hsmp: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230302144732.1903781-4-u.kleine-koenig@pengutronix.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David Arcari <darcari@redhat.com>
Conflicts: limited to amd/hsmp.c
JIRA: https://issues.redhat.com/browse/RHEL-16017
commit 8d05fc039456517d2c246c7b202891188ba40c4d
Author: Barnabás Pőcze <pobrn@protonmail.com>
Date: Fri Sep 30 10:59:14 2022 +0000
platform/x86: use PLATFORM_DEVID_NONE instead of -1
Use the `PLATFORM_DEVID_NONE` constant instead of
hard-coding -1 when creating a platform device.
No functional changes are intended.
Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Link: https://lore.kernel.org/r/20220930104857.2796923-1-pobrn@protonmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David Arcari <darcari@redhat.com>
JIRA: https://issues.redhat.com/browse/RHEL-16017
Conflicts: This commit was already applied for amd-pmc.c so adding the
amd-hsmp.c portions now.
commit ef233eafe5adc54ddc39a1b6cc483dddc744bf97
Author: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Date: Thu Jun 9 01:02:12 2022 +0530
platform/x86: Move AMD platform drivers to separate directory
Currently, AMD supported platform drivers are grouped under generic "x86"
folder structure. Move the current drivers (amd-pmc and amd_hsmp) to a
separate directory. This would also mean the newer driver submissions to
pdx86 subsystem in the future will also land in AMD specific directory.
Reviewed-by: Naveen Krishna Chatradhi <NaveenKrishna.Chatradhi@amd.com>
Tested-by: Suma Hegde <suma.hegde@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://lore.kernel.org/r/20220608193212.2827257-1-Shyam-sundar.S-k@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David Arcari <darcari@redhat.com>