qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PULL 084/136] exec: Let the address_space API use void pointer arguments
Date: Tue, 25 Feb 2020 12:50:14 +0100	[thread overview]
Message-ID: <1582631466-13880-84-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1582631466-13880-1-git-send-email-pbonzini@redhat.com>

From: Philippe Mathieu-Daudé <philmd@redhat.com>

As we are only dealing with a blob buffer, use a void pointer
argument. This will let us simplify other APIs.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 exec.c                | 11 ++++++-----
 include/exec/memory.h | 12 ++++++------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/exec.c b/exec.c
index 17808e3..3d6ee06 100644
--- a/exec.c
+++ b/exec.c
@@ -3271,7 +3271,7 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
 }
 
 MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
-                                    MemTxAttrs attrs, uint8_t *buf, hwaddr len)
+                                    MemTxAttrs attrs, void *buf, hwaddr len)
 {
     MemTxResult result = MEMTX_OK;
     FlatView *fv;
@@ -3287,7 +3287,7 @@ MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
 
 MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
                                 MemTxAttrs attrs,
-                                const uint8_t *buf, hwaddr len)
+                                const void *buf, hwaddr len)
 {
     MemTxResult result = MEMTX_OK;
     FlatView *fv;
@@ -3302,7 +3302,7 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
 }
 
 MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
-                             uint8_t *buf, hwaddr len, bool is_write)
+                             void *buf, hwaddr len, bool is_write)
 {
     if (is_write) {
         return address_space_write(as, addr, attrs, buf, len);
@@ -3326,7 +3326,7 @@ enum write_rom_type {
 static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
                                                            hwaddr addr,
                                                            MemTxAttrs attrs,
-                                                           const uint8_t *buf,
+                                                           const void *ptr,
                                                            hwaddr len,
                                                            enum write_rom_type type)
 {
@@ -3334,6 +3334,7 @@ static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
     uint8_t *ram_ptr;
     hwaddr addr1;
     MemoryRegion *mr;
+    const uint8_t *buf = ptr;
 
     RCU_READ_LOCK_GUARD();
     while (len > 0) {
@@ -3366,7 +3367,7 @@ static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,
 /* used for ROM loading : can write in RAM and ROM */
 MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
                                     MemTxAttrs attrs,
-                                    const uint8_t *buf, hwaddr len)
+                                    const void *buf, hwaddr len)
 {
     return address_space_write_rom_internal(as, addr, attrs,
                                             buf, len, WRITE_DATA);
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 6f8084f..afee185 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -2052,7 +2052,7 @@ void address_space_remove_listeners(AddressSpace *as);
  * @is_write: indicates the transfer direction
  */
 MemTxResult address_space_rw(AddressSpace *as, hwaddr addr,
-                             MemTxAttrs attrs, uint8_t *buf,
+                             MemTxAttrs attrs, void *buf,
                              hwaddr len, bool is_write);
 
 /**
@@ -2070,7 +2070,7 @@ MemTxResult address_space_rw(AddressSpace *as, hwaddr addr,
  */
 MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
                                 MemTxAttrs attrs,
-                                const uint8_t *buf, hwaddr len);
+                                const void *buf, hwaddr len);
 
 /**
  * address_space_write_rom: write to address space, including ROM.
@@ -2096,7 +2096,7 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
  */
 MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
                                     MemTxAttrs attrs,
-                                    const uint8_t *buf, hwaddr len);
+                                    const void *buf, hwaddr len);
 
 /* address_space_ld*: load from an address space
  * address_space_st*: store to an address space
@@ -2334,7 +2334,7 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
 
 /* Internal functions, part of the implementation of address_space_read.  */
 MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
-                                    MemTxAttrs attrs, uint8_t *buf, hwaddr len);
+                                    MemTxAttrs attrs, void *buf, hwaddr len);
 MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
                                    MemTxAttrs attrs, void *buf,
                                    hwaddr len, hwaddr addr1, hwaddr l,
@@ -2374,7 +2374,7 @@ static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write)
  */
 static inline __attribute__((__always_inline__))
 MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
