All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Will Deacon <will-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: [RFC 1/2] iommu: arm-smmu: Extract arm_smmu_of_parse()
Date: Mon,  9 Dec 2019 16:07:47 +0100	[thread overview]
Message-ID: <20191209150748.2471814-2-thierry.reding@gmail.com> (raw)
In-Reply-To: <20191209150748.2471814-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

This function will be subsequently used to extract stream ID information
early, before a struct device is available.

Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/iommu/arm-smmu.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index d1aef07bb784..5c5cf942077e 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1545,18 +1545,28 @@ static int arm_smmu_domain_set_attr(struct iommu_domain *domain,
 	return ret;
 }
 
-static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
+static u32 arm_smmu_of_parse(struct device_node *np, const u32 *args,
+			     unsigned int count)
 {
-	u32 mask, fwid = 0;
+	u32 fwid = 0, mask;
 
-	if (args->args_count > 0)
-		fwid |= FIELD_PREP(SMR_ID, args->args[0]);
+	if (count > 0)
+		fwid |= FIELD_PREP(SMR_ID, args[0]);
 
-	if (args->args_count > 1)
-		fwid |= FIELD_PREP(SMR_MASK, args->args[1]);
-	else if (!of_property_read_u32(args->np, "stream-match-mask", &mask))
+	if (count > 1)
+		fwid |= FIELD_PREP(SMR_MASK, args[1]);
+	else if (!of_property_read_u32(np, "stream-match-mask", &mask))
 		fwid |= FIELD_PREP(SMR_MASK, mask);
 
+	return fwid;
+}
+
+static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
+{
+	u32 fwid;
+
+	fwid = arm_smmu_of_parse(args->np, args->args, args->args_count);
+
 	return iommu_fwspec_add_ids(dev, &fwid, 1);
 }
 
-- 
2.23.0

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: linux-tegra@vger.kernel.org, Robin Murphy <robin.murphy@arm.com>,
	iommu@lists.linux-foundation.org, Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [RFC 1/2] iommu: arm-smmu: Extract arm_smmu_of_parse()
Date: Mon,  9 Dec 2019 16:07:47 +0100	[thread overview]
Message-ID: <20191209150748.2471814-2-thierry.reding@gmail.com> (raw)
In-Reply-To: <20191209150748.2471814-1-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

This function will be subsequently used to extract stream ID information
early, before a struct device is available.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/iommu/arm-smmu.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index d1aef07bb784..5c5cf942077e 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1545,18 +1545,28 @@ static int arm_smmu_domain_set_attr(struct iommu_domain *domain,
 	return ret;
 }
 
-static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
+static u32 arm_smmu_of_parse(struct device_node *np, const u32 *args,
+			     unsigned int count)
 {
-	u32 mask, fwid = 0;
+	u32 fwid = 0, mask;
 
-	if (args->args_count > 0)
-		fwid |= FIELD_PREP(SMR_ID, args->args[0]);
+	if (count > 0)
+		fwid |= FIELD_PREP(SMR_ID, args[0]);
 
-	if (args->args_count > 1)
-		fwid |= FIELD_PREP(SMR_MASK, args->args[1]);
-	else if (!of_property_read_u32(args->np, "stream-match-mask", &mask))
+	if (count > 1)
+		fwid |= FIELD_PREP(SMR_MASK, args[1]);
+	else if (!of_property_read_u32(np, "stream-match-mask", &mask))
 		fwid |= FIELD_PREP(SMR_MASK, mask);
 
+	return fwid;
+}
+
+static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
+{
+	u32 fwid;
+
+	fwid = arm_smmu_of_parse(args->np, args->args, args->args_count);
+
 	return iommu_fwspec_add_ids(dev, &fwid, 1);
 }
 
-- 
2.23.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: linux-tegra@vger.kernel.org, Robin Murphy <robin.murphy@arm.com>,
	iommu@lists.linux-foundation.org, Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: [RFC 1/2] iommu: arm-smmu: Extract arm_smmu_of_parse()
