platform/adaptation/renesas_rcar/renesas_kernel.git
12 years agoMerge branch 'pci/yinghai-hotplug-cleanup' into next
Bjorn Helgaas [Wed, 11 Jul 2012 18:26:40 +0000 (12:26 -0600)]
Merge branch 'pci/yinghai-hotplug-cleanup' into next

* pci/yinghai-hotplug-cleanup:
  PCI: acpiphp: merge acpiphp_debug and debug
  PCI: acpiphp: remove unused res_lock

12 years agoPCI: acpiphp: merge acpiphp_debug and debug
Yinghai Lu [Sat, 23 Jun 2012 07:42:03 +0000 (00:42 -0700)]
PCI: acpiphp: merge acpiphp_debug and debug

Should not have two, just remove debug, and use module_param_named
instead.

Also change acpiphp_debug to bool.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: acpiphp: remove unused res_lock
Yinghai Lu [Sat, 23 Jun 2012 07:42:01 +0000 (00:42 -0700)]
PCI: acpiphp: remove unused res_lock

res_lock is never used, so remove it.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMerge branch 'pci/bjorn-p2p-bridge-windows' into next
Bjorn Helgaas [Tue, 10 Jul 2012 14:36:09 +0000 (08:36 -0600)]
Merge branch 'pci/bjorn-p2p-bridge-windows' into next

* pci/bjorn-p2p-bridge-windows:
  sparc/PCI: replace pci_cfg_fake_ranges() with pci_read_bridge_bases()
  PCI: support sizing P2P bridge I/O windows with 1K granularity
  PCI: reimplement P2P bridge 1K I/O windows (Intel P64H2)
  PCI: allow P2P bridge windows starting at PCI bus address zero

Conflicts:
drivers/pci/probe.c
include/linux/pci.h

12 years agosparc/PCI: replace pci_cfg_fake_ranges() with pci_read_bridge_bases()
Bjorn Helgaas [Mon, 9 Jul 2012 19:39:52 +0000 (13:39 -0600)]
sparc/PCI: replace pci_cfg_fake_ranges() with pci_read_bridge_bases()

The generic code to read P2P bridge windows is functionally equivalent
to the sparc-specific pci_cfg_fake_ranges(), so use the generic code.

The "if (!res->start) res->start = ..." removed from the I/O window code
here was an artifact of the Intel 1K window support from 9d265124d051 and
is no longer necessary (it probably was just cloned from x86 and was never
useful on sparc).

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMerge branch 'pci/bjorn-disable-decode' into next
Bjorn Helgaas [Tue, 10 Jul 2012 03:02:44 +0000 (21:02 -0600)]
Merge branch 'pci/bjorn-disable-decode' into next

* pci/bjorn-disable-decode:
  PCI: disable MEM decoding while updating 64-bit MEM BARs
  PCI: leave MEM and IO decoding disabled during 64-bit BAR sizing, too

12 years agoMerge branch 'pci/myron-final-fixups-v2' into next
Bjorn Helgaas [Tue, 10 Jul 2012 02:56:54 +0000 (20:56 -0600)]
Merge branch 'pci/myron-final-fixups-v2' into next

* pci/myron-final-fixups-v2:
  PCI: call final fixups hot-added devices
  PCI: move final fixups from __init to __devinit
  x86/PCI: move final fixups from __init to __devinit
  MIPS/PCI: move final fixups from __init to __devinit
  PCI: never discard enable/suspend/resume_early/resume fixups
  PCI: release temporary reference in __nv_msi_ht_cap_quirk()
  PCI: restructure 'pci_do_fixups()'

12 years agoPCI: call final fixups hot-added devices
Myron Stowe [Mon, 9 Jul 2012 21:36:46 +0000 (15:36 -0600)]
PCI: call final fixups hot-added devices

Final fixups are currently applied only at boot-time by
pci_apply_final_quirks(), which is an fs_initcall().  Hot-added devices
don't get these fixups, so they may not be completely initialized.

This patch makes us run final fixups for hot-added devices in
pci_bus_add_device() just before the new device becomes eligible for driver
binding.

This patch keeps the fs_initcall() for devices present at boot because we
do resource assignment between pci_bus_add_device and the fs_initcall(),
and we don't want to break any fixups that depend on that assignment.  This
is a design issue that may be addressed in the future -- any resource
assignment should be done *before* device_add().

[bhelgaas: changelog]
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: move final fixups from __init to __devinit
Myron Stowe [Mon, 9 Jul 2012 21:36:39 +0000 (15:36 -0600)]
PCI: move final fixups from __init to __devinit

Final fixups are executed during device enumeration.  If we support
hotplug, this may be after boot, so final fixups cannot be __init.

[bhelgaas: changelog]
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: move final fixups from __init to __devinit
Myron Stowe [Mon, 9 Jul 2012 21:36:33 +0000 (15:36 -0600)]
x86/PCI: move final fixups from __init to __devinit

Final fixups are executed during device enumeration.  If we support
hotplug, this may be after boot, so final fixups cannot be __init.

[bhelgaas: changelog]
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMIPS/PCI: move final fixups from __init to __devinit
Myron Stowe [Mon, 9 Jul 2012 21:36:27 +0000 (15:36 -0600)]
MIPS/PCI: move final fixups from __init to __devinit

Final fixups are executed during device enumeration.  If we support
hotplug, this may be after boot, so final fixups cannot be __init.

[bhelgaas: changelog]
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: support sizing P2P bridge I/O windows with 1K granularity
Yinghai Lu [Tue, 10 Jul 2012 01:55:29 +0000 (19:55 -0600)]
PCI: support sizing P2P bridge I/O windows with 1K granularity

Some bridges support I/O windows with 1K alignment, not just the 4K
alignment defined by the PCI spec.  For example, see the IOBL_ADR register
and the EN1K bit in the CNF register in the Intel 82870P2 (P64H2).

