VFIO fixes 2017-07-10
- Don't iterate over non-realized devices (Alex Williamson) - Add PCIe capability version fixup (Alex Williamson) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iQIbBAABAgAGBQJZY9AjAAoJECObm247sIsiQs4P9Ai2tGMihJDJUj71lb/5nQOw 2yvzfJaSaB1136K9BXRiCEFj1x44e1EdweiPur3AqZ8mDVGY/WXWSqnVV/iCLTVR nM7GWtIXnA52LHjwFYomDD/9iz6gj6bPIPGPGAF7iv1A9lfDvgb1Yr9F5bHLE+DQ GBlfT5WM0SzfrN5bFI+yN82elDOTHlbRPtrM9P2GDvj9H9Zvd2RDUn5Uv9yGUbQF mBYMyBZoL3FL3ij09zFFSwuJGYTwxfWTPnc73BgRAyKMyuy2dnv19XwHB3DQSQ70 EbWSzcTYjsuquVKni7hfCD+XrP3NMb2U/42hyOAhXVbKAQ5bVmKFPzwA3bHOWBpR yWhALZVtl1bTQG4J5nrN+VYQfEv3Yr0dyhVUKZXGvrmP8SoA5WWkdeSrDcEANtew VHT7eOsBsCYlqH/0kO772K2XNuvj2XgkDY9da4c5O88WHRk7fUYBZgkjaEQ1uNrq +DV4Eixc4UsQiQOTmfCXFWT6hC8vRaM5NA25EvsRXFn8DNEyD/mlRRkndD9Ujawc LW1enhleeMXOtR/b6M5TqfPmBMGzQm4ITvM9EumLX/1nF0wDG/Ia+9qNVwZmf2qK 6/riDUIpbKMzsj9XerDayLp1vTWEuh8Y3ExoOjadKxNYPsN+xcguOknHEVxA0suh SR20xhlho/Lq+rzTvcY= =FrIF -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/awilliam/tags/vfio-updates-20170710.0' into staging VFIO fixes 2017-07-10 - Don't iterate over non-realized devices (Alex Williamson) - Add PCIe capability version fixup (Alex Williamson) # gpg: Signature made Mon 10 Jul 2017 20:06:11 BST # gpg: using RSA key 0x239B9B6E3BB08B22 # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" # gpg: aka "Alex Williamson <alex@shazbot.org>" # gpg: aka "Alex Williamson <alwillia@redhat.com>" # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" # Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B 8A90 239B 9B6E 3BB0 8B22 * remotes/awilliam/tags/vfio-updates-20170710.0: vfio/pci: Fixup v0 PCIe capabilities vfio: Test realized when using VFIOGroup.device_list iterator Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
29741be341
@ -858,13 +858,15 @@ void vfio_reset_handler(void *opaque)
|
||||
|
||||
QLIST_FOREACH(group, &vfio_group_list, next) {
|
||||
QLIST_FOREACH(vbasedev, &group->device_list, next) {
|
||||
vbasedev->ops->vfio_compute_needs_reset(vbasedev);
|
||||
if (vbasedev->dev->realized) {
|
||||
vbasedev->ops->vfio_compute_needs_reset(vbasedev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QLIST_FOREACH(group, &vfio_group_list, next) {
|
||||
QLIST_FOREACH(vbasedev, &group->device_list, next) {
|
||||
if (vbasedev->needs_reset) {
|
||||
if (vbasedev->dev->realized && vbasedev->needs_reset) {
|
||||
vbasedev->ops->vfio_hot_reset_multi(vbasedev);
|
||||
}
|
||||
}
|
||||
|
@ -1743,6 +1743,18 @@ static int vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
|
||||
PCI_EXP_LNKCAP_MLW | PCI_EXP_LNKCAP_SLS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Intel 82599 SR-IOV VFs report an invalid PCIe capability version 0
|
||||
* (Niantic errate #35) causing Windows to error with a Code 10 for the
|
||||
* device on Q35. Fixup any such devices to report version 1. If we
|
||||
* were to remove the capability entirely the guest would lose extended
|
||||
* config space.
|
||||
*/
|
||||
if ((flags & PCI_EXP_FLAGS_VERS) == 0) {
|
||||
vfio_add_emulated_word(vdev, pos + PCI_CAP_FLAGS,
|
||||
1, PCI_EXP_FLAGS_VERS);
|
||||
}
|
||||
|
||||
pos = pci_add_capability(&vdev->pdev, PCI_CAP_ID_EXP, pos, size,
|
||||
errp);
|
||||
if (pos < 0) {
|
||||
@ -2116,7 +2128,8 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
|
||||
|
||||
/* Prep dependent devices for reset and clear our marker. */
|
||||
QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
|
||||
if (vbasedev_iter->type != VFIO_DEVICE_TYPE_PCI) {
|
||||
if (!vbasedev_iter->dev->realized ||
|
||||
vbasedev_iter->type != VFIO_DEVICE_TYPE_PCI) {
|
||||
continue;
|
||||
}
|
||||
tmp = container_of(vbasedev_iter, VFIOPCIDevice, vbasedev);
|
||||
@ -2197,7 +2210,8 @@ out:
|
||||
}
|
||||
|
||||
QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
|
||||
if (vbasedev_iter->type != VFIO_DEVICE_TYPE_PCI) {
|
||||
if (!vbasedev_iter->dev->realized ||
|
||||
vbasedev_iter->type != VFIO_DEVICE_TYPE_PCI) {
|
||||
continue;
|
||||
}
|
||||
tmp = container_of(vbasedev_iter, VFIOPCIDevice, vbasedev);
|
||||
@ -2647,6 +2661,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
|
||||
vdev->vbasedev.name = g_strdup(basename(vdev->vbasedev.sysfsdev));
|
||||
vdev->vbasedev.ops = &vfio_pci_ops;
|
||||
vdev->vbasedev.type = VFIO_DEVICE_TYPE_PCI;
|
||||
vdev->vbasedev.dev = &vdev->pdev.qdev;
|
||||
|
||||
tmp = g_strdup_printf("%s/iommu_group", vdev->vbasedev.sysfsdev);
|
||||
len = readlink(tmp, group_path, sizeof(group_path));
|
||||
|
@ -640,6 +640,7 @@ static void vfio_platform_realize(DeviceState *dev, Error **errp)
|
||||
int i, ret;
|
||||
|
||||
vbasedev->type = VFIO_DEVICE_TYPE_PLATFORM;
|
||||
vbasedev->dev = dev;
|
||||
vbasedev->ops = &vfio_platform_ops;
|
||||
|
||||
trace_vfio_platform_realize(vbasedev->sysfsdev ?
|
||||
|
@ -115,6 +115,7 @@ typedef struct VFIODevice {
|
||||
struct VFIOGroup *group;
|
||||
char *sysfsdev;
|
||||
char *name;
|
||||
DeviceState *dev;
|
||||
int fd;
|
||||
int type;
|
||||
bool reset_works;
|
||||
|
Loading…
Reference in New Issue
Block a user