RE: Programming PASID in IMS entries
From: Tian, Kevin
Date: Wed Jul 07 2021 - 19:49:46 EST
> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Sent: Wednesday, July 7, 2021 8:16 PM
>
> On Wed, Jul 07, 2021 at 10:50:52AM +0200, Thomas Gleixner wrote:
> > Megha,
> >
> > On Wed, Jul 07 2021 at 09:49, Megha Dey wrote:
> > > Per your suggestions during the last meeting, we wanted to confirm the
> > > sequence to program the PASID into the IMS entries:
> > >
> > > 1. Add a PASID member to struct msi_desc (Add as part of a union. Other
> > > source-id's such as Jason's vm-id can be added to it)
> >
> > Yes. Though we also discussed storing the default PASID in struct device
> > to begin with which is then copied to the msi_desc entries during
> > allocation.
>
> This seems like a pretty good idea, though it requires that the
> device's IRQ code cast the struct device to some driver specific
> subtype, like mdev in this case.
it's not necessary, if in the end we still need a helper to set PASID to
struct msi_desc. It doesn't matter whether this PASID is default or for
vSVA. Just let device driver to pick whatever ID is necessary to mark
the entry.
>
> > > 2. Create an API which device drivers can call, to program the PASID
> > > (PASID provided by the driver) on a per-irq basis. This API is to be
> > > called after msi_domain_alloc_irqs and will write to the corresponding
> > > msi_desc->pasid entry. (Assumption: For now, all devices will have the
> > > same IMS format). for e.g:
> > >
> > > msi_desc_set_pasid (irq, pasid) {
> > >
> > > struct msi_desc *desc = irq_get_msi_desc(irq);
> > >
> > > desc->pasid = pasid;
> > >
> > > }
> >
> > That interface should be opaque probably with an u64 argument so it can
> > be reused for Jason's VM-id. Jason?
>
> Well, I certainly wouldn't put any IDXD specific words like PASID in
> the general API. The comingling of PASID with the rest of the IRQ
> registers is entirely a device specific choice.
>
> Most likely something like mlx5 is going to want to associate a
> pointer with the irq, and I believe it could use a struct device just
> fine.
>
Agree. Better call it source_id or cookie?
Thanks
Kevin