[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [RFC v3 3/8] hw: vfio: common: Introduce vfio_register_msi_io
From: |
Eric Auger |
Subject: |
[Qemu-arm] [RFC v3 3/8] hw: vfio: common: Introduce vfio_register_msi_iova |
Date: |
Thu, 6 Oct 2016 09:50:39 +0000 |
vfio_register_msi_iova allows to register the MSI IOVA region.
This IOVA window will be used by the kernel to map MSI doorbells.
The function will become static in subsequent patches. However, since
there is no user yet, the compiler argues; the function is currently
not static and a dummy declaration needs to be added.
Signed-off-by: Eric Auger <address@hidden>
---
v2 -> v3:
- rename vfio_register_reserved_iova into vfio_register_msi_iova
- VFIO_DMA_MAP_FLAG_MSI_RESERVED_IOVA renamed into
VFIO_DMA_MAP_FLAG_RESERVED_MSI_IOVA
---
hw/vfio/common.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 4f4014e..fe8a855 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -212,6 +212,34 @@ static int vfio_dma_unmap(VFIOContainer *container,
return 0;
}
+/**
+ * vfio_register_msi_iova: registers the MSI iova region
+ *
+ * @container: container handle
+ * @iova: base IOVA of the MSI region
+ * @size: size of the MSI IOVA region
+ */
+int vfio_register_msi_iova(VFIOContainer *container, hwaddr iova,
+ ram_addr_t size);
+int vfio_register_msi_iova(VFIOContainer *container, hwaddr iova,
+ ram_addr_t size)
+{
+ int ret;
+ struct vfio_iommu_type1_dma_map map = {
+ .argsz = sizeof(map),
+ .flags = VFIO_DMA_MAP_FLAG_RESERVED_MSI_IOVA,
+ .iova = iova,
+ .size = size,
+ };
+
+ ret = ioctl(container->fd, VFIO_IOMMU_MAP_DMA, &map);
+
+ if (ret) {
+ error_report("VFIO_MAP_DMA/RESERVED_MSI_IOVA: %m");
+ }
+ return ret;
+}
+
static int vfio_dma_map(VFIOContainer *container, hwaddr iova,
ram_addr_t size, void *vaddr, bool readonly)
{
--
1.9.1
- [Qemu-arm] [RFC v3 0/8] KVM PCI/MSI passthrough with mach-virt, Eric Auger, 2016/10/06
- [Qemu-arm] [RFC v3 1/8] linux-headers: Partial update for MSI IOVA handling, Eric Auger, 2016/10/06
- [Qemu-arm] [RFC v3 2/8] hw: vfio: common: vfio_get_iommu_type1_info, Eric Auger, 2016/10/06
- [Qemu-arm] [RFC v3 3/8] hw: vfio: common: Introduce vfio_register_msi_iova,
Eric Auger <=
- [Qemu-arm] [RFC v3 4/8] memory: Add reserved_iova region type, Eric Auger, 2016/10/06
- [Qemu-arm] [RFC v3 5/8] memory: memory_region_find_by_name, Eric Auger, 2016/10/06
- [Qemu-arm] [RFC v3 6/8] hw: platform-bus: Enable to map any memory region onto the platform-bus, Eric Auger, 2016/10/06
- [Qemu-arm] [RFC v3 7/8] hw: vfio: common: vfio_prepare_msi_mapping, Eric Auger, 2016/10/06
- [Qemu-arm] [RFC v3 8/8] hw: vfio: common: Adapt vfio_listeners for reserved_iova region, Eric Auger, 2016/10/06