From: Suma Hegde <Suma.Hegde@amd.com>
To: Yazen Ghannam <yazen.ghannam@amd.com>, Borislav Petkov <bp@alien8.de>
Cc: 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: Tue, 24 Dec 2024 06:44:17 +0530 [thread overview]
Message-ID: <3a616457-7f8e-4add-a363-58dea914e3da@amd.com> (raw)
In-Reply-To: <20241216183338.GA542682@yaz-khff2.amd.com>
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.
>
> Thoughts from Platform/HSMP folks? I can send another revision if this
> is okay.
>
> Thanks,
> Yazen
Thanks and Regards,
Suma
next prev parent reply other threads:[~2024-12-24 1:14 UTC|newest]
Thread overview: 33+ 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
2024-12-06 16:11 ` [PATCH v2 02/16] x86/amd_nb: Restrict init function to AMD-based systems Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 03/16] x86/amd_nb: Clean up early_is_amd_nb() Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 04/16] x86: Start moving AMD Node functionality out of AMD_NB Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 05/16] x86/amd_nb: Simplify function 4 search Yazen Ghannam
2024-12-06 16:11 ` [PATCH v2 06/16] x86/amd_nb: Simplify root device search 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
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
2024-12-06 16:12 ` [PATCH v2 11/16] x86/amd_node: Update __amd_smn_rw() error paths Yazen Ghannam
2024-12-06 16:12 ` [PATCH v2 12/16] x86/amd_node: Remove dependency on AMD_NB Yazen Ghannam
2024-12-06 16:12 ` [PATCH v2 13/16] x86/amd_node: Use defines for SMN register offsets 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 [this message]
2025-01-02 20:04 ` Yazen Ghannam
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=3a616457-7f8e-4add-a363-58dea914e3da@amd.com \
--to=suma.hegde@amd.com \
--cc=Shyam-sundar.S-k@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 \
--cc=yazen.ghannam@amd.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox