Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp671648iob; Tue, 3 May 2022 07:19:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvf6PvKQks3fFiEtDYN19n0WA21DRW15nekolsy6omhbM6rmYK3O84fFu69q0gAeDGDH29 X-Received: by 2002:a05:6402:3695:b0:427:b16e:e1b4 with SMTP id ej21-20020a056402369500b00427b16ee1b4mr15139892edb.117.1651587588843; Tue, 03 May 2022 07:19:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651587588; cv=none; d=google.com; s=arc-20160816; b=TBbLAC4JMZSt4PXtLd18WLmBIThMmpZ2EGD4tcL+BhNmy5v2bUcqyT9OqA6hCD/Lhj +49oQwCQJrMJS7U7dlC9/hqbkCCR2cFz2gbXL/buSRNC/G0pKZoCXQokaLkEL+rzEWTe Abg3BtMzTk56lfr5rqF4/FOf0DfrhdHY4rx99RQmToWpy6FHEgObwEPtzDBzrIgJ9Sbi kKtqZcWNahS040A1ZrYRyFM4Gxr1lf3xZdH7WOhI7ZB9yBY97HcRJh0/NOcRGzAIf8XT ebXRaA7m8gCgT736VPDyHRiblIF3dIzbGQxD2q3snK3YBvhyw3x/9nOj7qnw+Tnn/eUv mBvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=65IjrOdR5xkcCqdI7V1pTEeLT/T/gs9WY67oGK06nkw=; b=bYtetEYOnv5IFDhSxbW2wLlwFxtE2jM1I3U0Qdt+lk4djO5uyaix9vJLGL74vOMb0o QS+9dWF1dfyacvdOx2Vs1yKZGq80HKfBW4ct3+QJBeI1CF4Dm5hglWQZ8Eh0myQjHrr9 DDnX1b9r3ScTho65iY9/v5gFzmkJz3zc4MtGbguK92vSVUEwWqrAofMwbc5hDGdq1cRn eRpMafIqnmWJ9nn1sMclRA2rC9zKeBQeE+sAWw1XhHeJ1r0Zj1pvI38KLPk3xz1TH2v7 CgLVJeVDvkEi/wbU8m+yM7ZZVZzs5x0yeAiCTRAAPii/wJJhk0rCkj0gjIvuULZc1hbo zMyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jr19-20020a170906515300b006f4408bfffbsi4707070ejc.779.2022.05.03.07.19.21; Tue, 03 May 2022 07:19:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235122AbiECMP5 (ORCPT + 99 others); Tue, 3 May 2022 08:15:57 -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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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: > */