The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "M K, Muralidhara" <muralimk@amd.com>
Cc: Muralidhara M K <muralidhara.mk@amd.com>,
	 platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/4] platform/x86/amd/hsmp: Pass struct device explicitly to ACPI mailbox parsers
Date: Mon, 29 Jun 2026 17:52:28 +0300 (EEST)	[thread overview]
Message-ID: <368950aa-c12f-5dfe-93cc-dc8d4854e340@linux.intel.com> (raw)
In-Reply-To: <fa120fd2-3ebd-4ef9-9882-773123ab2505@amd.com>

[-- Attachment #1: Type: text/plain, Size: 5854 bytes --]

On Mon, 29 Jun 2026, M K, Muralidhara wrote:
> On 6/29/2026 6:16 PM, Ilpo Järvinen wrote:
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> > 
> > 
> > On Mon, 29 Jun 2026, Muralidhara M K wrote:
> > 
> > > hsmp_read_acpi_crs() and hsmp_read_acpi_dsd() read the ACPI handle and
> > > emit error messages via sock->dev.  Pass the struct device explicitly to
> > > both helpers instead of reading it back from sock->dev.
> > > 
> > > This is a pure refactor with no functional change; it prepares for
> > > publishing sock->dev as the data-plane readiness gate only after the
> > > socket has been fully initialized, so the parsers must not depend on
> > > sock->dev already being set.
> > > 
> > > Signed-off-by: Muralidhara M K <muralidhara.mk@amd.com>
> > > Link:
> > > https://lore.kernel.org/platform-driver-x86/20260625123337.886435-5-muralidhara.mk@amd.com/T/#u
> > > [1]
> > > ---
> > >   drivers/platform/x86/amd/hsmp/acpi.c | 22 +++++++++++-----------
> > >   1 file changed, 11 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/drivers/platform/x86/amd/hsmp/acpi.c
> > > b/drivers/platform/x86/amd/hsmp/acpi.c
> > > index 8c3185ae6395..f7fbba4c6b66 100644
> > > --- a/drivers/platform/x86/amd/hsmp/acpi.c
> > > +++ b/drivers/platform/x86/amd/hsmp/acpi.c
> > > @@ -107,7 +107,7 @@ static acpi_status hsmp_resource(struct acpi_resource
> > > *res, void *data)
> > >        return AE_OK;
> > >   }
> > > 
> > > -static int hsmp_read_acpi_dsd(struct hsmp_socket *sock)
> > > +static int hsmp_read_acpi_dsd(struct hsmp_socket *sock, struct device
> > > *dev)
> > >   {
> > >        struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
> > >        union acpi_object *guid, *mailbox_package;
> > > @@ -116,10 +116,10 @@ static int hsmp_read_acpi_dsd(struct hsmp_socket
> > > *sock)
> > >        int ret = 0;
> > >        int j;
> > > 
> > > -     status = acpi_evaluate_object_typed(ACPI_HANDLE(sock->dev), "_DSD",
> > > NULL,
> > > +     status = acpi_evaluate_object_typed(ACPI_HANDLE(dev), "_DSD", NULL,
> > >                                            &buf, ACPI_TYPE_PACKAGE);
> > >        if (ACPI_FAILURE(status)) {
> > > -             dev_err(sock->dev, "Failed to read mailbox reg offsets from
> > > DSD table, err: %s\n",
> > > +             dev_err(dev, "Failed to read mailbox reg offsets from DSD
> > > table, err: %s\n",
> > >                        acpi_format_exception(status));
> > >                return -ENODEV;
> > >        }
> > > @@ -142,7 +142,7 @@ static int hsmp_read_acpi_dsd(struct hsmp_socket
> > > *sock)
> > >        guid = &dsd->package.elements[0];
> > >        mailbox_package = &dsd->package.elements[1];
> > >        if (!is_acpi_hsmp_uuid(guid) || mailbox_package->type !=
> > > ACPI_TYPE_PACKAGE) {
> > > -             dev_err(sock->dev, "Invalid hsmp _DSD table data\n");
> > > +             dev_err(dev, "Invalid hsmp _DSD table data\n");
> > >                ret = -EINVAL;
> > >                goto free_buf;
> > >        }
> > > @@ -192,14 +192,14 @@ static int hsmp_read_acpi_dsd(struct hsmp_socket
> > > *sock)
> > >        return ret;
> > >   }
> > > 
> > > -static int hsmp_read_acpi_crs(struct hsmp_socket *sock)
> > > +static int hsmp_read_acpi_crs(struct hsmp_socket *sock, struct device
> > > *dev)
> > >   {
> > >        acpi_status status;
> > > 
> > > -     status = acpi_walk_resources(ACPI_HANDLE(sock->dev),
> > > METHOD_NAME__CRS,
> > > +     status = acpi_walk_resources(ACPI_HANDLE(dev), METHOD_NAME__CRS,
> > >                                     hsmp_resource, sock);
> > >        if (ACPI_FAILURE(status)) {
> > > -             dev_err(sock->dev, "Failed to look up MP1 base address from
> > > CRS method, err: %s\n",
> > > +             dev_err(dev, "Failed to look up MP1 base address from CRS
> > > method, err: %s\n",
> > >                        acpi_format_exception(status));
> > >                return -EINVAL;
> > >        }
> > > @@ -207,10 +207,10 @@ static int hsmp_read_acpi_crs(struct hsmp_socket
> > > *sock)
> > >                return -EINVAL;
> > > 
> > >        /* The mapped region should be un-cached */
> > > -     sock->virt_base_addr = devm_ioremap_uc(sock->dev,
> > > sock->mbinfo.base_addr,
> > > +     sock->virt_base_addr = devm_ioremap_uc(dev, sock->mbinfo.base_addr,
> > >                                               sock->mbinfo.size);
> > >        if (!sock->virt_base_addr) {
> > > -             dev_err(sock->dev, "Failed to ioremap MP1 base address\n");
> > > +             dev_err(dev, "Failed to ioremap MP1 base address\n");
> > >                return -ENOMEM;
> > >        }
> > > 
> > > @@ -232,12 +232,12 @@ static int hsmp_parse_acpi_table(struct device *dev,
> > > u16 sock_ind)
> > >        dev_set_drvdata(dev, sock);
> > > 
> > >        /* Read MP1 base address from CRS method */
> > > -     ret = hsmp_read_acpi_crs(sock);
> > > +     ret = hsmp_read_acpi_crs(sock, dev);
> > >        if (ret)
> > >                return ret;
> > > 
> > >        /* Read mailbox offsets from DSD table */
> > > -     return hsmp_read_acpi_dsd(sock);
> > > +     return hsmp_read_acpi_dsd(sock, dev);
> > 
> > It would probably make more sense to have the arguments other way around
> > (dev, sock) in both of these calls as dev is "complete" and we're still
> > filling sock at this point.
> > 
> Thanks I will fix this.
> 
> Ilpo, could you please confirm whether patches 0001 and 0002 have already been
> accepted in the maintainer branch, or if I should resubmit them as v2 along
> with patches 0003 and 0004 ?

I've not applied any patches yet in this cycle so please resubmit the 
whole series.

-- 
 i.

  reply	other threads:[~2026-06-29 14:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  7:39 [PATCH 0/4] platform/x86/amd/hsmp: ACPI input hardening and data-plane readiness gating Muralidhara M K
2026-06-29  7:39 ` [PATCH 1/4] platform/x86/amd/hsmp: Validate ACPI UID before parsing socket index Muralidhara M K
2026-06-29  7:39 ` [PATCH 2/4] platform/x86/amd/hsmp: Validate _DSD mailbox sub-package element count Muralidhara M K
2026-06-29  7:39 ` [PATCH 3/4] platform/x86/amd/hsmp: Pass struct device explicitly to ACPI mailbox parsers Muralidhara M K
2026-06-29 12:46   ` Ilpo Järvinen
2026-06-29 14:07     ` M K, Muralidhara
2026-06-29 14:52       ` Ilpo Järvinen [this message]
2026-06-29  7:39 ` [PATCH 4/4] platform/x86/amd/hsmp: Gate the data plane on a fully initialized socket Muralidhara M K
2026-06-29 12:50   ` 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=368950aa-c12f-5dfe-93cc-dc8d4854e340@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muralidhara.mk@amd.com \
    --cc=muralimk@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