Re: [PATCH 3/4] platform/x86/amd/hsmp: Pass struct device explicitly to ACPI mailbox parsers

From: Ilpo Järvinen

Date: Mon Jun 29 2026 - 10:55:37 EST


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@xxxxxxx>
> > > Link:
> > > https://lore.kernel.org/platform-driver-x86/20260625123337.886435-5-muralidhara.mk@xxxxxxx/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.