]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
PCI/IOV: Mark VFs as not implementing PCI_COMMAND_MEMORY
authorMatthew Rosato <mjrosato@linux.ibm.com>
Thu, 10 Sep 2020 14:59:55 +0000 (10:59 -0400)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 21 Sep 2020 20:42:11 +0000 (14:42 -0600)
For VFs, the Memory Space Enable bit in the Command Register is
hard-wired to 0.

Add a new bit to signify devices where the Command Register Memory
Space Enable bit does not control the device's response to MMIO
accesses.

Fixes: abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO access on disabled memory")
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/pci/iov.c
include/linux/pci.h

index b37e08c4f9d1adcfa1a8b588390066d977b7d399..4afd4ee4f7f04f8d4aed5c7d0f9fc79dd547be0d 100644 (file)
@@ -180,6 +180,7 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id)
        virtfn->device = iov->vf_device;
        virtfn->is_virtfn = 1;
        virtfn->physfn = pci_dev_get(dev);
+       virtfn->no_command_memory = 1;
 
        if (id == 0)
                pci_read_vf_config_common(virtfn);
index 835530605c0d7b4a4626f65c5b869bc49f48fd5c..3ff723124ca7f3b72899b7839800038cf7f8a6d2 100644 (file)
@@ -445,6 +445,7 @@ struct pci_dev {
        unsigned int    is_probed:1;            /* Device probing in progress */
        unsigned int    link_active_reporting:1;/* Device capable of reporting link active */
        unsigned int    no_vf_scan:1;           /* Don't scan for VFs after IOV enablement */
+       unsigned int    no_command_memory:1;    /* No PCI_COMMAND_MEMORY */
        pci_dev_flags_t dev_flags;
        atomic_t        enable_cnt;     /* pci_enable_device has been called */