On 7/5/2015 2:25, Michael S. Tsirkin wrote:
On Fri, Jul 03, 2015 at 07:09:59PM +0800, Hong Bo Li wrote:
But I would like to note that pci device drivers require driver handshake
before device goes away.
IIUC s390 hotplug is immediate, which is a problem.
Maybe doing the change will help make sure device removal is acked
by guest before it happens?
I did some prototype today. If define zpci first, the progress of unplug
will get complicated.
The point is that you don't have to remove the zpci device at all.
Remove pci device from zpci.
I think the complication you refer to is the guest ack of
the removal, isn't it?
It's complicated, but it has a chance to actually work with
pci device drivers.
This, as opposed to just removing the device whenever host
tells us to.
This patch supports the ack in this way:
After unplugging, the guest will do some cleanup work and disable the zpci
The "is_unplugged" flag in this patch is used to do this ack. Only after the
be disabled, we can remove the zpci device from list and do unparent.
The complication I mean is:
1. If we define zpci first, the user can unplug a s390 pci device in two ways:
a) unplug the vfio pci device first, unplug the zpci device second.
If the user only tell us to unplug the vfio pci, after the ack, we will
still need to wait for the unplug zpci cmd from user, before that,
we have to maintain a useless zpci in list.
b) Unplug the zpci device directly. This will cause the unplugging of vfio
automatically. Then on s390, we have a different unplug cmd comparing to
2. If we define vfio pci first, the user can unplug a s390 pci device in two
a) Unplug the zpci first, unplug the vfio pci device second.
We don't need to maintain the extra s390 zpci structure, after ack, we
remove the zpci from list and do unparent.
b) Unplug the vfio pci directly. This will cause the unplugging of zpci
automatically. Then on s390, we have a same unplug cmd comparing to