All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Joerg Roedel <joro@8bytes.org>,
	Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>,
	Jordan Crouse <jcrouse@codeaurora.org>,
	Rob Clark <robdclark@chromium.org>
Cc: linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org,
	Sibi Sankar <sibis@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings
Date: Wed, 16 Sep 2020 13:09:44 +0300	[thread overview]
Message-ID: <1eb59ae2-bec4-aaf7-f07d-bec75979e4f7@nxp.com> (raw)
In-Reply-To: <20200904155513.282067-1-bjorn.andersson@linaro.org>


On 9/4/2020 6:55 PM, Bjorn Andersson wrote:
> Based on previous attempts and discussions this is the latest attempt at
> inheriting stream mappings set up by the bootloader, for e.g. boot splash or
> efifb.
> 
> Per Will's request this builds on the work by Jordan and Rob for the Adreno
> SMMU support. It applies cleanly ontop of v16 of their series, which can be
> found at
> https://lore.kernel.org/linux-arm-msm/20200901164707.2645413-1-robdclark@gmail.com/
> 
> Bjorn Andersson (8):
>   iommu/arm-smmu: Refactor context bank allocation
>   iommu/arm-smmu: Delay modifying domain during init
>   iommu/arm-smmu: Consult context bank allocator for identify domains
>   iommu/arm-smmu-qcom: Emulate bypass by using context banks
>   iommu/arm-smmu-qcom: Consistently initialize stream mappings
>   iommu/arm-smmu: Add impl hook for inherit boot mappings
>   iommu/arm-smmu: Provide helper for allocating identity domain
>   iommu/arm-smmu-qcom: Setup identity domain for boot mappings
> 
>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 111 ++++++++++++++++++-
>  drivers/iommu/arm/arm-smmu/arm-smmu.c      | 122 ++++++++++++++-------
>  drivers/iommu/arm/arm-smmu/arm-smmu.h      |  14 ++-
>  3 files changed, 205 insertions(+), 42 deletions(-)
> 

Tested on a NXP LX2160A with John's tree [1] and below diff [2], so for
the whole series:

Tested-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>

[1]
https://git.linaro.org/people/john.stultz/android-dev.git/log/?h=dev/db845c-mainline-WIP
[2]
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
@@ -190,11 +190,43 @@ static const struct arm_smmu_impl mrvl_mmu500_impl = {
        .reset = arm_mmu500_reset,
 };