-                               MemTxAttrs attrs, uint8_t *buf,
+                               MemTxAttrs attrs, void *buf,
                                hwaddr len)
 {
     MemTxResult result = MEMTX_OK;
@@ -2433,7 +2433,7 @@ address_space_read_cached(MemoryRegionCache *cache, hwaddr addr,
  */
 static inline void
 address_space_write_cached(MemoryRegionCache *cache, hwaddr addr,
-                           void *buf, hwaddr len)
+                           const void *buf, hwaddr len)
 {
     assert(addr < cache->len && len <= cache->len - addr);
     if (likely(cache->ptr)) {
-- 
1.8.3.1




  parent reply	other threads:[~2020-02-25 12:36 UTC|newest]

Thread overview: 149+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 11:48 [PULL 000/136] Misc patches for 2020-02-25 (refactoring and Coccinelle edition) Paolo Bonzini
2020-02-25 11:48 ` [PULL 002/136] machine: introduce memory-backend property Paolo Bonzini
2020-02-25 11:48 ` [PULL 003/136] machine: alias -mem-path and -mem-prealloc into memory-foo backend Paolo Bonzini
2020-02-25 11:48 ` [PULL 004/136] machine: introduce convenience MachineState::ram Paolo Bonzini
2020-02-25 11:48 ` [PULL 005/136] initialize MachineState::ram in NUMA case Paolo Bonzini
2020-02-25 11:48 ` [PULL 006/136] vl.c: move -m parsing after memory backends has been processed Paolo Bonzini
2020-03-26  9:20   ` Auger Eric
2020-03-26 10:43     ` Igor Mammedov
2020-02-25 11:48 ` [PULL 007/136] vl.c: ensure that ram_size matches size of machine.memory-backend Paolo Bonzini
2020-02-25 11:48 ` [PULL 008/136] alpha/dp264: use memdev for RAM Paolo Bonzini
2020-02-25 11:48 ` [PULL 009/136] arm/aspeed: actually check RAM size Paolo Bonzini
2020-02-25 11:49 ` [PULL 010/136] arm/aspeed: use memdev for RAM Paolo Bonzini
2020-02-25 11:49 ` [PULL 011/136] arm/collie: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 012/136] arm/cubieboard: " Paolo Bonzini
2020-03-02 15:41   ` Peter Maydell
2020-03-02 16:55     ` Igor Mammedov
2020-03-02 17:11       ` Peter Maydell
2020-02-25 11:49 ` [PULL 013/136] arm/digic_boards: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 014/136] arm/highbank: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 015/136] arm/imx25_pdk: drop RAM size fixup Paolo Bonzini
2020-02-25 11:49 ` [PULL 016/136] arm/imx25_pdk: use memdev for RAM Paolo Bonzini
2020-02-25 11:49 ` [PULL 017/136] arm/integratorcp: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 018/136] arm/kzm: drop RAM size fixup Paolo Bonzini
2020-02-25 11:49 ` [PULL 019/136] arm/kzm: use memdev for RAM Paolo Bonzini
2020-02-25 11:49 ` [PULL 020/136] arm/mcimx6ul-evk: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 021/136] arm/mcimx7d-sabre: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 022/136] arm/mps2-tz: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 023/136] arm/mps2: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 024/136] arm/musicpal: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 025/136] arm/nseries: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 026/136] arm/omap_sx1: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 027/136] arm/palm: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 028/136] arm/sabrelite: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 029/136] arm/raspi: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 030/136] arm/sbsa-ref: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 031/136] arm/versatilepb: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 032/136] arm/vexpress: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 033/136] arm/virt: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 034/136] arm/xilinx_zynq: drop RAM size fixup Paolo Bonzini
2020-02-25 11:49 ` [PULL 035/136] arm/xilinx_zynq: use memdev for RAM Paolo Bonzini
2020-02-25 11:49 ` [PULL 036/136] arm/xlnx-versal-virt: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 037/136] arm/xlnx-zcu102: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 038/136] s390x/s390-virtio-ccw: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 039/136] null-machine: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 040/136] cris/axis_dev88: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 041/136] hppa: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 042/136] x86/microvm: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 043/136] x86/pc: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 044/136] lm32/lm32_boards: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 045/136] lm32/milkymist: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 046/136] m68k/an5206: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 047/136] m68k/q800: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 048/136] m68k/mcf5208: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 049/136] m68k/next-cube: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 050/136] mips/boston: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 051/136] mips/mips_fulong2e: drop RAM size fixup Paolo Bonzini
2020-02-25 11:49 ` [PULL 052/136] mips/mips_fulong2e: use memdev for RAM Paolo Bonzini
2020-02-25 11:49 ` [PULL 053/136] mips/mips_jazz: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 054/136] mips/mips_jazz: add max ram size check Paolo Bonzini
2020-02-25 11:49 ` [PULL 055/136] mips/mips_malta: use memdev for RAM Paolo Bonzini
2020-02-25 11:49 ` [PULL 056/136] mips/mips_mipssim: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 057/136] mips/mips_r4k: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 058/136] ppc/e500: drop RAM size fixup Paolo Bonzini
2020-02-25 11:49 ` [PULL 059/136] ppc/e500: use memdev for RAM Paolo Bonzini
2020-02-25 11:49 ` [PULL 060/136] ppc/mac_newworld: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 061/136] ppc/mac_oldworld: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 062/136] ppc/pnv: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 063/136] ppc/ppc405_boards: add RAM size checks Paolo Bonzini
2020-02-25 11:49 ` [PULL 064/136] ppc/ppc405_boards: use memdev for RAM Paolo Bonzini
2020-02-25 11:49 ` [PULL 065/136] ppc/{ppc440_bamboo, sam460ex}: drop RAM size fixup Paolo Bonzini
2020-02-25 11:49 ` [PULL 066/136] ppc/{ppc440_bamboo, sam460ex}: use memdev for RAM Paolo Bonzini
2020-02-25 11:49 ` [PULL 067/136] ppc/spapr: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 068/136] ppc/virtex_ml507: " Paolo Bonzini
2020-02-25 11:49 ` [PULL 069/136] sparc/leon3: " Paolo Bonzini
2020-02-25 11:50 ` [PULL 070/136] sparc/sun4m: " Paolo Bonzini
2020-02-25 11:50 ` [PULL 071/136] sparc/niagara: " Paolo Bonzini
2020-02-25 11:50 ` [PULL 072/136] remove no longer used memory_region_allocate_system_memory() Paolo Bonzini
2020-02-25 11:50 ` [PULL 073/136] exec: cleanup qemu_minrampagesize()/qemu_maxrampagesize() Paolo Bonzini
2020-02-25 11:50 ` [PULL 074/136] exec: drop bogus mem_path from qemu_ram_alloc_from_fd() Paolo Bonzini
2020-02-25 11:50 ` [PULL 075/136] make mem_path local variable Paolo Bonzini
2020-02-25 11:50 ` [PULL 076/136] hostmem: introduce "prealloc-threads" property Paolo Bonzini
2020-02-25 11:50 ` [PULL 077/136] hostmem: fix strict bind policy Paolo Bonzini
2020-02-25 11:50 ` [PULL 078/136] tests/numa-test: make top level args dynamic and g_autofree(cli) cleanups Paolo Bonzini
2020-02-25 11:50 ` [PULL 079/136] tests:numa-test: use explicit memdev to specify node RAM Paolo Bonzini
2020-02-25 11:50 ` [PULL 080/136] scripts/git.orderfile: Display Cocci scripts before code modifications Paolo Bonzini
2020-02-25 11:50 ` [PULL 081/136] hw: Remove unnecessary cast when calling dma_memory_read() Paolo Bonzini
2020-02-25 11:50 ` [PULL 082/136] exec: Rename ram_ptr variable Paolo Bonzini
2020-02-25 11:50 ` [PULL 083/136] exec: Let flatview API take void pointer arguments Paolo Bonzini
2020-02-25 11:50 ` Paolo Bonzini [this message]
2020-02-25 11:50 ` [PULL 085/136] hw/net: Avoid casting non-const pointer, use address_space_write() Paolo Bonzini
2020-02-25 11:50 ` [PULL 086/136] Remove unnecessary cast when using the address_space API Paolo Bonzini
2020-02-25 11:50 ` [PULL 087/136] exec: Let the cpu_[physical]_memory API use void pointer arguments Paolo Bonzini
2020-02-25 11:50 ` [PULL 088/136] Remove unnecessary cast when using the cpu_[physical]_memory API Paolo Bonzini
2020-02-25 11:50 ` [PULL 089/136] hw/ide/internal: Remove unused DMARestartFunc typedef Paolo Bonzini
2020-02-25 11:50 ` [PULL 090/136] hw/ide: Let the DMAIntFunc prototype use a boolean 'is_write' argument Paolo Bonzini
2020-02-25 11:50 ` [PULL 091/136] hw/virtio: Let virtqueue_map_iovec() " Paolo Bonzini
2020-02-25 11:50 ` [PULL 092/136] hw/virtio: Let vhost_memory_map() " Paolo Bonzini
2020-02-25 11:50 ` [PULL 093/136] exec: Let address_space_unmap() " Paolo Bonzini
2020-02-25 11:50 ` [PULL 094/136] Let address_space_rw() calls pass " Paolo Bonzini
2020-02-25 11:50 ` [PULL 095/136] Avoid address_space_rw() with a constant is_write argument Paolo Bonzini
2020-02-25 11:50 ` [PULL 096/136] exec: Let cpu_[physical]_memory API use a boolean 'is_write' argument Paolo Bonzini
2020-02-25 11:50 ` [PULL 097/136] Let cpu_[physical]_memory() calls pass " Paolo Bonzini
2020-02-25 11:50 ` [PULL 098/136] Avoid cpu_physical_memory_rw() with a constant is_write argument Paolo Bonzini
2020-02-25 11:50 ` [PULL 099/136] memory: Correctly return alias region type Paolo Bonzini
2020-02-25 11:50 ` [PULL 100/136] memory: Simplify memory_region_init_rom_nomigrate() to ease review Paolo Bonzini
2020-02-25 11:50 ` [PULL 101/136] scripts/cocci: Rename memory-region-{init-ram -> housekeeping} Paolo Bonzini
2020-02-25 11:50 ` [PULL 102/136] scripts/cocci: Patch to replace memory_region_init_{ram, readonly -> rom} Paolo Bonzini
2020-02-25 11:50 ` [PULL 103/136] hw/arm: Use memory_region_init_rom() with read-only regions Paolo Bonzini
2020-02-25 12:07 ` Paolo Bonzini
2020-02-25 12:07 ` [PULL 104/136] hw/display: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 105/136] hw/mips: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 106/136] hw/m68k: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 107/136] hw/net: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 108/136] hw/pci-host: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 109/136] hw/ppc: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 110/136] hw/riscv: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 111/136] hw/sh4: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 112/136] hw/sparc: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 113/136] scripts/cocci: Patch to detect potential use of memory_region_init_rom Paolo Bonzini
2020-02-25 12:07 ` [PULL 114/136] hw/arm/stm32: Use memory_region_init_rom() with read-only regions Paolo Bonzini
2020-02-25 12:07 ` [PULL 115/136] hw/ppc/ppc405: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 116/136] hw/i386/pc_sysfw: Simplify using memory_region_init_alias() Paolo Bonzini
2020-02-25 12:07 ` [PULL 117/136] hw/i386/pc_sysfw: Remove unused 'ram_size' argument Paolo Bonzini
2020-02-25 12:07 ` [PULL 118/136] scripts/cocci: Patch to remove unnecessary memory_region_set_readonly() Paolo Bonzini
2020-02-25 12:07 ` [PULL 119/136] hw/arm: Remove unnecessary memory_region_set_readonly() on ROM alias Paolo Bonzini
2020-02-25 12:07 ` [PULL 120/136] scripts/cocci: Patch to let devices own their MemoryRegions Paolo Bonzini
2020-02-25 12:07 ` [PULL 121/136] hw/arm: Let devices own the MemoryRegion they create Paolo Bonzini
2020-02-25 12:07 ` [PULL 122/136] hw/char: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 123/136] hw/core: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 124/136] hw/display: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 125/136] hw/dma: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 126/136] hw/riscv: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 127/136] hw/input/milkymist-softusb: Remove unused 'pmem_ptr' field Paolo Bonzini
2020-02-25 12:07 ` [PULL 128/136] hw/input/milkymist-softusb: Let devices own the MemoryRegion they create Paolo Bonzini
2020-02-25 12:07 ` [PULL 129/136] hw/net/milkymist-minimac2: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 130/136] hw/block/onenand: " Paolo Bonzini
2020-02-25 12:07 ` [PULL 131/136] memory: batch allocate ioeventfds[] in address_space_update_ioeventfds() Paolo Bonzini
2020-02-25 12:07 ` [PULL 132/136] mem-prealloc: optimize large guest startup Paolo Bonzini
2020-03-16  8:42   ` Laurent Vivier
2020-03-16  8:45     ` Paolo Bonzini
2020-02-25 12:07 ` [PULL 133/136] qdev-monitor: Forbid repeated device_del Paolo Bonzini
2020-02-25 12:07 ` [PULL 134/136] target/i386: check for empty register in FXAM Paolo Bonzini
2020-02-25 12:07 ` [PULL 135/136] accel/kvm: Check ioctl(KVM_SET_USER_MEMORY_REGION) return value Paolo Bonzini
2020-02-25 12:07 ` [PULL 136/136] WHPX: Assigning maintainer for Windows Hypervisor Platform Paolo Bonzini
2020-02-26 21:07 ` [PULL 000/136] Misc patches for 2020-02-25 (refactoring and Coccinelle edition) Aleksandar Markovic
2020-02-28 10:40   ` Paolo Bonzini
2020-03-06  8:02 ` Christian Borntraeger
2020-03-06  8:34   ` Christian Borntraeger
2020-03-06  8:42     ` Christian Borntraeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1582631466-13880-84-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).