Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp124126imm; Fri, 3 Aug 2018 00:17:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfj0Btd7xPjfCeCnPT1AZJQRpgLsZ/DheQD1fPUKSd8nCNk42GICN65I+qtpQT4aMWiR/w+ X-Received: by 2002:a17:902:9a83:: with SMTP id w3-v6mr2413862plp.75.1533280671386; Fri, 03 Aug 2018 00:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533280671; cv=none; d=google.com; s=arc-20160816; b=NfuisM8GujItcVVqU4KCrFufrovWwt41m0eNsbugagbAoUbH3yKak9rbcoKDoTY/Yg Yjk3EXDV+dkh6dIrXN37sxMXcK7kZ9auZ7b1CXwrAUVEqIpUu1IAzdWo/5YlUVMvI3Cw nnmvc4C38jHMqaHHuTX58PU6s7DAl/uAVMUci5+Z6D346lK4gWBGhUhrjK8hCBVGyfee rXCTswNv4Mt9vQz5ggMD5pfpABMPm8iKBiDK5PN9wTcAjGuBi5Fto2T7XdaupKCT5tw7 si5QLjXokY4GJUMMhlO+9+wvRkd5FcyqqdqEOApnNGdWua9qBO8y8ZwySOH/cHQmqJlb Zl+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Zzp4ncsuj9rG5qACaSG3GJJvpeFSD00yenJ89qvmnuA=; b=l+9luOZshCBlm5yWcqEuVr1WjHORFnpKpehIs2kuXPsPGj79jbN5cXRenbhRYg21ia 2lsb/DgDzHhZH3FD8u4YAoZf2wReaR2VrWd2iiwz+AnItJOdC9WAcrdseo6ik6vzh4bP g7NbyBa1Yfz5PFNOzBTy1bvzPUVVoxGTesJ1IvBMIoXwiD4icycoYp4nNE7M58IbJ2ep vk1O5mzUcQbmXgABlGE+QFcASYYobHAjftuZyNQRH+P8ak8EohvfbH2WGgKDC4tkgsPb 3GkYWlVrojiV8OyMf2osxMmFOdosDnHJNMeN6QTVhY84uSpQ5fPFc4gnuxsdFuRmhu+2 QqSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e8RY2uLi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k130-v6si4672814pfc.282.2018.08.03.00.17.36; Fri, 03 Aug 2018 00:17:51 -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; dkim=pass header.i=@linaro.org header.s=google header.b=e8RY2uLi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728197AbeHCJLf (ORCPT + 99 others); Fri, 3 Aug 2018 05:11:35 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:50691 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727469AbeHCJLf (ORCPT ); Fri, 3 Aug 2018 05:11:35 -0400 Received: by mail-it0-f51.google.com with SMTP id j81-v6so5368217ite.0 for ; Fri, 03 Aug 2018 00:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Zzp4ncsuj9rG5qACaSG3GJJvpeFSD00yenJ89qvmnuA=; b=e8RY2uLisnK2e4IgB3CpE+tAJm1aEs/XOACjgo/Oqpivu+F4EK50xR97+zSnBkcAfm uaW5z6PelFjorKa6MIfjomdXP7bDhZF+jJkBeIHbxUX0a3INf9NPrLciV+R9T7ZXVMkG X0FS9SG1L1EhfrsFSQewa1w05Lsj9YhuJIsEI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Zzp4ncsuj9rG5qACaSG3GJJvpeFSD00yenJ89qvmnuA=; b=D28/mDCdtf573PfRKRQO5ki4+2bcG8V+TJQILYqkA7w6FRiubqHmefi5UV5Q6vCdx3 drlyNwVkB+KWd+FzmVN7hpmEzzgQqN8p7pVHbVVCbmJtoMoTdpvJ4P5bLR4jad+hKMsg GJoU+3QvUdARQiuXQYn1ewCwK/Dtht7TzK4EFmyjlK4P9eZFW1lwHGMYsRGoBTrb2j+R hWuxnwZRx5Q44JSesE1wkjt8z7LStKg7bQVgvLEOFtC2DtSE3i4nDjG8iKOnSW3WBnPd LWv0I1WIindzsfpJPuqoYAL2VpTGWxgeGg1eCOof0PV6TMEB0kHxa7qzHWUWTQFCgqql kPpA== X-Gm-Message-State: AOUpUlGVHUcGwiz+GsEsdsDuKR/rgCU1ko62MDTjmbq1wdQrVCxX16uQ iHtcSgXbO1PiqNmKzuJ1BFx1TqT44y/PSGvI1fbqgg== X-Received: by 2002:a24:148c:: with SMTP id 134-v6mr5340613itg.50.1533280599786; Fri, 03 Aug 2018 00:16:39 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:ac05:0:0:0:0:0 with HTTP; Fri, 3 Aug 2018 00:16:39 -0700 (PDT) In-Reply-To: References: From: Ard Biesheuvel Date: Fri, 3 Aug 2018 09:16:39 +0200 Message-ID: Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 To: Mikulas Patocka Cc: Matt Sealey , Thomas Petazzoni , libc-alpha@sourceware.org, Catalin Marinas , Will Deacon , Russell King , Linux Kernel Mailing List , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3 August 2018 at 08:35, Mikulas Patocka wrote: > > > On Thu, 2 Aug 2018, Matt Sealey wrote: > >> The easiest explanation for this would be that the memory isn?t mapped >> correctly. You can?t use PCIe memory spaces with anything other than >> Device-nGnRE or stricter mappings. That?s just differences between the >> AMBA and PCIe (posted/unposted) memory models. Whoa hold on there. Are you saying we cannot have PCIe BAR windows with memory semantics on ARM? Most accelerated graphics drivers rely heavily on the ability to map the VRAM normal-non-cacheable (ioremap_wc, basically), and treat it as ordinary memory. > > I've tried to use Device-nGnRE mapping and I've got unaligned access > traps. Gcc have store-merging pass so that it generates unaligned accesses > even in code that has none explicit unaligned accesses. Perhaps it would > be possible to recompile the kernel without the store-merging pass, but > recompiling all the userspace code is impossible. > > Should we catch the unaligned access traps in the kernel and emulate them? > There are a lot of instructions that access memory in the ARMv8 ISA, so > the emulator would be quite complicated. > >> Normal memory (cacheable or uncacheable, which Linux tends to call >> ?memory? and ?writecombine? respectively) is not a good idea. >> >> There are two options; make sure Links maps it?s framebuffer as Device >> memory, or the driver, or both - and make sure that only aligned >> accesses happen (otherwise you?ll just get a synchronous exception) and >> there isn?t a Normal memory alias. >> >> Alternatively, tell the PCIe driver that the framebuffer is in system >> memory > > But how would the graphics card display from it? You'd have to > periodically copy the framebuffer from the system memory to the real > videoram. I'm not an expert in graphics drivers, I don't know if the > graphics drivers have this possibility. > >> - you can map it however you like but there?ll be a performance >> hit if you start to use GPU acceleration, but a significant performance >> boost from the PoV of the CPU. Only memory accessed from the PCIe master >> interface (i.e. reads and writes generated by the card itself - telling >> the GPU to pull from system memory or other DMA) can be in Normal memory >> and this allows PCIe to be cache coherent with the right interconnect. >> The slave port on a PCIe root complex (i.e. CPU writes) can?t be used >> with Normal, or reorderable, and therefore your 2GB of graphics memory >> is going to be slow from the point of view of the CPU. >> >> To find the correct mapping you?ll need to know just how cache coherent >> the PCIe RC is... >> >> Ta, >> Matt > > Mikulas > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel