All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/irq: do not insert IRQ_MSI_EMU in emuirq mappings
@ 2023-10-31 13:30 Xenia Ragiadakou
  2023-10-31 16:33 ` Roger Pau Monné
  0 siblings, 1 reply; 4+ messages in thread
From: Xenia Ragiadakou @ 2023-10-31 13:30 UTC (permalink / raw)
  To: xen-devel
  Cc: Xenia Ragiadakou, Jan Beulich, Andrew Cooper,
	Roger Pau Monné, Wei Liu

Do not use emuirq mappings for MSIs injected by emulated devices.
This kind of pirq shares the same emuirq value and is not remapped.

Fixes: 88fccdd11ca0 ('xen: event channel remapping for emulated MSIs')
Signed-off-by: Xenia Ragiadakou <xenia.ragiadakou@amd.com>
---

Question: is there any strong reason why Linux HVM guests still use pirqs?

 xen/arch/x86/irq.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index f42ad539dc..cdc8dc5a55 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2684,7 +2684,7 @@ int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq)
     }
 
     old_emuirq = domain_pirq_to_emuirq(d, pirq);
-    if ( emuirq != IRQ_PT )
+    if ( (emuirq != IRQ_PT) && (emuirq != IRQ_MSI_EMU) )
         old_pirq = domain_emuirq_to_pirq(d, emuirq);
 
     if ( (old_emuirq != IRQ_UNBOUND && (old_emuirq != emuirq) ) ||
@@ -2699,8 +2699,8 @@ int map_domain_emuirq_pirq(struct domain *d, int pirq, int emuirq)
     if ( !info )
         return -ENOMEM;
 
-    /* do not store emuirq mappings for pt devices */
-    if ( emuirq != IRQ_PT )
+    /* do not store emuirq mappings for pt devices and emulated MSIs */
+    if ( (emuirq != IRQ_PT) && (emuirq != IRQ_MSI_EMU) )
     {
         int err = radix_tree_insert(&d->arch.hvm.emuirq_pirq, emuirq,
                                     radix_tree_int_to_ptr(pirq));
@@ -2753,7 +2753,7 @@ int unmap_domain_pirq_emuirq(struct domain *d, int pirq)
         info->arch.hvm.emuirq = IRQ_UNBOUND;
         pirq_cleanup_check(info, d);
     }
-    if ( emuirq != IRQ_PT )
+    if ( (emuirq != IRQ_PT) && (emuirq != IRQ_MSI_EMU) )
         radix_tree_delete(&d->arch.hvm.emuirq_pirq, emuirq);
 
  done:
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-02 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 13:30 [PATCH] x86/irq: do not insert IRQ_MSI_EMU in emuirq mappings Xenia Ragiadakou
2023-10-31 16:33 ` Roger Pau Monné
2023-11-02  8:45   ` Jan Beulich
2023-11-02 22:19     ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.