From patchwork Tue Jul 17 14:12:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10529553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BA5E4603ED for ; Tue, 17 Jul 2018 14:13:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A7BB2910D for ; Tue, 17 Jul 2018 14:13:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E9F92911A; Tue, 17 Jul 2018 14:13:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2D5952910D for ; Tue, 17 Jul 2018 14:13:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 741C36E72D; Tue, 17 Jul 2018 14:13:09 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 33ABF6E72D for ; Tue, 17 Jul 2018 14:13:07 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 12379310-1500050 for multiple; Tue, 17 Jul 2018 15:12:59 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Tue, 17 Jul 2018 15:12:58 +0100 Message-Id: <20180717141259.20841-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.18.0 Subject: [Intel-gfx] [PATCH 1/2] drm/i915/selftests: Mark mock contexts as being !GGTT X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 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-Virus-Scanned: ClamAV using ClamSMTP i915_is_ggtt() uses the ctx->file_priv == NULL to determine if the context was allocation on behalf of the user, or by the kernel. Ordinarily, we only ever allocate one context by the kernel and this is used as the Global GTT, but for self testing we may want to create lots of internal contexts unconnected to struct files. These we ordinarily do not want to mistake for the GGTT, even when mocked there will only be a single mock GGTT. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/selftests/mock_context.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/selftests/mock_context.c b/drivers/gpu/drm/i915/selftests/mock_context.c index 8904f1ce64e3..23b8b254ef89 100644 --- a/drivers/gpu/drm/i915/selftests/mock_context.c +++ b/drivers/gpu/drm/i915/selftests/mock_context.c @@ -103,7 +103,14 @@ live_context(struct drm_i915_private *i915, struct drm_file *file) struct i915_gem_context * kernel_context(struct drm_i915_private *i915) { - return i915_gem_context_create_kernel(i915, I915_PRIORITY_NORMAL); + struct i915_gem_context *ctx; + + ctx = i915_gem_context_create_kernel(i915, I915_PRIORITY_NORMAL); + if (IS_ERR(ctx)) + return ctx; + + ctx->file_priv = ERR_PTR(-EPERM); /* !i915_is_ggtt() */ + return ctx; } void kernel_context_close(struct i915_gem_context *ctx)