[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 06/14] exec.c: Make address_space_rw take tra
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v2 06/14] exec.c: Make address_space_rw take transaction attributes |
Date: |
Tue, 21 Apr 2015 14:27:15 +0100 |
On 21 April 2015 at 08:39, Alex Bennée <address@hidden> wrote:
>
> Peter Maydell <address@hidden> writes:
>
>> Make address_space_rw take transaction attributes, rather
>> than always using the 'unspecified' attributes.
>>
>> Signed-off-by: Peter Maydell <address@hidden>
>> Reviewed-by: Paolo Bonzini <address@hidden>
>> Reviewed-by: Edgar E. Iglesias <address@hidden>
>> ---
>> 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,...
>
> ?
We rely on the convert-to-bool behaviour elsewhere too; it's just that
this one place needs an explicit cast because the dma api makes the
odd choice to have a boolean semantic but an int return type.
(Coding style frowns on yoda-conditionals, by the way.)
-- PMM
- [Qemu-devel] [PATCH v2 05/14] exec.c: Convert subpage memory ops to _with_attrs, (continued)
- [Qemu-devel] [PATCH v2 08/14] exec.c: Capture the memory attributes for a watchpoint hit, Peter Maydell, 2015/04/13
- [Qemu-devel] [PATCH v2 09/14] Switch non-CPU callers from ld/st*_phys to address_space_ld/st*, Peter Maydell, 2015/04/13
- [Qemu-devel] [PATCH v2 06/14] exec.c: Make address_space_rw take transaction attributes, Peter Maydell, 2015/04/13
- [Qemu-devel] [PATCH v2 13/14] target-arm: Use attribute info to handle user-only watchpoints, Peter Maydell, 2015/04/13
- [Qemu-devel] [PATCH v2 12/14] target-arm: Add user-mode transaction attribute, Peter Maydell, 2015/04/13
- [Qemu-devel] [PATCH v2 01/14] memory: Define API for MemoryRegionOps to take attrs and return status, Peter Maydell, 2015/04/13
- Re: [Qemu-devel] [PATCH v2 00/14] Add memory attributes and use them in ARM, Peter Maydell, 2015/04/21