Re: [PATCH v3 13/13] PCI/TSM: Add Guest TSM Support

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

 



Aneesh Kumar K.V wrote:
> Dan Williams <dan.j.williams@xxxxxxxxx> writes:
> 
> > From: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>
> ...
> 
> > @@ -558,11 +675,11 @@ int pci_tsm_bind(struct pci_dev *pdev, struct kvm *kvm, u64 tdi_id)
> >  	if (!pdev->tsm)
> >  		return -EINVAL;
> >  
> > -	struct pci_dev *pf0_dev __free(pci_dev_put) = tsm_pf0_get(pdev);
> > -	if (!pf0_dev)
> > +	struct pci_dev *dsm_dev __free(pci_dev_put) = dsm_dev_get(pdev);
> > +	if (!dsm_dev)
> >  		return -EINVAL;
> >  
> > -	struct mutex *ops_lock __free(tdi_ops_unlock) = tdi_ops_lock(pf0_dev);
> > +	struct mutex *ops_lock __free(tdi_ops_unlock) = tdi_ops_lock(dsm_dev);
> >  	if (IS_ERR(ops_lock))
> >  		return PTR_ERR(ops_lock);
> >  
> > @@ -573,10 +690,13 @@ int pci_tsm_bind(struct pci_dev *pdev, struct kvm *kvm, u64 tdi_id)
> >  			return -EBUSY;
> >  	}
> >  
> > -	tdi = tsm_ops->bind(pdev, pf0_dev, kvm, tdi_id);
> > +	tdi = tsm_ops->bind(pdev, dsm_dev, kvm, tdi_id);
> >  	if (!tdi)
> >  		return -ENXIO;
> >  
> > +	tdi->pdev = pdev;
> > +	tdi->dsm_dev = dsm_dev;
> > +	tdi->kvm = kvm;
> >  	pdev->tsm->tdi = tdi;
> >
> 
> should that be no_free_ptr(dsm_dev)? Also unbind needs to drop that
> device reference? 

Hmmm, are there any scenarios where @tdi can outlive @dsm_dev?

The end of life of @dsm_dev includes pci_tsm_destroy() which should
invalidate all outstanding @tdi contexts.




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux