qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/sd/pxa2xx_mmci: Disable reentrancy detection
@ 2023-12-13  1:49 Guenter Roeck
  2023-12-13 17:12 ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2023-12-13  1:49 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-arm, qemu-devel, Guenter Roeck

All tests using pxa2xx_mmc to access mmc cards on pxa2xx platforms
such as borzoi fail starting with commit a2e1753b80 ("memory: prevent
dma-reentracy issues"). Disable reentrancy guard to fix the problem.

Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 hw/sd/pxa2xx_mmci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
index 5e8ea69188..27ae8f2888 100644
--- a/hw/sd/pxa2xx_mmci.c
+++ b/hw/sd/pxa2xx_mmci.c
@@ -555,6 +555,8 @@ static void pxa2xx_mmci_instance_init(Object *obj)
     qdev_init_gpio_out_named(dev, &s->rx_dma, "rx-dma", 1);
     qdev_init_gpio_out_named(dev, &s->tx_dma, "tx-dma", 1);
 
+    s->iomem.disable_reentrancy_guard = true;
+
     qbus_init(&s->sdbus, sizeof(s->sdbus),
               TYPE_PXA2XX_MMCI_BUS, DEVICE(obj), "sd-bus");
 }
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] hw/sd/pxa2xx_mmci: Disable reentrancy detection
  2023-12-13  1:49 [PATCH] hw/sd/pxa2xx_mmci: Disable reentrancy detection Guenter Roeck
@ 2023-12-13 17:12 ` Peter Maydell
  2023-12-13 17:19   ` Philippe Mathieu-Daudé
  2023-12-13 17:55   ` Guenter Roeck
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Maydell @ 2023-12-13 17:12 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: qemu-arm, qemu-devel

On Wed, 13 Dec 2023 at 01:49, Guenter Roeck <linux@roeck-us.net> wrote:
>
> All tests using pxa2xx_mmc to access mmc cards on pxa2xx platforms
> such as borzoi fail starting with commit a2e1753b80 ("memory: prevent
> dma-reentracy issues"). Disable reentrancy guard to fix the problem.
>
> Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  hw/sd/pxa2xx_mmci.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
> index 5e8ea69188..27ae8f2888 100644
> --- a/hw/sd/pxa2xx_mmci.c
> +++ b/hw/sd/pxa2xx_mmci.c
> @@ -555,6 +555,8 @@ static void pxa2xx_mmci_instance_init(Object *obj)
>      qdev_init_gpio_out_named(dev, &s->rx_dma, "rx-dma", 1);
>      qdev_init_gpio_out_named(dev, &s->tx_dma, "tx-dma", 1);
>
> +    s->iomem.disable_reentrancy_guard = true;
> +

All patches that set this flag should include a comment which
explains what the device access path that triggers the reentrancy
is, please.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] hw/sd/pxa2xx_mmci: Disable reentrancy detection
  2023-12-13 17:12 ` Peter Maydell
@ 2023-12-13 17:19   ` Philippe Mathieu-Daudé
  2023-12-13 18:04     ` Guenter Roeck
  2023-12-13 17:55   ` Guenter Roeck
  1 sibling, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-13 17:19 UTC (permalink / raw)
  To: Peter Maydell, Guenter Roeck; +Cc: qemu-arm, qemu-devel

Hi Guenter,

On 13/12/23 18:12, Peter Maydell wrote:
> On Wed, 13 Dec 2023 at 01:49, Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> All tests using pxa2xx_mmc to access mmc cards on pxa2xx platforms
>> such as borzoi fail starting with commit a2e1753b80 ("memory: prevent
>> dma-reentracy issues"). Disable reentrancy guard to fix the problem.
>>
>> Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   hw/sd/pxa2xx_mmci.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
>> index 5e8ea69188..27ae8f2888 100644
>> --- a/hw/sd/pxa2xx_mmci.c
>> +++ b/hw/sd/pxa2xx_mmci.c
>> @@ -555,6 +555,8 @@ static void pxa2xx_mmci_instance_init(Object *obj)
>>       qdev_init_gpio_out_named(dev, &s->rx_dma, "rx-dma", 1);
>>       qdev_init_gpio_out_named(dev, &s->tx_dma, "tx-dma", 1);
>>
>> +    s->iomem.disable_reentrancy_guard = true;
>> +
> 
> All patches that set this flag should include a comment which
> explains what the device access path that triggers the reentrancy
> is, please.

Can we get a reproducer or backtrace please?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] hw/sd/pxa2xx_mmci: Disable reentrancy detection
  2023-12-13 17:12 ` Peter Maydell
  2023-12-13 17:19   ` Philippe Mathieu-Daudé
@ 2023-12-13 17:55   ` Guenter Roeck
  1 sibling, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2023-12-13 17:55 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-arm, qemu-devel

