From patchwork Fri Oct 21 15:25:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101648 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1358629qge; Fri, 21 Oct 2016 08:27:49 -0700 (PDT) X-Received: by 10.98.82.75 with SMTP id g72mr2554621pfb.119.1477063669162; Fri, 21 Oct 2016 08:27:49 -0700 (PDT) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id h29si3140187pfd.139.2016.10.21.08.27.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Oct 2016 08:27:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C60E6ED55; Fri, 21 Oct 2016 15:27:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id ECDF36E066; Fri, 21 Oct 2016 15:27:34 +0000 (UTC) Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0MTveb-1cOJXJ2jmT-00QnSq; Fri, 21 Oct 2016 17:26:52 +0200 From: Arnd Bergmann To: Daniel Vetter , Jani Nikula Subject: [PATCH 2/2] drm/i915/gvt: fix compilation Date: Fri, 21 Oct 2016 17:25:50 +0200 Message-Id: <20161021152620.3324407-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161021152620.3324407-1-arnd@arndb.de> References: <20161021152620.3324407-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K0:3hPYIlrbDKYCjvNVv/kGt7v44LjRSzw5bO/NIWeAXB2WyIQsOWs HkFfBi/pzMWDlJzb/8LB6hs2GjlOCRybeEfTEI1DvVZuWZbq6xrGkYHJY/xFhc+cHmd32Q0 djy4xQkijgkS/TbuRNjioJRZKolqiCsKGckYSOPbrx1TJtz1+PoWIRqd8m3Pu6pduMc3pRS 9mX/FkT3ztB6BcbINRBAA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Nd0caVp/DaA=:H7qzIXQMagEwF30RAlHlJl Iua+Onn6OmLcgrompTkynIiDWGJ3uWy8qgavdTLDdJl6Zsrrpx/N29kSBGihvETgJfOfA+TL+ mU6t2t3T/W7iA//+HpYK2vdgetE87JFNYc1kQYBzJCtxh5mOpYRqrnjFeA2D0JBLNtOCFbtjV ujGn8fT1GHP8WIhQ9HzA7sfDPmN1Nf50Foo8YDjNobed1daoSOq8JTzCSZnaBWf2zz4Pl3hCM HwQjZEiHIbz9r+3cweg83Zis6NR416qmNpdgnJ+HtbNwXelPUI7zLO83d+t5ZAz1XQL8rUlWS XDUNzpppjEed0KAWG6DjOzCqehp5DLDFyk51FL7hYKtaxpgzN48mtwTXpSU8ThYttlyR36y/D L1LL1XYW3OYo48RVkaJWV3JzYan+GuC0KzGzyrXc2xxezsBZyzf+bTd3cSMGbq26L7djXjRaA xb7AY3WO/HpW21cKL6rinx+a2Xm0Es++Ac1kka5UaD0zOKmYaomtaxHT07L9Q5+m1N4ioGxiS 80j1yysqyG45+NUWLx/81aIYyqhHzeByXlc7AWuL8ZDlRGmG2ljdAGBljfd8ZmdAp8tsxWHUu wtlJg1ZxtWPkq+2CBMglx/8SDbFbdnAynSRWbI0VQkOaZ9UZU5Dw5ba76J5CorcjanSHmCEb/ VjyEfZFVMfBvqYr1+mB8gYD3FOF/ZekbYjhKUEwmxL4SzCATGaFop/j7MGWjxwlaeEs76+jyE mycEL5HUdJAUKeIf Cc: dri-devel@lists.freedesktop.org, Arnd Bergmann , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, igvt-g-dev@lists.01.org, Zhi Wang X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Two functions in the newly added gvt render code are obviously broken, as they reference a variable without initialization and don't reference another variable at all: drivers/gpu/drm/i915/gvt/render.c: In function ‘intel_gvt_load_render_mmio’: drivers/gpu/drm/i915/gvt/render.c:148:13: error: ‘offset.reg’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/gpu/drm/i915/gvt/render.c: In function ‘intel_gvt_restore_render_mmio’: drivers/gpu/drm/i915/gvt/render.c:185:13: error: ‘offset.reg’ may be used uninitialized in this function [-Werror=maybe-uninitialized] This is probably not a correct fix, but it gets us a clean build by removing the unused arrays and initializing the offset variable to something that potentially might be correct. Fixes: 178657139307 ("drm/i915/gvt: vGPU context switch") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/i915/gvt/render.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/render.c b/drivers/gpu/drm/i915/gvt/render.c index feebb65ba641..79e112288065 100644 --- a/drivers/gpu/drm/i915/gvt/render.c +++ b/drivers/gpu/drm/i915/gvt/render.c @@ -147,29 +147,20 @@ static void load_mocs(struct intel_vgpu *vgpu, int ring_id) { struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; i915_reg_t offset, l3_offset; - u32 regs[] = { - [RCS] = 0xc800, - [VCS] = 0xc900, - [VCS2] = 0xca00, - [BCS] = 0xcc00, - [VECS] = 0xcb00, - }; int i; - if (WARN_ON(ring_id >= ARRAY_SIZE(regs))) - return; - if (!IS_SKYLAKE(dev_priv)) return; for (i = 0; i < 64; i++) { + offset.reg = i * 4; gen9_render_mocs[ring_id][i] = I915_READ(offset); I915_WRITE(offset, vgpu_vreg(vgpu, offset)); POSTING_READ(offset); - offset.reg += 4; } if (ring_id == RCS) { + offset.reg = 64 * 4; l3_offset.reg = 0xb020; for (i = 0; i < 32; i++) { gen9_render_mocs_L3[i] = I915_READ(l3_offset); @@ -184,26 +175,16 @@ static void restore_mocs(struct intel_vgpu *vgpu, int ring_id) { struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; i915_reg_t offset, l3_offset; - u32 regs[] = { - [RCS] = 0xc800, - [VCS] = 0xc900, - [VCS2] = 0xca00, - [BCS] = 0xcc00, - [VECS] = 0xcb00, - }; int i; - if (WARN_ON(ring_id >= ARRAY_SIZE(regs))) - return; - if (!IS_SKYLAKE(dev_priv)) return; for (i = 0; i < 64; i++) { + offset.reg = i * 4; vgpu_vreg(vgpu, offset) = I915_READ(offset); I915_WRITE(offset, gen9_render_mocs[ring_id][i]); POSTING_READ(offset); - offset.reg += 4; } if (ring_id == RCS) {