Skip to contentSkip to conversation

address_space: replaced function calls

PATCH In review Mriyam Tamuli 3 participants 3 messages Mar 13, 2016 – Mar 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 address_space: replaced function calls

replaced calls named cpu_physical_memory_* with address_space_*

cpus.c
cputlb.c
disas.c
exec.c

---
 cpus.c   |  2 +-
 cputlb.c |  8 ++++----
 disas.c  |  2 +-
 exec.c   | 60 ++++++++++++++++++++++++++++++------------------------------
 4 files changed, 36 insertions(+), 36 deletions(-)
cpus.c +1 -1
index bc774e2..d73cd7b 100644
@@ -1662,7 +1662,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
         l = sizeof(buf);
         if (l > size)
             l = size;
-        cpu_physical_memory_read(addr, buf, l);
+        address_space_read(addr, buf, l);
         if (fwrite(buf, 1, l, f) != l) {
             error_setg(errp, QERR_IO_ERROR);
             goto exit;
cputlb.c +4 -4
index 2f7a166..19aeb6a 100644
@@ -222,15 +222,15 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, ...)
    can be detected */
 void tlb_protect_code(ram_addr_t ram_addr)
 {
-    cpu_physical_memory_test_and_clear_dirty(ram_addr, TARGET_PAGE_SIZE,
-                                             DIRTY_MEMORY_CODE);
+    address_space_test_and_clear_dirty(ram_addr, TARGET_PAGE_SIZE,
+                                       DIRTY_MEMORY_CODE);
 }
 
 /* update the TLB so that writes in physical page 'phys_addr' are no longer
    tested for self modifying code */
 void tlb_unprotect_code(ram_addr_t ram_addr)
 {
-    cpu_physical_memory_set_dirty_flag(ram_addr, DIRTY_MEMORY_CODE);
+    address_space_set_dirty_flag(ram_addr, DIRTY_MEMORY_CODE);
 }
 
 static bool tlb_is_dirty_ram(CPUTLBEntry *tlbe)
@@ -416,7 +416,7 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
             /* Write access calls the I/O callback.  */
             te->addr_write = address | TLB_MMIO;
         } else if (memory_region_is_ram(section->mr)
-                   && cpu_physical_memory_is_clean(
+                   && address_space_is_clean(
                         memory_region_get_ram_addr(section->mr) + xlat)) {
             te->addr_write = address | TLB_NOTDIRTY;
         } else {
disas.c +1 -1
index 05a7a12..c6128e3 100644
@@ -356,7 +356,7 @@ monitor_read_memory (bfd_vma memaddr, bfd_byte *myaddr, int length,
     CPUDebug *s = container_of(info, CPUDebug, info);
 
     if (monitor_disas_is_physical) {
-        cpu_physical_memory_read(memaddr, myaddr, length);
+        address_space_read(memaddr, myaddr, length);
     } else {
         cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
     }
exec.c +30 -30

162 lines not on this page · raw message

Signature · 1 line
2.5.0
#1 lore raw
Quoted 18 lines · Mriyam Tamuli

replaced calls named cpu_physical_memory_* with address_space_*

cpus.c
cputlb.c
disas.c
exec.c

---
 cpus.c   |  2 +-
 cputlb.c |  8 ++++----
 disas.c  |  2 +-
 exec.c   | 60 ++++++++++++++++++++++++++++++------------------------------
 4 files changed, 36 insertions(+), 36 deletions(-)
cpus.c +0 -0
index bc774e2..d73cd7b 100644

cpus.c void qmp_pmemsave(int64_t addr, int64_t size, const char *filename, · line 1665

Quoted 5 lines
cpus.c +1 -1
@@ -1662,7 +1662,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
         l = sizeof(buf);
         if (l > size)
             l = size;
-        cpu_physical_memory_read(addr, buf, l);
+        address_space_read(addr, buf, l);

address_space_read() takes five arguments, not three -- surely this change won't compile?

exec.c static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length) · line 996

Quoted 12 lines
exec.c +3 -3
@@ -991,9 +991,9 @@ static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length)
 }
 
 /* Note: start and end must be within the same ram block.  */
-bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,
-                                              ram_addr_t length,
-                                              unsigned client)
+bool address_space_test_and_clear_dirty(ram_addr_t start,
+                                        ram_addr_t length,
+                                        unsigned client)

This doesn't look right either -- a function address_space_* should take an AddressSpace* as argument.

The idea of the item on the BiteSizedTasks list is to convert code (and in particular device model code) which uses cpu_physical_memory_read() or cpu_physical_memory_write() from using those functions (which implicitly act on the CPU's default address space) to instead use functions which specify their address space explicitly. This might involve changing the devices to allow board code to pass the device a memory region that it should use for DMA type accesses. In any case it is not as simple as a pure search and replace operation.

thanks
-- PMM

#2 lore raw
Quoted 14 lines · Peter Maydell
Quoted 13 lines · Mriyam Tamuli

replaced calls named cpu_physical_memory_* with address_space_*

cpus.c
cputlb.c
disas.c
exec.c

---
 cpus.c   |  2 +-
 cputlb.c |  8 ++++----
 disas.c  |  2 +-
 exec.c   | 60 ++++++++++++++++++++++++++++++------------------------------
 4 files changed, 36 insertions(+), 36 deletions(-)
Quoted 13 lines

cpus.c void qmp_pmemsave(int64_t addr, int64_t size, const char *filename, · line 1665

Quoted 10 lines
cpus.c +1 -1
index bc774e2..d73cd7b 100644
@@ -1662,7 +1662,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
         l = sizeof(buf);
         if (l > size)
             l = size;
-        cpu_physical_memory_read(addr, buf, l);
+        address_space_read(addr, buf, l);

address_space_read() takes five arguments, not three -- surely this change won't compile?

Also, sending 5 identically-titled patches is poor form; it makes life harder for backporting. Please make sure all 5 patches have different subject lines, with proper threading (each message in-reply-to the 0/5 cover letter, rather than its own top-level thread).

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org