x86/PCI updates for 4.13
Linus,
please pull the latest x86-platform-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-platform-for-linus
This update provides:
The seperation of x86 PCI accessors from the global PCI lock in the generic PCI config space accessors. The reasons for this are:
- x86 has it's own PCI config lock for various reasons, so the accessors have to lock two locks nested.
- The ECAM (mmconfig) access to the extended configuration space does not require locking. The existing generic locking causes a massive lock contention when accessing the extended config space of the Uncore facility for performance monitoring.
The commit, which switched the access to the primary config space over to ECAM mode, has been removed from the branch, so the primary config space is still accessed with type1 accessors properly serialized by the x86 internal locking.
Bjorn agreed on merging this through the x86 tree.
Thanks,
tglx
------------------>
Thomas Gleixner (5):
x86/PCI: Remove duplicate defines
x86/PCI: Abort if legacy init fails
x86/PCI/ce4100: Properly lock accessor functions
PCI: Provide Kconfig option for lockless config space accessors x86/PCI: Select CONFIG_PCI_LOCKLESS_CONFIG
arch/x86/Kconfig | 1 + arch/x86/include/asm/pci.h | 8 +---- arch/x86/pci/ce4100.c | 87 +++++++++++++++++++++++++--------------------- arch/x86/pci/common.c | 4 +-- arch/x86/pci/legacy.c | 18 +++++----- drivers/pci/Kconfig | 3 ++ drivers/pci/access.c | 16 ++++++--- 7 files changed, 77 insertions(+), 60 deletions(-)
arch/x86/Kconfig +1 -0
@@ -166,6 +166,7 @@ config X86 select HAVE_UNSTABLE_SCHED_CLOCK select HAVE_USER_RETURN_NOTIFIER select IRQ_FORCED_THREADING + select PCI_LOCKLESS_CONFIG select PERF_EVENTS select RTC_LIB select RTC_MC146818_LIB
arch/x86/include/asm/pci.h +1 -7
@@ -77,14 +77,8 @@ static inline bool is_vmd(struct pci_bus *bus)extern unsigned int pcibios_assign_all_busses (void );extern int pci_legacy_init (void ); -# ifdef CONFIG_ACPI -# define x86_default_pci_init pci_acpi_init -# else -# define x86_default_pci_init pci_legacy_init -# endif #else -# define pcibios_assign_all_busses () 0 -# define x86_default_pci_init NULL +static inline int pcibios_assign_all_busses (void ) {return 0 ; }#endif extern unsigned long pci_mem_start;
arch/x86/pci/ce4100.c +48 -39
142 lines not on this page · raw message
arch/x86/pci/common.c +2 -2
@@ -75,8 +75,8 @@ struct pci_ops pci_root_ops = { };/* -* This interrupt-safe spinlock protects all accesses to PCI -* configuration space. +* This interrupt-safe spinlock protects all accesses to PCI configuration +* space, except for the mmconfig (ECAM) based operations. */ DEFINE_RAW_SPINLOCK (pci_config_lock);
arch/x86/pci/legacy.c +10 -8
@@ -24,12 +24,10 @@ static void pcibios_fixup_peer_bridges(void)int __init pci_legacy_init (void ) { -if (!raw_pci_ops) { -printk ("PCI: System does not support PCI\n" ); -return 0 ; - } +if (!raw_pci_ops) +return 1 ; -printk ("PCI: Probing PCI hardware\n" ); +pr_info ("PCI: Probing PCI hardware\n" );pcibios_scan_root (0 );return 0 ; }
@@ -46,7 +44,7 @@ void pcibios_scan_specific_bus(int busn)if (!raw_pci_read (0 , busn, devfn,PCI_VENDOR_ID ,2 , &l) && l !=0x0000 && l !=0xffff ) {DBG ("Found device at %02x:%02x [%04x]\n" , busn, devfn, l); -printk (KERN_INFO "PCI: Discovered peer bus %02x\n" , busn); +pr_info ("PCI: Discovered peer bus %02x\n" , busn);pcibios_scan_root (busn);return ; }
@@ -60,8 +58,12 @@ static int __init pci_subsys_init(void)* The init function returns an non zero value when * pci_legacy_init should be invoked. */ -if (x86_init.pci.init ()) -pci_legacy_init (); +if (x86_init.pci.init ()) { +if (pci_legacy_init ()) { +pr_info ("PCI: System does not support PCI\n" ); +return -ENODEV ; + } + }pcibios_fixup_peer_bridges (); x86_init.pci.init_irq ();
drivers/pci/Kconfig +3 -0
@@ -86,6 +86,9 @@ config PCI_ATS config PCI_ECAM bool +config PCI_LOCKLESS_CONFIG + bool + config PCI_IOV bool "PCI IOV support" depends on PCI
drivers/pci/access.c +12 -4
@@ -25,6 +25,14 @@ DEFINE_RAW_SPINLOCK(pci_lock);#define PCI_word_BAD (pos & 1)#define PCI_dword_BAD (pos & 3) +#ifdef CONFIG_PCI_LOCKLESS_CONFIG +# define pci_lock_config (f) do { (void)(f); } while (0) +# define pci_unlock_config (f) do { (void)(f); } while (0) +#else +# define pci_lock_config (f) raw_spin_lock_irqsave(&pci_lock, f) +# define pci_unlock_config (f) raw_spin_unlock_irqrestore(&pci_lock, f) +#endif +#define PCI_OP_READ (size, type, len) \ int pci_bus_read_config_##size \ (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
@@ -33,10 +41,10 @@ int pci_bus_read_config_##size \unsigned long flags; \u32 data =0 ; \ if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ -raw_spin_lock_irqsave (&pci_lock, flags); \ +pci_lock_config (flags); \ res = bus->ops->read (bus, devfn, pos, len, &data); \ *value = (type )data; \ -raw_spin_unlock_irqrestore (&pci_lock, flags); \ +pci_unlock_config (flags); \return res; \ }
@@ -47,9 +55,9 @@ int pci_bus_write_config_##size \int res; \unsigned long flags; \ if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ -raw_spin_lock_irqsave (&pci_lock, flags); \ +pci_lock_config (flags); \ res = bus->ops->write (bus, devfn, pos, len, value); \ -raw_spin_unlock_irqrestore (&pci_lock, flags); \ +pci_unlock_config (flags); \return res; \ }