From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <lenb@kernel.org>, Joerg Roedel <joro@8bytes.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Will Deacon <will@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Lu Baolu <baolu.lu@linux.intel.com>,
David Woodhouse <dwmw2@infradead.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
"open list:AMD IOMMU (AMD-VI)" <iommu@lists.linux-foundation.org>,
virtualization@lists.linux-foundation.org,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
Eric Auger <eric.auger@redhat.com>,
sebastien.boeuf@intel.com, Robin Murphy <robin.murphy@arm.com>,
kevin.tian@intel.com,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Hanjun Guo <guohanjun@huawei.com>,
Sudeep Holla <sudeep.holla@arm.com>
Subject: Re: [PATCH v4 3/6] ACPI: Add driver for the VIOT table
Date: Fri, 18 Jun 2021 09:54:28 +0200 [thread overview]
Message-ID: <YMxRNHVjKk3H6r7t@myrica> (raw)
In-Reply-To: <CAJZ5v0gTZDyEC7MuBEv2gg6Usq+PD-WEQJbiAqKrFC3KV-M52g@mail.gmail.com>
On Thu, Jun 17, 2021 at 01:50:59PM +0200, Rafael J. Wysocki wrote:
> > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> > index be7da23fad76..b835ca702ff0 100644
> > --- a/drivers/acpi/bus.c
> > +++ b/drivers/acpi/bus.c
> > @@ -27,6 +27,7 @@
> > #include <linux/dmi.h>
> > #endif
> > #include <linux/acpi_iort.h>
> > +#include <linux/acpi_viot.h>
> > #include <linux/pci.h>
> > #include <acpi/apei.h>
> > #include <linux/suspend.h>
> > @@ -1339,6 +1340,7 @@ static int __init acpi_init(void)
> > pci_mmcfg_late_init();
> > acpi_iort_init();
> > acpi_scan_init();
> > + acpi_viot_init();
>
> Is there a specific reason why to call it right here?
>
> In particular, does it need to be called after acpi_scan_init()? And
> does it need to be called before the subsequent functions? If so,
> then why?
It does need to be called after acpi_scan_init(), because it relies on
struct device and their fwnode to be initialized. In particular to find a
PCI device we call pci_get_domain_bus_and_slot(), which needs the PCI
topology made available by acpi_scan_init().
It does not need to be before the subsequent functions however, I can move
it at the end.
> > +void __init acpi_viot_init(void)
> > +{
> > + int i;
> > + acpi_status status;
> > + struct acpi_table_header *hdr;
> > + struct acpi_viot_header *node;
> > +
> > + status = acpi_get_table(ACPI_SIG_VIOT, 0, &hdr);
> > + if (ACPI_FAILURE(status)) {
> > + if (status != AE_NOT_FOUND) {
> > + const char *msg = acpi_format_exception(status);
> > +
> > + pr_err("Failed to get table, %s\n", msg);
> > + }
> > + return;
> > + }
> > +
> > + viot = (void *)hdr;
> > +
> > + node = ACPI_ADD_PTR(struct acpi_viot_header, viot, viot->node_offset);
> > + for (i = 0; i < viot->node_count; i++) {
> > + if (viot_parse_node(node))
> > + return;
> > +
> > + node = ACPI_ADD_PTR(struct acpi_viot_header, node,
> > + node->length);
> > + }
>
> Do you still need the table after the above is complete? If not,
> release the reference on it acquired above.
We don't need the table anymore, I'll drop the reference
Thanks,
Jean
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-06-18 8:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-10 7:51 [PATCH v4 0/6] Add support for ACPI VIOT Jean-Philippe Brucker
2021-06-10 7:51 ` [PATCH v4 1/6] ACPI: arm64: Move DMA setup operations out of IORT Jean-Philippe Brucker
2021-06-16 9:35 ` Eric Auger
2021-06-10 7:51 ` [PATCH v4 2/6] ACPI: Move IOMMU setup code " Jean-Philippe Brucker
2021-06-16 9:35 ` Eric Auger
2021-06-18 7:41 ` Jean-Philippe Brucker
2021-06-18 9:16 ` Robin Murphy
2021-06-10 7:51 ` [PATCH v4 3/6] ACPI: Add driver for the VIOT table Jean-Philippe Brucker
2021-06-16 13:26 ` Eric Auger
2021-06-18 7:43 ` Jean-Philippe Brucker
2021-06-17 11:50 ` Rafael J. Wysocki
2021-06-18 7:54 ` Jean-Philippe Brucker [this message]
2021-06-10 7:51 ` [PATCH v4 4/6] iommu/dma: Pass address limit rather than size to iommu_setup_dma_ops() Jean-Philippe Brucker
2021-06-16 15:28 ` Eric Auger
2021-06-18 9:18 ` Jean-Philippe Brucker
2021-06-10 7:51 ` [PATCH v4 5/6] iommu/dma: Simplify calls " Jean-Philippe Brucker
2021-06-16 15:50 ` Eric Auger
2021-06-16 17:02 ` Robin Murphy
2021-06-18 10:50 ` Jean-Philippe Brucker
2021-06-18 11:19 ` Robin Murphy
2021-06-10 7:51 ` [PATCH v4 6/6] iommu/virtio: Enable x86 support Jean-Philippe Brucker
2021-06-16 15:52 ` Eric Auger
2021-06-16 6:34 ` [PATCH v4 0/6] Add support for ACPI VIOT Jean-Philippe Brucker
2021-06-16 12:40 ` Eric Auger
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=YMxRNHVjKk3H6r7t@myrica \
--to=jean-philippe@linaro.org \
--cc=baolu.lu@linux.intel.com \
--cc=catalin.marinas@arm.com \
--cc=dwmw2@infradead.org \
--cc=eric.auger@redhat.com \
--cc=guohanjun@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mst@redhat.com \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=robin.murphy@arm.com \
--cc=sebastien.boeuf@intel.com \
--cc=sudeep.holla@arm.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).