diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 8de9d01138..d5f38f225e 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -2044,6 +2044,8 @@ void asmlinkage __init noreturn __start_xen(void) if ( ret < 0 ) panic("Error %d setting up IRQ data\n", ret); + bound_extra_guest_irqs(); + console_init_irq(); init_IRQ(); diff --git a/xen/common/domain.c b/xen/common/domain.c index 35b11f6072..0ced34aaa6 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1164,6 +1164,26 @@ struct domain *domain_create(domid_t domid, return ERR_PTR(err); } +#ifdef CONFIG_HAS_PIRQ +/* Bound-check values passed via "extra_guest_irqs=", once nr_irqs is known. */ +void __init bound_extra_guest_irqs(void) +{ + unsigned int n = max(arch_hwdom_irqs(dom_xen), nr_static_irqs); + + if ( extra_hwdom_irqs > n - nr_static_irqs ) + { + extra_hwdom_irqs = n - nr_static_irqs; + printk(XENLOG_WARNING "hwdom IRQs bounded to %u\n", n); + } + if ( extra_domU_irqs > + max(DEFAULT_EXTRA_DOMU_IRQS, n - nr_static_irqs) ) + { + extra_domU_irqs = n - nr_static_irqs; + printk(XENLOG_WARNING "domU IRQs bounded to %u\n", n); + } +} +#endif + void __init setup_system_domains(void) { /* @@ -1177,25 +1197,6 @@ void __init setup_system_domains(void) if ( IS_ERR(dom_xen) ) panic("Failed to create d[XEN]: %ld\n", PTR_ERR(dom_xen)); -#ifdef CONFIG_HAS_PIRQ - /* Bound-check values passed via "extra_guest_irqs=". */ - { - unsigned int n = max(arch_hwdom_irqs(dom_xen), nr_static_irqs); - - if ( extra_hwdom_irqs > n - nr_static_irqs ) - { - extra_hwdom_irqs = n - nr_static_irqs; - printk(XENLOG_WARNING "hwdom IRQs bounded to %u\n", n); - } - if ( extra_domU_irqs > - max(DEFAULT_EXTRA_DOMU_IRQS, n - nr_static_irqs) ) - { - extra_domU_irqs = n - nr_static_irqs; - printk(XENLOG_WARNING "domU IRQs bounded to %u\n", n); - } - } -#endif - /* * Initialise our DOMID_IO domain. * This domain owns I/O pages that are within the range of the page_info diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 313bb047cc..73d5975eb7 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -43,6 +43,9 @@ int vcpu_reset(struct vcpu *v); int vcpu_up(struct vcpu *v); void setup_system_domains(void); +#ifdef CONFIG_HAS_PIRQ +void bound_extra_guest_irqs(void); +#endif struct xen_domctl_getdomaininfo; void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info);