Date: Mon,  9 Dec 2019 16:07:47 +0100	[thread overview]
Message-ID: <20191209150748.2471814-2-thierry.reding@gmail.com> (raw)
In-Reply-To: <20191209150748.2471814-1-thierry.reding@gmail.com>

From: Thierry Reding <treding@nvidia.com>

This function will be subsequently used to extract stream ID information
early, before a struct device is available.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/iommu/arm-smmu.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index d1aef07bb784..5c5cf942077e 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1545,18 +1545,28 @@ static int arm_smmu_domain_set_attr(struct iommu_domain *domain,
 	return ret;
 }
 
-static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
+static u32 arm_smmu_of_parse(struct device_node *np, const u32 *args,
+			     unsigned int count)
 {
-	u32 mask, fwid = 0;
+	u32 fwid = 0, mask;
 
-	if (args->args_count > 0)
-		fwid |= FIELD_PREP(SMR_ID, args->args[0]);
+	if (count > 0)
+		fwid |= FIELD_PREP(SMR_ID, args[0]);
 
-	if (args->args_count > 1)
-		fwid |= FIELD_PREP(SMR_MASK, args->args[1]);
-	else if (!of_property_read_u32(args->np, "stream-match-mask", &mask))
+	if (count > 1)
+		fwid |= FIELD_PREP(SMR_MASK, args[1]);
+	else if (!of_property_read_u32(np, "stream-match-mask", &mask))
 		fwid |= FIELD_PREP(SMR_MASK, mask);
 
+	return fwid;
+}
+
+static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args)
+{
+	u32 fwid;
+
+	fwid = arm_smmu_of_parse(args->np, args->args, args->args_count);
+
 	return iommu_fwspec_add_ids(dev, &fwid, 1);
 }
 
