RE: [RFC 2/8] iommufd: replace attach_fn with a structure

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

 



> From: Baolu Lu <baolu.lu@xxxxxxxxxxxxxxx>
> 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.




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux