RE: [iommufd 2/2] vfio/ap: validate iova during dma_unmap and trigger irq disable

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

 



> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Sent: Thursday, November 24, 2022 8:59 PM
> 
> On Thu, Nov 24, 2022 at 07:08:06AM +0000, Tian, Kevin wrote:
> > > From: Liu, Yi L <yi.l.liu@xxxxxxxxx>
> > > Sent: Wednesday, November 23, 2022 9:49 PM
> > > +static void unmap_iova(struct ap_matrix_mdev *matrix_mdev, u64 iova,
> > > u64 length)
> > > +{
> > > +	struct ap_queue_table *qtable = &matrix_mdev->qtable;
> > > +	u64 iova_pfn_end = (iova + length - 1) >> PAGE_SHIFT;
> > > +	u64 iova_pfn_start = iova >> PAGE_SHIFT;
> > > +	struct vfio_ap_queue *q;
> > > +	int loop_cursor;
> > > +	u64 pfn;
> > > +
> > > +	hash_for_each(qtable->queues, loop_cursor, q, mdev_qnode) {
> > > +		pfn = q->saved_iova >> PAGE_SHIFT;
> > > +		if (pfn >= iova_pfn_start && pfn <= iova_pfn_end) {
> > > +			vfio_ap_irq_disable(q);
> > > +			break;
> >
> > does this need a WARN_ON if the length is more than one page?
> 
> The iova and length are the range being invalidated, the driver has no
> control over them and length is probably multiple pages.

Yes. I'm misled by the 'break'. Presumably all queues covered by
the unmapped range should have interrupt disabled while above only
disables interrupt for the first covered queue.




[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