From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Suma Hegde <Suma.Hegde@amd.com>
Cc: Borislav Petkov <bp@alien8.de>,
x86@kernel.org, tony.luck@intel.com, mario.limonciello@amd.com,
bhelgaas@google.com, jdelvare@suse.com, linux@roeck-us.net,
clemens@ladisch.de, Shyam-sundar.S-k@amd.com,
hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com,
naveenkrishna.chatradhi@amd.com, linux-kernel@vger.kernel.org,
linux-edac@vger.kernel.org, linux-pci@vger.kernel.org,
linux-hwmon@vger.kernel.org, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v2.2] x86/amd_node, platform/x86/amd/hsmp: Have HSMP use SMN through AMD_NODE
Date: Thu, 2 Jan 2025 15:04:11 -0500 [thread overview]
Message-ID: <20250102200411.GA230071@yaz-khff2.amd.com> (raw)
In-Reply-To: <3a616457-7f8e-4add-a363-58dea914e3da@amd.com>
On Tue, Dec 24, 2024 at 06:44:17AM +0530, Suma Hegde wrote:
> Hi Yazen,
>
>
> On 12/17/2024 12:03 AM, Yazen Ghannam wrote:
> > 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@amd.com>
> > > > ---
> > > >
> > > > Notes:
> > > > Link:
> > > > https://lore.kernel.org/20241212172711.1944927-1-yazen.ghannam@amd.com
> > > > 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.
>
> COMPILE_TEST was added to provide build coverage to HSMP based on Ilpo's
> suggestion.
>
> We can probably add #ifdef CONFIG_AMD_NODE and #else as below to fix this
> instead of removing COMPILE_TEST?
>
> #ifdef CONFIG_AMD_NODE
> /* Should only be used by the HSMP driver. */
> int __must_check amd_smn_hsmp_rdwr(u16 node, u32 address, u32 *value, bool
> write);
> #else
> static int amd_smn_hsmp_rdwr(u16 node, u32 address, u32 *value, bool write);
> {
> return 0;
> }
>
> #endif
>
> May be Ilpo can comment more.
>
Thanks Suma for the feedback.
If the intent is to increase build coverage, then I think AMD_HSMP_ACPI
also needs COMPILE_TEST.
We could do the following in addition to the #ifdef.
---
drivers/platform/x86/amd/hsmp/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/amd/hsmp/Kconfig b/drivers/platform/x86/amd/hsmp/Kconfig
index d6f7a62d55b5..b60933806eed 100644
--- a/drivers/platform/x86/amd/hsmp/Kconfig
+++ b/drivers/platform/x86/amd/hsmp/Kconfig
@@ -7,11 +7,10 @@ config AMD_HSMP
tristate
menu "AMD HSMP Driver"
- depends on AMD_NODE || COMPILE_TEST
config AMD_HSMP_ACPI
tristate "AMD HSMP ACPI device driver"
- depends on ACPI
+ depends on ACPI || COMPILE_TEST
select AMD_HSMP
help
Host System Management Port (HSMP) interface is a mailbox interface
@@ -29,6 +28,7 @@ config AMD_HSMP_ACPI
config AMD_HSMP_PLAT
tristate "AMD HSMP platform device driver"
+ depends on AMD_NODE || COMPILE_TEST
select AMD_HSMP
help
Host System Management Port (HSMP) interface is a mailbox interface
--
The scope of AMD_NODE is reduced to only what needs it. And each option
can be independently built to increase coverage.
How does this sound?
Thanks,
Yazen
next prev parent reply other threads:[~2025-01-02 20:04 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 16:11 [PATCH v2 00/16] AMD NB and SMN rework Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 01/16] x86/mce/amd: Remove shared threshold bank plumbing Yazen Ghannam
2025-01-03 18:18 ` [tip: ras/core] " tip-bot2 for Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 02/16] x86/amd_nb: Restrict init function to AMD-based systems Yazen Ghannam
2025-01-09 9:15 ` [tip: x86/misc] " tip-bot2 for Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 03/16] x86/amd_nb: Clean up early_is_amd_nb() Yazen Ghannam
2025-01-09 9:15 ` [tip: x86/misc] " tip-bot2 for Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 04/16] x86: Start moving AMD Node functionality out of AMD_NB Yazen Ghannam
2025-01-09 9:15 ` [tip: x86/misc] x86: Start moving AMD node " tip-bot2 for Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 05/16] x86/amd_nb: Simplify function 4 search Yazen Ghannam
2025-01-09 9:15 ` [tip: x86/misc] " tip-bot2 for Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 06/16] x86/amd_nb: Simplify root device search Yazen Ghannam
2025-01-09 9:15 ` [tip: x86/misc] " tip-bot2 for Yazen Ghannam
2024-12-06 16:12 ` [PATCH v2 07/16] x86/amd_nb: Use topology info to get AMD node count Yazen Ghannam
2024-12-06 16:12 ` [PATCH v2 08/16] x86/amd_nb: Simplify function 3 search Yazen Ghannam
2024-12-06 16:12 ` [PATCH v2 09/16] x86/amd_nb, hwmon: (k10temp): Simplify amd_pci_dev_to_node_id() Yazen Ghannam
2024-12-06 16:38 ` Guenter Roeck
2025-01-09 9:15 ` [tip: x86/misc] " tip-bot2 for Mario Limonciello
2024-12-06 16:12 ` [PATCH v2 10/16] x86/amd_nb: Move SMN access code to a new amd_node driver Yazen Ghannam
2024-12-09 13:35 ` Ilpo Järvinen
2025-01-09 9:15 ` [tip: x86/misc] " tip-bot2 for Mario Limonciello
2024-12-06 16:12 ` [PATCH v2 11/16] x86/amd_node: Update __amd_smn_rw() error paths Yazen Ghannam
2025-01-09 9:15 ` [tip: x86/misc] " tip-bot2 for Yazen Ghannam
2024-12-06 16:12 ` [PATCH v2 12/16] x86/amd_node: Remove dependency on AMD_NB Yazen Ghannam
2025-01-09 9:15 ` [tip: x86/misc] " tip-bot2 for Yazen Ghannam
2024-12-06 16:12 ` [PATCH v2 13/16] x86/amd_node: Use defines for SMN register offsets Yazen Ghannam
2025-01-09 9:15 ` [tip: x86/misc] " tip-bot2 for Yazen Ghannam
2024-12-06 16:12 ` [PATCH v2 14/16] x86/amd_node, platform/x86/amd/hsmp: Have HSMP use SMN through AMD_NODE Yazen Ghannam
2024-12-09 13:32 ` Ilpo Järvinen
2024-12-11 16:13 ` Yazen Ghannam
2024-12-12 17:27 ` [PATCH v2.1] " Yazen Ghannam
2024-12-12 18:50 ` Ilpo Järvinen
2024-12-12 21:46 ` Yazen Ghannam
2024-12-16 13:57 ` Ilpo Järvinen
2024-12-13 15:22 ` [PATCH v2.2] " Yazen Ghannam
2024-12-14 10:05 ` Borislav Petkov
2024-12-16 18:33 ` Yazen Ghannam
2024-12-24 1:14 ` Suma Hegde
2025-01-02 20:04 ` Yazen Ghannam [this message]
2024-12-06 16:12 ` [PATCH v2 15/16] x86/amd_node: Add SMN offsets to exclusive region access Yazen Ghannam
2024-12-06 16:12 ` [PATCH v2 16/16] x86/amd_node: Add support for debugfs access to SMN registers Yazen Ghannam
2025-01-03 21:49 ` [PATCH v2 00/16] AMD NB and SMN rework Borislav Petkov
2025-01-06 15:38 ` Yazen Ghannam
2025-01-06 16:31 ` Yazen Ghannam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250102200411.GA230071@yaz-khff2.amd.com \
--to=yazen.ghannam@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=Suma.Hegde@amd.com \
--cc=bhelgaas@google.com \
--cc=bp@alien8.de \
--cc=clemens@ladisch.de \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jdelvare@suse.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mario.limonciello@amd.com \
--cc=naveenkrishna.chatradhi@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.