* [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables
@ 2020-08-17 22:01 Rob Clark
2020-08-17 22:01 ` [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU Rob Clark
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Rob Clark @ 2020-08-17 22:01 UTC (permalink / raw)
To: dri-devel, iommu, linux-arm-msm
Cc: Sai Prakash Ranjan, Will Deacon, freedreno, Bjorn Andersson,
Sibi Sankar, Vivek Gautam, Stephen Boyd, Robin Murphy,
Joerg Roedel, Rob Clark, Akhil P Oommen,
AngeloGioacchino Del Regno, Ben Dooks, Brian Masney,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Emil Velikov, Eric Anholt, Greg Kroah-Hartman, Hanna Hawa,
Joerg Roedel, John Stultz, Jonathan Marek, Jon Hunter,
Jordan Crouse, Krishna Reddy, moderated list:ARM SMMU DRIVERS,
open list, Nicolin Chen, Pritesh Raithatha, Sam Ravnborg,
Sharat Masetty, Shawn Guo, Takashi Iwai, Thierry Reding,
Thierry Reding, Wambui Karuga
From: Rob Clark <robdclark@chromium.org>
This series adds an Adreno SMMU implementation to arm-smmu to allow GPU hardware
pagetable switching.
The Adreno GPU has built in capabilities to switch the TTBR0 pagetable during
runtime to allow each individual instance or application to have its own
pagetable. In order to take advantage of the HW capabilities there are certain
requirements needed of the SMMU hardware.
This series adds support for an Adreno specific arm-smmu implementation. The new
implementation 1) ensures that the GPU domain is always assigned context bank 0,
2) enables split pagetable support (TTBR1) so that the instance specific
pagetable can be swapped while the global memory remains in place and 3) shares
the current pagetable configuration with the GPU driver to allow it to create
its own io-pgtable instances.
The series then adds the drm/msm code to enable these features. For targets that
support it allocate new pagetables using the io-pgtable configuration shared by
the arm-smmu driver and swap them in during runtime.
This version of the series merges the previous patchset(s) [1] and [2]
with the following improvements:
v14: (Respin by Rob)
- Minor update to 16/20 (only force ASID to zero in one place)
- Addition of sc7180 dtsi patch.
v13: (Respin by Rob)
- Switch to a private interface between adreno-smmu and GPU driver,
dropping the custom domain attr (Will Deacon)
- Rework the SCTLR.HUPCF patch to add new fields in smmu_domain->cfg
rather than adding new impl hook (Will Deacon)
- Drop for_each_cfg_sme() in favor of plain for() loop (Will Deacon)
- Fix context refcnt'ing issue which was causing problems with GPU
crash recover stress testing.
- Spiff up $debugfs/gem to show process information associated with
VMAs
v12:
- Nitpick cleanups in gpu/drm/msm/msm_iommu.c (Rob Clark)
- Reorg in gpu/drm/msm/msm_gpu.c (Rob Clark)
- Use the default asid for the context bank so that iommu_tlb_flush_all works
- Flush the UCHE after a page switch
- Add the SCTLR.HUPCF patch at the end of the series
v11:
- Add implementation specific get_attr/set_attr functions (per Rob Clark)
- Fix context bank allocation (per Bjorn Andersson)
v10:
- arm-smmu: add implementation hook to allocate context banks
- arm-smmu: Match the GPU domain by stream ID instead of compatible string
- arm-smmu: Make DOMAIN_ATTR_PGTABLE_CFG bi-directional. The leaf driver
queries the configuration to create a pagetable and then sends the newly
created configuration back to the smmu-driver to enable TTBR0
- drm/msm: Add context reference counting for submissions
- drm/msm: Use dummy functions to skip TLB operations on per-instance
pagetables
[1] https://lists.linuxfoundation.org/pipermail/iommu/2020-June/045653.html
[2] https://lists.linuxfoundation.org/pipermail/iommu/2020-June/045659.html
Jordan Crouse (12):
iommu/arm-smmu: Pass io-pgtable config to implementation specific
function
iommu/arm-smmu: Add support for split pagetables
iommu/arm-smmu: Prepare for the adreno-smmu implementation
iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU
dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
drm/msm: Add a context pointer to the submitqueue
drm/msm: Drop context arg to gpu->submit()
drm/msm: Set the global virtual address range from the IOMMU domain
drm/msm: Add support to create a local pagetable
drm/msm: Add support for private address space instances
drm/msm/a6xx: Add support for per-instance pagetables
arm: dts: qcom: sm845: Set the compatible string for the GPU SMMU
Rob Clark (8):
drm/msm: remove dangling submitqueue references
iommu: add private interface for adreno-smmu
drm/msm/gpu: add dev_to_gpu() helper
drm/msm: set adreno_smmu as gpu's drvdata
iommu/arm-smmu: constify some helpers
arm: dts: qcom: sc7180: Set the compatible string for the GPU SMMU
iommu/arm-smmu: add a way for implementations to influence SCTLR
drm/msm: show process names in gem_describe
.../devicetree/bindings/iommu/arm,smmu.yaml | 4 +
arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +-
arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 +-
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 12 +-
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 68 +++++-
drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 1 +
drivers/gpu/drm/msm/adreno/adreno_device.c | 12 +-
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 18 +-
drivers/gpu/drm/msm/adreno/adreno_gpu.h | 3 +-
drivers/gpu/drm/msm/msm_drv.c | 16 +-
drivers/gpu/drm/msm/msm_drv.h | 25 +++
drivers/gpu/drm/msm/msm_gem.c | 25 ++-
drivers/gpu/drm/msm/msm_gem.h | 6 +
drivers/gpu/drm/msm/msm_gem_submit.c | 8 +-
drivers/gpu/drm/msm/msm_gem_vma.c | 10 +
drivers/gpu/drm/msm/msm_gpu.c | 41 +++-
drivers/gpu/drm/msm/msm_gpu.h | 21 +-
drivers/gpu/drm/msm/msm_gpummu.c | 2 +-
drivers/gpu/drm/msm/msm_iommu.c | 206 +++++++++++++++++-
drivers/gpu/drm/msm/msm_mmu.h | 16 +-
drivers/gpu/drm/msm/msm_ringbuffer.h | 1 +
drivers/gpu/drm/msm/msm_submitqueue.c | 7 +-
drivers/iommu/arm/arm-smmu/arm-smmu-impl.c | 6 +-
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 155 ++++++++++++-
drivers/iommu/arm/arm-smmu/arm-smmu.c | 102 ++++-----
drivers/iommu/arm/arm-smmu/arm-smmu.h | 87 +++++++-
include/linux/adreno-smmu-priv.h | 36 +++
27 files changed, 759 insertions(+), 133 deletions(-)
create mode 100644 include/linux/adreno-smmu-priv.h
--
2.26.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
2020-08-17 22:01 [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables Rob Clark
@ 2020-08-17 22:01 ` Rob Clark
2020-08-19 17:02 ` Doug Anderson
2020-08-17 22:01 ` [PATCH 17/20] arm: dts: qcom: sm845: Set the compatible string for the " Rob Clark
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Rob Clark @ 2020-08-17 22:01 UTC (permalink / raw)
To: dri-devel, iommu, linux-arm-msm
Cc: Sai Prakash Ranjan, Will Deacon, freedreno, Bjorn Andersson,
Sibi Sankar, Vivek Gautam, Stephen Boyd, Robin Murphy,
Joerg Roedel, Jordan Crouse, Rob Herring, Rob Clark, Rob Herring,
moderated list:ARM SMMU DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
From: Jordan Crouse <jcrouse@codeaurora.org>
Every Qcom Adreno GPU has an embedded SMMU for its own use. These
devices depend on unique features such as split pagetables,
different stall/halt requirements and other settings. Identify them
with a compatible string so that they can be identified in the
arm-smmu implementation specific code.
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index 503160a7b9a0..5ec5d0d691f6 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -40,6 +40,10 @@ properties:
- qcom,sm8150-smmu-500
- qcom,sm8250-smmu-500
- const: arm,mmu-500
+ - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
+ items:
+ - const: qcom,adreno-smmu
+ - const: qcom,smmu-v2
- description: Marvell SoCs implementing "arm,mmu-500"
items:
- const: marvell,ap806-smmu-500
--
2.26.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 17/20] arm: dts: qcom: sm845: Set the compatible string for the GPU SMMU
2020-08-17 22:01 [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables Rob Clark
2020-08-17 22:01 ` [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU Rob Clark
@ 2020-08-17 22:01 ` Rob Clark
2020-08-17 22:01 ` [PATCH 18/20] arm: dts: qcom: sc7180: " Rob Clark
2020-09-04 9:11 ` [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables Joerg Roedel
3 siblings, 0 replies; 11+ messages in thread
From: Rob Clark @ 2020-08-17 22:01 UTC (permalink / raw)
To: dri-devel, iommu, linux-arm-msm
Cc: Sai Prakash Ranjan, Will Deacon, freedreno, Bjorn Andersson,
Sibi Sankar, Vivek Gautam, Stephen Boyd, Robin Murphy,
Joerg Roedel, Jordan Crouse, Rob Clark, Andy Gross, Rob Herring,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
From: Jordan Crouse <jcrouse@codeaurora.org>
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 <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index 2884577dcb77..6a9adaa401a9 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -4058,7 +4058,7 @@ opp-257000000 {
};
adreno_smmu: iommu@5040000 {
- compatible = "qcom,sdm845-smmu-v2", "qcom,smmu-v2";
+ compatible = "qcom,adreno-smmu", "qcom,smmu-v2";
reg = <0 0x5040000 0 0x10000>;
#iommu-cells = <1>;
#global-interrupts = <2>;
--
2.26.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 18/20] arm: dts: qcom: sc7180: Set the compatible string for the GPU SMMU
2020-08-17 22:01 [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables Rob Clark
2020-08-17 22:01 ` [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU Rob Clark
2020-08-17 22:01 ` [PATCH 17/20] arm: dts: qcom: sm845: Set the compatible string for the " Rob Clark
@ 2020-08-17 22:01 ` Rob Clark
2020-09-04 9:11 ` [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables Joerg Roedel
3 siblings, 0 replies; 11+ messages in thread
From: Rob Clark @ 2020-08-17 22:01 UTC (permalink / raw)
To: dri-devel, iommu, linux-arm-msm
Cc: Sai Prakash Ranjan, Will Deacon, freedreno, Bjorn Andersson,
Sibi Sankar, Vivek Gautam, Stephen Boyd, Robin Murphy,
Joerg Roedel, Rob Clark, Andy Gross, Rob Herring,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
From: Rob Clark <robdclark@chromium.org>
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: Rob Clark <robdclark@chromium.org>
---
arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index d46b3833e52f..61ae67186691 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -1937,7 +1937,7 @@ opp-180000000 {
};
adreno_smmu: iommu@5040000 {
- compatible = "qcom,sc7180-smmu-v2", "qcom,smmu-v2";
+ compatible = "qcom,adreno-smmu", "qcom,smmu-v2";
reg = <0 0x05040000 0 0x10000>;
#iommu-cells = <1>;
#global-interrupts = <2>;
--
2.26.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
2020-08-17 22:01 ` [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU Rob Clark
@ 2020-08-19 17:02 ` Doug Anderson
2020-08-19 17:36 ` Rob Clark
0 siblings, 1 reply; 11+ messages in thread
From: Doug Anderson @ 2020-08-19 17:02 UTC (permalink / raw)
To: Rob Clark
Cc: dri-devel,
list@263.net:IOMMU DRIVERS <iommu@lists.linux-foundation.org>, Joerg Roedel <joro@8bytes.org>,,
linux-arm-msm, Sai Prakash Ranjan, Will Deacon, freedreno,
Bjorn Andersson, Sibi Sankar, Vivek Gautam, Stephen Boyd,
Robin Murphy, Joerg Roedel, Jordan Crouse, Rob Herring, Rob Clark,
Rob Herring, moderated list:ARM SMMU DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
Hi,
On Mon, Aug 17, 2020 at 3:03 PM Rob Clark <robdclark@gmail.com> wrote:
>
> From: Jordan Crouse <jcrouse@codeaurora.org>
>
> Every Qcom Adreno GPU has an embedded SMMU for its own use. These
> devices depend on unique features such as split pagetables,
> different stall/halt requirements and other settings. Identify them
> with a compatible string so that they can be identified in the
> arm-smmu implementation specific code.
>
> Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
> Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> index 503160a7b9a0..5ec5d0d691f6 100644
> --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> @@ -40,6 +40,10 @@ properties:
> - qcom,sm8150-smmu-500
> - qcom,sm8250-smmu-500
> - const: arm,mmu-500
> + - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
> + items:
> + - const: qcom,adreno-smmu
> + - const: qcom,smmu-v2
I know I'm kinda late to the game, but this seems weird to me,
especially given the later patches in the series like:
https://lore.kernel.org/r/20200817220238.603465-19-robdclark@gmail.com
Specifically in that patch you can see that this IOMMU already had a
compatible string and we're changing it and throwing away the
model-specific string? I'm guessing that you're just trying to make
it easier for code to identify the adreno iommu, but it seems like a
better way would have been to just add the adreno compatible in the
middle, like:
- description: Qcom Adreno GPUs implementing "arm,smmu-v2"
items:
- enum:
- qcom,msm8996-smmu-v2
- qcom,msm8998-smmu-v2
- qcom,sc7180-smmu-v2
- qcom,sdm845-smmu-v2
- const: qcom,adreno-smmu
- const: qcom,smmu-v2
Then we still have the SoC-specific compatible string in case we need
it but we also have the generic one? It also means that we're not
deleting the old compatible string...
-Doug
> - description: Marvell SoCs implementing "arm,mmu-500"
> items:
> - const: marvell,ap806-smmu-500
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
2020-08-19 17:02 ` Doug Anderson
@ 2020-08-19 17:36 ` Rob Clark
2020-08-19 18:20 ` Doug Anderson
2020-08-21 14:39 ` Jordan Crouse
0 siblings, 2 replies; 11+ messages in thread
From: Rob Clark @ 2020-08-19 17:36 UTC (permalink / raw)
To: Doug Anderson
Cc: dri-devel,
list@263.net:IOMMU DRIVERS <iommu@lists.linux-foundation.org>, Joerg Roedel <joro@8bytes.org>,,
linux-arm-msm, Sai Prakash Ranjan, Will Deacon, freedreno,
Bjorn Andersson, Sibi Sankar, Vivek Gautam, Stephen Boyd,
Robin Murphy, Joerg Roedel, Jordan Crouse, Rob Herring, Rob Clark,
Rob Herring, moderated list:ARM SMMU DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
On Wed, Aug 19, 2020 at 10:03 AM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Mon, Aug 17, 2020 at 3:03 PM Rob Clark <robdclark@gmail.com> wrote:
> >
> > From: Jordan Crouse <jcrouse@codeaurora.org>
> >
> > Every Qcom Adreno GPU has an embedded SMMU for its own use. These
> > devices depend on unique features such as split pagetables,
> > different stall/halt requirements and other settings. Identify them
> > with a compatible string so that they can be identified in the
> > arm-smmu implementation specific code.
> >
> > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > Reviewed-by: Rob Herring <robh@kernel.org>
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > ---
> > Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> > index 503160a7b9a0..5ec5d0d691f6 100644
> > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> > @@ -40,6 +40,10 @@ properties:
> > - qcom,sm8150-smmu-500
> > - qcom,sm8250-smmu-500
> > - const: arm,mmu-500
> > + - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
> > + items:
> > + - const: qcom,adreno-smmu
> > + - const: qcom,smmu-v2
>
> I know I'm kinda late to the game, but this seems weird to me,
> especially given the later patches in the series like:
>
> https://lore.kernel.org/r/20200817220238.603465-19-robdclark@gmail.com
>
> Specifically in that patch you can see that this IOMMU already had a
> compatible string and we're changing it and throwing away the
> model-specific string? I'm guessing that you're just trying to make
> it easier for code to identify the adreno iommu, but it seems like a
> better way would have been to just add the adreno compatible in the
> middle, like:
>
> - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
> items:
> - enum:
> - qcom,msm8996-smmu-v2
> - qcom,msm8998-smmu-v2
> - qcom,sc7180-smmu-v2
> - qcom,sdm845-smmu-v2
> - const: qcom,adreno-smmu
> - const: qcom,smmu-v2
>
> Then we still have the SoC-specific compatible string in case we need
> it but we also have the generic one? It also means that we're not
> deleting the old compatible string...
I did bring up the thing about removing the compat string in an
earlier revision of the series.. but then we realized that
qcom,sc7180-smmu-v2 was never actually used anywhere.
But I guess we could: compatible = "qcom,sc7180-smmu-v2",
"qcom,adreno-smmu", "qcom,smmu-v2";
BR,
-R
>
> -Doug
>
>
> > - description: Marvell SoCs implementing "arm,mmu-500"
> > items:
> > - const: marvell,ap806-smmu-500
> > --
> > 2.26.2
> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
2020-08-19 17:36 ` Rob Clark
@ 2020-08-19 18:20 ` Doug Anderson
2020-08-21 14:39 ` Jordan Crouse
1 sibling, 0 replies; 11+ messages in thread
From: Doug Anderson @ 2020-08-19 18:20 UTC (permalink / raw)
To: Rob Clark
Cc: dri-devel,
list@263.net:IOMMU DRIVERS <iommu@lists.linux-foundation.org>, Joerg Roedel <joro@8bytes.org>,,
linux-arm-msm, Sai Prakash Ranjan, Will Deacon, freedreno,
Bjorn Andersson, Sibi Sankar, Vivek Gautam, Stephen Boyd,
Robin Murphy, Joerg Roedel, Jordan Crouse, Rob Herring, Rob Clark,
Rob Herring, moderated list:ARM SMMU DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
Hi,
On Wed, Aug 19, 2020 at 10:36 AM Rob Clark <robdclark@gmail.com> wrote:
>
> On Wed, Aug 19, 2020 at 10:03 AM Doug Anderson <dianders@chromium.org> wrote:
> >
> > Hi,
> >
> > On Mon, Aug 17, 2020 at 3:03 PM Rob Clark <robdclark@gmail.com> wrote:
> > >
> > > From: Jordan Crouse <jcrouse@codeaurora.org>
> > >
> > > Every Qcom Adreno GPU has an embedded SMMU for its own use. These
> > > devices depend on unique features such as split pagetables,
> > > different stall/halt requirements and other settings. Identify them
> > > with a compatible string so that they can be identified in the
> > > arm-smmu implementation specific code.
> > >
> > > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > > Reviewed-by: Rob Herring <robh@kernel.org>
> > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > > ---
> > > Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> > > index 503160a7b9a0..5ec5d0d691f6 100644
> > > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> > > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> > > @@ -40,6 +40,10 @@ properties:
> > > - qcom,sm8150-smmu-500
> > > - qcom,sm8250-smmu-500
> > > - const: arm,mmu-500
> > > + - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
> > > + items:
> > > + - const: qcom,adreno-smmu
> > > + - const: qcom,smmu-v2
> >
> > I know I'm kinda late to the game, but this seems weird to me,
> > especially given the later patches in the series like:
> >
> > https://lore.kernel.org/r/20200817220238.603465-19-robdclark@gmail.com
> >
> > Specifically in that patch you can see that this IOMMU already had a
> > compatible string and we're changing it and throwing away the
> > model-specific string? I'm guessing that you're just trying to make
> > it easier for code to identify the adreno iommu, but it seems like a
> > better way would have been to just add the adreno compatible in the
> > middle, like:
> >
> > - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
> > items:
> > - enum:
> > - qcom,msm8996-smmu-v2
> > - qcom,msm8998-smmu-v2
> > - qcom,sc7180-smmu-v2
> > - qcom,sdm845-smmu-v2
> > - const: qcom,adreno-smmu
> > - const: qcom,smmu-v2
> >
> > Then we still have the SoC-specific compatible string in case we need
> > it but we also have the generic one? It also means that we're not
> > deleting the old compatible string...
>
> I did bring up the thing about removing the compat string in an
> earlier revision of the series.. but then we realized that
> qcom,sc7180-smmu-v2 was never actually used anywhere.
Right, so at least there's not going to be weird issues where landing
the dts before the code change will break anything.
> But I guess we could: compatible = "qcom,sc7180-smmu-v2",
> "qcom,adreno-smmu", "qcom,smmu-v2";
Yeah, that was what I was suggesting.
-Doug
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
2020-08-19 17:36 ` Rob Clark
2020-08-19 18:20 ` Doug Anderson
@ 2020-08-21 14:39 ` Jordan Crouse
1 sibling, 0 replies; 11+ messages in thread
From: Jordan Crouse @ 2020-08-21 14:39 UTC (permalink / raw)
To: Rob Clark
Cc: Doug Anderson, dri-devel,
list@263.net:IOMMU DRIVERS <iommu@lists.linux-foundation.org>, Joerg Roedel <joro@8bytes.org>,,
linux-arm-msm, Sai Prakash Ranjan, Will Deacon, freedreno,
Bjorn Andersson, Sibi Sankar, Vivek Gautam, Stephen Boyd,
Robin Murphy, Joerg Roedel, Rob Herring, Rob Clark, Rob Herring,
moderated list:ARM SMMU DRIVERS,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list
On Wed, Aug 19, 2020 at 10:36:38AM -0700, Rob Clark wrote:
> On Wed, Aug 19, 2020 at 10:03 AM Doug Anderson <dianders@chromium.org> wrote:
> >
> > Hi,
> >
> > On Mon, Aug 17, 2020 at 3:03 PM Rob Clark <robdclark@gmail.com> wrote:
> > >
> > > From: Jordan Crouse <jcrouse@codeaurora.org>
> > >
> > > Every Qcom Adreno GPU has an embedded SMMU for its own use. These
> > > devices depend on unique features such as split pagetables,
> > > different stall/halt requirements and other settings. Identify them
> > > with a compatible string so that they can be identified in the
> > > arm-smmu implementation specific code.
> > >
> > > Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
> > > Reviewed-by: Rob Herring <robh@kernel.org>
> > > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > > ---
> > > Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> > > index 503160a7b9a0..5ec5d0d691f6 100644
> > > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> > > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
> > > @@ -40,6 +40,10 @@ properties:
> > > - qcom,sm8150-smmu-500
> > > - qcom,sm8250-smmu-500
> > > - const: arm,mmu-500
> > > + - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
> > > + items:
> > > + - const: qcom,adreno-smmu
> > > + - const: qcom,smmu-v2
> >
> > I know I'm kinda late to the game, but this seems weird to me,
> > especially given the later patches in the series like:
> >
> > https://lore.kernel.org/r/20200817220238.603465-19-robdclark@gmail.com
> >
> > Specifically in that patch you can see that this IOMMU already had a
> > compatible string and we're changing it and throwing away the
> > model-specific string? I'm guessing that you're just trying to make
> > it easier for code to identify the adreno iommu, but it seems like a
> > better way would have been to just add the adreno compatible in the
> > middle, like:
> >
> > - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
> > items:
> > - enum:
> > - qcom,msm8996-smmu-v2
> > - qcom,msm8998-smmu-v2
> > - qcom,sc7180-smmu-v2
> > - qcom,sdm845-smmu-v2
> > - const: qcom,adreno-smmu
> > - const: qcom,smmu-v2
> >
> > Then we still have the SoC-specific compatible string in case we need
> > it but we also have the generic one? It also means that we're not
> > deleting the old compatible string...
>
> I did bring up the thing about removing the compat string in an
> earlier revision of the series.. but then we realized that
> qcom,sc7180-smmu-v2 was never actually used anywhere.
>
> But I guess we could: compatible = "qcom,sc7180-smmu-v2",
> "qcom,adreno-smmu", "qcom,smmu-v2";
I think the SoC specific string is intended for the "other" SMMU that everybody
else uses. Rarely would a workaround for that SMMU affect the GPU and vice
versa. Since these are the bindings it doesn't hurt to allow for the possibility
but I would be surprised if the occasion presented itself.
Jordan
> BR,
> -R
>
>
>
>
> >
> > -Doug
> >
> >
> > > - description: Marvell SoCs implementing "arm,mmu-500"
> > > items:
> > > - const: marvell,ap806-smmu-500
> > > --
> > > 2.26.2
> > >
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables
@ 2020-08-24 18:37 Rob Clark
0 siblings, 0 replies; 11+ messages in thread
From: Rob Clark @ 2020-08-24 18:37 UTC (permalink / raw)
To: dri-devel, iommu
Cc: Sai Prakash Ranjan, Will Deacon, freedreno, Bjorn Andersson,
Sibi Sankar, Vivek Gautam, Stephen Boyd, Robin Murphy,
Joerg Roedel, Rob Clark, Akhil P Oommen,
AngeloGioacchino Del Regno, Ben Dooks, Brian Masney, Eric Anholt,
Joerg Roedel, John Stultz, Jonathan Marek, Jordan Crouse,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Emil Velikov, Greg Kroah-Hartman, Hanna Hawa, Jon Hunter,
Krishna Reddy, moderated list:ARM SMMU DRIVERS,
open list:ARM/QUALCOMM SUPPORT, open list, Sam Ravnborg,
Sharat Masetty, Shawn Guo, Takashi Iwai, Thierry Reding,
Thierry Reding, Thomas Zimmermann, Wambui Karuga
From: Rob Clark <robdclark@chromium.org>
This series adds an Adreno SMMU implementation to arm-smmu to allow GPU hardware
pagetable switching.
The Adreno GPU has built in capabilities to switch the TTBR0 pagetable during
runtime to allow each individual instance or application to have its own
pagetable. In order to take advantage of the HW capabilities there are certain
requirements needed of the SMMU hardware.
This series adds support for an Adreno specific arm-smmu implementation. The new
implementation 1) ensures that the GPU domain is always assigned context bank 0,
2) enables split pagetable support (TTBR1) so that the instance specific
pagetable can be swapped while the global memory remains in place and 3) shares
the current pagetable configuration with the GPU driver to allow it to create
its own io-pgtable instances.
The series then adds the drm/msm code to enable these features. For targets that
support it allocate new pagetables using the io-pgtable configuration shared by
the arm-smmu driver and swap them in during runtime.
This version of the series merges the previous patchset(s) [1] and [2]
with the following improvements:
v15: (Respin by Rob)
- Adjust dt bindings to keep SoC specific compatible (Doug)
- Add dts workaround for cheza fw limitation
- Add missing 'select IOMMU_IO_PGTABLE' (Guenter)
v14: (Respin by Rob)
- Minor update to 16/20 (only force ASID to zero in one place)
- Addition of sc7180 dtsi patch.
v13: (Respin by Rob)
- Switch to a private interface between adreno-smmu and GPU driver,
dropping the custom domain attr (Will Deacon)
- Rework the SCTLR.HUPCF patch to add new fields in smmu_domain->cfg
rather than adding new impl hook (Will Deacon)
- Drop for_each_cfg_sme() in favor of plain for() loop (Will Deacon)
- Fix context refcnt'ing issue which was causing problems with GPU
crash recover stress testing.
- Spiff up $debugfs/gem to show process information associated with
VMAs
v12:
- Nitpick cleanups in gpu/drm/msm/msm_iommu.c (Rob Clark)
- Reorg in gpu/drm/msm/msm_gpu.c (Rob Clark)
- Use the default asid for the context bank so that iommu_tlb_flush_all works
- Flush the UCHE after a page switch
- Add the SCTLR.HUPCF patch at the end of the series
v11:
- Add implementation specific get_attr/set_attr functions (per Rob Clark)
- Fix context bank allocation (per Bjorn Andersson)
v10:
- arm-smmu: add implementation hook to allocate context banks
- arm-smmu: Match the GPU domain by stream ID instead of compatible string
- arm-smmu: Make DOMAIN_ATTR_PGTABLE_CFG bi-directional. The leaf driver
queries the configuration to create a pagetable and then sends the newly
created configuration back to the smmu-driver to enable TTBR0
- drm/msm: Add context reference counting for submissions
- drm/msm: Use dummy functions to skip TLB operations on per-instance
pagetables
[1] https://lists.linuxfoundation.org/pipermail/iommu/2020-June/045653.html
[2] https://lists.linuxfoundation.org/pipermail/iommu/2020-June/045659.html
Jordan Crouse (12):
iommu/arm-smmu: Pass io-pgtable config to implementation specific
function
iommu/arm-smmu: Add support for split pagetables
iommu/arm-smmu: Prepare for the adreno-smmu implementation
iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU
dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
drm/msm: Add a context pointer to the submitqueue
drm/msm: Drop context arg to gpu->submit()
drm/msm: Set the global virtual address range from the IOMMU domain
drm/msm: Add support to create a local pagetable
drm/msm: Add support for private address space instances
drm/msm/a6xx: Add support for per-instance pagetables
arm: dts: qcom: sm845: Set the compatible string for the GPU SMMU
Rob Clark (8):
drm/msm: remove dangling submitqueue references
iommu: add private interface for adreno-smmu
drm/msm/gpu: add dev_to_gpu() helper
drm/msm: set adreno_smmu as gpu's drvdata
iommu/arm-smmu: constify some helpers
arm: dts: qcom: sc7180: Set the compatible string for the GPU SMMU
iommu/arm-smmu: add a way for implementations to influence SCTLR
drm/msm: show process names in gem_describe
.../devicetree/bindings/iommu/arm,smmu.yaml | 9 +-
arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +-
arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi | 9 +
arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 +-
drivers/gpu/drm/msm/Kconfig | 1 +
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 12 +-
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 68 +++++-
drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 1 +
drivers/gpu/drm/msm/adreno/adreno_device.c | 12 +-
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 18 +-
drivers/gpu/drm/msm/adreno/adreno_gpu.h | 3 +-
drivers/gpu/drm/msm/msm_drv.c | 16 +-
drivers/gpu/drm/msm/msm_drv.h | 25 +++
drivers/gpu/drm/msm/msm_gem.c | 25 ++-
drivers/gpu/drm/msm/msm_gem.h | 6 +
drivers/gpu/drm/msm/msm_gem_submit.c | 8 +-
drivers/gpu/drm/msm/msm_gem_vma.c | 10 +
drivers/gpu/drm/msm/msm_gpu.c | 41 +++-
drivers/gpu/drm/msm/msm_gpu.h | 21 +-
drivers/gpu/drm/msm/msm_gpummu.c | 2 +-
drivers/gpu/drm/msm/msm_iommu.c | 206 +++++++++++++++++-
drivers/gpu/drm/msm/msm_mmu.h | 16 +-
drivers/gpu/drm/msm/msm_ringbuffer.h | 1 +
drivers/gpu/drm/msm/msm_submitqueue.c | 7 +-
drivers/iommu/arm/arm-smmu/arm-smmu-impl.c | 6 +-
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 155 ++++++++++++-
drivers/iommu/arm/arm-smmu/arm-smmu.c | 102 ++++-----
drivers/iommu/arm/arm-smmu/arm-smmu.h | 87 +++++++-
include/linux/adreno-smmu-priv.h | 36 +++
29 files changed, 772 insertions(+), 135 deletions(-)
create mode 100644 include/linux/adreno-smmu-priv.h
--
2.26.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables
2020-08-17 22:01 [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables Rob Clark
` (2 preceding siblings ...)
2020-08-17 22:01 ` [PATCH 18/20] arm: dts: qcom: sc7180: " Rob Clark
@ 2020-09-04 9:11 ` Joerg Roedel
2020-09-04 16:47 ` Rob Clark
3 siblings, 1 reply; 11+ messages in thread
From: Joerg Roedel @ 2020-09-04 9:11 UTC (permalink / raw)
To: Rob Clark
Cc: dri-devel, iommu, linux-arm-msm, Sai Prakash Ranjan, Will Deacon,
freedreno, Bjorn Andersson, Sibi Sankar, Vivek Gautam,
Stephen Boyd, Robin Murphy, Rob Clark, Akhil P Oommen,
AngeloGioacchino Del Regno, Ben Dooks, Brian Masney,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Emil Velikov, Eric Anholt, Greg Kroah-Hartman, Hanna Hawa,
Joerg Roedel, John Stultz, Jonathan Marek, Jon Hunter,
Jordan Crouse, Krishna Reddy, moderated list:ARM SMMU DRIVERS,
open list, Nicolin Chen, Pritesh Raithatha, Sam Ravnborg,
Sharat Masetty, Shawn Guo, Takashi Iwai, Thierry Reding,
Thierry Reding, Wambui Karuga
On Mon, Aug 17, 2020 at 03:01:25PM -0700, Rob Clark wrote:
> Jordan Crouse (12):
> iommu/arm-smmu: Pass io-pgtable config to implementation specific
> function
> iommu/arm-smmu: Add support for split pagetables
> iommu/arm-smmu: Prepare for the adreno-smmu implementation
> iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU
> dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
> drm/msm: Add a context pointer to the submitqueue
> drm/msm: Drop context arg to gpu->submit()
> drm/msm: Set the global virtual address range from the IOMMU domain
> drm/msm: Add support to create a local pagetable
> drm/msm: Add support for private address space instances
> drm/msm/a6xx: Add support for per-instance pagetables
> arm: dts: qcom: sm845: Set the compatible string for the GPU SMMU
>
> Rob Clark (8):
> drm/msm: remove dangling submitqueue references
> iommu: add private interface for adreno-smmu
> drm/msm/gpu: add dev_to_gpu() helper
> drm/msm: set adreno_smmu as gpu's drvdata
> iommu/arm-smmu: constify some helpers
> arm: dts: qcom: sc7180: Set the compatible string for the GPU SMMU
> iommu/arm-smmu: add a way for implementations to influence SCTLR
> drm/msm: show process names in gem_describe
Can the DRM parts be merged independently from the IOMMU parts or does
this need to be queued together? If it needs to be together I defer the
decission to Will through which tree this should go.
Joerg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables
2020-09-04 9:11 ` [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables Joerg Roedel
@ 2020-09-04 16:47 ` Rob Clark
0 siblings, 0 replies; 11+ messages in thread
From: Rob Clark @ 2020-09-04 16:47 UTC (permalink / raw)
To: Joerg Roedel
Cc: dri-devel,
list@263.net:IOMMU DRIVERS <iommu@lists.linux-foundation.org>, Joerg Roedel <joro@8bytes.org>,,
linux-arm-msm, Sai Prakash Ranjan, Will Deacon, freedreno,
Bjorn Andersson, Sibi Sankar, Vivek Gautam, Stephen Boyd,
Robin Murphy, Rob Clark, Akhil P Oommen,
AngeloGioacchino Del Regno, Ben Dooks, Brian Masney,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Emil Velikov, Eric Anholt, Greg Kroah-Hartman, Hanna Hawa,
Joerg Roedel, John Stultz, Jonathan Marek, Jon Hunter,
Jordan Crouse, Krishna Reddy, moderated list:ARM SMMU DRIVERS,
open list, Nicolin Chen, Pritesh Raithatha, Sam Ravnborg,
Sharat Masetty, Shawn Guo, Takashi Iwai, Thierry Reding,
Thierry Reding, Wambui Karuga
On Fri, Sep 4, 2020 at 2:11 AM Joerg Roedel <joro@8bytes.org> wrote:
>
> On Mon, Aug 17, 2020 at 03:01:25PM -0700, Rob Clark wrote:
> > Jordan Crouse (12):
> > iommu/arm-smmu: Pass io-pgtable config to implementation specific
> > function
> > iommu/arm-smmu: Add support for split pagetables
> > iommu/arm-smmu: Prepare for the adreno-smmu implementation
> > iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU
> > dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU
> > drm/msm: Add a context pointer to the submitqueue
> > drm/msm: Drop context arg to gpu->submit()
> > drm/msm: Set the global virtual address range from the IOMMU domain
> > drm/msm: Add support to create a local pagetable
> > drm/msm: Add support for private address space instances
> > drm/msm/a6xx: Add support for per-instance pagetables
> > arm: dts: qcom: sm845: Set the compatible string for the GPU SMMU
> >
> > Rob Clark (8):
> > drm/msm: remove dangling submitqueue references
> > iommu: add private interface for adreno-smmu
> > drm/msm/gpu: add dev_to_gpu() helper
> > drm/msm: set adreno_smmu as gpu's drvdata
> > iommu/arm-smmu: constify some helpers
> > arm: dts: qcom: sc7180: Set the compatible string for the GPU SMMU
> > iommu/arm-smmu: add a way for implementations to influence SCTLR
> > drm/msm: show process names in gem_describe
>
> Can the DRM parts be merged independently from the IOMMU parts or does
> this need to be queued together? If it needs to be together I defer the
> decission to Will through which tree this should go.
>
Hi,
v16 of this series re-ordered the patches and has some notes at the
top of the cover letter[1] about a potential way to land it.. tl;dr:
the drm parts can and adreno-smmu-priv.h can go independently of
iommu. And the first four iommu patches can go in independently of
drm. But the last two iommu patches have a dependency on the drm
patches.
Note that I'll send one more revision of the series shortly (I have a
small fixup for one of the drm patches for an issue found in testing,
and Bjorn had some suggestions about "iommu/arm-smmu: Prepare for the
adreno-smmu implementation" that I need to look at.
BR,
-R
[1] https://lkml.org/lkml/2020/9/1/1469
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-09-04 16:47 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-17 22:01 [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables Rob Clark
2020-08-17 22:01 ` [PATCH 10/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU Rob Clark
2020-08-19 17:02 ` Doug Anderson
2020-08-19 17:36 ` Rob Clark
2020-08-19 18:20 ` Doug Anderson
2020-08-21 14:39 ` Jordan Crouse
2020-08-17 22:01 ` [PATCH 17/20] arm: dts: qcom: sm845: Set the compatible string for the " Rob Clark
2020-08-17 22:01 ` [PATCH 18/20] arm: dts: qcom: sc7180: " Rob Clark
2020-09-04 9:11 ` [PATCH 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables Joerg Roedel
2020-09-04 16:47 ` Rob Clark
-- strict thread matches above, loose matches on Subject: below --
2020-08-24 18:37 Rob Clark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).