Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1713463rwi; Wed, 19 Oct 2022 14:30:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5TEZ9OT5SWygeTQaxZvZ21gPGQhrcy7DDtejC9ux/VHnhzpVLmotIUhH+9Ggo9KLaihOsR X-Received: by 2002:a17:907:7d8d:b0:78d:d467:dd3 with SMTP id oz13-20020a1709077d8d00b0078dd4670dd3mr8449744ejc.547.1666215000401; Wed, 19 Oct 2022 14:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666215000; cv=none; d=google.com; s=arc-20160816; b=MXEb92bxKNFn2hjyAhfajOtkYGdbUggUeIFr08AttPJB8uP5eiWDQFtP/06hEDUiA9 5v9KKKdOSJKZ+A9sLKtPkGYFqsN09qfxkDcu6z9V7STh6EPZb5ZPpKM/6Muv+flYu2+V w6VizVUwEfX88xobBXHwKeJN1yLDuSCgkBkfe89Sq12F8dFAvBhe8F8xQ/Hn6A5o6PMb 6pB7x8XHQpO/SQcMyRBwTQr20hLETxG3wDpSmPrtK9PTO05pFG4SwKdb3IblaBZu3gHO +GrS9DfieocopWLuNIhYAvcf1cjhvKecD1DMWXmlLAaC+3wmd0AhxC/tDuhyln51Aelf 5ZTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=v02lubHCvUgrTExgVSjs3iH2RzBOzg6UGAwCAUxRqJs=; b=LECo1C/ZhLfyq392OYqzZZvs2Ub+X5yh0U4tuztq0uL8DIZnldzGTl/I9XyAjxu9gZ 7NzuVchnRWPB2O5/kMMGVquzdrYZVsx9aK1Sq84F/4epXMs3T7PzZvAqJIbNhWVDXD99 y4Ji44+unDDylu1zCHaPVzAHH9RwyhQ7EyauhO+fKDLh3n/4PrrGPNQBOYjUPPbgxTHF GJ40WOXR73mk+h52mX1gxIWwNegaNJLWdFVgrcLUjFB1WSWOH0skT4DuS7VYQC50WeT1 zthRyoFp3TAo8ytIp7nv0TcCPWs60F5S2/vvppoQR5eKgaPp1CQbs9RbEYlCZQxSxQyl d1rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=p+cXu8MH; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=fBfc4hIN; 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 ds1-20020a170907724100b0078e11a20640si14439683ejc.2.2022.10.19.14.29.34; Wed, 19 Oct 2022 14:30:00 -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=@arndb.de header.s=fm2 header.b=p+cXu8MH; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=fBfc4hIN; 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 S231517AbiJSUuo (ORCPT + 99 others); Wed, 19 Oct 2022 16:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbiJSUum (ORCPT ); Wed, 19 Oct 2022 16:50:42 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A62F460E1 for ; Wed, 19 Oct 2022 13:50:40 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id EC0205C0172; Wed, 19 Oct 2022 16:50:39 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute3.internal (MEProxy); Wed, 19 Oct 2022 16:50:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1666212639; x=1666299039; bh=v02lubHCvU grTExgVSjs3iH2RzBOzg6UGAwCAUxRqJs=; b=p+cXu8MHpC/7DVe6y2ZZOtdDZ4 6vcC+B2jqcssDTzCgTy4HA9px5ybTkZMumK8lXTP07c7Jcyf1sxTxbHt8lVLQgr5 6MhBedMX82hqPVH5mvzXOJo8WFPX/BiyaugJBkCOuvv4ReGTt9Wy99VLs5xg69b1 lCOh1YzZk76S5l+XW2gY/sngygZSxm0vWUPdUGFZbht4CPWUA8u4mflrm0vHnbdr UwvNPcrx8ofelLR67T4ktGvkKzzNytoNH6LSCG+UXwfsR3ODFu59vgbThING85F9 KoMn9DW7n/39pyvU1nakVA5pqLplFldksUURTzX/zOvcWVlqGbn7VU9jdHvA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1666212639; x=1666299039; bh=v02lubHCvUgrTExgVSjs3iH2RzBO zg6UGAwCAUxRqJs=; b=fBfc4hINCDwv8+Dz/eU06bQw5+UKsrsNfcS9NvHAzjlA RpI6F0a39UjCXWMwYqDIAVU49L1iiaQEIJcDaOGPYhnXZen+klLzswT2tx25wgm2 3GEkbUym7MNR19Ty0dKQWx8pHVWvtnD3eMxVARBqgVkyzfQTNW9/N8ypswrVkgeS hBRI418ZpGCxbBtRDUeQpTYmVJEMxZlQItEOjjxKlcofNK/De+ogqjJZQ18s3OJz peAP7h5RnXP/ocnAgIsxT+aX2s78h5/QAxEkBRxD0NEaOIZuRRoclMl7aN2vh9wQ HRLdPakTIjrZj2VqtbUZbgdhyaCsSgrpmkkCZHDwfw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeelgedgudehgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedt keetffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 18CACB60086; Wed, 19 Oct 2022 16:50:38 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1047-g9e4af4ada4-fm-20221005.001-g9e4af4ad Mime-Version: 1.0 Message-Id: <20bfd8a3-3836-46b8-9fdd-a407973224ba@app.fastmail.com> In-Reply-To: References: <20221019131128.237026-1-apatel@ventanamicro.com> <20221019131128.237026-3-apatel@ventanamicro.com> <13122510.uLZWGnKmhe@phil> Date: Wed, 19 Oct 2022 22:50:17 +0200 From: "Arnd Bergmann" To: "Anup Patel" , =?UTF-8?Q?Heiko_St=C3=BCbner?= Cc: "Palmer Dabbelt" , "Paul Walmsley" , "Atish Patra" , "Anup Patel" , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, "Mayuresh Chitale" Subject: Re: [PATCH v4 2/4] RISC-V: Fix ioremap_cache() and ioremap_wc() for systems with Svpbmt Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS 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 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. Arnd