[PATCH] iommu/amd: Add prefetch iommu pages command build function

2020-09-05 Thread Wesley Sheng
Add function to build prefetch iommu pages command Signed-off-by: Wesley Sheng --- drivers/iommu/amd/amd_iommu_types.h | 2 ++ drivers/iommu/amd/iommu.c | 19 +++ 2 files changed, 21 insertions(+) diff --git a/drivers/iommu/amd/amd_iommu_types.h

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

2020-09-05 Thread Rob Clark
On Fri, Sep 4, 2020 at 8:55 AM 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

[PATCH] iommu/amd: Add prefetch iommu pages command build function

2020-09-05 Thread Wesley Sheng
Add function to build prefetch iommu pages command Signed-off-by: Wesley Sheng --- drivers/iommu/amd/amd_iommu_types.h | 2 ++ drivers/iommu/amd/iommu.c | 19 +++ 2 files changed, 21 insertions(+) diff --git a/drivers/iommu/amd/amd_iommu_types.h

[PATCH 2/2] iommu/amd: Revise ga_tag member in struct of fields_remap

2020-09-05 Thread Wesley Sheng
Per <> ga_tag member is only available when IRTE[GuestMode]=1, this field should be reserved when IRTE[GuestMode]=0. So change the ga_tag to rsvd_1 in struct of fields_remap. Signed-off-by: Wesley Sheng --- drivers/iommu/amd/amd_iommu_types.h | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 1/2] iommu/amd: Unify reserved member naming convention in struct

2020-09-05 Thread Wesley Sheng
Unify reserved member naming convention to rsvd_x in struct Signed-off-by: Wesley Sheng --- drivers/iommu/amd/amd_iommu_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h index

[PATCH v17 18/20] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU

2020-09-05 Thread Rob Clark
From: Jordan Crouse 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

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

2020-09-05 Thread Rob Clark
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 Reviewed-by: Bjorn Andersson --- arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi | 9 +

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

2020-09-05 Thread Rob Clark
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. Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson --- arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH v17 07/20] drm/msm: Set the global virtual address range from the IOMMU domain

2020-09-05 Thread Rob Clark
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). Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson ---

[PATCH v17 09/20] drm/msm: Add support for private address space instances

2020-09-05 Thread Rob Clark
From: Jordan Crouse Add support for allocating private address space instances. Targets that support per-context pagetables should implement their own function to allocate private address spaces. The default will return a pointer to the global address space. Signed-off-by: Jordan Crouse

[PATCH v17 06/20] drm/msm: Drop context arg to gpu->submit()

2020-09-05 Thread Rob Clark
From: Jordan Crouse Now that we can get the ctx from the submitqueue, the extra arg is redundant. Signed-off-by: Jordan Crouse [split out of previous patch to reduce churny noise] Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson --- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 12

[PATCH v17 17/20] iommu/arm-smmu: Add a way for implementations to influence SCTLR

2020-09-05 Thread Rob Clark
From: Rob Clark For the Adreno GPU's SMMU, we want SCTLR.HUPCF set to ensure that pending translations are not terminated on iova fault. Otherwise a terminated CP read could hang the GPU by returning invalid command-stream data. Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson ---

[PATCH v17 08/20] drm/msm: Add support to create a local pagetable

2020-09-05 Thread Rob Clark
From: Jordan Crouse Add support to create a io-pgtable for use by targets that support per-instance pagetables. In order to support per-instance pagetables the GPU SMMU device needs to have the qcom,adreno-smmu compatible string and split pagetables enabled. Signed-off-by: Jordan Crouse

[PATCH v17 13/20] iommu/arm-smmu: Add support for split pagetables

2020-09-05 Thread Rob Clark
From: Jordan Crouse Enable TTBR1 for a context bank if IO_PGTABLE_QUIRK_ARM_TTBR1 is selected by the io-pgtable configuration. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 19 +++

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

2020-09-05 Thread Rob Clark
From: Jordan Crouse Do a bit of prep work to add the upcoming adreno-smmu implementation. Add an hook to allow the implementation to choose which context banks to allocate. Move some of the common structs to arm-smmu.h in anticipation of them being used by the implementations and update some

[PATCH v17 10/20] drm/msm/a6xx: Add support for per-instance pagetables

2020-09-05 Thread Rob Clark
From: Jordan Crouse Add support for using per-instance pagetables if all the dependencies are available. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark Reviewed-by: Akhil P Oommen --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 62 +++

[PATCH v17 16/20] iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU

2020-09-05 Thread Rob Clark
From: Jordan Crouse Add a special implementation for the SMMU attached to most Adreno GPU target triggered from the qcom,adreno-smmu compatible string. The new Adreno SMMU implementation will enable split pagetables (TTBR1) for the domain attached to the GPU device (SID 0) and hard code it

