From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgCWP-0001gi-8p for qemu-devel@nongnu.org; Sat, 25 May 2013 07:20:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UgCWK-0005Ti-9j for qemu-devel@nongnu.org; Sat, 25 May 2013 07:20:25 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:43490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UgCWK-0005TA-2D for qemu-devel@nongnu.org; Sat, 25 May 2013 07:20:20 -0400 Date: Sat, 25 May 2013 07:20:10 -0400 From: Konrad Rzeszutek Wilk Message-ID: <20130525112009.GC2418@localhost.localdomain> References: <20130524171613.14229.84050.stgit@bling.home> <20130524172438.14229.59476.stgit@bling.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130524172438.14229.59476.stgit@bling.home> Subject: Re: [Qemu-devel] [PATCH 2/2] vfio: hugepage support for vfio_iommu_type1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: iommu@lists.linux-foundation.org, chegu_vinod@hp.com, qemu-devel@nongnu.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org > + * Turns out AMD IOMMU has a page table bug where it won't map large pages > + * to a region that previously mapped smaller pages. This should be fixed > + * soon, so this is just a temporary workaround to break mappings down into > + * PAGE_SIZE. Better to map smaller pages than nothing. > + */ > +static int map_try_harder(struct vfio_iommu *iommu, dma_addr_t iova, > + unsigned long pfn, long npage, int prot) > +{ > + long i; > + int ret; > + > + for (i = 0; i < npage; i++, pfn++, iova += PAGE_SIZE) { > + ret = iommu_map(iommu->domain, iova, > + (phys_addr_t)pfn << PAGE_SHIFT, > + PAGE_SIZE, prot); > + if (ret) > + break; > + } > + > + for (; i < npage && i > 0; i--, iova -= PAGE_SIZE) > + iommu_unmap(iommu->domain, iova, PAGE_SIZE); > + > return ret; > } This looks to belong to a vfio-quirk file (a something else) that deals with various IOMMU's quirks.