[PATCH v5 3/3] iommu/arm-smmu-qcom: Implement S2CR quirk

2020-10-19 Thread Bjorn Andersson
by the means of configuring the stream for translation using a reserved and disabled context bank. Also circumvent the problem of configuring faulting streams by configuring the stream as bypass. Signed-off-by: Bjorn Andersson --- Changes since v4: - Made the bypass_cbndx an integer... - Separated out

[PATCH v5 2/3] iommu/arm-smmu-qcom: Read back stream mappings

2020-10-19 Thread Bjorn Andersson
-smmu driver maintain the streams in bypass mode. Signed-off-by: Bjorn Andersson --- Changes since v4: - Don't increment s2cr[i]->count, as this is not actually needed to survive probe deferral drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 23 ++ 1 file changed, 23 inserti

[PATCH v5 1/3] iommu/arm-smmu: Allow implementation specific write_s2cr

2020-10-19 Thread Bjorn Andersson
function, to allow the Qualcomm driver to work around this behavior. Reviewed-by: Robin Murphy Signed-off-by: Bjorn Andersson --- Changes since v4: - Return early instead of indenting the rest of the function drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 ++--- drivers/iommu/arm/arm-smmu

[PATCH v5 0/3] iommu/arm-smmu-qcom: Support maintaining bootloader mappings

2020-10-19 Thread Bjorn Andersson
of a context bank for bypass emulation and use of this context bank pretty much isolated to the Qualcomm specific implementation. The patchset has been tested to boot DB845c and RB5 (with splash screen) and Lenovo Yoga C630 (with EFI framebuffer). Bjorn Andersson (3): iommu/arm-smmu: Allow

Re: [PATCH v4 3/3] iommu/arm-smmu-qcom: Implement S2CR quirk

2020-10-19 Thread Bjorn Andersson
On Mon 19 Oct 09:04 CDT 2020, Robin Murphy wrote: > On 2020-10-17 05:39, Bjorn Andersson wrote: > > The firmware found in some Qualcomm platforms intercepts writes to S2CR > > in order to replace bypass type streams with fault; and ignore S2CR > > updates of type f

Re: [PATCH v4 2/3] iommu/arm-smmu-qcom: Read back stream mappings

2020-10-19 Thread Bjorn Andersson
On Mon 19 Oct 09:03 CDT 2020, Robin Murphy wrote: > On 2020-10-17 05:39, Bjorn Andersson wrote: > > The Qualcomm boot loader configures stream mapping for the peripherals > > that it accesses and in particular it sets up the stream mapping for the > > display controller to b

[PATCH v4 1/3] iommu/arm-smmu: Allow implementation specific write_s2cr

2020-10-16 Thread Bjorn Andersson
function, to allow the Qualcomm driver to work around this behavior. Signed-off-by: Bjorn Andersson --- Changes since v3: - New patch drivers/iommu/arm/arm-smmu/arm-smmu.c | 22 ++ drivers/iommu/arm/arm-smmu/arm-smmu.h | 1 + 2 files changed, 15 insertions(+), 8 deletions

[PATCH v4 0/3] iommu/arm-smmu-qcom: Support maintaining bootloader mappings

2020-10-16 Thread Bjorn Andersson
bank for bypass emulation and use of this context bank pretty much isolated to the Qualcomm specific implementation. As before the patchset has been tested to boot DB845c (with splash screen) and Lenovo Yoga C630 (with EFI framebuffer). Bjorn Andersson (3): iommu/arm-smmu: Allow implementation

[PATCH v4 2/3] iommu/arm-smmu-qcom: Read back stream mappings

2020-10-16 Thread Bjorn Andersson
-smmu driver maintain the streams in bypass mode. Signed-off-by: Bjorn Andersson --- Changes since v3: - Extracted from different patch in v3. - Now configures the stream as BYPASS, rather than translate, which should work for platforms with working S2CR handling as well. drivers/iommu/arm/arm

[PATCH v4 3/3] iommu/arm-smmu-qcom: Implement S2CR quirk

2020-10-16 Thread Bjorn Andersson
by the means of configuring the stream for translation using a reserved and disabled context bank. Also circumvent the problem of configuring faulting streams by configuring the stream as bypass. Signed-off-by: Bjorn Andersson --- Changes since v3: - Move the reservation of the "identity context

