@@ -415,7 +415,10 @@ static bool vhost_section(struct vhost_dev *dev, MemoryRegionSection *section)
{
MemoryRegion *mr = section->mr;
- if (memory_region_is_ram(mr) && !memory_region_is_rom(mr)) {
+ if (memory_region_is_ram(mr) &&
+ !memory_region_is_rom(mr) &&
+ !memory_region_is_no_vhost(mr)) {
+
uint8_t dirty_mask = memory_region_get_dirty_log_mask(mr);
uint8_t handled_dirty;
@@ -380,6 +380,7 @@ struct MemoryRegion {
bool global_locking;
uint8_t dirty_log_mask;
bool is_iommu;
+ bool no_vhost;
RAMBlock *ram_block;
Object *owner;
@@ -1205,6 +1206,26 @@ static inline bool memory_region_is_romd(MemoryRegion *mr)
return mr->rom_device && mr->romd_mode;
}
+/**
+ * memory_region_set_no_vhost: Make vhost ignore a memory region
+ *
+ * Makes vhost ignore a memory region, useful if it isn't real
+ * DMAble memory and is at inconvenient addresses
+ *
+ * @mr: the region being updated.
+ * @no_vhost: true to ignore
+ */
+void memory_region_set_no_vhost(MemoryRegion *mr, bool no_vhost);
+
+/**
+ * memory_region_is_no_vhost: Test if memory region is marked no vhost
+ *
+ * Test if the no_vhost flag is set on the memory region
+ *
+ * @mr: the region being tested.
+ */
+bool memory_region_is_no_vhost(const MemoryRegion *mr);
+
/**
* memory_region_get_iommu: check whether a memory region is an iommu
*
@@ -2125,6 +2125,21 @@ void memory_region_rom_device_set_romd(MemoryRegion *mr, bool romd_mode)
}
}
+void memory_region_set_no_vhost(MemoryRegion *mr, bool no_vhost)
+{
+ if (mr->no_vhost != no_vhost) {
+ memory_region_transaction_begin();
+ mr->no_vhost = no_vhost;
+ memory_region_update_pending |= mr->enabled;
+ memory_region_transaction_commit();
+ }
+}
+
+bool memory_region_is_no_vhost(const MemoryRegion *mr)
+{
+ return mr->no_vhost;
+}
+
void memory_region_reset_dirty(MemoryRegion *mr, hwaddr addr,
hwaddr size, unsigned client)
{