[PATCH v5 1/5] iommu/arm-smmu-v3: fix the implementation of flush_iotlb_all hook

2018-08-14 Thread Zhen Lei
.flush_iotlb_all can not just wait for previous tlbi operations to be completed, but should also invalid all TLBs of the related domain. Signed-off-by: Zhen Lei Reviewed-by: Robin Murphy --- drivers/iommu/arm-smmu-v3.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git

[PATCH v5 5/5] iommu/arm-smmu-v3: add bootup option "iommu.non_strict"

2018-08-14 Thread Zhen Lei
Add a bootup option to make the system manager can choose which mode to be used. The default mode is strict. Signed-off-by: Zhen Lei --- Documentation/admin-guide/kernel-parameters.txt | 13 + drivers/iommu/arm-smmu-v3.c | 22 +- 2 files

[PATCH v3 0/2] bugfix and optimization about CMD_SYNC

2018-08-15 Thread Zhen Lei
ut, because msidata=1 is overridden by cmd0, that means VAL=0, sync_idx=1. Zhen Lei (2): iommu/arm-smmu-v3: fix unexpected CMD_SYNC timeout iommu/arm-smmu-v3: avoid redundant CMD_SYNCs if possible drivers/iommu/arm-smmu-v3.c | 30 +- 1 file

[PATCH v3 1/2] iommu/arm-smmu-v3: fix unexpected CMD_SYNC timeout

2018-08-15 Thread Zhen Lei
use msidata=1 is overridden by cmd0, that means VAL=0, sync_idx=1. This is not a functional problem, just make the caller wait for a long time until TIMEOUT. It's rare to happen, because any other CMD_SYNCs during the waiting period will break it. Signed-off-by: Zhen Lei --

[PATCH v3 2/2] iommu/arm-smmu-v3: avoid redundant CMD_SYNCs if possible

2018-08-15 Thread Zhen Lei
/3. See below: CMD_SYNCs reduced: 19542181 CMD_SYNCs total:58098548(include reduced) CMDs total: 116197099 (TLBI:SYNC about 1:1) Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions

[PATCH v4 1/2] iommu/arm-smmu-v3: fix unexpected CMD_SYNC timeout

2018-08-19 Thread Zhen Lei
SIG_IRQ mode into a single function, to ensure better performance and good coding style. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c

[PATCH v4 0/2] bugfix and optimization about CMD_SYNC

2018-08-19 Thread Zhen Lei
smmu execute cmd1 smmu execute TLBI smmu execute cmd0 poll timeout, because msidata=1 is overridden by cmd0, that means VAL=0, sync_idx=1. Zhen Lei (2): iommu/arm-smmu-v3: fix unexpected CMD_SYNC timeout iommu/arm-smmu-

[PATCH v4 2/2] iommu/arm-smmu-v3: avoid redundant CMD_SYNCs if possible

2018-08-19 Thread Zhen Lei
/3. See below: CMD_SYNCs reduced: 19542181 CMD_SYNCs total:58098548(include reduced) CMDs total: 116197099 (TLBI:SYNC about 1:1) Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions

[PATCH 5/8] iommu/arm-smmu: rename __arm_smmu_get_pci_sid

2015-06-26 Thread Zhen Lei
Remove the words "pci", to make this function can also be used by non-pci devices. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 6d6712

[PATCH 1/8] iommu/arm-smmu: fix the assignment of log2size field

2015-06-26 Thread Zhen Lei
Add a new local variable to store the value of log2size, so that it will not be overridden by L1 table size. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm

[PATCH 3/8] iommu/arm-smmu: fix the values of ARM64_TCR_IRGN0_SHIFT and ARM64_TCR_ORGN0_SHIFT

2015-06-26 Thread Zhen Lei
In context descriptor, the offset of IR0 is 8, the offset of OR0 is 10. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 2a5f810..43120ad 100644 --- a

[PATCH 7/8] iommu/arm-smmu: enlarge STRTAB_L1_SZ_SHIFT to support larger sidsize

2015-06-26 Thread Zhen Lei
Because we will choose the minimum value between STRTAB_L1_SZ_SHIFT and IDR1.SIDSIZE, so enlarge STRTAB_L1_SZ_SHIFT will not impact the platforms whose IDR1.SIDSIZE is smaller than old STRTAB_L1_SZ_SHIFT value. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 2 +- 1 file changed, 1

[PATCH 2/8] iommu/arm-smmu: fix the index calculation of strtab

2015-06-26 Thread Zhen Lei
The element size of cfg->strtab is just one DWORD, should use multiply operation. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index ba7fe2d..2a5f810 100

[PATCH 4/8] iommu/arm-smmu: set EPD1 to disable TT1 translation table walk

