Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2961167imu; Mon, 19 Nov 2018 08:39:58 -0800 (PST) X-Google-Smtp-Source: AJdET5dhtJPJTorCYvnNMSnaJuoetFLRkf4egUCSv7ACtabfm300RVAXM6WMZGixD4wahwWdAUCP X-Received: by 2002:a63:5153:: with SMTP id r19mr20635473pgl.281.1542645597967; Mon, 19 Nov 2018 08:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645597; cv=none; d=google.com; s=arc-20160816; b=u24gZ/xIy6DZZvZ1yMGXH3banl1mhdU+FlbRpYh2qKAbUwuh0ltYeDLC5hzJ4dytjW mQUetFXrEYTZUJteBSpdw3D3VKuY9/yJosW8ddt1snGmhxlnSMIuzAQBSYkDB/OlR5CT 4gCnaSOHGNNKZj0EKCBk0ynEIF9JDPYgaCccrp2yu0mxUw//8OHHcrAnciRTAYHLs8zM uCiqT8aImuPD2BEWeMdcWmnCjV4pBrWvvnBBnywZY+9cAlnLFp3ogwi1L2lNJRs+d1+J 4UlJ1hSz+UT99pkWvp8KdPMXKLv04XnYXtz3SsM5D2MpnaR913jqJ70hrAxB8Us/v718 beTg== 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=8hFUEvz/UeQ+3+DtErZnIVlhkigY2dMxtbkMG+YJn/c=; b=0DnzXgUTl4ARhgHizXOdSSI6ab6rafjtdktUB533M7Va8n2D/0Zsprt3qiFTp4+nxu xJWOmwfADRegetW9o5RhdE6BJ0nqS54MXEtN4IkdO+8UNwMngRO1M/Imi+JFXztUblNR Y9zj9Z/Bl8AI4btnR1KPmKZAg1K0brmZbezANGkA4Jiq8d45n8BS0eZ95fDA0nBlitkN iaXjcgzAeANnn6nCKOWW8ag9KeoQUgcA7CbFt2A1dXGk+A+wnLn8VXjZ9E5DPC8uoCha 0pdoQbo4uAIkr6rhT5bN4C8w2ywz2QOgmI+ROm1IQp0Mw89RAyd6xYyq7FHg2k4AJPq8 Hlcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1Dy+u607; 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 r22-v6si53105248pfr.18.2018.11.19.08.39.43; Mon, 19 Nov 2018 08:39:57 -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=1Dy+u607; 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 S1732613AbeKTDDI (ORCPT + 99 others); Mon, 19 Nov 2018 22:03:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:35608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731637AbeKTDDH (ORCPT ); Mon, 19 Nov 2018 22:03:07 -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 50D1F20989; Mon, 19 Nov 2018 16:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645537; bh=VLSvI9axjnG4Qqm578tuiJBopkzlfnPoULtevo3Ds2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Dy+u607Qvs9IhwMJUA9STOJUnSHhcO7GEa223j5iJHwRT26AbU/zV2thjbJzKDbu E+iMMSYCbPPNvCFL6qPYbhllEBCbXQbSVvXghPxVfEfc7Xm4zz8TEeLk81QBu58HBY W5QZCPjM2BAFoJiFX9eNmdI45fwCg7D2orh6I5Sk= 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.19 201/205] drm/i915/execlists: Force write serialisation into context image vs execution Date: Mon, 19 Nov 2018 17:28:28 +0100 Message-Id: <20181119162642.716435677@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@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.19-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 @@ -424,7 +424,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. @@ -432,6 +433,17 @@ static u64 execlists_update_context(stru if (ppgtt && !i915_vm_is_48bit(&ppgtt->vm)) 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; }