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

[PATCH v3 2/6] x86/vioapic: issue EOI to dpci when switching pin to edge trigger mode


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Tue, 26 Jan 2021 14:45:17 +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=6Nf2vo0SRD3R2LaShoNNJNHs097bPQ8mcbsO7gxjiRM=; b=UALr/fRrhEec5S8nu7t08noFFXKDh7LN20g1hhlT7eXbhW0Fo7hg2gO4hFJd6hTNZRmYKvNOZbcMbYt/5nyJ+FwrSoJ5fF9L6SfhCPX/s4y4VQYRr9N8sTMHwvu/+2N4Nr3YMVHm1boDEGwd+ecsajgNkP+UP8V+jInvs4H5E45prVMOdM1WVs9spbYiDslceKUsAYnXh2+IK9aaqGpxgWJaX+/ZTgfI/yOtO/oOiLr08eeCB9KIC7bRQClNMnwT0czAouSRHjQUmUDw7n3BfiMMlhJBCM6gnYeY5ryRSIo3AuL0OQu5gv3njCpSuWpvQPYfunXHINCStSdl48TzEg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Alt0/j4ju1hiCWivRDHqubxRIHiItxRG4vPt1wwwflZ5oOse6UnaosA3YGQfRvJaEOvi+3NmUMfjrA/uxvYzLTZl19TAreEqbeQ6RCrWgxd1VNBoJQWwWjDr/cVYldRi6JivmaPnI6HiyS9bsqCJq/5cOX5z7zm0xMP5ZR3ZcDVfQgnI2jA+qQ53r102qtf+9QK8h3gGngzdpYrbXWkzwEBHuVrt9V2tqZDAfovvDT1Eh0PwPTYI5uGtnW/gb6lUl2xW5SUTS5xhtAZnhMm85om9DrhSwsvYinsbIVOmc0PZbjCrwvRLL3Vk9j1V0Q3eEsQXPsq3mBiM4VNvnWREMw==
  • Authentication-results: esa1.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:17 +0000
  • Ironport-sdr: 1I1o0MRHHmIo27T7CpFCM+kxvb78QkbOvVEv0KemKdjD9Wn7Gb1CIegeGvVNoHiyx62POk+w31 FvZP/TDjU57yAT26Ub6bYm17yadl8z4oS7sVYCAZAZA+gS/0PGaWzkj0Cl3s/d7km6KMiW/kf8 Sm9DikMw6oiWy1Mhn8uIhdbkJT7+xZVwFII+1SPJVUx1T06VL4SHuG2Qq0nR628fWWqPlYgYsu XvHErenOspk0fyYJ8hWqfyvYJCziX8NyPuDC8KjVw7qFmxeVlaF2uPhNUNQSyX9S9zFgZWOTnU uYI=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

When an IO-APIC pin is switched from level to edge trigger mode the
IRR bit is cleared, so it can be used as a way to EOI an interrupt at
the IO-APIC level.

Such EOI however does not get forwarded to the dpci code like it's
done for the local APIC initiated EOI. This change adds the code in
order to notify dpci of such EOI, so that dpci and the interrupt
controller are in sync.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Changes since v2:
 - Fix comment message missing 'edge'.
 - Add asserts that previous triggering mode was level and it's not a
   top word write.
---
 xen/arch/x86/hvm/vioapic.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
index e3ee747b7d..87370dd417 100644
--- a/xen/arch/x86/hvm/vioapic.c
+++ b/xen/arch/x86/hvm/vioapic.c
@@ -219,6 +219,7 @@ static void vioapic_write_redirent(
     struct domain *d = vioapic_domain(vioapic);
     struct hvm_irq *hvm_irq = hvm_domain_irq(d);
     union vioapic_redir_entry *pent, ent;
+    bool prev_level;
     int unmasked = 0;
     unsigned int gsi;
 
@@ -234,6 +235,7 @@ static void vioapic_write_redirent(
 
     pent = &vioapic->redirtbl[idx];
     ent  = *pent;
+    prev_level = ent.fields.trig_mode == VIOAPIC_LEVEL_TRIG;
 
     if ( top_word )
     {
@@ -270,6 +272,21 @@ static void vioapic_write_redirent(
 
     spin_unlock(&d->arch.hvm.irq_lock);
 
+    if ( ent.fields.trig_mode == VIOAPIC_EDGE_TRIG &&
+         ent.fields.remote_irr && is_iommu_enabled(d) )
+    {
+            /*
+             * Since IRR has been cleared and further interrupts can be
+             * injected also attempt to deassert any virtual line of passed
+             * through devices using this pin. Switching a pin from level to
+             * edge trigger mode can be used as a way to EOI an interrupt at
+             * the IO-APIC level.
+             */
+            ASSERT(prev_level);
+            ASSERT(!top_word);
+            hvm_dpci_eoi(d, gsi);
+    }
+
     if ( is_hardware_domain(d) && unmasked )
     {
         /*
-- 
2.29.2




 


Rackspace

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