From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
patches@linaro.org,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
qemu-devel@nongnu.org, Greg Bellows <greg.bellows@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2 06/14] exec.c: Make address_space_rw take transaction attributes
Date: Tue, 21 Apr 2015 08:39:47 +0100 [thread overview]
Message-ID: <87d22yvsjg.fsf@linaro.org> (raw)
In-Reply-To: <1428931324-4973-7-git-send-email-peter.maydell@linaro.org>
Peter Maydell <peter.maydell@linaro.org> writes:
> Make address_space_rw take transaction attributes, rather
> than always using the 'unspecified' attributes.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
> dma-helpers.c | 3 ++-
> exec.c | 51 ++++++++++++++++++++++++++----------------------
> hw/mips/mips_jazz.c | 6 ++++--
> hw/pci-host/prep.c | 6 ++++--
> include/exec/memory.h | 31 ++++++++++++++++++-----------
> include/sysemu/dma.h | 3 ++-
> ioport.c | 16 +++++++++------
> kvm-all.c | 3 ++-
> scripts/coverity-model.c | 8 +++++---
> 9 files changed, 77 insertions(+), 50 deletions(-)
>
<snip>
> diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
> index 3f2f4c8..efa8b99 100644
> --- a/include/sysemu/dma.h
> +++ b/include/sysemu/dma.h
> @@ -88,7 +88,8 @@ static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr,
> void *buf, dma_addr_t len,
> DMADirection dir)
> {
> - return address_space_rw(as, addr, buf, len, dir == DMA_DIRECTION_FROM_DEVICE);
> + return (bool)address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED,
> + buf, len, dir == DMA_DIRECTION_FROM_DEVICE);
> }
The return does the right thing but I was wondering if it should be more
explicit:
return MEMTX_OK==address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED,...
?
>
> static inline int dma_memory_read_relaxed(AddressSpace *as, dma_addr_t addr,
> diff --git a/ioport.c b/ioport.c
> index 783a3ae..b345bd9 100644
> --- a/ioport.c
> +++ b/ioport.c
> @@ -64,7 +64,8 @@ void cpu_outb(pio_addr_t addr, uint8_t val)
> {
> LOG_IOPORT("outb: %04"FMT_pioaddr" %02"PRIx8"\n", addr, val);
> trace_cpu_out(addr, val);
> - address_space_write(&address_space_io, addr, &val, 1);
> + address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
> + &val, 1);
> }
>
> void cpu_outw(pio_addr_t addr, uint16_t val)
> @@ -74,7 +75,8 @@ void cpu_outw(pio_addr_t addr, uint16_t val)
> LOG_IOPORT("outw: %04"FMT_pioaddr" %04"PRIx16"\n", addr, val);
> trace_cpu_out(addr, val);
> stw_p(buf, val);
> - address_space_write(&address_space_io, addr, buf, 2);
> + address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
> + buf, 2);
> }
>
> void cpu_outl(pio_addr_t addr, uint32_t val)
> @@ -84,14 +86,16 @@ void cpu_outl(pio_addr_t addr, uint32_t val)
> LOG_IOPORT("outl: %04"FMT_pioaddr" %08"PRIx32"\n", addr, val);
> trace_cpu_out(addr, val);
> stl_p(buf, val);
> - address_space_write(&address_space_io, addr, buf, 4);
> + address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
> + buf, 4);
> }
>
> uint8_t cpu_inb(pio_addr_t addr)
> {
> uint8_t val;
>
> - address_space_read(&address_space_io, addr, &val, 1);
> + address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
> + &val, 1);
> trace_cpu_in(addr, val);
> LOG_IOPORT("inb : %04"FMT_pioaddr" %02"PRIx8"\n", addr, val);
> return val;
> @@ -102,7 +106,7 @@ uint16_t cpu_inw(pio_addr_t addr)
> uint8_t buf[2];
> uint16_t val;
>
> - address_space_read(&address_space_io, addr, buf, 2);
> + address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 2);
> val = lduw_p(buf);
> trace_cpu_in(addr, val);
> LOG_IOPORT("inw : %04"FMT_pioaddr" %04"PRIx16"\n", addr, val);
> @@ -114,7 +118,7 @@ uint32_t cpu_inl(pio_addr_t addr)
> uint8_t buf[4];
> uint32_t val;
>
> - address_space_read(&address_space_io, addr, buf, 4);
> + address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 4);
> val = ldl_p(buf);
> trace_cpu_in(addr, val);
> LOG_IOPORT("inl : %04"FMT_pioaddr" %08"PRIx32"\n", addr, val);
> diff --git a/kvm-all.c b/kvm-all.c
> index dd44f8c..4ec153d 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1667,7 +1667,8 @@ static void kvm_handle_io(uint16_t port, void *data, int direction, int size,
> uint8_t *ptr = data;
>
> for (i = 0; i < count; i++) {
> - address_space_rw(&address_space_io, port, ptr, size,
> + address_space_rw(&address_space_io, port, MEMTXATTRS_UNSPECIFIED,
> + ptr, size,
> direction == KVM_EXIT_IO_OUT);
> ptr += size;
> }
> diff --git a/scripts/coverity-model.c b/scripts/coverity-model.c
> index cdda259..224d2d1 100644
> --- a/scripts/coverity-model.c
> +++ b/scripts/coverity-model.c
> @@ -46,6 +46,8 @@ typedef struct va_list_str *va_list;
>
> typedef struct AddressSpace AddressSpace;
> typedef uint64_t hwaddr;
> +typedef uint32_t MemTxResult;
> +typedef uint64_t MemTxAttrs;
>
> static void __write(uint8_t *buf, ssize_t len)
> {
> @@ -65,10 +67,10 @@ static void __read(uint8_t *buf, ssize_t len)
> int last = buf[len-1];
> }
>
> -bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf,
> - int len, bool is_write)
> +MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
> + uint8_t *buf, int len, bool is_write)
> {
> - bool result;
> + MemTxResult result;
>
> // TODO: investigate impact of treating reads as producing
> // tainted data, with __coverity_tainted_data_argument__(buf).
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
next prev parent reply other threads:[~2015-04-21 7:39 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-13 13:21 [Qemu-devel] [PATCH v2 00/14] Add memory attributes and use them in ARM Peter Maydell
2015-04-13 13:21 ` [Qemu-devel] [PATCH v2 01/14] memory: Define API for MemoryRegionOps to take attrs and return status Peter Maydell
2015-04-15 1:35 ` Edgar E. Iglesias
2015-04-17 16:00 ` Alex Bennée
2015-04-13 13:21 ` [Qemu-devel] [PATCH v2 02/14] memory: Replace io_mem_read/write with memory_region_dispatch_read/write Peter Maydell
2015-04-17 16:01 ` Alex Bennée
2015-04-13 13:21 ` [Qemu-devel] [PATCH v2 03/14] Make CPU iotlb a structure rather than a plain hwaddr Peter Maydell
2015-04-17 16:08 ` Alex Bennée
2015-04-13 13:21 ` [Qemu-devel] [PATCH v2 04/14] Add MemTxAttrs to the IOTLB Peter Maydell
2015-04-17 16:09 ` Alex Bennée
2015-04-13 13:21 ` [Qemu-devel] [PATCH v2 05/14] exec.c: Convert subpage memory ops to _with_attrs Peter Maydell
2015-04-17 16:15 ` Alex Bennée
2015-04-17 16:18 ` Peter Maydell
2015-04-17 16:25 ` Alex Bennée
2015-04-13 13:21 ` [Qemu-devel] [PATCH v2 06/14] exec.c: Make address_space_rw take transaction attributes Peter Maydell
2015-04-21 7:39 ` Alex Bennée [this message]
2015-04-21 13:27 ` Peter Maydell
2015-04-13 13:21 ` [Qemu-devel] [PATCH v2 07/14] exec.c: Add new address_space_ld*/st* functions Peter Maydell
2015-04-21 8:36 ` Alex Bennée
2015-04-13 13:21 ` [Qemu-devel] [PATCH v2 08/14] exec.c: Capture the memory attributes for a watchpoint hit Peter Maydell
2015-04-21 8:42 ` Alex Bennée
2015-04-13 13:21 ` [Qemu-devel] [PATCH v2 09/14] Switch non-CPU callers from ld/st*_phys to address_space_ld/st* Peter Maydell
2015-04-21 8:44 ` Alex Bennée
2015-04-13 13:22 ` [Qemu-devel] [PATCH v2 10/14] target-arm: Honour NS bits in page tables Peter Maydell
2015-04-21 9:24 ` Alex Bennée
2015-04-21 13:28 ` Peter Maydell
2015-04-13 13:22 ` [Qemu-devel] [PATCH v2 11/14] target-arm: Use correct memory attributes for page table walks Peter Maydell
2015-04-21 9:36 ` Alex Bennée
2015-04-13 13:22 ` [Qemu-devel] [PATCH v2 12/14] target-arm: Add user-mode transaction attribute Peter Maydell
2015-04-21 9:36 ` Alex Bennée
2015-04-13 13:22 ` [Qemu-devel] [PATCH v2 13/14] target-arm: Use attribute info to handle user-only watchpoints Peter Maydell
2015-04-21 9:37 ` Alex Bennée
2015-04-13 13:22 ` [Qemu-devel] [PATCH v2 14/14] target-arm: Check watchpoints against CPU security state Peter Maydell
2015-04-21 9:37 ` Alex Bennée
2015-04-21 13:35 ` [Qemu-devel] [PATCH v2 00/14] Add memory attributes and use them in ARM Peter Maydell
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=87d22yvsjg.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=edgar.iglesias@gmail.com \
--cc=greg.bellows@linaro.org \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).