This patch adds support for sizing the window in 1K increments based
on the requirements of downstream devices.

[bhelgaas: changelog, comment]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: reimplement P2P bridge 1K I/O windows (Intel P64H2)
Bjorn Helgaas [Mon, 9 Jul 2012 19:38:57 +0000 (13:38 -0600)]
PCI: reimplement P2P bridge 1K I/O windows (Intel P64H2)

9d265124d051 and 15a260d53f7c added quirks for P2P bridges that support
I/O windows that start/end at 1K boundaries, not just the 4K boundaries
defined by the PCI spec.  For details, see the IOBL_ADR register and the
EN1K bit in the CNF register in the Intel 82870P2 (P64H2).

These quirks complicate the code that reads P2P bridge windows
(pci_read_bridge_io() and pci_cfg_fake_ranges()) because the bridge
I/O resource is updated in the HEADER quirk, in pci_read_bridge_io(),
in pci_setup_bridge(), and again in the FINAL quirk.  This is confusing
and makes it impossible to reassign the bridge windows after FINAL
quirks are run.

This patch adds support for 1K windows in the generic paths, so the
HEADER quirk only has to enable this support.  The FINAL quirk, which
used to undo damage done by pci_setup_bridge(), is no longer needed.

This removes "if (!res->start) res->start = ..." from pci_read_bridge_io();
that was part of 9d265124d051 to avoid overwriting the resource filled in
by the quirk.  Since pci_read_bridge_io() itself now knows about
granularity, the quirk no longer updates the resource and this test is no
longer needed.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: disable MEM decoding while updating 64-bit MEM BARs
Bjorn Helgaas [Tue, 10 Jul 2012 01:49:37 +0000 (19:49 -0600)]
PCI: disable MEM decoding while updating 64-bit MEM BARs

When we update 64-bit BARs, we have to perform two config writes.  Between
the writes, the half-written BAR value could match a MEM access intended
for another device.  This could result in corruption of this device (for
writes) or an unexpected response machine check (for reads).

To prevent this, disable MEM decoding while updating such BARs.  This uses
the same safety test as 253d2e5498, which disables both MEM and IO while
sizing BARs, namely, we don't disable decoding for host bridge devices.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: leave MEM and IO decoding disabled during 64-bit BAR sizing, too
Bjorn Helgaas [Fri, 6 Jul 2012 18:08:18 +0000 (12:08 -0600)]
PCI: leave MEM and IO decoding disabled during 64-bit BAR sizing, too

After 253d2e5498, we disable MEM and IO decoding for most devices while we
size 32-bit BARs.  However, we restore the original COMMAND register before
we size the upper 32 bits of 64-bit BARs, so we can still cause a conflict.

This patch waits to restore the original COMMAND register until we're
completely finished sizing the BAR.

Reference: https://lkml.org/lkml/2007/8/25/154
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: never discard enable/suspend/resume_early/resume fixups
Myron Stowe [Mon, 9 Jul 2012 21:36:14 +0000 (15:36 -0600)]
PCI: never discard enable/suspend/resume_early/resume fixups

The enable/suspend/resume_early/resume fixups can be called at any time, so
they can't be __init or __devinit.

[bhelgaas: changelog]
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: release temporary reference in __nv_msi_ht_cap_quirk()
Myron Stowe [Mon, 9 Jul 2012 21:36:08 +0000 (15:36 -0600)]
PCI: release temporary reference in __nv_msi_ht_cap_quirk()

__nv_msi_ht_cap_quirk() acquires a temporary reference via
'pci_get_bus_and_slot()' that is never released.

This patch releases the temporary reference.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: restructure 'pci_do_fixups()'
Myron Stowe [Mon, 9 Jul 2012 21:36:02 +0000 (15:36 -0600)]
PCI: restructure 'pci_do_fixups()'

This patch restructures pci_do_fixups()'s quirk invocations in the style
of initcall_debug_start() and initcall_debug_report(), so we have only
one call site for the quirk.

[bhelgaas: changelog]
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: allow P2P bridge windows starting at PCI bus address zero
Bjorn Helgaas [Mon, 9 Jul 2012 19:38:41 +0000 (13:38 -0600)]
PCI: allow P2P bridge windows starting at PCI bus address zero

cd81e1ea1a4c added checks that prevent us from using P2P bridge windows
that start at PCI bus address zero.  The reason was to "prevent us from
overwriting resources that are unassigned."

But generic code should allow address zero in both BARs and bridge
windows, so I think that commit was a mistake.

Windows at bus address zero are legal and likely to exist on machines with
an offset between bus addresses and CPU addresses.  For example, in the
following hypothetical scenario, the bridge at 00:01.0 has a window at bus
address zero and the device at 01:00.0 has a BAR at bus address zero, and
I think both are perfectly valid:

    PCI host bridge to bus 0000:00
    pci_bus 0000:00: root bus resource [mem 0x100000000-0x1ffffffff] (bus address [0x00000000-0xffffffff])
    pci 0000:00:01.0: PCI bridge to [bus 01]
    pci 0000:00:01.0:   bridge window [mem 0x100000000-0x100ffffff]
    pci 0000:01:00.0: reg 10: [mem 0x100000000-0x100ffffff]

Acked-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMerge branch 'pci/rafael-pci_set_power_state-rebase' into next
Bjorn Helgaas [Thu, 5 Jul 2012 22:29:52 +0000 (16:29 -0600)]
Merge branch 'pci/rafael-pci_set_power_state-rebase' into next

* pci/rafael-pci_set_power_state-rebase:
  PCI / PM: restore the original behavior of pci_set_power_state()

12 years agoMerge branch 'pci/myron-pcibios_setup' into next
Bjorn Helgaas [Thu, 5 Jul 2012 21:31:05 +0000 (15:31 -0600)]
Merge branch 'pci/myron-pcibios_setup' into next

