|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] x86/irq: Return -EEXIST from map_domain_pirq()
commit bfc341a65cfb ("x86: Make the hypercall PHYSDEVOP_alloc_irq_vector
hypercall dummy.") modified map_domain_pirq() to return 0 when an irq or
pirq is already mapped, when it previously returned -EINVAL. This
occured when moving map_domain_pirq()'s call from
PHYSDEVOP_alloc_irq_vector into PHYSDEVOP_apic_write.
However, this means other callers cannot detect when a pirq or irq is
already mapped. Since success is returned but the pirq is not
connected, it will never fire.
Modify map_domain_pirq() to return -EEXIST. -EINVAL is already returned
elsewhere in map_domain_pirq(), so -EEXIST allows identifying this case.
With that, squash -EEXIST in ioapic_guest_write() so the behavior does not
change.
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
I'm not sure whether or not this warrants a Fixes. Nothing in tree
today is broken, so I did not add one.
xen/arch/x86/io_apic.c | 2 ++
xen/arch/x86/irq.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 46c2a43dac..2b928fc236 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2315,6 +2315,8 @@ int ioapic_guest_write(unsigned long physbase, unsigned
int reg, u32 val)
ret = map_domain_pirq(hardware_domain, pirq, irq,
MAP_PIRQ_TYPE_GSI, NULL);
write_unlock(&hardware_domain->event_lock);
+ if ( ret == -EEXIST )
+ ret = 0;
if ( ret < 0 )
return ret;
}
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 739fc04bd1..938cca6203 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2210,7 +2210,7 @@ int map_domain_pirq(
dprintk(XENLOG_G_WARNING,
"dom%d: pirq %d or irq %d already mapped (%d,%d)\n",
d->domain_id, pirq, irq, old_pirq, old_irq);
- return 0;
+ return -EEXIST;
}
ret = xsm_map_domain_irq(XSM_HOOK, d, irq, data);
--
2.54.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |