All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
To: <linux-arm-kernel@lists.infradead.org>,
	<linux-acpi@vger.kernel.org>, <iommu@lists.linux-foundation.org>
Cc: <linuxarm@huawei.com>, <lorenzo.pieralisi@arm.com>,
	<joro@8bytes.org>, <robin.murphy@arm.com>, <will@kernel.org>,
	<wanghuiqiang@huawei.com>, <guohanjun@huawei.com>,
	<steven.price@arm.com>, <Sami.Mujawar@arm.com>,
	<jon@solid-run.com>, <eric.auger@redhat.com>,
	<laurentiu.tudor@nxp.com>, <hch@infradead.org>
Subject: [PATCH v12 6/9] iommu/arm-smmu-v3: Introduce strtab init helper
Date: Tue, 3 May 2022 17:33:27 +0100	[thread overview]
Message-ID: <20220503163330.509-7-shameerali.kolothum.thodi@huawei.com> (raw)
In-Reply-To: <20220503163330.509-1-shameerali.kolothum.thodi@huawei.com>

Introduce a helper to check the sid range and to init the l2 strtab
entries(bypass). This will be useful when we have to initialize the
l2 strtab with bypass for RMR SIDs.

Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 28 +++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 627a3ed5ee8f..df326d8f02c6 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2537,6 +2537,19 @@ static bool arm_smmu_sid_in_range(struct arm_smmu_device *smmu, u32 sid)
 	return sid < limit;
 }
 
+static int arm_smmu_init_sid_strtab(struct arm_smmu_device *smmu, u32 sid)
+{
+	/* Check the SIDs are in range of the SMMU and our stream table */
+	if (!arm_smmu_sid_in_range(smmu, sid))
+		return -ERANGE;
+
+	/* Ensure l2 strtab is initialised */
+	if (smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB)
+		return arm_smmu_init_l2_strtab(smmu, sid);
+
+	return 0;
+}
+
 static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
 				  struct arm_smmu_master *master)
 {
@@ -2560,20 +2573,9 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
 		new_stream->id = sid;
 		new_stream->master = master;
 
-		/*
-		 * Check the SIDs are in range of the SMMU and our stream table
-		 */
-		if (!arm_smmu_sid_in_range(smmu, sid)) {
-			ret = -ERANGE;
+		ret = arm_smmu_init_sid_strtab(smmu, sid);
+		if (ret)
 			break;
-		}
-
-		/* Ensure l2 strtab is initialised */
-		if (smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB) {
-			ret = arm_smmu_init_l2_strtab(smmu, sid);
-			if (ret)
-				break;
-		}
 
 		/* Insert into SID tree */
 		new_node = &(smmu->streams.rb_node);
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Shameer Kolothum via iommu <iommu@lists.linux-foundation.org>
To: <linux-arm-kernel@lists.infradead.org>,
	<linux-acpi@vger.kernel.org>, <iommu@lists.linux-foundation.org>
Cc: robin.murphy@arm.com, jon@solid-run.com, linuxarm@huawei.com,
	steven.price@arm.com, hch@infradead.org, guohanjun@huawei.com,
	Sami.Mujawar@arm.com, will@kernel.org, wanghuiqiang@huawei.com
Subject: [PATCH v12 6/9] iommu/arm-smmu-v3: Introduce strtab init helper
Date: Tue, 3 May 2022 17:33:27 +0100	[thread overview]
Message-ID: <20220503163330.509-7-shameerali.kolothum.thodi@huawei.com> (raw)
In-Reply-To: <20220503163330.509-1-shameerali.kolothum.thodi@huawei.com>

Introduce a helper to check the sid range and to init the l2 strtab
entries(bypass). This will be useful when we have to initialize the
l2 strtab with bypass for RMR SIDs.

Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 28 +++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 627a3ed5ee8f..df326d8f02c6 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2537,6 +2537,19 @@ static bool arm_smmu_sid_in_range(struct arm_smmu_device *smmu, u32 sid)
 	return sid < limit;
 }
 