* pci/myron-pcibios_setup:
  xtensa/PCI: factor out pcibios_setup()
  x86/PCI: adjust section annotations for pcibios_setup()
  unicore32/PCI: adjust section annotations for pcibios_setup()
  tile/PCI: factor out pcibios_setup()
  sparc/PCI: factor out pcibios_setup()
  sh/PCI: adjust section annotations for pcibios_setup()
  sh/PCI: factor out pcibios_setup()
  powerpc/PCI: factor out pcibios_setup()
  parisc/PCI: factor out pcibios_setup()
  MIPS/PCI: adjust section annotations for pcibios_setup()
  MIPS/PCI: factor out pcibios_setup()
  microblaze/PCI: factor out pcibios_setup()
  ia64/PCI: factor out pcibios_setup()
  cris/PCI: factor out pcibios_setup()
  alpha/PCI: factor out pcibios_setup()
  PCI: pull pcibios_setup() up into core

12 years agoPCI / PM: restore the original behavior of pci_set_power_state()
Rafael J. Wysocki [Thu, 5 Jul 2012 21:20:00 +0000 (15:20 -0600)]
PCI / PM: restore the original behavior of pci_set_power_state()

Commit cc2893b6 (PCI: Ensure we re-enable devices on resume)
addressed the problem with USB not being powered after resume on
recent Lenovo machines, but it did that in a suboptimal way.
Namely, it should have changed the relevant code paths only,
which are pci_pm_resume_noirq() and pci_pm_restore_noirq() supposed
to restore the device's power and standard configuration registers
after system resume from suspend or hibernation.  Instead, however,
it modified pci_set_power_state() which is executed in several
other situations too.  That resulted in some undesirable effects,
like attempting to change a device's power state in the same way
multiple times in a row (up to as many as 4 times in a row in the
snd_hda_intel driver).

Fix the bug addressed by commit cc2893b6 in an alternative way,
by forcibly powering up all devices in pci_pm_default_resume_early(),
which is called by pci_pm_resume_noirq() and pci_pm_restore_noirq()
to restore the device's power and standard configuration registers,
and modifying pci_pm_runtime_resume() to avoid the forcible power-up
if not necessary.  Then, revert the changes made by commit cc2893b6
to make the confusion introduced by it go away.

Acked-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoxtensa/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:32:39 +0000 (21:32 -0600)]
xtensa/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: adjust section annotations for pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:32:32 +0000 (21:32 -0600)]
x86/PCI: adjust section annotations for pcibios_setup()

Make pcibios_setup() consistently use the "__init" section annotation.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agounicore32/PCI: adjust section annotations for pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:32:25 +0000 (21:32 -0600)]
unicore32/PCI: adjust section annotations for pcibios_setup()

Make pcibios_setup() consistently use the "__init" section annotation.

Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agotile/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:32:19 +0000 (21:32 -0600)]
tile/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agosparc/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:32:12 +0000 (21:32 -0600)]
sparc/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agosh/PCI: adjust section annotations for pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:32:05 +0000 (21:32 -0600)]
sh/PCI: adjust section annotations for pcibios_setup()

Make pcibios_setup() consistently use the "__init" section annotation.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agosh/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:31:58 +0000 (21:31 -0600)]
sh/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Tested-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agopowerpc/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:31:51 +0000 (21:31 -0600)]
powerpc/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoparisc/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:31:44 +0000 (21:31 -0600)]
parisc/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMIPS/PCI: adjust section annotations for pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:31:37 +0000 (21:31 -0600)]
MIPS/PCI: adjust section annotations for pcibios_setup()

Make pcibios_setup() consistently use the "__init" section annotation.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMIPS/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:31:30 +0000 (21:31 -0600)]
MIPS/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agomicroblaze/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:31:23 +0000 (21:31 -0600)]
microblaze/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Acked-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoia64/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:31:17 +0000 (21:31 -0600)]
ia64/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Acked-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agocris/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:32:46 +0000 (21:32 -0600)]
cris/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

This patch fixes what looks like a bug in cris, which implements
pcibios_setup() such that pci_setup() doesn't look for any generic
options.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoalpha/PCI: factor out pcibios_setup()
Myron Stowe [Tue, 26 Jun 2012 03:31:10 +0000 (21:31 -0600)]
alpha/PCI: factor out pcibios_setup()

The PCI core provides a generic pcibios_setup() routine.  Drop this
architecture-specific version in favor of that.

Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: pull pcibios_setup() up into core
Myron Stowe [Tue, 26 Jun 2012 03:30:57 +0000 (21:30 -0600)]
PCI: pull pcibios_setup() up into core

Currently, all of the architectures implement their own pcibios_setup()
routine.  Most of the implementations do nothing so this patch introduces
a generic (__weak) routine in the core that can be used by all
architectures as a default.  If necessary, it can be overridden by
architecture-specific code.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMerge branch 'topic/huang-d3cold-v7' into next
Bjorn Helgaas [Sat, 23 Jun 2012 17:59:43 +0000 (11:59 -0600)]
Merge branch 'topic/huang-d3cold-v7' into next

* topic/huang-d3cold-v7:
  PCI/PM: add PCIe runtime D3cold support
  PCI: do not call pci_set_power_state with PCI_D3cold
  PCI/PM: add runtime PM support to PCIe port
  ACPI/PM: specify lowest allowed state for device sleep state

12 years agoPCI/PM: add PCIe runtime D3cold support
Huang Ying [Sat, 23 Jun 2012 02:23:51 +0000 (10:23 +0800)]
PCI/PM: add PCIe runtime D3cold support

This patch adds runtime D3cold support and corresponding ACPI platform
support.  This patch only enables runtime D3cold support; it does not
enable D3cold support during system suspend/hibernate.

