diff mbox series

[32/36] x86/hvm: add helpers for raising guest IRQs

Message ID 20241126-vuart-ns8250-v1-v1-32-87b9a8375b7a@ford.com (mailing list archive)
State New
Headers show
Series Introduce NS8250 UART emulator | expand

Commit Message

Denis Mukhin via B4 Relay Nov. 26, 2024, 11:22 p.m. UTC
From: Denis Mukhin <dmukhin@ford.com>

Added convenience wrappers for asserting/de-asserting interrupts in the
hardware emulation code.

That will be used for PCI-based NS8250 emulator.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
 xen/arch/x86/hvm/irq.c             | 24 ++++++++++++++++++++++++
 xen/arch/x86/include/asm/hvm/irq.h |  3 +++
 2 files changed, 27 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 1eab44defca4c82ec35769617c66c380cc07d1b6..9e3a50d21dcf281c1015116094e47795c51ed5d0 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -242,6 +242,30 @@  void hvm_isa_irq_deassert(
     spin_unlock(&d->arch.hvm.irq_lock);
 }
 
+void hvm_irq_raise(struct domain *d, unsigned int irq)
+{
+    if ( irq < NR_ISAIRQS )
+    {
+        hvm_isa_irq_assert(d, irq, NULL);
+    }
+    else
+    {
+        hvm_gsi_assert(d, irq);
+    }
+}
+
+void hvm_irq_lower(struct domain *d, unsigned int irq)
+{
+    if ( irq < NR_ISAIRQS )
+    {
+        hvm_isa_irq_deassert(d, irq);
+    }
+    else
+    {
+        hvm_gsi_deassert(d, irq);
+    }
+}
+
 static void hvm_set_callback_irq_level(struct vcpu *v)
 {
     struct domain *d = v->domain;
diff --git a/xen/arch/x86/include/asm/hvm/irq.h b/xen/arch/x86/include/asm/hvm/irq.h
index 87e89993a44f48f366fa84e851688f383cb562d4..27bb9f64171c1b8aac2cf119699e60c91e727177 100644
--- a/xen/arch/x86/include/asm/hvm/irq.h
+++ b/xen/arch/x86/include/asm/hvm/irq.h
@@ -210,6 +210,9 @@  void hvm_maybe_deassert_evtchn_irq(void);
 void hvm_assert_evtchn_irq(struct vcpu *v);
 void hvm_set_callback_via(struct domain *d, uint64_t via);
 
+void hvm_irq_raise(struct domain *d, unsigned int irq);
+void hvm_irq_lower(struct domain *d, unsigned int irq);
+
 struct pirq;
 bool hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq);