[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [RFC PATCH qemu 1/3] memory: Add get_fd() hook for IOMMU MR
From: |
Alexey Kardashevskiy |
Subject: |
[Qemu-ppc] [RFC PATCH qemu 1/3] memory: Add get_fd() hook for IOMMU MR |
Date: |
Tue, 28 Mar 2017 20:05:28 +1100 |
Signed-off-by: Alexey Kardashevskiy <address@hidden>
---
include/exec/memory.h | 2 ++
hw/ppc/spapr_iommu.c | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index e39256ad03..925c10b35b 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -174,6 +174,8 @@ struct MemoryRegionIOMMUOps {
void (*notify_flag_changed)(MemoryRegion *iommu,
IOMMUNotifierFlag old_flags,
IOMMUNotifierFlag new_flags);
+ /* Returns a kernel fd for IOMMU */
+ int (*get_fd)(MemoryRegion *iommu);
};
typedef struct CoalescedMemoryRange CoalescedMemoryRange;
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index 9e30e148d6..b61c8f053e 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -170,6 +170,13 @@ static void spapr_tce_notify_flag_changed(MemoryRegion
*iommu,
}
}
+static int spapr_tce_get_fd(MemoryRegion *iommu)
+{
+ sPAPRTCETable *tcet = container_of(iommu, sPAPRTCETable, iommu);
+
+ return tcet->fd;
+}
+
static int spapr_tce_table_post_load(void *opaque, int version_id)
{
sPAPRTCETable *tcet = SPAPR_TCE_TABLE(opaque);
@@ -251,6 +258,7 @@ static MemoryRegionIOMMUOps spapr_iommu_ops = {
.translate = spapr_tce_translate_iommu,
.get_min_page_size = spapr_tce_get_min_page_size,
.notify_flag_changed = spapr_tce_notify_flag_changed,
+ .get_fd = spapr_tce_get_fd,
};
static int spapr_tce_table_realize(DeviceState *dev)
--
2.11.0