From 7a09490966bd4e36fd1cee33775b3ed15344f93d Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Wed, 29 Nov 2017 11:47:29 -0600 Subject: PCI: Remove sysfs resource mmap warning When a process uses sysfs and tries to mmap more space than is available in a PCI BAR, we emit a warning and a backtrace. The mmap fails anyway, so the backtrace is mainly for debugging. But in general we don't emit kernel messages when syscalls return failure. The similar procfs mmap path simply fails the mmap with no warning. Remove the sysfs warning. Reported-by: Fengguang Wu Signed-off-by: Bjorn Helgaas --- drivers/pci/pci-sysfs.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/pci') diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 06c7f0b85cd2..ccc0e28c6678 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1216,14 +1216,9 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(res->start)) return -EINVAL; - if (!pci_mmap_fits(pdev, bar, vma, PCI_MMAP_SYSFS)) { - WARN(1, "process \"%s\" tried to map 0x%08lx bytes at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n", - current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff, - pci_name(pdev), bar, - (u64)pci_resource_start(pdev, bar), - (u64)pci_resource_len(pdev, bar)); + if (!pci_mmap_fits(pdev, bar, vma, PCI_MMAP_SYSFS)) return -EINVAL; - } + mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io; return pci_mmap_resource_range(pdev, bar, vma, mmap_type, write_combine); -- cgit v1.2.3 From 7153884c088a9500f9379aeec877f3d4d4ec4fba Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Thu, 30 Nov 2017 11:21:57 -0600 Subject: PCI: Remove PCI_REASSIGN_ALL_RSRC use on arm and arm64 On arm, PCI_REASSIGN_ALL_RSRC is used only in pcibios_assign_all_busses(), which helps decide whether to reconfigure bridge bus numbers. It has nothing to do with BAR assignments. On arm64 and powerpc, pcibios_assign_all_busses() tests PCI_REASSIGN_ALL_BUS, which makes more sense. Align arm with arm64 and powerpc, so they all use PCI_REASSIGN_ALL_BUS for pcibios_assign_all_busses(). Remove PCI_REASSIGN_ALL_RSRC from the generic, Tegra, Versatile, and R-Car drivers. These drivers are used only on arm or arm64, where PCI_REASSIGN_ALL_RSRC is not used after this change, so removing it should have no effect. No functional change intended. Signed-off-by: Bjorn Helgaas Reviewed-by: Manikanta Maddireddy Reviewed-by: Lorenzo Pieralisi --- arch/arm/include/asm/pci.h | 5 +---- arch/arm/kernel/bios32.c | 2 +- drivers/pci/host/pci-host-common.c | 2 +- drivers/pci/host/pci-tegra.c | 2 +- drivers/pci/host/pci-versatile.c | 2 +- drivers/pci/host/pcie-rcar.c | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) (limited to 'drivers/pci') diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h index 960d9dc4f380..1f0de808d111 100644 --- a/arch/arm/include/asm/pci.h +++ b/arch/arm/include/asm/pci.h @@ -10,10 +10,7 @@ extern unsigned long pcibios_min_io; extern unsigned long pcibios_min_mem; #define PCIBIOS_MIN_MEM pcibios_min_mem -static inline int pcibios_assign_all_busses(void) -{ - return pci_has_flag(PCI_REASSIGN_ALL_RSRC); -} +#define pcibios_assign_all_busses() pci_has_flag(PCI_REASSIGN_ALL_BUS) #ifdef CONFIG_PCI_DOMAINS static inline int pci_proc_domain(struct pci_bus *bus) diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 0cd0aefb3a8f..ed46ca69813d 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -527,7 +527,7 @@ void pci_common_init_dev(struct device *parent, struct hw_pci *hw) struct pci_sys_data *sys; LIST_HEAD(head); - pci_add_flags(PCI_REASSIGN_ALL_RSRC); + pci_add_flags(PCI_REASSIGN_ALL_BUS); if (hw->preinit) hw->preinit(); pcibios_init_hw(parent, hw, &head); diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c index 44a47d4f0b8f..c4b891c84703 100644 --- a/drivers/pci/host/pci-host-common.c +++ b/drivers/pci/host/pci-host-common.c @@ -142,7 +142,7 @@ int pci_host_common_probe(struct platform_device *pdev, /* Do not reassign resources if probe only */ if (!pci_has_flag(PCI_PROBE_ONLY)) - pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS); + pci_add_flags(PCI_REASSIGN_ALL_BUS); list_splice_init(&resources, &bridge->windows); bridge->dev.parent = dev; diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index f9d3960dc39f..ee193767f77b 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -2382,7 +2382,7 @@ static int tegra_pcie_probe(struct platform_device *pdev) tegra_pcie_enable_ports(pcie); - pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS); + pci_add_flags(PCI_REASSIGN_ALL_BUS); host->busnr = pcie->busn.start; host->dev.parent = &pdev->dev; host->ops = &tegra_pcie_ops; diff --git a/drivers/pci/host/pci-versatile.c b/drivers/pci/host/pci-versatile.c index d417acab0ecf..2a2dfcd68e86 100644 --- a/drivers/pci/host/pci-versatile.c +++ b/drivers/pci/host/pci-versatile.c @@ -202,7 +202,7 @@ static int versatile_pci_probe(struct platform_device *pdev) writel(0, versatile_cfg_base[0] + PCI_INTERRUPT_LINE); pci_add_flags(PCI_ENABLE_PROC_DOMAINS); - pci_add_flags(PCI_REASSIGN_ALL_BUS | PCI_REASSIGN_ALL_RSRC); + pci_add_flags(PCI_REASSIGN_ALL_BUS); list_splice_init(&pci_res, &bridge->windows); bridge->dev.parent = dev; diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 52ab3cb0a0bf..2ef5ff9cddf6 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -459,7 +459,7 @@ static int rcar_pcie_enable(struct rcar_pcie *pcie) rcar_pcie_setup(&bridge->windows, pcie); - pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS); + pci_add_flags(PCI_REASSIGN_ALL_BUS); bridge->dev.parent = dev; bridge->sysdata = pcie; -- cgit v1.2.3 From 116a6063cac3107d5abfe7bd14fc01a19271b14a Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 27 Nov 2017 12:21:10 -0500 Subject: PCI: Use dev_info() rather than dev_err() for ROM validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On AMD GPUs, we use several mechanisms to fetch the VBIOS ROM depending on the platform. We try to read the ROM via the ROM BAR and fall back to other methods in some cases. This leads to spurious error messages from the PCI ROM code which are harmless in our case. This leads to bugs being filed, etc. Change these to dev_info() rather than dev_err() to avoid that. Link: https://bugzilla.kernel.org/show_bug.cgi?id=198077 Link: https://bugzilla.redhat.com/show_bug.cgi?id=1462438 Link: https://bugs.freedesktop.org/show_bug.cgi?id=98798 Signed-off-by: Alex Deucher Signed-off-by: Bjorn Helgaas Reviewed-by: Christian König dev, "Invalid PCI ROM header signature: expecting 0xaa55, got %#06x\n", + dev_info(&pdev->dev, "Invalid PCI ROM header signature: expecting 0xaa55, got %#06x\n", readw(image)); break; } /* get the PCI data structure and check its "PCIR" signature */ pds = image + readw(image + 24); if (readl(pds) != 0x52494350) { - dev_err(&pdev->dev, "Invalid PCI ROM data signature: expecting 0x52494350, got %#010x\n", + dev_info(&pdev->dev, "Invalid PCI ROM data signature: expecting 0x52494350, got %#010x\n", readl(pds)); break; } -- cgit v1.2.3 From a9b94b74806b47348727aa3334a0541427e0061b Mon Sep 17 00:00:00 2001 From: Manikanta Maddireddy Date: Tue, 9 Jan 2018 14:49:33 +0530 Subject: PCI: tegra: Remove PCI_REASSIGN_ALL_BUS use on Tegra Bridge primary, secondary, and subordinate bus numbers power up as zero, and Tegra firmware doesn't program them. pci_scan_bridge_extend() automatically programs these bus numbers if they are zero, so we don't need to set the PCI_REASSIGN_ALL_BUS flag for Tegra. Signed-off-by: Manikanta Maddireddy [bhelgaas: changelog] Signed-off-by: Bjorn Helgaas Acked-by: Thierry Reding --- drivers/pci/host/pci-tegra.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/pci') diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index ee193767f77b..67328a21d0ee 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -2382,7 +2382,6 @@ static int tegra_pcie_probe(struct platform_device *pdev) tegra_pcie_enable_ports(pcie); - pci_add_flags(PCI_REASSIGN_ALL_BUS); host->busnr = pcie->busn.start; host->dev.parent = &pdev->dev; host->ops = &tegra_pcie_ops; -- cgit v1.2.3