qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-4.0 0/3] Avoid cpu_physical_memory_read() in generic code
@ 2018-11-22 11:29 Peter Maydell
  2018-11-22 11:29 ` [Qemu-devel] [PATCH for-4.0 1/3] disas.c: Use address_space_read() to read memory Peter Maydell
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Peter Maydell @ 2018-11-22 11:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Dr. David Alan Gilbert, Markus Armbruster

This patchset takes three places in generic code which
use cpu_physical_memory_read(), and changes them to use
address_space_read() instead.

cpu_physical_memory_{read,rw,write} all implicitly assume
that there is exactly one view of physical memory. This
is sort-of true today, but we'd like to be able to move
to having heterogenous systems where not all CPUs share
the same view of physical memory.

In disas.c we are disassembling for a particular CPU, so
use that CPU's primary address space (cs->as).

In monitor.c we are reading physical memory for a
particular CPU, so again use that CPU's primary address
space; we fall back to address_space_memory for the case
where there are no CPUs in the system (-machine none).

In elf_ops.h the function was passed an address space to
use, so just use it.

Other places in generic code that use these functions are:
 * dump.c -- the whole UI here seems to assume that there
   is only one view of memory and that is what is being dumped
 * cpu.c:qmp_pmemsave() -- again, the UI assumption is that
   there's only one view of memory
So I've left those alone.

NB: git grep command line for finding callsites:
 git grep '\<cpu_physical_memory_\(read\|write\|rw\)\>'

thanks
-- PMM

Peter Maydell (3):
  disas.c: Use address_space_read() to read memory
  monitor: Use address_space_read() to read memory
  elf_ops.h: Use address_space_write() to write memory

 include/hw/elf_ops.h | 3 ++-
 disas.c              | 5 ++++-
 monitor.c            | 8 +++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.19.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-11-22 16:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-22 11:29 [Qemu-devel] [PATCH for-4.0 0/3] Avoid cpu_physical_memory_read() in generic code Peter Maydell
2018-11-22 11:29 ` [Qemu-devel] [PATCH for-4.0 1/3] disas.c: Use address_space_read() to read memory Peter Maydell
2018-11-22 12:21   ` Philippe Mathieu-Daudé
2018-11-22 11:29 ` [Qemu-devel] [PATCH for-4.0 2/3] monitor: " Peter Maydell
2018-11-22 13:01   ` Dr. David Alan Gilbert
2018-11-22 11:29 ` [Qemu-devel] [PATCH for-4.0 3/3] elf_ops.h: Use address_space_write() to write memory Peter Maydell
2018-11-22 11:44   ` Philippe Mathieu-Daudé
2018-11-22 16:36   ` Peter Maydell

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).