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]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux