get_gfn_query_unlocked(d, a.pfn, &t);
if ( p2m_is_mmio(t) )
a.mem_type = HVMMEM_mmio_dm;
- else if ( t == p2m_mmio_write_dm )
- a.mem_type = HVMMEM_mmio_write_dm;
else if ( p2m_is_readonly(t) )
a.mem_type = HVMMEM_ram_ro;
else if ( p2m_is_ram(t) )
[HVMMEM_ram_rw] = p2m_ram_rw,
[HVMMEM_ram_ro] = p2m_ram_ro,
[HVMMEM_mmio_dm] = p2m_mmio_dm,
- [HVMMEM_mmio_write_dm] = p2m_mmio_write_dm
+ [HVMMEM_unused] = p2m_invalid
};
if ( copy_from_guest(&a, arg, 1) )
((a.first_pfn + a.nr - 1) > domain_get_maximum_gpfn(d)) )
goto setmemtype_fail;
- if ( a.hvmmem_type >= ARRAY_SIZE(memtype) )
+ if ( a.hvmmem_type >= ARRAY_SIZE(memtype) ||
+ unlikely(a.hvmmem_type == HVMMEM_unused) )
goto setmemtype_fail;
while ( a.nr > start_iter )
HVMMEM_ram_rw, /* Normal read/write guest RAM */
HVMMEM_ram_ro, /* Read-only; writes are discarded */
HVMMEM_mmio_dm, /* Reads and write go to the device model */
+#if __XEN_INTERFACE_VERSION__ < 0x00040700
HVMMEM_mmio_write_dm /* Read-only; writes go to the device model */
+#else
+ HVMMEM_unused /* Placeholder; setting memory to this type
+ will fail for code after 4.7.0 */
+#endif
} hvmmem_type_t;
/* Following tools-only interfaces may change in future. */