From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9240CC433E0 for ; Wed, 24 Feb 2021 20:27:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D74164E60 for ; Wed, 24 Feb 2021 20:27:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233331AbhBXU06 (ORCPT ); Wed, 24 Feb 2021 15:26:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231638AbhBXU05 (ORCPT ); Wed, 24 Feb 2021 15:26:57 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10F7CC061574; Wed, 24 Feb 2021 12:26:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=12uBme4GCr5a64UICfDbTfX0OuT87MBZBcK/kCTZvbk=; b=SLzy9dCxAYlVLXy9GlVICcWvPV ZONL9MQqnJfS1YM/LP75Jfcel8YwDJkw6fH5DdbfexEETSxS9ZiRhvP8QNPaYa3T9rbQ+ZZ8DRQev sLpED6AGOXn7Og/bztdtJXh8KRt17lvpa1FwI/tAXYAuNYvurT1uej9jqAJ/BIB6GnEgm7XDrBvUH HZu1fqXTyo9NXr27Gq3Gjgc9BCbWq39LBfHPCepditv8nnhRU5uj/uu1OzpfSorpP9bx1uQUYKIRx m8qNHOcctLnyxydwggT39kNF1kscayTHiEI7wCW2WEr9V4ZpWxZ3zfeHojXDcUffe8WJB/8raN8lB hbB9c3NQ==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lF0j4-009qsn-3j; Wed, 24 Feb 2021 20:25:49 +0000 Date: Wed, 24 Feb 2021 20:25:38 +0000 From: Christoph Hellwig To: Florian Fainelli Cc: Robin Murphy , Nicolas Saenz Julienne , linux-pci , linux-arm-kernel , linux-rpi-kernel , devicetree , Rob Herring , Bjorn Helgaas , Robin Murphy , bcm-kernel-feedback-list Subject: Re: RPi4 can't deal with 64 bit PCI accesses Message-ID: <20210224202538.GA2346950@infradead.org> References: <2220c875-f327-586c-79c7-eadff87e4b4d@arm.com> <6088038a-2366-2f63-0678-c65a0d2efabd@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6088038a-2366-2f63-0678-c65a0d2efabd@gmail.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Wed, Feb 24, 2021 at 08:55:10AM -0800, Florian Fainelli wrote: > > Working around kernel I/O accessors is all very well, but another > > concern for PCI in particular is when things like framebuffer memory can > > get mmap'ed into userspace (or even memremap'ed within the kernel). Even > > in AArch32, compiled code may result in 64-bit accesses being generated > > depending on how the CPU and interconnect handle LDRD/STRD/LDM/STM/etc., > > so it's basically not safe to ever let that happen at all. > > Agreed, this makes finding a generic solution a tiny bit harder. Do you > have something in mind Nicolas? The only workable solution is a new bool 64bit_mmio_supported(void) check that is used like: if (64bit_mmio_supported()) readq(foodev->regs, REG_OFFSET); else lo_hi_readq(foodev->regs, REG_OFFSET); where 64bit_mmio_supported() return false for all 32-bit kernels, true for all non-broken 64-bit kernels and is an actual function for arm64 multiplatforms builds that include te RPi quirk. The above would then replace the existing magic from the and headers.