From: Suma Hegde <suma.hegde@amd.com>
To: <platform-driver-x86@vger.kernel.org>
Cc: <ilpo.jarvinen@linux.intel.com>, <hdegoede@redhat.com>,
Suma Hegde <suma.hegde@amd.com>,
Naveen Krishna Chatradhi <nchatrad@amd.com>
Subject: [PATCH v2 1/7] platform/x86: Move hsmp_test to probe
Date: Wed, 20 Dec 2023 16:55:22 +0000 [thread overview]
Message-ID: <20231220165528.1351200-2-suma.hegde@amd.com> (raw)
In-Reply-To: <20231220165528.1351200-1-suma.hegde@amd.com>
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>
Changed since v1:
1. Add "Reviewed-by: Hans de Goede <hdegoede@redhat.com>"
---
drivers/platform/x86/amd/hsmp.c | 30 +++++++++++-------------------
1 file changed, 11 insertions(+), 19 deletions(-)
diff --git a/drivers/platform/x86/amd/hsmp.c b/drivers/platform/x86/amd/hsmp.c
index b55d80e29139..3c17b488f4f8 100644
--- a/drivers/platform/x86/amd/hsmp.c
+++ b/drivers/platform/x86/amd/hsmp.c
@@ -244,12 +244,7 @@ EXPORT_SYMBOL_GPL(hsmp_send_message);
static int hsmp_test(u16 sock_ind, u32 value)
{
struct hsmp_message msg = { 0 };
- struct amd_northbridge *nb;
- int ret = -ENODEV;
-
- nb = node_to_amd_nb(sock_ind);
- if (!nb || !nb->root)
- return ret;
+ int ret;
/*
* Test the hsmp port by performing TEST command. The test message
@@ -261,7 +256,7 @@ static int hsmp_test(u16 sock_ind, u32 value)
msg.args[0] = value;
msg.sock_ind = sock_ind;
- ret = __hsmp_send_message(nb->root, &msg);
+ ret = hsmp_send_message(&msg);
if (ret)
return ret;
@@ -504,6 +499,15 @@ static int hsmp_pltdrv_probe(struct platform_device *pdev)
for (i = 0; i < plat_dev.num_sockets; i++) {
sema_init(&plat_dev.sock[i].hsmp_sem, 1);
plat_dev.sock[i].sock_ind = i;
+
+ /* Test the hsmp interface on each socket */
+ ret = hsmp_test(i, 0xDEADBEEF);
+ if (ret) {
+ pr_err("HSMP test message failed on Fam:%x model:%x\n",
+ boot_cpu_data.x86, boot_cpu_data.x86_model);
+ pr_err("Is HSMP disabled in BIOS ?\n");
+ return ret;
+ }
}
plat_dev.hsmp_device.name = HSMP_CDEV_NAME;
@@ -544,7 +548,6 @@ static struct platform_device *amd_hsmp_platdev;
static int __init hsmp_plt_init(void)
{
int ret = -ENODEV;
- int i;
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD || boot_cpu_data.x86 < 0x19) {
pr_err("HSMP is not supported on Family:%x model:%x\n",
@@ -560,17 +563,6 @@ static int __init hsmp_plt_init(void)
if (plat_dev.num_sockets == 0)
return ret;
- /* Test the hsmp interface on each socket */
- for (i = 0; i < plat_dev.num_sockets; i++) {
- ret = hsmp_test(i, 0xDEADBEEF);
- if (ret) {
- pr_err("HSMP test message failed on Fam:%x model:%x\n",
- boot_cpu_data.x86, boot_cpu_data.x86_model);
- pr_err("Is HSMP disabled in BIOS ?\n");
- return ret;
- }
- }
-
ret = platform_driver_register(&amd_hsmp_driver);
if (ret)
return ret;
--
2.25.1
next prev parent reply other threads:[~2023-12-20 16:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-20 16:55 [PATCH v2 0/7] platform/x86: Add ACPI probing support for HSMP Suma Hegde
2023-12-20 16:55 ` Suma Hegde [this message]
2023-12-20 17:04 ` [PATCH v2 1/7] platform/x86: Move hsmp_test to probe Ilpo Järvinen
2023-12-20 16:55 ` [PATCH v2 2/7] platform/x86: Cache pci_dev in struct hsmp_socket Suma Hegde
2023-12-20 17:00 ` Ilpo Järvinen
2023-12-20 16:55 ` [PATCH v2 3/7] platform/x86: Create static func to handle platdev Suma Hegde
2023-12-20 17:08 ` Ilpo Järvinen
2023-12-20 16:55 ` [PATCH v2 4/7] platform/x86: Define a struct to hold mailbox regs Suma Hegde
2023-12-20 17:12 ` Ilpo Järvinen
2023-12-20 16:55 ` [PATCH v2 5/7] platform/x86: Move dev from platdev to hsmp_socket Suma Hegde
2023-12-20 17:18 ` Ilpo Järvinen
2023-12-20 17:20 ` Ilpo Järvinen
2023-12-20 16:55 ` [PATCH v2 6/7] platform/x86: Convert to ACPI based probing Suma Hegde
2023-12-20 17:34 ` Ilpo Järvinen
2023-12-21 10:27 ` Hegde, Suma
2023-12-20 16:55 ` [PATCH v2 7/7] platform/x86: Non-ACPI support for AMD F1A_M00~0Fh Suma Hegde
2023-12-20 17:40 ` Ilpo Järvinen
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=20231220165528.1351200-2-suma.hegde@amd.com \
--to=suma.hegde@amd.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=nchatrad@amd.com \
--cc=platform-driver-x86@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox