@@ -543,13 +543,18 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
if ( (rc = domain_vtimer_init(d)) != 0 )
goto fail;
- if ( d->domain_id )
+ /*
+ * The hardware domain will get a PPI later in
+ * arch/arm/domain_build.c depending on the
+ * interrupt map of the hardware.
+ */
+ if ( !is_hardware_domain(d) )
+ {
d->arch.evtchn_irq = GUEST_EVTCHN_PPI;
- else
- d->arch.evtchn_irq = platform_dom0_evtchn_ppi();
-
- if ( !vgic_reserve_virq(d, d->arch.evtchn_irq) )
- BUG();
+ /* At this stage vgic_reserve_virq should never fail */
+ if ( !vgic_reserve_virq(d, GUEST_EVTCHN_PPI) )
+ BUG();
+ }
/*
* Virtual UART is only used by linux early printk and decompress code.
@@ -627,6 +627,16 @@ static int make_hypervisor_node(struct domain *d,
return res;
/*
+ * The allocation of the event channel IRQ has been deferred until
+ * now. At this time, all PPIs use by DOM0 has been registered
+ */
+ res = vgic_allocate_virq(d, 0);
+ if ( res < 0 )
+ return -FDT_ERR_XEN(ENOSPC);
+
+ d->arch.evtchn_irq = res;
+
+ /*
* interrupts is evtchn upcall:
* - Active-low level-sensitive
* - All cpus
@@ -160,13 +160,6 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node)
return dt_match_node(blacklist, node);
}
-unsigned int platform_dom0_evtchn_ppi(void)
-{
- if ( platform && platform->dom0_evtchn_ppi )
- return platform->dom0_evtchn_ppi;
- return GUEST_EVTCHN_PPI;
-}
-
void platform_dom0_gnttab(paddr_t *start, paddr_t *size)
{
if ( platform && platform->dom0_gnttab_size )
@@ -232,7 +232,6 @@ PLATFORM_START(xgene_storm, "APM X-GENE STORM")
.quirks = xgene_storm_quirks,
.specific_mapping = xgene_storm_specific_mapping,
- .dom0_evtchn_ppi = 24,
.dom0_gnttab_start = 0x1f800000,
.dom0_gnttab_size = 0x20000,
PLATFORM_END
@@ -38,10 +38,6 @@ struct platform_desc {
*/
const struct dt_device_match *blacklist_dev;
/*
- * The IRQ (PPI) to use to inject event channels to dom0.
- */
- unsigned int dom0_evtchn_ppi;
- /*
* The location of a region of physical address space which dom0
* can use for grant table mappings. If size is zero defaults to
* 0xb0000000-0xb0020000.
Use the new vgic interface to know which virtual PPI is free and use it for the event channel code. At the DOM0 creation time, Xen still don't know which vIRQ will be free. All the vIRQ will be reserved when we parse the device tree. So allocate when the hypervisor node is created. It's safe to defer the allocation because no vIRQ can be injected as long as the vCPU is not online. Also correct the check in arch_domain_create to use is_hardware_domain. Signed-off-by: Julien Grall <julien.grall@linaro.org> --- Changes in v2: - Correct the BUG_ON in arch_domain_create - Use if (...) BUG() rather than BUG_ON() --- xen/arch/arm/domain.c | 17 +++++++++++------ xen/arch/arm/domain_build.c | 10 ++++++++++ xen/arch/arm/platform.c | 7 ------- xen/arch/arm/platforms/xgene-storm.c | 1 - xen/include/asm-arm/platform.h | 4 ---- 5 files changed, 21 insertions(+), 18 deletions(-)