[PATCH v17 12/20] iommu/arm-smmu: Pass io-pgtable config to implementation specific function

2020-09-05 Thread Rob Clark
From: Jordan Crouse Construct the io-pgtable config before calling the implementation specific init_context function and pass it so the implementation specific function can get a chance to change it before the io-pgtable is created. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark

[PATCH v17 11/20] drm/msm: Show process names in gem_describe

2020-09-05 Thread Rob Clark
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. Signed-off-by: Rob Clark Reviewed-by: Jordan Crouse Reviewed-by: Bjorn Andersson --- drivers/gpu/drm/msm/msm_drv.c |

[PATCH v17 15/20] iommu/arm-smmu: Constify some helpers

2020-09-05 Thread Rob Clark
From: Rob Clark Sprinkle a few `const`s where helpers don't need write access. Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson --- drivers/iommu/arm/arm-smmu/arm-smmu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h

[PATCH v17 02/20] drm/msm: Add private interface for adreno-smmu

2020-09-05 Thread Rob Clark
From: Rob Clark This interface will be used for drm/msm to coordinate with the qcom_adreno_smmu_impl to enable/disable TTBR0 translation. Once TTBR0 translation is enabled, the GPU's CP (Command Processor) will directly switch TTBR0 pgtables (and do the necessary TLB inv) synchronized to the

[PATCH v17 03/20] drm/msm/gpu: Add dev_to_gpu() helper

2020-09-05 Thread Rob Clark
From: Rob Clark In a later patch, the drvdata will not directly be 'struct msm_gpu *', so add a helper to reduce the churn. Signed-off-by: Rob Clark Reviewed-by: Jordan Crouse Reviewed-by: Bjorn Andersson --- drivers/gpu/drm/msm/adreno/adreno_device.c | 10 --

[PATCH v17 05/20] drm/msm: Add a context pointer to the submitqueue

2020-09-05 Thread Rob Clark
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. Co-developed-by: Rob Clark Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark Reviewed-by:

[PATCH v17 01/20] drm/msm: Remove dangling submitqueue references

2020-09-05 Thread Rob Clark
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 Reviewed-by: Jordan Crouse Reviewed-by: Bjorn Andersson ---

[PATCH v17 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables

2020-09-05 Thread Rob Clark
From: Rob Clark NOTE: I have re-ordered the series, and propose that we could merge this series in the following order: 1) 01-11 - merge via drm / msm-next 2) 12-15 - merge via iommu, no dependency on msm-next pull req 3) 16-18 - patch 16 has a dependency on 02 and

[PATCH v17 04/20] drm/msm: Set adreno_smmu as gpu's drvdata

2020-09-05 Thread Rob Clark
From: Rob Clark This will be populated by adreno-smmu, to provide a way for coordinating enabling/disabling TTBR0 translation. Signed-off-by: Rob Clark Reviewed-by: Jordan Crouse Reviewed-by: Bjorn Andersson --- drivers/gpu/drm/msm/adreno/adreno_device.c | 2 --

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

2020-09-05 Thread Rob Clark
On Fri, Sep 4, 2020 at 9:00 AM Bjorn Andersson wrote: > > On Tue 01 Sep 11:46 CDT 2020, Rob Clark wrote: > > > From: Jordan Crouse > > > > Do a bit of prep work to add the upcoming adreno-smmu implementation. > > > > Add an hook to allow the implementation to choose which context banks > > to

Re: [PATCH v7 3/9] docs: x86: Add documentation for SVA (Shared Virtual Addressing)

2020-09-05 Thread Randy Dunlap
Hi, I'll add a few edits other than those that Borislav made. (nice review job, BP) On 8/27/20 8:06 AM, Fenghua Yu wrote: > From: Ashok Raj > > ENQCMD and Data Streaming Accelerator (DSA) and all of their associated > features are a complicated stack with lots of interconnected pieces. > This

Re: [PATCH 5/5] powerpc: use the generic dma_ops_bypass mode

2020-09-05 Thread Alexey Kardashevskiy
On 31/08/2020 16:40, Christoph Hellwig wrote: On Sun, Aug 30, 2020 at 11:04:21AM +0200, Cédric Le Goater wrote: Hello, On 7/8/20 5:24 PM, Christoph Hellwig wrote: Use the DMA API bypass mechanism for direct window mappings. This uses common code and speed up the direct mapping case by

Re: [PATCH v7 3/9] docs: x86: Add documentation for SVA (Shared Virtual Addressing)

2020-09-05 Thread Borislav Petkov
> Subject: Re: [PATCH v7 3/9] docs: x86: Add documentation for SVA (Shared > Virtual Addressing) Fix prefix: Documentation/x86: ... On Thu, Aug 27, 2020 at 08:06:28AM -0700, Fenghua Yu wrote: > From: Ashok Raj > > ENQCMD and Data Streaming Accelerator (DSA) and all of their associated >

