Skip to contentSkip to conversation

x86/pci: Create PCI/MSI irqdomain after x86_init.pci.arch_init()

PATCH Applied Thomas Gleixner 2 participants 2 messages Feb 10, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pci: Create PCI/MSI irqdomain after x86_init.pci.arch_init()

Invoking x86_init.irqs.create_pci_msi_domain() before x86_init.pci.arch_init() breaks XEN PV.

The XEN_PV specific pci.arch_init() function overrides the default create_pci_msi_domain() which is obviously too late.

As a consequence the XEN PV PCI/MSI allocation goes through the native path which runs out of vectors and causes malfunction.

Invoke it after x86_init.pci.arch_init().

Fixes 6b15ffa07dc3 ("x86/irq: Initialize PCI/MSI domain at PCI init time")
---
 arch/x86/pci/init.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
arch/x86/pci/init.c +1 -3
@@ -9,16 +9,23 @@
    in the right sequence from here. */
 static __init int pci_arch_init(void)
 {
-	int type;
-
-	x86_create_pci_msi_domain();
+	int type, pcbios = 1;
 
	type = pci_direct_probe();

	if (!(pci_probe & PCI_PROBE_NOEARLY))
		pci_mmcfg_early_init();

- if (x86_init.pci.arch_init && !x86_init.pci.arch_init())
+ if (x86_init.pci.arch_init)
+ pcbios = x86_init.pci.arch_init();
+
+ /*
+ * Must happen after x86_init.pci.arch_init(). Xen sets up the
+ * x86_init.irqs.create_pci_msi_domain there.
+ */
+ x86_create_pci_msi_domain();
+
+ if (!pcbios)

		return 0;

	pci_pcbios_init();
#1 lore raw
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     70245f86c109e0eafb92ea9653184c0e44b4b35c
Gitweb:        https://git.kernel.org/tip/70245f86c109e0eafb92ea9653184c0e44b4b35c
Author:        Thomas Gleixner <[email protected]>
AuthorDate:    Wed, 10 Feb 2021 16:27:41 +01:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Wed, 10 Feb 2021 22:06:47 +01:00

x86/pci: Create PCI/MSI irqdomain after x86_init.pci.arch_init()

Invoking x86_init.irqs.create_pci_msi_domain() before x86_init.pci.arch_init() breaks XEN PV.

The XEN_PV specific pci.arch_init() function overrides the default create_pci_msi_domain() which is obviously too late.

As a consequence the XEN PV PCI/MSI allocation goes through the native path which runs out of vectors and causes malfunction.

Invoke it after x86_init.pci.arch_init().

Fixes 6b15ffa07dc3 ("x86/irq: Initialize PCI/MSI domain at PCI init time")
---
 arch/x86/pci/init.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
arch/x86/pci/init.c +11 -4
index 00bfa1e..0bb3b8b 100644
@@ -9,16 +9,23 @@
    in the right sequence from here. */
 static __init int pci_arch_init(void)
 {
-	int type;
-
-	x86_create_pci_msi_domain();
+	int type, pcbios = 1;
 
 	type = pci_direct_probe();
 
 	if (!(pci_probe & PCI_PROBE_NOEARLY))
 		pci_mmcfg_early_init();
 
-	if (x86_init.pci.arch_init && !x86_init.pci.arch_init())
+	if (x86_init.pci.arch_init)
+		pcbios = x86_init.pci.arch_init();
+
+	/*
+	 * Must happen after x86_init.pci.arch_init(). Xen sets up the
+	 * x86_init.irqs.create_pci_msi_domain there.
+	 */
+	x86_create_pci_msi_domain();
+
+	if (!pcbios)
 		return 0;
 
 	pci_pcbios_init();