D3cold is the deepest power saving state for a PCIe device, where its main
power is removed.  While it is in D3cold, you can't access the device at
all, not even its configuration space (which is still accessible in D3hot).
Therefore the PCI PM registers can not be used to transition into/out of
the D3cold state; that must be done by platform logic such as ACPI _PR3.

To support wakeup from D3cold, a system may provide auxiliary power, which
allows a device to request wakeup using a Beacon or the sideband WAKE#
signal.  WAKE# is usually connected to platform logic such as ACPI GPE.
This is quite different from other power saving states, where devices
request wakeup via a PME message on the PCIe link.

Some devices, such as those in plug-in slots, have no direct platform
logic.  For example, there is usually no ACPI _PR3 for them.  D3cold
support for these devices can be done via the PCIe Downstream Port leading
to the device.  When the PCIe port is powered on/off, the device is powered
on/off too.  Wakeup events from the device will be notified to the
corresponding PCIe port.

For more information about PCIe D3cold and corresponding ACPI support,
please refer to:

- PCI Express Base Specification Revision 2.0
- Advanced Configuration and Power Interface Specification Revision 5.0

[bhelgaas: changelog]
Reviewed-by: Rafael J. Wysocki <rjw@sisk.pl>
Originally-by: Zheng Yan <zheng.z.yan@intel.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: do not call pci_set_power_state with PCI_D3cold
Huang Ying [Sat, 23 Jun 2012 02:23:50 +0000 (10:23 +0800)]
PCI: do not call pci_set_power_state with PCI_D3cold

PCI subsystem has not been ready for D3cold support yet.  So
PCI_D3cold should not be used as parameter for pci_set_power_state.
This patch is needed for upcoming PCI_D3cold support.

This patch has no functionality change, because pci_set_power_state
will bound the parameter to PCI_D3hot too.

CC: Michal Miroslaw <mirq-linux@rere.qmqm.pl>
CC: Jesse Barnes <jesse.barnes@intel.com>
Reviewed-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI/PM: add runtime PM support to PCIe port
Zheng Yan [Sat, 23 Jun 2012 02:23:49 +0000 (10:23 +0800)]
PCI/PM: add runtime PM support to PCIe port

This patch adds runtime PM support to PCIe port.  This is needed by
PCIe D3cold support, where PCIe device without ACPI node may be
powered on/off by PCIe port.

Because runtime suspend is broken for some chipsets, a black list is
used to disable runtime PM support for these chipsets.

Reviewed-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Zheng Yan <zheng.z.yan@intel.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoACPI/PM: specify lowest allowed state for device sleep state
Huang Ying [Sat, 23 Jun 2012 02:23:48 +0000 (10:23 +0800)]
ACPI/PM: specify lowest allowed state for device sleep state

Lower device sleep state can save more power, but has more exit
latency too.  Sometimes, to satisfy some power QoS and other
requirement, we need to constrain the lowest device sleep state.

In this patch, a parameter to specify lowest allowed state for
acpi_pm_device_sleep_state is added.  So that the caller can enforce
the constraint via the parameter.

This is needed by PCIe D3cold support, where the lowest power state
allowed may be D3_HOT instead of default D3_COLD.

CC: Len Brown <lenb@kernel.org>
CC: linux-acpi@vger.kernel.org
Reviewed-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMerge branch 'topic/jiang-mmconfig-v10' into next
Bjorn Helgaas [Fri, 22 Jun 2012 21:39:00 +0000 (15:39 -0600)]
Merge branch 'topic/jiang-mmconfig-v10' into next

* topic/jiang-mmconfig-v10:
  ACPI: mark acpi_sfi_table_parse() as __init
  x86/PCI: use pr_level() to replace printk(KERN_LEVEL)
  x86/PCI: refine __pci_mmcfg_init() for better code readability
  x86/PCI: get rid of redundant log messages
  x86/PCI: simplify pci_mmcfg_late_insert_resources()
  x86/PCI: update MMCONFIG information when hot-plugging PCI host bridges
  PCI/ACPI: provide MMCONFIG address for PCI host bridges
  x86/PCI: add pci_mmconfig_insert()/delete() for PCI root bridge hotplug
  x86/PCI: prepare pci_mmcfg_check_reserved() to be called at runtime
  x86/PCI: introduce pci_mmcfg_arch_map()/pci_mmcfg_arch_unmap()
  x86/PCI: use RCU list to protect mmconfig list
  x86/PCI: split out pci_mmconfig_alloc() for code reuse
  x86/PCI: split out pci_mmcfg_check_reserved() for code reuse

12 years agoACPI: mark acpi_sfi_table_parse() as __init
Jiang Liu [Fri, 22 Jun 2012 06:55:21 +0000 (14:55 +0800)]
ACPI: mark acpi_sfi_table_parse() as __init

Mark function acpi_sfi_table_parse() as __init to avoid warning messages:

WARNING: vmlinux.o(.text+0x4cd2d2): Section mismatch in reference from the
function acpi_sfi_table_parse.clone.0() to the function

Function acpi_sfi_table_parse() calls acpi_table_parse() and
pci_parse_mcfg(), which are both marked as __init.  Currently
acpi_sfi_table_parse() is only used by MMCONFIG to scan MCFG table
at boot time only, so it's safe to mark acpi_sfi_table_parse() as __init.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMerge branch 'topic/bjorn-trivial' into next
Bjorn Helgaas [Fri, 22 Jun 2012 21:32:50 +0000 (15:32 -0600)]
Merge branch 'topic/bjorn-trivial' into next

* topic/bjorn-trivial:
  PCI: remove useless pcix_set_mmrbc() dev->bus check
  PCI: acpiphp: check whether _ADR evaluation succeeded
  PCI: shpchp: remove dead code
  PCI: fix P2P bridge I/O port window sign extension
  PCI: fix upstream P2P bridge checks when enabling OBFF and LTR
  PCI: use __weak consistently
  PCI: cleanup assign_requested_resources_sorted() kernel-doc warning
  sparc/PCI: remove unused pcibios_assign_resource() definition

