make sure the memory regions of rom in pc have readonly property, prepare for plug these memory to kvm as readonly memory slots. Signed-off-by: Liu Sheng <liusheng@xxxxxxxxxxxxxxxxxx> --- hw/pc.c | 1 + hw/pci.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index c32ee8e..b7fb058 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -992,6 +992,7 @@ void *pc_memory_init(MemoryRegion *system_memory, option_rom_mr = g_malloc(sizeof(*option_rom_mr)); memory_region_init_ram(option_rom_mr, "pc.rom", PC_ROM_SIZE); vmstate_register_ram_global(option_rom_mr); + memory_region_set_readonly(option_rom_mr, true); memory_region_add_subregion_overlap(rom_memory, PC_ROM_MIN_VGA, option_rom_mr, diff --git a/hw/pci.c b/hw/pci.c index 4d95984..195971c 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1786,6 +1786,7 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom) pdev->has_rom = true; memory_region_init_ram(&pdev->rom, name, size); vmstate_register_ram(&pdev->rom, &pdev->qdev); + memory_region_set_readonly(&pdev->rom, true); ptr = memory_region_get_ram_ptr(&pdev->rom); load_image(path, ptr); g_free(path); -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html