mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-06 02:24:14 +08:00
x86/xen: Consolidate XEN-MSI init
X86 cannot store the irq domain pointer in struct device without breaking XEN because the irq domain pointer takes precedence over arch_*_msi_irqs() fallbacks. To achieve this XEN MSI interrupt management needs to be wrapped into an irq domain. Move the x86_msi ops setup into a single function to prepare for this. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/20200826112333.420224092@linutronix.de
This commit is contained in:
parent
7d4d892de6
commit
70b59379ef
@ -372,7 +372,10 @@ static void xen_initdom_restore_msi_irqs(struct pci_dev *dev)
|
||||
WARN(ret && ret != -ENOSYS, "restore_msi -> %d\n", ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else /* CONFIG_XEN_DOM0 */
|
||||
#define xen_initdom_setup_msi_irqs NULL
|
||||
#define xen_initdom_restore_msi_irqs NULL
|
||||
#endif /* !CONFIG_XEN_DOM0 */
|
||||
|
||||
static void xen_teardown_msi_irqs(struct pci_dev *dev)
|
||||
{
|
||||
@ -404,7 +407,31 @@ static void xen_teardown_msi_irq(unsigned int irq)
|
||||
WARN_ON_ONCE(1);
|
||||
}
|
||||
|
||||
#endif
|
||||
static __init void xen_setup_pci_msi(void)
|
||||
{
|
||||
if (xen_pv_domain()) {
|
||||
if (xen_initial_domain()) {
|
||||
x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs;
|
||||
x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs;
|
||||
} else {
|
||||
x86_msi.setup_msi_irqs = xen_setup_msi_irqs;
|
||||
}
|
||||
x86_msi.teardown_msi_irqs = xen_pv_teardown_msi_irqs;
|
||||
pci_msi_ignore_mask = 1;
|
||||
} else if (xen_hvm_domain()) {
|
||||
x86_msi.setup_msi_irqs = xen_hvm_setup_msi_irqs;
|
||||
x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs;
|
||||
} else {
|
||||
WARN_ON_ONCE(1);
|
||||
return;
|
||||
}
|
||||
|
||||
x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
|
||||
}
|
||||
|
||||
#else /* CONFIG_PCI_MSI */
|
||||
static inline void xen_setup_pci_msi(void) { }
|
||||
#endif /* CONFIG_PCI_MSI */
|
||||
|
||||
int __init pci_xen_init(void)
|
||||
{
|
||||
@ -421,12 +448,7 @@ int __init pci_xen_init(void)
|
||||
/* Keep ACPI out of the picture */
|
||||
acpi_noirq_set();
|
||||
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
x86_msi.setup_msi_irqs = xen_setup_msi_irqs;
|
||||
x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
|
||||
x86_msi.teardown_msi_irqs = xen_pv_teardown_msi_irqs;
|
||||
pci_msi_ignore_mask = 1;
|
||||
#endif
|
||||
xen_setup_pci_msi();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -446,10 +468,7 @@ static void __init xen_hvm_msi_init(void)
|
||||
((eax & XEN_HVM_CPUID_APIC_ACCESS_VIRT) && boot_cpu_has(X86_FEATURE_APIC)))
|
||||
return;
|
||||
}
|
||||
|
||||
x86_msi.setup_msi_irqs = xen_hvm_setup_msi_irqs;
|
||||
x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs;
|
||||
x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
|
||||
xen_setup_pci_msi();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -482,13 +501,7 @@ int __init pci_xen_initial_domain(void)
|
||||
{
|
||||
int irq;
|
||||
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs;
|
||||
x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
|
||||
x86_msi.teardown_msi_irqs = xen_teardown_pv_msi_irqs;
|
||||
x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs;
|
||||
pci_msi_ignore_mask = 1;
|
||||
#endif
|
||||
xen_setup_pci_msi();
|
||||
__acpi_register_gsi = acpi_register_gsi_xen;
|
||||
__acpi_unregister_gsi = NULL;
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user