]> www.infradead.org Git - users/dwmw2/linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:57:54 +0000 (09:57 +0100)
[ Upstream commit 12856e7acde4702b7c3238c15fcba86ff6aa507f ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/iov.c
include/linux/pci.h

index 9c116cbaa95d838f1a626ee90df81e65c8520af5..e15220385666f56e999fb2de5f31a12efcddf508 100644 (file)
@@ -158,6 +158,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 e92bd9b32f36935c6171d33df07e68185564ecb3..6a6a819c5b49b5897e77961604aa6c2e6a995640 100644 (file)
@@ -423,6 +423,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 */