On 12/13/23 09:12, Peter Maydell wrote:
> On Wed, 13 Dec 2023 at 01:49, Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> All tests using pxa2xx_mmc to access mmc cards on pxa2xx platforms
>> such as borzoi fail starting with commit a2e1753b80 ("memory: prevent
>> dma-reentracy issues"). Disable reentrancy guard to fix the problem.
>>
>> Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   hw/sd/pxa2xx_mmci.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
>> index 5e8ea69188..27ae8f2888 100644
>> --- a/hw/sd/pxa2xx_mmci.c
>> +++ b/hw/sd/pxa2xx_mmci.c
>> @@ -555,6 +555,8 @@ static void pxa2xx_mmci_instance_init(Object *obj)
>>       qdev_init_gpio_out_named(dev, &s->rx_dma, "rx-dma", 1);
>>       qdev_init_gpio_out_named(dev, &s->tx_dma, "tx-dma", 1);
>>
>> +    s->iomem.disable_reentrancy_guard = true;
>> +
> 
> All patches that set this flag should include a comment which
> explains what the device access path that triggers the reentrancy
> is, please.
> 

No idea what that would be, sorry. I noticed that the reentrancy guard
causes the affected emulations to fail, but I have no understanding or
knowledge of the code itself. NP if this is insufficient to apply the patch.
I am carrying it locally anyway, so for me it doesn't make a difference.
Maybe someone with better understanding of the underlying code can pick
it up at some point in the future and provide the necessary context.

Thanks,
Guenter



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] hw/sd/pxa2xx_mmci: Disable reentrancy detection
  2023-12-13 17:19   ` Philippe Mathieu-Daudé
@ 2023-12-13 18:04     ` Guenter Roeck
  2023-12-13 19:00       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2023-12-13 18:04 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Peter Maydell; +Cc: qemu-arm, qemu-devel

