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

[PATCH v2 3/4] x86/vpic: issue dpci EOI for cleared pins at ICW1


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Fri, 15 Jan 2021 15:28:19 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-SenderADCheck; bh=Gb2pmxF+aMeLd7tJRs/LNeeBQ4qY8d0Asrdtw+zUKBA=; b=Cr70kmjG582tbpMVct/gX6HsutZuMNN2mD0HIjxzsyT0Er3Pbc04UO2xaMD6TKd6x6gtWhY1f6k6AXoroCLlQ3l08PMMWCOpaEs8yGCXiKxVJjfYbXAUACsyb93pSvcPZq8oXAJPyuuT/ZstEELwiCQusnk3+nCW3kzk/SwzRw4vqAkjPQyGM47KlBbWimFV4G/0Z+ZZfnIhPvs+FZNfmJE9vTQkB7p2E75pmWf1qhI4au4tk1pH/of3TNCxz1w2BbwUzuqlWhZTACIy0jaSg4Gy268HWtzlc+e5pAeaLD1qp1+AVAIEITsCNoCIFBxeawzQu0OOcHD7OZyLqSq+WQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VgkxYW4Pz86SXB29q3ZLvpd4f7Ol50XI1y3f4fr7tQMbXyAxS1rmhMwKU5dIL3aBSakGYQ9njegJLHT0rxXwAGbpYpKJ+/Qbax/OPs7ym+ArcfDL+cJGzZJ0fxpEFE7SOQlFqIA1w9pqzrwKMU7VuH7l7LVh7bB2o8eh13LZFfMbHCVqr9GrooL1Ab3b9QRcyqK6sEvUESUMS7O5xM6GLF7eavR/sj6qQow4IHBVnLgIb4xT/P1lXKuaXFjJDrK+3Ehhd25qBDoVhqGoT8l2y8Br0i9p3+wYVrTB5vLGb6La/tU+Oaz6UCsOMxADTAJvlqBFoBLh7F7q9Of9KfoEMw==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 15 Jan 2021 14:29:13 +0000
  • Ironport-sdr: SGmcXL20sqmwaljJqK9smOwOKgZubMQtc4xZk0j9WUcjIZ7h5U/KJH+M/Ox5V8jgQwB2NHwKtu NK9mLMO1Q5WR7Z2EbJLpSa/HPISVXYHxSXwFaCAGZ+rYQy9t8fXM/SqMJy+XoX6DKDogy0ga4R pgNdPGtKEL/bFC5aXjry4D0Mz5U6U07WsLthw+ZfinLjHw5vDRE4OvjIV9tc2DMywdqau1fdx/ wvwX6YSNIhZOTO3yjb2LLeHovFoJaS8RJvG7Sqj7dxAA1SKyDZq0uHvopjuagDMn9gUlvMImNx ZCY=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When pins are cleared from either ISR or IRR as part of the
initialization sequence forward the clearing of those pins to the dpci
EOI handler, as it is equivalent to an EOI. Not doing so can bring the
interrupt controller state out of sync with the dpci handling logic,
that expects a notification when a pin has been EOI'ed.

Fixes: 7b3cb5e5416 ('IRQ injection changes for HVM PCI passthru.')
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vpic.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index c1c1de7fd0..522cacdc4b 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -193,6 +193,8 @@ static void vpic_ioport_write(
     {
         if ( val & 0x10 )
         {
+            unsigned int pending = vpic->isr | (vpic->irr & ~vpic->elcr);
+
             /* ICW1 */
             /* Clear edge-sensing logic. */
             vpic->irr &= vpic->elcr;
@@ -217,6 +219,24 @@ static void vpic_ioport_write(
             }
 
             vpic->init_state = ((val & 3) << 2) | 1;
+            vpic_update_int_output(vpic);
+            vpic_unlock(vpic);
+
+            /*
+             * Forward the EOI of any pending or in service interrupt that has
+             * been cleared from IRR or ISR, or else the dpci logic will get
+             * out of sync with the state of the interrupt controller.
+             */
+            while ( pending )
+            {
+                unsigned int pin = __scanbit(pending, 8);
+
+                ASSERT(pin < 8);
+                hvm_dpci_eoi(current->domain,
+                             hvm_isa_irq_to_gsi((addr >> 7) ? (pin | 8) : 
pin));
+                __clear_bit(pin, &pending);
+            }
+            goto unmask;
         }
         else if ( val & 0x08 )
         {
@@ -306,6 +326,7 @@ static void vpic_ioport_write(
 
     vpic_unlock(vpic);
 
+ unmask:
     if ( unmasked )
         pt_may_unmask_irq(vpic_domain(vpic), NULL);
 }
-- 
2.29.2




 


Rackspace

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