Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3769126imm; Mon, 6 Aug 2018 10:15:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc7i/G7LkUDdkPGm8L67lKLkSf91uBP/ykywRJNcPBIR0W6mifusALuSZjt3zp3DhSo8EOj X-Received: by 2002:a62:7590:: with SMTP id q138-v6mr9708323pfc.1.1533575707082; Mon, 06 Aug 2018 10:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533575707; cv=none; d=google.com; s=arc-20160816; b=t50dS8Sw1WBD+e7U1Yte0RThVzVm5qJFo5vLzgHm2EhLMduZDB+2/VhEHAzqdv4RlF D2NjXJhDBi+hJiETsbEPtSPOKqSfxviTrwSd0dCttRkmR8l83WinAglLQMcqUSbeZCfD jJeM8kAxeWvpBVMmbRSz6qZCL/SGk+DLP/84Z4EySlNLaCJf3GWiQVM24MxaNCoR4eor wApLTLNmkNiZUsirkvdVWhJjp+wA2av45OYtGbqP0BRTN/S9FtQ5dRMAkyUpa0NUBBnb gQsYzcCKHxyK9sFtRfIAv+805Ee2P3IFiMtURLikzVHtrkmykjkS3cPOG9ByKdthYTp7 0a+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=WOJIDb6mMR1611Bl1CLdMSQMqxHyMMF5lZy+xreLnL8=; b=jOmhHlcyqB89PErtDJN1iJwtFHXQHcTATc688krL9TMQB0ieqEuXuNeMWScW4rLIph mK5urlDw7XcgnDKKkFYpOiwC02fkq4RFtr59juRVpdm/et/rZOXNMGxEWsWGrDJTq91g ME7jIR7ryn6D9iVNNy1C60SoLvhr/XADqi0O33+YZFcGeJKA0zJGxX5ycan3flQJxO2M zs7NEp82Q3EMHLP2eTwBFc9TIg4jm8JuijugKvX79gEStcluk5mcJsJkdQ9MQjsobY/b zuGUutYr2gzdgQVFstLIwnfieDDOymYvQcW8QbzHpLCFeiEquThyCM8ZnmQDx1fH6jtO tpSw== ARC-Authentication-Results: i=1; mx.google.com; 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 q126-v6si15122214pfb.277.2018.08.06.10.14.51; Mon, 06 Aug 2018 10:15:07 -0700 (PDT) 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; 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 S1732440AbeHFTYE (ORCPT + 99 others); Mon, 6 Aug 2018 15:24:04 -0400 Received: from foss.arm.com ([217.140.101.70]:42578 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729749AbeHFTYE (ORCPT ); Mon, 6 Aug 2018 15:24:04 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E78CF80D; Mon, 6 Aug 2018 10:14:01 -0700 (PDT) Received: from armageddon.cambridge.arm.com (armageddon.emea.arm.com [10.4.13.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D249E3F5D0; Mon, 6 Aug 2018 10:13:59 -0700 (PDT) Date: Mon, 6 Aug 2018 18:13:57 +0100 From: Catalin Marinas To: Ard Biesheuvel Cc: Robin Murphy , Thomas Petazzoni , Joao Pinto , linux-pci , Will Deacon , Russell King , Linux Kernel Mailing List , Mikulas Patocka , Matt Sealey , Jingoo Han , linux-arm-kernel Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 Message-ID: <20180806171356.kk45vd7n5bdi6ka3@armageddon.cambridge.arm.com> References: <20180803094129.GB17798@arm.com> <99fff4fe-afa9-f12f-a518-472a9dd1c530@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 06, 2018 at 05:47:36PM +0200, Ard Biesheuvel wrote: > On 6 August 2018 at 14:42, Robin Murphy wrote: > > On 06/08/18 11:25, Mikulas Patocka wrote: > > [...] > >>> > >>> None of this explains why some transactions fail to make it across > >>> entirely. The overlapping writes in question write the same data to > >>> the memory locations that are covered by both, and so the ordering in > >>> which the transactions are received should not affect the outcome. > >> > >> You're right that the corruption couldn't be explained just by reordering > >> writes. My hypothesis is that the PCIe controller tries to disambiguate > >> the overlapping writes, but the disambiguation logic was not tested and it > >> is buggy. If there's a barrier between the overlapping writes, the PCIe > >> controller won't see any overlapping writes, so it won't trigger the > >> faulty disambiguation logic and it works. > >> > >> Could the ARM engineers look if there's some chicken bit in Cortex-A72 > >> that could insert barriers between non-cached writes automatically? > > > > I don't think there is, and even if there was I imagine it would have a > > pretty hideous effect on non-coherent DMA buffers and the various other > > places in which we have Normal-NC mappings of actual system RAM. > > Looking at the A72 manual, there is one chicken bit that looks like it > may be related: > > CPUACTLR_EL1 bit #50: > > 0 Enables store streaming on NC/GRE memory type. This is the reset value. > 1 Disables store streaming on NC/GRE memory type. > > so putting something like > > mrs x0, S3_1_C15_C2_0 > orr x0, x0, #(1 << 50) > msr S3_1_C15_C2_0, x0 > > in __cpu_setup() would be worth a try. Note that access to this register may be disabled at EL3 by firmware (ACTLR_EL3.CPUACTLR). FWIW, Mikulas' test seems to run fine on a ThunderX1 with AMD FirePro W2100 (on /dev/fb1) -- Catalin