Rather than expose the xen_dm handle outside of xen-hvm.c introduce a
function wrapper for xen_platform to use.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
xendevicemodel_populate_ram(dm, 0, 0);
xendevicemodel_create_ioreq_server(dm, 1, NULL);
xendevicemodel_mark_memory_region_dirty(dm, 0, 0);
xendevicemodel_populate_ram(dm, 0, 0);
xendevicemodel_create_ioreq_server(dm, 1, NULL);
xendevicemodel_mark_memory_region_dirty(dm, 0, 0);
+ xendevicemodel_make_ram_region_ro(dm, 0, 0);
switch (addr) {
case 0: /* Platform flags */ {
switch (addr) {
case 0: /* Platform flags */ {
- hvmmem_type_t mem_type = (val & PFFLAG_ROM_LOCK) ?
- HVMMEM_ram_ro : HVMMEM_ram_rw;
- if (xc_hvm_set_mem_type(xen_xc, xen_domid, mem_type, 0xc0, 0x40)) {
+ if (xen_hvm_set_rom_ro(val & PFFLAG_ROM_LOCK)) {
DPRINTF("unable to change ro/rw state of ROM memory area!\n");
} else {
s->flags = val & PFFLAG_ROM_LOCK;
DPRINTF("changed ro/rw state of ROM memory area. now is %s state.\n",
DPRINTF("unable to change ro/rw state of ROM memory area!\n");
} else {
s->flags = val & PFFLAG_ROM_LOCK;
DPRINTF("changed ro/rw state of ROM memory area. now is %s state.\n",
- (mem_type == HVMMEM_ram_ro ? "ro":"rw"));
+ (val & PFFLAG_ROM_LOCK ? "ro":"rw"));
void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len);
void xen_hvm_inject_msi(uint64_t addr, uint32_t data);
int xen_is_pirq_msi(uint32_t msi_data);
void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len);
void xen_hvm_inject_msi(uint64_t addr, uint32_t data);
int xen_is_pirq_msi(uint32_t msi_data);
+int xen_hvm_set_rom_ro(int ro);
qemu_irq *xen_interrupt_controller_init(void);
qemu_irq *xen_interrupt_controller_init(void);
#define xendevicemodel_mark_memory_region_dirty(h, s, n) \
xc_hvm_modified_memory(h, xen_domid, s, n)
#define xendevicemodel_mark_memory_region_dirty(h, s, n) \
xc_hvm_modified_memory(h, xen_domid, s, n)
+#define xendevicemodel_make_ram_region_ro(h, s, n) \
+ xc_hvm_set_mem_type(h, xen_domid, HVMMEM_ram_ro, s, n)
+#define xendevicemodel_make_ram_region_rw(h, s, n) \
+ xc_hvm_set_mem_type(h, xen_domid, HVMMEM_ram_rw, s, n)
#if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 450
#if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 450
xendevicemodel_inject_msi(xen_dm, addr, data);
}
xendevicemodel_inject_msi(xen_dm, addr, data);
}
+int xen_hvm_set_rom_ro(int ro)
+{
+ if (ro)
+ return xendevicemodel_make_ram_region_ro(xen_dm, 0xc0, 0x40);
+ else
+ return xendevicemodel_make_ram_region_rw(xen_dm, 0xc0, 0x40);
+}
+
static void xen_suspend_notifier(Notifier *n, void *data)
{
xendevicemodel_s3_suspend(xen_dm);
static void xen_suspend_notifier(Notifier *n, void *data)
{
xendevicemodel_s3_suspend(xen_dm);
hwaddr start_addr = section->offset_within_address_space;
ram_addr_t size = int128_get64(section->size);
bool log_dirty = memory_region_is_logging(section->mr, DIRTY_MEMORY_VGA);
hwaddr start_addr = section->offset_within_address_space;
ram_addr_t size = int128_get64(section->size);
bool log_dirty = memory_region_is_logging(section->mr, DIRTY_MEMORY_VGA);
- hvmmem_type_t mem_type;
if (section->mr == &ram_memory) {
return;
if (section->mr == &ram_memory) {
return;
xen_add_to_physmap(state, start_addr, size,
section->mr, section->offset_within_region);
} else {
xen_add_to_physmap(state, start_addr, size,
section->mr, section->offset_within_region);
} else {
- mem_type = HVMMEM_ram_ro;
- if (xc_hvm_set_mem_type(xen_xc, xen_domid, mem_type,
+ if (xendevicemodel_make_ram_region_ro(xen_dm,
start_addr >> TARGET_PAGE_BITS,
size >> TARGET_PAGE_BITS)) {
start_addr >> TARGET_PAGE_BITS,
size >> TARGET_PAGE_BITS)) {
- DPRINTF("xc_hvm_set_mem_type error, addr: "TARGET_FMT_plx"\n",
+ DPRINTF("make_ram_region_ro error, addr: "TARGET_FMT_plx"\n",