qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Memory: use memory address space for cpu-memory


From: Xu, Anthony
Subject: Re: [Qemu-devel] [PATCH] Memory: use memory address space for cpu-memory
Date: Thu, 18 May 2017 23:28:40 +0000

> On 18/05/2017 23:48, Xu, Anthony wrote:
> >> It should be called.  Alternatively you could try adding a new function
> >> to mark address_space_memory as a never-destroyed AddressSpace:
> >>
> > This patch would do it, could you please submit this patch?
> 
> If you have tested it (together with the change in the initialization of
> address_space_memory), I can do that.
> 

Based on your patch, I added the change in the initialization of 
address_space_memory. It works well in my setup, cpu-memory
address space doesn't show up as we expected.

Anthony

diff --git a/exec.c b/exec.c
index 96e3ac9..746dbbc 100644
--- a/exec.c
+++ b/exec.c
@@ -2712,7 +2712,7 @@ static void memory_map_init(void)
     system_memory = g_malloc(sizeof(*system_memory));

     memory_region_init(system_memory, NULL, "system", UINT64_MAX);
-    address_space_init(&address_space_memory, system_memory, "memory");
+    address_space_init_static(&address_space_memory, system_memory, "memory");

     system_io = g_malloc(sizeof(*system_io));
     memory_region_init_io(system_io, NULL, &unassigned_io_ops, NULL, "io",
diff --git a/include/exec/memory.h b/include/exec/memory.h
index b27b288..6f44b79 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1395,6 +1395,17 @@ MemTxResult memory_region_dispatch_write(MemoryRegion 
*mr,
 void address_space_init(AddressSpace *as, MemoryRegion *root, const char 
*name);

 /**
+ * address_space_init_static: initializes an static address space
+ *
+ * @as: an uninitialized #AddressSpace
+ * @root: a #MemoryRegion that routes addresses for the address space
+ * @name: an address space name.  The name is only used for debugging
+ *        output.
+ */
+void address_space_init_static(AddressSpace *as, MemoryRegion *root,
+       const char *name);
+
+/**
  * address_space_init_shareable: return an address space for a memory region,
  *                               creating it if it does not already exist
  *
diff --git a/memory.c b/memory.c
index 190cd3d..6c933d8 100644
--- a/memory.c
+++ b/memory.c
@@ -2461,7 +2461,8 @@ static void do_address_space_destroy(AddressSpace *as)
     }
 }

-void address_space_init_static(AddressSpace *as, MemoryRegion *root, const 
char *name)
+void address_space_init_static(AddressSpace *as, MemoryRegion *root,
+       const char *name)
 {
     address_space_init(as, root, name);
     as->shared = true;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]