From patchwork Tue Apr 26 17:29:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 8941251 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8B1E5BF29F for ; Tue, 26 Apr 2016 17:30:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A846D201EF for ; Tue, 26 Apr 2016 17:30:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C9FE6201EC for ; Tue, 26 Apr 2016 17:30:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DCB456E8BA; Tue, 26 Apr 2016 17:30:30 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E0126E8B3 for ; Tue, 26 Apr 2016 17:30:27 +0000 (UTC) Received: by mail-wm0-x233.google.com with SMTP id n3so15798674wmn.0 for ; Tue, 26 Apr 2016 10:30:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MOr8exl7EhHnjQMFD5kVc+JMvkmpwznSv3mBMGoYqdQ=; b=OQtI4hzKenUMU1MhLwnt3bIBluvHxD8PdYQAVksQGCI86V/e2ZHpoesf32yYVoVgpf aYJr6xod3zw41/gKGwTRCHU9l3T67PR5LmQBa6p7lTQ8JU9uk0+ra124XSutS/Qj7e5V Govc+d+pOONDDIBGKtVw5E+hbl0bTK7UaQXoo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MOr8exl7EhHnjQMFD5kVc+JMvkmpwznSv3mBMGoYqdQ=; b=gbmKFHr+5gQDYzY0kPDgP61OlGVkjeq/EyaVE7KhHt0j9czF9riNy7ZyiuC+rWwl8z 2hIGRQ1NHvfZ7+CE7NO+n94otjiCVoKZe1sdAwG7nALADmEaYp1MkJpsD7V0okRZfWfF nSpSA+rs+gUTMnFnDRtJnV8pmd4lGQUBqhLr8X/gMVrPNHL+YJZOaQmaq70S7gRBWDBk POZzVRuhAqXL8TosAH6l8e6Tm+mKL9Ywz7NOS317UpkK08FNTf2ocRgeHSNm9fn9mjNT H8tMeImrqSctYTMXX1qbCUShONTpy8MBLtKGFQVcNYe+3+UyV8Q3IqXrMRs2e2BNGUx0 G/wA== X-Gm-Message-State: AOPr4FXjVukAtqCf+5IJuA9YLRb80DTvLiiVT6l/MfpzuCJfO3c1biXwIzC/uo6t5qABnA== X-Received: by 10.194.172.228 with SMTP id bf4mr4466552wjc.123.1461691825621; Tue, 26 Apr 2016 10:30:25 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id wr2sm29928678wjc.49.2016.04.26.10.30.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 10:30:24 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Tue, 26 Apr 2016 19:29:37 +0200 Message-Id: <1461691808-12414-5-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1461691808-12414-1-git-send-email-daniel.vetter@ffwll.ch> References: <1461691808-12414-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Daniel Vetter , Intel Graphics Development , Ben Skeggs Subject: [Intel-gfx] [PATCH 04/35] drm: Forbid legacy MAP functions for DRIVER_MODESET X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Like in commit 0e975980d435d58df2d430d688b8c18778b42218 Author: Peter Antoine Date: Tue Jun 23 08:18:49 2015 +0100 drm: Turn off Legacy Context Functions we need to again make an exception for nouveau, but everyone else really doesn't need this. Cc: Peter Antoine Cc: Ben Skeggs Signed-off-by: Daniel Vetter Acked-by: Alex Deucher --- drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index d92db7007f62..e8a12a4fd400 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data, if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM)) return -EPERM; + if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && + drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + err = drm_addmap_core(dev, map->offset, map->size, map->type, map->flags, &maplist); @@ -438,6 +442,10 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data, int idx; int i; + if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && + drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + idx = map->offset; if (idx < 0) return -EINVAL; @@ -569,6 +577,10 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data, struct drm_map_list *r_list; int ret; + if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) && + drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + mutex_lock(&dev->struct_mutex); list_for_each_entry(r_list, &dev->maplist, head) { if (r_list->map &&