public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: iommu@lists.linux-foundation.org
Cc: David Woodhouse <dwmw2@infradead.org>,
	zhen-hual@hp.com, bhe@redhat.com, linux-kernel@vger.kernel.org,
	Joerg Roedel <jroedel@suse.de>
Subject: [PATCH 3/4] iommu/vt-d: Remove unmap_device_dma()
Date: Thu, 11 Jun 2015 15:47:42 +0200	[thread overview]
Message-ID: <1434030463-942-4-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1434030463-942-1-git-send-email-joro@8bytes.org>

From: Joerg Roedel <jroedel@suse.de>

This removes the unmap_device_dma() function and the
code-path calling it. That code looks like a left-over from
Bill Sumners patch-set, as it only makes sense when kdump
recovery is implemented like in his original patch-set.

With the way it is implemented now this code doesn't make
sense at all and can be removed.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/intel-iommu.c | 44 --------------------------------------------
 1 file changed, 44 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index f50d065..fcb9310 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -400,9 +400,6 @@ static LIST_HEAD(__iommu_remapped_mem);
  */
 static int intel_iommu_load_translation_tables(struct intel_iommu *iommu);
 
-static void unmap_device_dma(struct dmar_domain *domain,
-				struct device *dev,
-				struct intel_iommu *iommu);
 static void iommu_check_pre_te_status(struct intel_iommu *iommu);
 static u8 g_translation_pre_enabled;
 
@@ -3120,25 +3117,6 @@ static struct dmar_domain *__get_valid_domain_for_dev(struct device *dev)
 		return NULL;
 	}
 
-	/* if in kdump kernel, we need to unmap the mapped dma pages,
-	 * detach this device first.
-	 */
-	if (likely(domain_context_mapped(dev))) {
-		iommu = domain_get_iommu(domain);
-		if (iommu->pre_enabled_trans) {
-			unmap_device_dma(domain, dev, iommu);
-
-			domain = get_domain_for_dev(dev,
-				DEFAULT_DOMAIN_ADDRESS_WIDTH);
-			if (!domain) {
-				pr_err("Allocating domain for %s failed",
-				       dev_name(dev));
-				return NULL;
-			}
-		} else
-			return domain;
-	}
-
 	ret = domain_context_mapping(domain, dev, CONTEXT_TT_MULTI_LEVEL);
 	if (ret) {
 		pr_err("Domain context map for %s failed",
@@ -5063,28 +5041,6 @@ out_unmap:
 	return ret;
 }
 
-static void unmap_device_dma(struct dmar_domain *domain,
-				struct device *dev,
-				struct intel_iommu *iommu)
-{
-	struct context_entry *ce;
-	struct iova *iova;
-	phys_addr_t phys_addr;
-	dma_addr_t dev_addr;
-	struct pci_dev *pdev;
-
-	pdev = to_pci_dev(dev);
-	ce = iommu_context_addr(iommu, pdev->bus->number, pdev->devfn, 1);
-	phys_addr = context_address_root(ce) << VTD_PAGE_SHIFT;
-	dev_addr = phys_to_dma(dev, phys_addr);
-
-	iova = find_iova(&domain->iovad, IOVA_PFN(dev_addr));
-	if (iova)
-		intel_unmap(dev, dev_addr);
-
-	domain_remove_one_dev_info(domain, dev);
-}
-
 static void iommu_check_pre_te_status(struct intel_iommu *iommu)
 {
 	u32 sts;
-- 
1.9.1


  parent reply	other threads:[~2015-06-11 13:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 13:47 [PATCH 0/4] More cleanups and fixes for Intel VT-d Joerg Roedel
2015-06-11 13:47 ` [PATCH 1/4] iommu/vt-d: Remove iommu_attach_domain_with_id() Joerg Roedel
2015-06-11 13:47 ` [PATCH 2/4] iommu/vt-d: Don't consider copied context entries as present Joerg Roedel
2015-06-11 14:07   ` David Woodhouse
2015-06-11 14:12     ` Joerg Roedel
2015-06-11 14:19       ` David Woodhouse
2015-06-11 14:25     ` Joerg Roedel
2015-06-11 14:44       ` David Woodhouse
2015-06-11 15:12         ` David Woodhouse
2015-06-11 14:51       ` Joerg Roedel
2015-06-11 13:47 ` Joerg Roedel [this message]
2015-06-11 13:47 ` [PATCH 4/4] iommu/vt-d: Make sure si_domain is allocated for kdump kernel Joerg Roedel
2015-06-11 15:54 ` [PATCH 0/4] More cleanups and fixes for Intel VT-d David Woodhouse
2015-06-12  7:31   ` Joerg Roedel
2015-06-12 20:29   ` Joerg Roedel

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=1434030463-942-4-git-send-email-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=bhe@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhen-hual@hp.com \
    /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