Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2977282imu; Mon, 19 Nov 2018 08:53:29 -0800 (PST) X-Google-Smtp-Source: AJdET5cV0sb/kE0JfN3FjBBQdn5ttbld/4gJy+V2IOAkTAHPfhgtW9cIhpY3TbUO/tg6fdbVg/J/ X-Received: by 2002:a62:8a51:: with SMTP id y78mr12900637pfd.35.1542646409210; Mon, 19 Nov 2018 08:53:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542646409; cv=none; d=google.com; s=arc-20160816; b=DzrIwgbqb9cygmScHZczaTRYXSQe+Ku+EeWZvBd6z0w28iC0MnAbWYriA3pHQ3nDhY P6DKS1bDIIAt2YbO+KnTKzdSRtwnyksTc9n94al0i/Un0BFW96eh07dvleRKPAHtTdGt CbMpPCYZytyCJw9D+xC40OEBDXvdGzcrddwM0xZFEqo/CYVOmN0gtyndJSQnnuE2tkqL SZGM+I227BE3OnGc7dUch8k6Z0A4MRrLfaWgaMWTHJS30+8c21CuLxVJVjHK9BBk46RB d8OIwv0npQ1c1wN0Ti7kWmw2jn3aoT6w42JCDdxfj53Dk96MPitnEsDHWZkRi+IJuQge CVbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iJlfa+hEtGgJ0HxdkLELtphTFO/fVl0oUQobYcEV2EA=; b=AzrFVQI6r1VY+wBcxj6JVphkq1fFSYDueS6KilcXpCgwtZ+GTMMidPZ79hRUrM7hRW I1EJRaKF4UwEKjp1fF6Q48P7/ntLvE/reh08CXkw6mhtdQ6fYs+hBBjWRiasClZ2EWeY SsthxwRD4e/RazvALNgjmuh7BR+lgAfFr9qSH5EMcEv46by53gaKB9xeUBjqElluy1L+ Q30atDroWfIgBeAz6KJoHi7MrzMq/QQP63tWyHgqxFDHH/Vf+aT1TZDZz3ZFPaxxd5x7 EJKh6BG0KAc3vM7G/kx4XOc7Ysq78bQzXYtPI6s0t6eR2z19RPyIJ2P1+nRLhNDKJJPL 69qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="aVBTjL/J"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m61si3450779plb.154.2018.11.19.08.53.14; Mon, 19 Nov 2018 08:53:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="aVBTjL/J"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390543AbeKTDQb (ORCPT + 99 others); Mon, 19 Nov 2018 22:16:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:54420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390534AbeKTDQa (ORCPT ); Mon, 19 Nov 2018 22:16:30 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 25494206BA; Mon, 19 Nov 2018 16:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646336; bh=MgxcbQUFEoErDCLgYPF7lzAB5iY3WorPGnGaHPaLnE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aVBTjL/JYy2/RBotFtsMQCm73DSHSs4z8RcIoDwuvnfYJmBmanvCtg+7ZqahjBeB8 eKmVpUsQSdcIIshkZMcNzs0iLIOOgur1kDpL1T42Uz8JhxTo26cU0BN9ZXIyeZnIe3 0LcuFQ3D1uQyODVuE81e4YcLyBZTjIQPabCXiy/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Mika Kuoppala , Tvrtko Ursulin , Joonas Lahtinen Subject: [PATCH 4.14 119/124] drm/i915/execlists: Force write serialisation into context image vs execution Date: Mon, 19 Nov 2018 17:29:33 +0100 Message-Id: <20181119162633.662498749@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162612.951907286@linuxfoundation.org> References: <20181119162612.951907286@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chris Wilson commit 0a823e8fd4fd67726697854578f3584ee3a49b1d upstream. Ensure that the writes into the context image are completed prior to the register mmio to trigger execution. Although previously we were assured by the SDM that all writes are flushed before an uncached memory transaction (our mmio write to submit the context to HW for execution), we have empirical evidence to believe that this is not actually the case. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108656 References: https://bugs.freedesktop.org/show_bug.cgi?id=108315 References: https://bugs.freedesktop.org/show_bug.cgi?id=106887 Signed-off-by: Chris Wilson Cc: Mika Kuoppala Cc: Tvrtko Ursulin Acked-by: Mika Kuoppala Link: https://patchwork.freedesktop.org/patch/msgid/20181108081740.25615-1-chris@chris-wilson.co.uk Cc: stable@vger.kernel.org (cherry picked from commit 987abd5c62f92ee4970b45aa077f47949974e615) Signed-off-by: Joonas Lahtinen Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_lrc.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -325,7 +325,8 @@ static u64 execlists_update_context(stru reg_state[CTX_RING_TAIL+1] = intel_ring_set_tail(rq->ring, rq->tail); - /* True 32b PPGTT with dynamic page allocation: update PDP + /* + * True 32b PPGTT with dynamic page allocation: update PDP * registers and point the unallocated PDPs to scratch page. * PML4 is allocated during ppgtt init, so this is not needed * in 48-bit mode. @@ -333,6 +334,17 @@ static u64 execlists_update_context(stru if (ppgtt && !i915_vm_is_48bit(&ppgtt->base)) execlists_update_context_pdps(ppgtt, reg_state); + /* + * Make sure the context image is complete before we submit it to HW. + * + * Ostensibly, writes (including the WCB) should be flushed prior to + * an uncached write such as our mmio register access, the empirical + * evidence (esp. on Braswell) suggests that the WC write into memory + * may not be visible to the HW prior to the completion of the UC + * register write and that we may begin execution from the context + * before its image is complete leading to invalid PD chasing. + */ + wmb(); return ce->lrc_desc; }