From patchwork Sat Jul 10 21:24:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 12368871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05FC5C07E9B for ; Sat, 10 Jul 2021 21:26:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B685F6127C for ; Sat, 10 Jul 2021 21:26:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B685F6127C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jlekstrand.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 72FFB6EB62; Sat, 10 Jul 2021 21:26:39 +0000 (UTC) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 59D056EB62 for ; Sat, 10 Jul 2021 21:26:38 +0000 (UTC) Received: by mail-ot1-x32f.google.com with SMTP id 75-20020a9d08510000b02904acfe6bcccaso13669930oty.12 for ; Sat, 10 Jul 2021 14:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jlekstrand-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=45bOLRN9YVIYbe76ALv944ijiFpGvJt/dysEPQc6ByA=; b=g3DS5pa1hQYtZkOWfeq639THCis7EEdUnBQVeeXDfZcVzwQj+xcbS5Brc2lv51oVKe jDhTug5Crq7+AKyYQGhznRCmYsXjC1DuDcB2GuZaOC90YmY9dSWAVkcyvePnKfKV8+j6 tky41jZ05u/JeBWQ1CgMYESijB5PNTJanNK/bZgy6kf47mWKLKURYXEB7AjIRFaPfrDk d/Sdx834pN0dIzuFQEYHOhgyJGvMYlz4u/N4y6F6/UJkFPJtg6YswhysvUYeLbVBQcPp IIjIokA/C8dLMKWzmRreb78z0tCGGR8ddJ0Ax1XkgbSmSD0z9mYg6AC9Kd8rTeA9gumx Indw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=45bOLRN9YVIYbe76ALv944ijiFpGvJt/dysEPQc6ByA=; b=skPcnliZ2nu4lO2CDmaYak+xYx0xgZcSfTXEl0ntJ/pP3yEc6oKbtKUZT3mSJn+kZt ce1cT/vfxPbOJU8iExBHweqe2NZXiKHljzhMPmZKlGyDPlEeiig3Ud1CXNENYLmyM3eb 2sWVNpI+fynwUabasmrGUgaI2XsHKVKGkt3B9u8qMMHjleFIOLFQv9Inq1f87Mxu0HLQ kzbsnlq+3wF1o9sTKr+sofmAHUuIVYFBnNj1s06kAWUocGsUhB3yXdGWKW48rJn/NYQo TYETYPGvBlji2uqd6ehs5sLQ0aR7ELJSP54Vx+MR2CIGkxkOWKSjM+vOT4jd0UxTJt95 Pp+w== X-Gm-Message-State: AOAM533/+81FffqMa/M2gzGgnLIRYVr5k3WdZe9t0+nNK7qvEKH6Vwy6 zn15GBQUCScn+MutZ6A0UDi31fMh0MXq4A== X-Google-Smtp-Source: ABdhPJztfVpTBy/bcYNpoOkjUnp5O7VxAGEtG3kJSvBXlZixomUuuvujcd0UmolvtbKpRuUULqzGAQ== X-Received: by 2002:a05:6830:1598:: with SMTP id i24mr15675001otr.155.1625952397474; Sat, 10 Jul 2021 14:26:37 -0700 (PDT) Received: from omlet.lan ([68.203.99.148]) by smtp.gmail.com with ESMTPSA id u18sm972797ooq.36.2021.07.10.14.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jul 2021 14:26:37 -0700 (PDT) From: Jason Ekstrand To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Date: Sat, 10 Jul 2021 16:24:46 -0500 Message-Id: <20210710212447.785288-2-jason@jlekstrand.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210710212447.785288-1-jason@jlekstrand.net> References: <20210710212447.785288-1-jason@jlekstrand.net> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Don't allow setting I915_CONTEXT_PARAM_VM twice X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Allowing setting it multiple times brings no real utility to the API, no userspace relies on it, and it does make i915 a tiny bit more complicated. Let's disallow it for now unless someone comes up with a compelling reason to support it. Signed-off-by: Jason Ekstrand Cc: Daniel Vetter Reviewed-by: Daniel Vetter --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c index 7d6f52d8a8012..5853737cc79f3 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c @@ -319,7 +319,6 @@ static int set_proto_ctx_vm(struct drm_i915_file_private *fpriv, const struct drm_i915_gem_context_param *args) { struct drm_i915_private *i915 = fpriv->dev_priv; - struct i915_address_space *vm; if (args->size) return -EINVAL; @@ -327,17 +326,16 @@ static int set_proto_ctx_vm(struct drm_i915_file_private *fpriv, if (!HAS_FULL_PPGTT(i915)) return -ENODEV; + if (pc->vm) + return -EINVAL; + if (upper_32_bits(args->value)) return -ENOENT; - vm = i915_gem_vm_lookup(fpriv, args->value); - if (!vm) + pc->vm = i915_gem_vm_lookup(fpriv, args->value); + if (!pc->vm) return -ENOENT; - if (pc->vm) - i915_vm_put(pc->vm); - pc->vm = vm; - return 0; } From patchwork Sat Jul 10 21:24:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Ekstrand X-Patchwork-Id: 12368873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15B7AC07E95 for ; Sat, 10 Jul 2021 21:26:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D13DC6135B for ; Sat, 10 Jul 2021 21:26:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D13DC6135B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=jlekstrand.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4448C6EB66; Sat, 10 Jul 2021 21:26:41 +0000 (UTC) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by gabe.freedesktop.org (Postfix) with ESMTPS id BA5326EB65 for ; Sat, 10 Jul 2021 21:26:39 +0000 (UTC) Received: by mail-ot1-x32f.google.com with SMTP id 59-20020a9d0ac10000b0290462f0ab0800so13675990otq.11 for ; Sat, 10 Jul 2021 14:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jlekstrand-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NaZZyfwePxiEZkEb5ZSYisIkekSPvEcFee5QuNg1gBQ=; b=eBYS37VRLSFrOEsvajH4C2QctUznJRROu6upoTh3/P1JN0ziVx8E7DrvICkmbuU5yV eummayUJV2S2O4Cm2GeSNDrFRoq7kjtJ08okssRyxLHY60x4FJny+LRyx3pM0fxHXg+z FN0742KaQxrgjBmanh8jI9zP4VI8ilV8MoiNb0qKl9/1sZ2hcsVO7ODyoSrVIZxvgemC t92Ax/wkV17NILBj5Pk8jb/1HmlaXxuHim4tUs0GGochTZSRQERwIx5k3QjUcS30xHu7 plQe66lxAsmCQEjdcviXhmi5TIjzAFtUYUn9sXKTn/sLpTSjK8Xxyf+AEiE4nNQ2fKoM iqoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NaZZyfwePxiEZkEb5ZSYisIkekSPvEcFee5QuNg1gBQ=; b=Bh1ErnrEnddbIhmyky4a0Ppf4/UFoDhBIWi5spQuEzd/aw4AdXPRDYVYW9nDlBJD8f kPP2LG0rTRQBafXZT3pOMQr4BAEtRhuY1Oh09jw/bRS/imeceWMdajhTfhNS1C5Dzmo5 TjjQQVIBpMVPyhZRmHtey7oCakb2nlOCYwE5ibtwOYwCV4exMSdB6+lXRysQFIxiYiUH 6NF7PgrHXFTGoEuk0SM+68nPXHc4Yzej0pfBN7L9mqWg9HELGllWYxoJrTnDMPJR8Biw 98LV6VjBCkkrd8R7a0+aTttH+tyz8vFupdUmst27+T6sYujbiXyEqHYwYNbkSnTog5Gg JOyQ== X-Gm-Message-State: AOAM531T2UY4CwE61+xG5+Ea+xIz+qHYY8/zEUvErzOAGRef7Vet/anm H435eAi7Cf4vyktgLL9YE3DXv6DCx0ORAA== X-Google-Smtp-Source: ABdhPJxG8bSY8jyyuCxz542abC/u5CeDMpxONyHV/26q4pLBfSPEt77O7fl/GHGAMcRWK0b/+rdvyw== X-Received: by 2002:a05:6830:34a2:: with SMTP id c34mr34198395otu.59.1625952398789; Sat, 10 Jul 2021 14:26:38 -0700 (PDT) Received: from omlet.lan ([68.203.99.148]) by smtp.gmail.com with ESMTPSA id u18sm972797ooq.36.2021.07.10.14.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jul 2021 14:26:38 -0700 (PDT) From: Jason Ekstrand To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Date: Sat, 10 Jul 2021 16:24:47 -0500 Message-Id: <20210710212447.785288-3-jason@jlekstrand.net> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210710212447.785288-1-jason@jlekstrand.net> References: <20210710212447.785288-1-jason@jlekstrand.net> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/2] drm/i915/uapi: Add docs about immutability of engine sets and VMs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Signed-off-by: Jason Ekstrand Cc: Daniel Vetter --- include/uapi/drm/i915_drm.h | 39 ++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index e334a8b14ef2d..b6bfbda1258c8 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -1676,15 +1676,25 @@ struct drm_i915_gem_context_param { */ #define I915_CONTEXT_PARAM_RECOVERABLE 0x8 - /* - * The id of the associated virtual memory address space (ppGTT) of - * this context. Can be retrieved and passed to another context - * (on the same fd) for both to use the same ppGTT and so share - * address layouts, and avoid reloading the page tables on context - * switches between themselves. - * - * See DRM_I915_GEM_VM_CREATE and DRM_I915_GEM_VM_DESTROY. - */ +/* + * The id of the associated virtual memory address space (ppGTT) of + * this context. Can be retrieved and passed to another context + * (on the same fd) for both to use the same ppGTT and so share + * address layouts, and avoid reloading the page tables on context + * switches between themselves. + * + * The VM id should only be set via I915_CONTEXT_CREATE_EXT_SETPARAM. + * + * On GPUs with graphics version 12 and earlier, it may also be set via + * DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM. However, this is only for + * backwards compatibility with old userspace and should be considered + * deprecated. Starting with graphics version 13, it can only be set via + * I915_CONTEXT_CREATE_EXT_SETPARAM. When using setparam, it may only be + * set once for each context and, once the context has been used with any + * ioctl other than I915_CONTEXT_CREATE_EXT_SETPARAM, it may not be set. + * + * See DRM_I915_GEM_VM_CREATE and DRM_I915_GEM_VM_DESTROY. + */ #define I915_CONTEXT_PARAM_VM 0x9 /* @@ -1700,8 +1710,15 @@ struct drm_i915_gem_context_param { * to specify a gap in the array that can be filled in later, e.g. by a * virtual engine used for load balancing. * - * Setting the number of engines bound to the context to 0, by passing a zero - * sized argument, will revert back to default settings. + * The engine set should only be set via I915_CONTEXT_CREATE_EXT_SETPARAM. + * + * On GPUs with graphics version 12 and earlier, it may also be set via + * DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM. However, this is only for + * backwards compatibility with old userspace and should be considered + * deprecated. Starting with graphics version 13, it can only be set via + * I915_CONTEXT_CREATE_EXT_SETPARAM. When using setparam, it may only be + * set once for each context and, once the context has been used with any + * ioctl other than I915_CONTEXT_CREATE_EXT_SETPARAM, it may not be set. * * See struct i915_context_param_engines. *