Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2805989rwj; Mon, 19 Dec 2022 09:02:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf5fPdSGW6xWgOGAM7TjvJetrFSdrZpJK2gMIXaAepTArldffAg4QeLem0UBI+wH/N2kTEoN X-Received: by 2002:a17:907:9144:b0:7c0:e6d8:7770 with SMTP id l4-20020a170907914400b007c0e6d87770mr15139216ejs.74.1671469375325; Mon, 19 Dec 2022 09:02:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671469375; cv=none; d=google.com; s=arc-20160816; b=SE7A5lhcYtLthppMb/S698PHqFO6kpZykqFKJR9qAJpkGYHGDNnYPGEk7vfofv8c0m MgYv3p8HAwMv4HpeTVoxbGIyOpAGxLLn68p4mdYCU+vSgdNdXEXuu7wkLiaF7ewdK+iS ivLVHpezB+2gAMKHjwRMuGmsiFkJHjxgYIIW4DsxXdHiMEWKB9Fx6gbEwt8GjkiK3pq/ OIEzSb4S1EDlnLkpisHh8YHXShUmMTq6dvfO3LulLbdnIiDQLQMFgpUolguzLxGz1bKo CMZvBlT1qfDS6N2AZluMqbcHZSl7ovLnToCXUnEuE+W/Khu6XQjeWjnu/UHb7WFWL5Ya opQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eVqDeL7RSBS5ouY4Mtqc+dksB8jqq85iqWa+EW9nkFQ=; b=0e5A6Px76sx8zgDakiDok3/M1ENvVXTZy8VFVI4pAZsyYXMa1/5d6HhWYo6asjvzdn oZ1THHeFJYFRl+Z2J5VE0A+Ta0KtXBnW+BpI62XxntWbFb686TQvythrxpLF4EObC+fQ RR0rWo0X45PqnsfCVIGl/HdXN6Pv4fpJs3iLnlhngmuHQVHgZKzIpMuu2Mi9Zt2Or1pz wAhjJuWo7VXLfCV9sq7RVR7sUdxbSUqsIc5FGlAeNzXGU7Jn4jX/iios+15MoXiGNuIb ZI/tNuCkkEHNipLP8RyQMqB582OG1kpTOW4yGB0hEtfMpsm08l+fSwGfgidiQmfIA4QK Dy2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lCj9bDit; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds22-20020a170907725600b0078d770f363fsi9594057ejc.471.2022.12.19.09.02.37; Mon, 19 Dec 2022 09:02:55 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=lCj9bDit; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231991AbiLSQUe (ORCPT + 70 others); Mon, 19 Dec 2022 11:20:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231878AbiLSQU1 (ORCPT ); Mon, 19 Dec 2022 11:20:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E22FBCC2; Mon, 19 Dec 2022 08:20:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5ED9860ECA; Mon, 19 Dec 2022 16:20:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D6E8C433F2; Mon, 19 Dec 2022 16:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671466824; bh=TCDRHXSCue+6gNvdNI3YHH1hpd/QB4Bg6cEJ8MRAxS8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lCj9bDituBOnf8/UyeCcmKZTTL3vt3syeJvtt+7cUyKhRqhOKkRfiC0KvgxKwglYw NJkdgeyDbZ/k6YOWa8oISFpyghnrPfbEFqYKjXo7bc0k1yT9WJZ9IVt462XfQvkBOW pJbgMJMHdKOweN9bKa7kWy5uerXAAPmTbO8zcBQlUNTKgPVH7E9V65k6KiLbZC2FIb YFKvX4s6oCKXU8xD57RlS0SWDffbQcLLlu34vSqfB715tTVY0siFFC27JNoitx3x9i 9QVXSs138Yh6HGy9OkZobqE9lJ18BMgDX/ObiO3NOrXwb3+G/wZeDLeAgtVRc7Kdv0 RKU6qyhLfEvGQ== Date: Mon, 19 Dec 2022 16:20:17 +0000 From: Conor Dooley To: "Lad, Prabhakar" Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Geert Uytterhoeven , Magnus Damm , Heiko Stuebner , Conor Dooley , Samuel Holland , Guo Ren , Rob Herring , Krzysztof Kozlowski , Jisheng Zhang , Atish Patra , Anup Patel , Andrew Jones , Nathan Chancellor , Philipp Tomsich , devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Biju Das , Lad Prabhakar Subject: Re: [PATCH v5 3/6] riscv: errata: Add Andes alternative ports Message-ID: References: <20221212115505.36770-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221212115505.36770-4-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a/Wc8u+smEWp2mxo" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 --a/Wc8u+smEWp2mxo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 19, 2022 at 11:19:13AM +0000, Lad, Prabhakar wrote: > Hi Conor, >=20 > Thank you for the review. >=20 > On Sat, Dec 17, 2022 at 9:19 PM Conor Dooley wrote: > > > > On Mon, Dec 12, 2022 at 11:55:02AM +0000, Prabhakar wrote: > > > From: Lad Prabhakar > > > > > > Add required ports of the Alternative scheme for Andes CPU cores. > > > > > > I/O Coherence Port (IOCP) provides an AXI interface for connecting ex= ternal > > > non-caching masters, such as DMA controllers. IOCP is a specification > > > option and is disabled on the Renesas RZ/Five SoC due to this reason = cache > > > management needs a software workaround. > > > > > > Signed-off-by: Lad Prabhakar > > > --- > > > v4 -> v5 > > > * Sorted the Kconfig/Makefile/Switch based on Core name > > > * Added a comments > > > * Introduced RZFIVE_SBI_EXT_IOCP_SW_WORKAROUND SBI EXT ID to check if > > > CMO needs to be applied. Is there a way we can access the DTB while= patching > > > as we can drop this SBI EXT ID and add a DT property instead for cm= o? > > > > > > RFC v3 -> v4 > > > * New patch > > > --- > > > arch/riscv/Kconfig.erratas | 22 +++++++ > > > arch/riscv/errata/Makefile | 1 + > > > arch/riscv/errata/andes/Makefile | 1 + > > > arch/riscv/errata/andes/errata.c | 93 ++++++++++++++++++++++++++= ++ > > > arch/riscv/include/asm/alternative.h | 3 + > > > arch/riscv/include/asm/errata_list.h | 5 ++ > > > arch/riscv/kernel/alternative.c | 5 ++ > > > 7 files changed, 130 insertions(+) > > > create mode 100644 arch/riscv/errata/andes/Makefile > > > create mode 100644 arch/riscv/errata/andes/errata.c > > > > > > diff --git a/arch/riscv/Kconfig.erratas b/arch/riscv/Kconfig.erratas > > > index 69621ae6d647..f0f0c1abd52b 100644 > > > --- a/arch/riscv/Kconfig.erratas > > > +++ b/arch/riscv/Kconfig.erratas > > > @@ -1,5 +1,27 @@ > > > menu "CPU errata selection" > > > > > > +config ERRATA_ANDES > > > + bool "Andes AX45MP errata" > > > + depends on !XIP_KERNEL > > > + select RISCV_ALTERNATIVE > > > + help > > > + All Andes errata Kconfig depend on this Kconfig. Disabling > > > + this Kconfig will disable all Andes errata. Please say "Y" > > > + here if your platform uses Andes CPU cores. > > > + > > > + Otherwise, please say "N" here to avoid unnecessary overhead. > > > + > > > +config ERRATA_ANDES_CMO > > > + bool "Apply Andes cache management errata" > > > + depends on ERRATA_ANDES && MMU && ARCH_R9A07G043 > > > + select RISCV_DMA_NONCOHERENT > > > + default y > > > + help > > > + This will apply the cache management errata to handle the > > > + non-standard handling on non-coherent operations on Andes cor= es. > > > + > > > + If you don't know what to do here, say "Y". > > > + > > > config ERRATA_SIFIVE > > > bool "SiFive errata" > > > depends on !XIP_KERNEL > > > diff --git a/arch/riscv/errata/Makefile b/arch/riscv/errata/Makefile > > > index a1055965fbee..6f1c693af92d 100644 > > > --- a/arch/riscv/errata/Makefile > > > +++ b/arch/riscv/errata/Makefile > > > @@ -1,2 +1,3 @@ > > > +obj-$(CONFIG_ERRATA_ANDES) +=3D andes/ > > > obj-$(CONFIG_ERRATA_SIFIVE) +=3D sifive/ > > > obj-$(CONFIG_ERRATA_THEAD) +=3D thead/ > > > diff --git a/arch/riscv/errata/andes/Makefile b/arch/riscv/errata/and= es/Makefile > > > new file mode 100644 > > > index 000000000000..2d644e19caef > > > --- /dev/null > > > +++ b/arch/riscv/errata/andes/Makefile > > > @@ -0,0 +1 @@ > > > +obj-y +=3D errata.o > > > diff --git a/arch/riscv/errata/andes/errata.c b/arch/riscv/errata/and= es/errata.c > > > new file mode 100644 > > > index 000000000000..3d04f15df8d5 > > > --- /dev/null > > > +++ b/arch/riscv/errata/andes/errata.c > > > @@ -0,0 +1,93 @@ > > > +// SPDX-License-Identifier: GPL-2.0-only > > > +/* > > > + * Erratas to be applied for Andes CPU cores > > > + * > > > + * Copyright (C) 2022 Renesas Electronics Corporation. > > > + * > > > + * Author: Lad Prabhakar > > > + */ > > > + > > > +#include > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#define ANDESTECH_AX45MP_MARCHID 0x8000000000008a45UL > > > +#define ANDESTECH_AX45MP_MIMPID 0x500UL > > > +#define ANDESTECH_SBI_EXT_ANDES 0x0900031E > > > + > > > +#define RZFIVE_SBI_EXT_IOCP_SW_WORKAROUND 0 > > > + > > > +static long ax45mp_iocp_sw_workaround(void) > > > +{ > > > + struct sbiret ret; > > > + > > > + ret =3D sbi_ecall(ANDESTECH_SBI_EXT_ANDES, RZFIVE_SBI_EXT_IOCP_= SW_WORKAROUND, > > > + 0, 0, 0, 0, 0, 0); > > > > Seeing as you need a new version for some of the other bits, I think it > > would be good to add a minor comment here somewhere (be it here or the > > commit message) that links to the SBI specs for this. > > I think this looks pretty good though. > Sure I'll add a comment here. >=20 > I was wondering if we can get rid of this vendor specific extension > here if we get access to the DT here (for example having a DT property > which would indicate if IOCP CMO should be applied or not). Do you > think that would be good approach? ATM we dont have a pointer here > for FDT whie early patching. I dunno. I think it is fine to use the ECALL to be honest - I'd rather that than a property that someone may omit. That said, for the cache management stuff we are gonna need for PolarFire SoC, we will need to have info from the DT AFAICT - marchid etc are all set to zero on our platform so cannot be used. I was thinking about using the compatible instead, but... we've not tried to "forward"-port our stuff from 5.15 yet as we have not yet completed testing testing on our vendor tree (and need some PCI changes accepted upstream first anyway), as a result I have not looked into what's needed there for use with alternatives. We've been using a pre-alternatives version of that patchset from around the 5.15 development point in time instead. Thanks, Conor. --a/Wc8u+smEWp2mxo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCY6CPQQAKCRB4tDGHoIJi 0lZ9AQCOYZeG/oRfDujddYGIWFAf2ZJf64Ns/lFe7GdcCKveKwEArKQAQZukjH2r 31D53uaNNDyHGMmKJVq7A7fFO+yeSg4= =s444 -----END PGP SIGNATURE----- --a/Wc8u+smEWp2mxo--