12 years agoMerge branch 'topic/fixes-for-3.5' into next
Bjorn Helgaas [Fri, 22 Jun 2012 21:29:56 +0000 (15:29 -0600)]
Merge branch 'topic/fixes-for-3.5' into next

* topic/fixes-for-3.5:
  MAINTAINERS: correct PCI git tree address

12 years agoMAINTAINERS: correct PCI git tree address
Bjorn Helgaas [Thu, 24 May 2012 20:18:14 +0000 (14:18 -0600)]
MAINTAINERS: correct PCI git tree address

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: use pr_level() to replace printk(KERN_LEVEL)
Jiang Liu [Fri, 22 Jun 2012 06:55:22 +0000 (14:55 +0800)]
x86/PCI: use pr_level() to replace printk(KERN_LEVEL)

Script checkpatch.pl recommends to replace printk(KERN_LVL) with pr_lvl(),
so do it.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: refine __pci_mmcfg_init() for better code readability
Jiang Liu [Fri, 22 Jun 2012 06:55:20 +0000 (14:55 +0800)]
x86/PCI: refine __pci_mmcfg_init() for better code readability

Refine __pci_mmcfg_init() for better code readability.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: get rid of redundant log messages
Jiang Liu [Fri, 22 Jun 2012 06:55:19 +0000 (14:55 +0800)]
x86/PCI: get rid of redundant log messages

For each resource of a PCI host bridge, the arch code and PCI
code log following messages.  We don't need both, so drop the
arch-specific printing.

    pci_root PNP0A08:00: host bridge window [io 0x0000-0x03af]
    pci_bus 0000:00: root bus resource [io  0x0000-0x03af]

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: simplify pci_mmcfg_late_insert_resources()
Jiang Liu [Fri, 22 Jun 2012 06:55:18 +0000 (14:55 +0800)]
x86/PCI: simplify pci_mmcfg_late_insert_resources()

Reduce redundant code to simplify pci_mmcfg_late_insert_resources().

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: update MMCONFIG information when hot-plugging PCI host bridges
Jiang Liu [Fri, 22 Jun 2012 06:55:17 +0000 (14:55 +0800)]
x86/PCI: update MMCONFIG information when hot-plugging PCI host bridges

This patch enhances x86 arch-specific code to update MMCONFIG information
when PCI host bridge hotplug event happens.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI/ACPI: provide MMCONFIG address for PCI host bridges
Jiang Liu [Fri, 22 Jun 2012 06:55:16 +0000 (14:55 +0800)]
PCI/ACPI: provide MMCONFIG address for PCI host bridges

This patch provide MMCONFIG address for PCI host bridges, which will
be used to support host bridge hotplug.  It gets MMCONFIG address
by evaluating _CBA method if available.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: add pci_mmconfig_insert()/delete() for PCI root bridge hotplug
Jiang Liu [Fri, 22 Jun 2012 06:55:15 +0000 (14:55 +0800)]
x86/PCI: add pci_mmconfig_insert()/delete() for PCI root bridge hotplug

Introduce pci_mmconfig_insert()/pci_mmconfig_delete(), which will be used
to update MMCONFIG information when supporting PCI root bridge hotplug.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: prepare pci_mmcfg_check_reserved() to be called at runtime
Jiang Liu [Fri, 22 Jun 2012 06:55:14 +0000 (14:55 +0800)]
x86/PCI: prepare pci_mmcfg_check_reserved() to be called at runtime

Prepare function pci_mmcfg_check_reserved() to be called at runtime
for PCI host bridge hot-plugging

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: introduce pci_mmcfg_arch_map()/pci_mmcfg_arch_unmap()
Jiang Liu [Fri, 22 Jun 2012 06:55:13 +0000 (14:55 +0800)]
x86/PCI: introduce pci_mmcfg_arch_map()/pci_mmcfg_arch_unmap()

Introduce pci_mmcfg_arch_map()/pci_mmcfg_arch_unmap(), which will be used
when supporting PCI root bridge hotplug.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: use RCU list to protect mmconfig list
Jiang Liu [Fri, 22 Jun 2012 06:55:12 +0000 (14:55 +0800)]
x86/PCI: use RCU list to protect mmconfig list

Use RCU list to protect mmconfig list from dynamic change
when supporting PCI host bridge hotplug.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: split out pci_mmconfig_alloc() for code reuse
Jiang Liu [Fri, 22 Jun 2012 06:55:11 +0000 (14:55 +0800)]
x86/PCI: split out pci_mmconfig_alloc() for code reuse

Split out pci_mmconfig_alloc() for code reuse, which will be used
when supporting PCI root bridge hotplug.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agox86/PCI: split out pci_mmcfg_check_reserved() for code reuse
Jiang Liu [Fri, 22 Jun 2012 06:55:10 +0000 (14:55 +0800)]
x86/PCI: split out pci_mmcfg_check_reserved() for code reuse

Split out pci_mmcfg_check_reserved() for code reuse, which will be used
when supporting PCI host bridge hotplug.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: remove useless pcix_set_mmrbc() dev->bus check
Bjorn Helgaas [Wed, 20 Jun 2012 22:41:16 +0000 (16:41 -0600)]
PCI: remove useless pcix_set_mmrbc() dev->bus check

For a valid pci_dev, dev->bus != NULL always, so remove this
unnecessary test.

Found by Coverity (CID 101680).

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: acpiphp: check whether _ADR evaluation succeeded
Bjorn Helgaas [Wed, 20 Jun 2012 22:18:29 +0000 (16:18 -0600)]
PCI: acpiphp: check whether _ADR evaluation succeeded