+static int arm_smmu_init_sid_strtab(struct arm_smmu_device *smmu, u32 sid)
+{
+	/* Check the SIDs are in range of the SMMU and our stream table */
+	if (!arm_smmu_sid_in_range(smmu, sid))
+		return -ERANGE;
+
+	/* Ensure l2 strtab is initialised */
+	if (smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB)
+		return arm_smmu_init_l2_strtab(smmu, sid);
+
+	return 0;
+}
+
 static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
 				  struct arm_smmu_master *master)
 {
@@ -2560,20 +2573,9 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
 		new_stream->id = sid;
 		new_stream->master = master;
 
-		/*
-		 * Check the SIDs are in range of the SMMU and our stream table
-		 */
-		if (!arm_smmu_sid_in_range(smmu, sid)) {
-			ret = -ERANGE;
+		ret = arm_smmu_init_sid_strtab(smmu, sid);
+		if (ret)
 			break;
-		}
-
-		/* Ensure l2 strtab is initialised */
-		if (smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB) {
-			ret = arm_smmu_init_l2_strtab(smmu, sid);
-			if (ret)
-				break;
-		}
 
 		/* Insert into SID tree */
 		new_node = &(smmu->streams.rb_node);
-- 
2.17.1

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

WARNING: multiple messages have this Message-ID (diff)
From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
To: <linux-arm-kernel@lists.infradead.org>,
	<linux-acpi@vger.kernel.org>, <iommu@lists.linux-foundation.org>
Cc: <linuxarm@huawei.com>, <lorenzo.pieralisi@arm.com>,
	<joro@8bytes.org>, <robin.murphy@arm.com>, <will@kernel.org>,
	<wanghuiqiang@huawei.com>, <guohanjun@huawei.com>,
	<steven.price@arm.com>, <Sami.Mujawar@arm.com>,
	<jon@solid-run.com>, <eric.auger@redhat.com>,
	<laurentiu.tudor@nxp.com>, <hch@infradead.org>
Subject: [PATCH v12 6/9] iommu/arm-smmu-v3: Introduce strtab init helper
Date: Tue, 3 May 2022 17:33:27 +0100	[thread overview]
Message-ID: <20220503163330.509-7-shameerali.kolothum.thodi@huawei.com> (raw)
In-Reply-To: <20220503163330.509-1-shameerali.kolothum.thodi@huawei.com>

Introduce a helper to check the sid range and to init the l2 strtab
entries(bypass). This will be useful when we have to initialize the
l2 strtab with bypass for RMR SIDs.

Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 28 +++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 627a3ed5ee8f..df326d8f02c6 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -2537,6 +2537,19 @@ static bool arm_smmu_sid_in_range(struct arm_smmu_device *smmu, u32 sid)
 	return sid < limit;
 }
 
