[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/11] memory/iommu: Add get_attr()
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [PULL 01/11] memory/iommu: Add get_attr() |
Date: |
Mon, 05 Feb 2018 11:56:53 -0700 |
User-agent: |
StGit/0.18-101-g8fa6 |
From: Alexey Kardashevskiy <address@hidden>
This adds get_attr() to IOMMUMemoryRegionClass, like
iommu_ops::domain_get_attr in the Linux kernel.
This defines the first attribute - IOMMU_ATTR_SPAPR_TCE_FD - which
will be used between the pSeries machine and VFIO-PCI.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
Acked-by: Paolo Bonzini <address@hidden>
Acked-by: David Gibson <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>
---
include/exec/memory.h | 22 ++++++++++++++++++++++
memory.c | 13 +++++++++++++
2 files changed, 35 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 07c5d6d59796..3ef83991e99a 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -190,6 +190,10 @@ struct MemoryRegionOps {
const MemoryRegionMmio old_mmio;
};
+enum IOMMUMemoryRegionAttr {
+ IOMMU_ATTR_SPAPR_TCE_FD
+};
+
typedef struct IOMMUMemoryRegionClass {
/* private */
struct DeviceClass parent_class;
@@ -210,6 +214,10 @@ typedef struct IOMMUMemoryRegionClass {
IOMMUNotifierFlag new_flags);
/* Set this up to provide customized IOMMU replay function */
void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier);
+
+ /* Get IOMMU misc attributes */
+ int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr,
+ void *data);
} IOMMUMemoryRegionClass;
typedef struct CoalescedMemoryRange CoalescedMemoryRange;
@@ -926,6 +934,20 @@ void memory_region_iommu_replay_all(IOMMUMemoryRegion
*iommu_mr);
void memory_region_unregister_iommu_notifier(MemoryRegion *mr,
IOMMUNotifier *n);
+/**
+ * memory_region_iommu_get_attr: return an IOMMU attr if get_attr() is
+ * defined on the IOMMU.
+ *
+ * Returns 0 if succeded, error code otherwise.
+ *
+ * @iommu_mr: the memory region
+ * @attr: the requested attribute
+ * @data: a pointer to the requested attribute data
+ */
+int memory_region_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
+ enum IOMMUMemoryRegionAttr attr,
+ void *data);
+
/**
* memory_region_name: get a memory region's name
*
diff --git a/memory.c b/memory.c
index 449a1429b946..a4c603730a8c 100644
--- a/memory.c
+++ b/memory.c
@@ -1922,6 +1922,19 @@ void memory_region_notify_iommu(IOMMUMemoryRegion
*iommu_mr,
}
}
+int memory_region_iommu_get_attr(IOMMUMemoryRegion *iommu_mr,
+ enum IOMMUMemoryRegionAttr attr,
+ void *data)
+{
+ IOMMUMemoryRegionClass *imrc = IOMMU_MEMORY_REGION_GET_CLASS(iommu_mr);
+
+ if (!imrc->get_attr) {
+ return -EINVAL;
+ }
+
+ return imrc->get_attr(iommu_mr, attr, data);
+}
+
void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client)
{
uint8_t mask = 1 << client;
- [Qemu-devel] [PULL 00/11] VFIO updates 2018-02-05, Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 01/11] memory/iommu: Add get_attr(),
Alex Williamson <=
- [Qemu-devel] [PULL 02/11] vfio/spapr: Use iommu memory region's get_attr(), Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 03/11] spapr/iommu: Enable in-kernel TCE acceleration via VFIO KVM device, Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 04/11] vfio/pci: Fixup VFIOMSIXInfo comment, Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 05/11] vfio/pci: Add base BAR MemoryRegion, Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 06/11] vfio/pci: Emulate BARs, Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 07/11] qapi: Create DEFINE_PROP_OFF_AUTO_PCIBAR, Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 08/11] vfio/pci: Allow relocating MSI-X MMIO, Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 09/11] hw/vfio/platform: Init the interrupt mutex, Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 10/11] vfio/common: Remove redundant copy of local variable, Alex Williamson, 2018/02/05
- [Qemu-devel] [PULL 11/11] vfio/pci: Add option to disable GeForce quirks, Alex Williamson, 2018/02/05