On 12/13/23 09:19, Philippe Mathieu-Daudé wrote:
> Hi Guenter,
> 
> On 13/12/23 18:12, Peter Maydell wrote:
>> On Wed, 13 Dec 2023 at 01:49, Guenter Roeck <linux@roeck-us.net> wrote:
>>>
>>> All tests using pxa2xx_mmc to access mmc cards on pxa2xx platforms
>>> such as borzoi fail starting with commit a2e1753b80 ("memory: prevent
>>> dma-reentracy issues"). Disable reentrancy guard to fix the problem.
>>>
>>> Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>>> ---
>>>   hw/sd/pxa2xx_mmci.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
>>> index 5e8ea69188..27ae8f2888 100644
>>> --- a/hw/sd/pxa2xx_mmci.c
>>> +++ b/hw/sd/pxa2xx_mmci.c
>>> @@ -555,6 +555,8 @@ static void pxa2xx_mmci_instance_init(Object *obj)
>>>       qdev_init_gpio_out_named(dev, &s->rx_dma, "rx-dma", 1);
>>>       qdev_init_gpio_out_named(dev, &s->tx_dma, "tx-dma", 1);
>>>
>>> +    s->iomem.disable_reentrancy_guard = true;
>>> +
>>
>> All patches that set this flag should include a comment which
>> explains what the device access path that triggers the reentrancy
>> is, please.
> 
> Can we get a reproducer or backtrace please?

qemu-system-arm: warning: Blocked re-entrant IO on MemoryRegion: pxa2xx-mmci at addr: 0x40
[    0.770246] mmc0: invalid bus width
[    0.770962] mmc0: error -22 whilst initialising SD card
[    0.828179] mmc0: invalid bus width
[    0.828445] mmc0: error -22 whilst initialising SD card

with:

qemu-system-arm -M borzoi -kernel arch/arm/boot/zImage -no-reboot -snapshot \
	-device sd-card,drive=d0 -drive file=/tmp/flash,format=raw,if=none,id=d0 \
	-usb -device usb-net,netdev=net0 -netdev user,id=net0 \
	--append "root=/dev/mmcblk0 rootwait console=ttyS0"

Guenter



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] hw/sd/pxa2xx_mmci: Disable reentrancy detection
  2023-12-13 18:04     ` Guenter Roeck
@ 2023-12-13 19:00       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-13 19:00 UTC (permalink / raw)
  To: Guenter Roeck, Peter Maydell; +Cc: qemu-arm, qemu-devel

On 13/12/23 19:04, Guenter Roeck wrote:
> On 12/13/23 09:19, Philippe Mathieu-Daudé wrote:
>> Hi Guenter,
>>
>> On 13/12/23 18:12, Peter Maydell wrote:
>>> On Wed, 13 Dec 2023 at 01:49, Guenter Roeck <linux@roeck-us.net> wrote:
>>>>
>>>> All tests using pxa2xx_mmc to access mmc cards on pxa2xx platforms
>>>> such as borzoi fail starting with commit a2e1753b80 ("memory: prevent
>>>> dma-reentracy issues"). Disable reentrancy guard to fix the problem.
>>>>
>>>> Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
>>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>>>> ---
>>>>   hw/sd/pxa2xx_mmci.c | 2 ++
>>>>   1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c
>>>> index 5e8ea69188..27ae8f2888 100644
>>>> --- a/hw/sd/pxa2xx_mmci.c
>>>> +++ b/hw/sd/pxa2xx_mmci.c
>>>> @@ -555,6 +555,8 @@ static void pxa2xx_mmci_instance_init(Object *obj)
>>>>       qdev_init_gpio_out_named(dev, &s->rx_dma, "rx-dma", 1);
>>>>       qdev_init_gpio_out_named(dev, &s->tx_dma, "tx-dma", 1);
>>>>
>>>> +    s->iomem.disable_reentrancy_guard = true;
>>>> +
>>>
>>> All patches that set this flag should include a comment which
>>> explains what the device access path that triggers the reentrancy
>>> is, please.
>>
>> Can we get a reproducer or backtrace please?
> 
> qemu-system-arm: warning: Blocked re-entrant IO on MemoryRegion: 
> pxa2xx-mmci at addr: 0x40
> [    0.770246] mmc0: invalid bus width
> [    0.770962] mmc0: error -22 whilst initialising SD card
> [    0.828179] mmc0: invalid bus width
> [    0.828445] mmc0: error -22 whilst initialising SD card
> 
> with:
> 
> qemu-system-arm -M borzoi -kernel arch/arm/boot/zImage -no-reboot 
> -snapshot \
>      -device sd-card,drive=d0 -drive 
> file=/tmp/flash,format=raw,if=none,id=d0 \
>      -usb -device usb-net,netdev=net0 -netdev user,id=net0 \
>      --append "root=/dev/mmcblk0 rootwait console=ttyS0"

Thank you, I'll have a look after Christmas.

Regards,

Phil.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-13 19:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-13  1:49 [PATCH] hw/sd/pxa2xx_mmci: Disable reentrancy detection Guenter Roeck
2023-12-13 17:12 ` Peter Maydell
2023-12-13 17:19   ` Philippe Mathieu-Daudé
2023-12-13 18:04     ` Guenter Roeck
2023-12-13 19:00       ` Philippe Mathieu-Daudé
2023-12-13 17:55   ` Guenter Roeck

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).