Check whether we evaluated _ADR successfully.  Previously we ignored
failure, so we would have used garbage data from the stack as the device
and function number.

We return AE_OK so that we ignore only this slot and continue looking
for other slots.

Found by Coverity (CID 113981).

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: shpchp: remove dead code
Bjorn Helgaas [Wed, 20 Jun 2012 22:11:45 +0000 (16:11 -0600)]
PCI: shpchp: remove dead code

"slots_not_empty" is initialized to zero and can't be set again before
reaching this point, so this return statement is dead.  Remove it.

Found by Coverity (CID 114324).

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: fix P2P bridge I/O port window sign extension
Bjorn Helgaas [Tue, 19 Jun 2012 13:45:44 +0000 (07:45 -0600)]
PCI: fix P2P bridge I/O port window sign extension

On P2P bridges with 32-bit I/O decoding, we incorrectly sign-extended
windows starting at 0x80000000 or above.  In "base |= (io_base_hi << 16)",
"io_base_hi" is promoted to a signed int before being extended to an
unsigned long.

This would cause a window starting at I/O address 0x80000000 to be
treated as though it started at 0xffffffff80008000 instead, which
should cause "no compatible bridge window" errors when we enumerate
devices using that I/O space.

The mmio and mmio_pref casts are not strictly necessary, but without
them, correctness depends on the types of the PCI_MEMORY_RANGE_MASK and
PCI_PREF_RANGE_MASK constants, which are not obvious from reading the
local code.

Found by Coverity (CID 138747 and CID 138748).

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: fix upstream P2P bridge checks when enabling OBFF and LTR
Bjorn Helgaas [Tue, 19 Jun 2012 13:35:34 +0000 (07:35 -0600)]
PCI: fix upstream P2P bridge checks when enabling OBFF and LTR

pci_enable_obff() and pci_enable_ltr() incorrectly check "dev->bus" instead
of "dev->bus->self" to determine whether the upstream device is a P2P
bridge or a host bridge.  For devices on the root bus, the upstream device
is a host bridge, "dev->bus != NULL" and "dev->bus->self == NULL", and we
panic with a null pointer dereference.

These functions should previously have panicked when called on devices
supporting OBFF or LTR, so they should be regarded as untested.

Found by Coverity (CID 143038 and CID 143039).

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: use __weak consistently
Bjorn Helgaas [Tue, 19 Jun 2012 12:54:49 +0000 (06:54 -0600)]
PCI: use __weak consistently

Use "__weak" instead of the gcc-specific "__attribute__ ((weak))"

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: cleanup assign_requested_resources_sorted() kernel-doc warning
Wanpeng Li [Fri, 15 Jun 2012 13:15:49 +0000 (21:15 +0800)]
PCI: cleanup assign_requested_resources_sorted() kernel-doc warning

Warning(drivers/pci/setup-bus.c:277): No description found for parameter 'fail_head'
Warning(drivers/pci/setup-bus.c:277): Excess function parameter 'failed_list' description in 'assign_requested_resources_sorted'

Signed-off-by: Wanpeng Li <liwp.linux@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMerge branch 'topic/jan-intx-masking' into next
Bjorn Helgaas [Mon, 18 Jun 2012 18:14:16 +0000 (12:14 -0600)]
Merge branch 'topic/jan-intx-masking' into next

* topic/jan-intx-masking:
  PCI: add Ralink RT2800 broken INTx masking quirk
  PCI: add Chelsio T310 10GbE NIC broken INTx masking quirk
  PCI: add infrastructure for devices with broken INTx masking

12 years agoMerge branch 'topic/sebastian-devinit-fixups' into next
Bjorn Helgaas [Mon, 18 Jun 2012 18:14:10 +0000 (12:14 -0600)]
Merge branch 'topic/sebastian-devinit-fixups' into next

* topic/sebastian-devinit-fixups:
  scripts/modpost: check for bad references in .pci.fixups area
  sh/PCI: move fixup hooks from __init to __devinit
  powerpc/PCI: move fixup hooks from __init to __devinit
  frv/PCI: move fixup hooks from __init to __devinit
  arm/PCI: move fixup hooks from __init to __devinit
  alpha/PCI: move fixup hooks from __init to __devinit
  PCI: move fixup hooks from __init to __devinit
  x86/PCI: move fixup hooks from __init to __devinit

12 years agoMerge branch 'topic/stowe-cap-cleanup' into next
Bjorn Helgaas [Mon, 18 Jun 2012 18:10:39 +0000 (12:10 -0600)]
Merge branch 'topic/stowe-cap-cleanup' into next

* topic/stowe-cap-cleanup:
  PCI: remove redundant capabilities checking in pci_{save, restore}_pcie_state
  PCI: add pci_pcie_cap2() check for PCIe feature capabilities >= v2
  PCI: remove redundant checking in PCI Express capability routines
  PCI: make pci_ltr_supported() static

12 years agoPCI: add Ralink RT2800 broken INTx masking quirk
Alex Williamson [Thu, 7 Jun 2012 17:01:59 +0000 (11:01 -0600)]
PCI: add Ralink RT2800 broken INTx masking quirk

Passes pci_intx_mask_supported test but continues to send interrupts
as discovered through VFIO-based device assignment.

http://www.spinics.net/lists/kvm/msg73738.html

[bhelgaas: use HEADER, not FINAL, which is currently broken for hotplug]
Tested-by: Andreas Hartmann <andihartmann@01019freenet.de>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: add Chelsio T310 10GbE NIC broken INTx masking quirk
Jan Kiszka [Thu, 7 Jun 2012 08:30:59 +0000 (10:30 +0200)]
PCI: add Chelsio T310 10GbE NIC broken INTx masking quirk

According to

http://thread.gmane.org/gmane.comp.emulators.kvm.devel/91388

the T310 does not properly support INTx masking as it fails to keep the
PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this
adapter as broken so that pci_intx_mask_supported won't report it as
compatible.

