Re: [PATCH v2.2] x86/amd_node, platform/x86/amd/hsmp: Have HSMP use SMN through AMD_NODE
From: Yazen Ghannam
Date: Mon Dec 16 2024 - 13:34:08 EST
On Sat, Dec 14, 2024 at 11:05:07AM +0100, Borislav Petkov wrote:
> On Fri, Dec 13, 2024 at 03:22:06PM +0000, Yazen Ghannam wrote:
> > The HSMP interface is just an SMN interface with different offsets.
> >
> > Define an HSMP wrapper in the SMN code and have the HSMP platform driver
> > use that rather than a local solution.
> >
> > Also, remove the "root" member from AMD_NB, since there are no more
> > users of it.
> >
> > Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
> > ---
> >
> > Notes:
> > Link:
> > https://lore.kernel.org/20241212172711.1944927-1-yazen.ghannam@xxxxxxx
> >
> > v2.1-v2.2:
> > * Include <linux/build_bug.h> for static_assert()
> >
> > v2->v2.1:
> > * Include static_assert() and comment for sysfs attributes.
> >
> > v1->v2:
> > * Rebase on recent HSMP rework.
> >
> > arch/x86/include/asm/amd_nb.h | 1 -
> > arch/x86/include/asm/amd_node.h | 3 +++
> > arch/x86/kernel/amd_nb.c | 1 -
> > arch/x86/kernel/amd_node.c | 9 +++++++
> > drivers/platform/x86/amd/hsmp/Kconfig | 2 +-
> > drivers/platform/x86/amd/hsmp/acpi.c | 7 +++---
> > drivers/platform/x86/amd/hsmp/hsmp.c | 1 -
> > drivers/platform/x86/amd/hsmp/hsmp.h | 3 ---
> > drivers/platform/x86/amd/hsmp/plat.c | 36 +++++++++------------------
> > 9 files changed, 29 insertions(+), 34 deletions(-)
>
> ld: drivers/platform/x86/amd/hsmp/plat.o: in function `amd_hsmp_pci_rdwr':
> /home/amd/kernel/linux/drivers/platform/x86/amd/hsmp/plat.c:44: undefined reference to `amd_smn_hsmp_rdwr'
> make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
> make[1]: *** [/home/amd/bpetkov/kernel/linux/Makefile:1225: vmlinux] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:251: __sub-make] Error 2
>
> Config attached.
>
I think the fix is this:
diff --git a/drivers/platform/x86/amd/hsmp/Kconfig b/drivers/platform/x86/amd/hsmp/Kconfig
index d6f7a62d55b5..fc90ef11a8ad 100644
--- a/drivers/platform/x86/amd/hsmp/Kconfig
+++ b/drivers/platform/x86/amd/hsmp/Kconfig
@@ -7,7 +7,6 @@ config AMD_HSMP
tristate
menu "AMD HSMP Driver"
- depends on AMD_NODE || COMPILE_TEST
config AMD_HSMP_ACPI
tristate "AMD HSMP ACPI device driver"
@@ -29,6 +28,7 @@ config AMD_HSMP_ACPI
config AMD_HSMP_PLAT
tristate "AMD HSMP platform device driver"
+ depends on AMD_NODE
select AMD_HSMP
help
Host System Management Port (HSMP) interface is a mailbox interface
With all the recent rework, only AMD_HSMP_PLAT has a hard dependency on
AMD_NODE due to needing the SMN register access interface.
Various HSMP files still pull in <asm/amd_node.h>, but they just need
defines and an inline function.
It seems COMPILE_TEST is not needed, since this change allows
AMD_HSMP_ACPI to build without AMD_NODE which seems like the intent.
Thoughts from Platform/HSMP folks? I can send another revision if this
is okay.
Thanks,
Yazen