From: David Woodhouse <David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: [PATCH 09/33] iommu/vt-d: Pass iommu to domain_context_mapping_one() and iommu_support_dev_iotlb()
Date: Fri, 21 Mar 2014 17:18:50 +0000 [thread overview]
Message-ID: <1395422354-19762-10-git-send-email-David.Woodhouse@intel.com> (raw)
In-Reply-To: <1395422354-19762-1-git-send-email-David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: David Woodhouse <David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/iommu/intel-iommu.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index ccef436..1ab7c18 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1240,13 +1240,13 @@ static void __iommu_flush_iotlb(struct intel_iommu *iommu, u16 did,
(unsigned long long)DMA_TLB_IAIG(val));
}
-static struct device_domain_info *iommu_support_dev_iotlb(
- struct dmar_domain *domain, int segment, u8 bus, u8 devfn)
+static struct device_domain_info *
+iommu_support_dev_iotlb (struct dmar_domain *domain, struct intel_iommu *iommu,
+ u8 bus, u8 devfn)
{
int found = 0;
unsigned long flags;
struct device_domain_info *info;
- struct intel_iommu *iommu = device_to_iommu(segment, bus, devfn);
struct pci_dev *pdev;
if (!ecap_dev_iotlb_support(iommu->ecap))
@@ -1700,12 +1700,12 @@ static void domain_exit(struct dmar_domain *domain)
free_domain_mem(domain);
}
-static int domain_context_mapping_one(struct dmar_domain *domain, int segment,
- u8 bus, u8 devfn, int translation)
+static int domain_context_mapping_one(struct dmar_domain *domain,
+ struct intel_iommu *iommu,
+ u8 bus, u8 devfn, int translation)
{
struct context_entry *context;
unsigned long flags;
- struct intel_iommu *iommu;
struct dma_pte *pgd;
unsigned long num;
unsigned long ndomains;
@@ -1720,10 +1720,6 @@ static int domain_context_mapping_one(struct dmar_domain *domain, int segment,
BUG_ON(translation != CONTEXT_TT_PASS_THROUGH &&
translation != CONTEXT_TT_MULTI_LEVEL);
- iommu = device_to_iommu(segment, bus, devfn);
- if (!iommu)
- return -ENODEV;
-
context = device_to_context_entry(iommu, bus, devfn);
if (!context)
return -ENOMEM;
@@ -1781,7 +1777,7 @@ static int domain_context_mapping_one(struct dmar_domain *domain, int segment,
context_set_domain_id(context, id);
if (translation != CONTEXT_TT_PASS_THROUGH) {
- info = iommu_support_dev_iotlb(domain, segment, bus, devfn);
+ info = iommu_support_dev_iotlb(domain, iommu, bus, devfn);
translation = info ? CONTEXT_TT_DEV_IOTLB :
CONTEXT_TT_MULTI_LEVEL;
}
@@ -1836,8 +1832,14 @@ domain_context_mapping(struct dmar_domain *domain, struct pci_dev *pdev,
{
int ret;
struct pci_dev *tmp, *parent;
+ struct intel_iommu *iommu;
+
+ iommu = device_to_iommu(pci_domain_nr(pdev->bus), pdev->bus->number,
+ pdev->devfn);
+ if (!iommu)
+ return -ENODEV;
- ret = domain_context_mapping_one(domain, pci_domain_nr(pdev->bus),
+ ret = domain_context_mapping_one(domain, iommu,
pdev->bus->number, pdev->devfn,
translation);
if (ret)
@@ -1850,8 +1852,7 @@ domain_context_mapping(struct dmar_domain *domain, struct pci_dev *pdev,
/* Secondary interface's bus number and devfn 0 */
parent = pdev->bus->self;
while (parent != tmp) {
- ret = domain_context_mapping_one(domain,
- pci_domain_nr(parent->bus),
+ ret = domain_context_mapping_one(domain, iommu,
parent->bus->number,
parent->devfn, translation);
if (ret)
@@ -1859,13 +1860,11 @@ domain_context_mapping(struct dmar_domain *domain, struct pci_dev *pdev,
parent = parent->bus->self;
}
if (pci_is_pcie(tmp)) /* this is a PCIe-to-PCI bridge */
- return domain_context_mapping_one(domain,
- pci_domain_nr(tmp->subordinate),
+ return domain_context_mapping_one(domain, iommu,
tmp->subordinate->number, 0,
translation);
else /* this is a legacy PCI bridge */
- return domain_context_mapping_one(domain,
- pci_domain_nr(tmp->bus),
+ return domain_context_mapping_one(domain, iommu,
tmp->bus->number,
tmp->devfn,
translation);
--
1.8.5.3
next prev parent reply other threads:[~2014-03-21 17:18 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 17:18 [PATCH 00/33] iommu/vt-d: Add support for DMA mapping of ACPI-enumerated devices David Woodhouse
[not found] ` <1395422354-19762-1-git-send-email-David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-03-21 17:18 ` [PATCH 01/33] iommu/vt-d: Add ACPI namespace device reporting structures David Woodhouse
2014-03-21 17:18 ` [PATCH 02/33] iommu/vt-d: Parse ANDD records David Woodhouse
2014-03-21 17:18 ` [PATCH 03/33] iommu/vt-d: Allocate space for ACPI devices David Woodhouse
2014-03-21 17:18 ` [PATCH 04/33] iommu/vt-d: Change scope lists to struct device, bus, devfn David Woodhouse
2014-03-21 17:18 ` [PATCH 05/33] iommu/vt-d: Add ACPI devices into dmaru->devices[] array David Woodhouse
[not found] ` <1395422354-19762-6-git-send-email-David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-03-25 19:30 ` [PATCH] iommu/vt-d: Check for NULL pointer in dmar_acpi_dev_scope_init() array Joerg Roedel
[not found] ` <20140325193015.GI13491-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-03-26 9:16 ` Woodhouse, David
2014-03-21 17:18 ` [PATCH 06/33] iommu/vt-d: Make iommu_dummy() take struct device instead of struct pci_dev David Woodhouse
2014-03-21 17:18 ` [PATCH 07/33] iommu/vt-d: Make dmar_insert_dev_info() " David Woodhouse
2014-03-21 17:18 ` [PATCH 08/33] iommu/vt-d: Use struct device in device_domain_info, not " David Woodhouse
2014-03-21 17:18 ` David Woodhouse [this message]
2014-03-21 17:18 ` [PATCH 10/33] iommu/vt-d: Stop dmar_insert_dev_info() freeing domains on losing race David Woodhouse
2014-03-21 17:18 ` [PATCH 11/33] iommu/vt-d: use dmar_insert_dev_info() from dma_add_dev_info() David Woodhouse
2014-03-21 17:18 ` [PATCH 12/33] iommu/vt-d: Use domain_remove_one_dev_info() in domain_add_dev_info() error path David Woodhouse
2014-03-21 17:18 ` [PATCH 13/33] iommu/vt-d: Always store iommu in device_domain_info David Woodhouse
2014-03-21 17:18 ` [PATCH 14/33] iommu/vt-d: Simplify iommu check in domain_remove_one_dev_info() David Woodhouse
2014-03-21 17:18 ` [PATCH 15/33] iommu/vt-d: Remove device_to_iommu() call from domain_remove_dev_info() David Woodhouse
2014-03-21 17:18 ` [PATCH 16/33] iommu/vt-d: Store PCI segment number in struct intel_iommu David Woodhouse
2014-03-21 17:18 ` [PATCH 17/33] iommu/vt-d: Remove segment from struct device_domain_info() David Woodhouse
2014-03-21 17:18 ` [PATCH 18/33] iommu/vt-d: Make identity_mapping() take struct device not struct pci_dev David Woodhouse
2014-03-21 17:19 ` [PATCH 19/33] iommu/vt-d: Make device_to_iommu() cope with non-PCI devices David Woodhouse
2014-03-21 17:19 ` [PATCH 20/33] iommu/vt-d: Make domain_context_mapp{ed, ing}() take struct device David Woodhouse
2014-03-21 17:19 ` [PATCH 21/33] iommu/vt-d: Make get_domain_for_dev() " David Woodhouse
[not found] ` <1395422354-19762-22-git-send-email-David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-14 21:22 ` Alex Williamson
[not found] ` <1397510541.3060.15.camel-85EaTFmN5p//9pzu0YdTqQ@public.gmane.org>
2014-04-14 21:40 ` Woodhouse, David
[not found] ` <1397511643.19944.217.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2014-04-14 21:52 ` Alex Williamson
2014-03-21 17:19 ` [PATCH 22/33] iommu/vt-d: Handle RMRRs for non-PCI devices David Woodhouse
2014-03-21 17:19 ` [PATCH 23/33] iommu/vt-d: Make iommu_should_identity_map() take struct device David Woodhouse
2014-03-21 17:19 ` [PATCH 24/33] iommu/vt-d: Make get_valid_domain_for_dev() " David Woodhouse
2014-03-21 17:19 ` [PATCH 25/33] iommu/vt-d: Remove some pointless to_pci_dev() calls David Woodhouse
2014-03-21 17:19 ` [PATCH 26/33] iommu/vt-d: Rename 'hwdev' variables to 'dev' now that that's the norm David Woodhouse
2014-03-21 17:19 ` [PATCH 27/33] iommu/vt-d: Make domain_remove_one_dev_info() take struct device David Woodhouse
2014-03-21 17:19 ` [PATCH 28/33] iommu/vt-d: Make domain_add_dev_info() " David Woodhouse
2014-03-21 17:19 ` [PATCH 29/33] iommu/vt-d: Remove pdev from iommu_no_mapping() David Woodhouse
2014-03-21 17:19 ` [PATCH 30/33] iommu/vt-d: Remove pdev from intel_iommu_attach_device() David Woodhouse
2014-03-21 17:19 ` [PATCH 31/33] iommu/vt-d: Remove to_pci_dev() in intel_map_page() David Woodhouse
2014-03-21 17:19 ` [PATCH 32/33] iommu/vt-d: Finally enable translation for non-PCI devices David Woodhouse
2014-03-21 17:19 ` [PATCH 33/33] iommu/vt-d: Include ACPI devices in iommu=pt David Woodhouse
2014-03-24 13:52 ` [PATCH 34/33] iommu/vt-d: Fix RCU annotations on device scope lists Woodhouse, David
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=1395422354-19762-10-git-send-email-David.Woodhouse@intel.com \
--to=david.woodhouse-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.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).