[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH qemu v18 1/5] memory: Add reporting of supported
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [PATCH qemu v18 1/5] memory: Add reporting of supported page sizes |
Date: |
Tue, 21 Jun 2016 16:16:22 +1000 |
User-agent: |
Mutt/1.6.1 (2016-04-27) |
On Tue, Jun 21, 2016 at 11:14:01AM +1000, Alexey Kardashevskiy wrote:
> Every IOMMU has some granularity which MemoryRegionIOMMUOps::translate
> uses when translating, however this information is not available outside
> the translate context for various checks.
>
> This adds a get_min_page_size callback to MemoryRegionIOMMUOps and
> a wrapper for it so IOMMU users (such as VFIO) can know the minimum
> actual page size supported by an IOMMU.
>
> As IOMMU MR represents a guest IOMMU, this uses TARGET_PAGE_SIZE
> as fallback.
>
> This removes vfio_container_granularity() and uses new helper in
> memory_region_iommu_replay() when replaying IOMMU mappings on added
> IOMMU memory region.
>
> Signed-off-by: Alexey Kardashevskiy <address@hidden>
> Reviewed-by: David Gibson <address@hidden>
> Acked-by: Alex Williamson <address@hidden>
One remaining nit..
[snip]
> +void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n, bool is_write)
> +{
> + hwaddr addr, granularity;
> IOMMUTLBEntry iotlb;
>
> + granularity = (hwaddr)1 <<
> ctz64(memory_region_iommu_get_min_page_size(mr));
Because this is now a plain size, rather than some sort of pagemask,
you don't need the ctz64() business.
> for (addr = 0; addr < memory_region_size(mr); addr += granularity) {
> iotlb = mr->iommu_ops->translate(mr, addr, is_write);
> if (iotlb.perm != IOMMU_NONE) {
Paolo, are you ok for me to make that small change and take this
through my tree?
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature