Re: [PATCH v2 1/3] memory: Track whether a Device is engaged in IO

2022-05-30 Thread Alexander Bulekov
On 220530 1539, Philippe Mathieu-Daudé wrote: > On 30/5/22 15:28, Peter Maydell wrote: > > On Mon, 30 May 2022 at 14:10, Alexander Bulekov wrote: > > > > > > On 220530 1219, Peter Maydell wrote: > > > > On Fri, 27 May 2022 at 17:19, Alexander Bulekov wrote: > > > > > > > > > > Add a flag to the

Re: [PATCH v2 1/3] memory: Track whether a Device is engaged in IO

2022-05-30 Thread Alexander Bulekov
On 220530 1428, Peter Maydell wrote: > On Mon, 30 May 2022 at 14:10, Alexander Bulekov wrote: > > > > On 220530 1219, Peter Maydell wrote: > > > On Fri, 27 May 2022 at 17:19, Alexander Bulekov wrote: > > > > > > > > Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA. > > > >

Re: [PATCH v2 1/3] memory: Track whether a Device is engaged in IO

2022-05-30 Thread Philippe Mathieu-Daudé via
On 30/5/22 15:28, Peter Maydell wrote: On Mon, 30 May 2022 at 14:10, Alexander Bulekov wrote: On 220530 1219, Peter Maydell wrote: On Fri, 27 May 2022 at 17:19, Alexander Bulekov wrote: Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA. This flag should be set/checked

Re: [PATCH v2 1/3] memory: Track whether a Device is engaged in IO

2022-05-30 Thread Peter Maydell
On Mon, 30 May 2022 at 14:10, Alexander Bulekov wrote: > > On 220530 1219, Peter Maydell wrote: > > On Fri, 27 May 2022 at 17:19, Alexander Bulekov wrote: > > > > > > Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA. > > > This flag should be set/checked prior to calling a

Re: [PATCH v2 1/3] memory: Track whether a Device is engaged in IO

2022-05-30 Thread Alexander Bulekov
On 220530 1219, Peter Maydell wrote: > On Fri, 27 May 2022 at 17:19, Alexander Bulekov wrote: > > > > Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA. > > This flag should be set/checked prior to calling a device's MemoryRegion > > handlers, and set when device code initiat

Re: [PATCH v2 1/3] memory: Track whether a Device is engaged in IO

2022-05-30 Thread David Hildenbrand
On 27.05.22 18:19, Alexander Bulekov wrote: > Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA. > This flag should be set/checked prior to calling a device's MemoryRegion > handlers, and set when device code initiates DMA. The purpose of this > flag is to prevent DMA reentra

Re: [PATCH v2 1/3] memory: Track whether a Device is engaged in IO

2022-05-30 Thread Peter Maydell
On Fri, 27 May 2022 at 17:19, Alexander Bulekov wrote: > > Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA. > This flag should be set/checked prior to calling a device's MemoryRegion > handlers, and set when device code initiates DMA. The purpose of this > flag is to preve

Re: [PATCH v2 1/3] memory: Track whether a Device is engaged in IO

2022-05-30 Thread Darren Kenny
Hi Alex, I don't know this code well enough to be certain, but is a flag sufficient here given the intent, or should it be using a more thread-safe method like a rwlock or condition variable? Maybe the device state structure is already protected at some level with a mutex - just not obvious to

[PATCH v2 1/3] memory: Track whether a Device is engaged in IO

2022-05-27 Thread Alexander Bulekov
Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA. This flag should be set/checked prior to calling a device's MemoryRegion handlers, and set when device code initiates DMA. The purpose of this flag is to prevent DMA reentrancy issues. E.g.: sdhci pio -> dma write -> sdhci mm