From: Greg Kroah-Hartman Date: Wed, 16 Oct 2019 18:42:16 +0000 (-0700) Subject: 4.19-stable patches X-Git-Tag: v4.4.197~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5e6b859b07e4a72c0d97c638388cf31595abfb2b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: pci-vmd-fix-config-addressing-when-using-bus-offsets.patch --- diff --git a/queue-4.19/pci-vmd-fix-config-addressing-when-using-bus-offsets.patch b/queue-4.19/pci-vmd-fix-config-addressing-when-using-bus-offsets.patch new file mode 100644 index 00000000000..990b86e47c3 --- /dev/null +++ b/queue-4.19/pci-vmd-fix-config-addressing-when-using-bus-offsets.patch @@ -0,0 +1,83 @@ +From e3dffa4f6c3612dea337c9c59191bd418afc941b Mon Sep 17 00:00:00 2001 +From: Jon Derrick +Date: Mon, 16 Sep 2019 07:54:34 -0600 +Subject: PCI: vmd: Fix config addressing when using bus offsets + +From: Jon Derrick + +commit e3dffa4f6c3612dea337c9c59191bd418afc941b upstream. + +VMD maps child device config spaces to the VMD Config BAR linearly +regardless of the starting bus offset. Because of this, the config +address decode must ignore starting bus offsets when mapping the BDF to +the config space address. + +Fixes: 2a5a9c9a20f9 ("PCI: vmd: Add offset to bus numbers if necessary") +Signed-off-by: Jon Derrick +Signed-off-by: Lorenzo Pieralisi +Cc: stable@vger.kernel.org # v5.2+ +Signed-off-by: Sushma Kalakota +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/controller/vmd.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +--- a/drivers/pci/controller/vmd.c ++++ b/drivers/pci/controller/vmd.c +@@ -97,6 +97,7 @@ struct vmd_dev { + struct resource resources[3]; + struct irq_domain *irq_domain; + struct pci_bus *bus; ++ u8 busn_start; + + #ifdef CONFIG_X86_DEV_DMA_OPS + struct dma_map_ops dma_ops; +@@ -468,7 +469,8 @@ static char __iomem *vmd_cfg_addr(struct + unsigned int devfn, int reg, int len) + { + char __iomem *addr = vmd->cfgbar + +- (bus->number << 20) + (devfn << 12) + reg; ++ ((bus->number - vmd->busn_start) << 20) + ++ (devfn << 12) + reg; + + if ((addr - vmd->cfgbar) + len >= + resource_size(&vmd->dev->resource[VMD_CFGBAR])) +@@ -591,7 +593,7 @@ static int vmd_enable_domain(struct vmd_ + unsigned long flags; + LIST_HEAD(resources); + resource_size_t offset[2] = {0}; +- resource_size_t membar2_offset = 0x2000, busn_start = 0; ++ resource_size_t membar2_offset = 0x2000; + + /* + * Shadow registers may exist in certain VMD device ids which allow +@@ -633,14 +635,14 @@ static int vmd_enable_domain(struct vmd_ + pci_read_config_dword(vmd->dev, PCI_REG_VMCONFIG, &vmconfig); + if (BUS_RESTRICT_CAP(vmcap) && + (BUS_RESTRICT_CFG(vmconfig) == 0x1)) +- busn_start = 128; ++ vmd->busn_start = 128; + } + + res = &vmd->dev->resource[VMD_CFGBAR]; + vmd->resources[0] = (struct resource) { + .name = "VMD CFGBAR", +- .start = busn_start, +- .end = busn_start + (resource_size(res) >> 20) - 1, ++ .start = vmd->busn_start, ++ .end = vmd->busn_start + (resource_size(res) >> 20) - 1, + .flags = IORESOURCE_BUS | IORESOURCE_PCI_FIXED, + }; + +@@ -708,8 +710,8 @@ static int vmd_enable_domain(struct vmd_ + pci_add_resource_offset(&resources, &vmd->resources[1], offset[0]); + pci_add_resource_offset(&resources, &vmd->resources[2], offset[1]); + +- vmd->bus = pci_create_root_bus(&vmd->dev->dev, busn_start, &vmd_ops, +- sd, &resources); ++ vmd->bus = pci_create_root_bus(&vmd->dev->dev, vmd->busn_start, ++ &vmd_ops, sd, &resources); + if (!vmd->bus) { + pci_free_resource_list(&resources); + irq_domain_remove(vmd->irq_domain); diff --git a/queue-4.19/series b/queue-4.19/series index 7513a733b44..5a6372698ef 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -77,3 +77,4 @@ ftrace-get-a-reference-counter-for-the-trace_array-on-filter-files.patch tracing-get-trace_array-reference-for-available_tracers-files.patch hwmon-fix-hwmon_p_min_alarm-mask.patch x86-asm-fix-mwaitx-c-state-hint-value.patch +pci-vmd-fix-config-addressing-when-using-bus-offsets.patch