qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Liu Sheng <liusheng@linux.vnet.ibm.com>
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 <liusheng@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 1/3] set the readonly property of rom memory region in pc
Date: Fri,  7 Sep 2012 16:26:27 +0800	[thread overview]
Message-ID: <1347006389-543-2-git-send-email-liusheng@linux.vnet.ibm.com> (raw)
In-Reply-To: <1347006389-543-1-git-send-email-liusheng@linux.vnet.ibm.com>

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@linux.vnet.ibm.com>
---
 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

  reply	other threads:[~2012-09-07  8:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-07  8:26 [Qemu-devel] [PATCH 0/3] support kvm readonly memory slot in qemu Liu Sheng
2012-09-07  8:26 ` Liu Sheng [this message]
2012-09-07  8:26 ` [Qemu-devel] [PATCH 2/3] update kvm related the head file from kernel Liu Sheng
2012-09-07  8:49   ` Jan Kiszka
2012-09-07  9:39     ` Xiao Guangrong
2012-09-07 10:17       ` Jan Kiszka
2012-09-07  8:26 ` [Qemu-devel] [PATCH 3/3] support readonly memory feature in qemu Liu Sheng
2012-09-07  8:50   ` Jan Kiszka
2012-09-09 15:45     ` Avi Kivity
2012-09-10  9:25       ` Jan Kiszka
2012-09-11  3:02         ` Kevin O'Connor
2012-09-11 15:31           ` Jan Kiszka
2012-09-11 16:15             ` Anthony Liguori
2012-09-11 16:33               ` Jan Kiszka
2012-09-12  0:01               ` Kevin O'Connor
2012-09-09 15:42   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347006389-543-2-git-send-email-liusheng@linux.vnet.ibm.com \
    --to=liusheng@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).