+static int nxp_smmu_inherit_mappings(struct arm_smmu_device *smmu)
+{
+       u32 smr;
+       int i, cnt = 0;
+
+       for (i = 0; i < smmu->num_mapping_groups; i++) {
+               smr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_SMR(i));
+
+               if (FIELD_GET(ARM_SMMU_SMR_VALID, smr)) {
+                       smmu->smrs[i].id = FIELD_GET(ARM_SMMU_SMR_ID, smr);
+                       smmu->smrs[i].mask =
FIELD_GET(ARM_SMMU_SMR_MASK, smr);
+                       smmu->smrs[i].valid = true;
+
+                       smmu->s2crs[i].type = S2CR_TYPE_BYPASS;
+                       smmu->s2crs[i].privcfg = S2CR_PRIVCFG_DEFAULT;
+                       smmu->s2crs[i].count++;
+
+                       cnt++;
+               }
+       }
+
+       dev_notice(smmu->dev, "\tpreserved %d boot mapping%s\n", cnt,
+                  cnt == 1 ? "" : "s");
+
+       return 0;
+}
+
+static const struct arm_smmu_impl nxp_impl = {
+       .inherit_mappings = nxp_smmu_inherit_mappings,
+};

 struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu)
 {
        const struct device_node *np = smmu->dev->of_node;

        /*
         * Set the impl for model-specific implementation quirks first,
         * such that platform integration quirks can pick it up and
@@ -229,5 +261,12 @@ struct arm_smmu_device *arm_smmu_impl_init(struct
arm_smmu_device *smmu)
        if (of_device_is_compatible(np, "marvell,ap806-smmu-500"))
                smmu->impl = &mrvl_mmu500_impl;

+       if (of_property_read_bool(np, "nxp,keep-bypass-mappings"))
+               smmu->impl = &nxp_impl;

---
Best Regards, Laurentiu

WARNING: multiple messages have this Message-ID (diff)
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Joerg Roedel <joro@8bytes.org>,
	Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>,
	Jordan Crouse <jcrouse@codeaurora.org>,
	Rob Clark <robdclark@chromium.org>
Cc: linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org,
	Sibi Sankar <sibis@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings
Date: Wed, 16 Sep 2020 13:09:44 +0300	[thread overview]
Message-ID: <1eb59ae2-bec4-aaf7-f07d-bec75979e4f7@nxp.com> (raw)
In-Reply-To: <20200904155513.282067-1-bjorn.andersson@linaro.org>


On 9/4/2020 6:55 PM, Bjorn Andersson wrote:
> Based on previous attempts and discussions this is the latest attempt at
> inheriting stream mappings set up by the bootloader, for e.g. boot splash or
> efifb.
> 
> Per Will's request this builds on the work by Jordan and Rob for the Adreno
> SMMU support. It applies cleanly ontop of v16 of their series, which can be
> found at
> https://lore.kernel.org/linux-arm-msm/20200901164707.2645413-1-robdclark@gmail.com/
> 
> Bjorn Andersson (8):
>   iommu/arm-smmu: Refactor context bank allocation
>   iommu/arm-smmu: Delay modifying domain during init
>   iommu/arm-smmu: Consult context bank allocator for identify domains
>   iommu/arm-smmu-qcom: Emulate bypass by using context banks
>   iommu/arm-smmu-qcom: Consistently initialize stream mappings
>   iommu/arm-smmu: Add impl hook for inherit boot mappings
>   iommu/arm-smmu: Provide helper for allocating identity domain
>   iommu/arm-smmu-qcom: Setup identity domain for boot mappings
> 
>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 111 ++++++++++++++++++-
>  drivers/iommu/arm/arm-smmu/arm-smmu.c      | 122 ++++++++++++++-------
>  drivers/iommu/arm/arm-smmu/arm-smmu.h      |  14 ++-
>  3 files changed, 205 insertions(+), 42 deletions(-)
> 

Tested on a NXP LX2160A with John's tree [1] and below diff [2], so for
the whole series:

Tested-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>

[1]
https://git.linaro.org/people/john.stultz/android-dev.git/log/?h=dev/db845c-mainline-WIP
[2]
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
@@ -190,11 +190,43 @@ static const struct arm_smmu_impl mrvl_mmu500_impl = {
        .reset = arm_mmu500_reset,
 };

+static int nxp_smmu_inherit_mappings(struct arm_smmu_device *smmu)
+{
+       u32 smr;
+       int i, cnt = 0;
+
+       for (i = 0; i < smmu->num_mapping_groups; i++) {
+               smr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_SMR(i));
+
+               if (FIELD_GET(ARM_SMMU_SMR_VALID, smr)) {
+                       smmu->smrs[i].id = FIELD_GET(ARM_SMMU_SMR_ID, smr);
+                       smmu->smrs[i].mask =
FIELD_GET(ARM_SMMU_SMR_MASK, smr);
+                       smmu->smrs[i].valid = true;
+
+                       smmu->s2crs[i].type = S2CR_TYPE_BYPASS;
+                       smmu->s2crs[i].privcfg = S2CR_PRIVCFG_DEFAULT;
+                       smmu->s2crs[i].count++;
+
+                       cnt++;
+               }
+       }
+
+       dev_notice(smmu->dev, "\tpreserved %d boot mapping%s\n", cnt,
+                  cnt == 1 ? "" : "s");
+
+       return 0;
+}
+
+static const struct arm_smmu_impl nxp_impl = {
+       .inherit_mappings = nxp_smmu_inherit_mappings,
+};

 struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu)
 {
        const struct device_node *np = smmu->dev->of_node;

        /*
         * Set the impl for model-specific implementation quirks first,
         * such that platform integration quirks can pick it up and
@@ -229,5 +261,12 @@ struct arm_smmu_device *arm_smmu_impl_init(struct
arm_smmu_device *smmu)
        if (of_device_is_compatible(np, "marvell,ap806-smmu-500"))
                smmu->impl = &mrvl_mmu500_impl;

+       if (of_property_read_bool(np, "nxp,keep-bypass-mappings"))
+               smmu->impl = &nxp_impl;

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

WARNING: multiple messages have this Message-ID (diff)
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Joerg Roedel <joro@8bytes.org>,
	Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>,
	Jordan Crouse <jcrouse@codeaurora.org>,
	Rob Clark <robdclark@chromium.org>
Cc: linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org,
	Sibi Sankar <sibis@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings
Date: Wed, 16 Sep 2020 13:09:44 +0300	[thread overview]
Message-ID: <1eb59ae2-bec4-aaf7-f07d-bec75979e4f7@nxp.com> (raw)
In-Reply-To: <20200904155513.282067-1-bjorn.andersson@linaro.org>


On 9/4/2020 6:55 PM, Bjorn Andersson wrote:
> Based on previous attempts and discussions this is the latest attempt at
> inheriting stream mappings set up by the bootloader, for e.g. boot splash or
> efifb.
> 
> Per Will's request this builds on the work by Jordan and Rob for the Adreno
> SMMU support. It applies cleanly ontop of v16 of their series, which can be
> found at
> https://lore.kernel.org/linux-arm-msm/20200901164707.2645413-1-robdclark@gmail.com/
> 
> Bjorn Andersson (8):
>   iommu/arm-smmu: Refactor context bank allocation
>   iommu/arm-smmu: Delay modifying domain during init
>   iommu/arm-smmu: Consult context bank allocator for identify domains
>   iommu/arm-smmu-qcom: Emulate bypass by using context banks
>   iommu/arm-smmu-qcom: Consistently initialize stream mappings
>   iommu/arm-smmu: Add impl hook for inherit boot mappings
>   iommu/arm-smmu: Provide helper for allocating identity domain
>   iommu/arm-smmu-qcom: Setup identity domain for boot mappings
> 
>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 111 ++++++++++++++++++-
>  drivers/iommu/arm/arm-smmu/arm-smmu.c      | 122 ++++++++++++++-------
>  drivers/iommu/arm/arm-smmu/arm-smmu.h      |  14 ++-
>  3 files changed, 205 insertions(+), 42 deletions(-)
> 

Tested on a NXP LX2160A with John's tree [1] and below diff [2], so for
the whole series:

Tested-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>

[1]
https://git.linaro.org/people/john.stultz/android-dev.git/log/?h=dev/db845c-mainline-WIP
[2]
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
@@ -190,11 +190,43 @@ static const struct arm_smmu_impl mrvl_mmu500_impl = {
        .reset = arm_mmu500_reset,
 };

+static int nxp_smmu_inherit_mappings(struct arm_smmu_device *smmu)
+{
+       u32 smr;
+       int i, cnt = 0;
+
+       for (i = 0; i < smmu->num_mapping_groups; i++) {
+               smr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_SMR(i));
+
+               if (FIELD_GET(ARM_SMMU_SMR_VALID, smr)) {
+                       smmu->smrs[i].id = FIELD_GET(ARM_SMMU_SMR_ID, smr);
+                       smmu->smrs[i].mask =
FIELD_GET(ARM_SMMU_SMR_MASK, smr);
+                       smmu->smrs[i].valid = true;
+
+                       smmu->s2crs[i].type = S2CR_TYPE_BYPASS;
+                       smmu->s2crs[i].privcfg = S2CR_PRIVCFG_DEFAULT;
+                       smmu->s2crs[i].count++;
+
+                       cnt++;
+               }
+       }
+
+       dev_notice(smmu->dev, "\tpreserved %d boot mapping%s\n", cnt,
+                  cnt == 1 ? "" : "s");
+
+       return 0;
+}
+
+static const struct arm_smmu_impl nxp_impl = {
+       .inherit_mappings = nxp_smmu_inherit_mappings,
+};

 struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu)
 {
        const struct device_node *np = smmu->dev->of_node;

        /*
         * Set the impl for model-specific implementation quirks first,
         * such that platform integration quirks can pick it up and
@@ -229,5 +261,12 @@ struct arm_smmu_device *arm_smmu_impl_init(struct
arm_smmu_device *smmu)
        if (of_device_is_compatible(np, "marvell,ap806-smmu-500"))
                smmu->impl = &mrvl_mmu500_impl;

+       if (of_property_read_bool(np, "nxp,keep-bypass-mappings"))
+               smmu->impl = &nxp_impl;

---
Best Regards, Laurentiu

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

  parent reply	other threads:[~2020-09-16 10:10 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 15:55 [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings Bjorn Andersson
2020-09-04 15:55 ` Bjorn Andersson
2020-09-04 15:55 ` Bjorn Andersson
2020-09-04 15:55 ` [PATCH v3 1/8] iommu/arm-smmu: Refactor context bank allocation Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-08 18:42   ` Jordan Crouse
2020-09-08 18:42   ` Jordan Crouse
2020-09-08 18:42   ` Jordan Crouse
2020-09-08 18:46     ` Jordan Crouse
2020-09-08 18:46     ` Jordan Crouse
2020-09-08 18:46     ` Jordan Crouse
2020-09-11  8:18   ` Sai Prakash Ranjan
2020-09-11  8:18   ` Sai Prakash Ranjan
2020-09-11  8:18   ` Sai Prakash Ranjan
2020-09-04 15:55 ` [PATCH v3 2/8] iommu/arm-smmu: Delay modifying domain during init Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-11  8:20   ` Sai Prakash Ranjan
2020-09-11  8:20   ` Sai Prakash Ranjan
2020-09-11  8:20   ` Sai Prakash Ranjan
2020-09-04 15:55 ` [PATCH v3 3/8] iommu/arm-smmu: Consult context bank allocator for identify domains Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-11  8:21   ` Sai Prakash Ranjan
2020-09-11  8:21   ` Sai Prakash Ranjan
2020-09-11  8:21   ` Sai Prakash Ranjan
2020-09-11  8:24   ` Sai Prakash Ranjan
2020-09-11  8:24   ` Sai Prakash Ranjan
2020-09-11  8:24   ` Sai Prakash Ranjan
2020-09-04 15:55 ` [PATCH v3 4/8] iommu/arm-smmu-qcom: Emulate bypass by using context banks Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-11  8:25   ` Sai Prakash Ranjan
2020-09-11  8:25   ` Sai Prakash Ranjan
2020-09-11  8:25   ` Sai Prakash Ranjan
2020-09-04 15:55 ` [PATCH v3 5/8] iommu/arm-smmu-qcom: Consistently initialize stream mappings Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-11  8:26   ` Sai Prakash Ranjan
2020-09-11  8:26   ` Sai Prakash Ranjan
2020-09-11  8:26   ` Sai Prakash Ranjan
2020-09-04 15:55 ` [PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-11  8:27   ` Sai Prakash Ranjan
2020-09-11  8:27   ` Sai Prakash Ranjan
2020-09-11  8:27   ` Sai Prakash Ranjan
2020-09-11 17:13   ` Robin Murphy
2020-09-11 17:13     ` Robin Murphy
2020-09-11 17:13     ` Robin Murphy
2020-09-13  3:25     ` Bjorn Andersson
2020-09-13  3:25       ` Bjorn Andersson
2020-09-13  3:25       ` Bjorn Andersson
2020-09-21 21:08       ` Will Deacon
2020-09-21 21:08         ` Will Deacon
2020-09-21 21:08         ` Will Deacon
2020-09-24 15:55         ` Bjorn Andersson
2020-09-24 15:55           ` Bjorn Andersson
2020-09-24 15:55           ` Bjorn Andersson
2020-10-12  7:31         ` Bjorn Andersson
2020-10-12  7:31           ` Bjorn Andersson
2020-10-12  7:31           ` Bjorn Andersson
2020-10-13 16:47           ` Robin Murphy
2020-10-13 16:47             ` Robin Murphy
2020-10-13 16:47             ` Robin Murphy
2020-09-04 15:55 ` [PATCH v3 7/8] iommu/arm-smmu: Provide helper for allocating identity domain Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-11  8:28   ` Sai Prakash Ranjan
2020-09-11  8:28   ` Sai Prakash Ranjan
2020-09-11  8:28   ` Sai Prakash Ranjan
2020-09-04 15:55 ` [PATCH v3 8/8] iommu/arm-smmu-qcom: Setup identity domain for boot mappings Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-04 15:55   ` Bjorn Andersson
2020-09-11  8:29   ` Sai Prakash Ranjan
2020-09-11  8:29   ` Sai Prakash Ranjan
2020-09-11  8:29   ` Sai Prakash Ranjan
2020-09-11 17:29   ` Robin Murphy
2020-09-11 17:29     ` Robin Murphy
2020-09-11 17:29     ` Robin Murphy
2020-09-05 22:27 ` [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings Rob Clark
2020-09-05 22:27   ` Rob Clark
2020-09-05 22:27   ` Rob Clark
2020-09-09 14:46 ` Laurentiu Tudor
2020-09-09 14:46   ` Laurentiu Tudor
2020-09-09 14:46   ` Laurentiu Tudor
2020-09-10 22:56 ` John Stultz
2020-09-10 22:56   ` John Stultz
2020-09-10 22:56   ` John Stultz
2020-09-11  8:16 ` Sai Prakash Ranjan
2020-09-11  8:16 ` Sai Prakash Ranjan
2020-09-11  8:16 ` Sai Prakash Ranjan
2020-09-11 16:10 ` Amit Pundir
2020-09-11 16:10   ` Amit Pundir
2020-09-11 16:10   ` Amit Pundir
2020-09-16 10:09 ` Laurentiu Tudor [this message]
2020-09-16 10:09   ` Laurentiu Tudor
2020-09-16 10:09   ` Laurentiu Tudor
2020-09-07 18:49 Caleb Connolly
2020-09-07 18:49 ` Caleb Connolly

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=1eb59ae2-bec4-aaf7-f07d-bec75979e4f7@nxp.com \
    --to=laurentiu.tudor@nxp.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jcrouse@codeaurora.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@chromium.org \
    --cc=robin.murphy@arm.com \
    --cc=saiprakash.ranjan@codeaurora.org \
    --cc=sibis@codeaurora.org \
    --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.