All of lore.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, ddutile@redhat.com,
	alex.williamson@redhat.com, dyoung@redhat.com,
	linux-kernel@vger.kernel.org, jroedel@8bytes.org,
	joro@8bytes.org, Joerg Roedel <jroedel@suse.de>
Subject: [PATCH 08/19] iommu/vt-d: Allocate si_domain in init_dmars()
Date: Sat, 13 Jun 2015 08:47:16 +0200	[thread overview]
Message-ID: <1434178047-17809-9-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1434178047-17809-1-git-send-email-joro@8bytes.org>

From: Joerg Roedel <jroedel@suse.de>

This seperates the allocation of the si_domain from its
assignment to devices. It makes sure that the iommu=pt case
still works in the kdump kernel, when we have to defer the
assignment of devices to domains to device driver
initialization time.

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

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 1fdff58..bf87236 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2743,10 +2743,6 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
 	int i;
 	int ret = 0;
 
-	ret = si_domain_init(hw);
-	if (ret)
-		return -EFAULT;
-
 	for_each_pci_dev(pdev) {
 		ret = dev_prepare_static_identity_mapping(&pdev->dev, hw);
 		if (ret)
@@ -2760,7 +2756,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
 
 			if (dev->bus != &acpi_bus_type)
 				continue;
-				
+
 			adev= to_acpi_device(dev);
 			mutex_lock(&adev->physical_node_lock);
 			list_for_each_entry(pn, &adev->physical_node_list, node) {
@@ -3094,6 +3090,12 @@ static int __init init_dmars(void)
 	iommu_identity_mapping |= IDENTMAP_GFX;
 #endif
 
+	if (iommu_identity_mapping) {
+		ret = si_domain_init(hw_pass_through);
+		if (ret)
+			goto free_iommu;
+	}
+
 	check_tylersburg_isoch();
 
 	/*
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>,
	David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	jroedel-zLv9SwRftAIdnm+yROfE0A@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	zhen-hual-VXdhtT5mjnY@public.gmane.org,
	dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: [PATCH 08/19] iommu/vt-d: Allocate si_domain in init_dmars()
Date: Sat, 13 Jun 2015 08:47:16 +0200	[thread overview]
Message-ID: <1434178047-17809-9-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1434178047-17809-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>

From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>

This seperates the allocation of the si_domain from its
assignment to devices. It makes sure that the iommu=pt case
still works in the kdump kernel, when we have to defer the
assignment of devices to domains to device driver
initialization time.

Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
---
 drivers/iommu/intel-iommu.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 1fdff58..bf87236 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2743,10 +2743,6 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
 	int i;
 	int ret = 0;
 
-	ret = si_domain_init(hw);
-	if (ret)
-		return -EFAULT;
-
 	for_each_pci_dev(pdev) {
 		ret = dev_prepare_static_identity_mapping(&pdev->dev, hw);
 		if (ret)
@@ -2760,7 +2756,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
 
 			if (dev->bus != &acpi_bus_type)
 				continue;
-				
+
 			adev= to_acpi_device(dev);
 			mutex_lock(&adev->physical_node_lock);
 			list_for_each_entry(pn, &adev->physical_node_list, node) {
@@ -3094,6 +3090,12 @@ static int __init init_dmars(void)
 	iommu_identity_mapping |= IDENTMAP_GFX;
 #endif
 
+	if (iommu_identity_mapping) {
+		ret = si_domain_init(hw_pass_through);
+		if (ret)
+			goto free_iommu;
+	}
+
 	check_tylersburg_isoch();
 
 	/*
-- 
1.9.1

  parent reply	other threads:[~2015-06-13  6:50 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-13  6:47 [PATCH 00/19] Fix Intel IOMMU breakage in kdump kernel Joerg Roedel
2015-06-13  6:47 ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 01/19] iommu/vt-d: Cleanup log messages Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 02/19] iommu/vt-d: Init QI before root entry is allocated Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 03/19] iommu/vt-d: Make root entry visible for hardware right after allocation Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 04/19] iommu/vt-d: Detect pre enabled translation Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 05/19] iommu/vt-d: Copy translation tables from old kernel Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 06/19] iommu/vt-d: Do not re-use domain-ids from the " Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 07/19] iommu/vt-d: Mark copied context entries Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` Joerg Roedel [this message]
2015-06-13  6:47   ` [PATCH 08/19] iommu/vt-d: Allocate si_domain in init_dmars() Joerg Roedel
2015-06-13  6:47 ` [PATCH 09/19] iommu/vt-d: Don't do early domain assignment if kdump kernel Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 10/19] iommu/vt-d: Don't copy translation tables if RTT bit needs to be changed Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 11/19] iommu/vt-d: Don't disable translation prior to OS handover Joerg Roedel
2015-06-13  6:47 ` [PATCH 12/19] iommu/vt-d: Enable Translation only if it was previously disabled Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 13/19] iommu/vt-d: Move EIM detection to intel_prepare_irq_remapping Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 14/19] iommu/vt-d: Move QI initializationt to intel_setup_irq_remapping Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 15/19] iommu/vt-d: Disable IRQ remapping in intel_prepare_irq_remapping Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 16/19] iommu/vt-d: Set IRTA in intel_setup_irq_remapping Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 17/19] iommu/vt-d: Copy IR table from old kernel when in kdump mode Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 18/19] iommu/vt-d: Make sure copied over IR entries are not reused Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-13  6:47 ` [PATCH 19/19] iommu/vt-d: Don't disable IR when it was previously enabled Joerg Roedel
2015-06-13  6:47   ` Joerg Roedel
2015-06-23 13:31 ` [PATCH 00/19] Fix Intel IOMMU breakage in kdump kernel David Woodhouse
2015-06-23 14:06   ` Joerg Roedel
2015-06-23 14:06     ` Joerg Roedel
2015-06-23 14:38     ` David Woodhouse
2015-06-23 14:38       ` David Woodhouse
2015-06-25  6:35       ` Li, ZhenHua
2015-06-25  6:35         ` Li, ZhenHua
2015-06-25  8:06         ` David Woodhouse
2015-06-25  6:40 ` Li, ZhenHua
2015-06-25  6:40   ` Li, ZhenHua

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=1434178047-17809-9-git-send-email-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=alex.williamson@redhat.com \
    --cc=bhe@redhat.com \
    --cc=ddutile@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=dyoung@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jroedel@8bytes.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 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.