[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62e9db6daecef9ffc70560ac87ae5be77697ec21.camel@linux.ibm.com>
Date: Mon, 09 Jan 2023 09:49:11 +0100
From: Niklas Schnelle <schnelle@...ux.ibm.com>
To: Jason Gunthorpe <jgg@...pe.ca>,
Alex Williamson <alex.williamson@...hat.com>
Cc: Cornelia Huck <cohuck@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
Matthew Rosato <mjrosato@...ux.ibm.com>,
Pierre Morel <pmorel@...ux.ibm.com>,
Christian Bornträger
<borntraeger@...ux.ibm.com>
Subject: Re: [PATCH v2 1/1] vfio/type1: Respect IOMMU reserved regions in
vfio_test_domain_fgsp()
On Fri, 2023-01-06 at 14:03 -0400, Jason Gunthorpe wrote:
> On Fri, Jan 06, 2023 at 10:24:50AM -0700, Alex Williamson wrote:
>
> > > - ret = iommu_map(domain->domain, 0, page_to_phys(pages), PAGE_SIZE * 2,
> > > - IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE);
> > > - if (!ret) {
> > > - size_t unmapped = iommu_unmap(domain->domain, 0, PAGE_SIZE);
> > > + list_for_each_entry(region, regions, list) {
> > > + if (region->end - region->start < PAGE_SIZE * 2 ||
> > > + region->start % (PAGE_SIZE*2))
> >
> > Maybe this falls into the noise, but we don't care if region->start is
> > aligned to a double page, so long as we can map an aligned double page
> > within the region. Maybe something like:
>
> > dma_addr_t start = ALIGN(region->start, PAGE_SIZE * 2);
> >
> > if (start >= region->end || (region->end - start < PAGE_SIZE * 2))
> > continue;
>
> Yeah, that is more technically correct
>
> Jason
Makes sense, will incorporate this into v3.
Thanks,
Niklas
Powered by blists - more mailing lists