Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xen: support GSI -> pirq remapping in PV on HVM guests

Disable pcifront when running on HVM: it is meant to be used with pv
guests that don't have PCI bus.

Use acpi_register_gsi_xen_hvm to remap GSIs into pirqs.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

+29 -1
+5
arch/x86/include/asm/xen/pci.h
··· 3 3 4 4 #if defined(CONFIG_PCI_XEN) 5 5 extern int __init pci_xen_init(void); 6 + extern int __init pci_xen_hvm_init(void); 6 7 #define pci_xen 1 7 8 #else 8 9 #define pci_xen 0 9 10 #define pci_xen_init (0) 11 + static inline int pci_xen_hvm_init(void) 12 + { 13 + return -1; 14 + } 10 15 #endif 11 16 12 17 #if defined(CONFIG_PCI_MSI)
+16
arch/x86/pci/xen.c
··· 14 14 15 15 #include <asm/xen/hypervisor.h> 16 16 17 + #include <xen/features.h> 17 18 #include <xen/events.h> 18 19 #include <asm/xen/pci.h> 19 20 ··· 182 181 x86_msi.setup_msi_irqs = xen_setup_msi_irqs; 183 182 x86_msi.teardown_msi_irq = xen_teardown_msi_irq; 184 183 x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs; 184 + #endif 185 + return 0; 186 + } 187 + 188 + int __init pci_xen_hvm_init(void) 189 + { 190 + if (!xen_feature(XENFEAT_hvm_pirqs)) 191 + return 0; 192 + 193 + #ifdef CONFIG_ACPI 194 + /* 195 + * We don't want to change the actual ACPI delivery model, 196 + * just how GSIs get registered. 197 + */ 198 + __acpi_register_gsi = acpi_register_gsi_xen_hvm; 185 199 #endif 186 200 return 0; 187 201 }
+5 -1
drivers/xen/events.c
··· 623 623 624 624 /* If we are a PV guest, we don't have GSIs (no ACPI passed). Therefore 625 625 * we are using the !xen_initial_domain() to drop in the function.*/ 626 - if (identity_mapped_irq(gsi) || !xen_initial_domain()) { 626 + if (identity_mapped_irq(gsi) || (!xen_initial_domain() && 627 + xen_pv_domain())) { 627 628 irq = gsi; 628 629 irq_alloc_desc_at(irq, 0); 629 630 } else ··· 1398 1397 if (xen_hvm_domain()) { 1399 1398 xen_callback_vector(); 1400 1399 native_init_IRQ(); 1400 + /* pci_xen_hvm_init must be called after native_init_IRQ so that 1401 + * __acpi_register_gsi can point at the right function */ 1402 + pci_xen_hvm_init(); 1401 1403 } else { 1402 1404 irq_ctx_init(smp_processor_id()); 1403 1405 }
+3
include/xen/interface/features.h
··· 47 47 /* x86: pvclock algorithm is safe to use on HVM */ 48 48 #define XENFEAT_hvm_safe_pvclock 9 49 49 50 + /* x86: pirq can be used by HVM guests */ 51 + #define XENFEAT_hvm_pirqs 10 52 + 50 53 #define XENFEAT_NR_SUBMAPS 1 51 54 52 55 #endif /* __XEN_PUBLIC_FEATURES_H__ */