From 2e4109de8e589beecd69996ee14f24021b991c0d Mon Sep 17 00:00:00 2001 From: Alexey Kardashevskiy Date: Mon, 4 Jul 2016 13:33:06 +1000 Subject: vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2) New VFIO_SPAPR_TCE_v2_IOMMU type supports dynamic DMA window management. This adds ability to VFIO common code to dynamically allocate/remove DMA windows in the host kernel when new VFIO container is added/removed. This adds a helper to vfio_listener_region_add which makes VFIO_IOMMU_SPAPR_TCE_CREATE ioctl and adds just created IOMMU into the host IOMMU list; the opposite action is taken in vfio_listener_region_del. When creating a new window, this uses heuristic to decide on the TCE table levels number. This should cause no guest visible change in behavior. Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson [dwg: Added some casts to prevent printf() warnings on certain targets where the kernel headers' __u64 doesn't match uint64_t or PRIx64] Signed-off-by: David Gibson --- include/hw/vfio/vfio-common.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/hw/vfio') diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index b1f3e92405..07f7188df4 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -168,4 +168,10 @@ int vfio_get_dev_region_info(VFIODevice *vbasedev, uint32_t type, #endif extern const MemoryListener vfio_prereg_listener; +int vfio_spapr_create_window(VFIOContainer *container, + MemoryRegionSection *section, + hwaddr *pgsize); +int vfio_spapr_remove_window(VFIOContainer *container, + hwaddr offset_within_address_space); + #endif /* !HW_VFIO_VFIO_COMMON_H */ -- cgit v1.2.3