From patchwork Thu May 9 16:26:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 13659912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4431DC25B10 for ; Thu, 9 May 2024 16:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pvsrGeRfUBNCtbHrD6ZfCUc5VfCyYIAx5TdQmDk0/6A=; b=CnAs/3Ca8PgrwO 9+c7H8hs+ky3pF51ycbVDFXeIkPKtmo8UNeYzoVFqKDDsDjyEVgDzZIDJEGZfJ7B0CiL8n5t2j3pY uKuPRVHPxoy+3HlL/96wKQl9/Vw23yVOOdT9/Z8ff3TDI/rlma44Z6bk71IJwwLqeLFnh5FXGdIoi OblhmwXwxPLvzToEuB4+PWjTnuYk9BiE107VNgW4FJ40Zt/k0UO8Y+3ylNiYmEKlbRCYn+larv7Gc 31nzxCTuG+/OEIAuJSDY4yDWz7RvmTAiZkRNvLaJwYMlKTVC5xxn7cGFX+RukiCvRvv+rsqt55FJF lPAUteV4G0FIiJTG622w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s56cM-000000022Mr-1vHx; Thu, 09 May 2024 16:27:38 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s56cJ-000000022J9-0GK4 for linux-riscv@lists.infradead.org; Thu, 09 May 2024 16:27:36 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1ec92e355bfso9178165ad.3 for ; Thu, 09 May 2024 09:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1715272054; x=1715876854; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=hrVtT3wUj2Ro2LlZ8rt/5kKYI6Cl/lb7mj3BLkp83qk=; b=kXz+eQPcLnSFfCnK43ZvlXw7jDlxPgrabsF2CrusLEhAxYzZSer1sVTQepEoX9/68M +VpZ6bhCdPIlZW+tyGxsR7aqVwLgm769uUdj1Kq2ZKoUw2nEnEqUBEtSgci9nTEVJIUl 7N4Sp0dZXPtI2eNeRDLY0yR2dzrvsP4OI8IMLY8mh8AyZu13gd4pFzNN3WZTmSGCKDeG tCKe3bLbb5SNsw7MJwSMdhfZI4BYcs1BxVc4H7FjwCZWTM5qUWPtir4HK1q6m6zIuUJ3 1Yax1KJY6SNfCHi+sm9J6NpCKLgclXZFKe0Q+fhT9ne/WbiAK6HLp0UnIclE0whmCU0H 0StA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715272054; x=1715876854; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hrVtT3wUj2Ro2LlZ8rt/5kKYI6Cl/lb7mj3BLkp83qk=; b=YM6PK3aRJzkEJ71UBVLqp55utB7gN6QoaudhcPwBmWswMpGWNiIq1NXsC72VW6muC/ KGt2zR3IN1r8f9GsEsSfgpCvjPc6Y37nRETXJxxXFVQHigwoD2ev2BBkxMP2/iyE442x fgLQXhIV/yEZj7Ko1o96UxBcYrAld5ulAtY5aqpDLu8C5VVvSsb3rE69+d1/OnXW11T8 AjKCp9OoLoJFih0eBjrVfOLhLywGpp2o41tLAw814oyUxWdW15bA5he4SUTe4A6ycrnp 5ssr4CU/fX+05Opi8up7abhyZ/8nOnA0Fl9IbPPxZLeieaMKxkKZyxbIncV8BlkS+EGi wR8Q== X-Gm-Message-State: AOJu0YyFmjZi5hHyHLTnVE4iKkrYrUpIl5F37QBmv1/sm/lHwOkCgRrm RjP1R26EPsQEUAdNzFwecfcst1eIei4Q0qrZNIrcdJOztv0jUeAM1sr0BfRPtEw= X-Google-Smtp-Source: AGHT+IF8PgRVZZ0FHnW63FE7rtPOWp30TN+TCPvlMDVR+j+74ajw2NLtOZVqw2pXCxjO30nvabMrkw== X-Received: by 2002:a17:902:c3c5:b0:1ec:e3c2:790e with SMTP id d9443c01a7336-1ef43d2967cmr1810595ad.19.1715272053741; Thu, 09 May 2024 09:27:33 -0700 (PDT) Received: from [127.0.1.1] (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c13805asm16210285ad.264.2024.05.09.09.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 09:27:33 -0700 (PDT) From: Andy Chiu Date: Fri, 10 May 2024 00:26:53 +0800 Subject: [PATCH v5 3/8] riscv: cpufeature: call match_isa_ext() for single-letter extensions MIME-Version: 1.0 Message-Id: <20240510-zve-detection-v5-3-0711bdd26c12@sifive.com> References: <20240510-zve-detection-v5-0-0711bdd26c12@sifive.com> In-Reply-To: <20240510-zve-detection-v5-0-0711bdd26c12@sifive.com> To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Heiko Stuebner , Andy Chiu , Guo Ren , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , Evan Green , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Shuah Khan Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , Vincent Chen , Greentime Hu , devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.13-dev-a684c X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240509_092735_147507_A1BFD5CA X-CRM114-Status: GOOD ( 11.74 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Single-letter extensions may also imply multiple subextensions. For example, Vector extension implies zve64d, and zve64d implies zve64f. Extension parsing for "riscv,isa-extensions" has the ability to resolve the dependency by calling match_isa_ext(). This patch makes deprecated parser call the same function for single letter extensions. Signed-off-by: Andy Chiu Reviewed-by: Conor Dooley --- Changelog v3: - Remove set_bit for single-letter extensions as they are all checked in match_isa_ext. (Clément) --- arch/riscv/kernel/cpufeature.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 15ffda1968d8..4bfc13209938 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -468,16 +468,15 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc if (unlikely(ext_err)) continue; + + for (int i = 0; i < riscv_isa_ext_count; i++) + match_isa_ext(&riscv_isa_ext[i], ext, ext_end, isainfo); + if (!ext_long) { int nr = tolower(*ext) - 'a'; - if (riscv_isa_extension_check(nr)) { + if (riscv_isa_extension_check(nr)) *this_hwcap |= isa2hwcap[nr]; - set_bit(nr, isainfo->isa); - } - } else { - for (int i = 0; i < riscv_isa_ext_count; i++) - match_isa_ext(&riscv_isa_ext[i], ext, ext_end, isainfo); } } }