Patchwork [09/39] Integrate I/O memory regions into qemu

login
register
mail settings
Submitter Avi Kivity
Date July 31, 2011, 5:57 p.m.
Message ID <1312135082-31985-10-git-send-email-avi@redhat.com>
Download mbox | patch
Permalink /patch/107624/
State New
Headers show

Comments

Avi Kivity - July 31, 2011, 5:57 p.m.
get_system_io() returns the root I/O memory region.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 exec-memory.h |    2 ++
 exec.c        |   10 ++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
Richard Henderson - Aug. 1, 2011, 12:19 a.m.
On 07/31/2011 10:57 AM, Avi Kivity wrote:
> +    system_io = qemu_malloc(sizeof(*system_io));
> +    memory_region_init(system_memory, "io", 65536);
> +    set_system_io_map(system_io);

Cut-paste error on that second line.


r~
Avi Kivity - Aug. 1, 2011, 6:05 a.m.
On 08/01/2011 03:19 AM, Richard Henderson wrote:
> On 07/31/2011 10:57 AM, Avi Kivity wrote:
> >  +    system_io = qemu_malloc(sizeof(*system_io));
> >  +    memory_region_init(system_memory, "io", 65536);
> >  +    set_system_io_map(system_io);
>
> Cut-paste error on that second line.
>

Well spotted; the cpu also saw this and the fix is in patch 10, which I 
forgot to squash into this.  I'll post a squashed version.

Patch

diff --git a/exec-memory.h b/exec-memory.h
index c439aba..999fd69 100644
--- a/exec-memory.h
+++ b/exec-memory.h
@@ -28,6 +28,8 @@ 
  */
 MemoryRegion *get_system_memory(void);
 
+MemoryRegion *get_system_io(void);
+
 /* Set the root memory region.  This region is the system memory map. */
 void set_system_memory_map(MemoryRegion *mr);
 
diff --git a/exec.c b/exec.c
index 476b507..2fd4adb 100644
--- a/exec.c
+++ b/exec.c
@@ -113,6 +113,7 @@  static int in_migration;
 RAMList ram_list = { .blocks = QLIST_HEAD_INITIALIZER(ram_list) };
 
 static MemoryRegion *system_memory;
+static MemoryRegion *system_io;
 
 #endif
 
@@ -3820,6 +3821,10 @@  static void memory_map_init(void)
     system_memory = qemu_malloc(sizeof(*system_memory));
     memory_region_init(system_memory, "system", UINT64_MAX);
     set_system_memory_map(system_memory);
+
+    system_io = qemu_malloc(sizeof(*system_io));
+    memory_region_init(system_memory, "io", 65536);
+    set_system_io_map(system_io);
 }
 
 MemoryRegion *get_system_memory(void)
@@ -3827,6 +3832,11 @@  MemoryRegion *get_system_memory(void)
     return system_memory;
 }
 
+MemoryRegion *get_system_io(void)
+{
+    return system_io;
+}
+
 #endif /* !defined(CONFIG_USER_ONLY) */
 
 /* physical memory access (slow version, mainly for debug) */