From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9ttp-0000Dd-1C for qemu-devel@nongnu.org; Fri, 07 Sep 2012 04:26:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9ttk-0006GV-Ak for qemu-devel@nongnu.org; Fri, 07 Sep 2012 04:26:48 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:51632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9ttj-0006G9-LR for qemu-devel@nongnu.org; Fri, 07 Sep 2012 04:26:44 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 7 Sep 2012 13:56:39 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q878Qavs34603114 for ; Fri, 7 Sep 2012 13:56:36 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q87DuAot032060 for ; Fri, 7 Sep 2012 19:26:11 +0530 From: Liu Sheng Date: Fri, 7 Sep 2012 16:26:27 +0800 Message-Id: <1347006389-543-2-git-send-email-liusheng@linux.vnet.ibm.com> In-Reply-To: <1347006389-543-1-git-send-email-liusheng@linux.vnet.ibm.com> References: <1347006389-543-1-git-send-email-liusheng@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 1/3] set the readonly property of rom memory region in pc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvm@vger.kernel.org Cc: aliguori@us.ibm.com, mtosatti@redhat.com, qemu-devel@nongnu.org, xiaoguangrong@linux.vnet.ibm.com, avi@redhat.com, Liu Sheng 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 --- 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