From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 75FAE44C97 for ; Fri, 12 Apr 2024 06:49:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712904555; cv=none; b=bjDWATFYpYtqSKH56AFRhR0XHVOYLdlmw6WRt1Rm60mZVeu2PfTE7e1PPc7h82Vm493Fb8YE2TMnt96cYTzFM72kw6eS3pHtfU4kI9ZnZ/6ZcqKIhLt4ttm5pe/0Dvn8wGx7uqwlv8H+7hQpYkel/i/Lvm/w+BOH7BHKgPfw3/0= 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.176 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="Rdi7Ix4c" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1e5aa82d1f6so1522905ad.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=La5Uq3ZzRHL192dYtzX2OuklfxiAWDqGnRkl0KVa4YNKsDQflpDcElH+wSm4MkBurY /fipQBRZSH3VXJ5uC53oEoYtC/7mhny8Wx2x7R9nqnN9oqfU3CjhOGpG+HTJYYcNIjcP bFB/4x1hMI7dPvtxXNGyXK/zN6aK9nyDPyepmL5tIt2PLQq8xV7OEI2QJvnVMNAyfpJh 20uwUViWBJS1RiIoh4SKfh8EgOC3q/lj0COAa9NgNmkd8axwZJe0KHhHwI4igy9teUsJ jYj0QtywDQ8gd3SmrOA+U+618WKt2ueT8a1xpYEgmmVsC0SYyY9hc32UvglOVleIDkQ3 W3HQ== X-Forwarded-Encrypted: i=1; AJvYcCX2zSWPVAdWK1urr43t5DfUyHI4be7079Nai1O4A5V9emkYMKbobT7HG5hLRresTDd4YOR7naiZoODxsvEik7NmGSMXCv+D+jgLjA== X-Gm-Message-State: AOJu0Yw/QMSGlQuvyuGNt/0pHBpP3LAQXeaCrTVX5xHR7RVianK03cON /O8FW1J5YW6GZwGSxS+QO2naIX3fj1feE79s5Ae4u4LW7bDlBpKA/Sc1urzhuDo= X-Google-Smtp-Source: AGHT+IFbQ2c5TpJxdrKyUl2ru1yHmpDc6XY0Qm2Yv9aIIgLh9stQZB1+mDwKdX6s0oRU3mLmFdEA7w== 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: devicetree@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