From patchwork Mon Mar 18 10:39:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 13595205 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 6E786C54E58 for ; Mon, 18 Mar 2024 10:40:20 +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=5AB196ukfphtzohvHZUscpnYaA4UaIjD4ARIgrEr2o0=; b=vIwAMNREY2C/OL nvLcoLWMr2WOhZJV7TEf5ysUITDTJkVu4OYs7F9ogoJnPGE9duPu/Furw0YYK534DvsNzGIiywZXT NSf8yqDirX2gKJfKy/Wcg7Ouaa3aMmKnYs6KP1azSYyUxk3M2GBfiGrYiJYuTZ/nSC2Dm8ezF/kkR GuSMUWwoCWrwAHhQbsv3Y7dGT9KtmtUSXxtm/ATdVjOVTmD6qv3DQWISyuvtSZMkjD5T2nzRLaUk0 w3LpZLtrz6bpKU2BfIIYzVZmLvvH9MKt5xgQtJGLPPaxHifSUJwhbH7HIC+VdbCpNpw22K2bWl+lp iZKejNLgV9FCtk9dojiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmAPg-00000008B0d-3WrK; Mon, 18 Mar 2024 10:40:16 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmAPc-00000008Awy-2VQk for linux-riscv@lists.infradead.org; Mon, 18 Mar 2024 10:40:15 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6e6adc557b6so3926377b3a.2 for ; Mon, 18 Mar 2024 03:40:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1710758411; x=1711363211; 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=3nNTcXNffy4KdPfHJUqr4Rqkbq2/2XQcn/yEKFcKSuc=; b=TaELdJqe93MzpqPxBVd2UPspmCEOpe0lyBn36mNuWbtqlJNwey/qLM7EOLBuzygTuW fUEYZ8ZCWb2/XWz2G+5CvoOZMhy0ypqx4/oPlTV1iaXjbzWRAqEhCmwkylLClSsqGogB UtoZEovGqTPUkE/ywDQrFSOYiH6sM1lw9JO5jDQ+BMHghm2mtn4sl9VQyoQ0+30PWXgc Hld5ID5hRRxa+9QDqfSU/f/XZXRmTciKh/7lAxhVNdiM5znaBq0eDRuf4XGT+WrGPnMw FK5EYe2IOp/P9gcnWLCx+boFhNGottVQcNK8/ECIGGSTI0NLwhBXL25Y+NRfLsHkni2n zAmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710758411; x=1711363211; 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=3nNTcXNffy4KdPfHJUqr4Rqkbq2/2XQcn/yEKFcKSuc=; b=msH1IBc76Mc7dVe/dHGwk+N6Kxrr0LZkT3Ot3/auugTsvKugTo0bIiYbIKFH61OrUr MxuGiehjfCTCfAgJGI6QRQnBE9RgEtCrFeiSnXeivZXm57kijCC/SOlghASUSjvWlrGT HuSqsErAgRETH8rIOPlsg1JMwt4653IIDKLzKhcciPj4gf4rIOkoyoj0Ffq4e43fQx3b OOShMk0OW6Z3GuacnpcYtaLScx8rLBqQ5BmyAOujygRFqH+6dPywBeEK8kmfEurrup9P WM5CCHMW8KqUJxS/ebNBy+haQoSoKU4CWM9czuNQVfBveyq0qesfEVlA0crFQxiHoy4U dN3w== X-Gm-Message-State: AOJu0YyF4Pp9y0RorVqiD6w/+P3jg6isigWX5/MmJFDJJqa2Cx2IokVH QyQOPbMPZA+CmSuicJEpXx5bYtLhfC3IHIPS6TNmnoSbEg8znDVHEqdYQ8HlkWQ= X-Google-Smtp-Source: AGHT+IFsD3XyPwieL+ff+1DLNCsk15WFel5OqZJunIAZxacfoadhr6HvNJChmCWf1p/8ZTzzdtfAgQ== X-Received: by 2002:a05:6a00:1806:b0:6e4:62ed:23c3 with SMTP id y6-20020a056a00180600b006e462ed23c3mr13506206pfa.9.1710758411364; Mon, 18 Mar 2024 03:40:11 -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 c11-20020a056a00008b00b006e647716b6esm7838969pfj.149.2024.03.18.03.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 03:40:11 -0700 (PDT) From: Andy Chiu Date: Mon, 18 Mar 2024 18:39:56 +0800 Subject: [PATCH v3 3/7] riscv: cpufeature: call match_isa_ext() for single-letter extensions MIME-Version: 1.0 Message-Id: <20240318-zve-detection-v3-3-e12d42107fa8@sifive.com> References: <20240318-zve-detection-v3-0-e12d42107fa8@sifive.com> In-Reply-To: <20240318-zve-detection-v3-0-e12d42107fa8@sifive.com> To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andy Chiu , Vincent Chen , Heiko Stuebner , Conor Dooley , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , Greentime Hu , Guo Ren , devicetree@vger.kernel.org, linux-doc@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-20240318_034012_666784_D14D8914 X-CRM114-Status: GOOD ( 11.95 ) 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 --- 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 db9fb90cb272..cbdd63165e85 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -457,16 +457,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); } } }