Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5694929rwr; Mon, 1 May 2023 09:24:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67pzO7kXuMxbuT/HwgjFdGBnW6pYpBGCOjIJ/4ullAmsvBtKVMQetk4AVSrGfrKAMI5ejJ X-Received: by 2002:a17:903:22cb:b0:1ab:675:3e31 with SMTP id y11-20020a17090322cb00b001ab06753e31mr339235plg.37.1682958241531; Mon, 01 May 2023 09:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682958241; cv=none; d=google.com; s=arc-20160816; b=q2nnHAfXyBdmhHBURUkV3NW6wvJU4bWHjE7hUWP0EZipBJqVX5NwovV+exhsdz3U/h RHPFOmOmOTcHBE5lwPOR+V4cuBd07zQdrxm1fypzvr8dQPUD//WHdnpy95Py3p2tlz+Y bvdWTGnqYIrA0bbbkDDp84E7XS2TP9+x4m709XtlE5NUvOTSPG93odt5L7z01iyGZxii R2l3nV3LCx7ZKy5E5MKjaCDyt7kbFwrevFn7t2+8BWHsvrjWkrJxuXOM+AF5Qr/ZP31A ildcoevqrbqTSdx/GpMj1s/fQbUMUll69XthjugF/PzzvjCnZL5oQu7whrUq5IEL9MBO yOkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date :subject:cc:to:from:message-id:dkim-signature; bh=1i4fXVrCHwEHcOBQq4Knw1AJdDT/VSryujsH07IAoqQ=; b=kIKMoa3rapoQ52cvmVX7CSh9R/vmdPmwydtsUerKpjK6fLmV8VUPMkVBHJTJ2x5JRp 3S4SAB1tjgrijcblaHBdqL12kLMI8IQry/3MR3zsxV1OZu1UwvYBGHHtt8L9rsPZy9SQ jY8YoDaKZkxrctzBQPaxZP11T5eOPszotoS7/4dtjOIh7HTCibq1WMEqWDRllaoVp6vy ISnkLmDr9Ih3OaeDQpMw74kDjW6Zxt774WvJNWfDCULb6CFlV7aD3QHysJZLkwew4gX3 AW3GcNRTZtanYFeI7Gd1NkIlsgqo8qDHCh/eSG/IOwCJgX8BcTvGIvyD8gjfsq5oPQ5g aBfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=UKWQ+b24; 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 d22-20020a170902aa9600b001a6709378c0si27132572plr.333.2023.05.01.09.22.53; Mon, 01 May 2023 09:24:01 -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=@qq.com header.s=s201512 header.b=UKWQ+b24; 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 S232911AbjEAQLV (ORCPT + 99 others); Mon, 1 May 2023 12:11:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231229AbjEAQLT (ORCPT ); Mon, 1 May 2023 12:11:19 -0400 Received: from out162-62-57-87.mail.qq.com (out162-62-57-87.mail.qq.com [162.62.57.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE74C3 for ; Mon, 1 May 2023 09:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1682957470; bh=1i4fXVrCHwEHcOBQq4Knw1AJdDT/VSryujsH07IAoqQ=; h=From:To:Cc:Subject:Date; b=UKWQ+b24CF1iBZ3hJK3myiF0teCi6Jguw8dv3SscxNb1iFZOCJ9/rwZWV3MGL02bl fu0yKdL/jr6cDEThMX3f4KjNKx8QepT3R2yw5+JUr+7IxT0YFiuaXYAjW02MYcSnLg oGQem488C5exnnz9u6lzgr0Om/yMVjGFW51RcV50= Received: from cyy-pc.lan ([2001:da8:c800:d084:c65a:644a:13d7:e72c]) by newxmesmtplogicsvrsza10-0.qq.com (NewEsmtp) with SMTP id 2C5BE6A6; Tue, 02 May 2023 00:11:05 +0800 X-QQ-mid: xmsmtpt1682957465tbh88bn4e Message-ID: X-QQ-XMAILINFO: MB5+LsFw85NoN+Knf0Ay9A4a08OjqZU83GADjlLKdSN2QEjLhjRhG9wBVAS++z C+5NxI/l8K4j+Gz5TyWv5BkO6CB0IZa4OJD5mwLzE3CxzDGWkb9ZYorgLjeoP7eM3f7B3BN2sk1H UMLr5AdjEZ/T4ao4ChX4o8MN7JPo6NIVgHr1d8u9HaSLc64yfYZzCb5dwvn9O1itdWiMbH/s36Pe 6NKME10is6Z4mpZuAL+w8zmB26HlIS4p9+OBMHmY6FeA84B7v6Ez7TUi/XUYBjfioHcvJOYkO671 uJPoE8QNzqPHJA+SG+6PdX4T8fpQlK8dMNifJASiL9Is0ZK3mo6OoR2vxoMWz8Tt1Cx8FfKx5Fff 764EMdkhh5inrFGm/+zg7UpjADs+DAFxVV5U1IHrX9eDg8SumBMvj+q28xnnWUNDFwUHzymUb2sI bbNBawlLhh3ZkPbYbWr//rWZT4pjr0ohQzQUDhHt93xELgEY7S9kkx1G57USJQLGWHxcapR2Z5Yv rcBMJta5gbc07yYQ+2WRJUITbCjxtDz1FgyAK+EfvgpBYpSSOSZ/D9rdQT3MmKOeVH/Qpbk608zQ aYXHIrzqckeSCniOUhEOMLOJ3+9Bb816DoJQpgt0M/pO49CAxopXmoTNElss3INWSS1earQIF2qM G03ddTFSL/0RTZ7AGsygnrfj3aWJ4nCfg+7i/i2spyUq016gQysCWfSbsX12d6Ly6W6Yi49XyQEq BiGe2NWqv24foTI5T/NFQBYZQBl4uuRBSI0VedpO+7DAg73APEnqCXhmQu4fGp3fIQkfWEq1aK0K 5FCMelPOb2GSIpaFbl/Ibcloic6AGZJ21QNGKgVVqWow719bDHd/7qveSmbFvqFvVwg/wMsExu8X 54Xnp63uQ4lbsQfrgiKgPhb9ZwMXDpP1KA2hYCkQ+zFkkdG/+EHrzVhKcqPJQSMLQV6+AEE9Do/U W7Q52QzxAdTJYIPQ5on3+sBSwl1Z9lcEtW7WuCZFdpbkuLrTvQdymsFQH0p3KA From: Yangyu Chen To: Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Jones , Wende Tan , Soha Jin , Hongren Zheng , Yangyu Chen Subject: [PATCH v3 0/2] riscv: allow case-insensitive ISA string parsing Date: Tue, 2 May 2023 00:10:19 +0800 X-OQ-MSGID: <20230501161019.150419-1-cyy@cyyself.name> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HELO_DYNAMIC_IPADDR,RCVD_IN_DNSWL_NONE,RDNS_DYNAMIC, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 This patchset allows case-insensitive ISA string parsing, which is needed in the ACPI environment. As the RISC-V Hart Capabilities Table (RHCT) description in UEFI Forum ECR[1] shows the format of the ISA string is defined in the RISC-V unprivileged specification[2]. However, the RISC-V unprivileged specification defines the ISA naming strings are case-insensitive while the current ISA string parser in the kernel only accepts lowercase letters. In this case, the kernel should allow case-insensitive ISA string parsing. Moreover, this reason has been discussed in Conor's patch[3]. And I have also checked the current ISA string parsing in the recent ACPI support patch[4] will also call `riscv_fill_hwcap` function as DT we use now. The original motivation for my patch v1[5] is that some SoC generators will provide generated DT with illegal ISA string in dt-binding such as rocket-chip, which will even cause kernel panic in some cases as I mentioned in v1[5]. Now, the rocket-chip has been fixed in PR #3333[6]. However, when using some specific version of rocket-chip with illegal ISA string in DT, this patchset will also work for parsing uppercase letters correctly in DT, thus will have better compatibility. In summary, this patch not only works for case-insensitive ISA string parsing to meet the requirements in ECR[1] but also can be a workaround for some specific versions of rocket-chip. [1] https://drive.google.com/file/d/1nP3nFiH4jkPMp6COOxP6123DCZKR-tia/view [2] https://github.com/riscv/riscv-isa-manual/blob/main/src/naming.adoc [3] https://lore.kernel.org/all/20230426-getting-tactile-e6cee2cdf870@spud/ [4] https://lore.kernel.org/linux-riscv/20230404182037.863533-14-sunilvl@ventanamicro.com/ [5] https://lore.kernel.org/all/tencent_1647475C9618C390BEC601BE2CC1206D0C07@qq.com/ [6] https://github.com/chipsalliance/rocket-chip/pull/3333 Changes since v2: * Fixed misaligned '\' in `riscv_fill_hwcap` * Move case 'S' after 's' to make the workaround only works for QEMU in `riscv_fill_hwcap` Changes since v1: * Remove convert all isa string to lowercase letters in `print_isa` * Remove warp parser pointer dereference with tolower in switch, use uppercase letter case instead in `riscv_fill_hwcap` * Remove allow uppercase letters in dt-bindings * Add Conor Dooley's patch which drops invalid comment about riscv,isa lower-case reasoning Conor Dooley (1): dt-bindings: riscv: drop invalid comment about riscv,isa lower-case reasoning Yangyu Chen (1): riscv: allow case-insensitive ISA string parsing .../devicetree/bindings/riscv/cpus.yaml | 2 +- arch/riscv/kernel/cpu.c | 3 +- arch/riscv/kernel/cpufeature.c | 35 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) -- 2.40.1