[PATCH 2/5] iommu/arm-smmu: add support for PCI master devices
Varun Sethi
Varun.Sethi at freescale.com
Wed Jul 9 07:21:07 PDT 2014
Hi Will,
> -----Original Message-----
> From: Will Deacon [mailto:will.deacon at arm.com]
> Sent: Wednesday, July 09, 2014 6:57 PM
> To: Sethi Varun-B16395; alex.williamson at redhat.com
> Cc: linux-arm-kernel at lists.infradead.org; iommu at lists.linux-
> foundation.org; thierry.reding at gmail.com; arnd at arndb.de;
> ohaugan at codeaurora.org; joro at 8bytes.org;
> a.motakis at virtualopensystems.com; Marc Zyngier
> Subject: Re: [PATCH 2/5] iommu/arm-smmu: add support for PCI master
> devices
>
> [Adding Alex; question below]
>
> On Thu, Jul 03, 2014 at 03:22:37PM +0100, Varun Sethi wrote:
> > > +static int __arm_smmu_get_pci_sid(struct pci_dev *pdev, u16 alias,
> > > +void
> > > +*data) {
> > > + *((u16 *)data) = alias;
> > > + return 0; /* Continue walking */ }
>
> [...]
>
> > > @@ -1598,15 +1642,36 @@ static int arm_smmu_add_device(struct device
> > > *dev)
> > > return PTR_ERR(group);
> > > }
> > >
> > > + if (dev_is_pci(dev)) {
> > > + struct arm_smmu_master_cfg *cfg;
> > > + struct pci_dev *pdev = to_pci_dev(dev);
> > > +
> > > + cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
> > > + if (!cfg) {
> > > + ret = -ENOMEM;
> > > + goto out_put_group;
> > > + }
> > > +
> > > + cfg->num_streamids = 1;
> > > + pci_for_each_dma_alias(pdev, __arm_smmu_get_pci_sid,
> > > + &cfg->streamids[0]);
> > [Sethi Varun-B16395] We need to look for upstream DMA device. We
> > should be using pci_find_dma_isolation_root here. Also, this would
> > also imply that there could be multiple devices sharing the same
> > stream ID. So, we should check if a particular stream ID value has
> > already been configured in the SMR registers.
>
> pci_find_dma_isolation_root doesn't exist in any of the trees I have.
> Alex, is this queued anywhere and do I actually need it?
>
> The purpose of this code is to find the requester ID of a device as it
> appears at the host controller. At this point, we can map it (via
> firmware tables that are TBD) to a Stream ID for the SMMU. It looks to me
> like pci_for_each_dma_alias walks over non-transparent PCI bridges
> correctly, so the callback I provide just updates the alias until the
> walk has completed.
I think pci_for_each_dma_alias should work fine here. Isolation would be specifically required while setting up the iommu groups.
-Varun
More information about the linux-arm-kernel
mailing list