All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Kevin Tian <kevin.tian@intel.com>, Ian Jackson <iwj@xenproject.org>
Subject: [PATCH 2/4][4.15?] VT-d: leave FECTL write to vtd_resume()
Date: Thu, 18 Mar 2021 11:13:57 +0100	[thread overview]
Message-ID: <57976bd9-6c50-26c3-1f06-62f1a5546e06@suse.com> (raw)
In-Reply-To: <c19fe2b5-b682-374c-d30f-83fb8b367286@suse.com>

We shouldn't blindly unmask the interrupt when resuming. vtd_resume()
will restore the intended state.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2092,7 +2092,7 @@ static int adjust_vtd_irq_affinities(voi
 }
 __initcall(adjust_vtd_irq_affinities);
 
-static int __must_check init_vtd_hw(void)
+static int __must_check init_vtd_hw(bool resume)
 {
     struct acpi_drhd_unit *drhd;
     struct vtd_iommu *iommu;
@@ -2121,6 +2121,10 @@ static int __must_check init_vtd_hw(void
             disable_qinval(iommu);
         }
 
+        if ( resume )
+            /* FECTL write done by vtd_resume(). */
+            continue;
+
         spin_lock_irqsave(&iommu->register_lock, flags);
         sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
         sts &= ~DMA_FECTL_IM;
@@ -2320,7 +2324,7 @@ static int __init vtd_setup(void)
     P(iommu_hap_pt_share, "Shared EPT tables");
 #undef P
 
-    ret = init_vtd_hw();
+    ret = init_vtd_hw(false);
     if ( ret )
         goto error;
 
@@ -2590,7 +2594,7 @@ static void vtd_resume(void)
     if ( !iommu_enabled )
         return;
 
-    if ( init_vtd_hw() != 0  && force_iommu )
+    if ( init_vtd_hw(true) != 0 && force_iommu )
          panic("IOMMU setup failed, crash Xen for security purpose\n");
 
     for_each_drhd_unit ( drhd )



  parent reply	other threads:[~2021-03-18 10:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 10:12 [PATCH 0/4][4.15?] VT-d: mostly S3 related corrections Jan Beulich
2021-03-18 10:13 ` [PATCH 1/4][4.15?] VT-d: correct off-by-1 in number-of-IOMMUs check Jan Beulich
2021-03-23 13:31   ` Ian Jackson
2021-03-18 10:13 ` Jan Beulich [this message]
2021-03-18 10:14 ` [PATCH 3/4][4.15?] VT-d: re-order register restoring in vtd_resume() Jan Beulich
2021-03-18 10:15 ` [PATCH 4/4][4.15?] VT-d: restore flush hooks when disabling qinval Jan Beulich
2021-03-23  8:12 ` [PATCH 0/4][4.15?] VT-d: mostly S3 related corrections Tian, Kevin
2021-03-23 13:27   ` Jan Beulich
2021-03-23 13:37     ` Ian Jackson
2021-03-30 12:22       ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57976bd9-6c50-26c3-1f06-62f1a5546e06@suse.com \
    --to=jbeulich@suse.com \
    --cc=iwj@xenproject.org \
    --cc=kevin.tian@intel.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.