diff mbox

[RFC,v1,09/11] exec: use per-cpu address-spaces for cpuisms

Message ID a5330007fb685abe0cddfa53baa39880573c62a1.1401760826.git.peter.crosthwaite@xilinx.com
State New
Headers show

Commit Message

Peter Crosthwaite June 3, 2014, 2:11 a.m. UTC
Rather than address_space_memory.

Needs a few random callsites with hardcoded address_space_memory to be
patched. Use first_cpu->as in these cases.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
Long term, cpu_physical_memory_rw and friends needs to be replaced.

 exec.c           | 5 +++--
 hw/core/loader.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Peter Maydell June 3, 2014, 3:28 p.m. UTC | #1
On 3 June 2014 03:11, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
> Rather than address_space_memory.
>
> Needs a few random callsites with hardcoded address_space_memory to be
> patched. Use first_cpu->as in these cases.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> Long term, cpu_physical_memory_rw and friends needs to be replaced.

Yeah. The other two are not so bad, but cpu_physical_memory_rw()
really shouldn't have a first_cpu reference in it.


thanks
-- PMM
Peter Crosthwaite Aug. 20, 2014, 7:42 a.m. UTC | #2
On Wed, Jun 4, 2014 at 1:28 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 3 June 2014 03:11, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
>> Rather than address_space_memory.
>>
>> Needs a few random callsites with hardcoded address_space_memory to be
>> patched. Use first_cpu->as in these cases.
>>
>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>> ---
>> Long term, cpu_physical_memory_rw and friends needs to be replaced.
>
> Yeah. The other two are not so bad, but cpu_physical_memory_rw()
> really shouldn't have a first_cpu reference in it.
>

Dropping that. I guess the plan is to convert users on
cpu_physical_memory_rw to address_space_rw anyways. Can fix them on a
demand basis.

Regards,
Peter

>
> thanks
> -- PMM
>
diff mbox

Patch

diff --git a/exec.c b/exec.c
index aa39f6c..2535b32 100644
--- a/exec.c
+++ b/exec.c
@@ -487,7 +487,8 @@  void cpu_exec_init(CPUArchState *env)
     QTAILQ_INIT(&cpu->breakpoints);
     QTAILQ_INIT(&cpu->watchpoints);
 #ifndef CONFIG_USER_ONLY
-    cpu->as = &address_space_memory;
+    object_property_set_link(OBJECT(cpu), OBJECT(system_memory), "mr",
+                             &error_abort);
     cpu->thread_id = qemu_get_thread_id();
 #endif
     QTAILQ_INSERT_TAIL(&cpus, cpu, node);
@@ -2105,7 +2106,7 @@  bool address_space_read(AddressSpace *as, hwaddr addr, uint8_t *buf, int len)
 void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
                             int len, int is_write)
 {
-    address_space_rw(&address_space_memory, addr, buf, len, is_write);
+    address_space_rw(first_cpu->as, addr, buf, len, is_write);
 }
 
 enum write_rom_type {
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 2bf6b8f..16473a9 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -798,7 +798,7 @@  static void rom_reset(void *unused)
             void *host = memory_region_get_ram_ptr(rom->mr);
             memcpy(host, rom->data, rom->datasize);
         } else {
-            cpu_physical_memory_write_rom(&address_space_memory,
+            cpu_physical_memory_write_rom(first_cpu->as,
                                           rom->addr, rom->data, rom->datasize);
         }
         if (rom->isrom) {