+static int arm_smmu_init_sid_strtab(struct arm_smmu_device *smmu, u32 sid)
+{
+	/* Check the SIDs are in range of the SMMU and our stream table */
+	if (!arm_smmu_sid_in_range(smmu, sid))
+		return -ERANGE;
+
+	/* Ensure l2 strtab is initialised */
+	if (smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB)
+		return arm_smmu_init_l2_strtab(smmu, sid);
+
+	return 0;
+}
+
 static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
 				  struct arm_smmu_master *master)
 {
@@ -2560,20 +2573,9 @@ static int arm_smmu_insert_master(struct arm_smmu_device *smmu,
 		new_stream->id = sid;
 		new_stream->master = master;
 
-		/*
-		 * Check the SIDs are in range of the SMMU and our stream table
-		 */
-		if (!arm_smmu_sid_in_range(smmu, sid)) {
-			ret = -ERANGE;
+		ret = arm_smmu_init_sid_strtab(smmu, sid);
+		if (ret)
 			break;
-		}
-
-		/* Ensure l2 strtab is initialised */
-		if (smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB) {
-			ret = arm_smmu_init_l2_strtab(smmu, sid);
-			if (ret)
-				break;
-		}
 
 		/* Insert into SID tree */
 		new_node = &(smmu->streams.rb_node);
-- 
2.17.1


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

  parent reply	other threads:[~2022-05-03 16:35 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 16:33 [PATCH v12 0/9] ACPI/IORT: Support for IORT RMR node Shameer Kolothum
2022-05-03 16:33 ` Shameer Kolothum
2022-05-03 16:33 ` Shameer Kolothum via iommu
2022-05-03 16:33 ` [PATCH v12 1/9] iommu: Introduce a callback to struct iommu_resv_region Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum via iommu
2022-05-03 16:33 ` [PATCH v12 2/9] ACPI/IORT: Make iort_iommu_msi_get_resv_regions() return void Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum via iommu
2022-05-05  1:02   ` Hanjun Guo
2022-05-05  1:02     ` Hanjun Guo
2022-05-05  1:02     ` Hanjun Guo via iommu
2022-05-03 16:33 ` [PATCH v12 3/9] ACPI/IORT: Provide a generic helper to retrieve reserve regions Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum via iommu
2022-05-05  1:07   ` Hanjun Guo
2022-05-05  1:07     ` Hanjun Guo
2022-05-05  1:07     ` Hanjun Guo via iommu
2022-05-03 16:33 ` [PATCH v12 4/9] ACPI/IORT: Add support to retrieve IORT RMR reserved regions Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum via iommu
2022-05-05  1:17   ` Hanjun Guo
2022-05-05  1:17     ` Hanjun Guo
2022-05-05  1:17     ` Hanjun Guo via iommu
2022-05-03 16:33 ` [PATCH v12 5/9] ACPI/IORT: Add a helper to retrieve RMR info directly Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum via iommu
2022-05-05  1:20   ` Hanjun Guo
2022-05-05  1:20     ` Hanjun Guo
2022-05-05  1:20     ` Hanjun Guo via iommu
2022-05-03 16:33 ` Shameer Kolothum [this message]
2022-05-03 16:33   ` [PATCH v12 6/9] iommu/arm-smmu-v3: Introduce strtab init helper Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum via iommu
2022-06-09 15:47   ` Will Deacon
2022-06-09 15:47     ` Will Deacon
2022-06-09 15:47     ` Will Deacon
2022-05-03 16:33 ` [PATCH v12 7/9] iommu/arm-smmu-v3: Refactor arm_smmu_init_bypass_stes() to force bypass Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum via iommu
2022-05-03 16:33 ` [PATCH v12 8/9] iommu/arm-smmu-v3: Get associated RMR info and install bypass STE Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum via iommu
2022-05-03 16:33 ` [PATCH v12 9/9] iommu/arm-smmu: Get associated RMR info and install bypass SMR Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum
2022-05-03 16:33   ` Shameer Kolothum via iommu
2022-05-04 13:56 ` [PATCH v12 0/9] ACPI/IORT: Support for IORT RMR node Laurentiu Tudor
2022-05-04 13:56   ` Laurentiu Tudor
2022-05-04 13:56   ` Laurentiu Tudor
2022-05-05  1:23 ` Hanjun Guo
2022-05-05  1:23   ` Hanjun Guo
2022-05-05  1:23   ` Hanjun Guo via iommu
2022-05-10  7:23   ` Shameerali Kolothum Thodi via iommu
2022-05-10  7:23     ` Shameerali Kolothum Thodi
2022-05-10  7:23     ` Shameerali Kolothum Thodi
2022-05-10  8:07     ` Robin Murphy
2022-05-10  8:07       ` Robin Murphy
2022-05-10  8:07       ` Robin Murphy
2022-05-13  9:44       ` Lorenzo Pieralisi
2022-05-13  9:44         ` Lorenzo Pieralisi
2022-05-13  9:44         ` Lorenzo Pieralisi
2022-05-13  9:49       ` Lorenzo Pieralisi
2022-05-13  9:49         ` Lorenzo Pieralisi
2022-05-13  9:49         ` Lorenzo Pieralisi
2022-05-17  7:18         ` Shameerali Kolothum Thodi
2022-05-17  7:18           ` Shameerali Kolothum Thodi
2022-05-17  7:18           ` Shameerali Kolothum Thodi via iommu
2022-05-25  8:59         ` Shameerali Kolothum Thodi
2022-05-25  8:59           ` Shameerali Kolothum Thodi
2022-05-25  8:59           ` Shameerali Kolothum Thodi via iommu

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=20220503163330.509-7-shameerali.kolothum.thodi@huawei.com \
    --to=shameerali.kolothum.thodi@huawei.com \
    --cc=Sami.Mujawar@arm.com \
    --cc=eric.auger@redhat.com \
    --cc=guohanjun@huawei.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jon@solid-run.com \
    --cc=joro@8bytes.org \
    --cc=laurentiu.tudor@nxp.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=robin.murphy@arm.com \
    --cc=steven.price@arm.com \
    --cc=wanghuiqiang@huawei.com \
    --cc=will@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 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.