Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3021858imu; Mon, 19 Nov 2018 09:28:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/Ud8LvHXIK+aTvwkApU93dwQs2vbQSz/kwUbtF51paA0RMOu1nXjwjOApg70s6ZqqjDojxN X-Received: by 2002:a63:165e:: with SMTP id 30mr8656026pgw.103.1542648499341; Mon, 19 Nov 2018 09:28:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542648499; cv=none; d=google.com; s=arc-20160816; b=rHSOMDMGEx7EAw2ByO1iXiGHH+LtFRL1KqbY7x7yN97qHq28OnefQLHFmyMSbggzR3 XduKqmlwkvQKxasGigeT4MokwkR4YNHlh5+NJdC4scw+GwW72xG++4dQOXYY0LL60zfV UOMdE+L+Cz1qqOzI8weh45t5iIV+crxSon1D017UU0cfAE4pYn8BCNFJU9FSmh4Z9ty4 H2DsfCGc1CKiKwvXPtFRUyrP8QbPwDvFwrU9vTXW0XMAzTLYP9qhioqvctWG0lqNU/dR agLYiRz2m1AJuVobULTVd3qH7CwmtjQpN2S265wm2SJwq2ksaU0u4yoBUYdEPqdu3goA YjDA== 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=XeNWZWch3tEo69uaUCojgnDtRowjgiFO7V2PIuYA6cE=; b=au/stfwj4aOL/o7vVa1Umzdg9nTUA+fJZA+FnUqF3tZmgJEPEgu1WbQMIaWRKLc5Fc BvWefoGvuBeiOhG4IBG44WzUQam3vCmtHlzFkIsdon7U1DOYdoHm8F/Tu4O/s+7yM7WP 2n5zxzW6z/qKt4WDz1HhjluxSyHa6C8GN8jmEIRNGhWHsyMwPUAX3zS79ekNaH5S1fWK GAVrw+hauLvpHAUZF0w/La3J0I4aqXPDUNtmVKEvtcNezVUjr6N5/N8HOFcU3hFaVppr AabmCWzA7HRoOB61/DSlvae51Ksuxx5bv8IuGiSAKc2JMm9iiVSZ99uePjoxbvFSygXH uIDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OH5yksit; 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 k135si20877713pgc.574.2018.11.19.09.27.47; Mon, 19 Nov 2018 09:28:19 -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=OH5yksit; 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 S2404127AbeKTDT6 (ORCPT + 99 others); Mon, 19 Nov 2018 22:19:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:59158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390530AbeKTDT4 (ORCPT ); Mon, 19 Nov 2018 22:19:56 -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 397A5208E3; Mon, 19 Nov 2018 16:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646541; bh=anWZy+OD+7LUlNSyBfjgReljgJyZYjtqILZZLDebjTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OH5yksitImHH0/9YC1ttnmWR1w/0xIDRpSvzDYbEi1iMPGdomY6rjau5c7MgDrAgH SkwPUQTN0Bsom36O4/PLb0A7/q2zhZgyH0FW9ZzSYubOvhHE+DEDrREEus1GvBHRXr H3wQzk2kgFOw/Jx48ZctdV2Q3cXeFSTxBGq/p5MM= 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.9 81/83] drm/i915/execlists: Force write serialisation into context image vs execution Date: Mon, 19 Nov 2018 17:29:47 +0100 Message-Id: <20181119162627.457763057@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162612.046511542@linuxfoundation.org> References: <20181119162612.046511542@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.9-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 @@ -368,7 +368,8 @@ static u64 execlists_update_context(stru reg_state[CTX_RING_TAIL+1] = intel_ring_offset(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. @@ -376,6 +377,17 @@ static u64 execlists_update_context(stru if (ppgtt && !USES_FULL_48BIT_PPGTT(ppgtt->base.dev)) 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; }