Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp469227rwi; Thu, 20 Oct 2022 00:45:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZVG6cUFdjr+37v83dHSynAko+0dcRP6GTC/ZVWCAPfO2t+qEtxWJXZo+YNHqS7kqE/lg0 X-Received: by 2002:a17:902:d588:b0:180:cf18:e76c with SMTP id k8-20020a170902d58800b00180cf18e76cmr12534816plh.138.1666251935431; Thu, 20 Oct 2022 00:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666251935; cv=none; d=google.com; s=arc-20160816; b=n8C4Qe73jb4cS4tRbufWpkj39h/w7gM+zRQA18uhztd3CmvE/BU4ElQYy50gAlL/by +s5Y6+6VDn46GGc5t5V8LA0C7IbLLUzN85fqnWQCy1y5NfyKj2BvyQpfTwEZTqE7z21X VJ8jGKLsp/p0+gSzPe7InQ7HZOWbXxvcfB5wUo6utV59kuCr7U5TUGy7KHitMjROK3CK tr9yXXYOKnIrWn9ookKsqF7admz2G90rKVtXR5FUaF5SOSbTgYWc/zY+cZqnaGue7kh2 yfklNpp5RWsLeqt6JVJkdihvt625lOqyQVXzSyBCqajMAY4pLQdgi5TeqCXefrR/K/lF 4qFQ== 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=WXSAoATQCgV1tkrtFlfAwHc5TCrnlZk59AbU4gXCz/M=; b=m1FLXCbFDCZXM9BGHWjeKWJktkekxXm/scxpY4rkRKD+Wgnt2ba35RXu38N8QUWLIn dQfiPqdr9UVBQLla1aL15+IZB6FS5r4gO39cEcNlh/5rP61d56UaWpqULAX2eHVDppL+ aITu0XlOZ2N6zQTq2Syxw04b9LRcD39gE0Fm1CkwMr/o7+7Muw56q6Qhh0cXw3Rj6rgV TcQkCoRh0xWlq9b26zslY1Dw32269vuQm5j7gaZVOyBLjTi3CIcAIDAjxq0s5pyOy18D kk4G3v/5G0rED0ulP88P76Rb5rpDJyAdkr0gA4wgGRuCuMmkuvTOxdJaRtcawHS9xoL6 kqUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="IQfGk/Qy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a28-20020a62d41c000000b0052edbdb0910si18534071pfh.128.2022.10.20.00.45.08; Thu, 20 Oct 2022 00:45:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="IQfGk/Qy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230426AbiJTHj2 (ORCPT + 99 others); Thu, 20 Oct 2022 03:39:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbiJTHjI (ORCPT ); Thu, 20 Oct 2022 03:39:08 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B947D175341 for ; Thu, 20 Oct 2022 00:39:07 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id g1so32071564lfu.12 for ; Thu, 20 Oct 2022 00:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=WXSAoATQCgV1tkrtFlfAwHc5TCrnlZk59AbU4gXCz/M=; b=IQfGk/QydWspEikjitqgDAHA8Z7JztQjBAYZGBr5InCIRR+Vu2vkQ17YbWK5o0slwI siwCWxTauWfOZqnJV6vguVBXJtdXU5ztDjEJFaJUGHIzWKa8B/sVSlrfkxV0lXa0uMKl 6LO6jj/easqGTbyTkqFUKFRRqybL3jPvYHm3Mfm8wG9SQZe3K1MdJCjdwlNKhqWdFDrq zDiVYpViBJ8Po8lHQ6LPiGiIN1VFFl6Z8iAZ5JLjLyWY6iiCwL7M3/+5lJZvGa0rEwID eWUyLNce+YmQ20G+1Y6pZiHwPk6vEnPlZjw5szzgrySZrVn+JM+F34UKijg6Fiw4hyUx bm8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WXSAoATQCgV1tkrtFlfAwHc5TCrnlZk59AbU4gXCz/M=; b=Pmo76uz7U/Xy5W2W+KszteLpXy/v4+GHW3te7tqYUF2Z9hWrW4V+gEEebE2DotPONu XZhshsgtl1rP4lUr3O0AMxl6CekJ4sS0xkZOuwtPhTNGiK20mbWg0EHy0HfHhFu/hgTI JmRqHqGcwhncjX9xmRoUfCV7ZjKGYUCeNyIEaXZhdNfoGx4z8NJAvLUsm7le0D351B3l +wcnXlm4a6xHfYybQ8tbg+aqku0nwUgSd38R7/L0kvwC/W2sOIbciSH7/ml4d13uH+vZ LwR7EVRUXDXbFE+RtWAmqbM49N9jG4ra/iwjDzyvws+jqvLSkm64y5IjlMc6sz3MmFT7 evOg== X-Gm-Message-State: ACrzQf2/FW8xZa8OfxypzJ/7EPogy3fesc+GichWjtShvycXZiWBd+PZ Lei2cjQHF8Ix3YHiDAUPwYhlsZhZjW4JXslZwSw/jA== X-Received: by 2002:ac2:5616:0:b0:4a2:61f6:85e9 with SMTP id v22-20020ac25616000000b004a261f685e9mr4072003lfd.419.1666251545918; Thu, 20 Oct 2022 00:39:05 -0700 (PDT) MIME-Version: 1.0 References: <20221019131128.237026-1-apatel@ventanamicro.com> <20221019131128.237026-3-apatel@ventanamicro.com> <13122510.uLZWGnKmhe@phil> <20bfd8a3-3836-46b8-9fdd-a407973224ba@app.fastmail.com> In-Reply-To: <20bfd8a3-3836-46b8-9fdd-a407973224ba@app.fastmail.com> From: Anup Patel Date: Thu, 20 Oct 2022 13:08:54 +0530 Message-ID: Subject: Re: [PATCH v4 2/4] RISC-V: Fix ioremap_cache() and ioremap_wc() for systems with Svpbmt To: Arnd Bergmann Cc: =?UTF-8?Q?Heiko_St=C3=BCbner?= , Palmer Dabbelt , Paul Walmsley , Atish Patra , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Mayuresh Chitale Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 20, 2022 at 2:20 AM Arnd Bergmann wrote: > > On Wed, Oct 19, 2022, at 18:10, Anup Patel wrote: > > On Wed, Oct 19, 2022 at 7:49 PM Heiko Stuebner wrote: > >> > >> Am Mittwoch, 19. Oktober 2022, 15:11:26 CEST schrieb Anup Patel: > >> > Currently, all flavors of ioremap_xyz() function maps to the generic > >> > ioremap() which means any ioremap_xyz() call will always map the > >> > target memory as IO using _PAGE_IOREMAP page attributes. This breaks > >> > ioremap_cache() and ioremap_wc() on systems with Svpbmt because memory > >> > remapped using ioremap_cache() and ioremap_wc() will use _PAGE_IOREMAP > >> > page attributes. > >> > > >> > To address above (just like other architectures), we implement RISC-V > >> > specific ioremap_cache() and ioremap_wc() which maps memory using page > >> > attributes as defined by the Svpbmt specification. > >> > > >> > Fixes: ff689fd21cb1 ("riscv: add RISC-V Svpbmt extension support") > >> > Co-developed-by: Mayuresh Chitale > >> > Signed-off-by: Mayuresh Chitale > >> > Signed-off-by: Anup Patel > >> > >> Wasn't there discussion around those functions in general in v2? > > > > Yes, there was discussion about a few drivers using ioremap_xyz() > > which is discouraged and drivers should use memremap(). > > > > We still need the arch specific ioremap_xyz() functions/macros > > added by this patch because these are required by the generic > > kernel memremap() implementation (refer, kernel/iomem.c). > > There is a difference between the strongly discouraged > ioremap_cache() that pretty much has no valid users, and > the ioremap_wt/ioremap_wc functions that are sometimes used > for mapping video framebuffer or similar. > > It should be sufficient to provide a arch_memremap_wb() > and no ioremap_cache() to make memremap() work correctly. > Okay, I will simplify this patch to only implement arch_memremap_wb(). This will make the MEMREMAP_WB flag to work correctly but other MEMREMAP_xyz flags will always use non-cacheable IO mappings. Regards, Anup