[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/HVM: don't mark external IRQs as pending when vLAPIC is disabled


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 21 Nov 2022 13:13:15 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oUu6rnRXe9YkDTkyf1SAxdBVIm8j6LjCfjDtHIypVgQ=; b=QEdiMSilbMDD144iactQY8VIQQcSL5o9iJ13U2/uy8yuI7qhf43Hg04A0NUUvbK0yHyg/+c6BRxBt7+Vbonv1Y/+HIu/KDweVtAlt1UQD0uyXHxf8fNQfU8BMraTW6TBIP8Maz6EMPkXTxGUMHt+G5gXbDtDTiTPS/sHhhaeYBQ6k2mkC7SqBEq5jisN2j+TuGeNpV05zxh+xx96hjLfgOWwxBYn6BMYSGbZAwNaIjGPI5T4O1dMnNTYARnyMgMHrBCGakjX3/v9VAFG/idG6WCvA+wknZs/hDKmOc9WU7i6mQDQhbzmfXI1T3ONT1E57Fd02+IzCaFoTBK4mfxD1w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xkwosi6Z0eMXEUxYAT1HVXXVZ0I3/rXDfj8mmShesKfESpeEbhQ8JhrCILpFB2piVNwKyVSLeZtzuJHHL3Wt/PyyJ0dTLYCQ/gq0NcDkTlLzQW/W62LLA/TF2eB6ETCMKXjbc/sk/rjHqI4U4dzIro3f8DcC/7p+Bd6yrxIOfiR/sZ1yzRVGKx+xkV5B9WG7IUEpBqGwgvDAJe74ifb88BPAJ0JPYVa58V0wVuT3ocXc4PuM9XLB7F4tiyyr7VisGgu7m4KZc7z+K8ud/kKzBpRc501KL0EgfwRLhED967eLXv+JdIArn/HxVK1LRa3HZzuKaqQYabFEjhM/bkAxtA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 21 Nov 2022 12:13:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In software-disabled state an LAPIC does not accept any interrupt
requests and hence no IRR bit would newly become set while in this
state. As a result it is also wrong for us to mark IO-APIC or MSI
originating vectors as having a pending request when the vLAPIC is in
this state. Such interrupts are simply lost.

Introduce (IO-APIC) or re-use (MSI) a local variable to help
readability.

Fixes: 4fe21ad3712e ("This patch add virtual IOAPIC support for VMX guest")
Fixes: 85715f4bc7c9 ("MSI 5/6: add MSI support to passthrough HVM domain")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -460,9 +460,14 @@ static void vioapic_deliver(struct hvm_v
 
     case dest_Fixed:
         for_each_vcpu ( d, v )
-            if ( vlapic_match_dest(vcpu_vlapic(v), NULL, 0, dest, dest_mode) )
-                ioapic_inj_irq(vioapic, vcpu_vlapic(v), vector, trig_mode,
+        {
+            struct vlapic *vlapic = vcpu_vlapic(v);
+
+            if ( vlapic_enabled(vlapic) &&
+                 vlapic_match_dest(vlapic, NULL, 0, dest, dest_mode) )
+                ioapic_inj_irq(vioapic, vlapic, vector, trig_mode,
                                delivery_mode);
+        }
         break;
 
     case dest_NMI:
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -87,10 +87,12 @@ int vmsi_deliver(
 
     case dest_Fixed:
         for_each_vcpu ( d, v )
-            if ( vlapic_match_dest(vcpu_vlapic(v), NULL,
-                                   0, dest, dest_mode) )
-                vmsi_inj_irq(vcpu_vlapic(v), vector,
-                             trig_mode, delivery_mode);
+        {
+            target = vcpu_vlapic(v);
+            if ( vlapic_enabled(target) &&
+                 vlapic_match_dest(target, NULL, 0, dest, dest_mode) )
+                vmsi_inj_irq(target, vector, trig_mode, delivery_mode);
+        }
         break;
 
     default:



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.