From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> To: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>, Abhinav Kumar <quic_abhinavk@quicinc.com> Cc: Stephen Boyd <swboyd@chromium.org>, David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>, Bjorn Andersson <bjorn.andersson@linaro.org>, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Robin Murphy <robin.murphy@arm.com> Subject: [PATCH v3 3/5] drm/msm: Stop using iommu_present() Date: Thu, 16 Jun 2022 11:11:04 +0300 [thread overview] Message-ID: <20220616081106.350262-4-dmitry.baryshkov@linaro.org> (raw) In-Reply-To: <20220616081106.350262-1-dmitry.baryshkov@linaro.org> Even if some IOMMU has registered itself on the platform "bus", that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. On Qualcomm platforms the IOMMU can be specified either for the MDP/DPU device or for its parent MDSS device depending on the actual platform. Check both of them, since that is how both DPU and MDP5 drivers work. Co-developed-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/msm/msm_drv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 44485363f37a..c781307464a0 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -271,8 +271,14 @@ bool msm_use_mmu(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; - /* a2xx comes with its own MMU */ - return priv->is_a2xx || iommu_present(&platform_bus_type); + /* + * a2xx comes with its own MMU + * On other platforms IOMMU can be declared specified either for the + * MDP/DPU device or for its parent, MDSS device. + */ + return priv->is_a2xx || + device_iommu_mapped(dev->dev) || + device_iommu_mapped(dev->dev->parent); } static int msm_init_vram(struct drm_device *dev) -- 2.35.1
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> To: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>, Abhinav Kumar <quic_abhinavk@quicinc.com> Cc: David Airlie <airlied@linux.ie>, linux-arm-msm@vger.kernel.org, Robin Murphy <robin.murphy@arm.com>, dri-devel@lists.freedesktop.org, Bjorn Andersson <bjorn.andersson@linaro.org>, Stephen Boyd <swboyd@chromium.org>, freedreno@lists.freedesktop.org Subject: [PATCH v3 3/5] drm/msm: Stop using iommu_present() Date: Thu, 16 Jun 2022 11:11:04 +0300 [thread overview] Message-ID: <20220616081106.350262-4-dmitry.baryshkov@linaro.org> (raw) In-Reply-To: <20220616081106.350262-1-dmitry.baryshkov@linaro.org> Even if some IOMMU has registered itself on the platform "bus", that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. On Qualcomm platforms the IOMMU can be specified either for the MDP/DPU device or for its parent MDSS device depending on the actual platform. Check both of them, since that is how both DPU and MDP5 drivers work. Co-developed-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/msm/msm_drv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 44485363f37a..c781307464a0 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -271,8 +271,14 @@ bool msm_use_mmu(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; - /* a2xx comes with its own MMU */ - return priv->is_a2xx || iommu_present(&platform_bus_type); + /* + * a2xx comes with its own MMU + * On other platforms IOMMU can be declared specified either for the + * MDP/DPU device or for its parent, MDSS device. + */ + return priv->is_a2xx || + device_iommu_mapped(dev->dev) || + device_iommu_mapped(dev->dev->parent); } static int msm_init_vram(struct drm_device *dev) -- 2.35.1
next prev parent reply other threads:[~2022-06-16 8:11 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-16 8:11 [PATCH v3 0/5] drm/msm: fixes for KMS iommu handling Dmitry Baryshkov 2022-06-16 8:11 ` Dmitry Baryshkov 2022-06-16 8:11 ` [PATCH v3 1/5] drm/msm/dpu: check both DPU and MDSS devices for the IOMMU Dmitry Baryshkov 2022-06-16 8:11 ` Dmitry Baryshkov 2022-06-16 8:11 ` [PATCH v3 2/5] drm/msm/mdp5: move iommu_domain_alloc() call close to its usage Dmitry Baryshkov 2022-06-16 8:11 ` Dmitry Baryshkov 2022-06-16 8:11 ` Dmitry Baryshkov [this message] 2022-06-16 8:11 ` [PATCH v3 3/5] drm/msm: Stop using iommu_present() Dmitry Baryshkov 2022-06-16 8:11 ` [PATCH v3 4/5] drm/msm: move KMS aspace init to the separate helper Dmitry Baryshkov 2022-06-16 8:11 ` Dmitry Baryshkov 2022-06-16 8:11 ` [PATCH v3 5/5] drm/msm: switch msm_kms_init_aspace() to use device_iommu_mapped() Dmitry Baryshkov 2022-06-16 8:11 ` Dmitry Baryshkov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220616081106.350262-4-dmitry.baryshkov@linaro.org \ --to=dmitry.baryshkov@linaro.org \ --cc=airlied@linux.ie \ --cc=bjorn.andersson@linaro.org \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=freedreno@lists.freedesktop.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=quic_abhinavk@quicinc.com \ --cc=robdclark@gmail.com \ --cc=robin.murphy@arm.com \ --cc=sean@poorly.run \ --cc=swboyd@chromium.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.