2015-06-26 Thread Zhen Lei
Now we only use TT0 translation, disable TT1 translation will safer. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 43120ad..6d6712e 100644 --- a

[PATCH 0/8] iommu/arm-smmu: bugfixs and add support for non-pci devices

2015-06-26 Thread Zhen Lei
support a master with only one stream id. If some platforms that a master belongs to more than one SMMUs or have more than one device-id, we should dynamic memory allocation to record all information. Zhen Lei (8): iommu/arm-smmu: fix the assignment of log2size field iommu/arm-smmu: fix the

[PATCH 8/8] iommu/arm-smmu: suppress fault information about CMD_PREFETCH_CONFIG execution

2015-06-26 Thread Zhen Lei
Some broken SMMUv3 devices treat CMD_PREFETCH_CONFIG as illegal command, it's ugly to print error information. CMD_PREFETCH_CONFIG is just used to prefetch the configuration for a specified StreamID, without this command will not impact SMMUv3 function. Signed-off-by: Zhen Lei --- drivers/

[PATCH 6/8] iommu/arm-smmu: add support for non-pci devices

2015-06-26 Thread Zhen Lei
Now, we only support a master with only one stream id. It will cover most hardware platforms and coding so easy. Please refer Documentation\devicetree\bindings\iommu\iommu.txt on how to bind device tree. Signed-off-by: Zhen Lei --- arch/arm64/include/asm/device.h | 2 + drivers/iommu/arm-smmu

[PATCH v2 6/9] iommu/arm-smmu: to support probe deferral

2015-07-06 Thread Zhen Lei
For pci devices, only the root nodes have "iommus" property. So we should traverse all of its sub nodes in of_xlate. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 119 +--- 1 file changed, 89 insertions(+), 30 deletions(-) di

[PATCH v2 7/9] iommu/arm-smmu: remove arm_smmu_devices

2015-07-06 Thread Zhen Lei
It can be replaced by of_iommu_list(in of_iommu.c). Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 22 ++ 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index c569539..39c55f6 100644 --- a

[PATCH v2 4/9] iommu/arm-smmu: enlarge STRTAB_L1_SZ_SHIFT to support larger sidsize

2015-07-06 Thread Zhen Lei
Because we will choose the minimum value between STRTAB_L1_SZ_SHIFT and IDR1.SIDSIZE, so enlarge STRTAB_L1_SZ_SHIFT will not impact the platforms whose IDR1.SIDSIZE is smaller than old STRTAB_L1_SZ_SHIFT value. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 5 +++-- 1 file changed, 3

[PATCH v2 2/9] iommu/arm-smmu: fix the index calculation of strtab

2015-07-06 Thread Zhen Lei
The element size of cfg->strtab is just one DWORD, should use multiply operation. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 56a1fbe..48be7eb 100

[PATCH v2 0/9] bugfixs and add support for non-pci devices

2015-07-06 Thread Zhen Lei
ifferences just because of add tabs. scripts/checkpatch.pl 0006-iommu-arm-smmu-to-support-probe-deferral.patch WARNING: else is not generally useful after a break or return #161: FILE: drivers/iommu/arm-smmu-v3.c:1938: + return -ENODEV; + } else { Zhen Lei (9): iommu/arm-smmu

[PATCH v2 5/9] iommu/arm-smmu: skip the execution of CMD_PREFETCH_CONFIG

2015-07-06 Thread Zhen Lei
Hisilicon SMMUv3 devices treat CMD_PREFETCH_CONFIG as a illegal command, execute it will trigger GERROR interrupt. Although the gerror code manage to turn the prefetch into a SYNC, and the system can continue to run normally, but it's ugly to print error information. Signed-off-by: Zhe

[PATCH v2 9/9] iommu/arm-smmu: add support for non-pci devices

2015-07-06 Thread Zhen Lei
This patch support a master with multiple stream IDs, but doesn't support a master behinds more than one SMMUs. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 39 +-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/iomm

[PATCH v2 8/9] iommu/arm-smmu: rename __arm_smmu_get_pci_sid

2015-07-06 Thread Zhen Lei
Remove the words "pci", to make this function can also be used by non-pci devices. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 39c55f

[PATCH v2 3/9] iommu/arm-smmu: fix the values of ARM64_TCR_IRGN0_SHIFT and ARM64_TCR_ORGN0_SHIFT

2015-07-06 Thread Zhen Lei
In SMMU_CBn_TCR when LPAE enabled, the offset of IRGN0 is 8, the offset of ORGN0 is 10. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 48be7eb

[PATCH v2 1/9] iommu/arm-smmu: fix the assignment of L1 table log2entries

2015-07-06 Thread Zhen Lei
Add a new local variable to store the value of L1 talbe size, so that it will not conflict with L1 talbe log2entries(stored in variable size). Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers

