From: Alex Williamson <alex.williamson@redhat.com>
To: linux-pci@vger.kernel.org
Cc: bhelgaas@google.com, Joerg Roedel <joro@8bytes.org>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] iommu: Move REQ_ACS_FLAGS out to header and rename
Date: Wed, 26 Oct 2016 12:01:34 -0600 [thread overview]
Message-ID: <20161026180134.23495.27520.stgit@gimli.home> (raw)
In-Reply-To: <20161026175156.23495.12980.stgit@gimli.home>
Allow other parts of the kernel to see which PCI ACS flags the IOMMU
layer considers necessary for isolation.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
---
drivers/iommu/iommu.c | 18 +++++-------------
include/linux/iommu.h | 11 +++++++++++
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index b06d935..f73e6f4 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -610,16 +610,6 @@ static struct iommu_group *get_pci_alias_group(struct pci_dev *pdev,
unsigned long *devfns);
/*
- * To consider a PCI device isolated, we require ACS to support Source
- * Validation, Request Redirection, Completer Redirection, and Upstream
- * Forwarding. This effectively means that devices cannot spoof their
- * requester ID, requests and completions cannot be redirected, and all
- * transactions are forwarded upstream, even as it passes through a
- * bridge where the target device is downstream.
- */
-#define REQ_ACS_FLAGS (PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF)
-
-/*
* For multifunction devices which are not isolated from each other, find
* all the other non-isolated functions and look for existing groups. For
* each function, we also need to look for aliases to or from other devices
@@ -631,13 +621,14 @@ static struct iommu_group *get_pci_function_alias_group(struct pci_dev *pdev,
struct pci_dev *tmp = NULL;
struct iommu_group *group;
- if (!pdev->multifunction || pci_acs_enabled(pdev, REQ_ACS_FLAGS))
+ if (!pdev->multifunction ||
+ pci_acs_enabled(pdev, IOMMU_REQ_PCI_ACS_FLAGS))
return NULL;
for_each_pci_dev(tmp) {
if (tmp == pdev || tmp->bus != pdev->bus ||
PCI_SLOT(tmp->devfn) != PCI_SLOT(pdev->devfn) ||
- pci_acs_enabled(tmp, REQ_ACS_FLAGS))
+ pci_acs_enabled(tmp, IOMMU_REQ_PCI_ACS_FLAGS))
continue;
group = get_pci_alias_group(tmp, devfns);
@@ -765,7 +756,8 @@ struct iommu_group *pci_device_group(struct device *dev)
if (!bus->self)
continue;
- if (pci_acs_path_enabled(bus->self, NULL, REQ_ACS_FLAGS))
+ if (pci_acs_path_enabled(bus->self, NULL,
+ IOMMU_REQ_PCI_ACS_FLAGS))
break;
pdev = bus->self;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a35fb8b..23f4d1d 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -131,6 +131,17 @@ struct iommu_dm_region {
int prot;
};
+/*
+ * To consider a PCI device isolated, we require ACS to support Source
+ * Validation, Request Redirection, Completer Redirection, and Upstream
+ * Forwarding. This effectively means that devices cannot spoof their
+ * requester ID, requests and completions cannot be redirected, and all
+ * transactions are forwarded upstream, even as it passes through a
+ * bridge where the target device is downstream.
+ */
+#define IOMMU_REQ_PCI_ACS_FLAGS (PCI_ACS_SV | PCI_ACS_RR | \
+ PCI_ACS_CR | PCI_ACS_UF)
+
#ifdef CONFIG_IOMMU_API
/**
next prev parent reply other threads:[~2016-10-26 18:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 18:01 [PATCH 0/5] PCI: ACS enable quirk for link balancing switches Alex Williamson
2016-10-26 18:01 ` [PATCH 1/5] PCI: Make pci_std_enable_acs() non-static Alex Williamson
2016-11-14 20:59 ` Bjorn Helgaas
2016-10-26 18:01 ` [PATCH 2/5] PCI: Extract link speed & width retrieval from pcie_get_minimum_link() Alex Williamson
2016-11-14 21:02 ` Bjorn Helgaas
2016-10-26 18:01 ` [PATCH 3/5] PCI: Extract link retraining from pcie_aspm_configure_common_clock() Alex Williamson
2016-10-26 20:42 ` Alex Williamson
2016-10-26 18:01 ` Alex Williamson [this message]
2016-11-10 12:27 ` [PATCH 4/5] iommu: Move REQ_ACS_FLAGS out to header and rename Joerg Roedel
2016-11-11 22:57 ` Bjorn Helgaas
2016-11-14 12:48 ` Joerg Roedel
2016-10-26 18:01 ` [PATCH 5/5] PCI: Balance ports to avoid ACS errata on Pericom switches Alex Williamson
2016-11-14 21:03 ` Bjorn Helgaas
2016-11-14 21:21 ` Alex Williamson
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=20161026180134.23495.27520.stgit@gimli.home \
--to=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@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).