Current checks prevent routing of interrupts from the eSPI range to Xen
or guest domains. The addition of the is_espi condition allows verification
of whether a given index falls within the eSPI range, enabling routing of
such interrupts.
Existing behavior remains unchanged for configurations where eSPI support
is disabled, as in this case, is_espi always returns false.
Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
---
xen/arch/arm/gic.c | 4 ++--
xen/arch/arm/irq.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index e80fe0ca24..d5f2addf9f 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -111,7 +111,7 @@ static void gic_set_irq_priority(struct irq_desc *desc, unsigned int priority)
void gic_route_irq_to_xen(struct irq_desc *desc, unsigned int priority)
{
ASSERT(priority <= 0xff); /* Only 8 bits of priority */
- ASSERT(desc->irq < gic_number_lines());/* Can't route interrupts that don't exist */
+ ASSERT(desc->irq < gic_number_lines() || is_espi(desc->irq));/* Can't route interrupts that don't exist */
ASSERT(test_bit(_IRQ_DISABLED, &desc->status));
ASSERT(spin_is_locked(&desc->lock));
@@ -134,7 +134,7 @@ int gic_route_irq_to_guest(struct domain *d, unsigned int virq,
ASSERT(spin_is_locked(&desc->lock));
/* Caller has already checked that the IRQ is an SPI */
ASSERT(virq >= 32);
- ASSERT(virq < vgic_num_irqs(d));
+ ASSERT(virq < vgic_num_irqs(d) || is_espi(virq));
ASSERT(!is_lpi(virq));
ret = vgic_connect_hw_irq(d, NULL, virq, desc, true);
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 8c47eeb7c3..d4d40a4f2f 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -461,7 +461,7 @@ bool irq_type_set_by_domain(const struct domain *d)
/*
* Route an IRQ to a specific guest.
- * For now only SPIs are assignable to the guest.
+ * For now only SPIs and eSPIs are assignable to the guest.
*/
int route_irq_to_guest(struct domain *d, unsigned int virq,
unsigned int irq, const char * devname)
@@ -472,7 +472,7 @@ int route_irq_to_guest(struct domain *d, unsigned int virq,
unsigned long flags;
int retval = 0;
- if ( virq >= vgic_num_irqs(d) )
+ if ( virq >= vgic_num_irqs(d) && !is_espi(virq))
{
printk(XENLOG_G_ERR
"the vIRQ number %u is too high for domain %u (max = %u)\n",
--
2.34.1