Re: [PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings

2020-10-12 Thread Bjorn Andersson
On Mon 21 Sep 23:08 CEST 2020, Will Deacon wrote: > On Sat, Sep 12, 2020 at 10:25:59PM -0500, Bjorn Andersson wrote: > > On Fri 11 Sep 12:13 CDT 2020, Robin Murphy wrote: > > > On 2020-09-04 16:55, Bjorn Andersson wrote: > > > > Add a new operation to allow platform

Re: [PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings

2020-09-24 Thread Bjorn Andersson
On Mon 21 Sep 16:08 CDT 2020, Will Deacon wrote: > On Sat, Sep 12, 2020 at 10:25:59PM -0500, Bjorn Andersson wrote: > > On Fri 11 Sep 12:13 CDT 2020, Robin Murphy wrote: > > > On 2020-09-04 16:55, Bjorn Andersson wrote: > > > > Add a new operation to allow platform

Re: [PATCH] irqchip/qcom-pdc: Allow QCOM_PDC to be loadable as a permanent module

2020-09-15 Thread Bjorn Andersson
ovided a better solution in his > Hybrid probing patch set, I wanted to re-submit this change. > Reviewed-by: Bjorn Andersson > Cc: Andy Gross > Cc: Bjorn Andersson > Cc: Joerg Roedel > Cc: Thomas Gleixner > Cc: Jason Cooper > Cc: Marc Zyngier > Cc: Linus Walleij

Re: [PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings

2020-09-12 Thread Bjorn Andersson
On Fri 11 Sep 12:13 CDT 2020, Robin Murphy wrote: > On 2020-09-04 16:55, Bjorn Andersson wrote: > > Add a new operation to allow platform implementations to inherit any > > stream mappings from the boot loader. > > Is there a reason we need an explicit step for this? The a

Re: [PATCH v16 20/20] arm: dts: qcom: sc7180: Set the compatible string for the GPU SMMU

2020-09-04 Thread Bjorn Andersson
On Tue 01 Sep 11:46 CDT 2020, Rob Clark wrote: > From: Rob Clark > > Set the qcom,adreno-smmu compatible string for the GPU SMMU to enable > split pagetables and per-instance pagetables for drm/msm. > Reviewed-by: Bjorn Andersson > Signed-off-by: Rob Clark > --- >

Re: [PATCH v16 19/20] arm: dts: qcom: sm845: Set the compatible string for the GPU SMMU

2020-09-04 Thread Bjorn Andersson
On Tue 01 Sep 11:46 CDT 2020, Rob Clark wrote: > From: Jordan Crouse > > Set the qcom,adreno-smmu compatible string for the GPU SMMU to enable > split pagetables and per-instance pagetables for drm/msm. > > Signed-off-by: Jordan Crouse > Signed-off-by: Rob Clark Reviewe

[PATCH v3 5/8] iommu/arm-smmu-qcom: Consistently initialize stream mappings

2020-09-04 Thread Bjorn Andersson
ings might linger and reference context banks that Linux is reconfiguring. Use the fact that BYPASS writes result in FAULT type to force all stream mappings to FAULT. Signed-off-by: Bjorn Andersson --- Changes since v2: - None drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 18

[PATCH v3 7/8] iommu/arm-smmu: Provide helper for allocating identity domain

2020-09-04 Thread Bjorn Andersson
Some platform implementations needs to be able to allocate a domain for emulating identity mappings using a context bank without translation. Provide a helper function to allocate such a domain. Signed-off-by: Bjorn Andersson --- Changes since v2: - Extracted from previous

[PATCH v3 4/8] iommu/arm-smmu-qcom: Emulate bypass by using context banks

2020-09-04 Thread Bjorn Andersson
SMMU. This adds a Qualcomm specific cfg_probe function, which probes for the broken behavior of the S2CR registers and implements a custom alloc_context_bank() that when necessary allocates a context bank (without translation) for these domains as well. Signed-off-by: Bjorn Andersson --- Changes

[PATCH v3 1/8] iommu/arm-smmu: Refactor context bank allocation

2020-09-04 Thread Bjorn Andersson
passed object. This allows us to not assign smmu_domain->smmu before attempting to allocate the context bank and as such we don't need to roll back this assignment on failure. Signed-off-by: Bjorn Andersson --- Note that this series applies ontop of: https://lore.kernel.org/linux-arm-

[PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings

2020-09-04 Thread Bjorn Andersson
Add a new operation to allow platform implementations to inherit any stream mappings from the boot loader. Signed-off-by: Bjorn Andersson --- Changes since v2: - New patch/interface drivers/iommu/arm/arm-smmu/arm-smmu.c | 11 ++- drivers/iommu/arm/arm-smmu/arm-smmu.h | 6 ++ 2

Re: [PATCH v16 14/20] iommu/arm-smmu: Prepare for the adreno-smmu implementation

2020-09-04 Thread Bjorn Andersson
ittle bit cleaner. So perhaps you would be interested in squashing https://lore.kernel.org/linux-arm-msm/20200904155513.282067-2-bjorn.anders...@linaro.org/ into this patch? Otherwise, feel free to add my: Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/iommu/arm/arm-smmu/arm-

[PATCH v3 3/8] iommu/arm-smmu: Consult context bank allocator for identify domains

2020-09-04 Thread Bjorn Andersson
consulted and if it decides to use a context bank for the identity map, don't enable translation (i.e. omit ARM_SMMU_SCTLR_M). Signed-off-by: Bjorn Andersson --- Changes since v2: - Tie this to alloc_context_bank rather than carrying a Qualcomm specific quirk in the generic code. drivers/iommu

[PATCH v3 2/8] iommu/arm-smmu: Delay modifying domain during init

2020-09-04 Thread Bjorn Andersson
Delay modifications to the domain during arm_smmu_init_domain_context() until we've allocated a context bank. This will allow us to postpone the special handling of identity domains until the platform specific context bank allocator has been executed, in a later patch. Signed-off-by: Bjorn

[PATCH v3 8/8] iommu/arm-smmu-qcom: Setup identity domain for boot mappings

2020-09-04 Thread Bjorn Andersson
context bank is used and streams are diverted here during initialization. This also performs the readback of SMR registers for the Qualcomm platform, to trigger the mechanism. This is based on prior work by Thierry Reding and Laurentiu Tudor. Signed-off-by: Bjorn Andersson --- Changes since v2

[PATCH v3 0/8] iommu/arm-smmu: Support maintaining bootloader mappings

2020-09-04 Thread Bjorn Andersson
, which can be found at https://lore.kernel.org/linux-arm-msm/20200901164707.2645413-1-robdcl...@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

Re: [PATCH 1/3] iommu: amd: Fix kerneldoc

2020-09-04 Thread Bjorn Andersson
c:1938: warning: Function parameter or member > 'iommu' not described in 'iommu_update_intcapxt' > Reviewed-by: Bjorn Andersson > Signed-off-by: Krzysztof Kozlowski > --- > drivers/iommu/amd/init.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/d

Re: [PATCH 2/3] iommu: intel: Drop kerneldoc marker from regular comment

2020-09-04 Thread Bjorn Andersson
On Tue 28 Jul 12:08 CDT 2020, Krzysztof Kozlowski wrote: > Fix W=1 compile warnings (invalid kerneldoc): > > drivers/iommu/intel/dmar.c:389: warning: Function parameter or member > 'header' not described in 'dmar_parse_one_drhd' > Reviewed-by: Bjorn Andersson > Signed

Re: [PATCH 3/3] iommu: qcom: Drop of_match_ptr to fix -Wunused-const-variable

2020-09-04 Thread Bjorn Andersson
910:34: warning: 'qcom_iommu_of_match' defined > but not used [-Wunused-const-variable=] > 910 | static const struct of_device_id qcom_iommu_of_match[] = { > Reviewed-by: Bjorn Andersson > Signed-off-by: Krzysztof Kozlowski > --- > drivers/iommu/qcom_iommu.c | 4 ++-- > 1 file c

Re: [PATCH 01/19] drm/msm: remove dangling submitqueue references

2020-08-31 Thread Bjorn Andersson
On Tue 01 Sep 03:42 UTC 2020, Rob Clark wrote: > On Mon, Aug 31, 2020 at 7:35 PM Bjorn Andersson > wrote: > > > > On Fri 14 Aug 02:40 UTC 2020, Rob Clark wrote: > > > > > From: Rob Clark > > > > > > Currently it doesn't matter, since we

Re: [PATCH 01/19] drm/msm: remove dangling submitqueue references

2020-08-31 Thread Bjorn Andersson
On Fri 14 Aug 02:40 UTC 2020, Rob Clark wrote: > From: Rob Clark > > Currently it doesn't matter, since we free the ctx immediately. But > when we start refcnt'ing the ctx, we don't want old dangling list > entries to hang around. > > Signed-off-by: Rob Clark Reviewe

Re: [PATCH 19/19] drm/msm: show process names in gem_describe

2020-08-31 Thread Bjorn Andersson
On Thu 13 Aug 21:41 CDT 2020, Rob Clark wrote: > From: Rob Clark > > In $debugfs/gem we already show any vma(s) associated with an object. > Also show process names if the vma's address space is a per-process > address space. > Reviewed-by: Bjorn Andersson > Sig

Re: [PATCH 18/19] iommu/arm-smmu: add a way for implementations to influence SCTLR

2020-08-31 Thread Bjorn Andersson
ommand-stream data. > Reviewed-by: Bjorn Andersson > Signed-off-by: Rob Clark > --- > drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 6 ++ > drivers/iommu/arm/arm-smmu/arm-smmu.c | 3 +++ > drivers/iommu/arm/arm-smmu/arm-smmu.h | 3 +++ > 3 files changed, 12 insertions

Re: [PATCH 15/19] drm/msm: Add support for private address space instances

2020-08-31 Thread Bjorn Andersson
will return a pointer to the global address space. > Reviewed-by: Bjorn Andersson > Signed-off-by: Jordan Crouse > Signed-off-by: Rob Clark > --- > drivers/gpu/drm/msm/msm_drv.c | 13 +++-- > drivers/gpu/drm/msm/msm_drv.h | 5 + > drivers/gpu/drm/msm/m

Re: [PATCH 14/19] drm/msm: Add support to create a local pagetable

2020-08-31 Thread Bjorn Andersson
mpatible string and > split pagetables enabled. > Reviewed-by: Bjorn Andersson > Signed-off-by: Jordan Crouse > Signed-off-by: Rob Clark > --- > drivers/gpu/drm/msm/msm_gpummu.c | 2 +- > drivers/gpu/drm/msm/msm_iommu.c | 199 ++- > drivers/gpu/dr

Re: [PATCH 12/19] drm/msm: Drop context arg to gpu->submit()

2020-08-31 Thread Bjorn Andersson
On Thu 13 Aug 21:41 CDT 2020, Rob Clark wrote: > From: Jordan Crouse > > Now that we can get the ctx from the submitqueue, the extra arg is > redundant. > Reviewed-by: Bjorn Andersson > Signed-off-by: Jordan Crouse > [split out of previous patch to reduce churny noise]

Re: [PATCH 13/19] drm/msm: Set the global virtual address range from the IOMMU domain

2020-08-31 Thread Bjorn Andersson
On Thu 13 Aug 21:41 CDT 2020, Rob Clark wrote: > From: Jordan Crouse > > Use the aperture settings from the IOMMU domain to set up the virtual > address range for the GPU. This allows us to transparently deal with > IOMMU side features (like split pagetables). > Reviewed-b

Re: [PATCH 11/19] drm/msm: Add a context pointer to the submitqueue

2020-08-31 Thread Bjorn Andersson
On Thu 13 Aug 21:41 CDT 2020, Rob Clark wrote: > From: Jordan Crouse > > Each submitqueue is attached to a context. Add a pointer to the > context to the submitqueue at create time and refcount it so > that it stays around through the life of the queue. > Reviewed-by: Bjorn

Re: [PATCH 09/19] iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU

2020-08-31 Thread Bjorn Andersson
agetables > (TTBR1) for the domain attached to the GPU device (SID 0) and > hard code it context bank 0 so the GPU hardware can implement > per-instance pagetables. > Reviewed-by: Bjorn Andersson > Co-developed-by: Rob Clark > Signed-off-by: Jordan Crouse > Signed-off-by: Rob Clark

Re: [PATCH 10/19] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU

2020-08-31 Thread Bjorn Andersson
with a compatible string so that they can be identified in the > arm-smmu implementation specific code. > Reviewed-by: Bjorn Andersson > Signed-off-by: Jordan Crouse > Reviewed-by: Rob Herring > Signed-off-by: Rob Clark > --- > Documentation/devicetree/bindings/iommu/arm,

Re: [PATCH 07/19] drm/msm: set adreno_smmu as gpu's drvdata

2020-08-31 Thread Bjorn Andersson
On Thu 13 Aug 21:41 CDT 2020, Rob Clark wrote: > From: Rob Clark > > This will be populated by adreno-smmu, to provide a way for coordinating > enabling/disabling TTBR0 translation. > Reviewed-by: Bjorn Andersson > Signed-off-by: Rob Clark > --- > dr

Re: [PATCH 08/19] iommu/arm-smmu: constify some helpers

2020-08-31 Thread Bjorn Andersson
On Thu 13 Aug 21:41 CDT 2020, Rob Clark wrote: > From: Rob Clark > > Sprinkle a few `const`s where helpers don't need write access. > Reviewed-by: Bjorn Andersson > Signed-off-by: Rob Clark > --- > drivers/iommu/arm/arm-smmu/arm-smmu.h | 6 +++--- > 1 file cha

Re: [PATCH 06/19] drm/msm/gpu: add dev_to_gpu() helper

2020-08-31 Thread Bjorn Andersson
gt;gpu_get_freq) > *freq = gpu->funcs->gpu_get_freq(gpu); > diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h > index 0db117a7339b..8bda7beaed4b 100644 > --- a/drivers/gpu/drm/msm/msm_gpu.h > +++ b/drivers/gpu/drm/msm/msm_gpu.h > @@ -141,6 +1

Re: [PATCH 05/19] iommu: add private interface for adreno-smmu

2020-08-31 Thread Bjorn Andersson
used to > avoid adding highly driver specific things to the public iommu > interface. > > Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson > --- > include/linux/adreno-smmu-priv.h | 36 > 1 file changed, 36 insertions(+) > create

Re: [PATCH 03/19] iommu/arm-smmu: Add support for split pagetables

2020-08-31 Thread Bjorn Andersson
+ cfg->asid); The old indentation seems more appropriate. Apart from that this looks sensible. Reviewed-by: Bjorn Andersson Regards, Bjorn > + > + if (pgtbl_cfg->quirks & IO_PGTABLE_QUIRK_ARM_TTBR1) > +

Re: [PATCH 02/19] iommu/arm-smmu: Pass io-pgtable config to implementation specific function

2020-08-31 Thread Bjorn Andersson
able is created. > > Signed-off-by: Jordan Crouse > Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/iommu/arm/arm-smmu/arm-smmu-impl.c | 3 ++- > drivers/iommu/arm/arm-smmu/arm-smmu.c | 11 ++- > drivers/iommu/arm/arm-smmu

Re: [PATCH 01/19] drm/msm: remove dangling submitqueue references

2020-08-31 Thread Bjorn Andersson
On Fri 14 Aug 02:40 UTC 2020, Rob Clark wrote: > From: Rob Clark > > Currently it doesn't matter, since we free the ctx immediately. But > when we start refcnt'ing the ctx, we don't want old dangling list > entries to hang around. > > Signed-off-by: Rob Clark > --- >

Re: [PATCH 1/1] iommu/arm-smmu: Implement qcom,skip-init

2020-07-30 Thread Bjorn Andersson
On Wed 22 Jul 13:11 PDT 2020, Konrad Dybcio wrote: > >Is the problem on SDM630 that when you write to SMR/S2CR the device > >reboots? Or that when you start writing out the context bank > >configuration that trips the display and the device reboots? > > I added some debug prints and the phone

Re: [PATCH v10 04/13] iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU

2020-07-27 Thread Bjorn Andersson
On Mon 20 Jul 08:40 PDT 2020, Jordan Crouse wrote: > diff --git a/drivers/iommu/arm-smmu-qcom.c b/drivers/iommu/arm-smmu-qcom.c [..] > +static int qcom_adreno_smmu_alloc_context_bank(struct arm_smmu_domain > *smmu_domain, > + struct device *dev, int start, int count) > +{ > +

Re: [PATCH 1/1] iommu/arm-smmu: Implement qcom,skip-init

2020-07-21 Thread Bjorn Andersson
On Tue 21 Jul 09:20 PDT 2020, Konrad Dybcio wrote: > >The current > >focus has been on moving more of the SMMU specific bits into the > >arm-smmu-qcom > >implementation [1] and I think that is the right way to go. > > Pardon if I overlooked something obvious, but I can't seem to find a > clean

[PATCH v2 5/5] iommu/arm-smmu: Setup identity domain for boot mappings

2020-07-16 Thread Bjorn Andersson
-by: Bjorn Andersson --- Changes since v1: - Rebased to avoid conflict - Picked up tested-by drivers/iommu/arm-smmu-qcom.c | 11 + drivers/iommu/arm-smmu.c | 79 +-- drivers/iommu/arm-smmu.h | 3 ++ 3 files changed, 89 insertions(+), 4 deletions

[PATCH v2 2/5] iommu/arm-smmu: Emulate bypass by using context banks

2020-07-16 Thread Bjorn Andersson
translation. Tested-by: John Stultz Tested-by: Vinod Koul Signed-off-by: Bjorn Andersson --- Changes since v1: - Picked up tested-by drivers/iommu/arm-smmu-qcom.c | 21 + drivers/iommu/arm-smmu.c | 14 -- drivers/iommu/arm-smmu.h | 3 +++ 3 files changed

[PATCH v2 1/5] iommu/arm-smmu: Make all valid stream mappings BYPASS

2020-07-16 Thread Bjorn Andersson
Suggested-by: Robin Murphy Signed-off-by: Bjorn Andersson --- Changes since v1: - Mark arm_smmu_setup_identity() static - Picked up tested-by tags drivers/iommu/arm-smmu.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c

[PATCH v2 4/5] iommu/arm-smmu-qcom: Consistently initialize stream mappings

2020-07-16 Thread Bjorn Andersson
ings might linger and reference context banks that Linux is reconfiguring. Use the fact that BYPASS writes result in FAULT type to force all stream mappings to FAULT. Tested-by: John Stultz Tested-by: Vinod Koul Signed-off-by: Bjorn Andersson --- Changes since v1: - Fixed subject spelling mistak

[PATCH v2 3/5] iommu/arm-smmu: Move SMR and S2CR definitions to header file

2020-07-16 Thread Bjorn Andersson
Expose the SMR and S2CR structs in the header file, to allow platform specific implementations to populate/initialize the smrs and s2cr arrays. Tested-by: John Stultz Tested-by: Vinod Koul Signed-off-by: Bjorn Andersson --- Changes since v1: - Picked up tested-by drivers/iommu/arm-smmu.c

[PATCH v2 0/5] iommu/arm-smmu: Support maintaining bootloader mappings

2020-07-16 Thread Bjorn Andersson
to allow booting SDM845, SDM850, SM8150, SM8250 with boot splash screen setup by the bootloader. Specifically it also allows the Lenovo Yoga C630 to boot with SMMU and efifb enabled. Bjorn Andersson (5): iommu/arm-smmu: Make all valid stream mappings BYPASS iommu/arm-smmu: Emulate bypass

Re: [PATCH 5/5] iommu/arm-smmu: Setup identity domain for boot mappings

2020-07-09 Thread Bjorn Andersson
On Thu 09 Jul 08:50 PDT 2020, Laurentiu Tudor wrote: > > > On 7/9/2020 8:01 AM, Bjorn Andersson wrote: > > With many Qualcomm platforms not having functional S2CR BYPASS a > > temporary IOMMU domain, without translation, needs to be allocated in > > order to allo

Re: [PATCH 2/5] iommu/arm-smmu: Emulate bypass by using context banks

2020-07-09 Thread Bjorn Andersson
On Thu 09 Jul 11:55 PDT 2020, Rob Clark wrote: > On Thu, Jul 9, 2020 at 9:56 AM Rob Clark wrote: > > > > On Thu, Jul 9, 2020 at 9:48 AM Bjorn Andersson > > wrote: > > > > > > On Thu 09 Jul 09:17 PDT 2020, Rob Clark wrote: > > > > &g

Re: [PATCH 2/5] iommu/arm-smmu: Emulate bypass by using context banks

2020-07-09 Thread Bjorn Andersson
On Thu 09 Jul 09:17 PDT 2020, Rob Clark wrote: > On Wed, Jul 8, 2020 at 10:01 PM Bjorn Andersson > wrote: [..] > > @@ -678,7 +680,11 @@ static int arm_smmu_init_domain_context(struct > > iommu_domain *domain, > > if (smmu_domain->smmu) > >

[PATCH 4/5] iommu/arm-smmu-qcom: Consstently initialize stream mappings

2020-07-08 Thread Bjorn Andersson
ings might linger and reference context banks that Linux is reconfiguring. Use the fact that BYPASS writes result in FAULT type to force all stream mappings to FAULT. Signed-off-by: Bjorn Andersson --- drivers/iommu/arm-smmu-qcom.c | 18 +- 1 file changed, 17 insertions(+),

[PATCH 3/5] iommu/arm-smmu: Move SMR and S2CR definitions to header file

2020-07-08 Thread Bjorn Andersson
Expose the SMR and S2CR structs in the header file, to allow platform specific implementations to populate/initialize the smrs and s2cr arrays. Signed-off-by: Bjorn Andersson --- drivers/iommu/arm-smmu.c | 14 -- drivers/iommu/arm-smmu.h | 15 +++ 2 files changed, 15

[PATCH 1/5] iommu/arm-smmu: Make all valid stream mappings BYPASS

2020-07-08 Thread Bjorn Andersson
Turn all stream mappings marked as valid into BYPASS. This allows the platform specific implementation to configure stream mappings to match the boot loader's configuration for e.g. display to continue to function through the reset of the SMMU. Suggested-by: Robin Murphy Signed-off-by: Bjorn

[PATCH 2/5] iommu/arm-smmu: Emulate bypass by using context banks

2020-07-08 Thread Bjorn Andersson
translation. Signed-off-by: Bjorn Andersson --- drivers/iommu/arm-smmu-qcom.c | 21 + drivers/iommu/arm-smmu.c | 14 -- drivers/iommu/arm-smmu.h | 3 +++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu-qcom.c b/drivers

[PATCH 0/5] iommu/arm-smmu: Support maintaining bootloader mappings

2020-07-08 Thread Bjorn Andersson
to allow booting SDM845, SDM850, SM8150, SM8250 with boot splash screen setup by the bootloader. Specifically it also allows the Lenovo Yoga C630 to boot with SMMU and efifb enabled. Bjorn Andersson (5): iommu/arm-smmu: Make all valid stream mappings BYPASS iommu/arm-smmu: Emulate bypass

[PATCH 5/5] iommu/arm-smmu: Setup identity domain for boot mappings

2020-07-08 Thread Bjorn Andersson
context bank is used and streams are diverted here during initialization. This also performs the readback of SMR registers for the Qualcomm platform, to trigger the mechanism. This is based on prior work by Thierry Reding and Laurentiu Tudor. Signed-off-by: Bjorn Andersson --- drivers/iommu/arm-smmu

Re: [PATCH v2 0/8] arm64: dts: qcom: smmu/USB nodes and HDK855/HDK865 dts

2020-07-08 Thread Bjorn Andersson
On Fri 03 Jul 05:31 PDT 2020, Will Deacon wrote: > On Tue, Jun 09, 2020 at 03:40:18PM -0400, Jonathan Marek wrote: > > Add dts nodes for apps_smmu and USB for both sm8150 and sm8250. > > > > Also add initial dts files for HDK855 and HDK865, based on mtp dts, with a > > few changes. Notably, the

Re: [PATCH v2 2/8] iommu: arm-smmu-impl: Use qcom impl for sm8150 and sm8250 compatibles

2020-07-08 Thread Bjorn Andersson
On Tue 09 Jun 12:40 PDT 2020, Jonathan Marek wrote: > Use the qcom implementation for IOMMU hardware on sm8150 and sm8250 SoCs. > > Signed-off-by: Jonathan Marek Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/iommu/arm-smmu-impl.c | 4 +++- > 1 file changed,

Re: [PATCH 1/1] iommu/arm-smmu: Implement qcom,skip-init

2020-07-04 Thread Bjorn Andersson
On Sat 04 Jul 06:09 PDT 2020, Will Deacon wrote: > [Adding Bjorn, Jordan and John because I really don't want a bunch of > different ways to tell the driver that the firmware is screwing things up] > Thanks Will. > On Sat, Jul 04, 2020 at 02:28:09PM +0200, Konrad Dybcio wrote: > > This adds

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-07-01 Thread Bjorn Andersson
On Wed 03 Jun 04:00 PDT 2020, Robin Murphy wrote: > On 2020-06-02 07:32, Bjorn Andersson wrote: > > On Wed 27 May 04:03 PDT 2020, Will Deacon wrote: > > > > > Hi John, Bjorn, > > > > > > On Tue, May 26, 2020 at 01:34:45PM -0700, John Stultz wrote: >

Re: [RFC][PATCH 4/5] pinctrl: qcom: Allow pinctrl-msm code to be loadable as a module

2020-06-21 Thread Bjorn Andersson
SCM || QCOM_SCM=n" on all entries in the Kconfig that selects PINCTRL_MSM, or switch PINCTRL_MSM to be user selectable and make all the others depend on it. > Cc: Andy Gross > Cc: Bjorn Andersson > Cc: Joerg Roedel > Cc: Thomas Gleixner > Cc: Jason Cooper > Cc: Marc

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-06-03 Thread Bjorn Andersson
On Wed 03 Jun 03:24 PDT 2020, Thierry Reding wrote: > On Tue, Jun 02, 2020 at 12:32:49PM -0700, Bjorn Andersson wrote: > > On Tue 02 Jun 04:02 PDT 2020, Thierry Reding wrote: > > > > > On Wed, May 27, 2020 at 12:03:44PM +0100, Will Deacon wrote: > > > > Hi

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-06-03 Thread Bjorn Andersson
On Wed 03 Jun 04:11 PDT 2020, Will Deacon wrote: > On Mon, Jun 01, 2020 at 11:32:10PM -0700, Bjorn Andersson wrote: > > On Wed 27 May 04:03 PDT 2020, Will Deacon wrote: > > > > > Hi John, Bjorn, > > > > > > On Tue, May 26, 2020 at 01:34:45PM -0700,

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-06-02 Thread Bjorn Andersson
> > > > > On Thu 27 Feb 18:57 PST 2020, Bjorn Andersson wrote: > > > > > > > > Rob, Will, we're reaching the point where upstream has enough > > > > functionality that this is becoming a critical issue for us. > > > > > > >

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-06-02 Thread Bjorn Andersson
On Wed 27 May 04:03 PDT 2020, Will Deacon wrote: > Hi John, Bjorn, > > On Tue, May 26, 2020 at 01:34:45PM -0700, John Stultz wrote: > > On Thu, May 14, 2020 at 12:34 PM wrote: > > > > > > On Thu 27 Feb 18:57 PST 2020, Bjorn Andersson wrote: > > > >

Re: [PATCH v2] iommu/qcom: add optional 'tbu' clock for TLB invalidate

2020-05-18 Thread Bjorn Andersson
tional clock, so that platforms that have this > clock can pass it over DT. > > While adding the third clock, let's switch to bulk clk API to simplify > the enable/disable calls. clk_bulk_get() cannot used because the > existing two clocks are required while the new one is optio

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-05-14 Thread bjorn . andersson
On Thu 27 Feb 18:57 PST 2020, Bjorn Andersson wrote: Rob, Will, we're reaching the point where upstream has enough functionality that this is becoming a critical issue for us. E.g. Lenovo Yoga C630 is lacking this and a single dts patch to boot mainline with display, GPU, WiFi and audio working

Re: [PATCH] iommu/qcom: add optional clock for TLB invalidate

2020-05-14 Thread Bjorn Andersson
On Thu 14 May 07:39 PDT 2020, Shawn Guo wrote: > Hi Bjorn, > > On Mon, May 11, 2020 at 10:52:42PM -0700, Bjorn Andersson wrote: > > On Sat 09 May 06:08 PDT 2020, Shawn Guo wrote: > > > > > On some SoCs like MSM8939 with A405 adreno, there is a gfx_tbu clock > &

Re: [PATCH] iommu/qcom: add optional clock for TLB invalidate

2020-05-12 Thread Bjorn Andersson
On Sat 09 May 06:08 PDT 2020, Shawn Guo wrote: > On some SoCs like MSM8939 with A405 adreno, there is a gfx_tbu clock > needs to be on while doing TLB invalidate. Otherwise, TLBSYNC status > will not be correctly reflected, causing the system to go into a bad > state. Add it as an optional

Re: [PATCH -next] iommu/msm: Make msm_iommu_lock static

2020-05-11 Thread Bjorn Andersson
On Mon 11 May 19:17 PDT 2020, Samuel Zou wrote: > Fix the following sparse warning: > > drivers/iommu/msm_iommu.c:37:1: warning: symbol 'msm_iommu_lock' was not > declared. > > The msm_iommu_lock has only call site within msm_iommu.c > It should be static > Revi

Re: [PATCH v6] iommu/arm-smmu-qcom: Request direct mapping for modem device

2020-05-11 Thread Bjorn Andersson
programming the modem SIDs to the > kernel. Let's add compatibles here so that we can have the kernel > program the SIDs for the modem in these cases. > Reviewed-by: Bjorn Andersson Regards, Bjorn > Signed-off-by: Sibi Sankar > --- > > V6 > * Rebased on Will's fo

Re: [PATCH v2]iommu/qcom:fix local_base status check

2020-04-19 Thread Bjorn Andersson
On Sat 18 Apr 06:47 PDT 2020, Tang Bin wrote: > The function qcom_iommu_device_probe() does not perform sufficient > error checking after executing devm_ioremap_resource(), which can > result in crashes if a critical error path is encountered. > Thanks, that's much better. Review

Re: [PATCH] iommu/qcom:fix local_base status check

2020-04-02 Thread Bjorn Andersson
On Wed 01 Apr 23:33 PDT 2020, Tang Bin wrote: > Release resources when exiting on error. > Reviewed-by: Bjorn Andersson Regards, Bjorn > Signed-off-by: Tang Bin > --- > drivers/iommu/qcom_iommu.c | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > di

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-02-27 Thread Bjorn Andersson
On Mon 09 Dec 07:07 PST 2019, Thierry Reding wrote: > From: Thierry Reding > Sorry for the slow response on this, finally got the time to go through this in detail and try it out on some Qualcomm boards. > On some platforms, the firmware will setup hardware to read from a given > region of

Re: [PATCH 1/2] iommu: arm-smmu-impl: Convert to a generic reset implementation

2020-02-08 Thread Bjorn Andersson
on. Also add SC7180 SMMU > compatible for calling into QCOM specific implementation. > > Signed-off-by: Sai Prakash Ranjan Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/iommu/arm-smmu-impl.c | 8 +--- > drivers/iommu/arm-smmu-qcom.c | 16 +--- >

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-01-13 Thread Bjorn Andersson
On Mon 13 Jan 14:01 PST 2020, Saravana Kannan wrote: > I added everyone from the other thread, but somehow managed to miss > the Bjorn who sent the emails! Fixing that now. > Thanks for looping me in Saravana. > On Mon, Jan 13, 2020 at 6:07 AM Thierry Reding > wrote: > > > > On Fri, Jan 10,

[PATCH 2/3] iommu/arm-smmu: Expose s2cr and smr structs to impl

2019-12-26 Thread Bjorn Andersson
Move the arm_smmu_s2cr and arm_smmu_smr structs to the internal header file, in order to expose them to the platform specific arm-smmu implementations. Signed-off-by: Bjorn Andersson --- Changes since RFC: - New patch drivers/iommu/arm-smmu.c | 14 -- drivers/iommu/arm-smmu.h | 14

[PATCH 0/3] iommu/arm-smmu: Qualcomm bootsplash/efifb

2019-12-26 Thread Bjorn Andersson
then involves the rebase and migration of the read-back code to the Qualcomm specific implementation, the mapping is maintained indefinitely - to handle probe deferring clients - and rewritten commit messages. [1] https://lore.kernel.org/linux-arm-msm/20190605210856.20677-1-bjorn.anders...@linaro.org/ Bjorn

[PATCH 3/3] iommu/arm-smmu: Allow inherting stream mapping from bootloader

2019-12-26 Thread Bjorn Andersson
the code to the Qualcomm implementation for reading out the stream mapping from the bootloader, with the result of maintaining the display hardware's access to DDR until the context bank is enabled. Heavily based on downstream implementation by Patrick Daly . Signed-off-by: Bjorn Andersson --- Changes

[PATCH 1/3] iommu/arm-smmu: Don't blindly use first SMR to calculate mask

2019-12-26 Thread Bjorn Andersson
With the SMRs inherited from the bootloader the first SMR might actually be valid and in use. As such probing the SMR mask using the first SMR might break a stream in use. Search for an unused stream and use this to probe the SMR mask. Signed-off-by: Bjorn Andersson --- Changes since RFC

Re: [PATCHv7 0/3] QCOM smmu-500 wait-for-safe handling for sdm845

2019-11-04 Thread Bjorn Andersson
t; > > > comment > > > > on this. > > > > > > The rumors of my demise have been greatly exaggerated. All kidding > > > aside, I > > > ack'ed both. Bjorn will indeed be coming on as a co-maintener at some > > > point. > >

Re: [PATCHv7 3/3] iommu: arm-smmu-impl: Add sdm845 implementation hook

2019-10-04 Thread Bjorn Andersson
ime dd if=/dev/sda of=/dev/zero bs=1048576 count=300 conv=sync > 300+0 records in > 300+0 records out > 314572800 bytes (300.0MB) copied, 1.030541 seconds, 291.1MB/s > real 0m 1.03s > user0m 0.00s > sys 0m 0.54s > > Signed-off-by: Vivek Gautam > Reviewed-by: R

Re: [PATCH v4 0/7] Add support for QCOM IOMMU v2 and 500

2019-10-04 Thread Bjorn Andersson
On Tue 01 Oct 15:01 PDT 2019, khol...@gmail.com wrote: > From: AngeloGioacchino Del Regno > > Some Qualcomm Family-B SoCs have got a different version of the QCOM > IOMMU, specifically v2 and 500, which perfectly adhere to the current > qcom_iommu driver, but need some variations due to

Re: [PATCHv6 3/3] iommu: arm-smmu-impl: Add sdm845 implementation hook

2019-09-18 Thread Bjorn Andersson
On Tue 17 Sep 02:45 PDT 2019, Sai Prakash Ranjan wrote: > From: Vivek Gautam > > Add reset hook for sdm845 based platforms to turn off > the wait-for-safe sequence. > > Understanding how wait-for-safe logic affects USB and UFS performance > on MTP845 and DB845 boards: > > Qcom's

Re: [PATCH 3/4] remoteproc: don't allow modular build

2019-09-03 Thread Bjorn Andersson
; can remove the dma_declare_coherent_memory export and prevent other > drivers from "accidentally" using it like remoteproc. Note that the > driver would also leak the declared coherent memory on unload if it > actually was built as a module at the moment. > > Signed-off-by: C

Re: [PATCH v3 4/4] arm64: dts/sdm845: Enable FW implemented safe sequence handler on MTP

2019-08-11 Thread Bjorn Andersson
On Sun 11 Aug 09:08 PDT 2019, Vivek Gautam wrote: > On Tue, Aug 6, 2019 at 3:56 AM Bjorn Andersson > wrote: > > > > On Wed 12 Jun 00:15 PDT 2019, Vivek Gautam wrote: > > > > > Indicate on MTP SDM845 that firmware implements handler to > > > TLB inval

Re: [PATCH v3 1/4] firmware: qcom_scm-64: Add atomic version of qcom_scm_call

2019-08-05 Thread Bjorn Andersson
8191b38ef086274943f353ea7") > > > > > > Signed-off-by: Vivek Gautam > > > Reviewed-by: Bjorn Andersson > > > --- > > > drivers/firmware/qcom_scm-64.c | 136 > > > - > > > 1 file changed, 92

Re: [PATCH v3 4/4] arm64: dts/sdm845: Enable FW implemented safe sequence handler on MTP

2019-08-05 Thread Bjorn Andersson
On Wed 12 Jun 00:15 PDT 2019, Vivek Gautam wrote: > Indicate on MTP SDM845 that firmware implements handler to > TLB invalidate erratum SCM call where SAFE sequence is toggled > to achieve optimum performance on real-time clients, such as > display and camera. > > Signed-off-by: Vivek Gautam >

Re: [PATCH v2 1/2] arm64: dts: qcom: msm8998: Add ANOC1 SMMU node

2019-06-17 Thread Bjorn Andersson
On Mon 01 Apr 08:40 PDT 2019, Marc Gonzalez wrote: > The MSM8998 ANOC1(*) SMMU services BLSP2, PCIe, UFS, and USB. > (*) Aggregate Network-on-Chip #1 > > Based on the following DTS downstream: >

Re: [PATCH v3 4/4] arm64: dts/sdm845: Enable FW implemented safe sequence handler on MTP

2019-06-13 Thread Bjorn Andersson
f-by: Vivek Gautam Reviewed-by: Bjorn Andersson > --- > arch/arm64/boot/dts/qcom/sdm845.dtsi | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi > b/arch/arm64/boot/dts/qcom/sdm845.dtsi > index 78ec373a2b18..6a73d9744a71 100644 >

Re: [PATCH v3 3/4] iommu/arm-smmu: Add support to handle Qcom's wait-for-safe logic

2019-06-13 Thread Bjorn Andersson
mu-500") > && > + smmu->options & ARM_SMMU_OPT_QCOM_FW_IMPL_SAFE_ERRATA) { > + err = qcom_scm_qsmmu500_wait_safe_toggle(0); > + if (err) > + dev_warn(dev, "Failed to turn off SAFE logic\n"); > +

  1   2   >