* Re: [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings
2020-09-04 15:55 Bjorn Andersson
@ 2020-09-05 22:27 ` Rob Clark
2020-09-09 14:46 ` Laurentiu Tudor
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Rob Clark @ 2020-09-05 22:27 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Rob Clark, Will Deacon,
list@263.net:IOMMU DRIVERS
<iommu@lists.linux-foundation.org>,
Joerg Roedel <joro@8bytes.org>, ,
Linux Kernel Mailing List, Sibi Sankar, linux-arm-msm,
Robin Murphy,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
On Fri, Sep 4, 2020 at 8:55 AM Bjorn Andersson
<bjorn.andersson@linaro.org> 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
I have squashed 1/8 into v17 of the adreno-smmu series as suggested by
Bjorn, the remainder are:
Reviewed-by: Rob Clark <robdclark@gmail.com>
and on the lenovo c630,
Tested-by: Rob Clark <robdclark@gmail.com>
> 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(-)
>
> --
> 2.28.0
>
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings
2020-09-04 15:55 Bjorn Andersson
2020-09-05 22:27 ` Rob Clark
@ 2020-09-09 14:46 ` Laurentiu Tudor
2020-09-10 22:56 ` John Stultz
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Laurentiu Tudor @ 2020-09-09 14:46 UTC (permalink / raw)
To: Bjorn Andersson, Will Deacon, Robin Murphy, Joerg Roedel,
Sai Prakash Ranjan, Jordan Crouse, Rob Clark
Cc: linux-arm-msm, iommu, Sibi Sankar, linux-arm-kernel, linux-kernel
Hi Bjorn,
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/
Is there a git repo available with all the patches put together?
---
Thanks & Best Regards, Laurentiu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings
2020-09-04 15:55 Bjorn Andersson
2020-09-05 22:27 ` Rob Clark
2020-09-09 14:46 ` Laurentiu Tudor
@ 2020-09-10 22:56 ` John Stultz
2020-09-11 8:16 ` Sai Prakash Ranjan
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: John Stultz @ 2020-09-10 22:56 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Rob Clark, Will Deacon, iommu, lkml, Sibi Sankar, linux-arm-msm,
Robin Murphy, linux-arm-kernel
On Fri, Sep 4, 2020 at 8:56 AM Bjorn Andersson
<bjorn.andersson@linaro.org> 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/
>
Apologies, I just found this today. I've pulled your patches and Rob's
into my own tree here:
https://git.linaro.org/people/john.stultz/android-dev.git/log/?h=dev/db845c-mainline-WIP
And they all work fine on the db845c.
So for your whole series:
Tested-by: John Stultz <john.stultz@linaro.org>
thanks
-john
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings
2020-09-04 15:55 Bjorn Andersson
` (2 preceding siblings ...)
2020-09-10 22:56 ` John Stultz
@ 2020-09-11 8:16 ` Sai Prakash Ranjan
2020-09-11 16:10 ` Amit Pundir
2020-09-16 10:09 ` Laurentiu Tudor
5 siblings, 0 replies; 8+ messages in thread
From: Sai Prakash Ranjan @ 2020-09-11 8:16 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Rob Clark, Will Deacon, iommu, linux-kernel, Sibi Sankar,
linux-arm-msm, Robin Murphy, linux-arm-kernel
Hi Bjorn,
On 2020-09-04 21:25, 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/
>
Thanks for working on this, I have tested this on qcom platforms
where firmware does these shenanigans(most android) and this series
works well and where firmware doesn't do all this (chrome) and no
regressions there. Review and test tags given on individual patches.
Thanks,
Sai
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member
of Code Aurora Forum, hosted by The Linux Foundation
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings
2020-09-04 15:55 Bjorn Andersson
` (3 preceding siblings ...)
2020-09-11 8:16 ` Sai Prakash Ranjan
@ 2020-09-11 16:10 ` Amit Pundir
2020-09-16 10:09 ` Laurentiu Tudor
5 siblings, 0 replies; 8+ messages in thread
From: Amit Pundir @ 2020-09-11 16:10 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Rob Clark, Will Deacon, iommu, lkml, Sibi Sankar, linux-arm-msm,
Robin Murphy, linux-arm-kernel
On Fri, 4 Sep 2020 at 21:25, Bjorn Andersson <bjorn.andersson@linaro.org> 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/
>
Boot tested the series on Xiaomi Poco F1 phone (sdm845)
Tested-by: Amit Pundir <amit.pundir@linaro.org>
> 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(-)
>
> --
> 2.28.0
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings
2020-09-04 15:55 Bjorn Andersson
` (4 preceding siblings ...)
2020-09-11 16:10 ` Amit Pundir
@ 2020-09-16 10:09 ` Laurentiu Tudor
5 siblings, 0 replies; 8+ messages in thread
From: Laurentiu Tudor @ 2020-09-16 10:09 UTC (permalink / raw)
To: Bjorn Andersson, Will Deacon, Robin Murphy, Joerg Roedel,
Sai Prakash Ranjan, Jordan Crouse, Rob Clark
Cc: linux-arm-msm, iommu, Sibi Sankar, linux-arm-kernel, linux-kernel
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
^ permalink raw reply [flat|nested] 8+ messages in thread