-- 
2.23.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-12-09 15:07 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09 15:07 [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings Thierry Reding
2019-12-09 15:07 ` Thierry Reding
2019-12-09 15:07 ` Thierry Reding
     [not found] ` <20191209150748.2471814-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-12-09 15:07   ` Thierry Reding [this message]
2019-12-09 15:07     ` [RFC 1/2] iommu: arm-smmu: Extract arm_smmu_of_parse() Thierry Reding
2019-12-09 15:07     ` Thierry Reding
2019-12-09 15:07   ` [RFC 2/2] iommu: arm-smmu: Add support for early direct mappings Thierry Reding
2019-12-09 15:07     ` Thierry Reding
2019-12-09 15:07     ` Thierry Reding
2020-01-11  4:56   ` [RFC 0/2] " Saravana Kannan
2020-01-11  4:56     ` Saravana Kannan
2020-01-11  4:56     ` Saravana Kannan via iommu
     [not found]     ` <20200111045639.210486-1-saravanak-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2020-01-13 14:07       ` Thierry Reding
2020-01-13 14:07         ` Thierry Reding
2020-01-13 14:07         ` Thierry Reding
2020-01-13 22:01         ` Saravana Kannan
2020-01-13 22:01           ` Saravana Kannan
2020-01-13 22:01           ` Saravana Kannan via iommu
     [not found]           ` <CAGETcx8YAXOdr1__gTCT2xCPq47Cg9vGj+5HJ_ZLzy4mHxU2xA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-01-14  0:11             ` Bjorn Andersson
2020-01-14  0:11               ` Bjorn Andersson
2020-01-14  0:11               ` Bjorn Andersson
2020-02-28  2:57   ` Bjorn Andersson
2020-02-28  2:57     ` Bjorn Andersson
2020-02-28  2:57     ` Bjorn Andersson
2020-02-28  2:57     ` Bjorn Andersson
2020-03-04 13:48     ` Laurentiu Tudor
2020-03-04 13:48       ` Laurentiu Tudor
2020-03-04 13:48       ` Laurentiu Tudor
2020-03-04 13:48       ` Laurentiu Tudor
2020-05-14 19:32     ` bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A
2020-05-14 19:32       ` bjorn.andersson
2020-05-14 19:32       ` bjorn.andersson
2020-05-14 19:32       ` bjorn.andersson
     [not found]       ` <20200514193249.GE279327-Y7zrm0MriT3hXIiyNabO3w@public.gmane.org>
2020-05-26 20:34         ` John Stultz
2020-05-26 20:34           ` John Stultz
2020-05-26 20:34           ` John Stultz
2020-05-26 20:34           ` John Stultz
     [not found]           ` <CALAqxLVmomdKJCwh=e-PX+8-seDX0RXA81FzmG4sEyJmbXBh9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-05-27  9:06             ` Laurentiu Tudor
2020-05-27  9:06               ` Laurentiu Tudor
2020-05-27  9:06               ` Laurentiu Tudor
2020-05-27  9:06               ` Laurentiu Tudor
2020-05-27 11:03             ` Will Deacon
2020-05-27 11:03               ` Will Deacon
2020-05-27 11:03               ` Will Deacon
2020-05-27 11:03               ` Will Deacon
2020-06-02  6:32               ` Bjorn Andersson
2020-06-02  6:32                 ` Bjorn Andersson
2020-06-02  6:32                 ` Bjorn Andersson
2020-06-02  6:32                 ` Bjorn Andersson
2020-06-03 11:00                 ` Robin Murphy
2020-06-03 11:00                   ` Robin Murphy
2020-06-03 11:00                   ` Robin Murphy
2020-06-03 11:00                   ` Robin Murphy
     [not found]                   ` <a1f9ee83-66cd-1f04-3e78-3281b3cafd07-5wv7dgnIgG8@public.gmane.org>
2020-07-01  7:40                     ` Bjorn Andersson
2020-07-01  7:40                       ` Bjorn Andersson
2020-07-01  7:40                       ` Bjorn Andersson
2020-07-01  7:40                       ` Bjorn Andersson
     [not found]                       ` <20200701074050.GO388985-Y7zrm0MriT3hXIiyNabO3w@public.gmane.org>
2020-07-01 10:54                         ` Will Deacon
2020-07-01 10:54                           ` Will Deacon
2020-07-01 10:54                           ` Will Deacon
2020-07-01 10:54                           ` Will Deacon
2020-06-03 11:11                 ` Will Deacon
2020-06-03 11:11                   ` Will Deacon
2020-06-03 11:11                   ` Will Deacon
2020-06-03 11:11                   ` Will Deacon
2020-06-03 17:23                   ` Bjorn Andersson
2020-06-03 17:23                     ` Bjorn Andersson
2020-06-03 17:23                     ` Bjorn Andersson
2020-06-03 17:23                     ` Bjorn Andersson
2020-06-02 11:02               ` Thierry Reding
2020-06-02 11:02                 ` Thierry Reding
2020-06-02 11:02                 ` Thierry Reding
2020-06-02 11:02                 ` Thierry Reding
2020-06-02 19:32                 ` Bjorn Andersson
2020-06-02 19:32                   ` Bjorn Andersson
2020-06-02 19:32                   ` Bjorn Andersson
2020-06-02 19:32                   ` Bjorn Andersson
     [not found]                   ` <20200602193249.GC1799770-Y7zrm0MriT3hXIiyNabO3w@public.gmane.org>
2020-06-03 10:24                     ` Thierry Reding
2020-06-03 10:24                       ` Thierry Reding
2020-06-03 10:24                       ` Thierry Reding
2020-06-03 10:24                       ` Thierry Reding
2020-06-03 17:17                       ` Bjorn Andersson
2020-06-03 17:17                         ` Bjorn Andersson
2020-06-03 17:17                         ` Bjorn Andersson
2020-06-03 17:17                         ` Bjorn Andersson

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=20191209150748.2471814-2-thierry.reding@gmail.com \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robin.murphy-5wv7dgnIgG8@public.gmane.org \
    --cc=will-DgEjT+Ai2ygdnm+yROfE0A@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 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.