Linux IOMMU Development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
	Will Deacon <will@kernel.org>
Subject: Re: [PATCH 1/2] iommu/fsl: Do not use iommu_group_remove_device() under ops->device_group()
Date: Tue, 16 May 2023 16:52:10 -0300	[thread overview]
Message-ID: <ZGPe6mVdcj2Tf4Ce@nvidia.com> (raw)
In-Reply-To: <e8157615-abd3-9072-6245-50add0eeb284@arm.com>

On Tue, May 16, 2023 at 07:24:20PM +0100, Robin Murphy wrote:

> My reading of the current code is that it must absolutely be relying on
> fsl_pamu_init() having run before fsl_pci_init() (they're both at
> arch_initcall level, implying an icky fragile link-order
> dependency), 

Oh, I see, so this platform device would have a group assigned.

> > index b7232c46b24481..6daf620b63a4d5 100644
> > --- a/arch/powerpc/sysdev/fsl_pci.c
> > +++ b/arch/powerpc/sysdev/fsl_pci.c
> > @@ -1353,6 +1353,7 @@ static struct platform_driver fsl_pci_driver = {
> >                  .of_match_table = pci_ids,
> >          },
> >          .probe = fsl_pci_probe,
> > +       .driver_managed_dma = true,
> >   };
> >   static int __init fsl_pci_init(void)
> > 
> > Even though it is a NOP in this case because of ordering, it still
> > would be good for documentation purposes.
> 
> ...however I think you're on to something here - if with this we can safely
> guarantee to negate any ownership problem as well, then flipping it all
> around to *always* rely on the platform device's group might be neatest of
> all.

Okay, it makes sense. I don't see anything wrong with this, the
controller has to have a liodn and thus a group created for PCI to
work.

Though looking at this driver I don't really understand how it works..
The email discussion from 2013 for merging the driver made it clear
that

 .. We can isolate the DMA access to the host based on the to the
 pci bus,device,function number.

But I can't see where in this driver the RID gets relayed into any
kind of HW programming??

When fsl_pamu_attach_device() sees a PCI device it jumps to the
controller and discards the pci device entirely for the functions it
calls? It seems to do the same thing regardless of what PCI device is
attaching? Huh?

Thanks,
Jason

  reply	other threads:[~2023-05-16 19:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16  0:27 [PATCH 0/2] Remove iommu_group_remove_device() from fsl Jason Gunthorpe
2023-05-16  0:27 ` [PATCH 1/2] iommu/fsl: Do not use iommu_group_remove_device() under ops->device_group() Jason Gunthorpe
2023-05-16 15:00   ` Robin Murphy
2023-05-16 16:09     ` Jason Gunthorpe
2023-05-16 18:24       ` Robin Murphy
2023-05-16 19:52         ` Jason Gunthorpe [this message]
2023-05-16  0:27 ` [PATCH 2/2] iommu/fsl: Always allocate a group for non-pci devices Jason Gunthorpe

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=ZGPe6mVdcj2Tf4Ce@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=robin.murphy@arm.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