Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2368375rwj; Mon, 19 Dec 2022 03:44:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXt9xNB91IJuhrTeCS6aaLZ3/F3lSLOCY7Lz/EeiuvDKV0U7SsHn5P5PyGP065unpYKQ61ph X-Received: by 2002:a05:6a20:b059:b0:ac:21c3:2fb7 with SMTP id dx25-20020a056a20b05900b000ac21c32fb7mr8931416pzb.6.1671450258675; Mon, 19 Dec 2022 03:44:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671450258; cv=none; d=google.com; s=arc-20160816; b=Hvq9UoeLGzCgzKyXBAHTjRJxTF8llr98UWW5Z29rd5fOm5G8ZN+WVa/jtPGKTGy/Id lXxhTeRi5A0MjLYOEZTx+JT0pGyp/94vEM1qnuK0COk/1JT6uw1hh7coVg4GttPPZCgf TKnnx7LPbxo8GGGc4m/rPmzOBQcoUHSiZt7Mqf74Z6GlhjjXwqfGOjJxPF9w4GdvAJdg RCyfCshA+n7l8xBTXg2ruOGVTeQ2X+WkwBQCnDOVynsw6LW2cPJsZ20HNqV0TtdIQx7H sQGeAn1tFAD0tPYbZH59JPT91NpWgiFQVzaUI87gc3QxHb1t7WrHFsGRGDOVhA4PV+jA LepA== 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=zI2RTlOmL5oiwdZqJNw/D+P+a1vxFWJZ9IKVgLH4ir4=; b=GxyZSblz2IvQi1gRefTN6XiK94Mi/oVbPUMFN4Z7ehiimnVFfcBKduN8shGGgOZXwQ o37wCRIESfZSIDhDKYExf3wJWoqxaaDar+/DAJL5A4xIYJt8U53TVZJK2mhZhWpOOr+8 CXKoP1dQh9ZfM/piWTDmKOqg/8/i9MQ7goDmp+T103L7baZxc4q8vavK9oynmEv/ulqs IihGZUhRPzeXxBiwPda9l7ZQw91PIidOPTr1CzkmALUwjShtb0VBaCBWZ4bKaR6OkmFt KFwENCu2YSyMOwOvNyGt35x9kmA5f2MsmdUBdTbLfFfuFdwzkSKBMKW7x6i+ZGsimWWW rpFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bST3w1n2; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s73-20020a632c4c000000b00477bac45499si10209340pgs.75.2022.12.19.03.44.09; Mon, 19 Dec 2022 03:44:18 -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=@gmail.com header.s=20210112 header.b=bST3w1n2; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231927AbiLSLTp (ORCPT + 70 others); Mon, 19 Dec 2022 06:19:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231301AbiLSLTm (ORCPT ); Mon, 19 Dec 2022 06:19:42 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 843D92672; Mon, 19 Dec 2022 03:19:41 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id m18so20666013eji.5; Mon, 19 Dec 2022 03:19:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zI2RTlOmL5oiwdZqJNw/D+P+a1vxFWJZ9IKVgLH4ir4=; b=bST3w1n2l4lGbm29FxqMPyB7CEznBrQmws+cKHNPXfRBzJ+B5JlTr/56pIFpsc+yIA zeNLk1+vrvu60Nhfp9Fy2Ml2kxQg2+iWzFRo+uX8PssZJHOiZdLvCAh615JUYhRB8Bxh 6eo3UDkzllFuwTe0G5oyISg+stHLjrMRDlop3bn1PQyKZS9+ctlNDK7JX874Q5IBUI/W rzuOr8ZWXrXomg9s/yLd33dwiu7k2FSlsFEqNyOQE4RUZFjvcQaILIDbOejJS10SEGiT 3RO/FaO9t2nn+C6l7VGFHO5VtmAMkHZJMN5/tICm1rcsQLU6Bc8DoDkeuIvKgfKRpdiA zX4w== 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=zI2RTlOmL5oiwdZqJNw/D+P+a1vxFWJZ9IKVgLH4ir4=; b=AjP/y7nSby3cCs7nD3oJHiWYGyJfN4QzX4sSavGUm0vZYkFuiqmG7+v/j4w0djzdBv VIqoTdxKguoa8YFTLxAq0iwNsmyKinE9HiFAbTICxqxH25905ER7NDhhaHtpv7fAN7h+ aXB/t5HEm9TZLyAzYbTEA85f3nUk6kt7g4Pe55mZ01EtZSGClFH+XguHKAgol+xWrkBG gw1K9HOGdIp9R3GdHjzKiTvYs32XYqiv6J3xjDZpOM6gj+47JcUtI4J/SjTbRWzgng4T 5D0036+FFGAi2JIjn91BX9oGwKW7WyTV7KzWtS/6sqYhU61P6CW+pNiqB8eepCTzZNXt p95w== X-Gm-Message-State: ANoB5pms4qlepdd/5ddgPinh2a4n2Xd5yQY/b5CEQbEUQNyJHbzS2nWH p3++HyVYn8sB8O0aT2jigKRmsc6DE2FwyECrENw= X-Received: by 2002:a17:906:79c4:b0:778:e3e2:8311 with SMTP id m4-20020a17090679c400b00778e3e28311mr72229403ejo.342.1671448779945; Mon, 19 Dec 2022 03:19:39 -0800 (PST) MIME-Version: 1.0 References: <20221212115505.36770-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221212115505.36770-4-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: "Lad, Prabhakar" Date: Mon, 19 Dec 2022 11:19:13 +0000 Message-ID: Subject: Re: [PATCH v5 3/6] riscv: errata: Add Andes alternative ports To: Conor Dooley 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 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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Hi Conor, Thank you for the review. 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 external > > 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 cmo? > > > > 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 cores. > > + > > + 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) += andes/ > > obj-$(CONFIG_ERRATA_SIFIVE) += sifive/ > > obj-$(CONFIG_ERRATA_THEAD) += thead/ > > diff --git a/arch/riscv/errata/andes/Makefile b/arch/riscv/errata/andes/Makefile > > new file mode 100644 > > index 000000000000..2d644e19caef > > --- /dev/null > > +++ b/arch/riscv/errata/andes/Makefile > > @@ -0,0 +1 @@ > > +obj-y += errata.o > > diff --git a/arch/riscv/errata/andes/errata.c b/arch/riscv/errata/andes/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 = 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. 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. Cheers, Prabhakar