[bhelgaas: use HEADER, not FINAL, which is currently broken for hotplug]
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: add infrastructure for devices with broken INTx masking
Bjorn Helgaas [Sat, 16 Jun 2012 20:40:22 +0000 (14:40 -0600)]
PCI: add infrastructure for devices with broken INTx masking

pci_intx_mask_supported() assumes INTx masking is supported if the
PCI_COMMAND_INTX_DISABLE bit is writable.  But when that bit is set,
some devices don't actually mask INTx or update PCI_STATUS_INTERRUPT
as we expect.

This patch adds a way for quirks to identify these broken devices.

[bhelgaas: split out from Chelsio quirk addition]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoscripts/modpost: check for bad references in .pci.fixups area
Sebastian Andrzej Siewior [Sun, 3 Jun 2012 18:48:17 +0000 (20:48 +0200)]
scripts/modpost: check for bad references in .pci.fixups area

Functions used for PCI fixups (like DECLARE_PCI_FIXUP_HEADER) are often
marked __init. This is okay as long as nobody is using PCI hotplug.
However if one does execute
| echo 1 > /sys/bus/pci/rescan

and we hit a module which is marked __init istead of __devinit then we
go boom because the code is removed after the kernel booted. This patch
help to see those section mismatches.

Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agosh/PCI: move fixup hooks from __init to __devinit
Sebastian Andrzej Siewior [Sun, 3 Jun 2012 18:48:25 +0000 (20:48 +0200)]
sh/PCI: move fixup hooks from __init to __devinit

The fixups are executed once the pci-device is found which is during
boot process so __init seems fine as long as the platform does not
support hotplug.

However it is possible to remove the PCI bus at run time and have it
rediscovered again via "echo 1 > /sys/bus/pci/rescan" and this will call
the fixups again.

Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agopowerpc/PCI: move fixup hooks from __init to __devinit
Sebastian Andrzej Siewior [Sun, 3 Jun 2012 18:48:24 +0000 (20:48 +0200)]
powerpc/PCI: move fixup hooks from __init to __devinit

The fixups are executed once the pci-device is found which is during
boot process so __init seems fine as long as the platform does not
support hotplug.

However it is possible to remove the PCI bus at run time and have it
rediscovered again via "echo 1 > /sys/bus/pci/rescan" and this will call
the fixups again.

Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agosparc/PCI: remove unused pcibios_assign_resource() definition
Bjorn Helgaas [Fri, 15 Jun 2012 22:38:23 +0000 (16:38 -0600)]
sparc/PCI: remove unused pcibios_assign_resource() definition

pcibios_assign_resource() isn't used anywhere; remove it.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoMerge branch 'topic/alex-vfio-prep' into next
Bjorn Helgaas [Wed, 13 Jun 2012 23:04:54 +0000 (17:04 -0600)]
Merge branch 'topic/alex-vfio-prep' into next

* topic/alex-vfio-prep:
  PCI: misc pci_reg additions
  PCI: create common pcibios_err_to_errno
  PCI: export pci_user functions for use by other drivers
  PCI: add ACS validation utility
  PCI: add PCI DMA source ID quirk

12 years agoMerge branch 'topic/bjorn-remove-unused' into next
Bjorn Helgaas [Wed, 13 Jun 2012 23:04:51 +0000 (17:04 -0600)]
Merge branch 'topic/bjorn-remove-unused' into next

* topic/bjorn-remove-unused:
  PCI/AER: use pci_is_pcie() instead of obsolete pci_dev.is_pcie
  PCI: remove pci_max_busnr() (was already commented out)
  PCI: remove pci_bus_find_ext_capability() (unused)

12 years agoMerge branch 'topic/kong-acpiphp-remove' into next
Bjorn Helgaas [Wed, 13 Jun 2012 23:04:40 +0000 (17:04 -0600)]
Merge branch 'topic/kong-acpiphp-remove' into next

* topic/kong-acpiphp-remove:
  PCI: acpiphp: remove all functions in slot, even without ACPI _EJx
  PCI: acpiphp: fix function 0 leak when disabling a slot

12 years agoMerge branch 'topic/yinghai-busn-alloc' into next
Bjorn Helgaas [Wed, 13 Jun 2012 23:04:30 +0000 (17:04 -0600)]
Merge branch 'topic/yinghai-busn-alloc' into next

* topic/yinghai-busn-alloc: (33 commits)
  PCI: hotplug: remove pci_do_scan_bus()
  PCI: sgihp: use generic pci_hp_add_bridge()
  PCI: ibmhp: use generic pci_hp_add_bridge()
  PCI: cpqhp: use generic pci_hp_add_bridge()
  PCI: shpchp: use generic pci_hp_add_bridge()
  PCI: cpci_hotplug: use generic pci_hp_add_bridge()
  PCI: pciehp: use generic pci_hp_add_bridge()
  PCI: add generic pci_hp_add_bridge()
  PCI: sgihp: register busn_res
  PCI: ibmhp: register busn_res
  PCI: cpqhp: register busn_res
  PCI: shpchp: register busn_res
  PCI: cpci_hotplug: register busn_res
  PCI: insert busn_res for child bus
  PCI: register busn_res for iov bus
  tile/PCI: use pci_scan_root_bus instead pci_scan_bus
  parisc/PCI: register busn_res for root buses
  powerpc/PCI: register busn_res for root buses
  sparc/PCI: register busn_res for root buses
  ia64/PCI: register busn_res for root buses
  ...

12 years agoPCI: acpiphp: remove all functions in slot, even without ACPI _EJx
Amos Kong [Wed, 23 May 2012 16:20:35 +0000 (10:20 -0600)]
PCI: acpiphp: remove all functions in slot, even without ACPI _EJx

