Received: by 2002:a05:7208:13c3:b0:82:bbfa:f723 with SMTP id r3csp41730rbe; Thu, 9 May 2024 09:28:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXD9zJzNLAS38T7DCqQ/U6OUjqX7HvD8M5+BFDfpgr+BxQfC2zaQAv1JTT60gAwiAj6CDDVVtA1nGhj0QW6PJ3d775MmOaIQxGBxtyqZQ== X-Google-Smtp-Source: AGHT+IEVFgKTbCbsPWS9Br4XdduSTPXKmPE9knQNNLPCeMgynBsR+FRez2B2SaSGDfRlZRErXWFh X-Received: by 2002:a17:906:308b:b0:a58:9a67:967b with SMTP id a640c23a62f3a-a5a11844720mr254702266b.27.1715272096915; Thu, 09 May 2024 09:28:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715272096; cv=pass; d=google.com; s=arc-20160816; b=rL+MTJ4CHgE84wpL4xIju+Tb8g/J/q19Dq0NmINE4Np6hH8YGefAS2XWH2MLG/JWM/ +LKTHCQfvchBO3257hGUBnY8huP29gsDygbMQV4OfNolhddQic7fRyJBGoB/38T4d5kN bzudFLLVEnYo3Jq/3/Xj65Fo5ZPtn4rHsVNFmCOFycdWjanag0wUxHHYV7fFxGaFW7Zi l9YWvu4FTtEpdVcraDFK83jbyV0pvhyvmRKXp0wYljqZrVbxWEh17GNzTeNtCSFRM9/F Ob8jbYQCoRhTnCHWR3FdKMmyMtTz8QXNR02ThjrCJofkuVJE+NRsJVF0RRs+diCuYsfR Y3gg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=hrVtT3wUj2Ro2LlZ8rt/5kKYI6Cl/lb7mj3BLkp83qk=; fh=z5j0I0NKneWcQ8uyCGRlEBWVMyqEhUGcdKbLY+OA8nE=; b=SH4u68ttUPxrfDP8V10+xxKgIVHTfXeG+QKfKye1MNBcwQ3j15iWATI9fsRK2dmy4O gE5sqazSrIHEKKTCllPPRyzNobsHFqM/Qads9rx4EgXX9CHk/roPk6BF7R3J5zsyidWt v5GLL8U1Bc3dBID7wPqFW6EPNYY8eKtdRxEK10VZRQ+azzZM+NTzL9VxdfkmFtlN9ZOK YvhZiXegOAShN2Dluz8hXlWcuGFPy85SdkodvCK4d7DJPQ3Jy4o5Phjs3FjqZ8j7CkDO bnJXnH+iulIW+8sXE4uxOgxZSUHtLRXIpoFLY5rFvEOk2YSbhFOSI/XeVtbCUdMn/Btm 9NAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=GBmug3Rs; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-174677-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174677-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17c2c88esi98269566b.1022.2024.05.09.09.28.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 09:28:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174677-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=GBmug3Rs; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-174677-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174677-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AC8361F21E53 for ; Thu, 9 May 2024 16:28:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE77117089C; Thu, 9 May 2024 16:27:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="GBmug3Rs" Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78354170859 for ; Thu, 9 May 2024 16:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715272056; cv=none; b=bVc1i1Duhmsq2JIFXMRdTYkZtbJ69GTYSAJd0cNl7SvDzpTh/IKJX8XMhdULQBziYk20eOp4OQYyJnssP++TjKIV9XWkYQ9GciyOakQRAUJObfQFxUDk2ChsM9s1Rny87M+3JbSEDjzGznzrXA/JF9VYm91acz2r+quOzO/wedk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715272056; c=relaxed/simple; bh=bRdldBcR63JhBiYgvb0j6aaFVJpCttTWpBzzpwiAVFE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EccjEUvfhtXgoXYBTdyr/vWMOIUAvK17FF4ewAhmImbpVcvueYILt9E1v4PO1+3tExdg7V+kOzspOaq3su0dqSBE+jHoK6CqdXzRLQPNBryy//jiFLm5StDhH4PfHjzCLc7JCGwQx2CXvcjV6SQN6Zzl212wp8J/5/aRtbDsVD0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=GBmug3Rs; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1e4bf0b3e06so9147565ad.1 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=vger.kernel.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=GBmug3RsgN9C0pFjOHp1E1ldNsaVhtGlliA2BfHmjYkdiVq/lEEELtsvx5+iFKM+U/ xeqJZ3oL2xd+VofCUTUUO5oodWTLppmjoGRHSiuyyLgtRfqXxxsmQXC8f1AQi7Pt+DEb TYaLDubHtT+qJmVmsnvtHKjpNJY//QAmcycSh3shA/rUXcQuO+fe0QPnIIA8oltesOjM FLVGikc8DCEBIDDtuYfwr4+b1VdnXih0X+JynU1JOBKZOZZrGDoAxCRrc5OGCqykj/ng c/rLlHkwDF9H34PzPAa0MP7Qmtmg+B5MLSRnZwGoAXHXdBgEg+Lp83+PGNpebDIGnOYW JiHQ== 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=jH4azuRCe7hJLF00V/8K+9868quVVsscda7uvu/x5yADeyaw+oQwgyAQkq9+2Tf8Zq rJNr0m9msuiNmjEug/KDAoW9Y2S4s+h7LPHYYaPvaol0bB3wJIkw1m1HRHszGeST5hkV dduzSInMtQvcgKyCbkYlnFrsqBikUBGs9O3obTG1U0yYC8fuq7WeS6gGr+8AaUy71iGu Gt7G9oDp1QunjHkEw/h8RPxdUZch5hpzYHR/D7iYFKt9uxeBBl44QOLtxchIuBntxVSg e7zyC2z3vVC8JpE4vFUjub5qbk3nku6SR5awCKNCnGyPnQWkKGW9boG1Y1/Ao2tO66cq gOSw== X-Forwarded-Encrypted: i=1; AJvYcCU8qhfbr6HyyJJ6w1BzpawEo/jY9+MFXAvr7g3zpNomaC/XDIm6v+iVS56ItEYnZ5BdlqZScOlxaHf3K2o8mVUh3m3NhvqPZKj6EO6V X-Gm-Message-State: AOJu0YzI48N95YTIZwTCOOoZEGYGWhkZVDmYcNPGld7IYgD2mevKwgf4 LM7ZCHq5wfhGCbBaMpxd6tnt02wlpaHsCzWLLYQ05NnZ9neexQSbWB86WmpDdig= 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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?q?Cl=C3=A9ment_L=C3=A9ger?= , 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 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); } } } -- 2.44.0.rc2