diff mbox series

[v5,14/20] hw/audio: explicitly set .requester_type for intel-hda

Message ID 20221111182535.64844-15-alex.bennee@linaro.org
State New
Headers show
Series use MemTxAttrs to avoid current_cpu in hw/ | expand

Commit Message

Alex Bennée Nov. 11, 2022, 6:25 p.m. UTC
This is simulating a bus master writing data back into system memory.
Mark it as such.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 hw/audio/intel-hda.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Henderson Nov. 12, 2022, 5:50 a.m. UTC | #1
On 11/12/22 04:25, Alex Bennée wrote:
> This is simulating a bus master writing data back into system memory.
> Mark it as such.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   hw/audio/intel-hda.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
> index f38117057b..95c28b315c 100644
> --- a/hw/audio/intel-hda.c
> +++ b/hw/audio/intel-hda.c
> @@ -345,7 +345,7 @@ static void intel_hda_corb_run(IntelHDAState *d)
>   
>   static void intel_hda_response(HDACodecDevice *dev, bool solicited, uint32_t response)
>   {
> -    const MemTxAttrs attrs = { .memory = true };
> +    const MemTxAttrs attrs = { .requester_type = MTRT_PCI, .memory = true };

MEMTXATTRS_PCI?


r~
Philippe Mathieu-Daudé Nov. 13, 2022, 7:50 p.m. UTC | #2
On 12/11/22 06:50, Richard Henderson wrote:
> On 11/12/22 04:25, Alex Bennée wrote:
>> This is simulating a bus master writing data back into system memory.
>> Mark it as such.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>   hw/audio/intel-hda.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
>> index f38117057b..95c28b315c 100644
>> --- a/hw/audio/intel-hda.c
>> +++ b/hw/audio/intel-hda.c
>> @@ -345,7 +345,7 @@ static void intel_hda_corb_run(IntelHDAState *d)
>>   static void intel_hda_response(HDACodecDevice *dev, bool solicited, 
>> uint32_t response)
>>   {
>> -    const MemTxAttrs attrs = { .memory = true };
>> +    const MemTxAttrs attrs = { .requester_type = MTRT_PCI, .memory = 
>> true };
> 
> MEMTXATTRS_PCI?

Then removing the 'const' qualifier and setting .memory after.
Peter Maydell Nov. 21, 2022, 6:39 p.m. UTC | #3
On Fri, 11 Nov 2022 at 18:35, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> This is simulating a bus master writing data back into system memory.
> Mark it as such.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  hw/audio/intel-hda.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
> index f38117057b..95c28b315c 100644
> --- a/hw/audio/intel-hda.c
> +++ b/hw/audio/intel-hda.c
> @@ -345,7 +345,7 @@ static void intel_hda_corb_run(IntelHDAState *d)
>
>  static void intel_hda_response(HDACodecDevice *dev, bool solicited, uint32_t response)
>  {
> -    const MemTxAttrs attrs = { .memory = true };
> +    const MemTxAttrs attrs = { .requester_type = MTRT_PCI, .memory = true };

This doesn't look right -- it says "the requester_id field
is a PCI requester ID" but it doesn't fill in requester_id.


>      HDACodecBus *bus = HDA_BUS(dev->qdev.parent_bus);
>      IntelHDAState *d = container_of(bus, IntelHDAState, codecs);
>      hwaddr addr;

What breaks if we don't set this? Put another way, why do
we need to change this but not all the other PCI device models that
do DMA writes, most of which use MEMTXATTRS_UNSPECIFIED ?

I wonder if stl_le_pci_dma() and friends should set the
requester_id on the attrs that they are passed ?

-- PMM
Philippe Mathieu-Daudé Nov. 21, 2022, 10:14 p.m. UTC | #4
On 21/11/22 19:39, Peter Maydell wrote:
> On Fri, 11 Nov 2022 at 18:35, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> This is simulating a bus master writing data back into system memory.
>> Mark it as such.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>   hw/audio/intel-hda.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>

> I wonder if stl_le_pci_dma() and friends should set the
> requester_id on the attrs that they are passed ?

Very good point!
diff mbox series

Patch

diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index f38117057b..95c28b315c 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -345,7 +345,7 @@  static void intel_hda_corb_run(IntelHDAState *d)
 
 static void intel_hda_response(HDACodecDevice *dev, bool solicited, uint32_t response)
 {
-    const MemTxAttrs attrs = { .memory = true };
+    const MemTxAttrs attrs = { .requester_type = MTRT_PCI, .memory = true };
     HDACodecBus *bus = HDA_BUS(dev->qdev.parent_bus);
     IntelHDAState *d = container_of(bus, IntelHDAState, codecs);
     hwaddr addr;