diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2016-06-21 11:14:01 +1000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2016-06-22 11:13:09 +1000 |
commit | f682e9c244af7166225f4a50cc18ff296bb9d43e (patch) | |
tree | b7bd72279e877749a13819072e5380147e3cb66d /hw/ppc | |
parent | f0278900d38b2d8d9531c484bd088d9a7d5d4ea2 (diff) | |
download | qemu-f682e9c244af7166225f4a50cc18ff296bb9d43e.zip qemu-f682e9c244af7166225f4a50cc18ff296bb9d43e.tar.gz qemu-f682e9c244af7166225f4a50cc18ff296bb9d43e.tar.bz2 |
memory: Add reporting of supported page sizes
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 <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
[dwg: Removed an unnecessary calculation]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr_iommu.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index a3cc572..e230bac 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -149,6 +149,13 @@ static void spapr_tce_table_pre_save(void *opaque) tcet->bus_offset, tcet->page_shift); } +static uint64_t spapr_tce_get_min_page_size(MemoryRegion *iommu) +{ + sPAPRTCETable *tcet = container_of(iommu, sPAPRTCETable, iommu); + + return 1ULL << tcet->page_shift; +} + static int spapr_tce_table_post_load(void *opaque, int version_id) { sPAPRTCETable *tcet = SPAPR_TCE_TABLE(opaque); @@ -228,6 +235,7 @@ static const VMStateDescription vmstate_spapr_tce_table = { static MemoryRegionIOMMUOps spapr_iommu_ops = { .translate = spapr_tce_translate_iommu, + .get_min_page_size = spapr_tce_get_min_page_size, }; static int spapr_tce_table_realize(DeviceState *dev) |