Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp260857lqn; Thu, 11 Apr 2024 23:50:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdGuQ4/PDVjzneVLHfbNrC1OydX8hVh5Hjxa2vdXbF2xr71N1tcjeiDrw71xNxUM6R8fz3+w/36n6WpVWxkyg6or32D8b6aekN+GwxFg== X-Google-Smtp-Source: AGHT+IEcT5xSP9oLgbI4Y4etCXO+Jaab2m1H0l4758la7QJtrmqOdAGfedsHzSk9Qu4kQMdeVP9q X-Received: by 2002:a50:cdd5:0:b0:56c:195d:b162 with SMTP id h21-20020a50cdd5000000b0056c195db162mr1502597edj.6.1712904610582; Thu, 11 Apr 2024 23:50:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712904610; cv=pass; d=google.com; s=arc-20160816; b=M/u/Y4ZlJT+SN4FmRDNbnF0Xn+9Rjryb079sJ/XYEJhfv20LRfF32oWZH3YpUXuXkD oprv5wHNCLg8sjuCpA9K3kx3RRTbPtfdlGli3VpIDNQbBifr3fxW165aDm07ZkLzw/eT 2nFxJF6AK0UcJFo108cmsFPWB2xG7nM/gnJdJJhD03nYbNiJHbZQgylYCcNZjD9bsG+h OfDGScOQ+lD4VYKggQYrFqeMjfiqqvc7P9YTSPA+b74Nc7Mhvp6H/nGuNmp0SYH/1FX3 LQG35rBFykme1pFSV74nyrm/g0F39G9lp38oN/4Ngs4XrbX+s2yR1n+fBZIjewOF+MWO gQ5g== 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=OADn3kHEewLkE3kxFhkvk62eojDLq3ulyri6MOmjFqk=; fh=WFqaLxNXQewmj4B9URjexkSbMazBgrcIhQnomekKBMs=; b=Bqws6qy0NId+39xXsOIchS73nCtYmTIJvmbO1RvsOm6PgUO4ep/9/iPG+WUzRzY+xh Q/znDl/8DCc31cbaiS7kuW973hKViKczxco1HLRGbAhDpcqnVP6qAFE3oJFC/+nJ2Rs8 ExT1Rh+zD9o0nBhDivr5YcrTdPUkx/HWp5+IXjvna9z2HaY+PhuRuuBLtG92G7C17hMn WW7OHZ72OVfFPmQ07GXL08h5hyNKaBh5EUJw68UBueqYRB8OQ/943HGiKH0NDRfgH0Yt mS+JMAtc1KMkD5qwce/VqhWZ+YXy8p0i5dPA2EgRIhsFe/w8lDqSi5BFqCZjQvw0B901 JGbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=Rdi7Ix4c; 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-142068-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142068-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 ev19-20020a056402541300b0056e4aaecb82si1470933edb.404.2024.04.11.23.50.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 23:50:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142068-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=Rdi7Ix4c; 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-142068-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142068-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 51A281F23C3F for ; Fri, 12 Apr 2024 06:50:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8379F4D9E7; Fri, 12 Apr 2024 06:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="Rdi7Ix4c" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 7F7104CB4E for ; Fri, 12 Apr 2024 06:49:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712904555; cv=none; b=Amir99rKAMF/mE0n9bTViqy5dwxhCRE7dMWbq3MTQ99nmLF0Dc4zSwHGLZjHDqnw2cFZNk9bWy3aK1khplrHq46phlBHpcBsBMcdWDdWNhtRQY8Ec7bnd/QOAR/OkqL17aJH1YICGwKu34SI7S31o8rGJSJr0CNPBH8MM/NotMI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712904555; c=relaxed/simple; bh=a9rwcEjnh21QIPCAXbkgAFKpx5pi2e8+mY4wvsy1GA8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZMckPzU7UkPZgnnPT93H/sGEigQf6+RzKD3re4HXKcYXU7Eyc/w3rQjEy3NoHCHpzbRpoidaVIWMI0qx6jorCuEvm1OAFpZEXCbJemZMjB0NP3A8KRTHApFv1f+4LadJz5CMAErwDJ9Kp5msqYqhqWqel8fJtJ0I1c7g4vj3oaE= 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=Rdi7Ix4c; arc=none smtp.client-ip=209.85.214.178 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-f178.google.com with SMTP id d9443c01a7336-1e5aa82d1f6so1522925ad.0 for ; Thu, 11 Apr 2024 23:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1712904554; x=1713509354; 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=OADn3kHEewLkE3kxFhkvk62eojDLq3ulyri6MOmjFqk=; b=Rdi7Ix4c0p8kVPHHQ7VI96HupW78pU5L74+2ZrqwsX/On0/34FzVKjLYQUqFQw1NQP 8KS4IpBzBJML90BDRCFZpAEFFbGFl8Dg554PtQE8GxckJqlhlglWsWiEemfE6kWjW02V bOKJD03Oxl1nkQqJYV24cH1UgeGya55AdZRp23MgiwNQLhdnXUPo6JZHAcjHHiaKAy4c xip4un2gC/fgpsf0SwFAxc/RK1G5vS4fYwoTTckcuCjJBbeHjSZvSPMajZPfm+PoQB8x 1WZcF4S/H0nBUoS1/W+rSG89atc5/NoXvISHElhbiErKiCm6IhXS+XMYXfBIyd0xJ8ax hH8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712904554; x=1713509354; 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=OADn3kHEewLkE3kxFhkvk62eojDLq3ulyri6MOmjFqk=; b=niQ9CskyZa3OR+bOqafSoxhcO040CX4+l+YY44+UIyfDp/me+HXxH5uImiSIXnymCe FYU0g8OLyGUNdeMlIuDUnPX66YbI0aFddJTnKqeDuvxrWWd1l0TYDZ7cx4Hm7LPPALyj PTqCAz5Pal69YPCyOydjkApgpUp0wvLc/nNKV1pK/uxwBXcz7E8HQ2oM0vRyzv4l9ucJ zjY8SUXZxhIuQDGEYu/F15xPgYw+UJw2seLLBlHFQ2FQcqVnO3eRrpu7AqLUXJUR1LiD z76AuSUszaivDjFQpTrOIk4jtGPptCWVefh4kdE5vdUy7YycuZzSMH3YBOibaHkl3+Ae gCXw== X-Forwarded-Encrypted: i=1; AJvYcCU6i0Jwp5X3p4c+T/YIOJX/g/vgsFlMd7iL+cKtnVjrciw4S+S3KIWbI37WMIk5InYWbTYIqpfFlEXXQQ3P1od+goHQNfcgas+zX5m7 X-Gm-Message-State: AOJu0Yw9LQEifqJArSg3Y1KP34zxadx8yhAl7JMYjqd721iNAhvDPxoK ynDpk2xEOxDpS1kUbmuvJ8aNZZLCeaxEljTP95YcxKevgejIRtQwIx+T3AzEBQ45/VmddqCUEWL 0 X-Received: by 2002:a17:902:cec1:b0:1e3:ce12:ef77 with SMTP id d1-20020a170902cec100b001e3ce12ef77mr2423696plg.11.1712904553854; Thu, 11 Apr 2024 23:49:13 -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 q8-20020a170902b10800b001e107222eb5sm2258818plr.191.2024.04.11.23.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 23:49:13 -0700 (PDT) From: Andy Chiu Date: Fri, 12 Apr 2024 14:48:59 +0800 Subject: [PATCH v4 3/9] 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: <20240412-zve-detection-v4-3-e0c45bb6b253@sifive.com> References: <20240412-zve-detection-v4-0-e0c45bb6b253@sifive.com> In-Reply-To: <20240412-zve-detection-v4-0-e0c45bb6b253@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 --- 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 d22b12072579..f6f3ece60d69 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