Commit 6b15ffa0 authored by Thomas Gleixner's avatar Thomas Gleixner

x86/irq: Initialize PCI/MSI domain at PCI init time

No point in initializing the default PCI/MSI interrupt domain early and no
point to create it when XEN PV/HVM/DOM0 are active.

Move the initialization to pci_arch_init() and convert it to init ops so
that XEN can override it as XEN has it's own PCI/MSI management. The XEN
override comes in a later step.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20200826112332.859209894@linutronix.de
parent 445d3595
...@@ -51,9 +51,11 @@ extern int mp_irqdomain_ioapic_idx(struct irq_domain *domain); ...@@ -51,9 +51,11 @@ extern int mp_irqdomain_ioapic_idx(struct irq_domain *domain);
#endif /* CONFIG_X86_IO_APIC */ #endif /* CONFIG_X86_IO_APIC */
#ifdef CONFIG_PCI_MSI #ifdef CONFIG_PCI_MSI
extern void arch_init_msi_domain(struct irq_domain *domain); void x86_create_pci_msi_domain(void);
struct irq_domain *native_create_pci_msi_domain(void);
#else #else
static inline void arch_init_msi_domain(struct irq_domain *domain) { } static inline void x86_create_pci_msi_domain(void) { }
#define native_create_pci_msi_domain NULL
#endif #endif
#endif #endif
...@@ -8,6 +8,7 @@ struct mpc_bus; ...@@ -8,6 +8,7 @@ struct mpc_bus;
struct mpc_cpu; struct mpc_cpu;
struct mpc_table; struct mpc_table;
struct cpuinfo_x86; struct cpuinfo_x86;
struct irq_domain;
/** /**
* struct x86_init_mpparse - platform specific mpparse ops * struct x86_init_mpparse - platform specific mpparse ops
...@@ -42,12 +43,14 @@ struct x86_init_resources { ...@@ -42,12 +43,14 @@ struct x86_init_resources {
* @intr_init: interrupt init code * @intr_init: interrupt init code
* @intr_mode_select: interrupt delivery mode selection * @intr_mode_select: interrupt delivery mode selection
* @intr_mode_init: interrupt delivery mode setup * @intr_mode_init: interrupt delivery mode setup
* @create_pci_msi_domain: Create the PCI/MSI interrupt domain
*/ */
struct x86_init_irqs { struct x86_init_irqs {
void (*pre_vector_init)(void); void (*pre_vector_init)(void);
void (*intr_init)(void); void (*intr_init)(void);
void (*intr_mode_select)(void); void (*intr_mode_select)(void);
void (*intr_mode_init)(void); void (*intr_mode_init)(void);
struct irq_domain *(*create_pci_msi_domain)(void);
}; };
/** /**
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/irq_remapping.h> #include <asm/irq_remapping.h>
static struct irq_domain *msi_default_domain; static struct irq_domain *x86_pci_msi_default_domain __ro_after_init;
static void __irq_msi_compose_msg(struct irq_cfg *cfg, struct msi_msg *msg) static void __irq_msi_compose_msg(struct irq_cfg *cfg, struct msi_msg *msg)
{ {
...@@ -191,7 +191,7 @@ int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) ...@@ -191,7 +191,7 @@ int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
domain = irq_remapping_get_irq_domain(&info); domain = irq_remapping_get_irq_domain(&info);
if (domain == NULL) if (domain == NULL)
domain = msi_default_domain; domain = x86_pci_msi_default_domain;
if (domain == NULL) if (domain == NULL)
return -ENOSYS; return -ENOSYS;
...@@ -234,25 +234,32 @@ static struct msi_domain_info pci_msi_domain_info = { ...@@ -234,25 +234,32 @@ static struct msi_domain_info pci_msi_domain_info = {
.handler_name = "edge", .handler_name = "edge",
}; };
void __init arch_init_msi_domain(struct irq_domain *parent) struct irq_domain * __init native_create_pci_msi_domain(void)
{ {
struct fwnode_handle *fn; struct fwnode_handle *fn;
struct irq_domain *d;
if (disable_apic) if (disable_apic)
return; return NULL;
fn = irq_domain_alloc_named_fwnode("PCI-MSI"); fn = irq_domain_alloc_named_fwnode("PCI-MSI");
if (fn) { if (!fn)
msi_default_domain = return NULL;
pci_msi_create_irq_domain(fn, &pci_msi_domain_info,
parent); d = pci_msi_create_irq_domain(fn, &pci_msi_domain_info,
} x86_vector_domain);
if (!msi_default_domain) { if (!d) {
irq_domain_free_fwnode(fn); irq_domain_free_fwnode(fn);
pr_warn("failed to initialize irqdomain for MSI/MSI-x.\n"); pr_warn("Failed to initialize PCI-MSI irqdomain.\n");
} else { } else {
msi_default_domain->flags |= IRQ_DOMAIN_MSI_NOMASK_QUIRK; d->flags |= IRQ_DOMAIN_MSI_NOMASK_QUIRK;
} }
return d;
}
void __init x86_create_pci_msi_domain(void)
{
x86_pci_msi_default_domain = x86_init.irqs.create_pci_msi_domain();
} }
#ifdef CONFIG_IRQ_REMAP #ifdef CONFIG_IRQ_REMAP
......
...@@ -714,8 +714,6 @@ int __init arch_early_irq_init(void) ...@@ -714,8 +714,6 @@ int __init arch_early_irq_init(void)
BUG_ON(x86_vector_domain == NULL); BUG_ON(x86_vector_domain == NULL);
irq_set_default_host(x86_vector_domain); irq_set_default_host(x86_vector_domain);
arch_init_msi_domain(x86_vector_domain);
BUG_ON(!alloc_cpumask_var(&vector_searchmask, GFP_KERNEL)); BUG_ON(!alloc_cpumask_var(&vector_searchmask, GFP_KERNEL));
/* /*
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <asm/tsc.h> #include <asm/tsc.h>
#include <asm/iommu.h> #include <asm/iommu.h>
#include <asm/mach_traps.h> #include <asm/mach_traps.h>
#include <asm/irqdomain.h>
void x86_init_noop(void) { } void x86_init_noop(void) { }
void __init x86_init_uint_noop(unsigned int unused) { } void __init x86_init_uint_noop(unsigned int unused) { }
...@@ -76,7 +77,8 @@ struct x86_init_ops x86_init __initdata = { ...@@ -76,7 +77,8 @@ struct x86_init_ops x86_init __initdata = {
.pre_vector_init = init_ISA_irqs, .pre_vector_init = init_ISA_irqs,
.intr_init = native_init_IRQ, .intr_init = native_init_IRQ,
.intr_mode_select = apic_intr_mode_select, .intr_mode_select = apic_intr_mode_select,
.intr_mode_init = apic_intr_mode_init .intr_mode_init = apic_intr_mode_init,
.create_pci_msi_domain = native_create_pci_msi_domain,
}, },
.oem = { .oem = {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <asm/pci_x86.h> #include <asm/pci_x86.h>
#include <asm/x86_init.h> #include <asm/x86_init.h>
#include <asm/irqdomain.h>
/* arch_initcall has too random ordering, so call the initializers /* arch_initcall has too random ordering, so call the initializers
in the right sequence from here. */ in the right sequence from here. */
...@@ -10,6 +11,8 @@ static __init int pci_arch_init(void) ...@@ -10,6 +11,8 @@ static __init int pci_arch_init(void)
{ {
int type; int type;
x86_create_pci_msi_domain();
type = pci_direct_probe(); type = pci_direct_probe();
if (!(pci_probe & PCI_PROBE_NOEARLY)) if (!(pci_probe & PCI_PROBE_NOEARLY))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment