Bjorn Helgaas [Wed, 19 Mar 2014 21:11:03 +0000 (15:11 -0600)]
Merge branch 'pci/misc' into next
* pci/misc:
PCI: Enable INTx in pci_reenable_device() only when MSI/MSI-X not enabled
Bjorn Helgaas [Fri, 7 Mar 2014 23:06:05 +0000 (16:06 -0700)]
PCI: Enable INTx in pci_reenable_device() only when MSI/MSI-X not enabled
Andreas reported that after
1f42db786b14 ("PCI: Enable INTx if BIOS left
them disabled"), pciehp surprise removal stopped working.
This happens because pci_reenable_device() on the hotplug bridge (used in
the pciehp_configure_device() path) clears the Interrupt Disable bit, which
apparently breaks the bridge's MSI hotplug event reporting.
Previously we cleared the Interrupt Disable bit in do_pci_enable_device(),
which is used by both pci_enable_device() and pci_reenable_device(). But
we use pci_reenable_device() after the driver may have enabled MSI or
MSI-X, and we *set* Interrupt Disable as part of enabling MSI/MSI-X.
This patch clears Interrupt Disable only when MSI/MSI-X has not been
enabled.
Fixes: 1f42db786b14 PCI: Enable INTx if BIOS left them disabled
Link: https://bugzilla.kernel.org/show_bug.cgi?id=71691
Reported-and-tested-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: stable@vger.kernel.org
CC: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Bjorn Helgaas [Wed, 26 Feb 2014 21:00:51 +0000 (14:00 -0700)]
Merge branches 'pci/host-designware', 'pci/host-imx6' and 'pci/host-rcar' into next
* pci/host-designware:
PCI: designware: Fix RC BAR to be single 64-bit non-prefetchable memory BAR
* pci/host-imx6:
PCI: imx6: Wait for retraining
* pci/host-rcar:
PCI: rcar: Make the Kconfig dependencies more generic
PCI: rcar: Break out window size handling
PCI: rcar: Register each instance independently
PCI: rcar: Fix bridge logic configuration accesses
PCI: rcar: Add error interrupt handling
PCI: rcar: Check platform_get_irq() return code
Magnus Damm [Tue, 18 Feb 2014 02:12:01 +0000 (11:12 +0900)]
PCI: rcar: Make the Kconfig dependencies more generic
Update the R-Car Generation 2 PCI driver Kconfig dependencies to follow
same style as other drivers - no SoC dependencies.
Also, update the COMPILE_TEST bits to depend on ARM. This since the DMA
bounce buffer and dma_ops handling code is ARM specific.
[bhelgaas: adjust context after dropping DMABOUNCE patches]
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Bjorn Helgaas [Thu, 20 Feb 2014 21:32:34 +0000 (14:32 -0700)]
Merge branch 'pci/dead-code' into next
* pci/dead-code:
PCI: Remove unused SR-IOV VF Migration support
iommu/amd: Add include of <linux/irqreturn.h>
mei: Add include of <linux/irqreturn.h>
misc: mic: Add include of <linux/irqreturn.h>
Bjorn Helgaas [Thu, 20 Feb 2014 21:30:57 +0000 (14:30 -0700)]
Merge branch 'pci/pciehp' into next
* pci/pciehp:
PCI: pciehp: Cleanup whitespace
PCI: pciehp: Remove a non-existent card, regardless of "surprise" capability
PCI: pciehp: Don't turn slot off when hot-added device already exists
PCI: pciehp: Add hotplug_lock to serialize hotplug events
PCI: pciehp: Ensure very fast hotplug events are also processed
PCI: pciehp: Disable link notification across slot reset
PCI: pciehp: Don't check adapter or latch status while disabling
PCI: pciehp: Don't disable the link permanently during removal
PCI: pciehp: Enable link state change notifications
PCI: pciehp: Use link change notifications for hot-plug and removal
PCI: pciehp: Make check_link_active() non-static
Bjorn Helgaas [Thu, 20 Feb 2014 21:30:32 +0000 (14:30 -0700)]
Merge branch 'pci/list-for-each-entry' into next
* pci/list-for-each-entry:
PCI: frv: replace now removed pci_bus_b() causing build failure
Paul Gortmaker [Thu, 20 Feb 2014 17:46:06 +0000 (12:46 -0500)]
PCI: frv: replace now removed pci_bus_b() causing build failure
In commit
94e6a9b93064 ("PCI: Remove pci_bus_b() and use
list_for_each_entry() directly") the function pci_bus_b() was removed, but
one instance of its usage was missed.
Replace it in the same fashion that the original commit did.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Yijing Wang <wangyijing@huawei.com>
Bjorn Helgaas [Tue, 11 Feb 2014 22:26:29 +0000 (15:26 -0700)]
PCI: pciehp: Cleanup whitespace
Minor whitespace cleanup; no functional change.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Rajat Jain [Wed, 19 Feb 2014 02:53:19 +0000 (18:53 -0800)]
PCI: pciehp: Remove a non-existent card, regardless of "surprise" capability
In case a card is physically yanked out, it should immediately be removed,
regardless of the "surprise" capability bit. Thus:
- Always handle the physical removal - regardless of the "surprise" bit.
- Don't use "surprise" capability when making decisions about enabling
presence detect notifications.
- Reword the comments to indicate the intent.
Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Marek Vasut [Wed, 19 Feb 2014 20:22:18 +0000 (13:22 -0700)]
PCI: imx6: Wait for retraining
This patch handles the case where the PCIe link is up and running, yet
drops into the LTSSM training mode. The link spends short time in the LTSSM
training mode, but the current code can misinterpret it as the link being
stalled. Waiting for the LTSSM training to complete fixes the issue.
Quoting Sascha:
This is broken since commit
7f9f40c01cce ('PCI: imx6: Report "link up"
only after link training completes').
The designware driver changes the PORT_LOGIC_SPEED_CHANGE bit in
dw_pcie_host_init() which causes the link to be retrained. During the
next call to dw_pcie_rd_conf() the link is then reported being down and
the function returns PCIBIOS_DEVICE_NOT_FOUND resulting in nonfunctioning
PCIe.
Fixes: 7f9f40c01cce (PCI: imx6: Report "link up" only after link training completes)
Tested-by: Troy Kisky <troy.kisky@boundarydevices.com>
Tested-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Mohit Kumar [Wed, 19 Feb 2014 12:04:35 +0000 (17:34 +0530)]
PCI: designware: Fix RC BAR to be single 64-bit non-prefetchable memory BAR
The Synopsys PCIe core provides one pair of 32-bit BARs (BAR 0 and BAR 1).
The BARs can be configured as follows:
- One 64-bit BAR: BARs 0 and 1 are combined to form a single 64-bit BAR
- Two 32-bit BARs: BARs 0 and 1 are two independent 32-bit BARs
This patch corrects 64-bit, non-prefetchable memory BAR configuration
implemented in dw driver.
Signed-off-by: Mohit Kumar <mohit.kumar@st.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Pratyush Anand <pratyush.anand@st.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: stable@vger.kernel.org # v3.12+
Bjorn Helgaas [Thu, 30 Jan 2014 18:28:15 +0000 (11:28 -0700)]
PCI: Remove unused SR-IOV VF Migration support
This reverts commit
74bb1bcc7dbb ("PCI: handle SR-IOV Virtual Function
Migration"), removing this exported interface:
pci_sriov_migration()
Since pci_sriov_migration() is unused, it is impossible to schedule
sriov_migration_task() or use any of the other migration infrastructure.
This is based on Stephen Hemminger's patch (see link below), but goes a bit
further.
Link: http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.net
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
Bjorn Helgaas [Fri, 14 Feb 2014 21:08:51 +0000 (14:08 -0700)]
iommu/amd: Add include of <linux/irqreturn.h>
We currently include <linux/irqreturn.h> in <linux/pci.h>, but I'm about to
remove that from linux/pci.h, so add explicit includes where needed.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Bjorn Helgaas [Fri, 14 Feb 2014 21:06:14 +0000 (14:06 -0700)]
mei: Add include of <linux/irqreturn.h>
We currently include <linux/irqreturn.h> in <linux/pci.h>, but I'm about to
remove that from linux/pci.h, so add explicit includes where needed.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Bjorn Helgaas [Wed, 19 Feb 2014 00:02:04 +0000 (17:02 -0700)]
Merge branch 'pci/misc' into next
* pci/misc:
PCI: Enable INTx if BIOS left them disabled
ia64/PCI: Set IORESOURCE_ROM_SHADOW only for the default VGA device
x86/PCI: Set IORESOURCE_ROM_SHADOW only for the default VGA device
PCI: Update outdated comment for pcibios_bus_report_status()
PCI: Cleanup per-arch list of object files
PCI: cpqphp: Fix hex vs decimal typo in cpqhpc_probe()
x86/PCI: Fix function definition whitespace
x86/PCI: Reword comments
x86/PCI: Remove unnecessary local variable initialization
PCI: Remove unnecessary list_empty(&pci_pme_list) check
Bjorn Helgaas [Wed, 29 Jan 2014 23:13:51 +0000 (16:13 -0700)]
PCI: Enable INTx if BIOS left them disabled
Some firmware leaves the Interrupt Disable bit set even if the device uses
INTx interrupts. Clear Interrupt Disable so we get those interrupts.
Based on the report mentioned below, if the user selects the "EHCI only"
option in the Intel Baytrail BIOS, the EHCI device is handed off to the OS
with the PCI_COMMAND_INTX_DISABLE bit set.
Link: http://lkml.kernel.org/r/20140114181721.GC12126@xanatos
Link: https://bugzilla.kernel.org/show_bug.cgi?id=70601
Reported-by: Chris Cheng <chris.cheng@atrustcorp.com>
Reported-and-tested-by: Jamie Chen <jamie.chen@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: stable@vger.kernel.org
CC: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Bjorn Helgaas [Tue, 18 Feb 2014 22:50:12 +0000 (15:50 -0700)]
Merge branch 'pci/host-mvebu' into next
* pci/host-mvebu:
PCI: mvebu: Call request_resource() on the apertures
bus: mvebu-mbus: Fix incorrect size for PCI aperture resources
PCI: mvebu: Fix potential issue in range parsing
PCI: mvebu: Use Device ID and revision from underlying endpoint
Bjorn Helgaas [Tue, 18 Feb 2014 21:33:46 +0000 (14:33 -0700)]
Merge branch 'pci/list-for-each-entry' into next
* pci/list-for-each-entry:
PCI: Remove pci_bus_b() and use list_for_each_entry() directly
pcmcia: Use list_for_each_entry() for bus traversal
powerpc/PCI: Use list_for_each_entry() for bus traversal
drm: Use list_for_each_entry() for bus traversal
ARM/PCI: Use list_for_each_entry() for bus traversal
ACPI / hotplug / PCI: Use list_for_each_entry() for bus traversal
Bjorn Helgaas [Fri, 14 Feb 2014 21:05:18 +0000 (14:05 -0700)]
misc: mic: Add include of <linux/irqreturn.h>
We currently include <linux/irqreturn.h> in <linux/pci.h>, but I'm about to
remove that from linux/pci.h, so add explicit includes where needed.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Sudeep Dutt <sudeep.dutt@intel.com>
Jason Gunthorpe [Wed, 12 Feb 2014 22:57:08 +0000 (15:57 -0700)]
PCI: mvebu: Call request_resource() on the apertures
It is typical for host drivers to request a resource for the aperture; once
this is done the PCI core will properly populate resources for all BARs in
the system.
With this patch cat /proc/iomem will now show:
e0000000-
efffffff : PCI MEM 0000
e0000000-
e00fffff : PCI Bus 0000:01
e0000000-
e001ffff : 0000:01:00.0
Tested on Kirkwood.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Jason Gunthorpe [Wed, 12 Feb 2014 22:57:07 +0000 (15:57 -0700)]
bus: mvebu-mbus: Fix incorrect size for PCI aperture resources
reg[0] is the DT base, reg[1] is the DT length in bytes,
struct resource.end is the inclusive end address, so a -1 is required.
Tested on kirkwood.
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Magnus Damm [Tue, 18 Feb 2014 02:11:32 +0000 (11:11 +0900)]
PCI: rcar: Break out window size handling
Break out the hard coded window size code to allow dynamic setup. The
window size is still left at 1GiB but with this patch changing window size
is easy for testing.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Magnus Damm [Tue, 18 Feb 2014 02:11:21 +0000 (11:11 +0900)]
PCI: rcar: Register each instance independently
Convert the code to allow per-device probe() like other device drivers.
This also delays driver registration due to change from subsys_initcall()
to regular module_platform_driver().
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Ben Dooks [Tue, 18 Feb 2014 02:11:11 +0000 (11:11 +0900)]
PCI: rcar: Fix bridge logic configuration accesses
The bridge logic at slot 0 only supports reads up to 0x40 and the rest of
the PCI configuration space for this slot is marked as reserved in the
manual.
Trying a read from offset 0x100 is producing an error from the bridge. With
error interrupts enabled, the following is printed:
pci-rcar-gen2
ee0d0000.pci: error irq: status
00000014
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Ben Dooks [Tue, 18 Feb 2014 02:11:01 +0000 (11:11 +0900)]
PCI: rcar: Add error interrupt handling
Add option to enable interrupts to report any errors from the AHB-PCI
bridge to help find any issues with the bridge when in use.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Ben Dooks [Tue, 18 Feb 2014 02:10:51 +0000 (11:10 +0900)]
PCI: rcar: Check platform_get_irq() return code
The current code does not check the return from platform_get_irq() so add
an error check and return if this call does fail.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Bjorn Helgaas [Fri, 14 Feb 2014 21:38:00 +0000 (14:38 -0700)]
Merge branch 'pci/msi' into next
* pci/msi:
vfio: Use pci_enable_msi_range() and pci_enable_msix_range()
ahci: Use pci_enable_msi_range() instead of pci_enable_msi_block()
ahci: Fix broken fallback to single MSI mode
PCI/MSI: Add pci_enable_msi_exact() and pci_enable_msix_exact()
PCI/MSI: Fix cut-and-paste errors in documentation
PCI/MSI: Add pci_enable_msi() documentation back
PCI/MSI: Fix pci_msix_vec_count() htmldocs failure
PCI/MSI: Fix leak of msi_attrs
PCI/MSI: Check kmalloc() return value, fix leak of name
Bjorn Helgaas [Fri, 14 Feb 2014 21:37:18 +0000 (14:37 -0700)]
Merge branch 'pci/virtualization' into next
* pci/virtualization:
PCI: Enable quirks for PCIe ACS on Intel PCH root ports
PCI: Add pci_dev_flag for ACS enable quirks
PCI: Add device-specific PCI ACS enable
Bjorn Helgaas [Fri, 14 Feb 2014 21:37:09 +0000 (14:37 -0700)]
Merge branch 'pci/scan-bridge' into next
* pci/scan-bridge:
PCI: Don't scan random busses in pci_scan_bridge()
PCI: Check for child busses which use more bus numbers than allocated
PCI: Remove pci_fixup_parent_subordinate_busnr()
PCI: Make sure bus number resources stay within their parents bounds
PCI: Use request_resource_conflict() instead of insert_ for bus numbers
PCI: Assign CardBus bus number only during the second pass
PCI: Clarify the "scan anyway" comment in pci_scan_bridge()
PCI: Increment max correctly in pci_scan_bridge()
Alexander Gordeev [Fri, 17 Jan 2014 16:02:21 +0000 (17:02 +0100)]
vfio: Use pci_enable_msi_range() and pci_enable_msix_range()
pci_enable_msix() and pci_enable_msi_block() have been deprecated; use
pci_enable_msix_range() and pci_enable_msi_range() instead.
[bhelgaas: changelog]
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Alexander Gordeev [Wed, 29 Jan 2014 21:19:43 +0000 (14:19 -0700)]
ahci: Use pci_enable_msi_range() instead of pci_enable_msi_block()
pci_enable_msi_block() has been deprecated; use pci_enable_msi_range()
instead.
[bhelgaas: changelog]
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Tejun Heo <tj@kernel.org>
Alexander Gordeev [Fri, 17 Jan 2014 16:02:15 +0000 (17:02 +0100)]
ahci: Fix broken fallback to single MSI mode
Commit
7b92b4f61ec4 ("PCI/MSI: Remove pci_enable_msi_block_auto()")
introduced a regression: if multiple MSI initialization fails, the code
falls back to INTx rather than to single MSI.
Fixes: 7b92b4f61ec4 ("PCI/MSI: Remove pci_enable_msi_block_auto()")
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Tejun Heo <tj@kernel.org>
Sander Eikelenboom [Fri, 14 Feb 2014 18:55:13 +0000 (11:55 -0700)]
ia64/PCI: Set IORESOURCE_ROM_SHADOW only for the default VGA device
Setting the IORESOURCE_ROM_SHADOW flag on a VGA card other than the primary
prevents it from reading its own ROM. It will get the content of the
shadow ROM at C000 instead, which is of the primary VGA card and the driver
of the secondary card will bail out.
Fix this by checking if the arch code or vga-arbitration has already
determined the vga_default_device, if so only apply the fix to this primary
video device and let the comment reflect this.
[bhelgaas: add subject, split x86 & ia64 into separate patches,
include vgaarb.h]
Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Sander Eikelenboom [Fri, 31 Jan 2014 09:28:23 +0000 (10:28 +0100)]
x86/PCI: Set IORESOURCE_ROM_SHADOW only for the default VGA device
Setting the IORESOURCE_ROM_SHADOW flag on a VGA card other than the primary
prevents it from reading its own ROM. It will get the content of the
shadow ROM at C000 instead, which is of the primary VGA card and the driver
of the secondary card will bail out.
Fix this by checking if the arch code or vga-arbitration has already
determined the vga_default_device, if so only apply the fix to this primary
video device and let the comment reflect this.
[bhelgaas: add subject, split x86 & ia64 into separate patches]
Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Yijing Wang [Thu, 13 Feb 2014 13:14:03 +0000 (21:14 +0800)]
PCI: Remove pci_bus_b() and use list_for_each_entry() directly
Replace list_for_each() with list_for_each_entry(), which means we no
longer need pci_bus_b() and can remove it.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Jean-Jacques Hiblot [Fri, 14 Feb 2014 18:46:15 +0000 (11:46 -0700)]
PCI: mvebu: Fix potential issue in range parsing
The second parameter of of_read_number() is not the index, but a size. As
it happens, in this case it may work just fine because of the conversion to
u32 and the favorable endianness on this architecture.
Fixes: 11be65472a427 ("PCI: mvebu: Adapt to the new device tree layout")
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Cc: stable@vger.kernel.org # v3.12+
Yijing Wang [Thu, 13 Feb 2014 13:14:02 +0000 (21:14 +0800)]
pcmcia: Use list_for_each_entry() for bus traversal
Replace list_for_each() + pci_bus_b() with list_for_each_entry().
[bhelgaas: fix "silbling" typo]
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Yijing Wang [Thu, 13 Feb 2014 13:14:01 +0000 (21:14 +0800)]
powerpc/PCI: Use list_for_each_entry() for bus traversal
Replace list_for_each() + pci_bus_b() with list_for_each_entry().
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Yijing Wang [Thu, 13 Feb 2014 13:14:00 +0000 (21:14 +0800)]
drm: Use list_for_each_entry() for bus traversal
Replace list_for_each() + pci_bus_b() with list_for_each_entry().
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Yijing Wang [Thu, 13 Feb 2014 13:13:59 +0000 (21:13 +0800)]
ARM/PCI: Use list_for_each_entry() for bus traversal
Replace list_for_each() + pci_bus_b() with list_for_each_entry().
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Yijing Wang [Thu, 13 Feb 2014 13:13:58 +0000 (21:13 +0800)]
ACPI / hotplug / PCI: Use list_for_each_entry() for bus traversal
Replace list_for_each() + pci_bus_b() with list_for_each_entry().
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net>
Yijing Wang [Thu, 13 Feb 2014 11:57:43 +0000 (19:57 +0800)]
PCI: Update outdated comment for pcibios_bus_report_status()
pci_find_device() has been superseded by pci_get_device().
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Yijing Wang [Wed, 12 Feb 2014 00:36:51 +0000 (17:36 -0700)]
PCI: pciehp: Don't turn slot off when hot-added device already exists
If we found device already exists during hot add device, we should leave
it, not turn the slot off.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Alexander Gordeev [Thu, 13 Feb 2014 14:25:02 +0000 (15:25 +0100)]
PCI/MSI: Add pci_enable_msi_exact() and pci_enable_msix_exact()
The new functions are special cases for pci_enable_msi_range() and
pci_enable_msix_range() when a particular number of MSI or MSI-X
is needed.
By contrast with pci_enable_msi_range() and pci_enable_msix_range()
functions, pci_enable_msi_exact() and pci_enable_msix_exact()
return zero in case of success, which indicates MSI or MSI-X
interrupts have been successfully allocated.
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Alexander Gordeev [Wed, 12 Feb 2014 10:35:25 +0000 (11:35 +0100)]
PCI/MSI: Fix cut-and-paste errors in documentation
Function pci_enable_msi_range() is used in examples where
pci_enable_msix_range() should have been used instead.
Reported-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Liviu Dudau [Mon, 3 Feb 2014 17:38:36 +0000 (17:38 +0000)]
PCI: Cleanup per-arch list of object files
setup-bus.o is now included unconditionally as of commit
7dc303033425
("PCI: Always build setup-bus when PCI is enabled"). Remove it from the
per-arch list of object files.
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Dan Carpenter [Mon, 10 Feb 2014 15:23:50 +0000 (18:23 +0300)]
PCI: cpqphp: Fix hex vs decimal typo in cpqhpc_probe()
This is a static checker fix and I can't test it, but from the context it
definitely looks like hexadecimal 0x20 was intended here instead of decimal
20.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Bjorn Helgaas [Fri, 24 Jan 2014 17:44:42 +0000 (10:44 -0700)]
x86/PCI: Fix function definition whitespace
Consistently put the function type, name, and parameters on one line,
wrapping only as necessary.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Bjorn Helgaas [Fri, 24 Jan 2014 17:38:40 +0000 (10:38 -0700)]
x86/PCI: Reword comments
Reword comments so they make sense.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Bjorn Helgaas [Fri, 24 Jan 2014 17:41:11 +0000 (10:41 -0700)]
x86/PCI: Remove unnecessary local variable initialization
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Andrew Lunn [Wed, 5 Feb 2014 10:55:49 +0000 (11:55 +0100)]
PCI: mvebu: Use Device ID and revision from underlying endpoint
Marvell SoCs place the SoC number into the PCIe endpoint device ID. The
SoC stepping is placed into the PCIe revision. The old plat-orion PCIe
driver allowed this information to be seen in user space with a simple
lspci command.
The new driver places a virtual PCI-PCI bridge on top of these endpoints.
It has its own hard coded PCI device ID. Thus it is no longer possible to
see what the SoC is using lspci.
When initializing the PCI-PCI bridge, set its device ID and revision from
the underlying endpoint, thus restoring this functionality. Debian would
like to use this in order to aid installing the correct DTB file.
Fixes: 45361a4fe4464 ("pci: PCIe driver for Marvell Armada 370/XP systems")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Cc: stable@vger.kernel.org # v3.11+
Rajat Jain [Wed, 5 Feb 2014 02:31:11 +0000 (18:31 -0800)]
PCI: pciehp: Add hotplug_lock to serialize hotplug events
Today it is there is no protection around pciehp_enable_slot() and
pciehp_disable_slot() to ensure that they complete before another
hot-plug operation can be done on that particular slot.
This patch introduces the slot->hotplug_lock to ensure that any hotplug
operations (add / remove) complete before another hotplug event can begin
processing on that particular slot.
Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Rajat Jain [Wed, 5 Feb 2014 02:30:56 +0000 (18:30 -0800)]
PCI: pciehp: Ensure very fast hotplug events are also processed
Today, this is how all the hotplug and unplug events work:
Hotplug / Removal needs to be done
=> Set slot->state (protected by slot->lock) to either
POWERON_STATE (for enabling) or POWEROFF_STATE (for disabling).
=> Submit the work item for pciehp_power_thread() to slot->wq.
Problem:
There is a problem if the hotplug events can happen fast enough that
they do not give SW enough time to add or remove the new devices.
=> Assume: Event for unplug comes (e.g. surprise removal). But
before the pciehp_power_thread() work item was executed, the
card was replaced by another card, causing surprise hotplug event.
=> What goes wrong:
=> The hot-removal event sets slot->state to POWEROFF_STATE, and
schedules the pciehp_power_thread().
=> The hot-add event sets slot->state to POWERON_STATE, and
schedules the pciehp_power_thread().
=> Now the pciehp_power_thread() is scheduled twice, and on both
occasions it will find POWERON_STATE and will try to add the
devices on the slot, and will fail complaining that the devices
already exist.
=> Why this is a problem: If the device was replaced between the hot
removal and hot-add, then we should unload the old driver and
reload the new one. This does not happen today. The kernel or the
driver is not even aware that the device was replaced.
The problem is that the pciehp_power_thread() only looks at the
slot->state which would only contain the *latest* state - not
the actual event (add / remove) that was the intent of the IRQ
handler who submitted the work.
What this patch does:
=> Hotplug events pass on an actual request (for addition or removal)
to pciehp_power_thread() which is local to that work item
submission.
=> pciehp_power_thread() does not need to look at slote->state and
hence no locks needed in that.
=> Essentially this results in all the hotplug and unplug events
"replayed" by pciehp_power_thread().
Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Rajat Jain [Wed, 5 Feb 2014 02:30:40 +0000 (18:30 -0800)]
PCI: pciehp: Disable link notification across slot reset
Disable the link notification (in addition to presence detect
notifications) across the slot reset since the reset could flap the link,
and we don't want to treat it as hot unplug followed by a hotplug.
Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Rajat Jain [Wed, 5 Feb 2014 02:30:21 +0000 (18:30 -0800)]
PCI: pciehp: Don't check adapter or latch status while disabling
It does not make much sense to refuse to disable a slot if an adapter is
not present or the latch is open. If an adapter is not present, it provides
an even better reason to disable the device slot.
This is specially a problem for link state hot-plug, because some ports use
in band mechanism for presence detection. Thus when link goes down,
presence detect also goes down. We _want_ that the removal should take
place in such case.
Thus remove the checks for adapter and latch in pciehp_disable_slot()
Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Rajat Jain [Wed, 5 Feb 2014 02:30:04 +0000 (18:30 -0800)]
PCI: pciehp: Don't disable the link permanently during removal
We need future link up events for hot-add, thus don't disable the link
permanently during device removal. Also, remove the static functions that
are now left unused.
This reverts part of
2debd9289997 ("PCI: pciehp: Disable/enable link during
slot power off/on"). This was discussed at the URL below, where it was
revealed that it was done for a bug in a PCIe repeater chip on that
particular platform.
Link: https://lkml.kernel.org/r/CAErSpo72KZ-a2OSQLWoK71GCgwBt676XZdGt4tEYm-6UYnLmPw@mail.gmail.com
Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Rajat Jain [Wed, 5 Feb 2014 02:29:23 +0000 (18:29 -0800)]
PCI: pciehp: Enable link state change notifications
Enable the Link state notifications unconditionally. Enable the
presence detection notification only if attention button is absent.
This was discussed at this thread:
https://lkml.kernel.org/r/
529E5C0E.80903@gmail.com
Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Andreas Noever [Thu, 23 Jan 2014 20:59:28 +0000 (21:59 +0100)]
PCI: Don't scan random busses in pci_scan_bridge()
When assigning a new bus number in pci_scan_bridge we check whether
max+1 is free by calling pci_find_bus. If it does already exist then we
assume that we are rescanning and that this is the right bus to scan.
This is fragile. If max+1 lies outside of bus->busn_res.end then we will
rescan some random bus from somewhere else in the hierachy. This patch
checks for this case and prints a warning.
[bhelgaas: add parent/child bus number info to dev_warn()]
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Andreas Noever [Thu, 23 Jan 2014 20:59:27 +0000 (21:59 +0100)]
PCI: Check for child busses which use more bus numbers than allocated
pci_scan_child_bus can (potentially) return a bus number higher than the
subordinate value of the child bus. Possible reasons are that bus numbers
are reserved for SR-IOV or for CardBus (SR-IOV is done without checks and
the CardBus checks are sketchy at best).
We clamp the returned value to the actual subordinate value and print a
warning if too many bus numbers are reserved.
[bhelgaas: whitespace]
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Andreas Noever [Thu, 23 Jan 2014 20:59:26 +0000 (21:59 +0100)]
PCI: Remove pci_fixup_parent_subordinate_busnr()
The function has no effect.
If pcibios_assign_all_busses() is not set then the function does nothing.
If it is set then in pci_scan_bridge we are always in the branch where
we assign the bus numbers ourselves and the subordinate values of all
parent busses will be set to 0xff since that is what they inherited from
their parent bus and ultimately from the root bus.
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Alex Williamson [Mon, 3 Feb 2014 21:27:46 +0000 (14:27 -0700)]
PCI: Enable quirks for PCIe ACS on Intel PCH root ports
Many of the currently available Intel PCH-based root ports do not provide
PCIe ACS capabilities. Without this, we must assume that peer-to-peer
traffic between multifunction root ports and between devices behind root
ports is possible. This lack of isolation is exposed by grouping the
devices together in the same IOMMU group. If we want to expose these
devices to userspace, vfio uses IOMMU groups as the unit of ownership, thus
making it very difficult to assign individual devices to separate users.
The good news is that the chipset does provide ACS-like isolation
capabilities, but we do need to verify and enable those capabilities if the
BIOS has not done so. This patch implements the device specific enabling
and testing of equivalent ACS function for these devices.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Don Dugger <donald.d.dugger@intel.com>
Alex Williamson [Mon, 3 Feb 2014 21:27:39 +0000 (14:27 -0700)]
PCI: Add pci_dev_flag for ACS enable quirks
Quirks that enable ACS-compatible functionality on a device need some way
to track whether a given device has been enabled. Rather than create new
data structures for this, allocate one of the pci_dev_flags to indicate
this setup.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Alex Williamson [Mon, 3 Feb 2014 21:27:33 +0000 (14:27 -0700)]
PCI: Add device-specific PCI ACS enable
Some devices support PCI ACS-like features, but don't report it using the
standard PCIe capabilities. We already provide hooks for device-specific
testing of ACS, but not for device-specific enabling of ACS. This provides
that setup hook.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Rajat Jain [Wed, 5 Feb 2014 02:29:10 +0000 (18:29 -0800)]
PCI: pciehp: Use link change notifications for hot-plug and removal
A lot of systems do not have the fancy buttons and LEDs, and instead
want to rely only on the Link state change events to drive the hotplug
and removal state machinery.
(http://www.spinics.net/lists/hotplug/msg05802.html)
This patch adds support for that functionality. Here are the details
about the patch itself:
* Define and use interrupt events for linkup / linkdown.
* Make the pcie_isr() also look at link events, and direct control to
corresponding (new) link state change handler function.
* Introduce the functions to handle link-up and link-down events and
queue the add / removal work in the slot->wq to be processed by
pciehp_power_thread()
As a side note, this patch also fixes the bug
https://bugzilla.kernel.org/show_bug.cgi?id=65521 "pciehp ignores Data Link
Layer State Changed bit."
Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Rajat Jain [Wed, 5 Feb 2014 02:28:43 +0000 (18:28 -0800)]
PCI: pciehp: Make check_link_active() non-static
check_link_active() functionality needs to be used by subsequent patches
(that introduce link state change based hotplug). Thus make the function
non-static, and rename it to pciehp_check_link_active() so as to be
consistent with other non-static functions.
Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Andreas Noever [Thu, 23 Jan 2014 20:59:25 +0000 (21:59 +0100)]
PCI: Make sure bus number resources stay within their parents bounds
Right now we use 0xff for busn_res.end when probing and later reduce it to
the value that is actually used. This does not work if a parent bridge has
already a lower subordinate value. For example during hotplug of a new
bridge below an already-configured bridge the following message is printed
from pci_bus_insert_busn_res():
pci_bus 0000:06: busn_res: can not insert [bus 06-ff] under [bus 05-9b] (conflicts with (null) [bus 05-9b])
This patch clamps the bus range to that of the parent and also ensures that
we do not exceed the parents range when assigning the final subordinate
value.
We also check that busses configured by the firmware fit into their parents
bounds.
[bhelgaas: reword dev_warn() and fix printk format warning]
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Andreas Noever [Thu, 23 Jan 2014 20:59:24 +0000 (21:59 +0100)]
PCI: Use request_resource_conflict() instead of insert_ for bus numbers
If a conflict happens during insert_resource_conflict() and all conflicts
fit within the newly inserted resource then they will become children of
the new resource. This is almost certainly not what we want for bus
numbers.
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Andreas Noever [Thu, 23 Jan 2014 20:59:23 +0000 (21:59 +0100)]
PCI: Assign CardBus bus number only during the second pass
Right now the CardBus code in pci_scan_bridge() is executed during both
passes. Since we always allocate the bus number ourselves it makes sense
to put it into the second pass.
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Andreas Noever [Thu, 23 Jan 2014 20:59:22 +0000 (21:59 +0100)]
PCI: Clarify the "scan anyway" comment in pci_scan_bridge()
Initially when we encountered a bus that was already present we skipped
it. Since
74710ded8e16 'PCI: always scan child buses' we continue
scanning in order to allow user triggered rescans of already existing
busses.
The old comment suggested that the reason for continuing the scan is a
bug in the i450NX chipset. This is not the case.
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Andreas Noever [Thu, 23 Jan 2014 20:59:21 +0000 (21:59 +0100)]
PCI: Increment max correctly in pci_scan_bridge()
This patch fixes two small issues:
- If pci_add_new_bus() fails, max must not be incremented. Otherwise
an incorrect value is returned from pci_scan_bridge().
- If the bus is already present, max must be incremented. I think
that this case should only be hit if we trigger a manual rescan of a
CardBus bridge.
Signed-off-by: Andreas Noever <andreas.noever@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Bjorn Helgaas [Fri, 24 Jan 2014 16:51:06 +0000 (09:51 -0700)]
PCI: Remove unnecessary list_empty(&pci_pme_list) check
list_for_each_entry() handles empty lists just fine, so there's no need to
check whether the list is empty first.
No functional change.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net>
Alexander Gordeev [Fri, 17 Jan 2014 09:26:20 +0000 (10:26 +0100)]
PCI/MSI: Add pci_enable_msi() documentation back
We deprecated pci_enable_msi() in
302a2523c277 ("PCI/MSI: Add
pci_enable_msi_range() and pci_enable_msix_range()").
But we changed our minds after noticing that:
- pci_enable_msi() doesn't have confusing return values like
pci_enable_msi_block() and pci_enable_msix() did, and
- pci_enable_msi() has a hundred or so callers that we don't want to
change.
This adds back the pci_enable_msi() documentation.
[bhelgaas: changelog]
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Masanari Iida [Mon, 20 Jan 2014 15:42:55 +0000 (00:42 +0900)]
PCI/MSI: Fix pci_msix_vec_count() htmldocs failure
An empty line in msi.c caused "make htmldocs" failure:
Warning(/home/iida/Repo/linux-next//drivers/pci/msi.c:962): bad line:
Fixes: ff1aa430a2fa ("PCI/MSI: Add pci_msix_vec_count()")
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Greg Kroah-Hartman [Thu, 23 Jan 2014 20:01:12 +0000 (12:01 -0800)]
PCI/MSI: Fix leak of msi_attrs
Coverity reported that I forgot to clean up some allocated memory on the
error path in populate_msi_sysfs(), so this patch fixes that.
Thanks to Dave Jones for pointing out where the error was, I obviously
can't read code this morning...
Found by Coverity (CID
1163317).
Fixes: 1c51b50c2995 ("PCI/MSI: Export MSI mode using attributes, not kobjects")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Dave Jones <davej@redhat.com>
Greg Kroah-Hartman [Thu, 23 Jan 2014 19:30:37 +0000 (11:30 -0800)]
PCI/MSI: Check kmalloc() return value, fix leak of name
Coverity reported that I forgot to check the return value of kmalloc() when
creating the MSI attribute name, so fix that up and properly free it if
there is an error when allocating the msi_dev_attr variable.
Found by Coverity (CID
1163315 and
1163316).
Fixes: 1c51b50c2995 ("PCI/MSI: Export MSI mode using attributes, not kobjects")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Bjorn Helgaas [Mon, 3 Feb 2014 18:45:03 +0000 (10:45 -0800)]
Merge branch 'pci/numa-cleanup' into next
* pci/numa-cleanup:
ACPI / numa: Use __weak, not the gcc-specific version
ACPI / numa: Make __acpi_map_pxm_to_node(), acpi_get_pxm() static
ACPI / numa: Simplify acpi_get_node() style
ACPI / numa: Fix acpi_get_node() prototype
ia64: Remove acpi_get_pxm() usage
ia64 / sba_iommu: Use NUMA_NO_NODE, not MAX_NUMNODES, for unknown node
x86/PCI: Remove acpi_get_pxm() usage
x86/PCI: Use NUMA_NO_NODE, not -1, for unknown node
x86/PCI: Remove unnecessary list_empty(&pci_root_infos) check
x86/PCI: Remove mp_bus_to_node[], set_mp_bus_to_node(), get_mp_bus_to_node()
x86/PCI: Use x86_pci_root_bus_node() instead of get_mp_bus_to_node()
x86/PCI: Add x86_pci_root_bus_node() to look up NUMA node from PCI bus
x86/PCI: Drop return value of pcibios_scan_root()
x86/PCI: Merge pci_scan_bus_on_node() into pcibios_scan_root()
x86/PCI: Use pcibios_scan_root() instead of pci_scan_bus_on_node()
x86/PCI: Use pcibios_scan_root() instead of pci_scan_bus_with_sysdata()
x86/PCI: Drop pcibios_scan_root() check for bus already scanned
Bjorn Helgaas [Tue, 28 Jan 2014 00:19:15 +0000 (17:19 -0700)]
ACPI / numa: Use __weak, not the gcc-specific version
Use "__weak" instead of the gcc-specific "__attribute__ ((weak))".
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 22:48:01 +0000 (15:48 -0700)]
ACPI / numa: Make __acpi_map_pxm_to_node(), acpi_get_pxm() static
__acpi_map_pxm_to_node() and acpi_get_pxm() are only used within
drivers/acpi/numa.c. This makes them static and removes their
declarations.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 22:42:17 +0000 (15:42 -0700)]
ACPI / numa: Simplify acpi_get_node() style
Simplify control flow by removing local variable initialization and
returning a constant as soon as possible. No functional change.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 22:25:10 +0000 (15:25 -0700)]
ACPI / numa: Fix acpi_get_node() prototype
acpi_get_node() takes an acpi_handle, not an "acpi_handle *". This
fixes the prototype and the definitions.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 22:28:42 +0000 (15:28 -0700)]
ia64: Remove acpi_get_pxm() usage
The IOMMU, LSAPIC, IOSAPIC, and PCI host bridge code doesn't care about
_PXM values directly; it only needs to know what NUMA node the hardware is
on.
This uses acpi_get_node() directly and removes the _PXM stuff.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 21:42:33 +0000 (14:42 -0700)]
ia64 / sba_iommu: Use NUMA_NO_NODE, not MAX_NUMNODES, for unknown node
MAX_NUMNODES is typically used for sizing arrays. NUMA_NO_NODE is the
usual value for "we don't know what node this is on," e.g., it is the
error return from acpi_get_node().
This changes the ioc->node value for unknown nodes from MAX_NUMNODES to
NUMA_NO_NODE.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 21:40:46 +0000 (14:40 -0700)]
x86/PCI: Remove acpi_get_pxm() usage
The PCI host bridge code doesn't care about _PXM values directly; it only
needs to know what NUMA node the hardware is on.
This uses acpi_get_node() directly and removes the _PXM stuff.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 21:51:49 +0000 (14:51 -0700)]
x86/PCI: Use NUMA_NO_NODE, not -1, for unknown node
NUMA_NO_NODE is the usual value for "we don't know what node this is on,"
e.g., it is the error return from acpi_get_node(). This changes uses of -1
to NUMA_NO_NODE. NUMA_NO_NODE is #defined to be -1 already, so this is not
a functional change.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 18:57:18 +0000 (11:57 -0700)]
x86/PCI: Remove unnecessary list_empty(&pci_root_infos) check
list_for_each_entry() handles empty lists, so there's no need to check
whether the list is empty first.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 18:56:06 +0000 (11:56 -0700)]
x86/PCI: Remove mp_bus_to_node[], set_mp_bus_to_node(), get_mp_bus_to_node()
There are no callers of get_mp_bus_to_node(), so we no longer need
mp_bus_to_node[], get_mp_bus_to_node(), or set_mp_bus_to_node().
This removes them.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 18:54:51 +0000 (11:54 -0700)]
x86/PCI: Use x86_pci_root_bus_node() instead of get_mp_bus_to_node()
This replaces all uses of get_mp_bus_to_node() with x86_pci_root_bus_node().
I think these uses are all on root buses, except possibly for blind
probing, where NUMA node information is unimportant.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 18:54:36 +0000 (11:54 -0700)]
x86/PCI: Add x86_pci_root_bus_node() to look up NUMA node from PCI bus
The AMD early_fill_mp_bus_info() already allocates a struct pci_root_info
for each PCI host bridge it finds, and that structure contains the NUMA
node number. We don't need to keep the same information in the
mp_bus_to_node[] table.
This adds x86_pci_root_bus_node(), which returns the NUMA node number, or
NUMA_NO_NODE if the node is unknown.
Note that unlike get_mp_bus_to_node(), x86_pci_root_bus_node() only works
for root buses. For example, if amd_bus.c finds a host bridge on node 1 to
[bus 00-0f], get_mp_bus_to_node() returns 1 for any bus between 00 and 0f,
but x86_pci_root_bus_node() returns 1 for bus 00 and NUMA_NO_NODE for buses
01-0f.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Tue, 28 Jan 2014 23:40:36 +0000 (16:40 -0700)]
x86/PCI: Drop return value of pcibios_scan_root()
Nobody really uses the return value of pcibios_scan_root() (one place uses
it to control a printk, but the printk is not very useful). This converts
pcibios_scan_root() to a void function.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 18:52:25 +0000 (11:52 -0700)]
x86/PCI: Merge pci_scan_bus_on_node() into pcibios_scan_root()
pci_scan_bus_on_node() is only called by pcibios_scan_root().
This merges pci_scan_bus_on_node() into pcibios_scan_root() and removes
pci_scan_bus_on_node().
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 18:50:48 +0000 (11:50 -0700)]
x86/PCI: Use pcibios_scan_root() instead of pci_scan_bus_on_node()
pcibios_scan_root() looks up the bus's NUMA node, then calls
pci_scan_bus_on_node(). This uses pcibios_scan_root() directly and drops
the node lookup in the callers.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Fri, 24 Jan 2014 18:47:05 +0000 (11:47 -0700)]
x86/PCI: Use pcibios_scan_root() instead of pci_scan_bus_with_sysdata()
pci_scan_bus_with_sysdata() and pcibios_scan_root() are quite similar:
pci_scan_bus_with_sysdata
pci_scan_bus_on_node(..., &pci_root_ops, -1)
pcibios_scan_root
pci_scan_bus_on_node(..., &pci_root_ops, get_mp_bus_to_node(busnum))
get_mp_bus_to_node() returns -1 if it couldn't find the node number, so
this removes pci_scan_bus_with_sysdata() and uses pcibios_scan_root()
instead.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Bjorn Helgaas [Tue, 28 Jan 2014 23:28:21 +0000 (16:28 -0700)]
x86/PCI: Drop pcibios_scan_root() check for bus already scanned
The PCI core checks to see whether we've already scanned a bus, so we don't
need to do it in pcibios_scan_root(). Here's where it happens in the core:
pcibios_scan_root
pci_scan_bus_on_node
pci_scan_root_bus
pci_create_root_bus
b2 = pci_find_bus(pci_domain_nr(b), bus)
if (b2)
goto err_out; # already scanned this bus
This removes the check from pcibios_scan_root().
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Linus Torvalds [Mon, 3 Feb 2014 00:42:13 +0000 (16:42 -0800)]
Linus 3.14-rc1
Linus Torvalds [Mon, 3 Feb 2014 00:32:53 +0000 (16:32 -0800)]
Merge branch 'parisc-3.14' of git://git./linux/kernel/git/deller/parisc-linux
Pull parisc updates from Helge Deller:
"The three major changes in this patchset is a implementation for
flexible userspace memory maps, cache-flushing fixes (again), and a
long-discussed ABI change to make EWOULDBLOCK the same value as
EAGAIN.
parisc has been the only platform where we had EWOULDBLOCK != EAGAIN
to keep HP-UX compatibility. Since we will probably never implement
full HP-UX support, we prefer to drop this compatibility to make it
easier for us with Linux userspace programs which mostly never checked
for both values. We don't expect major fall-outs because of this
change, and if we face some, we will simply rebuild the necessary
applications in the debian archives"
* 'parisc-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: add flexible mmap memory layout support
parisc: Make EWOULDBLOCK be equal to EAGAIN on parisc
parisc: convert uapi/asm/stat.h to use native types only
parisc: wire up sched_setattr and sched_getattr
parisc: fix cache-flushing
parisc/sti_console: prefer Linux fonts over built-in ROM fonts
Mikulas Patocka [Tue, 28 Jan 2014 23:11:33 +0000 (00:11 +0100)]
hpfs: optimize quad buffer loading
HPFS needs to load 4 consecutive 512-byte sectors when accessing the
directory nodes or bitmaps. We can't switch to 2048-byte block size
because files are allocated in the units of 512-byte sectors.
Previously, the driver would allocate a 2048-byte area using kmalloc,
copy the data from four buffers to this area and eventually copy them
back if they were modified.
In the current implementation of the buffer cache, buffers are allocated
in the pagecache. That means that 4 consecutive 512-byte buffers are
stored in consecutive areas in the kernel address space. So, we don't
need to allocate extra memory and copy the content of the buffers there.
This patch optimizes the code to avoid copying the buffers. It checks
if the four buffers are stored in contiguous memory - if they are not,
it falls back to allocating a 2048-byte area and copying data there.
Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Mikulas Patocka [Tue, 28 Jan 2014 23:10:44 +0000 (00:10 +0100)]
hpfs: remember free space
Previously, hpfs scanned all bitmaps each time the user asked for free
space using statfs. This patch changes it so that hpfs scans the
bitmaps only once, remembes the free space and on next invocation of
statfs it returns the value instantly.
New versions of wine are hammering on the statfs syscall very heavily,
making some games unplayable when they're stored on hpfs, with load
times in minutes.
This should be backported to the stable kernels because it fixes
user-visible problem (excessive level load times in wine).
Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Helge Deller [Fri, 31 Jan 2014 21:19:52 +0000 (22:19 +0100)]
parisc: add flexible mmap memory layout support
Add support for the flexible mmap memory layout (as described in
http://lwn.net/Articles/91829). This is especially very interesting on
parisc since we currently only support 32bit userspace (even with a
64bit Linux kernel).
Signed-off-by: Helge Deller <deller@gmx.de>
Guy Martin [Thu, 16 Jan 2014 16:17:53 +0000 (17:17 +0100)]
parisc: Make EWOULDBLOCK be equal to EAGAIN on parisc
On Linux, only parisc uses a different value for EWOULDBLOCK which
causes a lot of troubles for applications not checking for both values.
Since the hpux compat is long dead, make EWOULDBLOCK behave the same as
all other architectures.
Signed-off-by: Guy Martin <gmsoft@tuxicoman.be>
Signed-off-by: Helge Deller <deller@gmx.de>