From: Jason Gunthorpe <jgg@nvidia.com>
To: Yi Liu <yi.l.liu@intel.com>
Cc: Lu Baolu <baolu.lu@linux.intel.com>,
Bjorn Helgaas <bhelgaas@google.com>,
David Woodhouse <dwmw2@infradead.org>,
iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-pci@vger.kernel.org, Robin Murphy <robin.murphy@arm.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Will Deacon <will@kernel.org>,
patches@lists.linux.dev
Subject: Re: [PATCH] iommu: Allow ATS to work on VFs when the PF uses IDENTITY
Date: Tue, 13 Aug 2024 09:30:41 -0300 [thread overview]
Message-ID: <20240813123041.GU8378@nvidia.com> (raw)
In-Reply-To: <a4760303-02cd-4c4b-bd23-eba4379b2947@intel.com>
On Tue, Aug 13, 2024 at 11:11:01AM +0800, Yi Liu wrote:
> > The simplest solution is to have the iommu driver set the ATS STU when it
> > probes the device. This way the ATS STU is loaded immediately at boot time
> > to all PFs and there is no issue when a VF comes to use it.
>
> This only sets STU without setting the ATS_CTRL.E bit. Is it possible that
> VF considers the PF's STU field as valid only if PF's ATS_CTRL.E bit is
> set?
That doesn't seem to be the case. Do you see something in the spec
that says so?
> > @@ -4091,6 +4091,7 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
> > dev_iommu_priv_set(dev, info);
> > if (pdev && pci_ats_supported(pdev)) {
> > + pci_prepare_ats(pdev, VTD_PAGE_SHIFT);
>
> perhaps just do it for PFs? :)
That check is inside pci_perpare_ats(), no reason to duplicate it in
all the callers.
> > +int pci_prepare_ats(struct pci_dev *dev, int ps)
> > +{
> > + u16 ctrl;
> > +
> > + if (!pci_ats_supported(dev))
> > + return -EINVAL;
> > +
> > + if (WARN_ON(dev->ats_enabled))
> > + return -EBUSY;
> > +
> > + if (ps < PCI_ATS_MIN_STU)
> > + return -EINVAL;
> > +
> > + if (dev->is_virtfn)
> > + return 0;
> > +
> > + dev->ats_stu = ps;
> > + ctrl = PCI_ATS_CTRL_STU(dev->ats_stu - PCI_ATS_MIN_STU);
> > + pci_write_config_word(dev, dev->ats_cap + PCI_ATS_CTRL, ctrl);
>
> Is it valuable to have a flag to mark if STU is set or not? Such way can
> avoid setting STU multiple times.
We don't because we only do it for the PF due to the is_virtfn check
Jason
next prev parent reply other threads:[~2024-08-13 12:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 18:19 [PATCH] iommu: Allow ATS to work on VFs when the PF uses IDENTITY Jason Gunthorpe
2024-08-09 2:36 ` Tian, Kevin
2024-08-09 13:28 ` Jason Gunthorpe
2024-08-12 0:09 ` Tian, Kevin
2024-08-12 9:03 ` Yi Liu
2024-08-12 11:35 ` Jason Gunthorpe
2024-08-13 3:00 ` Yi Liu
2024-08-09 19:10 ` Bjorn Helgaas
2024-08-12 2:20 ` Baolu Lu
2024-08-13 3:11 ` Yi Liu
2024-08-13 12:30 ` Jason Gunthorpe [this message]
2024-08-13 23:21 ` Yi Liu
2024-08-13 8:52 ` Joerg Roedel
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=20240813123041.GU8378@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=will@kernel.org \
--cc=yi.l.liu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.