[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/7] memory: associate DMA accesses with the initiator Dev
From: |
Peter Xu |
Subject: |
Re: [PATCH v3 1/7] memory: associate DMA accesses with the initiator Device |
Date: |
Tue, 15 Nov 2022 11:19:36 -0500 |
On Fri, Oct 28, 2022 at 03:16:42PM -0400, Alexander Bulekov wrote:
> + /* Do not allow more than one simultanous access to a device's IO
> Regions */
> + if (mr->owner &&
> + !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly)
> {
> + dev = (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE);
> + if (dev->mem_reentrancy_guard.engaged_in_io) {
Do we need to check dev being non-NULL? Fundamentally it's about whether
the owner can be not a DeviceState, I believe it's normally true but I
can't tell; at least from memory region API it can be any Object*.
> + trace_memory_region_reentrant_io(get_cpu_index(), mr, addr,
> size);
> + return MEMTX_ERROR;
> + }
> + dev->mem_reentrancy_guard.engaged_in_io = true;
> + }
--
Peter Xu