Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1856385pxb; Mon, 8 Mar 2021 08:01:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxm77Q5ITf8ZkN51TZ7OrtIKtpfuhNXnfpZsYbrFQ1wUnKir48OW9lV4nKyNYfKmWNljKjH X-Received: by 2002:a50:9dc9:: with SMTP id l9mr22615187edk.377.1615219259886; Mon, 08 Mar 2021 08:00:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615219259; cv=none; d=google.com; s=arc-20160816; b=ey0Hzk0Njxg5BBAc+7YPMBTnPlKYWOH43ncNiIwpKwt5DFDY4MsOlOFR+PFA9K4iep ufgxGuaEoLu3BoHWMeaOIRlFzObaAmPzuY9vMEo+Ufju3g2eFbA9PvlNL91fsTDBlspd dQIb6LXv0BcMP8xqyJVMm8c8gWDxTCWivJfPJ9KF2bXmr+0Qz9UswG5zgFTXL6eUO5UE vUUMvyE9qOEVWk/Gdfth0N9Ful7W4HbM77Jqxw5tyxdN4sJJSZyy2jxprqpJSdStKFNG T3pss6Gn1uIxd4pAG9HkmOBXJ731bdGipxsyGPon5KJMc29vghpDCQ2La7Y/6/CzXmwe stRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VY0PXUh9WT9Y5rGeaIMe8bKzVkreBRdAfUvdReE4e6I=; b=gCNXOULkZUGsIn8TE3ezDxDFDTRzg4DLbLQOm6zQWlC5zIXZWFcVHpmj7DnspZopOr V5bwLfaLVfIHNKGuh+VUk7I9u0Oxv2ZMeH++NCUOl9IM4gW3b/ZeAaJOpA+QdqmOa/0r j0jjmOHdwOYUtpNnCJsErQ9skODCfBTayfNpTAsHYm4vJAcp32Y3KHyCzkChQmywhM+5 CvCURC0ywhNIssG7VwvqqN3+38p0estBoPqNL7WS4IokqEi0WJ4LQ2bnNGpKgxbA1yEg aQq9m7ZaX4w2/vyqidAS9x+8Wr50EiNubgqQwjzBLOAmc/SP6JoAsi/6z/RiVg7pIqC5 mEZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hDVw4MdE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do13si2777202ejc.87.2021.03.08.08.00.36; Mon, 08 Mar 2021 08:00:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hDVw4MdE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbhCHP5D (ORCPT + 99 others); Mon, 8 Mar 2021 10:57:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:37848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbhCHP4r (ORCPT ); Mon, 8 Mar 2021 10:56:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B7906523A; Mon, 8 Mar 2021 15:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615219006; bh=AMnX0SygVGdsOpsu02CyTU1ONKxzUU3oyic44NgULgI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=hDVw4MdENfuLbuKeqvtBWjNwSH2rGzMMF/UVPMnMptRWwixmLjWouenUjUaZVGD/2 VDMzOioc+4g7dqsc/yvW88uPL+29CGqQCCcpQzmxLxhV7KMxKvQtgk6ST1Kjl8y1q2 duBbBAIERhBaUMUImlm/GCfe1/7FPwjyV+UM9oTNfa1Q/kDnW7sUHWtWfot6bOFk3y 1mqTkQCxIg0qqeUjcAZYP5AIzpA3NpprexEMQKdpGNeQYrMHp22XkRRVLOa26628X/ y1UFObeUQDmDtkDsdbhoJ2hHWCISQWABVWk7BJg3tO6uwI9Am6lX8TVOpfl/KC4tf3 GoDVG1lJDWslw== Received: by mail-ed1-f51.google.com with SMTP id d13so15511359edp.4; Mon, 08 Mar 2021 07:56:46 -0800 (PST) X-Gm-Message-State: AOAM532tV9yA+5I+6LKx8BpO+aC5xGnjjW7VmpqucMgr5UpNmm19fadp 1YCMJyacjIeBcqsG6poivuYRn+lcyBN3HwMcKg== X-Received: by 2002:a05:6402:c0f:: with SMTP id co15mr22380286edb.373.1615219004932; Mon, 08 Mar 2021 07:56:44 -0800 (PST) MIME-Version: 1.0 References: <20210304213902.83903-1-marcan@marcan.st> <20210304213902.83903-13-marcan@marcan.st> <6e4880b3-1fb6-0cbf-c1a5-7a46fd9ccf62@marcan.st> In-Reply-To: From: Rob Herring Date: Mon, 8 Mar 2021 08:56:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFT PATCH v3 12/27] of/address: Add infrastructure to declare MMIO as non-posted To: Arnd Bergmann Cc: Hector Martin , linux-arm-kernel , Marc Zyngier , Olof Johansson , Krzysztof Kozlowski , Mark Kettenis , Tony Lindgren , Mohamed Mediouni , Stan Skowronek , Alexander Graf , Will Deacon , Linus Walleij , Mark Rutland , Andy Shevchenko , Greg Kroah-Hartman , Jonathan Corbet , Catalin Marinas , Christoph Hellwig , "David S. Miller" , DTML , "open list:SERIAL DRIVERS" , Linux Doc Mailing List , linux-samsung-soc , "open list:GENERIC INCLUDE/ASM HEADER FILES" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 5, 2021 at 2:17 PM Arnd Bergmann wrote: > > On Fri, Mar 5, 2021 at 7:18 PM Hector Martin wrote: > > > > On 06/03/2021 02.39, Rob Herring wrote: > > >> - return ioremap(res.start, resource_size(&res)); > > >> + if (res.flags & IORESOURCE_MEM_NONPOSTED) > > >> + return ioremap_np(res.start, resource_size(&res)); > > >> + else > > >> + return ioremap(res.start, resource_size(&res)); > > > > > > This and the devm variants all scream for a ioremap_extended() > > > function. IOW, it would be better if the ioremap flavor was a > > > parameter. Unless we could implement that just for arm64 first, that's > > > a lot of refactoring... > > > > I agree, but yeah... that's one big refactor to try to do now... > > FWIW, there is ioremap_prot() that Christoph introduced in 2019 > for a few architectures. I suppose it would be nice to lift > that out architecture specific code and completely replace the > unusual variants, leaving only ioremap(), ioremap_prot() and > memremap() but dropping the _nc, _cached, _wc, _wt and _np > versions in favor of an extensible set of flags. > > Then again, I would not make that a prerequisite for the merge > of the M1 support. > > > > What's the code path using these functions on the M1 where we need to > > > return 'posted'? It's just downstream PCI mappings (PCI memory space), > > > right? Those would never hit these paths because they don't have a DT > > > node or if they do the memory space is not part of it. So can't the > > > check just be: > > > > > > bool of_mmio_is_nonposted(struct device_node *np) > > > { > > > return np && of_machine_is_compatible("apple,arm-platform"); > > > } > > > > Yes; the implementation was trying to be generic, but AIUI we don't need > > this on M1 because the PCI mappings don't go through this codepath, and > > nothing else needs posted mode. My first hack was something not too > > unlike this, then I was going to get rid of apple,arm-platform and just > > have this be a generic mechanism with the properties, but then we added > > the optimization to not do the lookups on other platforms, and now we're > > coming full circle... :-) > > I never liked the idea of having a list of platforms that need a > special hack, please let's not go back to that. I'm a fan of generic solutions as much as anyone, but not when there's a single user. Yes, there could be more, but we haven't seen any yet and Apple seems to have a knack for doing special things. I'm pretty sure posted vs. non-posted has been a possibility with AXI buses from the start, so it's not like this is a new thing we're going to see frequently on new platforms. A generic property we have to support forever because there's zero visibility if someone uses them. At least with something platform specific, we know if it's in use or can be removed. That's something I just checked recently with some of the PPC irq work-arounds (spoiler: yes, those 'old world Mac' are). I'm a bit less worried about this aspect given we can probably assume someone will still be using M1 Macs in 20+ years. The other situation I worry about here is another arch has implicitly defaulted to non-posted instead of posted. It could just be non-posted was what worked everywhere and Linux couldn't distinguish. Now someone sees we have this new posted vs. non-posted handling and can optimize some mappings on their platform and we have to have per arch defaults (like 'dma-coherent' now). Rob