v1->v2: Address Bjorn's comments - split code out to vc.c - #defines for everything - rename VC defines - fix word access to PCI_VC_PORT_CTRL It ended up getting a little bigger since I added function description comments, header, includes and misc lines here and there. v1: Turns out that even though we don't do much with virtual channel, we still need to save/restore it around reset. The case where this comes into play currently is a card with a switch and multiple devices, all supporting VC (Nvidia GRID). On some platforms the system firmware will leave all the virtual channel capabilities in their default state, where the VC0 TC/VC map is 0xff (TC0-7 enabled over VC0). Other systems decide to restrict the available traffic classes and configure 0x01 (only TC0 over VC0). At handoff, everything works, but as soon as we do a device reset, especially if done via bus reset, the endpoint can be returned to the spec defined default rather than the platform default. If such a device is then assigned to a guest, the guest driver sees multiple TCs enabled, attempts to use them, and it fails. The failure mode depends on the platform, ranging from the driver in the guest failing to work to host panic from an unsupported transaction. This series attempts to implement full save/restore support for all types of virtual channel (VC, MFVC, and VC9). The buffer sizing code will execute for any device with these capabilities, but of couse the actual save/restore is only done if a reset is requested for the device, which typically means assignment to a VM. Thanks, Alex --- Alex Williamson (4): pci: Generalize wait loop pci: Add support for save/restore of extended capabilities pci: Add Virtual Channel to save/restore support pci: Rename PCI_VC_PORT_REG1/2 to PCI_VC_PORT_CAP1/2 drivers/pci/Makefile | 2 drivers/pci/pci.c | 102 ++++++-- drivers/pci/vc.c | 434 ++++++++++++++++++++++++++++++++++++ drivers/vfio/pci/vfio_pci_config.c | 12 - include/linux/pci.h | 15 + include/uapi/linux/pci_regs.h | 29 ++ 6 files changed, 549 insertions(+), 45 deletions(-) create mode 100644 drivers/pci/vc.c -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html