[PATCH v2 19/23] iommu/mediatek: Support report iova 34bit translation fault in ISR

2020-09-05 Thread Yong Wu
If the iova is over 32bit, the fault status register bit is a little different. Add a flag for the special register bits. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c

[PATCH v2 23/23] memory: mtk-smi: Add mt8192 support

2020-09-05 Thread Yong Wu
Add mt8192 smi support. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index e94c99ca2883..0ec3eff4d92d 100644 --- a/drivers/memory/mtk-smi.c +++

[PATCH v2 20/23] iommu/mediatek: Add support for multi domain

2020-09-05 Thread Yong Wu
Some HW IP(ex: CCU) require the special iova range. That means the iova got from dma_alloc_attrs for that devices must locate in his special range. In this patch, we allocate a special iova_range for each a special requirement and create each a iommu domain for each a iova_range. meanwhile we

[PATCH v2 22/23] iommu/mediatek: Add mt8192 support

2020-09-05 Thread Yong Wu
Add mt8192 iommu support. For multi domain, Add 1M gap for the vdec domain size. That is because vdec HW has a end address register which require (start_addr + len) rather than (start_addr + len - 1). Take a example, if the start_addr is 0xfff0, size is 0x10, then the end_address is

[PATCH v2 21/23] iommu/mediatek: Adjust the structure

2020-09-05 Thread Yong Wu
Add "struct mtk_iommu_data *" in the "struct mtk_iommu_domain", reduce the call mtk_iommu_get_m4u_data(). No functional change. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c

[PATCH v2 18/23] iommu/mediatek: Support up to 34bit iova in tlb flush

2020-09-05 Thread Yong Wu
If the iova is 34bit, the iova[32][33] is the bit0/1 in the tlb flush register. Add a new macro for this. there is a minor change unrelated with this patch. it also use the new macro. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 11 +++ 1 file changed, 7 insertions(+), 4

[PATCH v2 17/23] iommu/mediatek: Support master use iova over 32bit

2020-09-05 Thread Yong Wu
After extending v7s, our pagetable already support iova reach 16GB(34bit). the master got the iova via dma_alloc_attrs may reach 34bits, but its HW register still is 32bit. then how to set the bit32/bit33 iova? this depend on a SMI larb setting(bank_sel). we separate whole 16GB iova to four

[PATCH v2 16/23] iommu/mediatek: Add single domain

2020-09-05 Thread Yong Wu
Defaultly the iova range is 0-4G. here we add a single-domain(0-4G) for the previous SoC. this also is a preparing patch for supporting multi-domains. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/iommu/mtk_iommu.c

[PATCH v2 15/23] iommu/mediatek: Add iova reserved function

2020-09-05 Thread Yong Wu
For multiple iommu_domains, we need to reserve some iova regions. Take a example, If the default iova region is 0 ~ 4G, but the 0x4000_ ~ 0x43ff_ is only for the special CCU0 domain. Thus we should exclude this region for the default iova region. This patch adds iova reserved flow. It's a

[PATCH v2 14/23] iommu/mediatek: Add power-domain operation

2020-09-05 Thread Yong Wu
In the previous SoC, the M4U HW is in the EMI power domain which is always on. the latest M4U is in the display power domain which may be turned on/off, thus we have to add pm_runtime interface for it. When the engine work, the engine always enable the power and clocks for smi-larb/smi-common,

[PATCH v2 13/23] iommu/mediatek: Add device link for smi-common and m4u

2020-09-05 Thread Yong Wu
In the lastest SoC, M4U has its special power domain. thus, If the engine begin to work, it should help enable the power for M4U firstly. Currently if the engine work, it always enable the power/clocks for smi-larbs/smi-common. This patch adds device_link for smi-common and M4U. then, if

[PATCH v2 06/23] dt-bindings: mediatek: Add binding for mt8192 IOMMU and SMI

2020-09-05 Thread Yong Wu
This patch adds decriptions for mt8192 IOMMU and SMI. mt8192 also is MTK IOMMU gen2 which uses ARM Short-Descriptor translation table format. The M4U-SMI HW diagram is as below: EMI | M4U |

[PATCH v2 12/23] iommu/mediatek: Move hw_init into attach_device

2020-09-05 Thread Yong Wu
In attach device, it will update the pagetable base address register. Move the hw_init function also here. Then it only need call pm_runtime_get/put one time here if m4u has power domain. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 10 ++ 1 file changed, 6 insertions(+), 4

[PATCH v2 09/23] iommu/io-pgtable-arm-v7s: Extend PA34 for MediaTek

