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

[PATCH v3 5/6] x86/vpic: issue dpci EOI for cleared pins at ICW1


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Tue, 26 Jan 2021 14:45:20 +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=H/2YxvgG6p6cjj2vAugUvonXsKtSjBfUQcfmm0qKKj0=; b=GeZNcg3nCiqc7MjMxuNF5uHh5e0NTokEGboMLBVIJeTgqvv0qig+K6EoXNYtYs4OpcmuhMXbmB7K3UsShVEooqA9meKRFtSid+rGTfg2ZccYxrSGV6lnu1ntkgooETYBLTU/7PqeVttnbvP+I1Kf6gOe4o5nDik3at9Cw35bRpUGBIJI2xIgyAWn3d+gviC/mrgvOBi2xCEgfkc5esADu4Qk0t+xTzPkqJXG1CiwBKiyF1gTIS2PZaCwD7czH12I790j8OXco2GkSlZxZFssUPsYQk/5FzhwusCX31fXFAiQ4AxEzYMqie/1XfDLnL5uS/KK7nz6QU62PQPtzlxYaA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eiBi/si0raOzLF8LpSiwHVd4D9QJSCS3dnZKzoJvO3m3YSYqT4UWayW2NjpR6o5bl6oO2/ZTz3cK95gzD5jxE2Ntktq2DQH7xiyEXeTJ4cX96POhsO7rd9DeJpHjMPFqbaGX0kQZuQWUxy4/Lh7XMLAeFUDBExlUJJasbJR+6K6RMGE68ZIs6roPM4Pe64TfMveDccnuuVRIEbb0zTKJorPkPf0nbzoBk87Iu3sVfPJm+anJywM1l7DxY/E0vufIFbI5Mi62DnVX7cpFbdJ2Axsg2T4YvmkE8G0nV63Bo9Jt7zcKQ1doRE0WYdPjIvZa1erVI45zg9YEVhFJCrJ26Q==
  • Authentication-results: esa5.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: Tue, 26 Jan 2021 13:46:35 +0000
  • Ironport-sdr: bPRthZlSwnuU+7vlFLpn7h8vnrNhWd303H2gOghQaR9vhrNR1p5rttKr+y5OLvQSEhSyeywj+f F1L5Ozf9sVfN86fsQGfFBQGC28MwBeUl37LHxuTAw33FF3RUgOBE35GQVdkgusO3yMj3ZNPnl3 IMoAnFvFJPNm/VluF/RgLsrOwN1b6NnY4YLmiB5IkyJge3mnAevxZmgrFJP6OPJtAkFvbOVjf8 Ws/LAjde5dTu4H3X87uk/MdM3sE78J3V/lHKYm03XvTtAaSX8zpbRIx6wop0UreXny1+BENOyl Gjo=
  • 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>
---
Changes since v2:
 - Remove the unmask label.
---
 xen/arch/x86/hvm/vpic.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index 795a76768d..f465b7f997 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -197,6 +197,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;
@@ -220,6 +222,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);
+            }
+            return;
         }
         else if ( val & 0x08 )
         {
-- 
2.29.2




 


Rackspace

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