[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB52761BC2182680172F71775E8CC2A@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Wed, 27 Sep 2023 03:10:06 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"joro@...tes.org" <joro@...tes.org>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"jgg@...dia.com" <jgg@...dia.com>,
"robin.murphy@....com" <robin.murphy@....com>
CC: "cohuck@...hat.com" <cohuck@...hat.com>,
"eric.auger@...hat.com" <eric.auger@...hat.com>,
"nicolinc@...dia.com" <nicolinc@...dia.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"mjrosato@...ux.ibm.com" <mjrosato@...ux.ibm.com>,
"chao.p.peng@...ux.intel.com" <chao.p.peng@...ux.intel.com>,
"yi.y.sun@...ux.intel.com" <yi.y.sun@...ux.intel.com>,
"peterx@...hat.com" <peterx@...hat.com>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>,
"lulu@...hat.com" <lulu@...hat.com>,
"suravee.suthikulpanit@....com" <suravee.suthikulpanit@....com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"Duan, Zhenzhong" <zhenzhong.duan@...el.com>,
"Martins, Joao" <joao.m.martins@...cle.com>
Subject: RE: [RFC 2/8] iommufd: replace attach_fn with a structure
> From: Baolu Lu <baolu.lu@...ux.intel.com>
> Sent: Wednesday, September 27, 2023 10:18 AM
>
> On 9/26/23 5:26 PM, Yi Liu wrote:
> >
> > -typedef struct iommufd_hw_pagetable *(*attach_fn)(
> > - struct iommufd_device *idev, struct iommufd_hw_pagetable *hwpt);
> > +static struct iommufd_hw_pagetable *do_attach(struct iommufd_device
> *idev,
> > + struct iommufd_hw_pagetable *hwpt, struct attach_data
> *data)
> > +{
> > + return data->attach_fn(idev, hwpt);
> > +}
>
> I assume that this change was made because we need to pass the pasid
> value to the attach_fn() callback.
>
> If so, how about passing it directly to attach_fn() function?
>
> typedef struct iommufd_hw_pagetable *(*attach_fn)(
> struct iommufd_device *idev,
> struct iommufd_hw_pagetable *hwpt,
> ioasid_t pasid);
>
> In no pasid case, use IOMMU_NO_PASID.
>
that is one option, but also means the existing device attach_fn() needs
to accept an unused pasid parameter which doesn't read good.
So this patch chooses to handle the pasid necessity in an outer wrapper
and contain the pasid awareness only in pasid related attach_fn.
Powered by blists - more mailing lists