Re: [PATCH v2 12/17] iommufd: Add iommufd_device_replace()

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

 



On Fri, Mar 10, 2023 at 11:48:58AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> > Sent: Wednesday, March 8, 2023 8:36 AM
> > 
> > @@ -359,6 +360,76 @@ iommufd_device_do_attach(struct iommufd_device
> > *idev,
> >  	return NULL;
> >  }
> > 
> > +static struct iommufd_hw_pagetable *
> > +iommufd_device_do_replace(struct iommufd_device *idev,
> > +			  struct iommufd_hw_pagetable *hwpt)
> > +{
> > +	struct iommufd_group *igroup = idev->igroup;
> > +	struct iommufd_hw_pagetable *old_hwpt;
> > +	unsigned int num_devices = 0;
> > +	struct iommufd_device *cur;
> > +	int rc;
> > +
> > +	mutex_lock(&idev->igroup->lock);
> > +
> > +	if (hwpt == igroup->hwpt) {
> > +		mutex_unlock(&idev->igroup->lock);
> > +		return NULL;
> > +	}
> > +
> > +	/* Try to upgrade the domain we have */
> > +	list_for_each_entry(cur, &igroup->device_list, group_item) {
> > +		num_devices++;
> > +		if (cur->enforce_cache_coherency) {
> > +			rc = iommufd_hw_pagetable_enforce_cc(hwpt);
> > +			if (rc)
> > +				goto err_unlock;
> > +		}
> > +	}
> > +
> > +	old_hwpt = igroup->hwpt;
> > +	if (hwpt->ioas != old_hwpt->ioas) {
> 
> Do we allow this function to be used as attach/detach?

No. NULL is never a valid input..

> if yes old_hwpt could be NULL here.

Er that test got lost in the last version it is neeed

> and looks the policy for physical attach is different from the one that
> Nicoline applies for access. iommufd_access_set_ioas() can behave
> like normal attach/detach.

Access should change.

Thanks,
Jason



[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