Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp212373iob; Mon, 2 May 2022 17:22:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0lCERqYHNH99Pc6Yy0n1XBQIMNQbQr3Ms3X3y1aAh2VRAa/FTPZEVanmfjCVvrv/8ZubP X-Received: by 2002:a17:902:d044:b0:15c:eec0:2bc with SMTP id l4-20020a170902d04400b0015ceec002bcmr14211478pll.28.1651537338078; Mon, 02 May 2022 17:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651537338; cv=none; d=google.com; s=arc-20160816; b=wEsDcteNxK4OXtgaHBpgGo0N0L/wUill0b40HrDde8vo9n5vxqESEwauFgtFnj0svs z5vSFcAQgKnXrwKrfyOPIB6yoOD/5EEZk6XhnBIvUAQrrVbEuKseLg3K6debP4U8neYw VZ8dVuS4IVArKSOh/90IqYqxGD8HyWlxp3vornRB17FYcV7ACuPdq296kXpoEjh9HKHY LaZw5KBp1F3oFfpLHqugocWb4JhDzDXcodpGLsARU49MSAqKOBKIk5qrl4A5VbGvZoY2 HpS+Vk16qQVuJ1JiLbkBlVtTyLkRWKojGL77fZEONElpw1LYY5G7PFyypacdO3CwRfYc oMWw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=oyJeFqHoGWWfsmN7ZUpT0hPaBi24D+V4aGuy1zcw08U=; b=hxtcyvMd6trEucMexLOXXVEIXQOfEXPl1+92vPj0H4F5D1U+X/jWfvw+2zkaZ+Eh4C l0aozBilL24zFXH4pkxDgrhTm+WFkuNlVnGo2EfUfw5gZfrl6Ck8QCsOj0MGx6iRAYy1 M7U5rvqoQ8/rVxvW6JSNEKEPLviTvn/qPaxLvhLId4UfNdbRx7i39TelmSqux2BaD3bT 1Qo2Az6fmdnFrm5OYOoSh/+MIfPmlFhpE9i8xl0rtAUeUimI72jOv4xrw1EfukscX41f BBO8sTj4BD/KLs/bXCqjWM0zfOrOAw+/oqKsXH58cxYhYOwyFkMd7kkIkOeo2wv1EApG cAfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gkB3nWHW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l130-20020a633e88000000b003c20bb1ee3dsi4628062pga.203.2022.05.02.17.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gkB3nWHW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3238D37A03; Mon, 2 May 2022 17:18:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358448AbiEBRcu (ORCPT + 99 others); Mon, 2 May 2022 13:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235761AbiEBRcr (ORCPT ); Mon, 2 May 2022 13:32:47 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10CE4A1A1; Mon, 2 May 2022 10:29:18 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id v10so12147840pgl.11; Mon, 02 May 2022 10:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oyJeFqHoGWWfsmN7ZUpT0hPaBi24D+V4aGuy1zcw08U=; b=gkB3nWHWQfhKPTtg6lYd+R/7QE9aVQPHgvJtP+ctJQ0SBARAm7Sc7BRdc6cdk3juc9 ZJdHsXlMexuGv8fVXyAYNdbL/cNP1soLaojegZvIp/Awj7Dhg00wO+PQQf+HTXhpWFWX BzndP2dJuMu3QU8Y6BoKOlHozEp6gaKV1lw3z1bfaBfebkKOXlj5HP4RJe6UhiYNu+qs MMEwC3mX6ypQIuWLK1Sb966deUIyH3tr6ez3WGKHDXFNwUe3FH5Y5b+JZ2sfCfzm9yhJ v1Pq1TmVb6qarjhBSpK1euW2N1S6uD9l+AbLaWM12sudV1HwnJTQ/3xjJhXnxN3lX6bR FOXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oyJeFqHoGWWfsmN7ZUpT0hPaBi24D+V4aGuy1zcw08U=; b=0fYRCwmXX1AiBwJYQM/ACIEaTvQOisgZPbuLZpPF6Ej8kXT+6j2/Hi52bRiMkJ1Nd2 YDVr64cTAoy67NEPrAT0gXmO4wZ4yJzICFmsbvEaJfcTyG2HZF0zZ4/E9vSEdmwS60o3 mTCO6QQ6EY7P3t5C4OorWxBYFN0cPZBJQZFCFxC4g3e14x4W5vMpqAZX+ECd9SYKZKFX 5r5fvviiLXlYm779A15vETvH4AusqWPfs2bBFH/COpRtgK2f8POjen25DDaIduUl0EBx x0MEZFXT2VEDq8vvtEgF3DEqhTGj9UV1irTHcbcknFyX+lA25h7hSIyVMj+Qt16A49yM Qwjg== X-Gm-Message-State: AOAM530B3Mb0LFjOyzSSi5CnEF/l0aWyc4xn7UuQunoXKwqa4tomagCW ZNTtAdLq7/ZVB3U11t74sJU= X-Received: by 2002:a63:1c0d:0:b0:3ab:1a76:953f with SMTP id c13-20020a631c0d000000b003ab1a76953fmr10499701pgc.73.1651512557459; Mon, 02 May 2022 10:29:17 -0700 (PDT) Received: from localhost ([172.19.27.22]) by smtp.gmail.com with ESMTPSA id j14-20020aa7800e000000b0050dc762816bsm4942208pfi.69.2022.05.02.10.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 10:29:16 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Luca Weiss , Rob Clark , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] drm/msm: Limit command submission when no IOMMU Date: Mon, 2 May 2022 10:29:08 -0700 Message-Id: <20220502172908.3569799-1-robdclark@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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. 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: */ -- 2.35.1