From: Tom Mingarelli <thomas.mingarelli@hp.com>
To: David Woodhouse <dwm2@infradead.org>,
Joerg Roedel <joerg.roedel@amd.com>
Cc: Tom Mingarelli <thomas.mingarelli@hp.com>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Intel IOMMU patch to reprocess RMRR info
Date: Fri, 15 Jun 2012 08:58:58 -0400 [thread overview]
Message-ID: <20120615125336.15536.69372.sendpatchset@localhost6.localdomain6> (raw)
This patch is being submitted to handle the case where a pci device is
placed into the si domain, but then removed. The RMRR information for
such devices need to be re-processed to avoid DMA Read errors due to
the Present Bit being cleared in the context entry.
----
drivers/iommu/intel-iommu.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
Signed-off-by: Tom Mingarelli <thomas.mingarelli@hp.com>
Tested-by: Tony Camuso <tony.camuso@hp.com>
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index f93d5ac..5ae57c5 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2696,6 +2696,37 @@ static int iommu_dummy(struct pci_dev *pdev)
return pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
}
+static int reprocess_rmrr(struct device *dev)
+{
+ struct dmar_rmrr_unit *rmrr;
+ struct pci_dev *pdev;
+ int i, ret;
+
+ pdev = to_pci_dev(dev);
+
+ for_each_rmrr_units(rmrr) {
+ for (i = 0; i < rmrr->devices_cnt; i++) {
+ /*
+ * Here we are just concerned with
+ * finding the one device that was
+ * removed from the si_domain and
+ * re-evaluating its RMRR info.
+ */
+ if (rmrr->devices[i] != pdev)
+ continue;
+ pr_info("%s %s\n",
+ "IOMMU: Reprocess RMRR information for device",
+ pci_name(pdev));
+ ret = iommu_prepare_rmrr_dev(rmrr, pdev);
+ if (ret)
+ pr_err("%s %s\n",
+ "IOMMU: Reprocessing RMRR reserved",
+ "region for device failed");
+ }
+ }
+ return 0;
+}
+
/* Check if the pdev needs to go through non-identity map and unmap process.*/
static int iommu_no_mapping(struct device *dev)
{
@@ -2724,6 +2755,7 @@ static int iommu_no_mapping(struct device *dev)
domain_remove_one_dev_info(si_domain, pdev);
printk(KERN_INFO "32bit %s uses non-identity mapping\n",
pci_name(pdev));
+ reprocess_rmrr(dev);
return 0;
}
} else {
reply other threads:[~2012-06-15 12:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20120615125336.15536.69372.sendpatchset@localhost6.localdomain6 \
--to=thomas.mingarelli@hp.com \
--cc=dwm2@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joerg.roedel@amd.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).