From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE6D1C433F5 for ; Tue, 3 May 2022 12:12:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235124AbiECMP6 (ORCPT ); Tue, 3 May 2022 08:15:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234572AbiECMP4 (ORCPT ); Tue, 3 May 2022 08:15:56 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87F1732EEB for ; Tue, 3 May 2022 05:12:24 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nlrO6-0006cw-5h; Tue, 03 May 2022 14:12:18 +0200 Message-ID: <86160889d7be260c5012044643b81d10098943fe.camel@pengutronix.de> Subject: Re: [PATCH] drm/msm: Limit command submission when no IOMMU From: Lucas Stach To: Rob Clark , dri-devel@lists.freedesktop.org Cc: Rob Clark , David Airlie , linux-arm-msm@vger.kernel.org, Abhinav Kumar , open list , Luca Weiss , Sean Paul , freedreno@lists.freedesktop.org Date: Tue, 03 May 2022 14:12:15 +0200 In-Reply-To: <20220502172908.3569799-1-robdclark@gmail.com> References: <20220502172908.3569799-1-robdclark@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Montag, dem 02.05.2022 um 10:29 -0700 schrieb Rob Clark: > From: Rob Clark > > 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 > --- > 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: > */