When we add a device with acpiphp, we enumerate all functions in the
slot with pci_scan_slot(), regardless of whether they have associated
ACPI methods such as _EJ0.

When removing the device, we previously removed only the functions
with those ACPI methods.  This patch makes the remove symmetric with the
add: we remove all functions in the slot, whether they have associated
ACPI methods or not.

With qemu-kvm and SeaBIOS, we can build a multi-function device where
only function 0 has _EJ0 and _ADR (see bugzilla below).  Removing and
re-adding that slot (including all functions of the device) works correctly
with Windows guests.  This patch makes it also work in Linux guests.

[bhelgaas: restructure loop iteration, pull out of slot->funcs loop]
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=43219
Signed-off-by: Amos Kong <kongjianjun@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: acpiphp: fix function 0 leak when disabling a slot
Amos Kong [Wed, 23 May 2012 03:58:40 +0000 (21:58 -0600)]
PCI: acpiphp: fix function 0 leak when disabling a slot

Previously, we acquired two references to function 0, but only released
one.

[bhelgaas: split this out from "remove all functions" fix]
Signed-off-by: Amos Kong <kongjianjun@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: hotplug: remove pci_do_scan_bus()
Yinghai Lu [Fri, 18 May 2012 01:58:41 +0000 (18:58 -0700)]
PCI: hotplug: remove pci_do_scan_bus()

All callers of pci_do_scan_bus() are gone, so remove it.

Note that pci_do_scan_bus() was exported, so out-of-tree modules could
depend on it.

[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: sgihp: use generic pci_hp_add_bridge()
Yinghai Lu [Fri, 18 May 2012 01:58:41 +0000 (18:58 -0700)]
PCI: sgihp: use generic pci_hp_add_bridge()

Use the new generic pci_hp_add_bridge() interface.

[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: ibmhp: use generic pci_hp_add_bridge()
Yinghai Lu [Fri, 18 May 2012 01:58:41 +0000 (18:58 -0700)]
PCI: ibmhp: use generic pci_hp_add_bridge()

Use the new generic pci_hp_add_bridge() interface.

[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: cpqhp: use generic pci_hp_add_bridge()
Yinghai Lu [Fri, 18 May 2012 01:58:41 +0000 (18:58 -0700)]
PCI: cpqhp: use generic pci_hp_add_bridge()

Use the new generic pci_hp_add_bridge() interface.

[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: shpchp: use generic pci_hp_add_bridge()
Yinghai Lu [Fri, 18 May 2012 01:58:41 +0000 (18:58 -0700)]
PCI: shpchp: use generic pci_hp_add_bridge()

Use the new generic pci_hp_add_bridge() interface.

[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: cpci_hotplug: use generic pci_hp_add_bridge()
Yinghai Lu [Fri, 18 May 2012 01:58:41 +0000 (18:58 -0700)]
PCI: cpci_hotplug: use generic pci_hp_add_bridge()

Use the new generic pci_hp_add_bridge() interface.

[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: pciehp: use generic pci_hp_add_bridge()
Yinghai Lu [Fri, 18 May 2012 01:58:41 +0000 (18:58 -0700)]
PCI: pciehp: use generic pci_hp_add_bridge()

Use the new generic pci_hp_add_bridge() interface.

[bhelgaas: split "add generic pci_hp_add_bridge()" into a separate patch]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: add generic pci_hp_add_bridge()
Yinghai Lu [Fri, 18 May 2012 19:46:34 +0000 (13:46 -0600)]
PCI: add generic pci_hp_add_bridge()

This creates a generic pci_hp_add_bridge() that can be used by several
hotplug drivers.

[bhelgaas: split out from pciehp patch]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: sgihp: register busn_res
Yinghai Lu [Fri, 18 May 2012 01:51:13 +0000 (18:51 -0700)]
PCI: sgihp: register busn_res

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: ibmhp: register busn_res
Yinghai Lu [Fri, 18 May 2012 01:51:13 +0000 (18:51 -0700)]
PCI: ibmhp: register busn_res

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: cpqhp: register busn_res
Yinghai Lu [Fri, 18 May 2012 01:51:13 +0000 (18:51 -0700)]
PCI: cpqhp: register busn_res

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: shpchp: register busn_res
Yinghai Lu [Fri, 18 May 2012 01:51:13 +0000 (18:51 -0700)]
PCI: shpchp: register busn_res

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: cpci_hotplug: register busn_res
Yinghai Lu [Fri, 18 May 2012 01:51:13 +0000 (18:51 -0700)]
PCI: cpci_hotplug: register busn_res

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: insert busn_res for child bus
Yinghai Lu [Fri, 18 May 2012 01:51:13 +0000 (18:51 -0700)]
PCI: insert busn_res for child bus

Now we can insert busn_res now, after all root bus's get inserted.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoPCI: register busn_res for iov bus
Yinghai Lu [Fri, 18 May 2012 01:51:13 +0000 (18:51 -0700)]
PCI: register busn_res for iov bus

Insert that to tree.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agotile/PCI: use pci_scan_root_bus instead pci_scan_bus
Yinghai Lu [Fri, 18 May 2012 01:51:13 +0000 (18:51 -0700)]
tile/PCI: use pci_scan_root_bus instead pci_scan_bus

It will update busn_res accordingly, so we get that for last_busno.

Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 years agoparisc/PCI: register busn_res for root buses
Yinghai Lu [Fri, 18 May 2012 01:51:12 +0000 (18:51 -0700)]
parisc/PCI: register busn_res for root buses

Add the host bridge bus number aperture to the resource list.
Like the MMIO and I/O port apertures, this is used when assigning
resources to hot-added devices or in the case of conflicts.

[bhelgaas: changelog, set flags directly, at LBA bus_num init]
CC: Kyle McMartin <kyle@mcmartin.ca>
CC: Helge Deller <deller@gmx.de>
CC: linux-parisc@vger.kernel.org
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>