diff mbox series

[v2,01/19] dma-helpers: add a return value to store helpers

Message ID 20171209084338.29395-2-clg@kaod.org
State New
Headers show
Series spapr: Guest exploitation of the XIVE interrupt controller (POWER9) | expand

Commit Message

Cédric Le Goater Dec. 9, 2017, 8:43 a.m. UTC
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 include/sysemu/dma.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Gibson Dec. 19, 2017, 4:46 a.m. UTC | #1
On Sat, Dec 09, 2017 at 09:43:20AM +0100, Cédric Le Goater wrote:
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Hrm.  I know I (indirectly) suggested this, but now that I see it, I'm
thinking adding return values here but not on the read side (which
would be awkward since they return the read values) seems like not a
great idea.

So I'm ok with just open coding the dma_memory_write()s after all.

> ---
>  include/sysemu/dma.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
> index c228c6651360..74a9558af39c 100644
> --- a/include/sysemu/dma.h
> +++ b/include/sysemu/dma.h
> @@ -153,12 +153,12 @@ static inline void dma_memory_unmap(AddressSpace *as,
>          dma_memory_read(as, addr, &val, (_bits) / 8);                   \
>          return _end##_bits##_to_cpu(val);                               \
>      }                                                                   \
> -    static inline void st##_sname##_##_end##_dma(AddressSpace *as,      \
> +    static inline int st##_sname##_##_end##_dma(AddressSpace *as,      \
>                                                   dma_addr_t addr,       \
>                                                   uint##_bits##_t val)   \
>      {                                                                   \
>          val = cpu_to_##_end##_bits(val);                                \
> -        dma_memory_write(as, addr, &val, (_bits) / 8);                  \
> +        return dma_memory_write(as, addr, &val, (_bits) / 8);           \
>      }
>  
>  static inline uint8_t ldub_dma(AddressSpace *as, dma_addr_t addr)
Cédric Le Goater Dec. 19, 2017, 6:43 a.m. UTC | #2
On 12/19/2017 05:46 AM, David Gibson wrote:
> On Sat, Dec 09, 2017 at 09:43:20AM +0100, Cédric Le Goater wrote:
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> 
> Hrm.  I know I (indirectly) suggested this, but now that I see it, I'm
> thinking adding return values here but not on the read side (which
> would be awkward since they return the read values) seems like not a
> great idea.
> 
> So I'm ok with just open coding the dma_memory_write()s after all.

OK. It's not a big change. Maybe I can use :

	ldl_phys(CPU(cpu)->as, ...)
	stl_phys(CPU(cpu)->as, ...)

in some cases, which would give us the correct ordering. 

The Pnv model does a few more peek/poke in RAM to use the XIVE 
structures which are larger, 8 * uint_64t for the XiveEQs and 
16 for the XiveVPs. 

Thanks,

C.

> 
>> ---
>>  include/sysemu/dma.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
>> index c228c6651360..74a9558af39c 100644
>> --- a/include/sysemu/dma.h
>> +++ b/include/sysemu/dma.h
>> @@ -153,12 +153,12 @@ static inline void dma_memory_unmap(AddressSpace *as,
>>          dma_memory_read(as, addr, &val, (_bits) / 8);                   \
>>          return _end##_bits##_to_cpu(val);                               \
>>      }                                                                   \
>> -    static inline void st##_sname##_##_end##_dma(AddressSpace *as,      \
>> +    static inline int st##_sname##_##_end##_dma(AddressSpace *as,      \
>>                                                   dma_addr_t addr,       \
>>                                                   uint##_bits##_t val)   \
>>      {                                                                   \
>>          val = cpu_to_##_end##_bits(val);                                \
>> -        dma_memory_write(as, addr, &val, (_bits) / 8);                  \
>> +        return dma_memory_write(as, addr, &val, (_bits) / 8);           \
>>      }
>>  
>>  static inline uint8_t ldub_dma(AddressSpace *as, dma_addr_t addr)
>
diff mbox series

Patch

diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index c228c6651360..74a9558af39c 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -153,12 +153,12 @@  static inline void dma_memory_unmap(AddressSpace *as,
         dma_memory_read(as, addr, &val, (_bits) / 8);                   \
         return _end##_bits##_to_cpu(val);                               \
     }                                                                   \
-    static inline void st##_sname##_##_end##_dma(AddressSpace *as,      \
+    static inline int st##_sname##_##_end##_dma(AddressSpace *as,      \
                                                  dma_addr_t addr,       \
                                                  uint##_bits##_t val)   \
     {                                                                   \
         val = cpu_to_##_end##_bits(val);                                \
-        dma_memory_write(as, addr, &val, (_bits) / 8);                  \
+        return dma_memory_write(as, addr, &val, (_bits) / 8);           \
     }
 
 static inline uint8_t ldub_dma(AddressSpace *as, dma_addr_t addr)