* [PATCH 0/7] Nvidia Arm SMMUv2 Implementation @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Hi All, Nvidia Arm SMMUv2 implementation has two ARM SMMU(MMU-500) instances that are used together for SMMU translations. The IOVA accesses from HW devices are interleaved across these two SMMU instances and need to be programmed identical except during tlb sync and fault handling. This patch set adds Nvidia Arm SMMUv2 Implementation on top of ARM SMMU driver to handle Nvidia specific implementation. It is also adding hooks for tlb sync and fault handling to allow vendor specific implementation for the same. Please review the patch set and provide the feedback. This patch set is based on the following branch as it is dependent on the Arm SMMU Refactor changes from Robin Murphy that are present in this branch. https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git for-joerg/arm-smmu/updates Krishna Reddy (7): iommu/arm-smmu: add Nvidia SMMUv2 implementation dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 iommu/arm-smmu: Add tlb_sync implementation hook iommu/arm-smmu: Add global/context fault implementation hooks arm64: tegra: Add Memory controller DT node on T194 arm64: tegra: Add DT node for T194 SMMU arm64: tegra: enable SMMU for SDHCI and EQOS .../devicetree/bindings/iommu/arm,smmu.txt | 1 + MAINTAINERS | 2 + arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 + arch/arm64/boot/dts/nvidia/tegra194.dtsi | 86 +++++++ drivers/iommu/Makefile | 2 +- drivers/iommu/arm-smmu-impl.c | 2 + drivers/iommu/arm-smmu-nvidia.c | 256 +++++++++++++++++++++ drivers/iommu/arm-smmu.c | 16 +- drivers/iommu/arm-smmu.h | 10 + 9 files changed, 375 insertions(+), 4 deletions(-) create mode 100644 drivers/iommu/arm-smmu-nvidia.c -- 2.1.4 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 0/7] Nvidia Arm SMMUv2 Implementation @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Hi All, Nvidia Arm SMMUv2 implementation has two ARM SMMU(MMU-500) instances that are used together for SMMU translations. The IOVA accesses from HW devices are interleaved across these two SMMU instances and need to be programmed identical except during tlb sync and fault handling. This patch set adds Nvidia Arm SMMUv2 Implementation on top of ARM SMMU driver to handle Nvidia specific implementation. It is also adding hooks for tlb sync and fault handling to allow vendor specific implementation for the same. Please review the patch set and provide the feedback. This patch set is based on the following branch as it is dependent on the Arm SMMU Refactor changes from Robin Murphy that are present in this branch. https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git for-joerg/arm-smmu/updates Krishna Reddy (7): iommu/arm-smmu: add Nvidia SMMUv2 implementation dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 iommu/arm-smmu: Add tlb_sync implementation hook iommu/arm-smmu: Add global/context fault implementation hooks arm64: tegra: Add Memory controller DT node on T194 arm64: tegra: Add DT node for T194 SMMU arm64: tegra: enable SMMU for SDHCI and EQOS .../devicetree/bindings/iommu/arm,smmu.txt | 1 + MAINTAINERS | 2 + arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 + arch/arm64/boot/dts/nvidia/tegra194.dtsi | 86 +++++++ drivers/iommu/Makefile | 2 +- drivers/iommu/arm-smmu-impl.c | 2 + drivers/iommu/arm-smmu-nvidia.c | 256 +++++++++++++++++++++ drivers/iommu/arm-smmu.c | 16 +- drivers/iommu/arm-smmu.h | 10 + 9 files changed, 375 insertions(+), 4 deletions(-) create mode 100644 drivers/iommu/arm-smmu-nvidia.c -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 0/7] Nvidia Arm SMMUv2 Implementation @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Hi All, Nvidia Arm SMMUv2 implementation has two ARM SMMU(MMU-500) instances that are used together for SMMU translations. The IOVA accesses from HW devices are interleaved across these two SMMU instances and need to be programmed identical except during tlb sync and fault handling. This patch set adds Nvidia Arm SMMUv2 Implementation on top of ARM SMMU driver to handle Nvidia specific implementation. It is also adding hooks for tlb sync and fault handling to allow vendor specific implementation for the same. Please review the patch set and provide the feedback. This patch set is based on the following branch as it is dependent on the Arm SMMU Refactor changes from Robin Murphy that are present in this branch. https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git for-joerg/arm-smmu/updates Krishna Reddy (7): iommu/arm-smmu: add Nvidia SMMUv2 implementation dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 iommu/arm-smmu: Add tlb_sync implementation hook iommu/arm-smmu: Add global/context fault implementation hooks arm64: tegra: Add Memory controller DT node on T194 arm64: tegra: Add DT node for T194 SMMU arm64: tegra: enable SMMU for SDHCI and EQOS .../devicetree/bindings/iommu/arm,smmu.txt | 1 + MAINTAINERS | 2 + arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 + arch/arm64/boot/dts/nvidia/tegra194.dtsi | 86 +++++++ drivers/iommu/Makefile | 2 +- drivers/iommu/arm-smmu-impl.c | 2 + drivers/iommu/arm-smmu-nvidia.c | 256 +++++++++++++++++++++ drivers/iommu/arm-smmu.c | 16 +- drivers/iommu/arm-smmu.h | 10 + 9 files changed, 375 insertions(+), 4 deletions(-) create mode 100644 drivers/iommu/arm-smmu-nvidia.c -- 2.1.4 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 0/7] Nvidia Arm SMMUv2 Implementation @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Hi All, Nvidia Arm SMMUv2 implementation has two ARM SMMU(MMU-500) instances that are used together for SMMU translations. The IOVA accesses from HW devices are interleaved across these two SMMU instances and need to be programmed identical except during tlb sync and fault handling. This patch set adds Nvidia Arm SMMUv2 Implementation on top of ARM SMMU driver to handle Nvidia specific implementation. It is also adding hooks for tlb sync and fault handling to allow vendor specific implementation for the same. Please review the patch set and provide the feedback. This patch set is based on the following branch as it is dependent on the Arm SMMU Refactor changes from Robin Murphy that are present in this branch. https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git for-joerg/arm-smmu/updates Krishna Reddy (7): iommu/arm-smmu: add Nvidia SMMUv2 implementation dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 iommu/arm-smmu: Add tlb_sync implementation hook iommu/arm-smmu: Add global/context fault implementation hooks arm64: tegra: Add Memory controller DT node on T194 arm64: tegra: Add DT node for T194 SMMU arm64: tegra: enable SMMU for SDHCI and EQOS .../devicetree/bindings/iommu/arm,smmu.txt | 1 + MAINTAINERS | 2 + arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 + arch/arm64/boot/dts/nvidia/tegra194.dtsi | 86 +++++++ drivers/iommu/Makefile | 2 +- drivers/iommu/arm-smmu-impl.c | 2 + drivers/iommu/arm-smmu-nvidia.c | 256 +++++++++++++++++++++ drivers/iommu/arm-smmu.c | 16 +- drivers/iommu/arm-smmu.h | 10 + 9 files changed, 375 insertions(+), 4 deletions(-) create mode 100644 drivers/iommu/arm-smmu-nvidia.c -- 2.1.4 ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation 2019-08-29 22:47 ` Krishna Reddy (?) (?) @ 2019-08-29 22:47 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add Nvidia SMMUv2 implementation and model info. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- MAINTAINERS | 2 + drivers/iommu/Makefile | 2 +- drivers/iommu/arm-smmu-impl.c | 2 + drivers/iommu/arm-smmu-nvidia.c | 97 +++++++++++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 2 + drivers/iommu/arm-smmu.h | 2 + 6 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 drivers/iommu/arm-smmu-nvidia.c diff --git a/MAINTAINERS b/MAINTAINERS index 289fb06..b9d59e51 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15785,9 +15785,11 @@ F: drivers/i2c/busses/i2c-tegra.c TEGRA IOMMU DRIVERS M: Thierry Reding <thierry.reding@gmail.com> +R: Krishna Reddy <vdumpa@nvidia.com> L: linux-tegra@vger.kernel.org S: Supported F: drivers/iommu/tegra* +F: drivers/iommu/arm-smmu-nvidia.c TEGRA KBC DRIVER M: Laxman Dewangan <ldewangan@nvidia.com> diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index a2729aa..7f5489e 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile @@ -13,7 +13,7 @@ obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += amd_iommu_debugfs.o obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o -obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o +obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o obj-$(CONFIG_DMAR_TABLE) += dmar.o obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c index 5c87a38..e5e595f 100644 --- a/drivers/iommu/arm-smmu-impl.c +++ b/drivers/iommu/arm-smmu-impl.c @@ -162,6 +162,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) break; case CAVIUM_SMMUV2: return cavium_smmu_impl_init(smmu); + case NVIDIA_SMMUV2: + return nvidia_smmu_impl_init(smmu); default: break; } diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c new file mode 100644 index 0000000..d93ceda --- /dev/null +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Nvidia ARM SMMU v2 implementation quirks +// Copyright (C) 2019 NVIDIA CORPORATION. All rights reserved. + +#define pr_fmt(fmt) "nvidia-smmu: " fmt + +#include <linux/bitfield.h> +#include <linux/delay.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + +#include "arm-smmu.h" + +#define NUM_SMMU_INSTANCES 3 + +struct nvidia_smmu { + struct arm_smmu_device smmu; + int num_inst; + void __iomem *bases[NUM_SMMU_INSTANCES]; +}; + +#define to_nsmmu(s) container_of(s, struct nvidia_smmu, smmu) + +#define nsmmu_page(smmu, inst, page) \ + (((inst) ? to_nsmmu(smmu)->bases[(inst)] : smmu->base) + \ + ((page) << smmu->pgshift)) + +static u32 nsmmu_read_reg(struct arm_smmu_device *smmu, + int page, int offset) +{ + return readl_relaxed(nsmmu_page(smmu, 0, page) + offset); +} + +static void nsmmu_write_reg(struct arm_smmu_device *smmu, + int page, int offset, u32 val) +{ + int i; + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + writel_relaxed(val, nsmmu_page(smmu, i, page) + offset); +} + +static u64 nsmmu_read_reg64(struct arm_smmu_device *smmu, + int page, int offset) +{ + return readq_relaxed(nsmmu_page(smmu, 0, page) + offset); +} + +static void nsmmu_write_reg64(struct arm_smmu_device *smmu, + int page, int offset, u64 val) +{ + int i; + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); +} + +static const struct arm_smmu_impl nsmmu_impl = { + .read_reg = nsmmu_read_reg, + .write_reg = nsmmu_write_reg, + .read_reg64 = nsmmu_read_reg64, + .write_reg64 = nsmmu_write_reg64, +}; + +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) +{ + int i; + struct nvidia_smmu *nsmmu; + struct resource *res; + struct device *dev = smmu->dev; + struct platform_device *pdev = to_platform_device(smmu->dev); + + nsmmu = devm_kzalloc(smmu->dev, sizeof(*nsmmu), GFP_KERNEL); + if (!nsmmu) + return ERR_PTR(-ENOMEM); + + nsmmu->smmu = *smmu; + /* Instance 0 is ioremapped by arm-smmu.c */ + nsmmu->num_inst = 1; + + for (i = 1; i < NUM_SMMU_INSTANCES; i++) { + res = platform_get_resource(pdev, IORESOURCE_MEM, i); + if (!res) + break; + nsmmu->bases[i] = devm_ioremap_resource(dev, res); + if (IS_ERR(nsmmu->bases[i])) + return (struct arm_smmu_device *)nsmmu->bases[i]; + nsmmu->num_inst++; + } + + nsmmu->smmu.impl = &nsmmu_impl; + devm_kfree(smmu->dev, smmu); + pr_info("Nvidia SMMUv2, Instances=%d\n", nsmmu->num_inst); + + return &nsmmu->smmu; +} diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 5b93c79..46e1641 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1871,6 +1871,7 @@ ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU); ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2); +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, @@ -1880,6 +1881,7 @@ static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 }, + { .compatible = "nvidia,smmu-v2", .data = &nvidia_smmuv2 }, { }, }; diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index b19b6ca..9645bf1 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -220,6 +220,7 @@ enum arm_smmu_implementation { ARM_MMU500, CAVIUM_SMMUV2, QCOM_SMMUV2, + NVIDIA_SMMUV2, }; struct arm_smmu_device { @@ -398,5 +399,6 @@ static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page, arm_smmu_writeq((s), ARM_SMMU_CB((s), (n)), (o), (v)) struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu); +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu); #endif /* _ARM_SMMU_H */ -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add Nvidia SMMUv2 implementation and model info. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- MAINTAINERS | 2 + drivers/iommu/Makefile | 2 +- drivers/iommu/arm-smmu-impl.c | 2 + drivers/iommu/arm-smmu-nvidia.c | 97 +++++++++++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 2 + drivers/iommu/arm-smmu.h | 2 + 6 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 drivers/iommu/arm-smmu-nvidia.c diff --git a/MAINTAINERS b/MAINTAINERS index 289fb06..b9d59e51 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15785,9 +15785,11 @@ F: drivers/i2c/busses/i2c-tegra.c TEGRA IOMMU DRIVERS M: Thierry Reding <thierry.reding@gmail.com> +R: Krishna Reddy <vdumpa@nvidia.com> L: linux-tegra@vger.kernel.org S: Supported F: drivers/iommu/tegra* +F: drivers/iommu/arm-smmu-nvidia.c TEGRA KBC DRIVER M: Laxman Dewangan <ldewangan@nvidia.com> diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index a2729aa..7f5489e 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile @@ -13,7 +13,7 @@ obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += amd_iommu_debugfs.o obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o -obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o +obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o obj-$(CONFIG_DMAR_TABLE) += dmar.o obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c index 5c87a38..e5e595f 100644 --- a/drivers/iommu/arm-smmu-impl.c +++ b/drivers/iommu/arm-smmu-impl.c @@ -162,6 +162,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) break; case CAVIUM_SMMUV2: return cavium_smmu_impl_init(smmu); + case NVIDIA_SMMUV2: + return nvidia_smmu_impl_init(smmu); default: break; } diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c new file mode 100644 index 0000000..d93ceda --- /dev/null +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Nvidia ARM SMMU v2 implementation quirks +// Copyright (C) 2019 NVIDIA CORPORATION. All rights reserved. + +#define pr_fmt(fmt) "nvidia-smmu: " fmt + +#include <linux/bitfield.h> +#include <linux/delay.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + +#include "arm-smmu.h" + +#define NUM_SMMU_INSTANCES 3 + +struct nvidia_smmu { + struct arm_smmu_device smmu; + int num_inst; + void __iomem *bases[NUM_SMMU_INSTANCES]; +}; + +#define to_nsmmu(s) container_of(s, struct nvidia_smmu, smmu) + +#define nsmmu_page(smmu, inst, page) \ + (((inst) ? to_nsmmu(smmu)->bases[(inst)] : smmu->base) + \ + ((page) << smmu->pgshift)) + +static u32 nsmmu_read_reg(struct arm_smmu_device *smmu, + int page, int offset) +{ + return readl_relaxed(nsmmu_page(smmu, 0, page) + offset); +} + +static void nsmmu_write_reg(struct arm_smmu_device *smmu, + int page, int offset, u32 val) +{ + int i; + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + writel_relaxed(val, nsmmu_page(smmu, i, page) + offset); +} + +static u64 nsmmu_read_reg64(struct arm_smmu_device *smmu, + int page, int offset) +{ + return readq_relaxed(nsmmu_page(smmu, 0, page) + offset); +} + +static void nsmmu_write_reg64(struct arm_smmu_device *smmu, + int page, int offset, u64 val) +{ + int i; + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); +} + +static const struct arm_smmu_impl nsmmu_impl = { + .read_reg = nsmmu_read_reg, + .write_reg = nsmmu_write_reg, + .read_reg64 = nsmmu_read_reg64, + .write_reg64 = nsmmu_write_reg64, +}; + +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) +{ + int i; + struct nvidia_smmu *nsmmu; + struct resource *res; + struct device *dev = smmu->dev; + struct platform_device *pdev = to_platform_device(smmu->dev); + + nsmmu = devm_kzalloc(smmu->dev, sizeof(*nsmmu), GFP_KERNEL); + if (!nsmmu) + return ERR_PTR(-ENOMEM); + + nsmmu->smmu = *smmu; + /* Instance 0 is ioremapped by arm-smmu.c */ + nsmmu->num_inst = 1; + + for (i = 1; i < NUM_SMMU_INSTANCES; i++) { + res = platform_get_resource(pdev, IORESOURCE_MEM, i); + if (!res) + break; + nsmmu->bases[i] = devm_ioremap_resource(dev, res); + if (IS_ERR(nsmmu->bases[i])) + return (struct arm_smmu_device *)nsmmu->bases[i]; + nsmmu->num_inst++; + } + + nsmmu->smmu.impl = &nsmmu_impl; + devm_kfree(smmu->dev, smmu); + pr_info("Nvidia SMMUv2, Instances=%d\n", nsmmu->num_inst); + + return &nsmmu->smmu; +} diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 5b93c79..46e1641 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1871,6 +1871,7 @@ ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU); ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2); +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, @@ -1880,6 +1881,7 @@ static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 }, + { .compatible = "nvidia,smmu-v2", .data = &nvidia_smmuv2 }, { }, }; diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index b19b6ca..9645bf1 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -220,6 +220,7 @@ enum arm_smmu_implementation { ARM_MMU500, CAVIUM_SMMUV2, QCOM_SMMUV2, + NVIDIA_SMMUV2, }; struct arm_smmu_device { @@ -398,5 +399,6 @@ static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page, arm_smmu_writeq((s), ARM_SMMU_CB((s), (n)), (o), (v)) struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu); +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu); #endif /* _ARM_SMMU_H */ -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add Nvidia SMMUv2 implementation and model info. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- MAINTAINERS | 2 + drivers/iommu/Makefile | 2 +- drivers/iommu/arm-smmu-impl.c | 2 + drivers/iommu/arm-smmu-nvidia.c | 97 +++++++++++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 2 + drivers/iommu/arm-smmu.h | 2 + 6 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 drivers/iommu/arm-smmu-nvidia.c diff --git a/MAINTAINERS b/MAINTAINERS index 289fb06..b9d59e51 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15785,9 +15785,11 @@ F: drivers/i2c/busses/i2c-tegra.c TEGRA IOMMU DRIVERS M: Thierry Reding <thierry.reding@gmail.com> +R: Krishna Reddy <vdumpa@nvidia.com> L: linux-tegra@vger.kernel.org S: Supported F: drivers/iommu/tegra* +F: drivers/iommu/arm-smmu-nvidia.c TEGRA KBC DRIVER M: Laxman Dewangan <ldewangan@nvidia.com> diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index a2729aa..7f5489e 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile @@ -13,7 +13,7 @@ obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += amd_iommu_debugfs.o obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o -obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o +obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o obj-$(CONFIG_DMAR_TABLE) += dmar.o obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c index 5c87a38..e5e595f 100644 --- a/drivers/iommu/arm-smmu-impl.c +++ b/drivers/iommu/arm-smmu-impl.c @@ -162,6 +162,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) break; case CAVIUM_SMMUV2: return cavium_smmu_impl_init(smmu); + case NVIDIA_SMMUV2: + return nvidia_smmu_impl_init(smmu); default: break; } diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c new file mode 100644 index 0000000..d93ceda --- /dev/null +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Nvidia ARM SMMU v2 implementation quirks +// Copyright (C) 2019 NVIDIA CORPORATION. All rights reserved. + +#define pr_fmt(fmt) "nvidia-smmu: " fmt + +#include <linux/bitfield.h> +#include <linux/delay.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + +#include "arm-smmu.h" + +#define NUM_SMMU_INSTANCES 3 + +struct nvidia_smmu { + struct arm_smmu_device smmu; + int num_inst; + void __iomem *bases[NUM_SMMU_INSTANCES]; +}; + +#define to_nsmmu(s) container_of(s, struct nvidia_smmu, smmu) + +#define nsmmu_page(smmu, inst, page) \ + (((inst) ? to_nsmmu(smmu)->bases[(inst)] : smmu->base) + \ + ((page) << smmu->pgshift)) + +static u32 nsmmu_read_reg(struct arm_smmu_device *smmu, + int page, int offset) +{ + return readl_relaxed(nsmmu_page(smmu, 0, page) + offset); +} + +static void nsmmu_write_reg(struct arm_smmu_device *smmu, + int page, int offset, u32 val) +{ + int i; + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + writel_relaxed(val, nsmmu_page(smmu, i, page) + offset); +} + +static u64 nsmmu_read_reg64(struct arm_smmu_device *smmu, + int page, int offset) +{ + return readq_relaxed(nsmmu_page(smmu, 0, page) + offset); +} + +static void nsmmu_write_reg64(struct arm_smmu_device *smmu, + int page, int offset, u64 val) +{ + int i; + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); +} + +static const struct arm_smmu_impl nsmmu_impl = { + .read_reg = nsmmu_read_reg, + .write_reg = nsmmu_write_reg, + .read_reg64 = nsmmu_read_reg64, + .write_reg64 = nsmmu_write_reg64, +}; + +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) +{ + int i; + struct nvidia_smmu *nsmmu; + struct resource *res; + struct device *dev = smmu->dev; + struct platform_device *pdev = to_platform_device(smmu->dev); + + nsmmu = devm_kzalloc(smmu->dev, sizeof(*nsmmu), GFP_KERNEL); + if (!nsmmu) + return ERR_PTR(-ENOMEM); + + nsmmu->smmu = *smmu; + /* Instance 0 is ioremapped by arm-smmu.c */ + nsmmu->num_inst = 1; + + for (i = 1; i < NUM_SMMU_INSTANCES; i++) { + res = platform_get_resource(pdev, IORESOURCE_MEM, i); + if (!res) + break; + nsmmu->bases[i] = devm_ioremap_resource(dev, res); + if (IS_ERR(nsmmu->bases[i])) + return (struct arm_smmu_device *)nsmmu->bases[i]; + nsmmu->num_inst++; + } + + nsmmu->smmu.impl = &nsmmu_impl; + devm_kfree(smmu->dev, smmu); + pr_info("Nvidia SMMUv2, Instances=%d\n", nsmmu->num_inst); + + return &nsmmu->smmu; +} diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 5b93c79..46e1641 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1871,6 +1871,7 @@ ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU); ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2); +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, @@ -1880,6 +1881,7 @@ static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 }, + { .compatible = "nvidia,smmu-v2", .data = &nvidia_smmuv2 }, { }, }; diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index b19b6ca..9645bf1 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -220,6 +220,7 @@ enum arm_smmu_implementation { ARM_MMU500, CAVIUM_SMMUV2, QCOM_SMMUV2, + NVIDIA_SMMUV2, }; struct arm_smmu_device { @@ -398,5 +399,6 @@ static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page, arm_smmu_writeq((s), ARM_SMMU_CB((s), (n)), (o), (v)) struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu); +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu); #endif /* _ARM_SMMU_H */ -- 2.1.4 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add Nvidia SMMUv2 implementation and model info. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- MAINTAINERS | 2 + drivers/iommu/Makefile | 2 +- drivers/iommu/arm-smmu-impl.c | 2 + drivers/iommu/arm-smmu-nvidia.c | 97 +++++++++++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 2 + drivers/iommu/arm-smmu.h | 2 + 6 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 drivers/iommu/arm-smmu-nvidia.c diff --git a/MAINTAINERS b/MAINTAINERS index 289fb06..b9d59e51 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15785,9 +15785,11 @@ F: drivers/i2c/busses/i2c-tegra.c TEGRA IOMMU DRIVERS M: Thierry Reding <thierry.reding@gmail.com> +R: Krishna Reddy <vdumpa@nvidia.com> L: linux-tegra@vger.kernel.org S: Supported F: drivers/iommu/tegra* +F: drivers/iommu/arm-smmu-nvidia.c TEGRA KBC DRIVER M: Laxman Dewangan <ldewangan@nvidia.com> diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile index a2729aa..7f5489e 100644 --- a/drivers/iommu/Makefile +++ b/drivers/iommu/Makefile @@ -13,7 +13,7 @@ obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += amd_iommu_debugfs.o obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o -obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o +obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o obj-$(CONFIG_DMAR_TABLE) += dmar.o obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c index 5c87a38..e5e595f 100644 --- a/drivers/iommu/arm-smmu-impl.c +++ b/drivers/iommu/arm-smmu-impl.c @@ -162,6 +162,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) break; case CAVIUM_SMMUV2: return cavium_smmu_impl_init(smmu); + case NVIDIA_SMMUV2: + return nvidia_smmu_impl_init(smmu); default: break; } diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c new file mode 100644 index 0000000..d93ceda --- /dev/null +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Nvidia ARM SMMU v2 implementation quirks +// Copyright (C) 2019 NVIDIA CORPORATION. All rights reserved. + +#define pr_fmt(fmt) "nvidia-smmu: " fmt + +#include <linux/bitfield.h> +#include <linux/delay.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + +#include "arm-smmu.h" + +#define NUM_SMMU_INSTANCES 3 + +struct nvidia_smmu { + struct arm_smmu_device smmu; + int num_inst; + void __iomem *bases[NUM_SMMU_INSTANCES]; +}; + +#define to_nsmmu(s) container_of(s, struct nvidia_smmu, smmu) + +#define nsmmu_page(smmu, inst, page) \ + (((inst) ? to_nsmmu(smmu)->bases[(inst)] : smmu->base) + \ + ((page) << smmu->pgshift)) + +static u32 nsmmu_read_reg(struct arm_smmu_device *smmu, + int page, int offset) +{ + return readl_relaxed(nsmmu_page(smmu, 0, page) + offset); +} + +static void nsmmu_write_reg(struct arm_smmu_device *smmu, + int page, int offset, u32 val) +{ + int i; + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + writel_relaxed(val, nsmmu_page(smmu, i, page) + offset); +} + +static u64 nsmmu_read_reg64(struct arm_smmu_device *smmu, + int page, int offset) +{ + return readq_relaxed(nsmmu_page(smmu, 0, page) + offset); +} + +static void nsmmu_write_reg64(struct arm_smmu_device *smmu, + int page, int offset, u64 val) +{ + int i; + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); +} + +static const struct arm_smmu_impl nsmmu_impl = { + .read_reg = nsmmu_read_reg, + .write_reg = nsmmu_write_reg, + .read_reg64 = nsmmu_read_reg64, + .write_reg64 = nsmmu_write_reg64, +}; + +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) +{ + int i; + struct nvidia_smmu *nsmmu; + struct resource *res; + struct device *dev = smmu->dev; + struct platform_device *pdev = to_platform_device(smmu->dev); + + nsmmu = devm_kzalloc(smmu->dev, sizeof(*nsmmu), GFP_KERNEL); + if (!nsmmu) + return ERR_PTR(-ENOMEM); + + nsmmu->smmu = *smmu; + /* Instance 0 is ioremapped by arm-smmu.c */ + nsmmu->num_inst = 1; + + for (i = 1; i < NUM_SMMU_INSTANCES; i++) { + res = platform_get_resource(pdev, IORESOURCE_MEM, i); + if (!res) + break; + nsmmu->bases[i] = devm_ioremap_resource(dev, res); + if (IS_ERR(nsmmu->bases[i])) + return (struct arm_smmu_device *)nsmmu->bases[i]; + nsmmu->num_inst++; + } + + nsmmu->smmu.impl = &nsmmu_impl; + devm_kfree(smmu->dev, smmu); + pr_info("Nvidia SMMUv2, Instances=%d\n", nsmmu->num_inst); + + return &nsmmu->smmu; +} diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 5b93c79..46e1641 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1871,6 +1871,7 @@ ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU); ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2); +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, @@ -1880,6 +1881,7 @@ static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 }, + { .compatible = "nvidia,smmu-v2", .data = &nvidia_smmuv2 }, { }, }; diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index b19b6ca..9645bf1 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -220,6 +220,7 @@ enum arm_smmu_implementation { ARM_MMU500, CAVIUM_SMMUV2, QCOM_SMMUV2, + NVIDIA_SMMUV2, }; struct arm_smmu_device { @@ -398,5 +399,6 @@ static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page, arm_smmu_writeq((s), ARM_SMMU_CB((s), (n)), (o), (v)) struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu); +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu); #endif /* _ARM_SMMU_H */ -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 15:02 ` Robin Murphy -1 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:02 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add Nvidia SMMUv2 implementation and model info. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > MAINTAINERS | 2 + > drivers/iommu/Makefile | 2 +- > drivers/iommu/arm-smmu-impl.c | 2 + > drivers/iommu/arm-smmu-nvidia.c | 97 +++++++++++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 2 + > drivers/iommu/arm-smmu.h | 2 + > 6 files changed, 106 insertions(+), 1 deletion(-) > create mode 100644 drivers/iommu/arm-smmu-nvidia.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 289fb06..b9d59e51 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -15785,9 +15785,11 @@ F: drivers/i2c/busses/i2c-tegra.c > > TEGRA IOMMU DRIVERS > M: Thierry Reding <thierry.reding@gmail.com> > +R: Krishna Reddy <vdumpa@nvidia.com> > L: linux-tegra@vger.kernel.org > S: Supported > F: drivers/iommu/tegra* > +F: drivers/iommu/arm-smmu-nvidia.c > > TEGRA KBC DRIVER > M: Laxman Dewangan <ldewangan@nvidia.com> > diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile > index a2729aa..7f5489e 100644 > --- a/drivers/iommu/Makefile > +++ b/drivers/iommu/Makefile > @@ -13,7 +13,7 @@ obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o > obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o > obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += amd_iommu_debugfs.o > obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o > -obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o > +obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o > obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o > obj-$(CONFIG_DMAR_TABLE) += dmar.o > obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o > diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c > index 5c87a38..e5e595f 100644 > --- a/drivers/iommu/arm-smmu-impl.c > +++ b/drivers/iommu/arm-smmu-impl.c > @@ -162,6 +162,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) > break; > case CAVIUM_SMMUV2: > return cavium_smmu_impl_init(smmu); > + case NVIDIA_SMMUV2: > + return nvidia_smmu_impl_init(smmu); > default: > break; > } > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > new file mode 100644 > index 0000000..d93ceda > --- /dev/null > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -0,0 +1,97 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +// Nvidia ARM SMMU v2 implementation quirks > +// Copyright (C) 2019 NVIDIA CORPORATION. All rights reserved. > + > +#define pr_fmt(fmt) "nvidia-smmu: " fmt > + > +#include <linux/bitfield.h> > +#include <linux/delay.h> > +#include <linux/of.h> > +#include <linux/platform_device.h> > +#include <linux/slab.h> > + > +#include "arm-smmu.h" > + > +#define NUM_SMMU_INSTANCES 3 > + > +struct nvidia_smmu { > + struct arm_smmu_device smmu; > + int num_inst; > + void __iomem *bases[NUM_SMMU_INSTANCES]; > +}; > + > +#define to_nsmmu(s) container_of(s, struct nvidia_smmu, smmu) > + > +#define nsmmu_page(smmu, inst, page) \ > + (((inst) ? to_nsmmu(smmu)->bases[(inst)] : smmu->base) + \ > + ((page) << smmu->pgshift)) > + > +static u32 nsmmu_read_reg(struct arm_smmu_device *smmu, > + int page, int offset) > +{ > + return readl_relaxed(nsmmu_page(smmu, 0, page) + offset); > +} > + > +static void nsmmu_write_reg(struct arm_smmu_device *smmu, > + int page, int offset, u32 val) > +{ > + int i; > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) > + writel_relaxed(val, nsmmu_page(smmu, i, page) + offset); > +} > + > +static u64 nsmmu_read_reg64(struct arm_smmu_device *smmu, > + int page, int offset) > +{ > + return readq_relaxed(nsmmu_page(smmu, 0, page) + offset); > +} > + > +static void nsmmu_write_reg64(struct arm_smmu_device *smmu, > + int page, int offset, u64 val) > +{ > + int i; > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) > + writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); > +} > + > +static const struct arm_smmu_impl nsmmu_impl = { > + .read_reg = nsmmu_read_reg, > + .write_reg = nsmmu_write_reg, > + .read_reg64 = nsmmu_read_reg64, > + .write_reg64 = nsmmu_write_reg64, > +}; > + > +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > +{ > + int i; > + struct nvidia_smmu *nsmmu; > + struct resource *res; > + struct device *dev = smmu->dev; > + struct platform_device *pdev = to_platform_device(smmu->dev); > + > + nsmmu = devm_kzalloc(smmu->dev, sizeof(*nsmmu), GFP_KERNEL); > + if (!nsmmu) > + return ERR_PTR(-ENOMEM); > + > + nsmmu->smmu = *smmu; > + /* Instance 0 is ioremapped by arm-smmu.c */ > + nsmmu->num_inst = 1; > + > + for (i = 1; i < NUM_SMMU_INSTANCES; i++) { > + res = platform_get_resource(pdev, IORESOURCE_MEM, i); > + if (!res) > + break; > + nsmmu->bases[i] = devm_ioremap_resource(dev, res); > + if (IS_ERR(nsmmu->bases[i])) > + return (struct arm_smmu_device *)nsmmu->bases[i]; > + nsmmu->num_inst++; > + } > + > + nsmmu->smmu.impl = &nsmmu_impl; > + devm_kfree(smmu->dev, smmu); > + pr_info("Nvidia SMMUv2, Instances=%d\n", nsmmu->num_inst); > + > + return &nsmmu->smmu; > +} > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 5b93c79..46e1641 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -1871,6 +1871,7 @@ ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU); > ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); > ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); > ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2); > +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? Robin. > > static const struct of_device_id arm_smmu_of_match[] = { > { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, > @@ -1880,6 +1881,7 @@ static const struct of_device_id arm_smmu_of_match[] = { > { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, > { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, > { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 }, > + { .compatible = "nvidia,smmu-v2", .data = &nvidia_smmuv2 }, > { }, > }; > > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index b19b6ca..9645bf1 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -220,6 +220,7 @@ enum arm_smmu_implementation { > ARM_MMU500, > CAVIUM_SMMUV2, > QCOM_SMMUV2, > + NVIDIA_SMMUV2, > }; > > struct arm_smmu_device { > @@ -398,5 +399,6 @@ static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page, > arm_smmu_writeq((s), ARM_SMMU_CB((s), (n)), (o), (v)) > > struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu); > +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu); > > #endif /* _ARM_SMMU_H */ > ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-08-30 15:02 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:02 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add Nvidia SMMUv2 implementation and model info. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > MAINTAINERS | 2 + > drivers/iommu/Makefile | 2 +- > drivers/iommu/arm-smmu-impl.c | 2 + > drivers/iommu/arm-smmu-nvidia.c | 97 +++++++++++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 2 + > drivers/iommu/arm-smmu.h | 2 + > 6 files changed, 106 insertions(+), 1 deletion(-) > create mode 100644 drivers/iommu/arm-smmu-nvidia.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 289fb06..b9d59e51 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -15785,9 +15785,11 @@ F: drivers/i2c/busses/i2c-tegra.c > > TEGRA IOMMU DRIVERS > M: Thierry Reding <thierry.reding@gmail.com> > +R: Krishna Reddy <vdumpa@nvidia.com> > L: linux-tegra@vger.kernel.org > S: Supported > F: drivers/iommu/tegra* > +F: drivers/iommu/arm-smmu-nvidia.c > > TEGRA KBC DRIVER > M: Laxman Dewangan <ldewangan@nvidia.com> > diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile > index a2729aa..7f5489e 100644 > --- a/drivers/iommu/Makefile > +++ b/drivers/iommu/Makefile > @@ -13,7 +13,7 @@ obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o > obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o > obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += amd_iommu_debugfs.o > obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o > -obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o > +obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o > obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o > obj-$(CONFIG_DMAR_TABLE) += dmar.o > obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o > diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c > index 5c87a38..e5e595f 100644 > --- a/drivers/iommu/arm-smmu-impl.c > +++ b/drivers/iommu/arm-smmu-impl.c > @@ -162,6 +162,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) > break; > case CAVIUM_SMMUV2: > return cavium_smmu_impl_init(smmu); > + case NVIDIA_SMMUV2: > + return nvidia_smmu_impl_init(smmu); > default: > break; > } > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > new file mode 100644 > index 0000000..d93ceda > --- /dev/null > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -0,0 +1,97 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +// Nvidia ARM SMMU v2 implementation quirks > +// Copyright (C) 2019 NVIDIA CORPORATION. All rights reserved. > + > +#define pr_fmt(fmt) "nvidia-smmu: " fmt > + > +#include <linux/bitfield.h> > +#include <linux/delay.h> > +#include <linux/of.h> > +#include <linux/platform_device.h> > +#include <linux/slab.h> > + > +#include "arm-smmu.h" > + > +#define NUM_SMMU_INSTANCES 3 > + > +struct nvidia_smmu { > + struct arm_smmu_device smmu; > + int num_inst; > + void __iomem *bases[NUM_SMMU_INSTANCES]; > +}; > + > +#define to_nsmmu(s) container_of(s, struct nvidia_smmu, smmu) > + > +#define nsmmu_page(smmu, inst, page) \ > + (((inst) ? to_nsmmu(smmu)->bases[(inst)] : smmu->base) + \ > + ((page) << smmu->pgshift)) > + > +static u32 nsmmu_read_reg(struct arm_smmu_device *smmu, > + int page, int offset) > +{ > + return readl_relaxed(nsmmu_page(smmu, 0, page) + offset); > +} > + > +static void nsmmu_write_reg(struct arm_smmu_device *smmu, > + int page, int offset, u32 val) > +{ > + int i; > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) > + writel_relaxed(val, nsmmu_page(smmu, i, page) + offset); > +} > + > +static u64 nsmmu_read_reg64(struct arm_smmu_device *smmu, > + int page, int offset) > +{ > + return readq_relaxed(nsmmu_page(smmu, 0, page) + offset); > +} > + > +static void nsmmu_write_reg64(struct arm_smmu_device *smmu, > + int page, int offset, u64 val) > +{ > + int i; > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) > + writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); > +} > + > +static const struct arm_smmu_impl nsmmu_impl = { > + .read_reg = nsmmu_read_reg, > + .write_reg = nsmmu_write_reg, > + .read_reg64 = nsmmu_read_reg64, > + .write_reg64 = nsmmu_write_reg64, > +}; > + > +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > +{ > + int i; > + struct nvidia_smmu *nsmmu; > + struct resource *res; > + struct device *dev = smmu->dev; > + struct platform_device *pdev = to_platform_device(smmu->dev); > + > + nsmmu = devm_kzalloc(smmu->dev, sizeof(*nsmmu), GFP_KERNEL); > + if (!nsmmu) > + return ERR_PTR(-ENOMEM); > + > + nsmmu->smmu = *smmu; > + /* Instance 0 is ioremapped by arm-smmu.c */ > + nsmmu->num_inst = 1; > + > + for (i = 1; i < NUM_SMMU_INSTANCES; i++) { > + res = platform_get_resource(pdev, IORESOURCE_MEM, i); > + if (!res) > + break; > + nsmmu->bases[i] = devm_ioremap_resource(dev, res); > + if (IS_ERR(nsmmu->bases[i])) > + return (struct arm_smmu_device *)nsmmu->bases[i]; > + nsmmu->num_inst++; > + } > + > + nsmmu->smmu.impl = &nsmmu_impl; > + devm_kfree(smmu->dev, smmu); > + pr_info("Nvidia SMMUv2, Instances=%d\n", nsmmu->num_inst); > + > + return &nsmmu->smmu; > +} > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 5b93c79..46e1641 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -1871,6 +1871,7 @@ ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU); > ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); > ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); > ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2); > +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? Robin. > > static const struct of_device_id arm_smmu_of_match[] = { > { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, > @@ -1880,6 +1881,7 @@ static const struct of_device_id arm_smmu_of_match[] = { > { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, > { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, > { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 }, > + { .compatible = "nvidia,smmu-v2", .data = &nvidia_smmuv2 }, > { }, > }; > > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index b19b6ca..9645bf1 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -220,6 +220,7 @@ enum arm_smmu_implementation { > ARM_MMU500, > CAVIUM_SMMUV2, > QCOM_SMMUV2, > + NVIDIA_SMMUV2, > }; > > struct arm_smmu_device { > @@ -398,5 +399,6 @@ static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page, > arm_smmu_writeq((s), ARM_SMMU_CB((s), (n)), (o), (v)) > > struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu); > +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu); > > #endif /* _ARM_SMMU_H */ > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-08-30 15:02 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:02 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add Nvidia SMMUv2 implementation and model info. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > MAINTAINERS | 2 + > drivers/iommu/Makefile | 2 +- > drivers/iommu/arm-smmu-impl.c | 2 + > drivers/iommu/arm-smmu-nvidia.c | 97 +++++++++++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 2 + > drivers/iommu/arm-smmu.h | 2 + > 6 files changed, 106 insertions(+), 1 deletion(-) > create mode 100644 drivers/iommu/arm-smmu-nvidia.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 289fb06..b9d59e51 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -15785,9 +15785,11 @@ F: drivers/i2c/busses/i2c-tegra.c > > TEGRA IOMMU DRIVERS > M: Thierry Reding <thierry.reding@gmail.com> > +R: Krishna Reddy <vdumpa@nvidia.com> > L: linux-tegra@vger.kernel.org > S: Supported > F: drivers/iommu/tegra* > +F: drivers/iommu/arm-smmu-nvidia.c > > TEGRA KBC DRIVER > M: Laxman Dewangan <ldewangan@nvidia.com> > diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile > index a2729aa..7f5489e 100644 > --- a/drivers/iommu/Makefile > +++ b/drivers/iommu/Makefile > @@ -13,7 +13,7 @@ obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o > obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o > obj-$(CONFIG_AMD_IOMMU_DEBUGFS) += amd_iommu_debugfs.o > obj-$(CONFIG_AMD_IOMMU_V2) += amd_iommu_v2.o > -obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o > +obj-$(CONFIG_ARM_SMMU) += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o > obj-$(CONFIG_ARM_SMMU_V3) += arm-smmu-v3.o > obj-$(CONFIG_DMAR_TABLE) += dmar.o > obj-$(CONFIG_INTEL_IOMMU) += intel-iommu.o intel-pasid.o > diff --git a/drivers/iommu/arm-smmu-impl.c b/drivers/iommu/arm-smmu-impl.c > index 5c87a38..e5e595f 100644 > --- a/drivers/iommu/arm-smmu-impl.c > +++ b/drivers/iommu/arm-smmu-impl.c > @@ -162,6 +162,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) > break; > case CAVIUM_SMMUV2: > return cavium_smmu_impl_init(smmu); > + case NVIDIA_SMMUV2: > + return nvidia_smmu_impl_init(smmu); > default: > break; > } > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > new file mode 100644 > index 0000000..d93ceda > --- /dev/null > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -0,0 +1,97 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +// Nvidia ARM SMMU v2 implementation quirks > +// Copyright (C) 2019 NVIDIA CORPORATION. All rights reserved. > + > +#define pr_fmt(fmt) "nvidia-smmu: " fmt > + > +#include <linux/bitfield.h> > +#include <linux/delay.h> > +#include <linux/of.h> > +#include <linux/platform_device.h> > +#include <linux/slab.h> > + > +#include "arm-smmu.h" > + > +#define NUM_SMMU_INSTANCES 3 > + > +struct nvidia_smmu { > + struct arm_smmu_device smmu; > + int num_inst; > + void __iomem *bases[NUM_SMMU_INSTANCES]; > +}; > + > +#define to_nsmmu(s) container_of(s, struct nvidia_smmu, smmu) > + > +#define nsmmu_page(smmu, inst, page) \ > + (((inst) ? to_nsmmu(smmu)->bases[(inst)] : smmu->base) + \ > + ((page) << smmu->pgshift)) > + > +static u32 nsmmu_read_reg(struct arm_smmu_device *smmu, > + int page, int offset) > +{ > + return readl_relaxed(nsmmu_page(smmu, 0, page) + offset); > +} > + > +static void nsmmu_write_reg(struct arm_smmu_device *smmu, > + int page, int offset, u32 val) > +{ > + int i; > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) > + writel_relaxed(val, nsmmu_page(smmu, i, page) + offset); > +} > + > +static u64 nsmmu_read_reg64(struct arm_smmu_device *smmu, > + int page, int offset) > +{ > + return readq_relaxed(nsmmu_page(smmu, 0, page) + offset); > +} > + > +static void nsmmu_write_reg64(struct arm_smmu_device *smmu, > + int page, int offset, u64 val) > +{ > + int i; > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) > + writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); > +} > + > +static const struct arm_smmu_impl nsmmu_impl = { > + .read_reg = nsmmu_read_reg, > + .write_reg = nsmmu_write_reg, > + .read_reg64 = nsmmu_read_reg64, > + .write_reg64 = nsmmu_write_reg64, > +}; > + > +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > +{ > + int i; > + struct nvidia_smmu *nsmmu; > + struct resource *res; > + struct device *dev = smmu->dev; > + struct platform_device *pdev = to_platform_device(smmu->dev); > + > + nsmmu = devm_kzalloc(smmu->dev, sizeof(*nsmmu), GFP_KERNEL); > + if (!nsmmu) > + return ERR_PTR(-ENOMEM); > + > + nsmmu->smmu = *smmu; > + /* Instance 0 is ioremapped by arm-smmu.c */ > + nsmmu->num_inst = 1; > + > + for (i = 1; i < NUM_SMMU_INSTANCES; i++) { > + res = platform_get_resource(pdev, IORESOURCE_MEM, i); > + if (!res) > + break; > + nsmmu->bases[i] = devm_ioremap_resource(dev, res); > + if (IS_ERR(nsmmu->bases[i])) > + return (struct arm_smmu_device *)nsmmu->bases[i]; > + nsmmu->num_inst++; > + } > + > + nsmmu->smmu.impl = &nsmmu_impl; > + devm_kfree(smmu->dev, smmu); > + pr_info("Nvidia SMMUv2, Instances=%d\n", nsmmu->num_inst); > + > + return &nsmmu->smmu; > +} > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 5b93c79..46e1641 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -1871,6 +1871,7 @@ ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU); > ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); > ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); > ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2); > +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? Robin. > > static const struct of_device_id arm_smmu_of_match[] = { > { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, > @@ -1880,6 +1881,7 @@ static const struct of_device_id arm_smmu_of_match[] = { > { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, > { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, > { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 }, > + { .compatible = "nvidia,smmu-v2", .data = &nvidia_smmuv2 }, > { }, > }; > > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index b19b6ca..9645bf1 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -220,6 +220,7 @@ enum arm_smmu_implementation { > ARM_MMU500, > CAVIUM_SMMUV2, > QCOM_SMMUV2, > + NVIDIA_SMMUV2, > }; > > struct arm_smmu_device { > @@ -398,5 +399,6 @@ static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page, > arm_smmu_writeq((s), ARM_SMMU_CB((s), (n)), (o), (v)) > > struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu); > +struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu); > > #endif /* _ARM_SMMU_H */ > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation 2019-08-30 15:02 ` Robin Murphy (?) (?) @ 2019-08-30 18:16 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:16 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); > From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-08-30 18:16 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:16 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, joro, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); > From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-08-30 18:16 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:16 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); > From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-08-30 18:16 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:16 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); > From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
[parent not found: <BYAPR12MB2710D045303BE89A7D3FF2C1B3BD0-ZGDeBxoHBPnlX2Hc6Vgn3wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>]
* Re: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation 2019-08-30 18:16 ` Krishna Reddy (?) (?) @ 2019-09-02 13:39 ` Robin Murphy -1 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-09-02 13:39 UTC (permalink / raw) To: Krishna Reddy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel-u79uwXL29TY76Z2rM5mHXA, will.deacon-5wv7dgnIgG8, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra-u79uwXL29TY76Z2rM5mHXA, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On 30/08/2019 19:16, Krishna Reddy wrote: >>> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); > >> From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? > > The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. > I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. In that case, I would rather keep smmu->model representing the MMU-500 microarchitecture - since you'll still want to pick up errata workarounds etc. for that - and detect the Tegra integration via an explicit of_device_is_compatible() check in arm_smmu_impl_init(). For comparison, under ACPI we'd probably have to detect integration details by looking at table headers, separately from the IORT "Model" field, so I'd prefer if the DT vs. ACPI handling didn't diverge more than necessary. Of course, that immediately opens the question of how best to combine arm_mmu500_impl with nsmmu_impl, but hey, one step at a time :) Robin. ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-09-02 13:39 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-09-02 13:39 UTC (permalink / raw) To: Krishna Reddy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, joro, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel On 30/08/2019 19:16, Krishna Reddy wrote: >>> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); > >> From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? > > The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. > I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. In that case, I would rather keep smmu->model representing the MMU-500 microarchitecture - since you'll still want to pick up errata workarounds etc. for that - and detect the Tegra integration via an explicit of_device_is_compatible() check in arm_smmu_impl_init(). For comparison, under ACPI we'd probably have to detect integration details by looking at table headers, separately from the IORT "Model" field, so I'd prefer if the DT vs. ACPI handling didn't diverge more than necessary. Of course, that immediately opens the question of how best to combine arm_mmu500_impl with nsmmu_impl, but hey, one step at a time :) Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-09-02 13:39 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-09-02 13:39 UTC (permalink / raw) To: Krishna Reddy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel On 30/08/2019 19:16, Krishna Reddy wrote: >>> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); > >> From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? > > The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. > I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. In that case, I would rather keep smmu->model representing the MMU-500 microarchitecture - since you'll still want to pick up errata workarounds etc. for that - and detect the Tegra integration via an explicit of_device_is_compatible() check in arm_smmu_impl_init(). For comparison, under ACPI we'd probably have to detect integration details by looking at table headers, separately from the IORT "Model" field, so I'd prefer if the DT vs. ACPI handling didn't diverge more than necessary. Of course, that immediately opens the question of how best to combine arm_mmu500_impl with nsmmu_impl, but hey, one step at a time :) Robin. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-09-02 13:39 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-09-02 13:39 UTC (permalink / raw) To: Krishna Reddy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro On 30/08/2019 19:16, Krishna Reddy wrote: >>> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); > >> From the previous discussions, I got the impression that other than the 'novel' way they're integrated, the actual SMMU implementations were unmodified Arm MMU-500s. Is that the case, or have I misread something? > > The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. > I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. In that case, I would rather keep smmu->model representing the MMU-500 microarchitecture - since you'll still want to pick up errata workarounds etc. for that - and detect the Tegra integration via an explicit of_device_is_compatible() check in arm_smmu_impl_init(). For comparison, under ACPI we'd probably have to detect integration details by looking at table headers, separately from the IORT "Model" field, so I'd prefer if the DT vs. ACPI handling didn't diverge more than necessary. Of course, that immediately opens the question of how best to combine arm_mmu500_impl with nsmmu_impl, but hey, one step at a time :) Robin. ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation 2019-09-02 13:39 ` Robin Murphy (?) (?) @ 2019-09-03 1:07 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-09-03 1:07 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >>> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); >> The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. >> I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. >In that case, I would rather keep smmu->model representing the MMU-500 microarchitecture - >since you'll still want to pick up errata workarounds etc. for that - and detect the Tegra integration via an explicit of_device_is_compatible() > check in arm_smmu_impl_init(). Looks good to me. >For comparison, under ACPI we'd probably have to detect integration details by looking at table headers, separately > from the IORT "Model" field, so I'd prefer if the DT vs. ACPI handling didn't diverge more than necessary. ACPI support for T194 can be added based on need in subsequent patches. For now, I am updating it for DT support. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-09-03 1:07 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-09-03 1:07 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, joro, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >>> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); >> The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. >> I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. >In that case, I would rather keep smmu->model representing the MMU-500 microarchitecture - >since you'll still want to pick up errata workarounds etc. for that - and detect the Tegra integration via an explicit of_device_is_compatible() > check in arm_smmu_impl_init(). Looks good to me. >For comparison, under ACPI we'd probably have to detect integration details by looking at table headers, separately > from the IORT "Model" field, so I'd prefer if the DT vs. ACPI handling didn't diverge more than necessary. ACPI support for T194 can be added based on need in subsequent patches. For now, I am updating it for DT support. -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-09-03 1:07 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-09-03 1:07 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >>> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); >> The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. >> I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. >In that case, I would rather keep smmu->model representing the MMU-500 microarchitecture - >since you'll still want to pick up errata workarounds etc. for that - and detect the Tegra integration via an explicit of_device_is_compatible() > check in arm_smmu_impl_init(). Looks good to me. >For comparison, under ACPI we'd probably have to detect integration details by looking at table headers, separately > from the IORT "Model" field, so I'd prefer if the DT vs. ACPI handling didn't diverge more than necessary. ACPI support for T194 can be added based on need in subsequent patches. For now, I am updating it for DT support. -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation @ 2019-09-03 1:07 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-09-03 1:07 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >>> +ARM_SMMU_MATCH_DATA(nvidia_smmuv2, ARM_SMMU_V2, NVIDIA_SMMUV2); >> The ARM MMU-500 implementation is unmodified. It is the way the are integrated and used together(for interleaved accesses) is different from regular ARM MMU-500. >> I have added it to get the model number and to be able differentiate the SMMU implementation in arm-smmu-impl.c. >In that case, I would rather keep smmu->model representing the MMU-500 microarchitecture - >since you'll still want to pick up errata workarounds etc. for that - and detect the Tegra integration via an explicit of_device_is_compatible() > check in arm_smmu_impl_init(). Looks good to me. >For comparison, under ACPI we'd probably have to detect integration details by looking at table headers, separately > from the IORT "Model" field, so I'd prefer if the DT vs. ACPI handling didn't diverge more than necessary. ACPI support for T194 can be added based on need in subsequent patches. For now, I am updating it for DT support. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 2019-08-29 22:47 ` Krishna Reddy (?) (?) @ 2019-08-29 22:47 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add binding doc for Nvidia's smmu-v2 implementation. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt index 3133f3b..0de3759 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt @@ -17,6 +17,7 @@ conditions. "arm,mmu-401" "arm,mmu-500" "cavium,smmu-v2" + "nidia,smmu-v2" "qcom,smmu-v2" depending on the particular implementation and/or the -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add binding doc for Nvidia's smmu-v2 implementation. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt index 3133f3b..0de3759 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt @@ -17,6 +17,7 @@ conditions. "arm,mmu-401" "arm,mmu-500" "cavium,smmu-v2" + "nidia,smmu-v2" "qcom,smmu-v2" depending on the particular implementation and/or the -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add binding doc for Nvidia's smmu-v2 implementation. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt index 3133f3b..0de3759 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt @@ -17,6 +17,7 @@ conditions. "arm,mmu-401" "arm,mmu-500" "cavium,smmu-v2" + "nidia,smmu-v2" "qcom,smmu-v2" depending on the particular implementation and/or the -- 2.1.4 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add binding doc for Nvidia's smmu-v2 implementation. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt index 3133f3b..0de3759 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt @@ -17,6 +17,7 @@ conditions. "arm,mmu-401" "arm,mmu-500" "cavium,smmu-v2" + "nidia,smmu-v2" "qcom,smmu-v2" depending on the particular implementation and/or the -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 12:07 ` Mikko Perttunen -1 siblings, 0 replies; 122+ messages in thread From: Mikko Perttunen @ 2019-08-30 12:07 UTC (permalink / raw) To: Krishna Reddy Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen On 30.8.2019 1.47, Krishna Reddy wrote: > Add binding doc for Nvidia's smmu-v2 implementation. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > index 3133f3b..0de3759 100644 > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > @@ -17,6 +17,7 @@ conditions. > "arm,mmu-401" > "arm,mmu-500" > "cavium,smmu-v2" > + "nidia,smmu-v2" nvidia Mikko > "qcom,smmu-v2" > > depending on the particular implementation and/or the > ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 @ 2019-08-30 12:07 ` Mikko Perttunen 0 siblings, 0 replies; 122+ messages in thread From: Mikko Perttunen @ 2019-08-30 12:07 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel On 30.8.2019 1.47, Krishna Reddy wrote: > Add binding doc for Nvidia's smmu-v2 implementation. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > index 3133f3b..0de3759 100644 > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > @@ -17,6 +17,7 @@ conditions. > "arm,mmu-401" > "arm,mmu-500" > "cavium,smmu-v2" > + "nidia,smmu-v2" nvidia Mikko > "qcom,smmu-v2" > > depending on the particular implementation and/or the > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 @ 2019-08-30 12:07 ` Mikko Perttunen 0 siblings, 0 replies; 122+ messages in thread From: Mikko Perttunen @ 2019-08-30 12:07 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel On 30.8.2019 1.47, Krishna Reddy wrote: > Add binding doc for Nvidia's smmu-v2 implementation. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > index 3133f3b..0de3759 100644 > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > @@ -17,6 +17,7 @@ conditions. > "arm,mmu-401" > "arm,mmu-500" > "cavium,smmu-v2" > + "nidia,smmu-v2" nvidia Mikko > "qcom,smmu-v2" > > depending on the particular implementation and/or the > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 15:13 ` Robin Murphy -1 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:13 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add binding doc for Nvidia's smmu-v2 implementation. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > index 3133f3b..0de3759 100644 > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > @@ -17,6 +17,7 @@ conditions. > "arm,mmu-401" > "arm,mmu-500" > "cavium,smmu-v2" > + "nidia,smmu-v2" > "qcom,smmu-v2" I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. Robin. > > depending on the particular implementation and/or the > ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 @ 2019-08-30 15:13 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:13 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add binding doc for Nvidia's smmu-v2 implementation. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > index 3133f3b..0de3759 100644 > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > @@ -17,6 +17,7 @@ conditions. > "arm,mmu-401" > "arm,mmu-500" > "cavium,smmu-v2" > + "nidia,smmu-v2" > "qcom,smmu-v2" I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. Robin. > > depending on the particular implementation and/or the > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 @ 2019-08-30 15:13 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:13 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add binding doc for Nvidia's smmu-v2 implementation. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > Documentation/devicetree/bindings/iommu/arm,smmu.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > index 3133f3b..0de3759 100644 > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt > @@ -17,6 +17,7 @@ conditions. > "arm,mmu-401" > "arm,mmu-500" > "cavium,smmu-v2" > + "nidia,smmu-v2" > "qcom,smmu-v2" I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. Robin. > > depending on the particular implementation and/or the > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 2019-08-30 15:13 ` Robin Murphy (?) (?) @ 2019-08-30 18:12 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:12 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel >> + "nidia,smmu-v2" >> "qcom,smmu-v2" >I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") > depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. I am correcting the spelling mistake pointed by Mikko. The NVIDIA SMMUv2 implementation is getting used beyond Tegra194 SOC. To be able to use the smmu compatible string across multiple SOC's, "nvidia,smmu-v2" compatible string is chosen. Are you suggesting to make it soc specific and add another one in future? -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 @ 2019-08-30 18:12 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:12 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + "nidia,smmu-v2" >> "qcom,smmu-v2" >I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") > depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. I am correcting the spelling mistake pointed by Mikko. The NVIDIA SMMUv2 implementation is getting used beyond Tegra194 SOC. To be able to use the smmu compatible string across multiple SOC's, "nvidia,smmu-v2" compatible string is chosen. Are you suggesting to make it soc specific and add another one in future? -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 @ 2019-08-30 18:12 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:12 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + "nidia,smmu-v2" >> "qcom,smmu-v2" >I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") > depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. I am correcting the spelling mistake pointed by Mikko. The NVIDIA SMMUv2 implementation is getting used beyond Tegra194 SOC. To be able to use the smmu compatible string across multiple SOC's, "nvidia,smmu-v2" compatible string is chosen. Are you suggesting to make it soc specific and add another one in future? -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 @ 2019-08-30 18:12 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:12 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel >> + "nidia,smmu-v2" >> "qcom,smmu-v2" >I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") > depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. I am correcting the spelling mistake pointed by Mikko. The NVIDIA SMMUv2 implementation is getting used beyond Tegra194 SOC. To be able to use the smmu compatible string across multiple SOC's, "nvidia,smmu-v2" compatible string is chosen. Are you suggesting to make it soc specific and add another one in future? -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 2019-08-30 18:12 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 Krishna Reddy (?) (?) @ 2019-09-02 7:38 ` Thierry Reding -1 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-09-02 7:38 UTC (permalink / raw) To: Krishna Reddy Cc: Robin Murphy, Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 1963 bytes --] On Fri, Aug 30, 2019 at 06:12:08PM +0000, Krishna Reddy wrote: > >> + "nidia,smmu-v2" > >> "qcom,smmu-v2" > > >I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") > > depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. > > I am correcting the spelling mistake pointed by Mikko. The NVIDIA SMMUv2 implementation is getting used beyond Tegra194 SOC. > To be able to use the smmu compatible string across multiple SOC's, "nvidia,smmu-v2" compatible string is chosen. > Are you suggesting to make it soc specific and add another one in future? Yeah, I think that's the safest thing to do. Even if we're using the same implementation in future SoCs, chances are there will be some changes. Even if the changes are just fixes, having a SoC-specific compatible string will ensure we can apply workarounds only to the implementations that are missing the fixes. So I think "nvidia,tegra194-smmu" is a good candidate. It uniquely identifies the instantiation of the IP in Tegra194. Also, if it ever turns out that the instantiation of the SMMU in the next Tegra generation is *exactly* the same (even if highly unlikely), there's nothing wrong with reusing the "nvidia,tegra194-smmu". We've done similar things in the past, where some new IP was mostly compatible with old IP. Typically we still include a new compatible string in case any errata are discovered subsequently. It's not uncommon to see things like: compatible = "nvidia,tegra124-xyz", "nvidia,tegra20-xyz"; Basically this means that this is the IP that was also used in Tegra20 and the same Tegra20 driver can be used to drive this hardware on Tegra124. The Tegra124-specific compatible string may enable newer features if there's a driver that supports it. Thierry [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 @ 2019-09-02 7:38 ` Thierry Reding 0 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-09-02 7:38 UTC (permalink / raw) To: Krishna Reddy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Robin Murphy, Alexander Van Brunt, linux-arm-kernel [-- Attachment #1.1: Type: text/plain, Size: 1963 bytes --] On Fri, Aug 30, 2019 at 06:12:08PM +0000, Krishna Reddy wrote: > >> + "nidia,smmu-v2" > >> "qcom,smmu-v2" > > >I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") > > depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. > > I am correcting the spelling mistake pointed by Mikko. The NVIDIA SMMUv2 implementation is getting used beyond Tegra194 SOC. > To be able to use the smmu compatible string across multiple SOC's, "nvidia,smmu-v2" compatible string is chosen. > Are you suggesting to make it soc specific and add another one in future? Yeah, I think that's the safest thing to do. Even if we're using the same implementation in future SoCs, chances are there will be some changes. Even if the changes are just fixes, having a SoC-specific compatible string will ensure we can apply workarounds only to the implementations that are missing the fixes. So I think "nvidia,tegra194-smmu" is a good candidate. It uniquely identifies the instantiation of the IP in Tegra194. Also, if it ever turns out that the instantiation of the SMMU in the next Tegra generation is *exactly* the same (even if highly unlikely), there's nothing wrong with reusing the "nvidia,tegra194-smmu". We've done similar things in the past, where some new IP was mostly compatible with old IP. Typically we still include a new compatible string in case any errata are discovered subsequently. It's not uncommon to see things like: compatible = "nvidia,tegra124-xyz", "nvidia,tegra20-xyz"; Basically this means that this is the IP that was also used in Tegra20 and the same Tegra20 driver can be used to drive this hardware on Tegra124. The Tegra124-specific compatible string may enable newer features if there's a driver that supports it. Thierry [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 @ 2019-09-02 7:38 ` Thierry Reding 0 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-09-02 7:38 UTC (permalink / raw) To: Krishna Reddy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Robin Murphy, Alexander Van Brunt, linux-arm-kernel [-- Attachment #1.1: Type: text/plain, Size: 1963 bytes --] On Fri, Aug 30, 2019 at 06:12:08PM +0000, Krishna Reddy wrote: > >> + "nidia,smmu-v2" > >> "qcom,smmu-v2" > > >I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") > > depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. > > I am correcting the spelling mistake pointed by Mikko. The NVIDIA SMMUv2 implementation is getting used beyond Tegra194 SOC. > To be able to use the smmu compatible string across multiple SOC's, "nvidia,smmu-v2" compatible string is chosen. > Are you suggesting to make it soc specific and add another one in future? Yeah, I think that's the safest thing to do. Even if we're using the same implementation in future SoCs, chances are there will be some changes. Even if the changes are just fixes, having a SoC-specific compatible string will ensure we can apply workarounds only to the implementations that are missing the fixes. So I think "nvidia,tegra194-smmu" is a good candidate. It uniquely identifies the instantiation of the IP in Tegra194. Also, if it ever turns out that the instantiation of the SMMU in the next Tegra generation is *exactly* the same (even if highly unlikely), there's nothing wrong with reusing the "nvidia,tegra194-smmu". We've done similar things in the past, where some new IP was mostly compatible with old IP. Typically we still include a new compatible string in case any errata are discovered subsequently. It's not uncommon to see things like: compatible = "nvidia,tegra124-xyz", "nvidia,tegra20-xyz"; Basically this means that this is the IP that was also used in Tegra20 and the same Tegra20 driver can be used to drive this hardware on Tegra124. The Tegra124-specific compatible string may enable newer features if there's a driver that supports it. Thierry [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 @ 2019-09-02 7:38 ` Thierry Reding 0 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-09-02 7:38 UTC (permalink / raw) To: Krishna Reddy Cc: Robin Murphy, Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 1963 bytes --] On Fri, Aug 30, 2019 at 06:12:08PM +0000, Krishna Reddy wrote: > >> + "nidia,smmu-v2" > >> "qcom,smmu-v2" > > >I agree with Mikko that the compatible must be at least SoC-specific, but potentially even instance-specific (e.g. "nvidia,tegra194-gpu-smmu") > > depending on how many of these parallel-SMMU configurations might be hiding in current and future SoCs. > > I am correcting the spelling mistake pointed by Mikko. The NVIDIA SMMUv2 implementation is getting used beyond Tegra194 SOC. > To be able to use the smmu compatible string across multiple SOC's, "nvidia,smmu-v2" compatible string is chosen. > Are you suggesting to make it soc specific and add another one in future? Yeah, I think that's the safest thing to do. Even if we're using the same implementation in future SoCs, chances are there will be some changes. Even if the changes are just fixes, having a SoC-specific compatible string will ensure we can apply workarounds only to the implementations that are missing the fixes. So I think "nvidia,tegra194-smmu" is a good candidate. It uniquely identifies the instantiation of the IP in Tegra194. Also, if it ever turns out that the instantiation of the SMMU in the next Tegra generation is *exactly* the same (even if highly unlikely), there's nothing wrong with reusing the "nvidia,tegra194-smmu". We've done similar things in the past, where some new IP was mostly compatible with old IP. Typically we still include a new compatible string in case any errata are discovered subsequently. It's not uncommon to see things like: compatible = "nvidia,tegra124-xyz", "nvidia,tegra20-xyz"; Basically this means that this is the IP that was also used in Tegra20 and the same Tegra20 driver can be used to drive this hardware on Tegra124. The Tegra124-specific compatible string may enable newer features if there's a driver that supports it. Thierry [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook 2019-08-29 22:47 ` Krishna Reddy (?) (?) @ 2019-08-29 22:47 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy tlb_sync hook allows nvidia smmu handle tlb sync across multiple SMMUs as necessary. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 8 +++++--- drivers/iommu/arm-smmu.h | 4 ++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c index d93ceda..a429b2c 100644 --- a/drivers/iommu/arm-smmu-nvidia.c +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); } +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, + int sync, int status, int inst) +{ + u32 reg; + unsigned int spin_cnt, delay; + + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { + reg = readl_relaxed( + nsmmu_page(smmu, inst, page) + status); + if (!(reg & sTLBGSTATUS_GSACTIVE)) + return; + cpu_relax(); + } + udelay(delay); + } + dev_err_ratelimited(smmu->dev, + "TLB sync timed out -- SMMU may be deadlocked\n"); +} + +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, + int sync, int status) +{ + int i; + + arm_smmu_writel(smmu, page, sync, 0); + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); +} + static const struct arm_smmu_impl nsmmu_impl = { .read_reg = nsmmu_read_reg, .write_reg = nsmmu_write_reg, .read_reg64 = nsmmu_read_reg64, .write_reg64 = nsmmu_write_reg64, + .tlb_sync = nsmmu_tlb_sync, }; struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 46e1641..f5454e71 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -52,9 +52,6 @@ */ #define QCOM_DUMMY_VAL -1 -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ -#define TLB_SPIN_COUNT 10 - #define MSI_IOVA_BASE 0x8000000 #define MSI_IOVA_LENGTH 0x100000 @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, unsigned int spin_cnt, delay; u32 reg; + if (smmu->impl->tlb_sync) { + smmu->impl->tlb_sync(smmu, page, sync, status); + return; + } + arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index 9645bf1..d3217f1 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { /* Maximum number of context banks per SMMU */ #define ARM_SMMU_MAX_CBS 128 +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ +#define TLB_SPIN_COUNT 10 /* Shared driver definitions */ enum arm_smmu_arch_version { @@ -336,6 +338,8 @@ struct arm_smmu_impl { int (*cfg_probe)(struct arm_smmu_device *smmu); int (*reset)(struct arm_smmu_device *smmu); int (*init_context)(struct arm_smmu_domain *smmu_domain); + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, + int status); }; static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel tlb_sync hook allows nvidia smmu handle tlb sync across multiple SMMUs as necessary. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 8 +++++--- drivers/iommu/arm-smmu.h | 4 ++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c index d93ceda..a429b2c 100644 --- a/drivers/iommu/arm-smmu-nvidia.c +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); } +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, + int sync, int status, int inst) +{ + u32 reg; + unsigned int spin_cnt, delay; + + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { + reg = readl_relaxed( + nsmmu_page(smmu, inst, page) + status); + if (!(reg & sTLBGSTATUS_GSACTIVE)) + return; + cpu_relax(); + } + udelay(delay); + } + dev_err_ratelimited(smmu->dev, + "TLB sync timed out -- SMMU may be deadlocked\n"); +} + +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, + int sync, int status) +{ + int i; + + arm_smmu_writel(smmu, page, sync, 0); + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); +} + static const struct arm_smmu_impl nsmmu_impl = { .read_reg = nsmmu_read_reg, .write_reg = nsmmu_write_reg, .read_reg64 = nsmmu_read_reg64, .write_reg64 = nsmmu_write_reg64, + .tlb_sync = nsmmu_tlb_sync, }; struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 46e1641..f5454e71 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -52,9 +52,6 @@ */ #define QCOM_DUMMY_VAL -1 -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ -#define TLB_SPIN_COUNT 10 - #define MSI_IOVA_BASE 0x8000000 #define MSI_IOVA_LENGTH 0x100000 @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, unsigned int spin_cnt, delay; u32 reg; + if (smmu->impl->tlb_sync) { + smmu->impl->tlb_sync(smmu, page, sync, status); + return; + } + arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index 9645bf1..d3217f1 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { /* Maximum number of context banks per SMMU */ #define ARM_SMMU_MAX_CBS 128 +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ +#define TLB_SPIN_COUNT 10 /* Shared driver definitions */ enum arm_smmu_arch_version { @@ -336,6 +338,8 @@ struct arm_smmu_impl { int (*cfg_probe)(struct arm_smmu_device *smmu); int (*reset)(struct arm_smmu_device *smmu); int (*init_context)(struct arm_smmu_domain *smmu_domain); + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, + int status); }; static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel tlb_sync hook allows nvidia smmu handle tlb sync across multiple SMMUs as necessary. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 8 +++++--- drivers/iommu/arm-smmu.h | 4 ++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c index d93ceda..a429b2c 100644 --- a/drivers/iommu/arm-smmu-nvidia.c +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); } +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, + int sync, int status, int inst) +{ + u32 reg; + unsigned int spin_cnt, delay; + + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { + reg = readl_relaxed( + nsmmu_page(smmu, inst, page) + status); + if (!(reg & sTLBGSTATUS_GSACTIVE)) + return; + cpu_relax(); + } + udelay(delay); + } + dev_err_ratelimited(smmu->dev, + "TLB sync timed out -- SMMU may be deadlocked\n"); +} + +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, + int sync, int status) +{ + int i; + + arm_smmu_writel(smmu, page, sync, 0); + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); +} + static const struct arm_smmu_impl nsmmu_impl = { .read_reg = nsmmu_read_reg, .write_reg = nsmmu_write_reg, .read_reg64 = nsmmu_read_reg64, .write_reg64 = nsmmu_write_reg64, + .tlb_sync = nsmmu_tlb_sync, }; struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 46e1641..f5454e71 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -52,9 +52,6 @@ */ #define QCOM_DUMMY_VAL -1 -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ -#define TLB_SPIN_COUNT 10 - #define MSI_IOVA_BASE 0x8000000 #define MSI_IOVA_LENGTH 0x100000 @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, unsigned int spin_cnt, delay; u32 reg; + if (smmu->impl->tlb_sync) { + smmu->impl->tlb_sync(smmu, page, sync, status); + return; + } + arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index 9645bf1..d3217f1 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { /* Maximum number of context banks per SMMU */ #define ARM_SMMU_MAX_CBS 128 +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ +#define TLB_SPIN_COUNT 10 /* Shared driver definitions */ enum arm_smmu_arch_version { @@ -336,6 +338,8 @@ struct arm_smmu_impl { int (*cfg_probe)(struct arm_smmu_device *smmu); int (*reset)(struct arm_smmu_device *smmu); int (*init_context)(struct arm_smmu_domain *smmu_domain); + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, + int status); }; static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) -- 2.1.4 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy tlb_sync hook allows nvidia smmu handle tlb sync across multiple SMMUs as necessary. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 8 +++++--- drivers/iommu/arm-smmu.h | 4 ++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c index d93ceda..a429b2c 100644 --- a/drivers/iommu/arm-smmu-nvidia.c +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); } +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, + int sync, int status, int inst) +{ + u32 reg; + unsigned int spin_cnt, delay; + + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { + reg = readl_relaxed( + nsmmu_page(smmu, inst, page) + status); + if (!(reg & sTLBGSTATUS_GSACTIVE)) + return; + cpu_relax(); + } + udelay(delay); + } + dev_err_ratelimited(smmu->dev, + "TLB sync timed out -- SMMU may be deadlocked\n"); +} + +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, + int sync, int status) +{ + int i; + + arm_smmu_writel(smmu, page, sync, 0); + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); +} + static const struct arm_smmu_impl nsmmu_impl = { .read_reg = nsmmu_read_reg, .write_reg = nsmmu_write_reg, .read_reg64 = nsmmu_read_reg64, .write_reg64 = nsmmu_write_reg64, + .tlb_sync = nsmmu_tlb_sync, }; struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 46e1641..f5454e71 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -52,9 +52,6 @@ */ #define QCOM_DUMMY_VAL -1 -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ -#define TLB_SPIN_COUNT 10 - #define MSI_IOVA_BASE 0x8000000 #define MSI_IOVA_LENGTH 0x100000 @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, unsigned int spin_cnt, delay; u32 reg; + if (smmu->impl->tlb_sync) { + smmu->impl->tlb_sync(smmu, page, sync, status); + return; + } + arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index 9645bf1..d3217f1 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { /* Maximum number of context banks per SMMU */ #define ARM_SMMU_MAX_CBS 128 +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ +#define TLB_SPIN_COUNT 10 /* Shared driver definitions */ enum arm_smmu_arch_version { @@ -336,6 +338,8 @@ struct arm_smmu_impl { int (*cfg_probe)(struct arm_smmu_device *smmu); int (*reset)(struct arm_smmu_device *smmu); int (*init_context)(struct arm_smmu_domain *smmu_domain); + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, + int status); }; static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 11:14 ` Thierry Reding -1 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-08-30 11:14 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel [-- Attachment #1.1: Type: text/plain, Size: 3970 bytes --] On Thu, Aug 29, 2019 at 03:47:03PM -0700, Krishna Reddy wrote: > tlb_sync hook allows nvidia smmu handle tlb sync > across multiple SMMUs as necessary. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 8 +++++--- > drivers/iommu/arm-smmu.h | 4 ++++ > 3 files changed, 41 insertions(+), 3 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index d93ceda..a429b2c 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, > writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); > } > > +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, > + int sync, int status, int inst) > +{ > + u32 reg; > + unsigned int spin_cnt, delay; > + > + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > + reg = readl_relaxed( > + nsmmu_page(smmu, inst, page) + status); > + if (!(reg & sTLBGSTATUS_GSACTIVE)) > + return; > + cpu_relax(); > + } > + udelay(delay); > + } > + dev_err_ratelimited(smmu->dev, > + "TLB sync timed out -- SMMU may be deadlocked\n"); > +} > + > +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > + int sync, int status) > +{ > + int i; > + > + arm_smmu_writel(smmu, page, sync, 0); > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) > + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > + .tlb_sync = nsmmu_tlb_sync, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 46e1641..f5454e71 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -52,9 +52,6 @@ > */ > #define QCOM_DUMMY_VAL -1 > > -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > -#define TLB_SPIN_COUNT 10 > - > #define MSI_IOVA_BASE 0x8000000 > #define MSI_IOVA_LENGTH 0x100000 > > @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, > unsigned int spin_cnt, delay; > u32 reg; > > + if (smmu->impl->tlb_sync) { > + smmu->impl->tlb_sync(smmu, page, sync, status); > + return; > + } > + Wouldn't it work if you replaced all calls of __arm_smmu_tlb_sync() by smmu->impl->tlb_sync() and assign __arm_smmu_tlb_sync() as default for devices that don't need to override it? That makes this patch slightly larger, but it saves us one level of indirection. > + > arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); > for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index 9645bf1..d3217f1 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { > /* Maximum number of context banks per SMMU */ > #define ARM_SMMU_MAX_CBS 128 > > +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > +#define TLB_SPIN_COUNT 10 > > /* Shared driver definitions */ > enum arm_smmu_arch_version { > @@ -336,6 +338,8 @@ struct arm_smmu_impl { > int (*cfg_probe)(struct arm_smmu_device *smmu); > int (*reset)(struct arm_smmu_device *smmu); > int (*init_context)(struct arm_smmu_domain *smmu_domain); > + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > + int status); Can't page, sync and status all be unsigned? Thierry [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 11:14 ` Thierry Reding 0 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-08-30 11:14 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel [-- Attachment #1.1: Type: text/plain, Size: 3970 bytes --] On Thu, Aug 29, 2019 at 03:47:03PM -0700, Krishna Reddy wrote: > tlb_sync hook allows nvidia smmu handle tlb sync > across multiple SMMUs as necessary. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 8 +++++--- > drivers/iommu/arm-smmu.h | 4 ++++ > 3 files changed, 41 insertions(+), 3 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index d93ceda..a429b2c 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, > writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); > } > > +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, > + int sync, int status, int inst) > +{ > + u32 reg; > + unsigned int spin_cnt, delay; > + > + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > + reg = readl_relaxed( > + nsmmu_page(smmu, inst, page) + status); > + if (!(reg & sTLBGSTATUS_GSACTIVE)) > + return; > + cpu_relax(); > + } > + udelay(delay); > + } > + dev_err_ratelimited(smmu->dev, > + "TLB sync timed out -- SMMU may be deadlocked\n"); > +} > + > +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > + int sync, int status) > +{ > + int i; > + > + arm_smmu_writel(smmu, page, sync, 0); > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) > + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > + .tlb_sync = nsmmu_tlb_sync, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 46e1641..f5454e71 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -52,9 +52,6 @@ > */ > #define QCOM_DUMMY_VAL -1 > > -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > -#define TLB_SPIN_COUNT 10 > - > #define MSI_IOVA_BASE 0x8000000 > #define MSI_IOVA_LENGTH 0x100000 > > @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, > unsigned int spin_cnt, delay; > u32 reg; > > + if (smmu->impl->tlb_sync) { > + smmu->impl->tlb_sync(smmu, page, sync, status); > + return; > + } > + Wouldn't it work if you replaced all calls of __arm_smmu_tlb_sync() by smmu->impl->tlb_sync() and assign __arm_smmu_tlb_sync() as default for devices that don't need to override it? That makes this patch slightly larger, but it saves us one level of indirection. > + > arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); > for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index 9645bf1..d3217f1 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { > /* Maximum number of context banks per SMMU */ > #define ARM_SMMU_MAX_CBS 128 > > +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > +#define TLB_SPIN_COUNT 10 > > /* Shared driver definitions */ > enum arm_smmu_arch_version { > @@ -336,6 +338,8 @@ struct arm_smmu_impl { > int (*cfg_probe)(struct arm_smmu_device *smmu); > int (*reset)(struct arm_smmu_device *smmu); > int (*init_context)(struct arm_smmu_domain *smmu_domain); > + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > + int status); Can't page, sync and status all be unsigned? Thierry [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 11:14 ` Thierry Reding 0 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-08-30 11:14 UTC (permalink / raw) To: Krishna Reddy Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen [-- Attachment #1: Type: text/plain, Size: 3970 bytes --] On Thu, Aug 29, 2019 at 03:47:03PM -0700, Krishna Reddy wrote: > tlb_sync hook allows nvidia smmu handle tlb sync > across multiple SMMUs as necessary. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 8 +++++--- > drivers/iommu/arm-smmu.h | 4 ++++ > 3 files changed, 41 insertions(+), 3 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index d93ceda..a429b2c 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, > writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); > } > > +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, > + int sync, int status, int inst) > +{ > + u32 reg; > + unsigned int spin_cnt, delay; > + > + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > + reg = readl_relaxed( > + nsmmu_page(smmu, inst, page) + status); > + if (!(reg & sTLBGSTATUS_GSACTIVE)) > + return; > + cpu_relax(); > + } > + udelay(delay); > + } > + dev_err_ratelimited(smmu->dev, > + "TLB sync timed out -- SMMU may be deadlocked\n"); > +} > + > +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > + int sync, int status) > +{ > + int i; > + > + arm_smmu_writel(smmu, page, sync, 0); > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) > + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > + .tlb_sync = nsmmu_tlb_sync, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 46e1641..f5454e71 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -52,9 +52,6 @@ > */ > #define QCOM_DUMMY_VAL -1 > > -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > -#define TLB_SPIN_COUNT 10 > - > #define MSI_IOVA_BASE 0x8000000 > #define MSI_IOVA_LENGTH 0x100000 > > @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, > unsigned int spin_cnt, delay; > u32 reg; > > + if (smmu->impl->tlb_sync) { > + smmu->impl->tlb_sync(smmu, page, sync, status); > + return; > + } > + Wouldn't it work if you replaced all calls of __arm_smmu_tlb_sync() by smmu->impl->tlb_sync() and assign __arm_smmu_tlb_sync() as default for devices that don't need to override it? That makes this patch slightly larger, but it saves us one level of indirection. > + > arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); > for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index 9645bf1..d3217f1 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { > /* Maximum number of context banks per SMMU */ > #define ARM_SMMU_MAX_CBS 128 > > +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > +#define TLB_SPIN_COUNT 10 > > /* Shared driver definitions */ > enum arm_smmu_arch_version { > @@ -336,6 +338,8 @@ struct arm_smmu_impl { > int (*cfg_probe)(struct arm_smmu_device *smmu); > int (*reset)(struct arm_smmu_device *smmu); > int (*init_context)(struct arm_smmu_domain *smmu_domain); > + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > + int status); Can't page, sync and status all be unsigned? Thierry [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook 2019-08-30 11:14 ` Thierry Reding (?) (?) @ 2019-08-30 19:00 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 19:00 UTC (permalink / raw) To: Thierry Reding Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, Thierry Reding, Yu-Huan Hsu, Sachin Nikam, Pritesh Raithatha, Timo Alho, Alexander Van Brunt, Thomas Zeng (SW-TEGRA), olof, Juha Tukkinen, Mikko Perttunen, Robin Murphy, will.deacon, joro@8bytes.org >Wouldn't it work if you replaced all calls of __arm_smmu_tlb_sync() by >smmu->impl->tlb_sync() and assign __arm_smmu_tlb_sync() as default for >devices that don't need to override it? That makes this patch slightly larger, but it saves us one level of indirection. The tlb_ops->tlb_sync can be overridden directly in arm-smmu-nvidia.c specific implementation as pointed by Robin. Will be updating in next patch. >> + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, >> + int status); >Can't page, sync and status all be unsigned? This is to be uniform with original tlb_sync definition is arm-smmu.c. Anyway, this hook is not necessary as tlb_ops->tlb_sync can be overridden directly. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 19:00 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 19:00 UTC (permalink / raw) To: Thierry Reding Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, joro, will.deacon, iommu, linux-kernel, Timo Alho, olof, Yu-Huan Hsu, linux-tegra, Thierry Reding, Robin Murphy, Alexander Van Brunt, linux-arm-kernel >Wouldn't it work if you replaced all calls of __arm_smmu_tlb_sync() by >smmu->impl->tlb_sync() and assign __arm_smmu_tlb_sync() as default for >devices that don't need to override it? That makes this patch slightly larger, but it saves us one level of indirection. The tlb_ops->tlb_sync can be overridden directly in arm-smmu-nvidia.c specific implementation as pointed by Robin. Will be updating in next patch. >> + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, >> + int status); >Can't page, sync and status all be unsigned? This is to be uniform with original tlb_sync definition is arm-smmu.c. Anyway, this hook is not necessary as tlb_ops->tlb_sync can be overridden directly. -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 19:00 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 19:00 UTC (permalink / raw) To: Thierry Reding Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, will.deacon, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Robin Murphy, Alexander Van Brunt, linux-arm-kernel >Wouldn't it work if you replaced all calls of __arm_smmu_tlb_sync() by >smmu->impl->tlb_sync() and assign __arm_smmu_tlb_sync() as default for >devices that don't need to override it? That makes this patch slightly larger, but it saves us one level of indirection. The tlb_ops->tlb_sync can be overridden directly in arm-smmu-nvidia.c specific implementation as pointed by Robin. Will be updating in next patch. >> + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, >> + int status); >Can't page, sync and status all be unsigned? This is to be uniform with original tlb_sync definition is arm-smmu.c. Anyway, this hook is not necessary as tlb_ops->tlb_sync can be overridden directly. -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 19:00 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 19:00 UTC (permalink / raw) To: Thierry Reding Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, Thierry Reding, Yu-Huan Hsu, Sachin Nikam, Pritesh Raithatha, Timo Alho, Alexander Van Brunt, Thomas Zeng (SW-TEGRA), olof, Juha Tukkinen, Mikko Perttunen, Robin Murphy, will.deacon, joro >Wouldn't it work if you replaced all calls of __arm_smmu_tlb_sync() by >smmu->impl->tlb_sync() and assign __arm_smmu_tlb_sync() as default for >devices that don't need to override it? That makes this patch slightly larger, but it saves us one level of indirection. The tlb_ops->tlb_sync can be overridden directly in arm-smmu-nvidia.c specific implementation as pointed by Robin. Will be updating in next patch. >> + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, >> + int status); >Can't page, sync and status all be unsigned? This is to be uniform with original tlb_sync definition is arm-smmu.c. Anyway, this hook is not necessary as tlb_ops->tlb_sync can be overridden directly. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 15:23 ` Robin Murphy -1 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:23 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > tlb_sync hook allows nvidia smmu handle tlb sync > across multiple SMMUs as necessary. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 8 +++++--- > drivers/iommu/arm-smmu.h | 4 ++++ > 3 files changed, 41 insertions(+), 3 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index d93ceda..a429b2c 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, > writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); > } > > +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, > + int sync, int status, int inst) > +{ > + u32 reg; > + unsigned int spin_cnt, delay; > + > + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > + reg = readl_relaxed( > + nsmmu_page(smmu, inst, page) + status); > + if (!(reg & sTLBGSTATUS_GSACTIVE)) > + return; > + cpu_relax(); > + } > + udelay(delay); > + } > + dev_err_ratelimited(smmu->dev, > + "TLB sync timed out -- SMMU may be deadlocked\n"); > +} > + > +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > + int sync, int status) > +{ > + int i; > + > + arm_smmu_writel(smmu, page, sync, 0); > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) It might make more sense to make this the innermost loop, i.e.: for (i = 0; i < nsmmu->num_inst; i++) reg &= readl_relaxed(nsmmu_page(smmu, i, page)... since polling the instances in parallel rather than in series seems like it might be a bit more efficient. > + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > + .tlb_sync = nsmmu_tlb_sync, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 46e1641..f5454e71 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -52,9 +52,6 @@ > */ > #define QCOM_DUMMY_VAL -1 > > -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > -#define TLB_SPIN_COUNT 10 > - > #define MSI_IOVA_BASE 0x8000000 > #define MSI_IOVA_LENGTH 0x100000 > > @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, > unsigned int spin_cnt, delay; > u32 reg; > > + if (smmu->impl->tlb_sync) { > + smmu->impl->tlb_sync(smmu, page, sync, status); What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. Robin. > + return; > + } > + > arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); > for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index 9645bf1..d3217f1 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { > /* Maximum number of context banks per SMMU */ > #define ARM_SMMU_MAX_CBS 128 > > +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > +#define TLB_SPIN_COUNT 10 > > /* Shared driver definitions */ > enum arm_smmu_arch_version { > @@ -336,6 +338,8 @@ struct arm_smmu_impl { > int (*cfg_probe)(struct arm_smmu_device *smmu); > int (*reset)(struct arm_smmu_device *smmu); > int (*init_context)(struct arm_smmu_domain *smmu_domain); > + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > + int status); > }; > > static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) > ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 15:23 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:23 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > tlb_sync hook allows nvidia smmu handle tlb sync > across multiple SMMUs as necessary. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 8 +++++--- > drivers/iommu/arm-smmu.h | 4 ++++ > 3 files changed, 41 insertions(+), 3 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index d93ceda..a429b2c 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, > writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); > } > > +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, > + int sync, int status, int inst) > +{ > + u32 reg; > + unsigned int spin_cnt, delay; > + > + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > + reg = readl_relaxed( > + nsmmu_page(smmu, inst, page) + status); > + if (!(reg & sTLBGSTATUS_GSACTIVE)) > + return; > + cpu_relax(); > + } > + udelay(delay); > + } > + dev_err_ratelimited(smmu->dev, > + "TLB sync timed out -- SMMU may be deadlocked\n"); > +} > + > +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > + int sync, int status) > +{ > + int i; > + > + arm_smmu_writel(smmu, page, sync, 0); > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) It might make more sense to make this the innermost loop, i.e.: for (i = 0; i < nsmmu->num_inst; i++) reg &= readl_relaxed(nsmmu_page(smmu, i, page)... since polling the instances in parallel rather than in series seems like it might be a bit more efficient. > + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > + .tlb_sync = nsmmu_tlb_sync, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 46e1641..f5454e71 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -52,9 +52,6 @@ > */ > #define QCOM_DUMMY_VAL -1 > > -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > -#define TLB_SPIN_COUNT 10 > - > #define MSI_IOVA_BASE 0x8000000 > #define MSI_IOVA_LENGTH 0x100000 > > @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, > unsigned int spin_cnt, delay; > u32 reg; > > + if (smmu->impl->tlb_sync) { > + smmu->impl->tlb_sync(smmu, page, sync, status); What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. Robin. > + return; > + } > + > arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); > for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index 9645bf1..d3217f1 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { > /* Maximum number of context banks per SMMU */ > #define ARM_SMMU_MAX_CBS 128 > > +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > +#define TLB_SPIN_COUNT 10 > > /* Shared driver definitions */ > enum arm_smmu_arch_version { > @@ -336,6 +338,8 @@ struct arm_smmu_impl { > int (*cfg_probe)(struct arm_smmu_device *smmu); > int (*reset)(struct arm_smmu_device *smmu); > int (*init_context)(struct arm_smmu_domain *smmu_domain); > + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > + int status); > }; > > static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 15:23 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:23 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > tlb_sync hook allows nvidia smmu handle tlb sync > across multiple SMMUs as necessary. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 32 ++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 8 +++++--- > drivers/iommu/arm-smmu.h | 4 ++++ > 3 files changed, 41 insertions(+), 3 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index d93ceda..a429b2c 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -56,11 +56,43 @@ static void nsmmu_write_reg64(struct arm_smmu_device *smmu, > writeq_relaxed(val, nsmmu_page(smmu, i, page) + offset); > } > > +static void nsmmu_tlb_sync_wait(struct arm_smmu_device *smmu, int page, > + int sync, int status, int inst) > +{ > + u32 reg; > + unsigned int spin_cnt, delay; > + > + for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > + for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > + reg = readl_relaxed( > + nsmmu_page(smmu, inst, page) + status); > + if (!(reg & sTLBGSTATUS_GSACTIVE)) > + return; > + cpu_relax(); > + } > + udelay(delay); > + } > + dev_err_ratelimited(smmu->dev, > + "TLB sync timed out -- SMMU may be deadlocked\n"); > +} > + > +static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > + int sync, int status) > +{ > + int i; > + > + arm_smmu_writel(smmu, page, sync, 0); > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) It might make more sense to make this the innermost loop, i.e.: for (i = 0; i < nsmmu->num_inst; i++) reg &= readl_relaxed(nsmmu_page(smmu, i, page)... since polling the instances in parallel rather than in series seems like it might be a bit more efficient. > + nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > + .tlb_sync = nsmmu_tlb_sync, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 46e1641..f5454e71 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -52,9 +52,6 @@ > */ > #define QCOM_DUMMY_VAL -1 > > -#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > -#define TLB_SPIN_COUNT 10 > - > #define MSI_IOVA_BASE 0x8000000 > #define MSI_IOVA_LENGTH 0x100000 > > @@ -244,6 +241,11 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu, int page, > unsigned int spin_cnt, delay; > u32 reg; > > + if (smmu->impl->tlb_sync) { > + smmu->impl->tlb_sync(smmu, page, sync, status); What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. Robin. > + return; > + } > + > arm_smmu_writel(smmu, page, sync, QCOM_DUMMY_VAL); > for (delay = 1; delay < TLB_LOOP_TIMEOUT; delay *= 2) { > for (spin_cnt = TLB_SPIN_COUNT; spin_cnt > 0; spin_cnt--) { > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index 9645bf1..d3217f1 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -207,6 +207,8 @@ enum arm_smmu_cbar_type { > /* Maximum number of context banks per SMMU */ > #define ARM_SMMU_MAX_CBS 128 > > +#define TLB_LOOP_TIMEOUT 1000000 /* 1s! */ > +#define TLB_SPIN_COUNT 10 > > /* Shared driver definitions */ > enum arm_smmu_arch_version { > @@ -336,6 +338,8 @@ struct arm_smmu_impl { > int (*cfg_probe)(struct arm_smmu_device *smmu); > int (*reset)(struct arm_smmu_device *smmu); > int (*init_context)(struct arm_smmu_domain *smmu_domain); > + void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > + int status); > }; > > static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook 2019-08-30 15:23 ` Robin Murphy (?) (?) @ 2019-08-30 18:05 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:05 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >> + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) >It might make more sense to make this the innermost loop, i.e.: for (i = 0; i < nsmmu->num_inst; i++) reg &= readl_relaxed(nsmmu_page(smmu, i, page)... >since polling the instances in parallel rather than in series seems like it might be a bit more efficient. Sync register is programmed at the same time for both instances. The status check is serialized. I can update it to check status of both at the same time. >> + if (smmu->impl->tlb_sync) { >> + smmu->impl->tlb_sync(smmu, page, sync, status); >What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. With arm_smmu_domain now available in arm-smmu.h, arm-smmu-nvidia.c can directly update the tlb_ops->tlb_sync and avoid indirection. Will update in next version. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 18:05 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:05 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, joro, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) >It might make more sense to make this the innermost loop, i.e.: for (i = 0; i < nsmmu->num_inst; i++) reg &= readl_relaxed(nsmmu_page(smmu, i, page)... >since polling the instances in parallel rather than in series seems like it might be a bit more efficient. Sync register is programmed at the same time for both instances. The status check is serialized. I can update it to check status of both at the same time. >> + if (smmu->impl->tlb_sync) { >> + smmu->impl->tlb_sync(smmu, page, sync, status); >What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. With arm_smmu_domain now available in arm-smmu.h, arm-smmu-nvidia.c can directly update the tlb_ops->tlb_sync and avoid indirection. Will update in next version. -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 18:05 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:05 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) >It might make more sense to make this the innermost loop, i.e.: for (i = 0; i < nsmmu->num_inst; i++) reg &= readl_relaxed(nsmmu_page(smmu, i, page)... >since polling the instances in parallel rather than in series seems like it might be a bit more efficient. Sync register is programmed at the same time for both instances. The status check is serialized. I can update it to check status of both at the same time. >> + if (smmu->impl->tlb_sync) { >> + smmu->impl->tlb_sync(smmu, page, sync, status); >What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. With arm_smmu_domain now available in arm-smmu.h, arm-smmu-nvidia.c can directly update the tlb_ops->tlb_sync and avoid indirection. Will update in next version. -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 18:05 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:05 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >> + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) >It might make more sense to make this the innermost loop, i.e.: for (i = 0; i < nsmmu->num_inst; i++) reg &= readl_relaxed(nsmmu_page(smmu, i, page)... >since polling the instances in parallel rather than in series seems like it might be a bit more efficient. Sync register is programmed at the same time for both instances. The status check is serialized. I can update it to check status of both at the same time. >> + if (smmu->impl->tlb_sync) { >> + smmu->impl->tlb_sync(smmu, page, sync, status); >What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. With arm_smmu_domain now available in arm-smmu.h, arm-smmu-nvidia.c can directly update the tlb_ops->tlb_sync and avoid indirection. Will update in next version. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook 2019-08-30 18:05 ` Krishna Reddy (?) (?) @ 2019-08-30 22:49 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 22:49 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >> + if (smmu->impl->tlb_sync) { >> + smmu->impl->tlb_sync(smmu, page, sync, status); >What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. Hi Robin, overriding tlb_ops->tlb_sync function is not enough here. There are direct references to arm_smmu_tlb_sync_context(), arm_smmu_tlb_sync_global() functions. In arm-smmu.c. we can replace these direct references with tlb_ops->tlb_sync() function except in one function arm_smmu_device_reset(). When arm_smmu_device_reset() gets called, domains are not initialized and tlb_ops is not available. Should we add a new hook for arm_smmu_tlb_sync_global() or make this as a responsibility of impl->reset() hook as it gets called at the same place? -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 22:49 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 22:49 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, joro, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + if (smmu->impl->tlb_sync) { >> + smmu->impl->tlb_sync(smmu, page, sync, status); >What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. Hi Robin, overriding tlb_ops->tlb_sync function is not enough here. There are direct references to arm_smmu_tlb_sync_context(), arm_smmu_tlb_sync_global() functions. In arm-smmu.c. we can replace these direct references with tlb_ops->tlb_sync() function except in one function arm_smmu_device_reset(). When arm_smmu_device_reset() gets called, domains are not initialized and tlb_ops is not available. Should we add a new hook for arm_smmu_tlb_sync_global() or make this as a responsibility of impl->reset() hook as it gets called at the same place? -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 22:49 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 22:49 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + if (smmu->impl->tlb_sync) { >> + smmu->impl->tlb_sync(smmu, page, sync, status); >What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. Hi Robin, overriding tlb_ops->tlb_sync function is not enough here. There are direct references to arm_smmu_tlb_sync_context(), arm_smmu_tlb_sync_global() functions. In arm-smmu.c. we can replace these direct references with tlb_ops->tlb_sync() function except in one function arm_smmu_device_reset(). When arm_smmu_device_reset() gets called, domains are not initialized and tlb_ops is not available. Should we add a new hook for arm_smmu_tlb_sync_global() or make this as a responsibility of impl->reset() hook as it gets called at the same place? -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-08-30 22:49 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 22:49 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >> + if (smmu->impl->tlb_sync) { >> + smmu->impl->tlb_sync(smmu, page, sync, status); >What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. Hi Robin, overriding tlb_ops->tlb_sync function is not enough here. There are direct references to arm_smmu_tlb_sync_context(), arm_smmu_tlb_sync_global() functions. In arm-smmu.c. we can replace these direct references with tlb_ops->tlb_sync() function except in one function arm_smmu_device_reset(). When arm_smmu_device_reset() gets called, domains are not initialized and tlb_ops is not available. Should we add a new hook for arm_smmu_tlb_sync_global() or make this as a responsibility of impl->reset() hook as it gets called at the same place? -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook 2019-08-30 22:49 ` Krishna Reddy (?) (?) @ 2019-09-02 13:00 ` Robin Murphy -1 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-09-02 13:00 UTC (permalink / raw) To: Krishna Reddy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro On 30/08/2019 23:49, Krishna Reddy wrote: >>> + if (smmu->impl->tlb_sync) { >>> + smmu->impl->tlb_sync(smmu, page, sync, status); > >> What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. > > Hi Robin, overriding tlb_ops->tlb_sync function is not enough here. > There are direct references to arm_smmu_tlb_sync_context(), arm_smmu_tlb_sync_global() functions. > In arm-smmu.c. we can replace these direct references with tlb_ops->tlb_sync() function except in one function arm_smmu_device_reset(). > When arm_smmu_device_reset() gets called, domains are not initialized and tlb_ops is not available. > Should we add a new hook for arm_smmu_tlb_sync_global() or make this as a responsibility of impl->reset() hook as it gets > called at the same place? Ah, right, I'd forgotten about the TLB maintenance on reset. Looking again, though, I think you might need to implement impl->reset anyway for the sake of clearing GFSR correctly - since the value read from the base instance technically may not match whatever bits might happen to be set in the other instances - so I don't see any issue with just calling nsmmu_tlb_sync() from there as well. Robin. ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-09-02 13:00 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-09-02 13:00 UTC (permalink / raw) To: Krishna Reddy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, joro, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel On 30/08/2019 23:49, Krishna Reddy wrote: >>> + if (smmu->impl->tlb_sync) { >>> + smmu->impl->tlb_sync(smmu, page, sync, status); > >> What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. > > Hi Robin, overriding tlb_ops->tlb_sync function is not enough here. > There are direct references to arm_smmu_tlb_sync_context(), arm_smmu_tlb_sync_global() functions. > In arm-smmu.c. we can replace these direct references with tlb_ops->tlb_sync() function except in one function arm_smmu_device_reset(). > When arm_smmu_device_reset() gets called, domains are not initialized and tlb_ops is not available. > Should we add a new hook for arm_smmu_tlb_sync_global() or make this as a responsibility of impl->reset() hook as it gets > called at the same place? Ah, right, I'd forgotten about the TLB maintenance on reset. Looking again, though, I think you might need to implement impl->reset anyway for the sake of clearing GFSR correctly - since the value read from the base instance technically may not match whatever bits might happen to be set in the other instances - so I don't see any issue with just calling nsmmu_tlb_sync() from there as well. Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-09-02 13:00 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-09-02 13:00 UTC (permalink / raw) To: Krishna Reddy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel On 30/08/2019 23:49, Krishna Reddy wrote: >>> + if (smmu->impl->tlb_sync) { >>> + smmu->impl->tlb_sync(smmu, page, sync, status); > >> What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. > > Hi Robin, overriding tlb_ops->tlb_sync function is not enough here. > There are direct references to arm_smmu_tlb_sync_context(), arm_smmu_tlb_sync_global() functions. > In arm-smmu.c. we can replace these direct references with tlb_ops->tlb_sync() function except in one function arm_smmu_device_reset(). > When arm_smmu_device_reset() gets called, domains are not initialized and tlb_ops is not available. > Should we add a new hook for arm_smmu_tlb_sync_global() or make this as a responsibility of impl->reset() hook as it gets > called at the same place? Ah, right, I'd forgotten about the TLB maintenance on reset. Looking again, though, I think you might need to implement impl->reset anyway for the sake of clearing GFSR correctly - since the value read from the base instance technically may not match whatever bits might happen to be set in the other instances - so I don't see any issue with just calling nsmmu_tlb_sync() from there as well. Robin. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook @ 2019-09-02 13:00 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-09-02 13:00 UTC (permalink / raw) To: Krishna Reddy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro On 30/08/2019 23:49, Krishna Reddy wrote: >>> + if (smmu->impl->tlb_sync) { >>> + smmu->impl->tlb_sync(smmu, page, sync, status); > >> What I'd hoped is that rather than needing a hook for this, you could just override smmu_domain->tlb_ops from .init_context to wire up the alternate .sync method directly. That would save this extra level of indirection. > > Hi Robin, overriding tlb_ops->tlb_sync function is not enough here. > There are direct references to arm_smmu_tlb_sync_context(), arm_smmu_tlb_sync_global() functions. > In arm-smmu.c. we can replace these direct references with tlb_ops->tlb_sync() function except in one function arm_smmu_device_reset(). > When arm_smmu_device_reset() gets called, domains are not initialized and tlb_ops is not available. > Should we add a new hook for arm_smmu_tlb_sync_global() or make this as a responsibility of impl->reset() hook as it gets > called at the same place? Ah, right, I'd forgotten about the TLB maintenance on reset. Looking again, though, I think you might need to implement impl->reset anyway for the sake of clearing GFSR correctly - since the value read from the base instance technically may not match whatever bits might happen to be set in the other instances - so I don't see any issue with just calling nsmmu_tlb_sync() from there as well. Robin. ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks 2019-08-29 22:47 ` Krishna Reddy (?) (?) @ 2019-08-29 22:47 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add global/context fault hooks to allow Nvidia SMMU implementation handle faults across multiple SMMUs. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 6 ++ drivers/iommu/arm-smmu.h | 4 ++ 3 files changed, 137 insertions(+) diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c index a429b2c..b2a3c49 100644 --- a/drivers/iommu/arm-smmu-nvidia.c +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -14,6 +14,10 @@ #define NUM_SMMU_INSTANCES 3 +static irqreturn_t nsmmu_context_fault_inst(int irq, + struct arm_smmu_device *smmu, + int idx, int inst); + struct nvidia_smmu { struct arm_smmu_device smmu; int num_inst; @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, nsmmu_tlb_sync_wait(smmu, page, sync, status, i); } +static irqreturn_t nsmmu_global_fault_inst(int irq, + struct arm_smmu_device *smmu, + int inst) +{ + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; + + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR0); + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR1); + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR2); + + if (!gfsr) + return IRQ_NONE; + + dev_err_ratelimited(smmu->dev, + "Unexpected global fault, this could be serious\n"); + dev_err_ratelimited(smmu->dev, + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", + gfsr, gfsynr0, gfsynr1, gfsynr2); + + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); + return IRQ_HANDLED; +} + +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) +{ + int i; + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line is shared between global and context faults. + * Check for both type of interrupts on either fault handlers. + */ + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + return irq_ret; +} + +static irqreturn_t nsmmu_context_fault_bank(int irq, + struct arm_smmu_device *smmu, + int idx, int inst) +{ + u32 fsr, fsynr, cbfrsynra; + unsigned long iova; + + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); + if (!(fsr & FSR_FAULT)) + return IRQ_NONE; + + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FSYNR0); + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FAR); + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + + ARM_SMMU_GR1_CBFRSYNRA(idx)); + + dev_err_ratelimited(smmu->dev, + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", + fsr, iova, fsynr, cbfrsynra, idx); + + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FSR); + return IRQ_HANDLED; +} + +static irqreturn_t nsmmu_context_fault_inst(int irq, + struct arm_smmu_device *smmu, + int idx, int inst) +{ + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line shared between global and all context faults. + * Check for faults across all contexts. + */ + for (idx = 0; idx < smmu->num_context_banks; idx++) { + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); + + if (irq_ret == IRQ_HANDLED) + break; + } + + return irq_ret; +} + +static irqreturn_t nsmmu_context_fault(int irq, + struct arm_smmu_device *smmu, + int cbndx) +{ + int i; + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line is shared between global and context faults. + * Check for both type of interrupts on either fault handlers. + */ + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + return irq_ret; +} + static const struct arm_smmu_impl nsmmu_impl = { .read_reg = nsmmu_read_reg, .write_reg = nsmmu_write_reg, .read_reg64 = nsmmu_read_reg64, .write_reg64 = nsmmu_write_reg64, .tlb_sync = nsmmu_tlb_sync, + .global_fault = nsmmu_global_fault, + .context_fault = nsmmu_context_fault, }; struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index f5454e71..9cc532d 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) struct arm_smmu_device *smmu = smmu_domain->smmu; int idx = smmu_domain->cfg.cbndx; + if (smmu->impl->context_fault) + return smmu->impl->context_fault(irq, smmu, idx); + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); if (!(fsr & FSR_FAULT)) return IRQ_NONE; @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) u32 gfsr, gfsynr0, gfsynr1, gfsynr2; struct arm_smmu_device *smmu = dev; + if (smmu->impl->global_fault) + return smmu->impl->global_fault(irq, smmu); + gfsr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSR); gfsynr0 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR0); gfsynr1 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR1); diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index d3217f1..dec5e1a 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -17,6 +17,7 @@ #include <linux/io-64-nonatomic-hi-lo.h> #include <linux/io-pgtable.h> #include <linux/iommu.h> +#include <linux/irqreturn.h> #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/types.h> @@ -340,6 +341,9 @@ struct arm_smmu_impl { int (*init_context)(struct arm_smmu_domain *smmu_domain); void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, int status); + irqreturn_t (*global_fault)(int irq, struct arm_smmu_device *smmu); + irqreturn_t (*context_fault)(int irq, struct arm_smmu_device *smmu, + int cbndx); }; static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add global/context fault hooks to allow Nvidia SMMU implementation handle faults across multiple SMMUs. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 6 ++ drivers/iommu/arm-smmu.h | 4 ++ 3 files changed, 137 insertions(+) diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c index a429b2c..b2a3c49 100644 --- a/drivers/iommu/arm-smmu-nvidia.c +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -14,6 +14,10 @@ #define NUM_SMMU_INSTANCES 3 +static irqreturn_t nsmmu_context_fault_inst(int irq, + struct arm_smmu_device *smmu, + int idx, int inst); + struct nvidia_smmu { struct arm_smmu_device smmu; int num_inst; @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, nsmmu_tlb_sync_wait(smmu, page, sync, status, i); } +static irqreturn_t nsmmu_global_fault_inst(int irq, + struct arm_smmu_device *smmu, + int inst) +{ + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; + + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR0); + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR1); + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR2); + + if (!gfsr) + return IRQ_NONE; + + dev_err_ratelimited(smmu->dev, + "Unexpected global fault, this could be serious\n"); + dev_err_ratelimited(smmu->dev, + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", + gfsr, gfsynr0, gfsynr1, gfsynr2); + + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); + return IRQ_HANDLED; +} + +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) +{ + int i; + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line is shared between global and context faults. + * Check for both type of interrupts on either fault handlers. + */ + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + return irq_ret; +} + +static irqreturn_t nsmmu_context_fault_bank(int irq, + struct arm_smmu_device *smmu, + int idx, int inst) +{ + u32 fsr, fsynr, cbfrsynra; + unsigned long iova; + + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); + if (!(fsr & FSR_FAULT)) + return IRQ_NONE; + + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FSYNR0); + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FAR); + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + + ARM_SMMU_GR1_CBFRSYNRA(idx)); + + dev_err_ratelimited(smmu->dev, + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", + fsr, iova, fsynr, cbfrsynra, idx); + + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FSR); + return IRQ_HANDLED; +} + +static irqreturn_t nsmmu_context_fault_inst(int irq, + struct arm_smmu_device *smmu, + int idx, int inst) +{ + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line shared between global and all context faults. + * Check for faults across all contexts. + */ + for (idx = 0; idx < smmu->num_context_banks; idx++) { + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); + + if (irq_ret == IRQ_HANDLED) + break; + } + + return irq_ret; +} + +static irqreturn_t nsmmu_context_fault(int irq, + struct arm_smmu_device *smmu, + int cbndx) +{ + int i; + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line is shared between global and context faults. + * Check for both type of interrupts on either fault handlers. + */ + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + return irq_ret; +} + static const struct arm_smmu_impl nsmmu_impl = { .read_reg = nsmmu_read_reg, .write_reg = nsmmu_write_reg, .read_reg64 = nsmmu_read_reg64, .write_reg64 = nsmmu_write_reg64, .tlb_sync = nsmmu_tlb_sync, + .global_fault = nsmmu_global_fault, + .context_fault = nsmmu_context_fault, }; struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index f5454e71..9cc532d 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) struct arm_smmu_device *smmu = smmu_domain->smmu; int idx = smmu_domain->cfg.cbndx; + if (smmu->impl->context_fault) + return smmu->impl->context_fault(irq, smmu, idx); + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); if (!(fsr & FSR_FAULT)) return IRQ_NONE; @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) u32 gfsr, gfsynr0, gfsynr1, gfsynr2; struct arm_smmu_device *smmu = dev; + if (smmu->impl->global_fault) + return smmu->impl->global_fault(irq, smmu); + gfsr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSR); gfsynr0 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR0); gfsynr1 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR1); diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index d3217f1..dec5e1a 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -17,6 +17,7 @@ #include <linux/io-64-nonatomic-hi-lo.h> #include <linux/io-pgtable.h> #include <linux/iommu.h> +#include <linux/irqreturn.h> #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/types.h> @@ -340,6 +341,9 @@ struct arm_smmu_impl { int (*init_context)(struct arm_smmu_domain *smmu_domain); void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, int status); + irqreturn_t (*global_fault)(int irq, struct arm_smmu_device *smmu); + irqreturn_t (*context_fault)(int irq, struct arm_smmu_device *smmu, + int cbndx); }; static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add global/context fault hooks to allow Nvidia SMMU implementation handle faults across multiple SMMUs. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 6 ++ drivers/iommu/arm-smmu.h | 4 ++ 3 files changed, 137 insertions(+) diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c index a429b2c..b2a3c49 100644 --- a/drivers/iommu/arm-smmu-nvidia.c +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -14,6 +14,10 @@ #define NUM_SMMU_INSTANCES 3 +static irqreturn_t nsmmu_context_fault_inst(int irq, + struct arm_smmu_device *smmu, + int idx, int inst); + struct nvidia_smmu { struct arm_smmu_device smmu; int num_inst; @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, nsmmu_tlb_sync_wait(smmu, page, sync, status, i); } +static irqreturn_t nsmmu_global_fault_inst(int irq, + struct arm_smmu_device *smmu, + int inst) +{ + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; + + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR0); + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR1); + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR2); + + if (!gfsr) + return IRQ_NONE; + + dev_err_ratelimited(smmu->dev, + "Unexpected global fault, this could be serious\n"); + dev_err_ratelimited(smmu->dev, + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", + gfsr, gfsynr0, gfsynr1, gfsynr2); + + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); + return IRQ_HANDLED; +} + +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) +{ + int i; + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line is shared between global and context faults. + * Check for both type of interrupts on either fault handlers. + */ + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + return irq_ret; +} + +static irqreturn_t nsmmu_context_fault_bank(int irq, + struct arm_smmu_device *smmu, + int idx, int inst) +{ + u32 fsr, fsynr, cbfrsynra; + unsigned long iova; + + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); + if (!(fsr & FSR_FAULT)) + return IRQ_NONE; + + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FSYNR0); + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FAR); + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + + ARM_SMMU_GR1_CBFRSYNRA(idx)); + + dev_err_ratelimited(smmu->dev, + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", + fsr, iova, fsynr, cbfrsynra, idx); + + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FSR); + return IRQ_HANDLED; +} + +static irqreturn_t nsmmu_context_fault_inst(int irq, + struct arm_smmu_device *smmu, + int idx, int inst) +{ + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line shared between global and all context faults. + * Check for faults across all contexts. + */ + for (idx = 0; idx < smmu->num_context_banks; idx++) { + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); + + if (irq_ret == IRQ_HANDLED) + break; + } + + return irq_ret; +} + +static irqreturn_t nsmmu_context_fault(int irq, + struct arm_smmu_device *smmu, + int cbndx) +{ + int i; + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line is shared between global and context faults. + * Check for both type of interrupts on either fault handlers. + */ + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + return irq_ret; +} + static const struct arm_smmu_impl nsmmu_impl = { .read_reg = nsmmu_read_reg, .write_reg = nsmmu_write_reg, .read_reg64 = nsmmu_read_reg64, .write_reg64 = nsmmu_write_reg64, .tlb_sync = nsmmu_tlb_sync, + .global_fault = nsmmu_global_fault, + .context_fault = nsmmu_context_fault, }; struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index f5454e71..9cc532d 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) struct arm_smmu_device *smmu = smmu_domain->smmu; int idx = smmu_domain->cfg.cbndx; + if (smmu->impl->context_fault) + return smmu->impl->context_fault(irq, smmu, idx); + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); if (!(fsr & FSR_FAULT)) return IRQ_NONE; @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) u32 gfsr, gfsynr0, gfsynr1, gfsynr2; struct arm_smmu_device *smmu = dev; + if (smmu->impl->global_fault) + return smmu->impl->global_fault(irq, smmu); + gfsr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSR); gfsynr0 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR0); gfsynr1 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR1); diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index d3217f1..dec5e1a 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -17,6 +17,7 @@ #include <linux/io-64-nonatomic-hi-lo.h> #include <linux/io-pgtable.h> #include <linux/iommu.h> +#include <linux/irqreturn.h> #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/types.h> @@ -340,6 +341,9 @@ struct arm_smmu_impl { int (*init_context)(struct arm_smmu_domain *smmu_domain); void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, int status); + irqreturn_t (*global_fault)(int irq, struct arm_smmu_device *smmu); + irqreturn_t (*context_fault)(int irq, struct arm_smmu_device *smmu, + int cbndx); }; static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) -- 2.1.4 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add global/context fault hooks to allow Nvidia SMMU implementation handle faults across multiple SMMUs. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 6 ++ drivers/iommu/arm-smmu.h | 4 ++ 3 files changed, 137 insertions(+) diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c index a429b2c..b2a3c49 100644 --- a/drivers/iommu/arm-smmu-nvidia.c +++ b/drivers/iommu/arm-smmu-nvidia.c @@ -14,6 +14,10 @@ #define NUM_SMMU_INSTANCES 3 +static irqreturn_t nsmmu_context_fault_inst(int irq, + struct arm_smmu_device *smmu, + int idx, int inst); + struct nvidia_smmu { struct arm_smmu_device smmu; int num_inst; @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, nsmmu_tlb_sync_wait(smmu, page, sync, status, i); } +static irqreturn_t nsmmu_global_fault_inst(int irq, + struct arm_smmu_device *smmu, + int inst) +{ + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; + + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR0); + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR1); + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + + ARM_SMMU_GR0_sGFSYNR2); + + if (!gfsr) + return IRQ_NONE; + + dev_err_ratelimited(smmu->dev, + "Unexpected global fault, this could be serious\n"); + dev_err_ratelimited(smmu->dev, + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", + gfsr, gfsynr0, gfsynr1, gfsynr2); + + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); + return IRQ_HANDLED; +} + +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) +{ + int i; + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line is shared between global and context faults. + * Check for both type of interrupts on either fault handlers. + */ + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + return irq_ret; +} + +static irqreturn_t nsmmu_context_fault_bank(int irq, + struct arm_smmu_device *smmu, + int idx, int inst) +{ + u32 fsr, fsynr, cbfrsynra; + unsigned long iova; + + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); + if (!(fsr & FSR_FAULT)) + return IRQ_NONE; + + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FSYNR0); + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FAR); + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + + ARM_SMMU_GR1_CBFRSYNRA(idx)); + + dev_err_ratelimited(smmu->dev, + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", + fsr, iova, fsynr, cbfrsynra, idx); + + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + + ARM_SMMU_CB_FSR); + return IRQ_HANDLED; +} + +static irqreturn_t nsmmu_context_fault_inst(int irq, + struct arm_smmu_device *smmu, + int idx, int inst) +{ + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line shared between global and all context faults. + * Check for faults across all contexts. + */ + for (idx = 0; idx < smmu->num_context_banks; idx++) { + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); + + if (irq_ret == IRQ_HANDLED) + break; + } + + return irq_ret; +} + +static irqreturn_t nsmmu_context_fault(int irq, + struct arm_smmu_device *smmu, + int cbndx) +{ + int i; + irqreturn_t irq_ret = IRQ_NONE; + + /* Interrupt line is shared between global and context faults. + * Check for both type of interrupts on either fault handlers. + */ + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); + if (irq_ret == IRQ_HANDLED) + return irq_ret; + } + + return irq_ret; +} + static const struct arm_smmu_impl nsmmu_impl = { .read_reg = nsmmu_read_reg, .write_reg = nsmmu_write_reg, .read_reg64 = nsmmu_read_reg64, .write_reg64 = nsmmu_write_reg64, .tlb_sync = nsmmu_tlb_sync, + .global_fault = nsmmu_global_fault, + .context_fault = nsmmu_context_fault, }; struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index f5454e71..9cc532d 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) struct arm_smmu_device *smmu = smmu_domain->smmu; int idx = smmu_domain->cfg.cbndx; + if (smmu->impl->context_fault) + return smmu->impl->context_fault(irq, smmu, idx); + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); if (!(fsr & FSR_FAULT)) return IRQ_NONE; @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) u32 gfsr, gfsynr0, gfsynr1, gfsynr2; struct arm_smmu_device *smmu = dev; + if (smmu->impl->global_fault) + return smmu->impl->global_fault(irq, smmu); + gfsr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSR); gfsynr0 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR0); gfsynr1 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR1); diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h index d3217f1..dec5e1a 100644 --- a/drivers/iommu/arm-smmu.h +++ b/drivers/iommu/arm-smmu.h @@ -17,6 +17,7 @@ #include <linux/io-64-nonatomic-hi-lo.h> #include <linux/io-pgtable.h> #include <linux/iommu.h> +#include <linux/irqreturn.h> #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/types.h> @@ -340,6 +341,9 @@ struct arm_smmu_impl { int (*init_context)(struct arm_smmu_domain *smmu_domain); void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, int status); + irqreturn_t (*global_fault)(int irq, struct arm_smmu_device *smmu); + irqreturn_t (*context_fault)(int irq, struct arm_smmu_device *smmu, + int cbndx); }; static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 11:17 ` Thierry Reding -1 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-08-30 11:17 UTC (permalink / raw) To: Krishna Reddy Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen [-- Attachment #1: Type: text/plain, Size: 6366 bytes --] On Thu, Aug 29, 2019 at 03:47:04PM -0700, Krishna Reddy wrote: > Add global/context fault hooks to allow Nvidia SMMU implementation > handle faults across multiple SMMUs. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 6 ++ > drivers/iommu/arm-smmu.h | 4 ++ > 3 files changed, 137 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index a429b2c..b2a3c49 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -14,6 +14,10 @@ > > #define NUM_SMMU_INSTANCES 3 > > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst); More of these signed integers that could be unsigned. Also why the need to predeclare this? Can you not just put the definition of the function up here? > + > struct nvidia_smmu { > struct arm_smmu_device smmu; > int num_inst; > @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > } > > +static irqreturn_t nsmmu_global_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int inst) > +{ > + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > + > + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR0); > + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR1); > + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR2); > + > + if (!gfsr) > + return IRQ_NONE; > + > + dev_err_ratelimited(smmu->dev, > + "Unexpected global fault, this could be serious\n"); > + dev_err_ratelimited(smmu->dev, > + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", > + gfsr, gfsynr0, gfsynr1, gfsynr2); > + > + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault_bank(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + u32 fsr, fsynr, cbfrsynra; > + unsigned long iova; > + > + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > + if (!(fsr & FSR_FAULT)) > + return IRQ_NONE; > + > + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSYNR0); > + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FAR); > + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + > + ARM_SMMU_GR1_CBFRSYNRA(idx)); > + > + dev_err_ratelimited(smmu->dev, > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > + fsr, iova, fsynr, cbfrsynra, idx); > + > + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line shared between global and all context faults. > + * Check for faults across all contexts. > + */ > + for (idx = 0; idx < smmu->num_context_banks; idx++) { > + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); > + > + if (irq_ret == IRQ_HANDLED) > + break; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault(int irq, > + struct arm_smmu_device *smmu, > + int cbndx) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > .tlb_sync = nsmmu_tlb_sync, > + .global_fault = nsmmu_global_fault, > + .context_fault = nsmmu_context_fault, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index f5454e71..9cc532d 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > struct arm_smmu_device *smmu = smmu_domain->smmu; > int idx = smmu_domain->cfg.cbndx; > > + if (smmu->impl->context_fault) > + return smmu->impl->context_fault(irq, smmu, idx); > + Same comment here... > fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > if (!(fsr & FSR_FAULT)) > return IRQ_NONE; > @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) > u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > struct arm_smmu_device *smmu = dev; > > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); ... and here about the extra level of indirection. Thierry [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 11:17 ` Thierry Reding 0 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-08-30 11:17 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel [-- Attachment #1.1: Type: text/plain, Size: 6366 bytes --] On Thu, Aug 29, 2019 at 03:47:04PM -0700, Krishna Reddy wrote: > Add global/context fault hooks to allow Nvidia SMMU implementation > handle faults across multiple SMMUs. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 6 ++ > drivers/iommu/arm-smmu.h | 4 ++ > 3 files changed, 137 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index a429b2c..b2a3c49 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -14,6 +14,10 @@ > > #define NUM_SMMU_INSTANCES 3 > > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst); More of these signed integers that could be unsigned. Also why the need to predeclare this? Can you not just put the definition of the function up here? > + > struct nvidia_smmu { > struct arm_smmu_device smmu; > int num_inst; > @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > } > > +static irqreturn_t nsmmu_global_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int inst) > +{ > + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > + > + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR0); > + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR1); > + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR2); > + > + if (!gfsr) > + return IRQ_NONE; > + > + dev_err_ratelimited(smmu->dev, > + "Unexpected global fault, this could be serious\n"); > + dev_err_ratelimited(smmu->dev, > + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", > + gfsr, gfsynr0, gfsynr1, gfsynr2); > + > + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault_bank(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + u32 fsr, fsynr, cbfrsynra; > + unsigned long iova; > + > + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > + if (!(fsr & FSR_FAULT)) > + return IRQ_NONE; > + > + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSYNR0); > + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FAR); > + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + > + ARM_SMMU_GR1_CBFRSYNRA(idx)); > + > + dev_err_ratelimited(smmu->dev, > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > + fsr, iova, fsynr, cbfrsynra, idx); > + > + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line shared between global and all context faults. > + * Check for faults across all contexts. > + */ > + for (idx = 0; idx < smmu->num_context_banks; idx++) { > + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); > + > + if (irq_ret == IRQ_HANDLED) > + break; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault(int irq, > + struct arm_smmu_device *smmu, > + int cbndx) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > .tlb_sync = nsmmu_tlb_sync, > + .global_fault = nsmmu_global_fault, > + .context_fault = nsmmu_context_fault, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index f5454e71..9cc532d 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > struct arm_smmu_device *smmu = smmu_domain->smmu; > int idx = smmu_domain->cfg.cbndx; > > + if (smmu->impl->context_fault) > + return smmu->impl->context_fault(irq, smmu, idx); > + Same comment here... > fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > if (!(fsr & FSR_FAULT)) > return IRQ_NONE; > @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) > u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > struct arm_smmu_device *smmu = dev; > > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); ... and here about the extra level of indirection. Thierry [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 11:17 ` Thierry Reding 0 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-08-30 11:17 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel [-- Attachment #1.1: Type: text/plain, Size: 6366 bytes --] On Thu, Aug 29, 2019 at 03:47:04PM -0700, Krishna Reddy wrote: > Add global/context fault hooks to allow Nvidia SMMU implementation > handle faults across multiple SMMUs. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 6 ++ > drivers/iommu/arm-smmu.h | 4 ++ > 3 files changed, 137 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index a429b2c..b2a3c49 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -14,6 +14,10 @@ > > #define NUM_SMMU_INSTANCES 3 > > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst); More of these signed integers that could be unsigned. Also why the need to predeclare this? Can you not just put the definition of the function up here? > + > struct nvidia_smmu { > struct arm_smmu_device smmu; > int num_inst; > @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > } > > +static irqreturn_t nsmmu_global_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int inst) > +{ > + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > + > + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR0); > + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR1); > + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR2); > + > + if (!gfsr) > + return IRQ_NONE; > + > + dev_err_ratelimited(smmu->dev, > + "Unexpected global fault, this could be serious\n"); > + dev_err_ratelimited(smmu->dev, > + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", > + gfsr, gfsynr0, gfsynr1, gfsynr2); > + > + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault_bank(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + u32 fsr, fsynr, cbfrsynra; > + unsigned long iova; > + > + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > + if (!(fsr & FSR_FAULT)) > + return IRQ_NONE; > + > + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSYNR0); > + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FAR); > + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + > + ARM_SMMU_GR1_CBFRSYNRA(idx)); > + > + dev_err_ratelimited(smmu->dev, > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > + fsr, iova, fsynr, cbfrsynra, idx); > + > + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line shared between global and all context faults. > + * Check for faults across all contexts. > + */ > + for (idx = 0; idx < smmu->num_context_banks; idx++) { > + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); > + > + if (irq_ret == IRQ_HANDLED) > + break; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault(int irq, > + struct arm_smmu_device *smmu, > + int cbndx) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > .tlb_sync = nsmmu_tlb_sync, > + .global_fault = nsmmu_global_fault, > + .context_fault = nsmmu_context_fault, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index f5454e71..9cc532d 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > struct arm_smmu_device *smmu = smmu_domain->smmu; > int idx = smmu_domain->cfg.cbndx; > > + if (smmu->impl->context_fault) > + return smmu->impl->context_fault(irq, smmu, idx); > + Same comment here... > fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > if (!(fsr & FSR_FAULT)) > return IRQ_NONE; > @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) > u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > struct arm_smmu_device *smmu = dev; > > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); ... and here about the extra level of indirection. Thierry [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks 2019-08-30 11:17 ` Thierry Reding (?) (?) @ 2019-08-30 19:16 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 19:16 UTC (permalink / raw) To: Thierry Reding Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, Thierry Reding, Yu-Huan Hsu, Sachin Nikam, Pritesh Raithatha, Timo Alho, Alexander Van Brunt, Thomas Zeng (SW-TEGRA), olof, Juha Tukkinen, Mikko Perttunen, Robin Murphy, will.deacon, joro@8bytes.org >> +static irqreturn_t nsmmu_context_fault_inst(int irq, >> + struct arm_smmu_device *smmu, >> + int idx, int inst); >More of these signed integers that could be unsigned. Also why the need to predeclare this? Can you not just put the definition of the function up here? The singed integers are based on original function prototype from arm-smmu.c. inst can be updated to unsigned. This is because I was checking context faults from global fault handler as well. This can avoided by using interrupt lines of all the instances across global and context irq entries. Let me update. > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); >>... and here about the extra level of indirection. Fixing in next version. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 19:16 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 19:16 UTC (permalink / raw) To: Thierry Reding Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, joro, will.deacon, iommu, linux-kernel, Timo Alho, olof, Yu-Huan Hsu, linux-tegra, Thierry Reding, Robin Murphy, Alexander Van Brunt, linux-arm-kernel >> +static irqreturn_t nsmmu_context_fault_inst(int irq, >> + struct arm_smmu_device *smmu, >> + int idx, int inst); >More of these signed integers that could be unsigned. Also why the need to predeclare this? Can you not just put the definition of the function up here? The singed integers are based on original function prototype from arm-smmu.c. inst can be updated to unsigned. This is because I was checking context faults from global fault handler as well. This can avoided by using interrupt lines of all the instances across global and context irq entries. Let me update. > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); >>... and here about the extra level of indirection. Fixing in next version. -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 19:16 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 19:16 UTC (permalink / raw) To: Thierry Reding Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, will.deacon, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Robin Murphy, Alexander Van Brunt, linux-arm-kernel >> +static irqreturn_t nsmmu_context_fault_inst(int irq, >> + struct arm_smmu_device *smmu, >> + int idx, int inst); >More of these signed integers that could be unsigned. Also why the need to predeclare this? Can you not just put the definition of the function up here? The singed integers are based on original function prototype from arm-smmu.c. inst can be updated to unsigned. This is because I was checking context faults from global fault handler as well. This can avoided by using interrupt lines of all the instances across global and context irq entries. Let me update. > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); >>... and here about the extra level of indirection. Fixing in next version. -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 19:16 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 19:16 UTC (permalink / raw) To: Thierry Reding Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, Thierry Reding, Yu-Huan Hsu, Sachin Nikam, Pritesh Raithatha, Timo Alho, Alexander Van Brunt, Thomas Zeng (SW-TEGRA), olof, Juha Tukkinen, Mikko Perttunen, Robin Murphy, will.deacon, joro >> +static irqreturn_t nsmmu_context_fault_inst(int irq, >> + struct arm_smmu_device *smmu, >> + int idx, int inst); >More of these signed integers that could be unsigned. Also why the need to predeclare this? Can you not just put the definition of the function up here? The singed integers are based on original function prototype from arm-smmu.c. inst can be updated to unsigned. This is because I was checking context faults from global fault handler as well. This can avoided by using interrupt lines of all the instances across global and context irq entries. Let me update. > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); >>... and here about the extra level of indirection. Fixing in next version. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 15:43 ` Robin Murphy -1 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:43 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add global/context fault hooks to allow Nvidia SMMU implementation > handle faults across multiple SMMUs. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 6 ++ > drivers/iommu/arm-smmu.h | 4 ++ > 3 files changed, 137 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index a429b2c..b2a3c49 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -14,6 +14,10 @@ > > #define NUM_SMMU_INSTANCES 3 > > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst); > + > struct nvidia_smmu { > struct arm_smmu_device smmu; > int num_inst; > @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > } > > +static irqreturn_t nsmmu_global_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int inst) > +{ > + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > + > + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR0); > + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR1); > + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR2); > + > + if (!gfsr) > + return IRQ_NONE; > + > + dev_err_ratelimited(smmu->dev, > + "Unexpected global fault, this could be serious\n"); > + dev_err_ratelimited(smmu->dev, > + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", > + gfsr, gfsynr0, gfsynr1, gfsynr2); > + > + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault_bank(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + u32 fsr, fsynr, cbfrsynra; > + unsigned long iova; > + > + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > + if (!(fsr & FSR_FAULT)) > + return IRQ_NONE; > + > + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSYNR0); > + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FAR); > + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + > + ARM_SMMU_GR1_CBFRSYNRA(idx)); > + > + dev_err_ratelimited(smmu->dev, > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > + fsr, iova, fsynr, cbfrsynra, idx); > + > + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line shared between global and all context faults. > + * Check for faults across all contexts. > + */ > + for (idx = 0; idx < smmu->num_context_banks; idx++) { > + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); > + > + if (irq_ret == IRQ_HANDLED) > + break; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault(int irq, > + struct arm_smmu_device *smmu, > + int cbndx) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > .tlb_sync = nsmmu_tlb_sync, > + .global_fault = nsmmu_global_fault, > + .context_fault = nsmmu_context_fault, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index f5454e71..9cc532d 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > struct arm_smmu_device *smmu = smmu_domain->smmu; > int idx = smmu_domain->cfg.cbndx; > > + if (smmu->impl->context_fault) > + return smmu->impl->context_fault(irq, smmu, idx); > + > fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > if (!(fsr & FSR_FAULT)) > return IRQ_NONE; > @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) > u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > struct arm_smmu_device *smmu = dev; > > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); Can't we just register impl->global_fault (if set) instead of arm_smmu_global_fault as the handler when we first set up the IRQs in arm_smmu_device_probe()? Ideally we'd do the same for the context banks as well, although we might need an additional hook from which to request the secondary IRQs that the main flow can't accommodate. Robin. > + > gfsr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSR); > gfsynr0 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR0); > gfsynr1 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR1); > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index d3217f1..dec5e1a 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -17,6 +17,7 @@ > #include <linux/io-64-nonatomic-hi-lo.h> > #include <linux/io-pgtable.h> > #include <linux/iommu.h> > +#include <linux/irqreturn.h> > #include <linux/mutex.h> > #include <linux/spinlock.h> > #include <linux/types.h> > @@ -340,6 +341,9 @@ struct arm_smmu_impl { > int (*init_context)(struct arm_smmu_domain *smmu_domain); > void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > int status); > + irqreturn_t (*global_fault)(int irq, struct arm_smmu_device *smmu); > + irqreturn_t (*context_fault)(int irq, struct arm_smmu_device *smmu, > + int cbndx); > }; > > static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) > ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 15:43 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:43 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add global/context fault hooks to allow Nvidia SMMU implementation > handle faults across multiple SMMUs. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 6 ++ > drivers/iommu/arm-smmu.h | 4 ++ > 3 files changed, 137 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index a429b2c..b2a3c49 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -14,6 +14,10 @@ > > #define NUM_SMMU_INSTANCES 3 > > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst); > + > struct nvidia_smmu { > struct arm_smmu_device smmu; > int num_inst; > @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > } > > +static irqreturn_t nsmmu_global_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int inst) > +{ > + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > + > + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR0); > + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR1); > + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR2); > + > + if (!gfsr) > + return IRQ_NONE; > + > + dev_err_ratelimited(smmu->dev, > + "Unexpected global fault, this could be serious\n"); > + dev_err_ratelimited(smmu->dev, > + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", > + gfsr, gfsynr0, gfsynr1, gfsynr2); > + > + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault_bank(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + u32 fsr, fsynr, cbfrsynra; > + unsigned long iova; > + > + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > + if (!(fsr & FSR_FAULT)) > + return IRQ_NONE; > + > + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSYNR0); > + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FAR); > + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + > + ARM_SMMU_GR1_CBFRSYNRA(idx)); > + > + dev_err_ratelimited(smmu->dev, > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > + fsr, iova, fsynr, cbfrsynra, idx); > + > + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line shared between global and all context faults. > + * Check for faults across all contexts. > + */ > + for (idx = 0; idx < smmu->num_context_banks; idx++) { > + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); > + > + if (irq_ret == IRQ_HANDLED) > + break; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault(int irq, > + struct arm_smmu_device *smmu, > + int cbndx) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > .tlb_sync = nsmmu_tlb_sync, > + .global_fault = nsmmu_global_fault, > + .context_fault = nsmmu_context_fault, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index f5454e71..9cc532d 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > struct arm_smmu_device *smmu = smmu_domain->smmu; > int idx = smmu_domain->cfg.cbndx; > > + if (smmu->impl->context_fault) > + return smmu->impl->context_fault(irq, smmu, idx); > + > fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > if (!(fsr & FSR_FAULT)) > return IRQ_NONE; > @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) > u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > struct arm_smmu_device *smmu = dev; > > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); Can't we just register impl->global_fault (if set) instead of arm_smmu_global_fault as the handler when we first set up the IRQs in arm_smmu_device_probe()? Ideally we'd do the same for the context banks as well, although we might need an additional hook from which to request the secondary IRQs that the main flow can't accommodate. Robin. > + > gfsr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSR); > gfsynr0 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR0); > gfsynr1 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR1); > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index d3217f1..dec5e1a 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -17,6 +17,7 @@ > #include <linux/io-64-nonatomic-hi-lo.h> > #include <linux/io-pgtable.h> > #include <linux/iommu.h> > +#include <linux/irqreturn.h> > #include <linux/mutex.h> > #include <linux/spinlock.h> > #include <linux/types.h> > @@ -340,6 +341,9 @@ struct arm_smmu_impl { > int (*init_context)(struct arm_smmu_domain *smmu_domain); > void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > int status); > + irqreturn_t (*global_fault)(int irq, struct arm_smmu_device *smmu); > + irqreturn_t (*context_fault)(int irq, struct arm_smmu_device *smmu, > + int cbndx); > }; > > static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 15:43 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:43 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add global/context fault hooks to allow Nvidia SMMU implementation > handle faults across multiple SMMUs. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > drivers/iommu/arm-smmu-nvidia.c | 127 ++++++++++++++++++++++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 6 ++ > drivers/iommu/arm-smmu.h | 4 ++ > 3 files changed, 137 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-nvidia.c b/drivers/iommu/arm-smmu-nvidia.c > index a429b2c..b2a3c49 100644 > --- a/drivers/iommu/arm-smmu-nvidia.c > +++ b/drivers/iommu/arm-smmu-nvidia.c > @@ -14,6 +14,10 @@ > > #define NUM_SMMU_INSTANCES 3 > > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst); > + > struct nvidia_smmu { > struct arm_smmu_device smmu; > int num_inst; > @@ -87,12 +91,135 @@ static void nsmmu_tlb_sync(struct arm_smmu_device *smmu, int page, > nsmmu_tlb_sync_wait(smmu, page, sync, status, i); > } > > +static irqreturn_t nsmmu_global_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int inst) > +{ > + u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > + > + gfsr = readl_relaxed(nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + gfsynr0 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR0); > + gfsynr1 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR1); > + gfsynr2 = readl_relaxed(nsmmu_page(smmu, inst, 0) + > + ARM_SMMU_GR0_sGFSYNR2); > + > + if (!gfsr) > + return IRQ_NONE; > + > + dev_err_ratelimited(smmu->dev, > + "Unexpected global fault, this could be serious\n"); > + dev_err_ratelimited(smmu->dev, > + "\tGFSR 0x%08x, GFSYNR0 0x%08x, GFSYNR1 0x%08x, GFSYNR2 0x%08x\n", > + gfsr, gfsynr0, gfsynr1, gfsynr2); > + > + writel_relaxed(gfsr, nsmmu_page(smmu, inst, 0) + ARM_SMMU_GR0_sGFSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_global_fault(int irq, struct arm_smmu_device *smmu) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, 0, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault_bank(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + u32 fsr, fsynr, cbfrsynra; > + unsigned long iova; > + > + fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > + if (!(fsr & FSR_FAULT)) > + return IRQ_NONE; > + > + fsynr = readl_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSYNR0); > + iova = readq_relaxed(nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FAR); > + cbfrsynra = readl_relaxed(nsmmu_page(smmu, inst, 1) + > + ARM_SMMU_GR1_CBFRSYNRA(idx)); > + > + dev_err_ratelimited(smmu->dev, > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > + fsr, iova, fsynr, cbfrsynra, idx); > + > + writel_relaxed(fsr, nsmmu_page(smmu, inst, smmu->numpage + idx) + > + ARM_SMMU_CB_FSR); > + return IRQ_HANDLED; > +} > + > +static irqreturn_t nsmmu_context_fault_inst(int irq, > + struct arm_smmu_device *smmu, > + int idx, int inst) > +{ > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line shared between global and all context faults. > + * Check for faults across all contexts. > + */ > + for (idx = 0; idx < smmu->num_context_banks; idx++) { > + irq_ret = nsmmu_context_fault_bank(irq, smmu, idx, inst); > + > + if (irq_ret == IRQ_HANDLED) > + break; > + } > + > + return irq_ret; > +} > + > +static irqreturn_t nsmmu_context_fault(int irq, > + struct arm_smmu_device *smmu, > + int cbndx) > +{ > + int i; > + irqreturn_t irq_ret = IRQ_NONE; > + > + /* Interrupt line is shared between global and context faults. > + * Check for both type of interrupts on either fault handlers. > + */ > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_global_fault_inst(irq, smmu, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + for (i = 0; i < to_nsmmu(smmu)->num_inst; i++) { > + irq_ret = nsmmu_context_fault_inst(irq, smmu, cbndx, i); > + if (irq_ret == IRQ_HANDLED) > + return irq_ret; > + } > + > + return irq_ret; > +} > + > static const struct arm_smmu_impl nsmmu_impl = { > .read_reg = nsmmu_read_reg, > .write_reg = nsmmu_write_reg, > .read_reg64 = nsmmu_read_reg64, > .write_reg64 = nsmmu_write_reg64, > .tlb_sync = nsmmu_tlb_sync, > + .global_fault = nsmmu_global_fault, > + .context_fault = nsmmu_context_fault, > }; > > struct arm_smmu_device *nvidia_smmu_impl_init(struct arm_smmu_device *smmu) > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index f5454e71..9cc532d 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -454,6 +454,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > struct arm_smmu_device *smmu = smmu_domain->smmu; > int idx = smmu_domain->cfg.cbndx; > > + if (smmu->impl->context_fault) > + return smmu->impl->context_fault(irq, smmu, idx); > + > fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > if (!(fsr & FSR_FAULT)) > return IRQ_NONE; > @@ -475,6 +478,9 @@ static irqreturn_t arm_smmu_global_fault(int irq, void *dev) > u32 gfsr, gfsynr0, gfsynr1, gfsynr2; > struct arm_smmu_device *smmu = dev; > > + if (smmu->impl->global_fault) > + return smmu->impl->global_fault(irq, smmu); Can't we just register impl->global_fault (if set) instead of arm_smmu_global_fault as the handler when we first set up the IRQs in arm_smmu_device_probe()? Ideally we'd do the same for the context banks as well, although we might need an additional hook from which to request the secondary IRQs that the main flow can't accommodate. Robin. > + > gfsr = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSR); > gfsynr0 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR0); > gfsynr1 = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSYNR1); > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index d3217f1..dec5e1a 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -17,6 +17,7 @@ > #include <linux/io-64-nonatomic-hi-lo.h> > #include <linux/io-pgtable.h> > #include <linux/iommu.h> > +#include <linux/irqreturn.h> > #include <linux/mutex.h> > #include <linux/spinlock.h> > #include <linux/types.h> > @@ -340,6 +341,9 @@ struct arm_smmu_impl { > int (*init_context)(struct arm_smmu_domain *smmu_domain); > void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > int status); > + irqreturn_t (*global_fault)(int irq, struct arm_smmu_device *smmu); > + irqreturn_t (*context_fault)(int irq, struct arm_smmu_device *smmu, > + int cbndx); > }; > > static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks 2019-08-30 15:43 ` Robin Murphy (?) (?) @ 2019-08-30 17:43 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 17:43 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + if (smmu->impl->global_fault) >> + return smmu->impl->global_fault(irq, smmu); >Can't we just register impl->global_fault (if set) instead of arm_smmu_global_fault as the handler when we first set up the IRQs in arm_smmu_device_probe()? >Ideally we'd do the same for the context banks as well, although we might need an additional hook from which to request the secondary IRQs that the main flow can't accommodate. When first implemented theis patch, I think there were compile issues in accessing struct arm_smmu_domain from arm-smmu-nvidia.c as it was part of arm-smmu.c. To avoid issues accessing arm_smmu_domain. It did this for context fault and did same for global fault for uniformity. Now, I see that it is part of arm-smmu.h. Let me update code to register implementation hooks directly. Thanks -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 17:43 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 17:43 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + if (smmu->impl->global_fault) >> + return smmu->impl->global_fault(irq, smmu); >Can't we just register impl->global_fault (if set) instead of arm_smmu_global_fault as the handler when we first set up the IRQs in arm_smmu_device_probe()? >Ideally we'd do the same for the context banks as well, although we might need an additional hook from which to request the secondary IRQs that the main flow can't accommodate. When first implemented theis patch, I think there were compile issues in accessing struct arm_smmu_domain from arm-smmu-nvidia.c as it was part of arm-smmu.c. To avoid issues accessing arm_smmu_domain. It did this for context fault and did same for global fault for uniformity. Now, I see that it is part of arm-smmu.h. Let me update code to register implementation hooks directly. Thanks -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 17:43 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 17:43 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + if (smmu->impl->global_fault) >> + return smmu->impl->global_fault(irq, smmu); >Can't we just register impl->global_fault (if set) instead of arm_smmu_global_fault as the handler when we first set up the IRQs in arm_smmu_device_probe()? >Ideally we'd do the same for the context banks as well, although we might need an additional hook from which to request the secondary IRQs that the main flow can't accommodate. When first implemented theis patch, I think there were compile issues in accessing struct arm_smmu_domain from arm-smmu-nvidia.c as it was part of arm-smmu.c. To avoid issues accessing arm_smmu_domain. It did this for context fault and did same for global fault for uniformity. Now, I see that it is part of arm-smmu.h. Let me update code to register implementation hooks directly. Thanks -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks @ 2019-08-30 17:43 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 17:43 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel >> + if (smmu->impl->global_fault) >> + return smmu->impl->global_fault(irq, smmu); >Can't we just register impl->global_fault (if set) instead of arm_smmu_global_fault as the handler when we first set up the IRQs in arm_smmu_device_probe()? >Ideally we'd do the same for the context banks as well, although we might need an additional hook from which to request the secondary IRQs that the main flow can't accommodate. When first implemented theis patch, I think there were compile issues in accessing struct arm_smmu_domain from arm-smmu-nvidia.c as it was part of arm-smmu.c. To avoid issues accessing arm_smmu_domain. It did this for context fault and did same for global fault for uniformity. Now, I see that it is part of arm-smmu.h. Let me update code to register implementation hooks directly. Thanks -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 5/7] arm64: tegra: Add Memory controller DT node on T194 2019-08-29 22:47 ` Krishna Reddy (?) (?) @ 2019-08-29 22:47 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add Memory controller DT node on T194 and enable it. This patch is a prerequisite for SMMU enable on T194. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 ++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi index 62e07e11..4b3441b 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi @@ -47,6 +47,10 @@ }; }; + memory-controller@2c00000 { + status = "okay"; + }; + serial@3110000 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index adebbbf..d906958 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -6,6 +6,7 @@ #include <dt-bindings/reset/tegra194-reset.h> #include <dt-bindings/power/tegra194-powergate.h> #include <dt-bindings/thermal/tegra194-bpmp-thermal.h> +#include <dt-bindings/memory/tegra186-mc.h> / { compatible = "nvidia,tegra194"; @@ -130,6 +131,12 @@ }; }; + memory-controller@2c00000 { + compatible = "nvidia,tegra186-mc"; + reg = <0x02c00000 0xb0000>; + status = "disabled"; + }; + uarta: serial@3100000 { compatible = "nvidia,tegra194-uart", "nvidia,tegra20-uart"; reg = <0x03100000 0x40>; -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 5/7] arm64: tegra: Add Memory controller DT node on T194 @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add Memory controller DT node on T194 and enable it. This patch is a prerequisite for SMMU enable on T194. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 ++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi index 62e07e11..4b3441b 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi @@ -47,6 +47,10 @@ }; }; + memory-controller@2c00000 { + status = "okay"; + }; + serial@3110000 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index adebbbf..d906958 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -6,6 +6,7 @@ #include <dt-bindings/reset/tegra194-reset.h> #include <dt-bindings/power/tegra194-powergate.h> #include <dt-bindings/thermal/tegra194-bpmp-thermal.h> +#include <dt-bindings/memory/tegra186-mc.h> / { compatible = "nvidia,tegra194"; @@ -130,6 +131,12 @@ }; }; + memory-controller@2c00000 { + compatible = "nvidia,tegra186-mc"; + reg = <0x02c00000 0xb0000>; + status = "disabled"; + }; + uarta: serial@3100000 { compatible = "nvidia,tegra194-uart", "nvidia,tegra20-uart"; reg = <0x03100000 0x40>; -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 5/7] arm64: tegra: Add Memory controller DT node on T194 @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add Memory controller DT node on T194 and enable it. This patch is a prerequisite for SMMU enable on T194. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 ++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi index 62e07e11..4b3441b 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi @@ -47,6 +47,10 @@ }; }; + memory-controller@2c00000 { + status = "okay"; + }; + serial@3110000 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index adebbbf..d906958 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -6,6 +6,7 @@ #include <dt-bindings/reset/tegra194-reset.h> #include <dt-bindings/power/tegra194-powergate.h> #include <dt-bindings/thermal/tegra194-bpmp-thermal.h> +#include <dt-bindings/memory/tegra186-mc.h> / { compatible = "nvidia,tegra194"; @@ -130,6 +131,12 @@ }; }; + memory-controller@2c00000 { + compatible = "nvidia,tegra186-mc"; + reg = <0x02c00000 0xb0000>; + status = "disabled"; + }; + uarta: serial@3100000 { compatible = "nvidia,tegra194-uart", "nvidia,tegra20-uart"; reg = <0x03100000 0x40>; -- 2.1.4 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 5/7] arm64: tegra: Add Memory controller DT node on T194 @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add Memory controller DT node on T194 and enable it. This patch is a prerequisite for SMMU enable on T194. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 ++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi index 62e07e11..4b3441b 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi @@ -47,6 +47,10 @@ }; }; + memory-controller@2c00000 { + status = "okay"; + }; + serial@3110000 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index adebbbf..d906958 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -6,6 +6,7 @@ #include <dt-bindings/reset/tegra194-reset.h> #include <dt-bindings/power/tegra194-powergate.h> #include <dt-bindings/thermal/tegra194-bpmp-thermal.h> +#include <dt-bindings/memory/tegra186-mc.h> / { compatible = "nvidia,tegra194"; @@ -130,6 +131,12 @@ }; }; + memory-controller@2c00000 { + compatible = "nvidia,tegra186-mc"; + reg = <0x02c00000 0xb0000>; + status = "disabled"; + }; + uarta: serial@3100000 { compatible = "nvidia,tegra194-uart", "nvidia,tegra20-uart"; reg = <0x03100000 0x40>; -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH 5/7] arm64: tegra: Add Memory controller DT node on T194 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 11:18 ` Thierry Reding -1 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-08-30 11:18 UTC (permalink / raw) To: Krishna Reddy Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen [-- Attachment #1: Type: text/plain, Size: 1918 bytes --] On Thu, Aug 29, 2019 at 03:47:05PM -0700, Krishna Reddy wrote: > Add Memory controller DT node on T194 and enable it. > This patch is a prerequisite for SMMU enable on T194. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 ++++ > arch/arm64/boot/dts/nvidia/tegra194.dtsi | 7 +++++++ > 2 files changed, 11 insertions(+) > > diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi > index 62e07e11..4b3441b 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi > @@ -47,6 +47,10 @@ > }; > }; > > + memory-controller@2c00000 { > + status = "okay"; > + }; > + > serial@3110000 { > status = "okay"; > }; > diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > index adebbbf..d906958 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > @@ -6,6 +6,7 @@ > #include <dt-bindings/reset/tegra194-reset.h> > #include <dt-bindings/power/tegra194-powergate.h> > #include <dt-bindings/thermal/tegra194-bpmp-thermal.h> > +#include <dt-bindings/memory/tegra186-mc.h> > > / { > compatible = "nvidia,tegra194"; > @@ -130,6 +131,12 @@ > }; > }; > > + memory-controller@2c00000 { > + compatible = "nvidia,tegra186-mc"; I think we need to make this "nvidia,tegra194-mc" and then enhance the Tegra186 driver to match on that compatible string. Nothing to worry about just yet and I can make that change when applying. Thierry > + reg = <0x02c00000 0xb0000>; > + status = "disabled"; > + }; > + > uarta: serial@3100000 { > compatible = "nvidia,tegra194-uart", "nvidia,tegra20-uart"; > reg = <0x03100000 0x40>; > -- > 2.1.4 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 5/7] arm64: tegra: Add Memory controller DT node on T194 @ 2019-08-30 11:18 ` Thierry Reding 0 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-08-30 11:18 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel [-- Attachment #1.1: Type: text/plain, Size: 1918 bytes --] On Thu, Aug 29, 2019 at 03:47:05PM -0700, Krishna Reddy wrote: > Add Memory controller DT node on T194 and enable it. > This patch is a prerequisite for SMMU enable on T194. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 ++++ > arch/arm64/boot/dts/nvidia/tegra194.dtsi | 7 +++++++ > 2 files changed, 11 insertions(+) > > diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi > index 62e07e11..4b3441b 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi > @@ -47,6 +47,10 @@ > }; > }; > > + memory-controller@2c00000 { > + status = "okay"; > + }; > + > serial@3110000 { > status = "okay"; > }; > diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > index adebbbf..d906958 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > @@ -6,6 +6,7 @@ > #include <dt-bindings/reset/tegra194-reset.h> > #include <dt-bindings/power/tegra194-powergate.h> > #include <dt-bindings/thermal/tegra194-bpmp-thermal.h> > +#include <dt-bindings/memory/tegra186-mc.h> > > / { > compatible = "nvidia,tegra194"; > @@ -130,6 +131,12 @@ > }; > }; > > + memory-controller@2c00000 { > + compatible = "nvidia,tegra186-mc"; I think we need to make this "nvidia,tegra194-mc" and then enhance the Tegra186 driver to match on that compatible string. Nothing to worry about just yet and I can make that change when applying. Thierry > + reg = <0x02c00000 0xb0000>; > + status = "disabled"; > + }; > + > uarta: serial@3100000 { > compatible = "nvidia,tegra194-uart", "nvidia,tegra20-uart"; > reg = <0x03100000 0x40>; > -- > 2.1.4 > [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 5/7] arm64: tegra: Add Memory controller DT node on T194 @ 2019-08-30 11:18 ` Thierry Reding 0 siblings, 0 replies; 122+ messages in thread From: Thierry Reding @ 2019-08-30 11:18 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel [-- Attachment #1.1: Type: text/plain, Size: 1918 bytes --] On Thu, Aug 29, 2019 at 03:47:05PM -0700, Krishna Reddy wrote: > Add Memory controller DT node on T194 and enable it. > This patch is a prerequisite for SMMU enable on T194. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 4 ++++ > arch/arm64/boot/dts/nvidia/tegra194.dtsi | 7 +++++++ > 2 files changed, 11 insertions(+) > > diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi > index 62e07e11..4b3441b 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi > @@ -47,6 +47,10 @@ > }; > }; > > + memory-controller@2c00000 { > + status = "okay"; > + }; > + > serial@3110000 { > status = "okay"; > }; > diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > index adebbbf..d906958 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > @@ -6,6 +6,7 @@ > #include <dt-bindings/reset/tegra194-reset.h> > #include <dt-bindings/power/tegra194-powergate.h> > #include <dt-bindings/thermal/tegra194-bpmp-thermal.h> > +#include <dt-bindings/memory/tegra186-mc.h> > > / { > compatible = "nvidia,tegra194"; > @@ -130,6 +131,12 @@ > }; > }; > > + memory-controller@2c00000 { > + compatible = "nvidia,tegra186-mc"; I think we need to make this "nvidia,tegra194-mc" and then enhance the Tegra186 driver to match on that compatible string. Nothing to worry about just yet and I can make that change when applying. Thierry > + reg = <0x02c00000 0xb0000>; > + status = "disabled"; > + }; > + > uarta: serial@3100000 { > compatible = "nvidia,tegra194-uart", "nvidia,tegra20-uart"; > reg = <0x03100000 0x40>; > -- > 2.1.4 > [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] [-- Attachment #2: Type: text/plain, Size: 156 bytes --] _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU 2019-08-29 22:47 ` Krishna Reddy (?) (?) @ 2019-08-29 22:47 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add DT node for T194 SMMU to enable SMMU support. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index d906958..ad509bb 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -1401,6 +1401,81 @@ 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ }; + smmu: iommu@12000000 { + compatible = "nvidia,smmu-v2"; + reg = <0 0x12000000 0 0x800000>, + <0 0x11000000 0 0x800000>, + <0 0x10000000 0 0x800000>; + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; + stream-match-mask = <0x7f80>; + #global-interrupts = <1>; + #iommu-cells = <1>; + }; + sysram@40000000 { compatible = "nvidia,tegra194-sysram", "mmio-sram"; reg = <0x0 0x40000000 0x0 0x50000>; -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add DT node for T194 SMMU to enable SMMU support. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index d906958..ad509bb 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -1401,6 +1401,81 @@ 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ }; + smmu: iommu@12000000 { + compatible = "nvidia,smmu-v2"; + reg = <0 0x12000000 0 0x800000>, + <0 0x11000000 0 0x800000>, + <0 0x10000000 0 0x800000>; + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; + stream-match-mask = <0x7f80>; + #global-interrupts = <1>; + #iommu-cells = <1>; + }; + sysram@40000000 { compatible = "nvidia,tegra194-sysram", "mmio-sram"; reg = <0x0 0x40000000 0x0 0x50000>; -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Add DT node for T194 SMMU to enable SMMU support. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index d906958..ad509bb 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -1401,6 +1401,81 @@ 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ }; + smmu: iommu@12000000 { + compatible = "nvidia,smmu-v2"; + reg = <0 0x12000000 0 0x800000>, + <0 0x11000000 0 0x800000>, + <0 0x10000000 0 0x800000>; + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; + stream-match-mask = <0x7f80>; + #global-interrupts = <1>; + #iommu-cells = <1>; + }; + sysram@40000000 { compatible = "nvidia,tegra194-sysram", "mmio-sram"; reg = <0x0 0x40000000 0x0 0x50000>; -- 2.1.4 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Add DT node for T194 SMMU to enable SMMU support. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index d906958..ad509bb 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -1401,6 +1401,81 @@ 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ }; + smmu: iommu@12000000 { + compatible = "nvidia,smmu-v2"; + reg = <0 0x12000000 0 0x800000>, + <0 0x11000000 0 0x800000>, + <0 0x10000000 0 0x800000>; + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; + stream-match-mask = <0x7f80>; + #global-interrupts = <1>; + #iommu-cells = <1>; + }; + sysram@40000000 { compatible = "nvidia,tegra194-sysram", "mmio-sram"; reg = <0x0 0x40000000 0x0 0x50000>; -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 12:09 ` Mikko Perttunen -1 siblings, 0 replies; 122+ messages in thread From: Mikko Perttunen @ 2019-08-30 12:09 UTC (permalink / raw) To: Krishna Reddy Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen On 30.8.2019 1.47, Krishna Reddy wrote: > Add DT node for T194 SMMU to enable SMMU support. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ > 1 file changed, 75 insertions(+) > > diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > index d906958..ad509bb 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > @@ -1401,6 +1401,81 @@ > 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ > }; > > + smmu: iommu@12000000 { > + compatible = "nvidia,smmu-v2"; Should we have a compatibility string like "nvidia,tegra194-smmu" so that we can have other chips with SMMUv2 that could be different? Mikko > + reg = <0 0x12000000 0 0x800000>, > + <0 0x11000000 0 0x800000>, > + <0 0x10000000 0 0x800000>; > + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; > + stream-match-mask = <0x7f80>; > + #global-interrupts = <1>; > + #iommu-cells = <1>; > + }; > + > sysram@40000000 { > compatible = "nvidia,tegra194-sysram", "mmio-sram"; > reg = <0x0 0x40000000 0x0 0x50000>; > ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 12:09 ` Mikko Perttunen 0 siblings, 0 replies; 122+ messages in thread From: Mikko Perttunen @ 2019-08-30 12:09 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel On 30.8.2019 1.47, Krishna Reddy wrote: > Add DT node for T194 SMMU to enable SMMU support. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ > 1 file changed, 75 insertions(+) > > diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > index d906958..ad509bb 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > @@ -1401,6 +1401,81 @@ > 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ > }; > > + smmu: iommu@12000000 { > + compatible = "nvidia,smmu-v2"; Should we have a compatibility string like "nvidia,tegra194-smmu" so that we can have other chips with SMMUv2 that could be different? Mikko > + reg = <0 0x12000000 0 0x800000>, > + <0 0x11000000 0 0x800000>, > + <0 0x10000000 0 0x800000>; > + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; > + stream-match-mask = <0x7f80>; > + #global-interrupts = <1>; > + #iommu-cells = <1>; > + }; > + > sysram@40000000 { > compatible = "nvidia,tegra194-sysram", "mmio-sram"; > reg = <0x0 0x40000000 0x0 0x50000>; > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 12:09 ` Mikko Perttunen 0 siblings, 0 replies; 122+ messages in thread From: Mikko Perttunen @ 2019-08-30 12:09 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel On 30.8.2019 1.47, Krishna Reddy wrote: > Add DT node for T194 SMMU to enable SMMU support. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ > 1 file changed, 75 insertions(+) > > diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > index d906958..ad509bb 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > @@ -1401,6 +1401,81 @@ > 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ > }; > > + smmu: iommu@12000000 { > + compatible = "nvidia,smmu-v2"; Should we have a compatibility string like "nvidia,tegra194-smmu" so that we can have other chips with SMMUv2 that could be different? Mikko > + reg = <0 0x12000000 0 0x800000>, > + <0 0x11000000 0 0x800000>, > + <0 0x10000000 0 0x800000>; > + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; > + stream-match-mask = <0x7f80>; > + #global-interrupts = <1>; > + #iommu-cells = <1>; > + }; > + > sysram@40000000 { > compatible = "nvidia,tegra194-sysram", "mmio-sram"; > reg = <0x0 0x40000000 0x0 0x50000>; > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU 2019-08-30 12:09 ` Mikko Perttunen (?) (?) @ 2019-08-30 18:39 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:39 UTC (permalink / raw) To: Mikko Perttunen Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, Thierry Reding, Yu-Huan Hsu, Sachin Nikam, Pritesh Raithatha, Timo Alho, Alexander Van Brunt, Thomas Zeng (SW-TEGRA), olof, Juha Tukkinen, Mikko Perttunen, will.deacon, joro >> + smmu: iommu@12000000 { >> + compatible = "nvidia,smmu-v2"; >Should we have a compatibility string like "nvidia,tegra194-smmu" so that we can have other chips with SMMUv2 that could be different? As pointed by Robin as well, as Nvidia hasn't modified ARM MMU-500 implementation, we can update it to specific chip based. Let me update. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 18:39 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:39 UTC (permalink / raw) To: Mikko Perttunen Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, joro, will.deacon, iommu, linux-kernel, Timo Alho, olof, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel >> + smmu: iommu@12000000 { >> + compatible = "nvidia,smmu-v2"; >Should we have a compatibility string like "nvidia,tegra194-smmu" so that we can have other chips with SMMUv2 that could be different? As pointed by Robin as well, as Nvidia hasn't modified ARM MMU-500 implementation, we can update it to specific chip based. Let me update. -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 18:39 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:39 UTC (permalink / raw) To: Mikko Perttunen Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, will.deacon, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel >> + smmu: iommu@12000000 { >> + compatible = "nvidia,smmu-v2"; >Should we have a compatibility string like "nvidia,tegra194-smmu" so that we can have other chips with SMMUv2 that could be different? As pointed by Robin as well, as Nvidia hasn't modified ARM MMU-500 implementation, we can update it to specific chip based. Let me update. -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 18:39 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:39 UTC (permalink / raw) To: Mikko Perttunen Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, Thierry Reding, Yu-Huan Hsu, Sachin Nikam, Pritesh Raithatha, Timo Alho, Alexander Van Brunt, Thomas Zeng (SW-TEGRA), olof, Juha Tukkinen, Mikko Perttunen, will.deacon, joro >> + smmu: iommu@12000000 { >> + compatible = "nvidia,smmu-v2"; >Should we have a compatibility string like "nvidia,tegra194-smmu" so that we can have other chips with SMMUv2 that could be different? As pointed by Robin as well, as Nvidia hasn't modified ARM MMU-500 implementation, we can update it to specific chip based. Let me update. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU 2019-08-29 22:47 ` Krishna Reddy (?) @ 2019-08-30 15:44 ` Robin Murphy -1 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:44 UTC (permalink / raw) To: Krishna Reddy Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add DT node for T194 SMMU to enable SMMU support. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ > 1 file changed, 75 insertions(+) > > diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > index d906958..ad509bb 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > @@ -1401,6 +1401,81 @@ > 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ > }; > > + smmu: iommu@12000000 { > + compatible = "nvidia,smmu-v2"; > + reg = <0 0x12000000 0 0x800000>, > + <0 0x11000000 0 0x800000>, > + <0 0x10000000 0 0x800000>; > + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; > + stream-match-mask = <0x7f80>; > + #global-interrupts = <1>; Shouldn't that be 3? Robin. > + #iommu-cells = <1>; > + }; > + > sysram@40000000 { > compatible = "nvidia,tegra194-sysram", "mmio-sram"; > reg = <0x0 0x40000000 0x0 0x50000>; > ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 15:44 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:44 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add DT node for T194 SMMU to enable SMMU support. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ > 1 file changed, 75 insertions(+) > > diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > index d906958..ad509bb 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > @@ -1401,6 +1401,81 @@ > 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ > }; > > + smmu: iommu@12000000 { > + compatible = "nvidia,smmu-v2"; > + reg = <0 0x12000000 0 0x800000>, > + <0 0x11000000 0 0x800000>, > + <0 0x10000000 0 0x800000>; > + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; > + stream-match-mask = <0x7f80>; > + #global-interrupts = <1>; Shouldn't that be 3? Robin. > + #iommu-cells = <1>; > + }; > + > sysram@40000000 { > compatible = "nvidia,tegra194-sysram", "mmio-sram"; > reg = <0x0 0x40000000 0x0 0x50000>; > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 15:44 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 15:44 UTC (permalink / raw) To: Krishna Reddy Cc: talho, treding, mperttunen, linux-kernel, iommu, praithatha, thomasz, snikam, linux-tegra, yhsu, jtukkinen, avanbrunt, linux-arm-kernel On 29/08/2019 23:47, Krishna Reddy wrote: > Add DT node for T194 SMMU to enable SMMU support. > > Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> > --- > arch/arm64/boot/dts/nvidia/tegra194.dtsi | 75 ++++++++++++++++++++++++++++++++ > 1 file changed, 75 insertions(+) > > diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > index d906958..ad509bb 100644 > --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi > +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi > @@ -1401,6 +1401,81 @@ > 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ > }; > > + smmu: iommu@12000000 { > + compatible = "nvidia,smmu-v2"; > + reg = <0 0x12000000 0 0x800000>, > + <0 0x11000000 0 0x800000>, > + <0 0x10000000 0 0x800000>; > + interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 232 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, > + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>; > + stream-match-mask = <0x7f80>; > + #global-interrupts = <1>; Shouldn't that be 3? Robin. > + #iommu-cells = <1>; > + }; > + > sysram@40000000 { > compatible = "nvidia,tegra194-sysram", "mmio-sram"; > reg = <0x0 0x40000000 0x0 0x50000>; > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU 2019-08-30 15:44 ` Robin Murphy (?) (?) @ 2019-08-30 17:25 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 17:25 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >> + #global-interrupts = <1>; >Shouldn't that be 3? Interrupt line is shared between global and all context faults for each SMMU instance. Nvidia implementation checks for both Global and context faults on each interrupt to an SMMU instance. It can be either 1 or 3. If we make it 3, we need to add two more irq entries in node for context faults. In the future, we can update arm-smmu.c to support shared interrupt line between global and all context faults. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 17:25 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 17:25 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, joro, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + #global-interrupts = <1>; >Shouldn't that be 3? Interrupt line is shared between global and all context faults for each SMMU instance. Nvidia implementation checks for both Global and context faults on each interrupt to an SMMU instance. It can be either 1 or 3. If we make it 3, we need to add two more irq entries in node for context faults. In the future, we can update arm-smmu.c to support shared interrupt line between global and all context faults. -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 17:25 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 17:25 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >> + #global-interrupts = <1>; >Shouldn't that be 3? Interrupt line is shared between global and all context faults for each SMMU instance. Nvidia implementation checks for both Global and context faults on each interrupt to an SMMU instance. It can be either 1 or 3. If we make it 3, we need to add two more irq entries in node for context faults. In the future, we can update arm-smmu.c to support shared interrupt line between global and all context faults. -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 17:25 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 17:25 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >> + #global-interrupts = <1>; >Shouldn't that be 3? Interrupt line is shared between global and all context faults for each SMMU instance. Nvidia implementation checks for both Global and context faults on each interrupt to an SMMU instance. It can be either 1 or 3. If we make it 3, we need to add two more irq entries in node for context faults. In the future, we can update arm-smmu.c to support shared interrupt line between global and all context faults. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU 2019-08-30 17:25 ` Krishna Reddy (?) (?) @ 2019-08-30 17:45 ` Robin Murphy -1 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 17:45 UTC (permalink / raw) To: Krishna Reddy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro On 30/08/2019 18:25, Krishna Reddy wrote: >>> + #global-interrupts = <1>; > >> Shouldn't that be 3? > > Interrupt line is shared between global and all context faults for each SMMU instance. > Nvidia implementation checks for both Global and context faults on each interrupt to an SMMU instance. > It can be either 1 or 3. If we make it 3, we need to add two more irq entries in node for context faults. The number of global interrupts has never been related to the number of context interrupts :/ > In the future, we can update arm-smmu.c to support shared interrupt line between global and all context faults. Clearly you have one combined interrupt output per SMMU - describing those as one global interrupt and the first two context bank interrupts respectively makes far less sense than calling them 3 global interrupts, not least because the latter is strictly true. Yes, the binding prevents us from describing the context bank interrupts for more than one instance, but at that point the fact that it *is* the combined output saves us - because the driver is aware of this specific integration it knows it can just register the "secondary" global interrupts as "secondary" context interrupts too. If we had separate IRQ lines per context bank per instance, then we'd have a really big problem and might have to redefine the binding, but as it is it happens to work out pretty neatly. Robin. ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 17:45 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 17:45 UTC (permalink / raw) To: Krishna Reddy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, joro, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel On 30/08/2019 18:25, Krishna Reddy wrote: >>> + #global-interrupts = <1>; > >> Shouldn't that be 3? > > Interrupt line is shared between global and all context faults for each SMMU instance. > Nvidia implementation checks for both Global and context faults on each interrupt to an SMMU instance. > It can be either 1 or 3. If we make it 3, we need to add two more irq entries in node for context faults. The number of global interrupts has never been related to the number of context interrupts :/ > In the future, we can update arm-smmu.c to support shared interrupt line between global and all context faults. Clearly you have one combined interrupt output per SMMU - describing those as one global interrupt and the first two context bank interrupts respectively makes far less sense than calling them 3 global interrupts, not least because the latter is strictly true. Yes, the binding prevents us from describing the context bank interrupts for more than one instance, but at that point the fact that it *is* the combined output saves us - because the driver is aware of this specific integration it knows it can just register the "secondary" global interrupts as "secondary" context interrupts too. If we had separate IRQ lines per context bank per instance, then we'd have a really big problem and might have to redefine the binding, but as it is it happens to work out pretty neatly. Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 17:45 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 17:45 UTC (permalink / raw) To: Krishna Reddy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel On 30/08/2019 18:25, Krishna Reddy wrote: >>> + #global-interrupts = <1>; > >> Shouldn't that be 3? > > Interrupt line is shared between global and all context faults for each SMMU instance. > Nvidia implementation checks for both Global and context faults on each interrupt to an SMMU instance. > It can be either 1 or 3. If we make it 3, we need to add two more irq entries in node for context faults. The number of global interrupts has never been related to the number of context interrupts :/ > In the future, we can update arm-smmu.c to support shared interrupt line between global and all context faults. Clearly you have one combined interrupt output per SMMU - describing those as one global interrupt and the first two context bank interrupts respectively makes far less sense than calling them 3 global interrupts, not least because the latter is strictly true. Yes, the binding prevents us from describing the context bank interrupts for more than one instance, but at that point the fact that it *is* the combined output saves us - because the driver is aware of this specific integration it knows it can just register the "secondary" global interrupts as "secondary" context interrupts too. If we had separate IRQ lines per context bank per instance, then we'd have a really big problem and might have to redefine the binding, but as it is it happens to work out pretty neatly. Robin. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* Re: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 17:45 ` Robin Murphy 0 siblings, 0 replies; 122+ messages in thread From: Robin Murphy @ 2019-08-30 17:45 UTC (permalink / raw) To: Krishna Reddy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro On 30/08/2019 18:25, Krishna Reddy wrote: >>> + #global-interrupts = <1>; > >> Shouldn't that be 3? > > Interrupt line is shared between global and all context faults for each SMMU instance. > Nvidia implementation checks for both Global and context faults on each interrupt to an SMMU instance. > It can be either 1 or 3. If we make it 3, we need to add two more irq entries in node for context faults. The number of global interrupts has never been related to the number of context interrupts :/ > In the future, we can update arm-smmu.c to support shared interrupt line between global and all context faults. Clearly you have one combined interrupt output per SMMU - describing those as one global interrupt and the first two context bank interrupts respectively makes far less sense than calling them 3 global interrupts, not least because the latter is strictly true. Yes, the binding prevents us from describing the context bank interrupts for more than one instance, but at that point the fact that it *is* the combined output saves us - because the driver is aware of this specific integration it knows it can just register the "secondary" global interrupts as "secondary" context interrupts too. If we had separate IRQ lines per context bank per instance, then we'd have a really big problem and might have to redefine the binding, but as it is it happens to work out pretty neatly. Robin. ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU 2019-08-30 17:45 ` Robin Murphy (?) (?) @ 2019-08-30 18:35 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:35 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >The number of global interrupts has never been related to the number of context interrupts :/ Yeah, They are not related. I was trying to use minimum irq entries in the DT node as they both would achieve the same functionality. >Clearly you have one combined interrupt output per SMMU - describing those as one global interrupt and the first two context bank interrupts respectively makes far less sense than calling them 3 global interrupts, not least because the latter is strictly true. Will update to 3 in next patch to make it better for readability. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 18:35 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:35 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, joro, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >The number of global interrupts has never been related to the number of context interrupts :/ Yeah, They are not related. I was trying to use minimum irq entries in the DT node as they both would achieve the same functionality. >Clearly you have one combined interrupt output per SMMU - describing those as one global interrupt and the first two context bank interrupts respectively makes far less sense than calling them 3 global interrupts, not least because the latter is strictly true. Will update to 3 in next patch to make it better for readability. -KR _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 18:35 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:35 UTC (permalink / raw) To: Robin Murphy Cc: Timo Alho, Thierry Reding, Mikko Perttunen, linux-kernel, will.deacon, iommu, Pritesh Raithatha, Thomas Zeng (SW-TEGRA), Sachin Nikam, linux-tegra, Yu-Huan Hsu, Juha Tukkinen, Alexander Van Brunt, linux-arm-kernel >The number of global interrupts has never been related to the number of context interrupts :/ Yeah, They are not related. I was trying to use minimum irq entries in the DT node as they both would achieve the same functionality. >Clearly you have one combined interrupt output per SMMU - describing those as one global interrupt and the first two context bank interrupts respectively makes far less sense than calling them 3 global interrupts, not least because the latter is strictly true. Will update to 3 in next patch to make it better for readability. -KR _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply [flat|nested] 122+ messages in thread
* RE: [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU @ 2019-08-30 18:35 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-30 18:35 UTC (permalink / raw) To: Robin Murphy Cc: Sachin Nikam, Thomas Zeng (SW-TEGRA), Juha Tukkinen, Mikko Perttunen, Pritesh Raithatha, iommu, linux-kernel, Timo Alho, Yu-Huan Hsu, linux-tegra, Thierry Reding, Alexander Van Brunt, linux-arm-kernel, will.deacon, joro >The number of global interrupts has never been related to the number of context interrupts :/ Yeah, They are not related. I was trying to use minimum irq entries in the DT node as they both would achieve the same functionality. >Clearly you have one combined interrupt output per SMMU - describing those as one global interrupt and the first two context bank interrupts respectively makes far less sense than calling them 3 global interrupts, not least because the latter is strictly true. Will update to 3 in next patch to make it better for readability. -KR ^ permalink raw reply [flat|nested] 122+ messages in thread
* [PATCH 7/7] arm64: tegra: enable SMMU for SDHCI and EQOS 2019-08-29 22:47 ` Krishna Reddy (?) (?) @ 2019-08-29 22:47 ` Krishna Reddy -1 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Enable SMMU translations for SDHCI and EQOS transactions. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index ad509bb..0496a87 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -51,6 +51,7 @@ clock-names = "master_bus", "slave_bus", "rx", "tx", "ptp_ref"; resets = <&bpmp TEGRA194_RESET_EQOS>; reset-names = "eqos"; + iommus = <&smmu TEGRA186_SID_EQOS>; status = "disabled"; snps,write-requests = <1>; @@ -381,6 +382,7 @@ clock-names = "sdhci"; resets = <&bpmp TEGRA194_RESET_SDMMC1>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC1>; nvidia,pad-autocal-pull-up-offset-3v3-timeout = <0x07>; nvidia,pad-autocal-pull-down-offset-3v3-timeout = @@ -403,6 +405,7 @@ clock-names = "sdhci"; resets = <&bpmp TEGRA194_RESET_SDMMC3>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC3>; nvidia,pad-autocal-pull-up-offset-1v8 = <0x00>; nvidia,pad-autocal-pull-down-offset-1v8 = <0x7a>; nvidia,pad-autocal-pull-up-offset-3v3-timeout = <0x07>; @@ -430,6 +433,7 @@ <&bpmp TEGRA194_CLK_PLLC4>; resets = <&bpmp TEGRA194_RESET_SDMMC4>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC4>; nvidia,pad-autocal-pull-up-offset-hs400 = <0x00>; nvidia,pad-autocal-pull-down-offset-hs400 = <0x00>; nvidia,pad-autocal-pull-up-offset-1v8-timeout = <0x0a>; -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 7/7] arm64: tegra: enable SMMU for SDHCI and EQOS @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, olof, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Enable SMMU translations for SDHCI and EQOS transactions. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index ad509bb..0496a87 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -51,6 +51,7 @@ clock-names = "master_bus", "slave_bus", "rx", "tx", "ptp_ref"; resets = <&bpmp TEGRA194_RESET_EQOS>; reset-names = "eqos"; + iommus = <&smmu TEGRA186_SID_EQOS>; status = "disabled"; snps,write-requests = <1>; @@ -381,6 +382,7 @@ clock-names = "sdhci"; resets = <&bpmp TEGRA194_RESET_SDMMC1>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC1>; nvidia,pad-autocal-pull-up-offset-3v3-timeout = <0x07>; nvidia,pad-autocal-pull-down-offset-3v3-timeout = @@ -403,6 +405,7 @@ clock-names = "sdhci"; resets = <&bpmp TEGRA194_RESET_SDMMC3>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC3>; nvidia,pad-autocal-pull-up-offset-1v8 = <0x00>; nvidia,pad-autocal-pull-down-offset-1v8 = <0x7a>; nvidia,pad-autocal-pull-up-offset-3v3-timeout = <0x07>; @@ -430,6 +433,7 @@ <&bpmp TEGRA194_CLK_PLLC4>; resets = <&bpmp TEGRA194_RESET_SDMMC4>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC4>; nvidia,pad-autocal-pull-up-offset-hs400 = <0x00>; nvidia,pad-autocal-pull-down-offset-hs400 = <0x00>; nvidia,pad-autocal-pull-up-offset-1v8-timeout = <0x0a>; -- 2.1.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 7/7] arm64: tegra: enable SMMU for SDHCI and EQOS @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: snikam, thomasz, jtukkinen, mperttunen, praithatha, iommu, linux-kernel, talho, yhsu, linux-tegra, treding, avanbrunt, linux-arm-kernel Enable SMMU translations for SDHCI and EQOS transactions. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index ad509bb..0496a87 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -51,6 +51,7 @@ clock-names = "master_bus", "slave_bus", "rx", "tx", "ptp_ref"; resets = <&bpmp TEGRA194_RESET_EQOS>; reset-names = "eqos"; + iommus = <&smmu TEGRA186_SID_EQOS>; status = "disabled"; snps,write-requests = <1>; @@ -381,6 +382,7 @@ clock-names = "sdhci"; resets = <&bpmp TEGRA194_RESET_SDMMC1>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC1>; nvidia,pad-autocal-pull-up-offset-3v3-timeout = <0x07>; nvidia,pad-autocal-pull-down-offset-3v3-timeout = @@ -403,6 +405,7 @@ clock-names = "sdhci"; resets = <&bpmp TEGRA194_RESET_SDMMC3>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC3>; nvidia,pad-autocal-pull-up-offset-1v8 = <0x00>; nvidia,pad-autocal-pull-down-offset-1v8 = <0x7a>; nvidia,pad-autocal-pull-up-offset-3v3-timeout = <0x07>; @@ -430,6 +433,7 @@ <&bpmp TEGRA194_CLK_PLLC4>; resets = <&bpmp TEGRA194_RESET_SDMMC4>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC4>; nvidia,pad-autocal-pull-up-offset-hs400 = <0x00>; nvidia,pad-autocal-pull-down-offset-hs400 = <0x00>; nvidia,pad-autocal-pull-up-offset-1v8-timeout = <0x0a>; -- 2.1.4 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu ^ permalink raw reply related [flat|nested] 122+ messages in thread
* [PATCH 7/7] arm64: tegra: enable SMMU for SDHCI and EQOS @ 2019-08-29 22:47 ` Krishna Reddy 0 siblings, 0 replies; 122+ messages in thread From: Krishna Reddy @ 2019-08-29 22:47 UTC (permalink / raw) Cc: linux-arm-kernel, iommu, linux-kernel, linux-tegra, treding, yhsu, snikam, praithatha, talho, avanbrunt, thomasz, olof, jtukkinen, mperttunen, Krishna Reddy Enable SMMU translations for SDHCI and EQOS transactions. Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index ad509bb..0496a87 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -51,6 +51,7 @@ clock-names = "master_bus", "slave_bus", "rx", "tx", "ptp_ref"; resets = <&bpmp TEGRA194_RESET_EQOS>; reset-names = "eqos"; + iommus = <&smmu TEGRA186_SID_EQOS>; status = "disabled"; snps,write-requests = <1>; @@ -381,6 +382,7 @@ clock-names = "sdhci"; resets = <&bpmp TEGRA194_RESET_SDMMC1>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC1>; nvidia,pad-autocal-pull-up-offset-3v3-timeout = <0x07>; nvidia,pad-autocal-pull-down-offset-3v3-timeout = @@ -403,6 +405,7 @@ clock-names = "sdhci"; resets = <&bpmp TEGRA194_RESET_SDMMC3>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC3>; nvidia,pad-autocal-pull-up-offset-1v8 = <0x00>; nvidia,pad-autocal-pull-down-offset-1v8 = <0x7a>; nvidia,pad-autocal-pull-up-offset-3v3-timeout = <0x07>; @@ -430,6 +433,7 @@ <&bpmp TEGRA194_CLK_PLLC4>; resets = <&bpmp TEGRA194_RESET_SDMMC4>; reset-names = "sdhci"; + iommus = <&smmu TEGRA186_SID_SDMMC4>; nvidia,pad-autocal-pull-up-offset-hs400 = <0x00>; nvidia,pad-autocal-pull-down-offset-hs400 = <0x00>; nvidia,pad-autocal-pull-up-offset-1v8-timeout = <0x0a>; -- 2.1.4 ^ permalink raw reply related [flat|nested] 122+ messages in thread
end of thread, other threads:[~2019-09-03 1:08 UTC | newest] Thread overview: 122+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-08-29 22:47 [PATCH 0/7] Nvidia Arm SMMUv2 Implementation Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` [PATCH 1/7] iommu/arm-smmu: add Nvidia SMMUv2 implementation Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-30 15:02 ` Robin Murphy 2019-08-30 15:02 ` Robin Murphy 2019-08-30 15:02 ` Robin Murphy 2019-08-30 18:16 ` Krishna Reddy 2019-08-30 18:16 ` Krishna Reddy 2019-08-30 18:16 ` Krishna Reddy 2019-08-30 18:16 ` Krishna Reddy [not found] ` <BYAPR12MB2710D045303BE89A7D3FF2C1B3BD0-ZGDeBxoHBPnlX2Hc6Vgn3wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 2019-09-02 13:39 ` Robin Murphy 2019-09-02 13:39 ` Robin Murphy 2019-09-02 13:39 ` Robin Murphy 2019-09-02 13:39 ` Robin Murphy 2019-09-03 1:07 ` Krishna Reddy 2019-09-03 1:07 ` Krishna Reddy 2019-09-03 1:07 ` Krishna Reddy 2019-09-03 1:07 ` Krishna Reddy 2019-08-29 22:47 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-30 12:07 ` Mikko Perttunen 2019-08-30 12:07 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 Mikko Perttunen 2019-08-30 12:07 ` Mikko Perttunen 2019-08-30 15:13 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 Robin Murphy 2019-08-30 15:13 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 Robin Murphy 2019-08-30 15:13 ` Robin Murphy 2019-08-30 18:12 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 Krishna Reddy 2019-08-30 18:12 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 Krishna Reddy 2019-08-30 18:12 ` Krishna Reddy 2019-08-30 18:12 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 Krishna Reddy 2019-09-02 7:38 ` Thierry Reding 2019-09-02 7:38 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia, smmu-v2 Thierry Reding 2019-09-02 7:38 ` Thierry Reding 2019-09-02 7:38 ` [PATCH 2/7] dt-bindings: arm-smmu: Add binding for nvidia,smmu-v2 Thierry Reding 2019-08-29 22:47 ` [PATCH 3/7] iommu/arm-smmu: Add tlb_sync implementation hook Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-30 11:14 ` Thierry Reding 2019-08-30 11:14 ` Thierry Reding 2019-08-30 11:14 ` Thierry Reding 2019-08-30 19:00 ` Krishna Reddy 2019-08-30 19:00 ` Krishna Reddy 2019-08-30 19:00 ` Krishna Reddy 2019-08-30 19:00 ` Krishna Reddy 2019-08-30 15:23 ` Robin Murphy 2019-08-30 15:23 ` Robin Murphy 2019-08-30 15:23 ` Robin Murphy 2019-08-30 18:05 ` Krishna Reddy 2019-08-30 18:05 ` Krishna Reddy 2019-08-30 18:05 ` Krishna Reddy 2019-08-30 18:05 ` Krishna Reddy 2019-08-30 22:49 ` Krishna Reddy 2019-08-30 22:49 ` Krishna Reddy 2019-08-30 22:49 ` Krishna Reddy 2019-08-30 22:49 ` Krishna Reddy 2019-09-02 13:00 ` Robin Murphy 2019-09-02 13:00 ` Robin Murphy 2019-09-02 13:00 ` Robin Murphy 2019-09-02 13:00 ` Robin Murphy 2019-08-29 22:47 ` [PATCH 4/7] iommu/arm-smmu: Add global/context fault implementation hooks Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-30 11:17 ` Thierry Reding 2019-08-30 11:17 ` Thierry Reding 2019-08-30 11:17 ` Thierry Reding 2019-08-30 19:16 ` Krishna Reddy 2019-08-30 19:16 ` Krishna Reddy 2019-08-30 19:16 ` Krishna Reddy 2019-08-30 19:16 ` Krishna Reddy 2019-08-30 15:43 ` Robin Murphy 2019-08-30 15:43 ` Robin Murphy 2019-08-30 15:43 ` Robin Murphy 2019-08-30 17:43 ` Krishna Reddy 2019-08-30 17:43 ` Krishna Reddy 2019-08-30 17:43 ` Krishna Reddy 2019-08-30 17:43 ` Krishna Reddy 2019-08-29 22:47 ` [PATCH 5/7] arm64: tegra: Add Memory controller DT node on T194 Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-30 11:18 ` Thierry Reding 2019-08-30 11:18 ` Thierry Reding 2019-08-30 11:18 ` Thierry Reding 2019-08-29 22:47 ` [PATCH 6/7] arm64: tegra: Add DT node for T194 SMMU Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-30 12:09 ` Mikko Perttunen 2019-08-30 12:09 ` Mikko Perttunen 2019-08-30 12:09 ` Mikko Perttunen 2019-08-30 18:39 ` Krishna Reddy 2019-08-30 18:39 ` Krishna Reddy 2019-08-30 18:39 ` Krishna Reddy 2019-08-30 18:39 ` Krishna Reddy 2019-08-30 15:44 ` Robin Murphy 2019-08-30 15:44 ` Robin Murphy 2019-08-30 15:44 ` Robin Murphy 2019-08-30 17:25 ` Krishna Reddy 2019-08-30 17:25 ` Krishna Reddy 2019-08-30 17:25 ` Krishna Reddy 2019-08-30 17:25 ` Krishna Reddy 2019-08-30 17:45 ` Robin Murphy 2019-08-30 17:45 ` Robin Murphy 2019-08-30 17:45 ` Robin Murphy 2019-08-30 17:45 ` Robin Murphy 2019-08-30 18:35 ` Krishna Reddy 2019-08-30 18:35 ` Krishna Reddy 2019-08-30 18:35 ` Krishna Reddy 2019-08-30 18:35 ` Krishna Reddy 2019-08-29 22:47 ` [PATCH 7/7] arm64: tegra: enable SMMU for SDHCI and EQOS Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy 2019-08-29 22:47 ` Krishna Reddy
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.