@@ -191,6 +191,7 @@ struct MemoryRegion {
/* The following fields should fit in a cache line */
bool romd_mode;
bool ram;
+ bool reserved_iova;
bool subpage;
bool readonly; /* For RAM regions */
bool rom_device;
@@ -385,6 +386,21 @@ void memory_region_init_ram(MemoryRegion *mr,
Error **errp);
/**
+ * memory_region_init_reserved_iova: Initialize reserved iova memory region
+ *
+ * @mr: the #MemoryRegion to be initialized.
+ * @owner: the object that tracks the region's reference count
+ * @name: the name of the region.
+ * @size: size of the region.
+ * @errp: pointer to Error*, to store an error if it happens.
+ */
+void memory_region_init_reserved_iova(MemoryRegion *mr,
+ struct Object *owner,
+ const char *name,
+ uint64_t size,
+ Error **errp);
+
+/**
* memory_region_init_resizeable_ram: Initialize memory region with resizeable
* RAM. Accesses into the region will
* modify memory directly. Only an initial
@@ -573,6 +589,19 @@ static inline bool memory_region_is_ram(MemoryRegion *mr)
}
/**
+ * memory_region_is_reserved_iova: check whether a memory region corresponds to
+ reserved iova
+ *
+ * Returns %true is a memory region is reserved iova
+ *
+ * @mr: the memory region being queried
+ */
+static inline bool memory_region_is_reserved_iova(MemoryRegion *mr)
+{
+ return mr->reserved_iova;
+}
+
+/**
* memory_region_is_skip_dump: check whether a memory region should not be
* dumped
*
@@ -1309,6 +1309,17 @@ void memory_region_init_ram(MemoryRegion *mr,
mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
}
+void memory_region_init_reserved_iova(MemoryRegion *mr,
+ Object *owner,
+ const char *name,
+ uint64_t size,
+ Error **errp)
+{
+ memory_region_init(mr, owner, name, size);
+ mr->reserved_iova = true;
+ mr->terminates = true;
+}
+
void memory_region_init_resizeable_ram(MemoryRegion *mr,
Object *owner,
const char *name,
Introduce a new reserved_iova region type. This type of iova region is bound to be used by the kernel to map some host physical addresses (typically MSI frames). A new initializer, memory_region_init_reserved_iova is introduced, as well as a test function, memory_region_is_reserved_iova. Signed-off-by: Eric Auger <eric.auger@redhat.com> --- include/exec/memory.h | 29 +++++++++++++++++++++++++++++ memory.c | 11 +++++++++++ 2 files changed, 40 insertions(+)