RE: [PATCH RFC v2 02/18] irq/dev-msi: Add support for a new DEV_MSI irq domain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jason,

> -----Original Message-----
> From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> Sent: Wednesday, August 5, 2020 3:54 PM
> To: Dey, Megha <megha.dey@xxxxxxxxx>
> Cc: Marc Zyngier <maz@xxxxxxxxxx>; Jiang, Dave <dave.jiang@xxxxxxxxx>;
> vkoul@xxxxxxxxxx; bhelgaas@xxxxxxxxxx; rafael@xxxxxxxxxx;
> gregkh@xxxxxxxxxxxxxxxxxxx; tglx@xxxxxxxxxxxxx; hpa@xxxxxxxxx;
> alex.williamson@xxxxxxxxxx; Pan, Jacob jun <jacob.jun.pan@xxxxxxxxx>; Raj,
> Ashok <ashok.raj@xxxxxxxxx>; Liu, Yi L <yi.l.liu@xxxxxxxxx>; Lu, Baolu
> <baolu.lu@xxxxxxxxx>; Tian, Kevin <kevin.tian@xxxxxxxxx>; Kumar, Sanjay K
> <sanjay.k.kumar@xxxxxxxxx>; Luck, Tony <tony.luck@xxxxxxxxx>; Lin, Jing
> <jing.lin@xxxxxxxxx>; Williams, Dan J <dan.j.williams@xxxxxxxxx>;
> kwankhede@xxxxxxxxxx; eric.auger@xxxxxxxxxx; parav@xxxxxxxxxxxx;
> Hansen, Dave <dave.hansen@xxxxxxxxx>; netanelg@xxxxxxxxxxxx;
> shahafs@xxxxxxxxxxxx; yan.y.zhao@xxxxxxxxxxxxxxx; pbonzini@xxxxxxxxxx;
> Ortiz, Samuel <samuel.ortiz@xxxxxxxxx>; Hossain, Mona
> <mona.hossain@xxxxxxxxx>; dmaengine@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; x86@xxxxxxxxxx; linux-pci@xxxxxxxxxxxxxxx;
> kvm@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH RFC v2 02/18] irq/dev-msi: Add support for a new DEV_MSI
> irq domain
> 
> On Wed, Aug 05, 2020 at 10:36:23PM +0000, Dey, Megha wrote:
> > Hi Jason,
> >
> > > From: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> > > Sent: Wednesday, August 5, 2020 3:16 PM
> > > To: Dey, Megha <megha.dey@xxxxxxxxx>
> > > Cc: Marc Zyngier <maz@xxxxxxxxxx>; Jiang, Dave
> > > <dave.jiang@xxxxxxxxx>; vkoul@xxxxxxxxxx; bhelgaas@xxxxxxxxxx;
> > > rafael@xxxxxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx; tglx@xxxxxxxxxxxxx;
> > > hpa@xxxxxxxxx; alex.williamson@xxxxxxxxxx; Pan, Jacob jun
> > > <jacob.jun.pan@xxxxxxxxx>; Raj, Ashok <ashok.raj@xxxxxxxxx>; Liu, Yi
> > > L <yi.l.liu@xxxxxxxxx>; Lu, Baolu <baolu.lu@xxxxxxxxx>; Tian, Kevin
> > > <kevin.tian@xxxxxxxxx>; Kumar, Sanjay K <sanjay.k.kumar@xxxxxxxxx>;
> > > Luck, Tony <tony.luck@xxxxxxxxx>; Lin, Jing <jing.lin@xxxxxxxxx>;
> > > Williams, Dan J <dan.j.williams@xxxxxxxxx>; kwankhede@xxxxxxxxxx;
> > > eric.auger@xxxxxxxxxx; parav@xxxxxxxxxxxx; Hansen, Dave
> > > <dave.hansen@xxxxxxxxx>; netanelg@xxxxxxxxxxxx;
> > > shahafs@xxxxxxxxxxxx; yan.y.zhao@xxxxxxxxxxxxxxx;
> > > pbonzini@xxxxxxxxxx; Ortiz, Samuel <samuel.ortiz@xxxxxxxxx>;
> > > Hossain, Mona <mona.hossain@xxxxxxxxx>; dmaengine@xxxxxxxxxxxxxxx;
> > > linux- kernel@xxxxxxxxxxxxxxx; x86@xxxxxxxxxx;
> > > linux-pci@xxxxxxxxxxxxxxx; kvm@xxxxxxxxxxxxxxx
> > > Subject: Re: [PATCH RFC v2 02/18] irq/dev-msi: Add support for a new
> > > DEV_MSI irq domain
> > >
> > > On Wed, Aug 05, 2020 at 07:18:39PM +0000, Dey, Megha wrote:
> > >
> > > > Hence we will only have one create_dev_msi_domain which can be
> > > > called by any device driver that wants to use the dev-msi IRQ
> > > > domain to alloc/free IRQs. It would be the responsibility of the
> > > > device driver to provide the correct device and update the dev-
> >msi_domain.
> > >
> > > I'm not sure that sounds like a good idea, why should a device
> > > driver touch dev-
> > > >msi_domain?
> > >
> > > There was a certain appeal to the api I suggested by having
> > > everything related to setting up the new IRQs being in the core code.
> >
> > The basic API to create the dev_msi domain would be :
> >
> > struct irq_domain *create_dev_msi_irq_domain(struct irq_domain
> > *parent)
> >
> > This can be called by devices according to their use case.
> >
> > For e.g. in dsa case, it is called from the irq remapping driver:
> > iommu->ir_dev_msi_domain = create_dev_msi_domain(iommu->ir_domain)
> >
> > and from the dsa mdev driver:
> > p_dev = get_parent_pci_dev(dev);
> > iommu = device_to_iommu(p_dev);
> >
> > dev->msi_domain = iommu->ir_dev_msi_domain;
> >
> > So we are creating the domain in the IRQ  remapping domain which can be
> used by other devices which want to have the same IRQ parent domain and use
> dev-msi APIs. We are only updating that device's msi_domain to the already
> created dev-msi domain in the driver.
> >
> > Other devices (your rdma driver etc) can create their own dev-msi domain by
> passing the appropriate parent IRq domain.
> >
> > We cannot have this in the core code since the parent domain cannot be
> > the same?
> 
> Well, I had suggested to pass in the parent struct device, but it could certainly
> use an irq_domain instead:
> 
>   platform_msi_assign_domain(dev, device_to_iommu(p_dev)->ir_domain);
> 
> Or
> 
>   platform_msi_assign_domain(dev, pdev->msi_domain)
> 
> ?
> 
> Any maybe the natural expression is to add a version of
> platform_msi_create_device_domain() that accepts a parent irq_domain() and if
> the device doesn't already have a msi_domain then it creates one. Might be too
> tricky to manage lifetime of the new irq_domain though..
> 
> It feels cleaner to me if everything related to this is contained in the
> platform_msi and the driver using it. Not sure it makes sense to involve the
> iommu?

Well yeah something like this can be done, but what is the missing piece is where the IRQ domain actually gets created, i.e where this new version of platform_msi_create_device_domain() is called. That is the only piece that is currently done in the IOMMU driver only for DSA mdev. Not that all devices need to do it this way.. do you have suggestions as to where you want to call this function?
> 
> Jason



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux