iommu/qcom+msm: Use identity domain for display/GPU
Subsystems (4)
Rob Clark
maintainercover iommu/qcom+msm: Use identity domain for display/GPU
Similar to what is already done in arm-smmu-qcom, match display and GPU compatible strings to pick identity domain type for them.
So far, we have an "evil twin" domain kicking around after drm/msm attaches it's own domain. Until now, that has been relatively harmless. But it becomes a problem with [1] when we start using sg_dma_len()/ sg_dma_address() for setting up mappings. Which is required to avoid problems with CONFIG_DMABUF_DEBUG (dma_buf_wrap_sg_table()).
The first patch is at least compile tested.. msm_iommu seems to be armv7-only.
If there are devices with bootloader splash, we may also need some work on qcom_iommu_identity_attach() and/or msm_iommu_identity_attach() to put the context bank into bypass instead of disabling it? Not sure, but that is probably going to require someone with such hardware at hand.
[1] https://patchwork.freedesktop.org/series/175619/
Rob Clark (2):
iommu/qcom: Use identity domain for GPU and display iommu/msm: Use identity domain for GPU and display
drivers/iommu/arm/arm-smmu/qcom_iommu.c | 18 ++++++++++++++++++ drivers/iommu/msm_iommu.c | 16 ++++++++++++++++ 2 files changed, 34 insertions(+)
Signature · 1 line
2.56.0
Rob Clark
maintainerPATCH 1/2 iommu/qcom: Use identity domain for GPU and display
Similar to commit 0e764a01015d ("iommu/arm-smmu: Allow client devices to select direct mapping") for arm-smmu-qcom, match GPU and display compat strings to pick identity domain time.
The drm/msm driver attaches it's own domain, which it manages directly, so we don't want an iommu managed domain interfering.
--- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/iommu/arm/arm-smmu/qcom_iommu.c +18 -0
@@ -22,6 +22,7 @@#include <linux/init.h> #include <linux/mutex.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm.h>
@@ -589,6 +590,22 @@ static int qcom_iommu_of_xlate(struct device *dev,return iommu_fwspec_add_ids (dev, &asid,1 ); } +static const struct of_device_id qcom_iommu_client_of_match[] = { + { .compatible ="qcom,adreno" }, + { .compatible ="qcom,mdp4" }, + { .compatible ="qcom,mdp5" }, + { .compatible ="qcom,mdss" }, + { } +}; + +static int qcom_iommu_def_domain_type (struct device *dev) +{ +const struct of_device_id *match = +of_match_device (qcom_iommu_client_of_match, dev); + +return match ?IOMMU_DOMAIN_IDENTITY :0 ; +} +static const struct iommu_ops qcom_iommu_ops = { .identity_domain = &qcom_iommu_identity_domain, .capable = qcom_iommu_capable,
@@ -596,6 +613,7 @@ static const struct iommu_ops qcom_iommu_ops = { .probe_device = qcom_iommu_probe_device, .device_group = generic_device_group, .of_xlate = qcom_iommu_of_xlate, + .def_domain_type = qcom_iommu_def_domain_type, .default_domain_ops = &(const struct iommu_domain_ops ) { .attach_dev = qcom_iommu_attach_dev, .map_pages = qcom_iommu_map,
Signature · 1 line
2.56.0
Re: [PATCH 1/2] iommu/qcom: Use identity domain for GPU and display
Quoted 9 lines · Rob Clark
Similar to commit
0e764a01015d("iommu/arm-smmu: Allow client devices to select direct mapping") for arm-smmu-qcom, match GPU and display compat strings to pick identity domain time.The drm/msm driver attaches it's own domain, which it manages directly, so we don't want an iommu managed domain interfering.
Signed-off-by Rob Clark <[email protected]>---
fwiw I'm not sure we have any devices with this driver and mdp4 but anyway
Konrad
Re: [PATCH 1/2] iommu/qcom: Use identity domain for GPU and display
Quoted 6 lines · Konrad Dybcio
Quoted 4 lines · Rob Clark
Similar to commit
0e764a01015d("iommu/arm-smmu: Allow client devices to select direct mapping") for arm-smmu-qcom, match GPU and display compat strings to pick identity domain time.
Quoted 8 lines
Quoted 5 lines
The drm/msm driver attaches it's own domain, which it manages directly, so we don't want an iommu managed domain interfering.
Signed-off-by Rob Clark <[email protected]>---
fwiw I'm not sure we have any devices with this driver and mdp4 but anyway
probably true of arm-smmu-qcom as well ;-)
Quoted 3 lines
Reviewed-by Konrad Dybcio <[email protected]>Konrad
Rob Clark
maintainerPATCH 2/2 iommu/msm: Use identity domain for GPU and display
In reply to Rob ClarkSimilar to commit 0e764a01015d ("iommu/arm-smmu: Allow client devices to select direct mapping") for arm-smmu-qcom, match GPU and display compat strings to pick identity domain time.
The drm/msm driver attaches it's own domain, which it manages directly, so we don't want an iommu managed domain interfering.
--- drivers/iommu/msm_iommu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/iommu/msm_iommu.c +16 -0
@@ -12,6 +12,7 @@#include <linux/io.h> #include <linux/io-pgtable.h> #include <linux/interrupt.h> +#include <linux/of_device.h> #include <linux/list.h> #include <linux/spinlock.h> #include <linux/slab.h>
@@ -691,12 +692,27 @@ irqreturn_t msm_iommu_fault_handler(int irq, void *dev_id)return 0 ; } +static const struct of_device_id msm_iommu_client_of_match[] = { + { .compatible ="qcom,adreno" }, + { .compatible ="qcom,mdp4" }, + { } +}; + +static int msm_iommu_def_domain_type (struct device *dev) +{ +const struct of_device_id *match = +of_match_device (msm_iommu_client_of_match, dev); + +return match ?IOMMU_DOMAIN_IDENTITY :0 ; +} +static struct iommu_ops msm_iommu_ops = { .identity_domain = &msm_iommu_identity_domain, .domain_alloc_paging = msm_iommu_domain_alloc_paging, .probe_device = msm_iommu_probe_device, .device_group = generic_device_group, .of_xlate = qcom_iommu_of_xlate, + .def_domain_type = msm_iommu_def_domain_type, .default_domain_ops = &(const struct iommu_domain_ops ) { .attach_dev = msm_iommu_attach_dev, .map_pages = msm_iommu_map,
Signature · 1 line
2.56.0
Re: [PATCH 2/2] iommu/msm: Use identity domain for GPU and display
Quoted 9 lines · Rob Clark
Similar to commit
0e764a01015d("iommu/arm-smmu: Allow client devices to select direct mapping") for arm-smmu-qcom, match GPU and display compat strings to pick identity domain time.The drm/msm driver attaches it's own domain, which it manages directly, so we don't want an iommu managed domain interfering.
Signed-off-by Rob Clark <[email protected]>---
Konrad
Re: [PATCH 2/2] iommu/msm: Use identity domain for GPU and display
In reply to Rob ClarkQuoted 11 lines · Rob Clark
Similar to commit
0e764a01015d("iommu/arm-smmu: Allow client devices to select direct mapping") for arm-smmu-qcom, match GPU and display compat strings to pick identity domain time.The drm/msm driver attaches it's own domain, which it manages directly, so we don't want an iommu managed domain interfering.
Signed-off-by Rob Clark <[email protected]>--- drivers/iommu/msm_iommu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Applied, thanks. Patch 1 needs to go through Will.