> From: Michael S. Tsirkin <m...@redhat.com> > Sent: 27 August 2025 04:19 PM > > On Wed, Aug 27, 2025 at 06:21:28AM -0400, Michael S. Tsirkin wrote: > > On Tue, Aug 26, 2025 at 06:52:11PM +0000, Parav Pandit wrote: > > > > > > If it does not, and a user pull out the working device, how > > > > > > does your patch help? > > > > > > > > > > > A driver must tell that it will not follow broken ancient > > > > > behaviour and at that > > > > point device would stop its ancient backward compatibility mode. > > > > > > > > > > > > > > > > I don't know what is "ancient backward compatibility mode". > > > > > > > Let me explain. > > > Sadly, CSPs virtio pci device implementation is done such a way that, it > works with ancient Linux kernel which does not have commit > 43bb40c5b9265. > > > > > > OK we are getting new information here. > > > > So let me summarize. There's a virtual system that pretends, to the > > guest, that device was removed by surprise removal, but actually > > device is there and is still doing DMA. > > Is that a fair summary? > Yes.
> If that is the case, the thing to do would be to try and detect the fake > removal > and then work with device as usual - device not doing DMA after removal is > pretty fundamental, after all. > The issue is: one can build the device to stop the DMA. There is no predictable combination for the driver and device that can work for the user. For example, Device that stops the dma will not work before the commit 43bb40c5b9265. Device that continues the dma will not work with whatever new implementation done in future kernels. Hence the capability negotiation would be needed so that device can stop the DMA, config interrupts etc. > For example, how about reading device control+status? > Most platforms read 0xffff on non-existing device, but not sure if this the standard or well defined. > If we get all ones device has been removed If we get 0 in bus master: device > has been removed but re-inserted Anything else is a fake removal > Bus master check may pass, right returning all 1s, even if the device is removed, isn't it? > Hmm? > > > > > -- > > MST >