Commit a07ea70a authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Rob Clark
Browse files

drm/msm/dpu: check both DPU and MDSS devices for the IOMMU



Follow the lead of MDP5 driver and check both DPU and MDSS devices for
the IOMMU specifiers.

Historically DPU devices had IOMMU specified in the MDSS device tree
node, but as some of MDP5 devices are being converted to the supported
by the DPU driver, the driver should adapt and check both devices.

Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/489696/
Link: https://lore.kernel.org/r/20220616081106.350262-2-dmitry.baryshkov@linaro.org


Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent ba0386a9
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -997,14 +997,22 @@ static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms)
	struct msm_mmu *mmu;
	struct msm_mmu *mmu;
	struct device *dpu_dev = dpu_kms->dev->dev;
	struct device *dpu_dev = dpu_kms->dev->dev;
	struct device *mdss_dev = dpu_dev->parent;
	struct device *mdss_dev = dpu_dev->parent;
	struct device *iommu_dev;


	domain = iommu_domain_alloc(&platform_bus_type);
	domain = iommu_domain_alloc(&platform_bus_type);
	if (!domain)
	if (!domain)
		return 0;
		return 0;


	/* IOMMUs are a part of MDSS device tree binding, not the
	/*
	 * MDP/DPU device. */
	 * IOMMUs can be a part of MDSS device tree binding, or the
	mmu = msm_iommu_new(mdss_dev, domain);
	 * MDP/DPU device.
	 */
	if (dev_iommu_fwspec_get(dpu_dev))
		iommu_dev = dpu_dev;
	else
		iommu_dev = mdss_dev;

	mmu = msm_iommu_new(iommu_dev, domain);
	if (IS_ERR(mmu)) {
	if (IS_ERR(mmu)) {
		iommu_domain_free(domain);
		iommu_domain_free(domain);
		return PTR_ERR(mmu);
		return PTR_ERR(mmu);