From patchwork Wed Jun 19 15:39:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13704190 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 C8E3DC27C79 for ; Wed, 19 Jun 2024 15:41:28 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BREfKWqb1iJFstFLyky+22XIpY9GmirsHhrYc8I3s1Q=; b=KODIGTc+6TvXfd eC8d/LCvt5bJ9wog8uJ60KEvSz6HdKEyynnU78WnXT/zQYgzZKynMVsCEPiAJPQrlBKwW5m3zAdfL Lqf6Un4zTqk5L55eCbtUzGk3sh7a0gZwOW5O7d8iHs7Kijsyre99Q/tx0yXhKDNpwHMuq2FdzNWgR VCFOhcXX6dJmK/Xyc9PPZ/TJ2ue71USlamJxKhh8slCLcFAXJ289/0CIF+rApdGzBC2kSkb3qy3m9 EOC2scAzb30+0uXBSnktrcHO5c7OA7G4hxweJJbFcH377C1thT34r1m0TXNxTBvy/3AXrVgKU/T4z 5bT0jy/Kwpi7vvWP4/tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJxR3-00000001qap-2Y6w; Wed, 19 Jun 2024 15:41:21 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJxQx-00000001qUc-1clc for linux-riscv@lists.infradead.org; Wed, 19 Jun 2024 15:41:17 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-364068c0ec5so76625f8f.2 for ; Wed, 19 Jun 2024 08:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718811673; x=1719416473; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XxBaoVReHjYi8LCIKzJk71raI5rhLtFKE/0A3hAurqc=; b=XujtEj0Vqty134XKkkMujJTmdwC3WwmBuw0rzi31szqLHCJtWbSCL4nYThfpFUpHag 1l9NzWJ8I5UxaB5zoHzH069GjSdQCjpNKJApQhE2zkzFPnNztFaEVZDaZTKyf30kUd5a GORTEnKxUT+TpLnKKXH1jfEcB+SorSTIUrA8NSULb5w2GPaNS5KudlegppzFXgj3fxDW 7tzkeFfUpYd2yjrZAdTDQUiLHkuMkaha//2uOb/dzGlhS5LCUnthDMtXlo9vh3T2KN9f SKE/yay9XcPENcv5EPA5D76x7Rit0c4dcRJ/wE74LgngHcvt9xUsvHQNVQwhC7dOPwPE qaKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718811673; x=1719416473; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XxBaoVReHjYi8LCIKzJk71raI5rhLtFKE/0A3hAurqc=; b=RqA9yF0H1wBnbibC403SivvWJ8MVxG0yfcm7DSXpvtPSH99vu4JntfHlqgJnVzmYOJ rxp0hWSSl2GKE6+csnrPcAawyzG8Ktwy8CsgjqC8tXHwLKK/Y8XzoUe3trdlRPFuOVkD l/meacZuqm9+EsREzLo357tKwBCxhZPB9yrXr4ei23ytZJKSUqgg2KwO0RWqD91i/5vz h63VhkDr4b5GBiJ7KYGeP1hbR8Cp5zSsNiWevMGOPF5FUctn/QYaFEkBi6v4xKxnC0JW tt7HWZ445Q8Kx+ItHyIcrU0V3USn7ZkLjIaVcV1I0nkL3ug4e/9tQExndaDvwrGxI5MR 1hVg== X-Forwarded-Encrypted: i=1; AJvYcCWIyi0wKUT9XznE8jSNyToPiRfShIxvn+ItcLlzK7dyZ2QsbK3UrH9reJ9qT8CS0fr60cmqpeOSSlhfyggc86A93/PZ9m1Ir3Ea5VRe0oV0 X-Gm-Message-State: AOJu0YxrnmrsWY9wWOfxu8e8a5U9k80TwmxzirvYaxC/WwL1Ii7p8wgn LEQDoDaeikDQnDmJyhUCmyViuUHborzFj9sziMgbAidZ5MpqX3Tf7VRP0Zxb0mI= X-Google-Smtp-Source: AGHT+IFz7mNhNVrkeHHVYr8mBns/F7ItFsjrGXd+9ip+r+Vpj1iuLdfUz+P+4a8dyx9jXLcARTyeFg== X-Received: by 2002:adf:cf02:0:b0:364:7a63:93c7 with SMTP id ffacd0b85a97d-3647a639555mr16771f8f.1.1718811672887; Wed, 19 Jun 2024 08:41:12 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:819d:b9d2:9c2:3b7a]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3607509c785sm17392292f8f.34.2024.06.19.08.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 08:41:11 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan , Atish Patra Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH 2/5] riscv: add parsing for Zaamo and Zalrsc extensions Date: Wed, 19 Jun 2024 17:39:09 +0200 Message-ID: <20240619153913.867263-3-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240619153913.867263-1-cleger@rivosinc.com> References: <20240619153913.867263-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_084115_480411_22C0AA0F X-CRM114-Status: GOOD ( 12.29 ) 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 These 2 new extensions are actually a subset of the A extension which provides atomic memory operations and load-reserved/store-conditional instructions. Signed-off-by: Clément Léger Acked-by: Conor Dooley --- arch/riscv/include/asm/hwcap.h | 2 ++ arch/riscv/kernel/cpufeature.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 4880324a1b29..69be244bce4b 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -92,6 +92,8 @@ #define RISCV_ISA_EXT_ZCD 83 #define RISCV_ISA_EXT_ZCF 84 #define RISCV_ISA_EXT_ZCMOP 85 +#define RISCV_ISA_EXT_ZAAMO 86 +#define RISCV_ISA_EXT_ZALRSC 87 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index ec4bff7a827c..d71e5bd58acc 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -156,6 +156,11 @@ static int riscv_ext_zcf_validate(const struct riscv_isa_ext_data *data, return -EPROBE_DEFER; } +static const unsigned int riscv_a_exts[] = { + RISCV_ISA_EXT_ZAAMO, + RISCV_ISA_EXT_ZALRSC, +}; + static const unsigned int riscv_zk_bundled_exts[] = { RISCV_ISA_EXT_ZBKB, RISCV_ISA_EXT_ZBKC, @@ -327,7 +332,7 @@ static const unsigned int riscv_c_exts[] = { const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(i, RISCV_ISA_EXT_i), __RISCV_ISA_EXT_DATA(m, RISCV_ISA_EXT_m), - __RISCV_ISA_EXT_DATA(a, RISCV_ISA_EXT_a), + __RISCV_ISA_EXT_SUPERSET(a, RISCV_ISA_EXT_a, riscv_a_exts), __RISCV_ISA_EXT_DATA(f, RISCV_ISA_EXT_f), __RISCV_ISA_EXT_DATA(d, RISCV_ISA_EXT_d), __RISCV_ISA_EXT_DATA(q, RISCV_ISA_EXT_q), @@ -346,7 +351,9 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zihintpause, RISCV_ISA_EXT_ZIHINTPAUSE), __RISCV_ISA_EXT_DATA(zihpm, RISCV_ISA_EXT_ZIHPM), __RISCV_ISA_EXT_DATA(zimop, RISCV_ISA_EXT_ZIMOP), + __RISCV_ISA_EXT_DATA(zaamo, RISCV_ISA_EXT_ZAAMO), __RISCV_ISA_EXT_DATA(zacas, RISCV_ISA_EXT_ZACAS), + __RISCV_ISA_EXT_DATA(zalrsc, RISCV_ISA_EXT_ZALRSC), __RISCV_ISA_EXT_DATA(zfa, RISCV_ISA_EXT_ZFA), __RISCV_ISA_EXT_DATA(zfh, RISCV_ISA_EXT_ZFH), __RISCV_ISA_EXT_DATA(zfhmin, RISCV_ISA_EXT_ZFHMIN),