2020-09-05 Thread Yong Wu
MediaTek extend the bit5 in lvl1 and lvl2 descriptor as PA34. Signed-off-by: Yong Wu --- drivers/iommu/io-pgtable-arm-v7s.c | 9 +++-- drivers/iommu/mtk_iommu.c | 2 +- include/linux/io-pgtable.h | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git

[PATCH v2 11/23] iommu/io-pgtable-arm-v7s: Quad lvl1 pgtable for MediaTek

2020-09-05 Thread Yong Wu
The standard input iova bits is 32. MediaTek quad the lvl1 pagetable (4 * lvl1). No change for lvl2 pagetable. Then the iova bits can reach 34bit. Signed-off-by: Yong Wu --- drivers/iommu/io-pgtable-arm-v7s.c | 13 ++--- drivers/iommu/mtk_iommu.c | 2 +- 2 files changed, 11

[PATCH v2 07/23] iommu/mediatek: Use the common mtk-smi-larb-port.h

2020-09-05 Thread Yong Wu
Use the common larb-port header in the source code. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 7 --- drivers/iommu/mtk_iommu.h | 1 + drivers/memory/mtk-smi.c | 1 + include/soc/mediatek/smi.h | 2 -- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git

[PATCH v2 10/23] iommu/io-pgtable-arm-v7s: Add cfg as a param in some macros

2020-09-05 Thread Yong Wu
Add "cfg" as a parameter for some macros. This is a preparing patch for mediatek extend the lvl1 pgtable. No functional change. Signed-off-by: Yong Wu --- drivers/iommu/io-pgtable-arm-v7s.c | 34 +++--- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git

[PATCH v2 08/23] iommu/io-pgtable-arm-v7s: Use ias to check the valid iova in unmap

2020-09-05 Thread Yong Wu
As title. BTW, change the ias/oas checking format in v7s_map. Signed-off-by: Yong Wu --- drivers/iommu/io-pgtable-arm-v7s.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index

[PATCH v2 05/23] dt-bindings: memory: mediatek: Add domain definition

2020-09-05 Thread Yong Wu
In the latest SoC, there are several HW IP require a sepecial iova range, mainly CCU and VPU has this requirement. Take CCU as a example, CCU require its iova locate in the range(0x4000_ ~ 0x43ff_). In this patch we add a domain definition for the special port. In the example of CCU, If

[PATCH v2 04/23] dt-bindings: memory: mediatek: Extend LARB_NR_MAX to 32

2020-09-05 Thread Yong Wu
Extend the max larb number definition as mt8192 has larb_nr over 16. Signed-off-by: Yong Wu Acked-by: Rob Herring --- include/dt-bindings/memory/mtk-smi-larb-port.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/dt-bindings/memory/mtk-smi-larb-port.h

[PATCH v2 01/23] dt-bindings: iommu: mediatek: Convert IOMMU to DT schema

2020-09-05 Thread Yong Wu
Convert MediaTek IOMMU to DT schema. Signed-off-by: Yong Wu --- .../bindings/iommu/mediatek,iommu.txt | 103 .../bindings/iommu/mediatek,iommu.yaml| 150 ++ 2 files changed, 150 insertions(+), 103 deletions(-) delete mode 100644

[PATCH v2 03/23] dt-bindings: memory: mediatek: Add a common larb-port header file

2020-09-05 Thread Yong Wu
Put all the macros about smi larb/port togethers, this is a preparing patch for extending LARB_NR and adding new dom-id support. Signed-off-by: Yong Wu Acked-by: Rob Herring --- include/dt-bindings/memory/mt2712-larb-port.h | 2 +- include/dt-bindings/memory/mt6779-larb-port.h | 2 +-

[PATCH v2 00/23] MT8192 IOMMU support

2020-09-05 Thread Yong Wu
This patch mainly adds support for mt8192 IOMMU and SMI. mt8192 also is MTK IOMMU gen2 which uses ARM Short-Descriptor translation table format. The M4U-SMI HW diagram is as below: EMI | M4U

[PATCH v2 02/23] dt-bindings: memory: mediatek: Convert SMI to DT schema

2020-09-05 Thread Yong Wu
Convert MediaTek SMI to DT schema. Signed-off-by: Yong Wu --- .../mediatek,smi-common.txt | 49 -- .../mediatek,smi-common.yaml | 96 +++ .../memory-controllers/mediatek,smi-larb.txt | 49 --

RE: [PATCH V6 1/3] iommu: Add support to change default domain of an iommu group

2020-09-05 Thread Prakhya, Sai Praneeth
Hi Joerg, > -Original Message- > From: Joerg Roedel > Sent: Friday, September 4, 2020 2:42 PM > To: Prakhya, Sai Praneeth > Cc: iommu@lists.linux-foundation.org; Christoph Hellwig ; Raj, > Ashok ; Will Deacon ; Lu Baolu > ; Mehta, Sohil ; Robin > Murphy ; Jacob Pan > Subject: Re: