qemu-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]