From: Pavan Kondeti <quic_pkondeti@quicinc.com>
To: Pavan Kondeti <quic_pkondeti@quicinc.com>
Cc: "Will Deacon" <will@kernel.org>,
"Vidya Sagar" <vidyas@nvidia.com>,
"Bjorn Helgaas" <helgaas@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Manikanta Maddireddy" <mmaddireddy@nvidia.com>,
"Shanker Donthineni" <sdonthineni@nvidia.com>,
"Krishna Thota" <kthota@nvidia.com>,
"Joerg Roedel" <joro@8bytes.org>
Subject: Re: [Query] ACS enablement in the DT based boot flow
Date: Wed, 6 Nov 2024 11:43:30 +0530 [thread overview]
Message-ID: <f320e311-89ba-4a92-a231-1298ecc94c0b@quicinc.com> (raw)
In-Reply-To: <f551eecc-33fa-4729-b004-64a532493705@quicinc.com>
Hi Will,
On Thu, Jul 18, 2024 at 03:43:18PM +0530, Pavan Kondeti wrote:
> > > The pci_request_acs() in of_iommu_configure(), which happens too late
> > > to affect pci_enable_acs(), was added by 6bf6c24720d3 ("iommu/of:
> > > Request ACS from the PCI core when configuring IOMMU linkage"), so I
> > > cc'd Will and Joerg. I don't know if that *used* to work and got
> > > broken somehow, or if it never worked as intended.
> >
> > I don't have any way to test this, but I'm supportive of having the same
> > flow for DT and ACPI-based flows. Vidya, are you able to cook a patch?
> >
>
> I ran into a similar observation while testing a PCI device assignment
> to a VM. In my configuration, the virtio-iommu is enumerated over the
> PCI transport. So, I am thinking we can't hook pci_request_acs() to an
> IOMMU driver. Does the below patch makes sense?
>
> The patch is tested with a VM and I could see ACS getting enabled and
> separate IOMMU groups are created for the devices attached under
> PCIe root port(s).
>
> The RC/devices with ACS quirks are not suffering from this problem as we
> short circuit ACS capability detection checking in
> pci_acs_enabled()->pci_dev_specific_acs_enabled() . May be this is one
> of the reason why this was not reported/observed by some platforms with
> DT.
>
> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
> index b908fe1ae951..0eeb7abfbcfa 100644
> --- a/drivers/pci/of.c
> +++ b/drivers/pci/of.c
> @@ -123,6 +123,13 @@ bool pci_host_of_has_msi_map(struct device *dev)
> return false;
> }
>
> +bool pci_host_of_has_iommu_map(struct device *dev)
> +{
> + if (dev && dev->of_node)
> + return of_get_property(dev->of_node, "iommu-map", NULL);
> + return false;
> +}
> +
> static inline int __of_pci_pci_compare(struct device_node *node,
> unsigned int data)
> {
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 4c367f13acdc..ea6fcdaf63e2 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -889,6 +889,7 @@ static void pci_set_bus_msi_domain(struct pci_bus *bus)
> dev_set_msi_domain(&bus->dev, d);
> }
>
> +bool pci_host_of_has_iommu(struct device *dev);
> static int pci_register_host_bridge(struct pci_host_bridge *bridge)
> {
> struct device *parent = bridge->dev.parent;
> @@ -951,6 +952,9 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
> !pci_host_of_has_msi_map(parent))
> bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
>
> + if (pci_host_of_has_iommu_map(parent))
> + pci_request_acs();
> +
> if (!parent)
> set_dev_node(bus->bridge, pcibus_to_node(bus));
>
I see that this problem is reproducible with the kernel tip. While preparing
patch submission, I found there was an attempt to fix [1] this problem
earlier but later reverted due to issues reported on linux-next. I did
not see any follow up on the issues. I would like to resend this patch
again as it was acked by people.
Thanks,
Pavan
[1]
https://lore.kernel.org/all/1621566204-37456-1-git-send-email-wangxingang5@huawei.com/
next prev parent reply other threads:[~2024-11-06 6:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 10:40 [Query] ACS enablement in the DT based boot flow Vidya Sagar
2024-04-10 7:40 ` Vidya Sagar
2024-04-10 19:28 ` Bjorn Helgaas
2024-04-28 7:23 ` Will Deacon
2024-07-18 10:13 ` Pavan Kondeti
2024-11-06 6:13 ` Pavan Kondeti [this message]
2024-11-06 15:54 ` Bjorn Helgaas
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=f320e311-89ba-4a92-a231-1298ecc94c0b@quicinc.com \
--to=quic_pkondeti@quicinc.com \
--cc=helgaas@kernel.org \
--cc=joro@8bytes.org \
--cc=kthota@nvidia.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mmaddireddy@nvidia.com \
--cc=rafael@kernel.org \
--cc=sdonthineni@nvidia.com \
--cc=vidyas@nvidia.com \
--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