From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Anthony Perard" <anthony.perard@citrix.com>,
"Fam Zheng" <fam@euphon.net>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
kvm@vger.kernel.org, "Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>, "Stefan Weil" <sw@weilnetz.de>,
"Eric Auger" <eric.auger@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
qemu-s390x@nongnu.org,
"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Michael Walle" <michael@walle.cc>,
qemu-ppc@nongnu.org, "Gerd Hoffmann" <kraxel@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
qemu-arm@nongnu.org, "Alistair Francis" <alistair@alistair23.me>,
qemu-block@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
"Jason Wang" <jasowang@redhat.com>,
xen-devel@lists.xenproject.org,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Dmitry Fleytman" <dmitry.fleytman@gmail.com>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
"Paul Durrant" <paul@xen.org>,
"Richard Henderson" <rth@twiddle.net>,
"John Snow" <jsnow@redhat.com>
Subject: [PATCH v3 05/20] exec: Let flatview API take void pointer arguments
Date: Thu, 20 Feb 2020 14:05:33 +0100 [thread overview]
Message-ID: <20200220130548.29974-6-philmd@redhat.com> (raw)
In-Reply-To: <20200220130548.29974-1-philmd@redhat.com>
Only flatview_[read/write]_continue use a byte pointer to increment
an offset. For the users, we are only dealing with a blob buffer.
Use a void pointer argument. This will let us simplify the
address_space API in the next commit.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
include/exec/memory.h | 2 +-
exec.c | 14 ++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index e85b7de99a..6f8084f45e 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -2336,7 +2336,7 @@ void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf, hwaddr len);
MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
- MemTxAttrs attrs, uint8_t *buf,
+ MemTxAttrs attrs, void *buf,
hwaddr len, hwaddr addr1, hwaddr l,
MemoryRegion *mr);
void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_t addr);
diff --git a/exec.c b/exec.c
index 06e386dc72..980cc0e2b2 100644
--- a/exec.c
+++ b/exec.c
@@ -2780,9 +2780,9 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
}
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
- MemTxAttrs attrs, uint8_t *buf, hwaddr len);
+ MemTxAttrs attrs, void *buf, hwaddr len);
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
- const uint8_t *buf, hwaddr len);
+ const void *buf, hwaddr len);
static bool flatview_access_valid(FlatView *fv, hwaddr addr, hwaddr len,
bool is_write, MemTxAttrs attrs);
@@ -3147,7 +3147,7 @@ static bool prepare_mmio_access(MemoryRegion *mr)
/* Called within RCU critical section. */
static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
MemTxAttrs attrs,
- const uint8_t *buf,
+ const void *ptr,
hwaddr len, hwaddr addr1,
hwaddr l, MemoryRegion *mr)
{
@@ -3155,6 +3155,7 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
uint64_t val;
MemTxResult result = MEMTX_OK;
bool release_lock = false;
+ const uint8_t *buf = ptr;
for (;;) {
if (!memory_access_is_direct(mr, true)) {
@@ -3194,7 +3195,7 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
/* Called from RCU critical section. */
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
- const uint8_t *buf, hwaddr len)
+ const void *buf, hwaddr len)
{
hwaddr l;
hwaddr addr1;
@@ -3211,7 +3212,7 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
/* Called within RCU critical section. */
MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
- MemTxAttrs attrs, uint8_t *buf,
+ MemTxAttrs attrs, void *ptr,
hwaddr len, hwaddr addr1, hwaddr l,
MemoryRegion *mr)
{
@@ -3219,6 +3220,7 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
uint64_t val;
MemTxResult result = MEMTX_OK;
bool release_lock = false;
+ uint8_t *buf = ptr;
for (;;) {
if (!memory_access_is_direct(mr, false)) {
@@ -3256,7 +3258,7 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
/* Called from RCU critical section. */
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
- MemTxAttrs attrs, uint8_t *buf, hwaddr len)
+ MemTxAttrs attrs, void *buf, hwaddr len)
{
hwaddr l;
hwaddr addr1;
--
2.21.1
next prev parent reply other threads:[~2020-02-20 13:06 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 13:05 [PATCH v3 00/20] global exec/memory/dma APIs cleanup Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 01/20] scripts/git.orderfile: Display Cocci scripts before code modifications Philippe Mathieu-Daudé
2020-02-20 13:10 ` Laurent Vivier
2020-02-20 13:12 ` Eric Blake
2020-02-20 20:36 ` Michael S. Tsirkin
2020-02-20 13:05 ` [PATCH v3 02/20] hw: Remove unnecessary cast when calling dma_memory_read() Philippe Mathieu-Daudé
2020-02-20 13:16 ` Eric Blake
2020-02-20 13:43 ` Philippe Mathieu-Daudé
2020-02-20 13:51 ` Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 03/20] exec: Let qemu_ram_*() functions take a const pointer argument Philippe Mathieu-Daudé
2020-02-20 13:21 ` Paolo Bonzini
2020-02-20 13:23 ` Philippe Mathieu-Daudé
2020-02-20 13:56 ` [Xen-devel] " Durrant, Paul
2020-02-20 13:05 ` [PATCH v3 04/20] exec: Rename ram_ptr variable Philippe Mathieu-Daudé
2020-02-20 13:05 ` Philippe Mathieu-Daudé [this message]
2020-02-20 13:05 ` [PATCH v3 06/20] exec: Let the address_space API use void pointer arguments Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 07/20] hw/net: Avoid casting non-const pointer, use address_space_write() Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 08/20] Remove unnecessary cast when using the address_space API Philippe Mathieu-Daudé
2020-02-21 8:38 ` Cornelia Huck
2020-02-20 13:05 ` [PATCH v3 09/20] exec: Let the cpu_[physical]_memory API use void pointer arguments Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 10/20] Remove unnecessary cast when using the cpu_[physical]_memory API Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 11/20] hw/ide/internal: Remove unused DMARestartFunc typedef Philippe Mathieu-Daudé
2020-03-05 0:36 ` John Snow
2020-02-20 13:05 ` [PATCH v3 12/20] hw/ide: Let the DMAIntFunc prototype use a boolean 'is_write' argument Philippe Mathieu-Daudé
2020-03-05 0:37 ` John Snow
2020-02-20 13:05 ` [PATCH v3 13/20] hw/virtio: Let virtqueue_map_iovec() " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 14/20] hw/virtio: Let vhost_memory_map() " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 15/20] exec: Let address_space_unmap() " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 16/20] Let address_space_rw() calls pass " Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 17/20] Avoid address_space_rw() with a constant is_write argument Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 18/20] exec: Let cpu_[physical]_memory API use a boolean 'is_write' argument Philippe Mathieu-Daudé
2020-02-20 13:05 ` [PATCH v3 19/20] Let cpu_[physical]_memory() calls pass " Philippe Mathieu-Daudé
2020-02-20 13:54 ` [Xen-devel] " Durrant, Paul
2020-02-20 21:46 ` David Gibson
2020-02-21 8:41 ` Cornelia Huck
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=20200220130548.29974-6-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=aleksandar.rikalo@rt-rk.com \
--cc=alistair@alistair23.me \
--cc=anthony.perard@citrix.com \
--cc=borntraeger@de.ibm.com \
--cc=clg@kaod.org \
--cc=cohuck@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=dmitry.fleytman@gmail.com \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=eric.auger@redhat.com \
--cc=fam@euphon.net \
--cc=hpoussin@reactos.org \
--cc=i.mitsyanko@gmail.com \
--cc=jasowang@redhat.com \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lvivier@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=michael@walle.cc \
--cc=mjrosato@linux.ibm.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=rth@twiddle.net \
--cc=sstabellini@kernel.org \
--cc=sw@weilnetz.de \
--cc=thuth@redhat.com \
--cc=xen-devel@lists.xenproject.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).