Skip to content
  • Michael S. Tsirkin's avatar
    virtio-pci: fix migration for pci bus master · 4d43d3f3
    Michael S. Tsirkin authored
    
    
    Current support for bus master (clearing OK bit)
    together with the need to support guests which do not
    enable PCI bus mastering, leads to extra state in
    VIRTIO_PCI_FLAG_BUS_MASTER_BUG bit, which isn't robust
    in case of cross-version migration for the case when
    guests use the device before setting DRIVER_OK.
    
    Rip out VIRTIO_PCI_FLAG_BUS_MASTER_BUG and implement a simpler
    work-around: treat clearing of PCI_COMMAND as a virtio reset.  Old
    guests never touch this bit so they will work.
    
    As reset clears device status, DRIVER and MASTER bits are
    now in sync, so we can fix up cross-version migration simply
    by synchronising them, without need to detect a buggy guest
    explicitly.
    
    Drop tracking VIRTIO_PCI_FLAG_BUS_MASTER_BUG completely.
    
    As reset makes the device quiescent, in the future we'll be able to drop
    checking OK bit in a bunch of places.
    
    Cc: Jason Wang <jasowang@redhat.com>
    Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    4d43d3f3