[PATCH v3 0/5] iommu/arm-smmu: add support for non-pci devices

2015-07-21 Thread Zhen Lei
s. patch 9/9 add support for a master with multiple stream IDs. Zhen Lei (5): iommu/arm-smmu: to support probe deferral iommu/arm-smmu: remove arm_smmu_devices iommu/arm-smmu: rename __arm_smmu_get_pci_sid iommu/arm-smmu: add support for non-pci devices iommu/arm-smmu: describe the limita

[PATCH v3 4/5] iommu/arm-smmu: add support for non-pci devices

2015-07-21 Thread Zhen Lei
This patch support a master with multiple stream IDs, but doesn't support a master behinds more than one SMMUs. Reviewed-by: Robin Murphy Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 40 ++-- 1 file changed, 38 insertions(+), 2 dele

[PATCH v3 2/5] iommu/arm-smmu: remove arm_smmu_devices

2015-07-21 Thread Zhen Lei
It can be replaced by of_iommu_list(in of_iommu.c). Reviewed-by: Robin Murphy Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 22 ++ 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index

[PATCH v3 1/5] iommu/arm-smmu: to support probe deferral

2015-07-21 Thread Zhen Lei
*/ if (!root->archdata.iommu) return -ENODEV; __arm_smmu_add_pci_device(pdev, root->archdata.iommu); Reviewed-by: Robin Murphy Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 147 +++- 1 file changed, 117 insertion

[PATCH v3 5/5] iommu/arm-smmu: describe the limitation of #iommu-cells

2015-07-21 Thread Zhen Lei
Only support #iommu-cells = <1>. Signed-off-by: Zhen Lei --- Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt

[PATCH v3 3/5] iommu/arm-smmu: rename __arm_smmu_get_pci_sid

2015-07-21 Thread Zhen Lei
Remove the words "pci", to make this function can also be used by non-pci devices. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 9daf4c

[PATCH v4 4/5] iommu/arm-smmu: to backward compatible with probe non-deferral

2015-10-15 Thread Zhen Lei
This patch eliminate the strong dependence on Laurent's series(to support probe deferral). That means, no matter whether Laurent's series upstreamed or not, the smmu-v3 driver will always work well. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 20 ++

[PATCH v4 0/5] iommu/arm-smmu: add support for non-pci devices

2015-10-15 Thread Zhen Lei
t probe deferral. patch 7/9 according to Robin Murphy's suggestion, remove global variable arm_smmu_devices, thanks. patch 9/9 add support for a master with multiple stream IDs. Zhen Lei (5): iommu/arm-smmu: to support probe deferral iommu/arm-smmu: rename __arm_smmu_get_pci_sid iommu/

[PATCH v4 3/5] iommu/arm-smmu: add support for non-pci devices

2015-10-15 Thread Zhen Lei
This patch support a master with multiple stream IDs, but doesn't support a master behinds more than one SMMUs. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 40 ++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/iomm

[PATCH v4 5/5] iommu/arm-smmu: describe the limitation of #iommu-cells

2015-10-15 Thread Zhen Lei
Only support #iommu-cells = <1>. Signed-off-by: Zhen Lei --- Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt

[PATCH v4 2/5] iommu/arm-smmu: rename __arm_smmu_get_pci_sid

2015-10-15 Thread Zhen Lei
Remove the word "pci", to make this function can also be used by non-pci devices. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 3a54af

[PATCH v4 1/5] iommu/arm-smmu: to support probe deferral

2015-10-15 Thread Zhen Lei
*/ if (!root->archdata.iommu) return -ENODEV; __arm_smmu_add_pci_device(pdev, root->archdata.iommu); Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 110 +--- 1 file changed, 83 insertions(+), 27 deletions(-) diff --g

[PATCH v3 1/1] iommu/arm-smmu-v3: Simplify useless instructions in arm_smmu_cmdq_build_cmd()

2021-12-07 Thread Zhen Lei via iommu
//w8 = ent->tlbi.leaf andx4, x4, #0xf000 ubfiz x1, x7, #8, #2 orr x1, x0, x1 orrx2, x6, x2, lsl #48 orrx0, x4, x8 orrx2, x2, x5 orrx1, x1, x0 b 3e8 Signed-off-by: Zhen Lei --- drive

[PATCH v3 0/1] iommu/arm-smmu-v3: Simplify useless instructions in arm_smmu_cmdq_build_cmd()

2021-12-07 Thread Zhen Lei via iommu
/lists.linuxfoundation.org/pipermail/iommu/2021-October/059831.html Zhen Lei (1): iommu/arm-smmu-v3: Simplify useless instructions in arm_smmu_cmdq_build_cmd() drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 11 --- 1 file changed, 8 insertions(+),

<    1   2   3