* [PATCH] drm/msm: Limit command submission when no IOMMU
@ 2022-05-02 17:29 Rob Clark
2022-05-03 12:12 ` Lucas Stach
2022-05-04 18:41 ` Dmitry Baryshkov
0 siblings, 2 replies; 4+ messages in thread
From: Rob Clark @ 2022-05-02 17:29 UTC (permalink / raw)
To: dri-devel
Cc: freedreno, linux-arm-msm, Luca Weiss, Rob Clark, Rob Clark,
Sean Paul, Abhinav Kumar, David Airlie, Daniel Vetter, open list
From: Rob Clark <robdclark@chromium.org>
Running the GPU without an IOMMU is not really a supported (or sane)
configuration. Yet it can be useful during SoC bringup (ie. if the
iommu driver doesn't work yet).
Lets limit it to users who already have /dev/mem access, to avoid the
chance that a user accidentially configures kernel without IOMMU
support.
Signed-off-by: Rob Clark <robdclark@chromium.org>
---
drivers/gpu/drm/msm/msm_gem_submit.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 23b68bc945f6..9cd8c8708990 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -734,6 +734,11 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
if (args->pad)
return -EINVAL;
+ if (unlikely(!ctx->aspace) && !capable(CAP_SYS_RAWIO)) {
+ DRM_ERROR_RATELIMITED("IOMMU support or CAP_SYS_RAWIO required!\n");
+ return -EPERM;
+ }
+
/* for now, we just have 3d pipe.. eventually this would need to
* be more clever to dispatch to appropriate gpu module:
*/
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm: Limit command submission when no IOMMU
2022-05-02 17:29 [PATCH] drm/msm: Limit command submission when no IOMMU Rob Clark
@ 2022-05-03 12:12 ` Lucas Stach
2022-05-03 14:13 ` Rob Clark
2022-05-04 18:41 ` Dmitry Baryshkov
1 sibling, 1 reply; 4+ messages in thread
From: Lucas Stach @ 2022-05-03 12:12 UTC (permalink / raw)
To: Rob Clark, dri-devel
Cc: Rob Clark, David Airlie, linux-arm-msm, Abhinav Kumar, open list,
Luca Weiss, Sean Paul, freedreno
Am Montag, dem 02.05.2022 um 10:29 -0700 schrieb Rob Clark:
> From: Rob Clark <robdclark@chromium.org>
>
> Running the GPU without an IOMMU is not really a supported (or sane)
> configuration. Yet it can be useful during SoC bringup (ie. if the
> iommu driver doesn't work yet).
>
> Lets limit it to users who already have /dev/mem access, to avoid the
> chance that a user accidentially configures kernel without IOMMU
> support.
I haven't followed MSM too closely, so ctx->aspace may also include the
GPU MMU, but if this really only includes the IOMMU (as the commit
message implies) then this breaks Freedreno on i.MX5.
Regards,
Lucas
>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
> ---
> drivers/gpu/drm/msm/msm_gem_submit.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index 23b68bc945f6..9cd8c8708990 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -734,6 +734,11 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
> if (args->pad)
> return -EINVAL;
>
> + if (unlikely(!ctx->aspace) && !capable(CAP_SYS_RAWIO)) {
> + DRM_ERROR_RATELIMITED("IOMMU support or CAP_SYS_RAWIO required!\n");
> + return -EPERM;
> + }
> +
> /* for now, we just have 3d pipe.. eventually this would need to
> * be more clever to dispatch to appropriate gpu module:
> */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm: Limit command submission when no IOMMU
2022-05-03 12:12 ` Lucas Stach
@ 2022-05-03 14:13 ` Rob Clark
0 siblings, 0 replies; 4+ messages in thread
From: Rob Clark @ 2022-05-03 14:13 UTC (permalink / raw)
To: Lucas Stach
Cc: dri-devel, Rob Clark, David Airlie, linux-arm-msm, Abhinav Kumar,
open list, Luca Weiss, Sean Paul, freedreno
On Tue, May 3, 2022 at 5:12 AM Lucas Stach <l.stach@pengutronix.de> wrote:
>
> Am Montag, dem 02.05.2022 um 10:29 -0700 schrieb Rob Clark:
> > From: Rob Clark <robdclark@chromium.org>
> >
> > Running the GPU without an IOMMU is not really a supported (or sane)
> > configuration. Yet it can be useful during SoC bringup (ie. if the
> > iommu driver doesn't work yet).
> >
> > Lets limit it to users who already have /dev/mem access, to avoid the
> > chance that a user accidentially configures kernel without IOMMU
> > support.
>
> I haven't followed MSM too closely, so ctx->aspace may also include the
> GPU MMU, but if this really only includes the IOMMU (as the commit
> message implies) then this breaks Freedreno on i.MX5.
it includes the gpu mmu, so a2xx should be fine.
BR,
-R
> Regards,
> Lucas
>
> >
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > ---
> > drivers/gpu/drm/msm/msm_gem_submit.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> > index 23b68bc945f6..9cd8c8708990 100644
> > --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> > +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> > @@ -734,6 +734,11 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
> > if (args->pad)
> > return -EINVAL;
> >
> > + if (unlikely(!ctx->aspace) && !capable(CAP_SYS_RAWIO)) {
> > + DRM_ERROR_RATELIMITED("IOMMU support or CAP_SYS_RAWIO required!\n");
> > + return -EPERM;
> > + }
> > +
> > /* for now, we just have 3d pipe.. eventually this would need to
> > * be more clever to dispatch to appropriate gpu module:
> > */
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/msm: Limit command submission when no IOMMU
2022-05-02 17:29 [PATCH] drm/msm: Limit command submission when no IOMMU Rob Clark
2022-05-03 12:12 ` Lucas Stach
@ 2022-05-04 18:41 ` Dmitry Baryshkov
1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2022-05-04 18:41 UTC (permalink / raw)
To: Rob Clark, dri-devel
Cc: freedreno, linux-arm-msm, Luca Weiss, Rob Clark, Sean Paul,
Abhinav Kumar, David Airlie, Daniel Vetter, open list
On 02/05/2022 20:29, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
>
> Running the GPU without an IOMMU is not really a supported (or sane)
> configuration. Yet it can be useful during SoC bringup (ie. if the
> iommu driver doesn't work yet).
>
> Lets limit it to users who already have /dev/mem access, to avoid the
> chance that a user accidentially configures kernel without IOMMU
> support.
>
> Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/msm_gem_submit.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index 23b68bc945f6..9cd8c8708990 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -734,6 +734,11 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
> if (args->pad)
> return -EINVAL;
>
> + if (unlikely(!ctx->aspace) && !capable(CAP_SYS_RAWIO)) {
> + DRM_ERROR_RATELIMITED("IOMMU support or CAP_SYS_RAWIO required!\n");
> + return -EPERM;
> + }
> +
> /* for now, we just have 3d pipe.. eventually this would need to
> * be more clever to dispatch to appropriate gpu module:
> */
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-04 18:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 17:29 [PATCH] drm/msm: Limit command submission when no IOMMU Rob Clark
2022-05-03 12:12 ` Lucas Stach
2022-05-03 14:13 ` Rob Clark
2022-05-04 18:41 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).