Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions xen/arch/x86/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
39 changes: 20 additions & 19 deletions xen/common/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
/*
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions xen/include/xen/domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading