Linux IOMMU Development
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
To: linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux-foundation.org
Cc: bhelgaas@google.com, robh+dt@kernel.org, mark.rutland@arm.com,
	lorenzo.pieralisi@arm.com, hanjun.guo@linaro.org,
	sudeep.holla@arm.com, rjw@rjwysocki.net, lenb@kernel.org,
	will.deacon@arm.com, robin.murphy@arm.com, joro@8bytes.org,
	okaya@codeaurora.org, sunil.kovvuri@gmail.com,
	thunder.leizhen@huawei.com, tn@semihalf.com
Subject: [PATCH 3/7] iommu/of: Check ATS capability in root complex nodes
Date: Wed, 24 May 2017 19:01:39 +0100	[thread overview]
Message-ID: <20170524180143.19855-4-jean-philippe.brucker@arm.com> (raw)
In-Reply-To: <20170524180143.19855-1-jean-philippe.brucker@arm.com>

The PCI root complex node in DT has a property indicating whether it
supports ATS. Store this bit in the IOMMU fwspec when initializing a
device, so it can be accessed later by an IOMMU driver.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
---
 drivers/iommu/of_iommu.c | 8 ++++++++
 include/linux/iommu.h    | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index 9f44ee8ea1bc..3d8168e80634 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -147,6 +147,11 @@ static int __get_pci_rid(struct pci_dev *pdev, u16 alias, void *data)
 	return iommu_spec->np == pdev->bus->dev.of_node;
 }
 
+static bool of_pci_rc_supports_ats(struct device_node *rc_node)
+{
+	return of_property_read_bool(rc_node, "ats-supported");
+}
+
 static const struct iommu_ops
 *of_pci_iommu_init(struct pci_dev *pdev, struct device_node *bridge_np)
 {
@@ -175,6 +180,9 @@ static const struct iommu_ops
 
 	ops = of_iommu_xlate(&pdev->dev, &iommu_spec);
 
+	if (!IS_ERR_OR_NULL(ops) && of_pci_rc_supports_ats(bridge_np))
+		pdev->dev.iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_SUPPORTS_ATS;
+
 	of_node_put(iommu_spec.np);
 	return ops;
 }
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 2cb54adc4a33..206821b9044c 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -360,6 +360,7 @@ extern struct iommu_group *generic_device_group(struct device *dev);
  * @ops: ops for this device's IOMMU
  * @iommu_fwnode: firmware handle for this device's IOMMU
  * @iommu_priv: IOMMU driver private data for this device
+ * @flags: miscellaneous properties for this device
  * @num_ids: number of associated device IDs
  * @ids: IDs which this device may present to the IOMMU
  */
@@ -367,10 +368,13 @@ struct iommu_fwspec {
 	const struct iommu_ops	*ops;
 	struct fwnode_handle	*iommu_fwnode;
 	void			*iommu_priv;
+	u32			flags;
 	unsigned int		num_ids;
 	u32			ids[1];
 };
 
+#define IOMMU_FWSPEC_PCI_RC_SUPPORTS_ATS		(1 << 0)
+
 int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode,
 		      const struct iommu_ops *ops);
 void iommu_fwspec_free(struct device *dev);
-- 
2.12.1


  parent reply	other threads:[~2017-05-24 18:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 18:01 [PATCH 0/7] Add PCI ATS support to SMMUv3 Jean-Philippe Brucker
2017-05-24 18:01 ` [PATCH 1/7] PCI: Move ATS declarations outside of CONFIG_PCI Jean-Philippe Brucker
2017-05-24 18:01 ` Jean-Philippe Brucker [this message]
     [not found] ` <20170524180143.19855-1-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2017-05-24 18:01   ` [PATCH 2/7] dt-bindings: PCI: Describe ATS property for root complex nodes Jean-Philippe Brucker
2017-05-30 10:01     ` Joerg Roedel
2017-05-30 10:58       ` Jean-Philippe Brucker
     [not found]         ` <035be7ba-e850-a5a9-08fa-802a04feb600-5wv7dgnIgG8@public.gmane.org>
2017-05-31 17:17           ` Rob Herring
     [not found]     ` <20170524180143.19855-3-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2017-05-31 17:23       ` Rob Herring
2017-06-01 12:28         ` Jean-Philippe Brucker
2017-06-05 17:20           ` Rob Herring
2017-06-06 11:11             ` Jean-Philippe Brucker
     [not found]               ` <65aea93f-d516-f045-f216-3f56e96bdeb6-5wv7dgnIgG8@public.gmane.org>
2017-06-20 11:38                 ` Jean-Philippe Brucker
2017-05-24 18:01   ` [PATCH 4/7] ACPI/IORT: Check ATS capability in " Jean-Philippe Brucker
2017-05-24 18:01   ` [PATCH 5/7] iommu/arm-smmu-v3: Link domains and devices Jean-Philippe Brucker
2017-05-24 18:01   ` [PATCH 6/7] iommu/arm-smmu-v3: Add support for PCI ATS Jean-Philippe Brucker
     [not found]     ` <20170524180143.19855-7-jean-philippe.brucker-5wv7dgnIgG8@public.gmane.org>
2017-05-30 10:28       ` Joerg Roedel
2017-05-30 10:58         ` Jean-Philippe Brucker
2017-05-24 18:01   ` [PATCH 7/7] iommu/arm-smmu-v3: Disable tagged pointers Jean-Philippe Brucker
2017-05-31 15:27   ` [PATCH 0/7] Add PCI ATS support to SMMUv3 Nate Watterson
2017-06-01 12:23     ` Jean-Philippe Brucker

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=20170524180143.19855-4-jean-philippe.brucker@arm.com \
    --to=jean-philippe.brucker@arm.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hanjun.guo@linaro.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=okaya@codeaurora.org \
    --cc=rjw@rjwysocki.net \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sudeep.holla@arm.com \
    --cc=sunil.kovvuri@gmail.com \
    --cc=thunder.leizhen@huawei.com \
    --cc=tn@semihalf.com \
    --cc=will.deacon@arm.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