Alexander Bulekov <alx...@bu.edu> 于2020年9月9日周三 下午10:28写道: > > On 200909 1258, Li Qiang wrote: > > Gerd Hoffmann <kra...@redhat.com> 于2020年9月9日周三 下午12:49写道: > > > > > > On Wed, Sep 09, 2020 at 10:15:47AM +0800, Jason Wang wrote: > > > > > > > > On 2020/9/9 上午12:41, Li Qiang wrote: > > > > > Currently the MR is not explicitly connecting with its device instead > > > > > of > > > > > a opaque. In most situation this opaque is the deivce but it is not an > > > > > enforcement. This patch adds a DeviceState member of to MemoryRegion > > > > > we will use it in later patch. > > > > > > > > > > > > I don't have a deep investigation. But I wonder whether we could make > > > > sure > > > > of owner instead of adding a new field here. > > > > > > Should be possible. There is object_dynamic_cast() which can be used to > > > figure whenever a given owner object is a device. > > > > > > > I found most caller of 'memory_region_init_io' will set the owner to > > the device object. > > But some of them will just set it to NULL. Do will have a clear rule > > that the device's MR > > 'owner' should be the device object? If yes, we can use this field. > > > > Those seem to be devices that havent't been QOM-imfied yet? Maybe those > devices are unlikely to be affected by these issues, though... >
No it seems not related QOM-ified. > For i386, it seems like parallel, port80, portF0, pckbd, and xen_pvdevice .. ? > I'm guessing none of these do DMA. > In fact xen_pvdevice is MMIO but the handlers does nothing. There are some other example than i386 such as the riscv in hw/riscv/sifive_uart.c If we have a rule to force the 'MR's owner to the device then we can fix these NULL owner MR. Thanks, Li Qiang > +CC Stefan, since he replied to the other thread. > > > Thanks, > > Li Qiang > > > > > take care, > > > Gerd > > >