On Fri, Mar 22, 2019 at 02:44:45PM +0100, Jens Freimann wrote: > Commandline: There is a dependency between vfio-pci and virtio-net > devices. One points to the other via new parameters > primar=<primary qdev id> and standby='<standby qdev id>'. This means > that the primary device needs to be specified after standby device on > the qemu command line. Not sure how to solve this.
So we hae this pair of args > -device > virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:6f:55:cc,bus=root2,primary=hostdev0 > \ > > -device vfio-pci,host=5e:00.2,id=hostdev0,bus=root1,standby=net1 \ In this you have denoted the "vfio-pci" device as the primary and "virtio-net-pci" as the standby. There's no need for the user to specify the "primary" property for for the "virtio-net-pci" NIC though. We only need to tell QEMU the relationship in one direction and it can set the relationship in the reverse direction automatically. In fact it is undesirable for the user to specify "primary" property, as they should be able to start QEMU with only the virtio-net-pci device present and then hot-plug a vfio-pci on the fly when it is available. So I think the "virtio-net-pci" merely needs a flag to indicate that it should be prepared to take part in a failover pair, but *not* take any device ID from the user. eg we should be able to start with just -device virtio-net-pci,netdev=hostnet1,id=net1,\ mac=52:54:00:6f:55:cc,bus=root2,failover=on When vfio-pci is then created, either via a further -device arg on later in QMP via device_add, it only needs to specify standby=net1. When vfio-pci is realized it can lookup the virtio-net-pci device in the QOM tree and set its "primary" property to point back to its own device ID. There should never be any need for the user to tell virtio-net-pci what the device ID of the vfio-pci is. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|