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=-9.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 CFA08C433E0 for ; Fri, 5 Mar 2021 16:07:40 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 712BE65068 for ; Fri, 5 Mar 2021 16:07:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 712BE65068 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MKhcAH56tBnqQSkFrB94GZTX/yv5U7zNzE3BQRriqaw=; b=iZ0koaA80/sBQ8VuhWiG/+nMw vNqHDrPpBATUT9FrxSmtcJKPb5kwoOg9urXxqNCXyMpOr2Da9ZlapPhsYTUh9tHjit8Pf4RCTA4V2 /gPdHcpvQewzUmq5PXrKBZ3c9k/fj9FrsMGg4onXE2slFyk0wvz8eCIGaCsatsKk5KgtwUZlWUhd1 v5MfHRLZfajsQezC679SyaSUjz8rtv/n11uNWkfqn6C1+14IhnvUQ5D9Gh8ObX/y+6o2ZWV6hwHED eUTyVtQJxdH1OnFJBIbC1tzGsYDFupg726YDRBksYttmsWt6j6MbxI2rT82BEH6odePPNI6AKuI2Y 5ihHIlI5w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lICxP-00FYdb-Ka; Fri, 05 Mar 2021 16:05:39 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lICxB-00FYbE-Fs for linux-arm-kernel@lists.infradead.org; Fri, 05 Mar 2021 16:05:29 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 555926509A for ; Fri, 5 Mar 2021 16:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614960322; bh=ChyQh3jUOf3mpcLiwmUiTp3mAW4ljibFzKZwZJvYMcg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TaVWfxx4/vllC7hR6YYISHmND4Na36dmQm1N7qtCjMqLrOljM3V4QVNTIJr2Q7MzX 8Mdq1njeGpl00EUjSWfKgk5KOmIoNd0BIGbuZx6U1oQY5+7DU3KGWUeiSta1GOHZAl zw2h4zndDgOaeFsFrI+v6I6ZmRks5IiVdtT7YjuYcN/MMibqGV+QqWudpCusRoVN7J r5cf4v/UlOh/381LqQhLzLxmPZmenrTNwALp3rDJ7ju/rTDDGShcgc7RTz2M7QwwOx YxCJDPqhTkDLQEKTNEHtEKofYboTBlMvJsV99zUz6QESINCFUmHsgfFInqmtFsiDtf +KbobAmBDhlNg== Received: by mail-ej1-f48.google.com with SMTP id mm21so4412206ejb.12 for ; Fri, 05 Mar 2021 08:05:22 -0800 (PST) X-Gm-Message-State: AOAM531W3bQfTjG69go9cBzhnwbmGiDVeku6oplDCL5aqwyxqnzLzVg4 GRO6GkBTaTBKF4bIAHYYYtPfPAhIq3EmL1NB8A== X-Google-Smtp-Source: ABdhPJwUc4XxP2OrKgKoWP3l/xIeHgoelPjOuT9cmvaXTMfKex+qDw3goxqSBhbjX88yTcUVjAFeGozCqyLLXTE1hAc= X-Received: by 2002:a17:906:c405:: with SMTP id u5mr2843037ejz.341.1614960320807; Fri, 05 Mar 2021 08:05:20 -0800 (PST) MIME-Version: 1.0 References: <20210304213902.83903-1-marcan@marcan.st> <20210304213902.83903-13-marcan@marcan.st> In-Reply-To: From: Rob Herring Date: Fri, 5 Mar 2021 10:05:08 -0600 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: Andy Shevchenko Cc: Hector Martin , linux-arm Mailing List , Marc Zyngier , Arnd Bergmann , Olof Johansson , Krzysztof Kozlowski , Mark Kettenis , Tony Lindgren , Mohamed Mediouni , Stan Skowronek , Alexander Graf , Will Deacon , Linus Walleij , Mark Rutland , Greg Kroah-Hartman , Jonathan Corbet , Catalin Marinas , Christoph Hellwig , "David S. Miller" , devicetree , "open list:SERIAL DRIVERS" , Linux Documentation List , Linux Samsung SOC , Linux-Arch , Linux Kernel Mailing List X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210305_160527_170468_86551FAF X-CRM114-Status: GOOD ( 24.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Mar 5, 2021 at 9:13 AM Andy Shevchenko wrote: > > On Thu, Mar 4, 2021 at 11:40 PM Hector Martin wrote: > > > > This implements the 'nonposted-mmio' and 'posted-mmio' boolean > > properties. Placing these properties in a bus marks all child devices as > > requiring non-posted or posted MMIO mappings. If no such properties are > > found, the default is posted MMIO. > > > > of_mmio_is_nonposted() performs the tree walking to determine if a given > > device has requested non-posted MMIO. > > > > of_address_to_resource() uses this to set the IORESOURCE_MEM_NONPOSTED > > flag on resources that require non-posted MMIO. > > > > of_iomap() and of_io_request_and_map() then use this flag to pick the > > correct ioremap() variant. > > > > This mechanism is currently restricted to Apple ARM platforms, as an > > optimization. > > ... > > > @@ -896,7 +899,10 @@ void __iomem *of_iomap(struct device_node *np, int index) > > if (of_address_to_resource(np, index, &res)) > > return NULL; > > > > - 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 doesn't sound right. Why _np is so exceptional? Why don't we have > other flavours (it also rings a bell to my previous comment that the > flag in ioresource is not in the right place)? > > ... > > > + if (res.flags & IORESOURCE_MEM_NONPOSTED) > > + mem = ioremap_np(res.start, resource_size(&res)); > > + else > > + mem = ioremap(res.start, resource_size(&res)); > > + > > Ditto. > > ... > > > + while (node) { > > + if (!of_property_read_bool(node, "ranges")) { > > + break; > > + } else if (of_property_read_bool(node, "nonposted-mmio")) { > > + of_node_put(node); > > + return true; > > + } else if (of_property_read_bool(node, "posted-mmio")) { > > + break; > > + } > > + parent = of_get_parent(node); > > + of_node_put(node); > > + node = parent; > > + } > > I believe above can be slightly optimized. Don't we have helpers to > traverse to all parents? We don't. I only found a handful of cases mostly in arch/powerpc. Given that and this series is big enough already, I don't think we need a helper as part of it. But patches welcome. Rob _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel