From: Hans de Goede <hdegoede@redhat.com>
To: Gregory Price <gourry@gourry.net>, Suma Hegde <suma.hegde@amd.com>
Cc: platform-driver-x86@vger.kernel.org,
ilpo.jarvinen@linux.intel.com,
Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Subject: Re: [BUG?] platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers
Date: Sat, 19 Apr 2025 10:59:24 +0200 [thread overview]
Message-ID: <8c0d9751-767f-4e8e-bbf1-bbab89c1b8c9@redhat.com> (raw)
In-Reply-To: <aALZxvHWmphNL1wa@gourry-fedora-PF4VCD3F>
Hi Gregory,
On 19-Apr-25 1:01 AM, Gregory Price wrote:
> On Mon, Oct 21, 2024 at 11:14:25AM +0000, Suma Hegde wrote:
>> diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/amd/hsmp/acpi.c
> ... snip ...
>> +#define DRIVER_NAME "amd_hsmp"
> ... snip ...
>> diff --git a/drivers/platform/x86/amd/hsmp/plat.c b/drivers/platform/x86/amd/hsmp/plat.c
>> +#define DRIVER_NAME "amd_hsmp"
>
> Hi,
>
> From looking around this patch, the code seems to suggest that these
> drivers should not be mutually exclusive, but we are seeing an error
> when attempting to load them both - apparently because they both use the
> same driver name.
>
> Was this intended, or should the DRIVER_NAME="hsmp_acpi" for acpi.c?
These drivers are mutually exclusive in the sense that only one of
them should actually bind to the hw.
Looking at the code this seems not to be guaranteed though ...
drivers/platform/x86/amd/hsmp/plat.c has:
static int __init hsmp_plt_init(void)
{
int ret = -ENODEV;
if (!legacy_hsmp_support()) {
pr_info("HSMP is not supported on Family:%x model:%x\n",
boot_cpu_data.x86, boot_cpu_data.x86_model);
return ret;
}
...
So loading that module should fail on AMD CPUs which fail the
legacy_hsmp_support() check. Which checks CPU family and model.
Since you are seeing the error you are reporting the system you
are testing on does pass that test.
Question, did you manually load hsmp_acpi, or did that auto-load?
Or a totally different way to ask the same thing, do you have
any AMDI0097:0? devices under /sys/bus/platform/devices ?
ATM it seems that the plat.c code assumes that on hw where
legacy_hsmp_support() returns true there will never be an
AMDI0097:0? device which I'm not sure is a safe assumption
to make.
IMHO besides the "if (!legacy_hsmp_support())" check,
hsmp_plt_init() should also do:
if (acpi_dev_present("AMDI0097", NULL, -1))
return -ENODEV;
leaving the HSMP handling up to the hsmp_acpi driver
when an AMDI0097:0? device is present.
Note that the identical driver-name is still an issue even
with this check, because if both checks pass a user could
still manually load hsmp_acpi and get the driver name conflict
error.
Another issue with the driver seems to be that hsmp_acpi_probe()
relies on hsmp_pdev->is_probed to only do some initialization
once, but that is_probed flag is not protected by a mutex,
so when async probing is used 2 hsmp_acpi_probe() calls can
race and make a mess of things.
Regards,
Hans
> ---
>
> diff --git a/drivers/platform/x86/amd/hsmp/acpi.c b/drivers/platform/x86/amd/hsmp/acpi.c
> index e981d45e1c12..871724995897 100644
> --- a/drivers/platform/x86/amd/hsmp/acpi.c
> +++ b/drivers/platform/x86/amd/hsmp/acpi.c
> @@ -26,7 +26,7 @@
>
> #include "hsmp.h"
>
> -#define DRIVER_NAME "amd_hsmp"
> +#define DRIVER_NAME "hsmp_acpi"
> #define DRIVER_VERSION "2.3"
> #define ACPI_HSMP_DEVICE_HID "AMDI0097"
>
next prev parent reply other threads:[~2025-04-19 8:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 11:14 [v10 01/11] platform/x86/amd/hsmp: Create hsmp/ directory Suma Hegde
2024-10-21 11:14 ` [v10 02/11] platform/x86/amd/hsmp: Create wrapper function init_acpi() Suma Hegde
2024-10-21 11:14 ` [v10 03/11] platform/x86/amd/hsmp: Convert amd_hsmp_rdwr() to a function pointer Suma Hegde
2024-10-21 11:14 ` [v10 04/11] platform/x86/amd/hsmp: Move structure and macros to header file Suma Hegde
2024-10-21 11:14 ` [v10 05/11] platform/x86/amd/hsmp: Move platform device specific code to plat.c Suma Hegde
2024-10-21 11:14 ` [v10 06/11] platform/x86/amd/hsmp: Move ACPI code to acpi.c Suma Hegde
2024-10-21 11:14 ` [v10 07/11] platform/x86/amd/hsmp: Change generic plat_dev name to hsmp_pdev Suma Hegde
2024-10-21 11:14 ` [v10 08/11] platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers Suma Hegde
2025-04-18 23:01 ` [BUG?] " Gregory Price
2025-04-19 8:59 ` Hans de Goede [this message]
2025-04-21 10:34 ` Suma Hegde
2025-04-21 15:40 ` Hans de Goede
2025-04-23 10:28 ` Suma Hegde
2024-10-21 11:14 ` [v10 09/11] platform/x86/amd/hsmp: Use name space while exporting module symbols Suma Hegde
2024-10-21 11:14 ` [v10 10/11] platform/x86/amd/hsmp: Use dev_groups in the driver structure Suma Hegde
2024-10-21 11:14 ` [v10 11/11] platform/x86/amd/hsmp: Make hsmp_pdev static instead of global Suma Hegde
2024-10-22 10:37 ` [v10 01/11] platform/x86/amd/hsmp: Create hsmp/ directory 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=8c0d9751-767f-4e8e-bbf1-bbab89c1b8c9@redhat.com \
--to=hdegoede@redhat.com \
--cc=gourry@gourry.net \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=naveenkrishna.chatradhi@amd.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=suma.hegde@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