From patchwork Tue Jun 4 12:45:33 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: 13685240 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 12DC2C25B78 for ; Tue, 4 Jun 2024 12:46:29 +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=hFHZmSV8yoMOBl3D5NzdrXGlwxQumY4Ig4AoBPM4oRI=; b=EpDjYBkUFiG5GV zWSRTrCxOcLNGeUEpLYgOVnI9brUA3LEg6kQLjYuAg5NqD+Mn99LnCjpNtA2dbwkNnouDXnooUkzO 0s815YFgB2IydybvRZnp5mO72/64L3rNtt9QsY+0ECpnRUwJ50HXwkemrZ7rghXwgLswiirWDYc0p f0BFwBKso2xt6zD3cWkW0GiPmdrD+oRmqYP4z/BrqbDEkH64jPJra/A3B2BxN9AqS+cPNFW+6Y+Nb TjH2/PFn4XBqp4ceSDq2KRnNlLE4r3W1BayxPSjid+eK4h8yXrkxknxNIlPWrjhiwZelvtA++++/A 8UT03/OR5IH53ZDjdjBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETYY-00000002LFf-0kfq; Tue, 04 Jun 2024 12:46:26 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETYV-00000002LCz-3MzB for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:46:25 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1f63b8a28a3so824345ad.3 for ; Tue, 04 Jun 2024 05:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505182; x=1718109982; 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=rkPyoR3KU3XSm/AEH/d1RonWJjnHK9mNu+9RmdnkI1w=; b=VYIPv+BnbZmN71fXPXEPngDz2cxg+LzE0iz9O9Qag0CbH9cxEdWB+gkwEytRVFgkFM FChe0cQpXCHjre/AyhAc2JBzfC3T+fSEwE6zJ7TMc7KODP2Nsky8FlLfIP7nr58u7/mL 9DCp4Ix5MvrFWJqCj+gLl3eJ1SnKXJTzYJyTk3QDrsvD/7HBSpfhdjNU57PTgYMhPOi0 entvuaM0t5GQVt6B25akG8SlJxb4V7t3Ia9FhVPiCGouii4WQP66yDmjCDMn6p5LxO2K FVjmvQoocP/mwO9YaPXG6wSdgZvG53CzHIxhfWv4+EwxWsLr2HBm9HKOWrUMBqoCZPoH CNyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505182; x=1718109982; 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=rkPyoR3KU3XSm/AEH/d1RonWJjnHK9mNu+9RmdnkI1w=; b=sIb8gNgkaXIK6SGSO8WfQg/euUHtp70FXtb0+GwlMPxQ+nn6tVp6JhvQGAhZkH1uM1 2pWO6kunLfJH8N+Pk2jlJp9wpb7FjMriYeS8l9A3CAJwUEu5FhpxYAiwqX5jvk6HTwM9 nn8HcSwarnA5nvFV1uqi2Hh4FnZxN6wqAn4aHmFMssMnLVqorvJ3nJUAzjWDto7/14z0 D09+9j2Pt4Iamd6QCvwvTdHdpMgtyf3Hlqp+p1xOiTozmpdW1MJIS3POKiEgpDzG6yuP nO83IfsESbD7EuqTAjC1V58o5iFBvclx/W3clUMcEAWwhJ/DC0PgQ+/m5LbTZ2kIk3r/ xZMA== X-Forwarded-Encrypted: i=1; AJvYcCXhdf3RBj5JR4gtwQbWU4tdcyj79z5JPJBd+GajgobyVA18J40glHvwEx6jgVA+eQuLnXM1m3fubaEIwN/oi/FzAy2ApKb0Et53UP/LfbmY X-Gm-Message-State: AOJu0YxjUVTNYYVl+V9w6ULgxXjSSE2W0qp7RbiQGHxqR4gbvCnBCTM0 m5+GBeHsKr5nT7AUZzoJ40vvL2Tr2qhjIA1Fxx7DmYQOnp3RYjjBep5LWX7RzFA= X-Google-Smtp-Source: AGHT+IE7Gfwq22B4CqIBvkHs1xIPksWu/HDt59N3pxzuY9J8Ym84nB3KvA4Wk5h6TCyGNl1IpKdoHw== X-Received: by 2002:a17:902:ecc6:b0:1f4:8a31:5a43 with SMTP id d9443c01a7336-1f6370b3a51mr135960905ad.4.1717505181811; Tue, 04 Jun 2024 05:46:21 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:46:21 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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, Charlie Jenkins Subject: [PATCH v6 01/16] dt-bindings: riscv: add Zimop ISA extension description Date: Tue, 4 Jun 2024 14:45:33 +0200 Message-ID: <20240604124550.3214710-2-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054623_877873_27BCA17B X-CRM114-Status: UNSURE ( 9.17 ) X-CRM114-Notice: Please train this message. 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 Add description for the Zimop (May-Be-Operations) ISA extension which was ratified in commit 58220614a5f of the riscv-isa-manual. Signed-off-by: Clément Léger Reviewed-by: Charlie Jenkins --- Documentation/devicetree/bindings/riscv/extensions.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 468c646247aa..616370318a66 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -363,6 +363,11 @@ properties: ratified in the 20191213 version of the unprivileged ISA specification. + - const: zimop + description: + The standard Zimop extension version 1.0, as ratified in commit + 58220614a5f ("Zimop is ratified/1.0") of the riscv-isa-manual. + - const: ztso description: The standard Ztso extension for total store ordering, as ratified From patchwork Tue Jun 4 12:45:34 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: 13685241 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 EB057C25B7E for ; Tue, 4 Jun 2024 12:46:44 +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=ZKr5L4WYtw73/8CLAdgvDeRRERO7I+Yb0vAF5ydJBqs=; b=S5nNnwUOBSEFNB cwDh8aNVWgP9ezBEW05TYrMrGmECZZ8zWd1GGavKZJFEscZLiS4teki4vXxGAGksJ4biNVKKzugqk DBcaJ1TTKZv6UOLKoJ10aEeLlOV6qSXW4goVhquvT82UhtZ2klmpZTpaTFg+mnxFHZzG2RU2IhHzS 2YgGJr2RQb5jc5kBAK/ZwSBREHYMPHJjZSOoL4fbNGWpSHEBDL1vzBRXQxjnm7FWCyY4IWpQcs8C/ kJjdsbiat7JpxcNbVQoO01ynETbQQ1FPPWbXulYNbLDXx//J4pVtOfJv4aS2hyrSJAm8xn4wI6FgY rNxC3M0E7VZTVGiZtihA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETYm-00000002LOd-1WHz; Tue, 04 Jun 2024 12:46:40 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETYi-00000002LKs-2exR for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:46:38 +0000 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-6c9cd96e485so313644a12.3 for ; Tue, 04 Jun 2024 05:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505193; x=1718109993; 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=FH0bMsHD4vaf3RN6eECK/cSeWYzW9s54IHrYdJwEDyo=; b=N8eqxSi8cFCdszz2dERjxCjWXY9zm2jNqSDp8RR4FR+p8Gv2z/uvtj/CvEAPBzuc7d P64gdjQJvSbrtGiKiOaLtHrLxZFVggwFjsB+b/cpqjG5NobCICYlTw2T5t+JqNj8QmIC OcgmuJ7/NnFHtI62MJII164zbc9L9ccCnklfeBHrqSd2qLhCdgXdi2nEbs11OurbiSeL awtS2qPitUI4rc9bnVFmvIMZTDqfzyjnQS6+faKQR0AuQDN9oYXH12klqS/W7RhVjlcH t9zVuDP0w0kPJyvsMjFrJlUv3prvJxZ5NZRL9ouenA5o8/6H9c5DE2ZpNPIiQSnspUmA nCMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505193; x=1718109993; 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=FH0bMsHD4vaf3RN6eECK/cSeWYzW9s54IHrYdJwEDyo=; b=JxA91Lwur7FxyJLuLoIt08brfCZY6hjnQWAGnCOBnGeOBh2da5GmzIuCcvsq/ZQ9P3 gPj6mqT6G3CBXGgpA8q/w2jDcQ50UIlTcBb6y3Ot9kd56k+fs6EZpEwGj5FfORUpH97A K0lkKdhMw59G237x4pcJfrN7Bxam5k9/vb/gBt8tm6JN3pfNpqf7mqvHiY2TP/MXZCFC vHImT7KYj6xcN8Qs2d2KvR3z2Ff8xMq1yy1bziGiZbiK0oVNZlVv2e1h0PWr2IWWVhI+ McX4UyokT6QSYRypSEKbUqbCqbB2oE4+jBa2f3PUhsAVKJX27Wuz3GYc2LqRsb7g64VZ qTvQ== X-Forwarded-Encrypted: i=1; AJvYcCXluILa2UjtGDQroySPpEfXFWwkOVv5Reh2oah9J1MY1J+3d02cLyDuibgSULn6DcTk6dtvtJuxgy/1oPmzofhge+Ll5PSRFLRkfqGx0FjO X-Gm-Message-State: AOJu0YztPnnCYgWuoMq3b46fgSvkmcq5aHJ7PlfHa669B4cOIrPmwu12 YbR6jsL6lFiUWfJDktXXACLVZfFrCJJapsFKHbaLuv3oNpOx7blqN6H+nQIapZY= X-Google-Smtp-Source: AGHT+IEcDwjJyY3zBUf22+Q+de7qq4n7Qn6IlYomnDRBzOkE4B5z+4AhELmoSGtibPGFsq4xo3mqwQ== X-Received: by 2002:a17:902:e5d2:b0:1f4:962f:e006 with SMTP id d9443c01a7336-1f693dd486bmr22891645ad.1.1717505193034; Tue, 04 Jun 2024 05:46:33 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.46.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:46:32 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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, Charlie Jenkins Subject: [PATCH v6 02/16] riscv: add ISA extension parsing for Zimop Date: Tue, 4 Jun 2024 14:45:34 +0200 Message-ID: <20240604124550.3214710-3-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054636_716235_35C7914A X-CRM114-Status: UNSURE ( 9.68 ) X-CRM114-Notice: Please train this message. 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 Add parsing for Zimop ISA extension which was ratified in commit 58220614a5f of the riscv-isa-manual. Signed-off-by: Clément Léger Reviewed-by: Charlie Jenkins --- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index e17d0078a651..543e3ea2da0e 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -81,6 +81,7 @@ #define RISCV_ISA_EXT_ZTSO 72 #define RISCV_ISA_EXT_ZACAS 73 #define RISCV_ISA_EXT_XANDESPMU 74 +#define RISCV_ISA_EXT_ZIMOP 75 #define RISCV_ISA_EXT_XLINUXENVCFG 127 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 5ef48cb20ee1..bd1597578fbc 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -256,6 +256,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(zihintntl, RISCV_ISA_EXT_ZIHINTNTL), __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(zacas, RISCV_ISA_EXT_ZACAS), __RISCV_ISA_EXT_DATA(zfa, RISCV_ISA_EXT_ZFA), __RISCV_ISA_EXT_DATA(zfh, RISCV_ISA_EXT_ZFH), From patchwork Tue Jun 4 12:45:35 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: 13685242 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 7AF62C25B78 for ; Tue, 4 Jun 2024 12:46:55 +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=Yv8UUFxNA/LD0FCOiagbwn48XfNW4wM/dDT6LvQkItc=; b=ah9PDrBWPlrZne upM7qU737WJBanHi7+H6cV4U5Xuq8PdXPbN9eiVRQjbPja1iB5l6HhcMifbu75K3LpMjjainELVSs XjLZWGeFrl36oiWfhnNaRfRtlqcMSGYYMBkt2eO6ehfPgIWn5w7c0pGtMPgAB33Iz07mC0+0TAaeT CqGBKLUueBwg2Nt/I9uJ5+liFLMMqFbSALjR5gZ93LX/W6gSIHPmBm9keEi33nTlx+qBr3Lxt3mRB RSPvmnV1HXgmowunGDOAP8sfAx9zhMrZ09N8br2WAnNFpPHsSxgpUPWlKgOZFsjw3TQb6yptAbhe6 LVId4sPlMPSdmHp2aN4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETYw-00000002LV4-0Fdh; Tue, 04 Jun 2024 12:46:50 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETYs-00000002LRt-0aAm for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:46:47 +0000 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-6c8b6e40ea6so337535a12.3 for ; Tue, 04 Jun 2024 05:46:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505204; x=1718110004; 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=degCLXX+XHlviO1qHS0Zal5T+84ciDG6Q4Lb35fjmT4=; b=2SIyN8cDwSgKbHu1EGeLx6mZJTD54RkymDahJi0jIfSZsNqLpeQ5txX3srZbSzPj4Z fvq/XEFL4O5mZJ/kcnAOXJA/iChYCGbbVlpCYeqoMAGTQtf1eyZKnYdw0ePVz7SXNG70 oEc3Kza1yASeOqXDRzYB3sKsiIjoOui83i9XAs7A5Cj60uglr7F6FknOVyJGTdQDtSGn 6WFz5RJk1zgZBUs8gHLr1hTP1S8aUmaGyDu4vUgaFKLHLaxions0YIiwTavUMeg5xZsg YrVxAHrufCi8kk58H7Jif+c2dD6X+3DtvztNkzHM1NPz0GFQNo8DZe7Ibc6+rQOUKkOQ hS4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505204; x=1718110004; 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=degCLXX+XHlviO1qHS0Zal5T+84ciDG6Q4Lb35fjmT4=; b=Fwgdd9kko82/dGm4ybHEqQOf1xGjzhdUJ4jrm42tCk2lyr5eZ4PXfliEj2XsuYeX4a whpO9Cstzn9uZS1iOGrUTUBrQjwojUL++lAFJr0YeVe0PIKCKmXC3wvl5a0JDSn8UbWe l8Rdt72SgbYrzudKy8ZpjQJD4Wu3xtMXr+Ug6a1x7gVW/7/5/K/BruPFjZ2hgBepMHh4 Kqr143+BMP9/aV/nza5XYx6yMpvcnS/6w1stxZ6vkMd7iBfvGNEs2CV6MtoAkNNZC1SB UM2GOiZhkARVJMA7MyukIUoaGnHEcY7/eejF/O1/jFBdOE19XqQW6/H8U/9RYDENi0zP pinw== X-Forwarded-Encrypted: i=1; AJvYcCWF8MUQwFrj/FPC1lPCMY5CCZqPtSiyUbRK+SaBaPUxu9kKFaQ/YKhowRNv3SlRSCREdM6mivxvDLDTNzsUcOTZdiadf0jERHQkE1sQZib8 X-Gm-Message-State: AOJu0YwxMD2IsOjS1EP0kPuIaWWhkI4RWI8/fNxl0xq91Y2tCn40Qxyx CJZgcwdogVun3BmHx29h7Uktfv5HVz+IWpBNLjD90/pXaLepuwhaEef+nWhRxns= X-Google-Smtp-Source: AGHT+IE7zjnoMPDLUunpx6Exg1+SZFG8SqiUAnSVY1fKx+9xoXFT3WVdqzkHkbK298PA0agj34W4eA== X-Received: by 2002:a05:6a21:339e:b0:1af:d9a3:f3a3 with SMTP id adf61e73a8af0-1b26f327d1amr13632883637.4.1717505204132; Tue, 04 Jun 2024 05:46:44 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:46:43 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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, Charlie Jenkins Subject: [PATCH v6 03/16] riscv: hwprobe: export Zimop ISA extension Date: Tue, 4 Jun 2024 14:45:35 +0200 Message-ID: <20240604124550.3214710-4-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054646_264196_521C4E41 X-CRM114-Status: GOOD ( 10.64 ) 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 Export Zimop ISA extension through hwprobe. Signed-off-by: Clément Léger Reviewed-by: Charlie Jenkins --- Documentation/arch/riscv/hwprobe.rst | 4 ++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_hwprobe.c | 1 + 3 files changed, 6 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 204cd4433af5..48be38e0b788 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -192,6 +192,10 @@ The following keys are defined: supported as defined in the RISC-V ISA manual starting from commit d8ab5c78c207 ("Zihintpause is ratified"). + * :c:macro:`RISCV_HWPROBE_EXT_ZIMOP`: The Zimop May-Be-Operations extension is + supported as defined in the RISC-V ISA manual starting from commit + 58220614a5f ("Zimop is ratified/1.0"). + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index dda76a05420b..575b95744843 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -60,6 +60,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZACAS (1ULL << 34) #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) #define RISCV_HWPROBE_EXT_ZIHINTPAUSE (1ULL << 36) +#define RISCV_HWPROBE_EXT_ZIMOP (1ULL << 37) #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index 969ef3d59dbe..fc6f4238f0b3 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -112,6 +112,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZACAS); EXT_KEY(ZICOND); EXT_KEY(ZIHINTPAUSE); + EXT_KEY(ZIMOP); if (has_vector()) { EXT_KEY(ZVBB); From patchwork Tue Jun 4 12:45:36 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: 13685243 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 65501C25B78 for ; Tue, 4 Jun 2024 12:47:04 +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=G6sKCoisgl8ifCFIZBxFW8RELiEQVfL47H//yJuY5DY=; b=tahaSlH9S1D7VC FOOVcb0MnmMlgNBXwUJHX38gzrf6MHyGFWNEGXFuRGnslY4OoXt4rufclhAPb6xPodW533XhJxWo9 5th4tFBcpdBnIdTlp8ouATb5UbWTY+NJzx6Bi8W+gfVHrV0sluIyIqN+MQSbKMwANI7C9u28pmxQj rsrz/i6VMbP2H233iET4xSTuxBe3l5ltTKVkuJNj2XO8px2oLPlNatTKspNonmlPus73LhDUzY1Ja XP9Q5gZhBzaLyjWC08t1xMl/3GKPCKK4WZfMf8dXCzfJYhil3mZtbiAxi2hynqMcK5YRdq17WIcYi 7GYtI8NrxCDq0MVsZPYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZ7-00000002LcJ-1Q3f; Tue, 04 Jun 2024 12:47:01 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZ3-00000002LZM-3iIv for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:46:59 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1f4c043d2f6so1770395ad.2 for ; Tue, 04 Jun 2024 05:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505216; x=1718110016; 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=6mFZhmlMUdGr00o3b1f1nxWnxsIbMQJnxaGpqqSRdZE=; b=mw/kqOjzbTddqqdThDOoP5T3tUyfBFs3mLmiyYDS7Rbbg/3DPUW6CucH9sQG0q4Hf4 P7B3wZn1BIJb7to6g8D/qy0Oz95FBGi8DFfBhrJKLlufiesD7Lgjjjkzq1FJx9m5VmxF cizBCG2fZaHVROowGP+3pNMh5W+do4tqQVpkqyj3v17eFiFP/AUWgHw89052nArNwMjZ Qy8EPi+SZLgq5UQPvD0qbK3xR1RHPH5UL2z6yY3ljMqTQfRNvBrNtkxKfP04tGFtafro SkLUvwO1i0C/MFXOscwvvfBsr6NWVGm7D5DqSoHk4IWwoyV0fWJUPr1Md3co6p+GwDx9 FHdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505216; x=1718110016; 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=6mFZhmlMUdGr00o3b1f1nxWnxsIbMQJnxaGpqqSRdZE=; b=n4dk/ufyTSkTLDqMffgn1PzkS03frrA/SofqwoCHmcSeOrfMwWG8r2lmf8ClqdAUnY adZlr8aPdqW1jkDEpr+NijOF45IHBO4zvcsAHzTJhvT1h10UFJpI/FfL1y9nT5h+jo7j a/P2ySJz9aBFjIE08jRSK1M3XfGLhBWo0Ap2XC+amJldu9xrg76hVXz0yBf+9dGEAMuL 4DqZ0xOJbVjWE0ruGSvBcHfoNFM2u9nszhqBZqoQOl2pfvnW/AhXA9oXNnwFcNsmlwdo KpniXl6BEBI2N9OoP74yL7tqIZW8jAWY/Q2AavP0qlamabkLElOoCNkY6Lmhj6nF0UaV jXGQ== X-Forwarded-Encrypted: i=1; AJvYcCXzPhkawUTXoh8jZcBAk+F2tdi8RabRgFljWldqrl0eQHnAQK7ynhZXO8SHNyaieJV0+Y2HHziWyZzHPKdkz0cBaIu3W9pdYn4oXCex3aVp X-Gm-Message-State: AOJu0YyFb0FRT3RaTCmOzsNMTW7T9w1tI/QT+VJwkhk5zMmA6y+aPCH5 ejBdhSbWkS8+qC1nE990V/S22hR/zMwxWI6Tq4tu2ID/9+iRY00Ks29FNpnYgkU= X-Google-Smtp-Source: AGHT+IFM41pQHUuJV2gzPwT4wOW9apDVDvAoHL8KWfUvAyFLfhBEBPDzezVMzHLJE7/SomhB0oFg6Q== X-Received: by 2002:a17:902:ceca:b0:1f5:e635:21e9 with SMTP id d9443c01a7336-1f636ff9877mr138756065ad.2.1717505216018; Tue, 04 Jun 2024 05:46:56 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:46:55 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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 v6 04/16] RISC-V: KVM: Allow Zimop extension for Guest/VM Date: Tue, 4 Jun 2024 14:45:36 +0200 Message-ID: <20240604124550.3214710-5-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054657_968265_04DE329F X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. 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 Extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zimop extension for Guest/VM. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu_onereg.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index e878e7cc3978..db482ef0ae1e 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -168,6 +168,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, KVM_RISCV_ISA_EXT_SSCOFPMF, + KVM_RISCV_ISA_EXT_ZIMOP, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index c676275ea0a0..09f0aa92a4da 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -61,6 +61,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZIHINTNTL), KVM_ISA_EXT_ARR(ZIHINTPAUSE), KVM_ISA_EXT_ARR(ZIHPM), + KVM_ISA_EXT_ARR(ZIMOP), KVM_ISA_EXT_ARR(ZKND), KVM_ISA_EXT_ARR(ZKNE), KVM_ISA_EXT_ARR(ZKNH), @@ -143,6 +144,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZIHINTNTL: case KVM_RISCV_ISA_EXT_ZIHINTPAUSE: case KVM_RISCV_ISA_EXT_ZIHPM: + case KVM_RISCV_ISA_EXT_ZIMOP: case KVM_RISCV_ISA_EXT_ZKND: case KVM_RISCV_ISA_EXT_ZKNE: case KVM_RISCV_ISA_EXT_ZKNH: From patchwork Tue Jun 4 12:45:37 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: 13685244 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 5760CC25B7E for ; Tue, 4 Jun 2024 12:47:15 +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=x9OPrPW0BivpSAteL5v2T4RQl65hZfNnpWmnrM4TOL4=; b=ikz7UyvFodAYFo 8akjoFdpGxREeCkDTCPjHGSAq0y2vHZS74EKkLdg5JzIZybKKBG1zlK1aPh/2x1XuV1eYViwMzfbl Ax1As/vSdgbFPaZoR8I/df22sIfj/hfSg5L2Oj/yvCmcFB7+NQJFg9gnaA7q8orU7U8h7+WKpXBrq H0B/iR1J/F1Y4ajBpl8BTcS6xCzKb12JSb2iBX9CN3EJoBlU90YPgheTZyQAip3yoIMSMD3cWR1Ni 0E3+5n0pH1ceJ21wGlmlDEUdD3xYNz1Nq1SZuQdpvodNTC5mL6AbvuKjDMaOrjYarafnGQpCLtwmR PuNFBC6gy0dYhNnJ2Jrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZG-00000002Li1-26hM; Tue, 04 Jun 2024 12:47:10 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZD-00000002Lfn-280X for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:47:08 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-6c5c1838040so214568a12.2 for ; Tue, 04 Jun 2024 05:47:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505227; x=1718110027; 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=Thrzhyhf4n6WJYCWxQDF3hgG8fVFwwW9ccIOLsViJdE=; b=KnQjcjAQevZ34mh2LggXvvElBCSTPFEOQKiIpwdQ3jkVPZzjIkhxCtLu4d+MTNqtVB 5wCdjSYY0ZISSlwCfFomfkd68jF1oFgXeOopSUufadA/7A2SW7ADMG50U4p34jlcNra+ Ga2R59lXktd7ej6+LbbDw6lL1mNV9TGYp7m1kQ4Bcrkxp3sB6bvLPlJUDwbzDiJvtm50 QyzZ47cXlcxQtz79rKwz6sNtHpmTLAMgt+KzJ9n6fOMrGXUISa/eTgX1kD9UO6KLgOSG VKAWY7wyqrkuc8QShrca6aUbK2kBYwFqhI+ItsWkipNNskv+kdQH/wCWo50I8Cnj5euU k0nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505227; x=1718110027; 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=Thrzhyhf4n6WJYCWxQDF3hgG8fVFwwW9ccIOLsViJdE=; b=s7r64JUcnVb/KGl62B4br05vAwunu1mWlMN0C9q6N7Wht7hwhuHXo2pce6vaoYOcTP o1GE4gmrkI5oGUu29W8a3EZwYDse7Gmv2cFstkscQWaSGimKI0gFdVitxmHvbNzmLqQL gyyQ/tVpdosoL0Fz1IJgiB+c8OGCupcGqX9IwLpAJyVMTNpuYuxbF3ej4EN1yqCfihwC keADhWMaRIX5y8GPpqYfYLwdEdcBKSfxMfW2gbrqUwQhS0NU4xMw+n5ja0GNsR4BHnJK +yHq/xoX7UJ3oxazkfch1DWvq6mizGbZoMD8Us1LWEBHilfPYdH+QNYCNl2Vlz69YXB2 DE+A== X-Forwarded-Encrypted: i=1; AJvYcCV+OJb9SIaivEqjwgK9qNvV+zfNheqCzJunAU6+PKJEWZLk7ob3AKEks9zgSgzqj6KMqJzR8zaMZPC2bvynQA0Ml93y1WI29jmKOpm+G2Ug X-Gm-Message-State: AOJu0Yy/BgIolslZRPE1ToRs+00FlKQ48ZukmubC4dRp7bzvdSDFItfY aShXWEXJRPCsMmCKRN6TAU29+wACAp1E/GCAaduv4AgGmxNKqiYXUc3snLOfiF0= X-Google-Smtp-Source: AGHT+IEm3zrqTkaD1e80nTXtvyaFcCt9SvKc4tEHifCVXXNN3kdXJvNYmPz0ey9WWV7TKhbEhWGmJA== X-Received: by 2002:a05:6a21:789e:b0:1a7:91b0:9ba3 with SMTP id adf61e73a8af0-1b26f30dbb1mr14554711637.4.1717505226907; Tue, 04 Jun 2024 05:47:06 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:47:06 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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 v6 05/16] KVM: riscv: selftests: Add Zimop extension to get-reg-list test Date: Tue, 4 Jun 2024 14:45:37 +0200 Message-ID: <20240604124550.3214710-6-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054707_655663_02FBF6E1 X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. 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 The KVM RISC-V allows Zimop extension for Guest/VM so add this extension to get-reg-list test. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 222198dd6d04..8c8b109ce3ca 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -68,6 +68,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIHINTNTL: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIHINTPAUSE: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIHPM: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZIMOP: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKND: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKNE: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZKNH: @@ -434,6 +435,7 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(ZIHINTNTL), KVM_ISA_EXT_ARR(ZIHINTPAUSE), KVM_ISA_EXT_ARR(ZIHPM), + KVM_ISA_EXT_ARR(ZIMOP), KVM_ISA_EXT_ARR(ZKND), KVM_ISA_EXT_ARR(ZKNE), KVM_ISA_EXT_ARR(ZKNH), @@ -958,6 +960,7 @@ KVM_ISA_EXT_SIMPLE_CONFIG(zifencei, ZIFENCEI); KVM_ISA_EXT_SIMPLE_CONFIG(zihintntl, ZIHINTNTL); KVM_ISA_EXT_SIMPLE_CONFIG(zihintpause, ZIHINTPAUSE); KVM_ISA_EXT_SIMPLE_CONFIG(zihpm, ZIHPM); +KVM_ISA_EXT_SIMPLE_CONFIG(zimop, ZIMOP); KVM_ISA_EXT_SIMPLE_CONFIG(zknd, ZKND); KVM_ISA_EXT_SIMPLE_CONFIG(zkne, ZKNE); KVM_ISA_EXT_SIMPLE_CONFIG(zknh, ZKNH); @@ -1014,6 +1017,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_zihintntl, &config_zihintpause, &config_zihpm, + &config_zimop, &config_zknd, &config_zkne, &config_zknh, From patchwork Tue Jun 4 12:45:38 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: 13685245 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 02F52C25B7E for ; Tue, 4 Jun 2024 12:47:29 +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=aZLO2BnikTXHVa8e25SFk7jZ3MfMPmo6oxQAHXEyT40=; b=w4kkFqtoyM5RhX XgUn/+e+XJccTPTqkxqpOZhiFfFvgCmLke0R+RCRpQBph0P6bOcB3IkYMVBJrO0Oh8LiSexN5ZjLI jfivA3VA9YujA3AIBEb3obAhd/20hhwvxTFP9HddEZ6r1coYsl2CY6QMPUYt5eeTLz6Dx3W4ku37Z JyvwerEIa++oqEheEySOAyZE0WkZqlRkBNR7OaVKcjLKLTS4HgcDBkhCPztEHWHA+D/1xejETWKdy FliInLhpzMlvfdrcSENwLkIB9AIniQkb/TGZLrgkCmStHH6wNXoznj0M6Kg4rfQr/cvXrWywrzi2C Q4XrxBG85yZqRJkwNpfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZV-00000002Lts-2L2w; Tue, 04 Jun 2024 12:47:25 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZQ-00000002LoJ-3lL7 for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:47:23 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1f61cca4a17so3706305ad.2 for ; Tue, 04 Jun 2024 05:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505239; x=1718110039; 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=MDggCbJq5xAgdt5U/mnZ4/8n6MHnmjzG09lZvHegJVk=; b=oowqtNwFQjUGP5kjlT3VQAI2bTvgi/hniKu7IlNAFWZpAXS9Ccy6Nm/dvrPrWxeGn5 8sQCpEAIAzA8vL95DvDHfhZdBkbn5BU6h/hz+B376Ep9nIoyYMBtZNFtNMgVeCSM8rWy kNfIpkBnhUpFBzLvsatnKsexLpW9kbhjZXscFkQ7aNbuW01zTsT0bboZrADDcQWo9tQu ioYCIWDlGkeMSWDY0Z7/PjpUzLVU/vtzgRLPgeJWh6LEZSXxbozyf/CLey+abzFscUpt iW5MJkVLetLZVCoqk/P14edvapiyXxl1i63LjDbYTcOJCNzlg0hsUB+T2BCpRik6MaEr Bhng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505239; x=1718110039; 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=MDggCbJq5xAgdt5U/mnZ4/8n6MHnmjzG09lZvHegJVk=; b=Y8OEoKgv5/BzQxMf4TuEpnJ1klb/7mVHjmeDY5P8K+PZq/NIJhYbD42mJVZsTs8Th7 idLn/2E07IhlOJHJ8+uyYxmvrFBxmCuNBFbiTCDYLo/nDH0iIGRp3H3ZZjoY5z3LuiBD 2JSpX1X/PmRtQJVTw0KITRrA8+v55LWtSr7uV/RSIoL1DrhCQpVS6PfkSjMkIYqmibBq ZRmz0cDI9NipQ+8EkdLIPTm+yxaI0h0hr3nSqsfHByQwmeo7tnvCFpcuayGREz/Ai66m ZKSJQTtYa6Tr2F7twjj3DC64GPlt29K6/yqiCNeRdLz2wGB4qbI9jy2uV1wxwRVljpIS 0Fcw== X-Forwarded-Encrypted: i=1; AJvYcCU3EYMyuIr84QTq/mc07wSJAwBq4I0DnaVqO90xv7ie+pRAdQ2KsVXHIjzoXVw5c0C28V3I9PtP6VS2bW4Z4MjLS3M8Bok4BH6eY1rvw1NJ X-Gm-Message-State: AOJu0YwuGeYNZxdxaCoXe/obghDdBCBUCswxkX9x+joc6A66PflACjhi f1RjgCixKupI0rgjwfzAuOP5TN2LhpXgp7x6iz7O3BNRb3T5GOMvm0MXk+LmUSM= X-Google-Smtp-Source: AGHT+IGQMTJjGTRyExe5WucoZYIN7+QmoxG6l4x/LYMJNGm+8SMfBCqkxppCIaA9Kdjsd1UwcvgPcQ== X-Received: by 2002:a17:902:c952:b0:1f3:453:2c82 with SMTP id d9443c01a7336-1f6370c3578mr132333805ad.4.1717505238694; Tue, 04 Jun 2024 05:47:18 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:47:18 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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, Conor Dooley , Charlie Jenkins Subject: [PATCH v6 06/16] dt-bindings: riscv: add Zca, Zcf, Zcd and Zcb ISA extension description Date: Tue, 4 Jun 2024 14:45:38 +0200 Message-ID: <20240604124550.3214710-7-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054721_033054_FAB45445 X-CRM114-Status: GOOD ( 10.63 ) 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 Add description for Zca, Zcf, Zcd and Zcb extensions which are part the Zc* standard extensions for code size reduction. Additional validation rules are added since Zcb depends on Zca, Zcf, depends on Zca and F, Zcd depends on Zca and D and finally, Zcf can not be present on rv64. Signed-off-by: Clément Léger Reviewed-by: Conor Dooley Reviewed-by: Charlie Jenkins --- .../devicetree/bindings/riscv/extensions.yaml | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 616370318a66..81bce4fa2424 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -220,6 +220,38 @@ properties: instructions as ratified at commit 6d33919 ("Merge pull request #158 from hirooih/clmul-fix-loop-end-condition") of riscv-bitmanip. + - const: zca + description: | + The Zca extension part of Zc* standard extensions for code size + reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on + RV64 as it contains no instructions") of riscv-code-size-reduction, + merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed + of zc.adoc to src tree."). + + - const: zcb + description: | + The Zcb extension part of Zc* standard extensions for code size + reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on + RV64 as it contains no instructions") of riscv-code-size-reduction, + merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed + of zc.adoc to src tree."). + + - const: zcd + description: | + The Zcd extension part of Zc* standard extensions for code size + reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on + RV64 as it contains no instructions") of riscv-code-size-reduction, + merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed + of zc.adoc to src tree."). + + - const: zcf + description: | + The Zcf extension part of Zc* standard extensions for code size + reduction, as ratified in commit 8be3419c1c0 ("Zcf doesn't exist on + RV64 as it contains no instructions") of riscv-code-size-reduction, + merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed + of zc.adoc to src tree."). + - const: zfa description: The standard Zfa extension for additional floating point @@ -489,5 +521,51 @@ properties: Registers in the AX45MP datasheet. https://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf + allOf: + # Zcb depends on Zca + - if: + contains: + const: zcb + then: + contains: + const: zca + # Zcd depends on Zca and D + - if: + contains: + const: zcd + then: + allOf: + - contains: + const: zca + - contains: + const: d + # Zcf depends on Zca and F + - if: + contains: + const: zcf + then: + allOf: + - contains: + const: zca + - contains: + const: f + +allOf: + # Zcf extension does not exist on rv64 + - if: + properties: + riscv,isa-extensions: + contains: + const: zcf + riscv,isa-base: + contains: + const: rv64i + then: + properties: + riscv,isa-extensions: + not: + contains: + const: zcf + additionalProperties: true ... From patchwork Tue Jun 4 12:45:39 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: 13685246 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 57D9CC25B78 for ; Tue, 4 Jun 2024 12:47:38 +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=6fHYMfX3eNxBam9bnuq5zc3pr6EMuXsdNw0lQbg6zhk=; b=bVsZCee4aU3kPs 9FcFcetDcQQhyH0XbPyudb1E30TFqRT1B5KxTK6bwXZkEyqMa0rmsnRyH+f4BIbVs3KhPKPDNsh+p /zug51L+viK6b8ikveIw1oNZ+2B0FLZCGdQGJSBMOG5wGrmxbidX1OFQCTBsjkPs9Pz7684Ninjdn /jdITviEZAniMq5QAzqI0PAu8BnhCoo4wgvnYskT6wcWwKGvvWfrIM7swhYEd21uaY4vk8Wn4HlOu ievlI5ZwbmuWSjW+AJq1ypNNXwsBskT9UjRSU5r9XKneozUqDuCt2Eui2mdLYc1ttivXCGd8Hlu3g HLAOHDjLSEMRDYdbCoqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZf-00000002M1a-1xGi; Tue, 04 Jun 2024 12:47:35 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZc-00000002Lxq-0d9p for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:47:33 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1f63b38e0b7so955355ad.0 for ; Tue, 04 Jun 2024 05:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505250; x=1718110050; 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=x+CSuJDThn+PB5fFUO+TXaSj7k0OUg7Xto567Lc3KzY=; b=ZBoooQxbQ1N1Bzvvww3ysO3sM3tjxgGlxDD7+kBRrS+Wijo5rwuYNjGFi2nE8WHg5+ s5oMWMxIwD25RX4H4XxH5yQlwEbLw6Hzo2nYqRS25eWxdIQRGNZ/drBU/AJztHDDeo2P aBD1oWxBJ74CDOUOcOpSu7ZbUTcXX5CKWrRsvFSqZ9IO8jZy25+WcZBPjUhxrsLMCLiS Lj/kvPfba1LmnngjvtJbz+KTYjWUCcIbpR6DDEki9YWuNkPfz/gIEsKcBjogB7bEVl1D XkzLwSKnLUlXEDIxIpL780vAmr2dj0QhMp27VB9tmkAwUyAVWkvjoes8yEF3UX7Tex2F MDfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505250; x=1718110050; 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=x+CSuJDThn+PB5fFUO+TXaSj7k0OUg7Xto567Lc3KzY=; b=Qd2Try9Mykfq5q9kbQHIasKPohNBE7sVtIzTc3FxDD/1vQPNi3Y/39VmbtvPV6vHXL 1U1Iu5TNMTjiso89cfswO2Kal6QS2+V25wRZqVTHcEGuNjQJ2i95x+8UH+B/F+W6Kxk+ njvJqbHgj0gxISbPd3Eiz9v4Y5qrdw9l3pMlJZpBdzW8IRK5rV9U1EdsW8kI6OIRMo8B qlA6mETfT7ivWhmj/+jM0kyuNC3KGyKe+ZY6KXiHnnixeziEc72LIHCVAFO+/iV3oD+1 C4dgz/1UH2KrMpeZ8fdT/NNvBz/0KzNXegbGUTeb+Xtm3C3TE6q6Xea3PGPjHCYTANpD Z8xQ== X-Forwarded-Encrypted: i=1; AJvYcCW3najJMWcHSDNNgiINQXnSVo4TJLNKsASF9B2svKIA6GxTnjo6KK10Z1cn2Ptbayq19GHvsxAda/3dwrkpLMe8SE8mONVBd56a4RSL8R4t X-Gm-Message-State: AOJu0Yxbm943yPCveB5b2262nzt4MYzXZczBbadm/yw7J/1IdAPqI4vw se40eCsiseS4g5mysa1zYViGrc7pOkcZaOSKeOeyCV9p7Z80pyu8kv3WFzsXxdA= X-Google-Smtp-Source: AGHT+IEy/LhwmIRZMH6aWZXrXK2uhRFHFVKmWf3P2U0Efxg286NPvZUcvjcoIBkiD+YHR73bgi+W9w== X-Received: by 2002:a17:902:f68b:b0:1f6:39cc:46cb with SMTP id d9443c01a7336-1f639cc52ccmr132729485ad.5.1717505249853; Tue, 04 Jun 2024 05:47:29 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.47.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:47:29 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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, Conor Dooley Subject: [PATCH v6 07/16] riscv: add ISA extensions validation callback Date: Tue, 4 Jun 2024 14:45:39 +0200 Message-ID: <20240604124550.3214710-8-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054732_297978_37DD4141 X-CRM114-Status: GOOD ( 29.34 ) 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 Since a few extensions (Zicbom/Zicboz) already needs validation and future ones will need it as well (Zc*) add a validate() callback to struct riscv_isa_ext_data. This require to rework the way extensions are parsed and split it in two phases. First phase is isa string or isa extension list parsing and consists in enabling all the extensions in a temporary bitmask (source isa) without any validation. The second step "resolves" the final isa bitmap, handling potential missing dependencies. The mechanism is quite simple and simply validate each extension described in the source bitmap before enabling it in the resolved isa bitmap. validate() callbacks can return either 0 for success, -EPROBEDEFER if extension needs to be validated again at next loop. A previous ISA bitmap is kept to avoid looping multiple times if an extension dependencies are never satisfied until we reach a stable state. In order to avoid any potential infinite looping, allow looping a maximum of the number of extension we handle. Zicboz and Zicbom extensions are modified to use this validation mechanism. Signed-off-by: Clément Léger Reviewed-by: Conor Dooley --- arch/riscv/include/asm/cpufeature.h | 1 + arch/riscv/kernel/cpufeature.c | 221 +++++++++++++++++----------- 2 files changed, 136 insertions(+), 86 deletions(-) diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h index 347805446151..000796c2d0b1 100644 --- a/arch/riscv/include/asm/cpufeature.h +++ b/arch/riscv/include/asm/cpufeature.h @@ -70,6 +70,7 @@ struct riscv_isa_ext_data { const char *property; const unsigned int *subset_ext_ids; const unsigned int subset_ext_size; + int (*validate)(const struct riscv_isa_ext_data *data, const unsigned long *isa_bitmap); }; extern const struct riscv_isa_ext_data riscv_isa_ext[]; diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index bd1597578fbc..d20e236cec8b 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -72,51 +72,55 @@ bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, unsigned i } EXPORT_SYMBOL_GPL(__riscv_isa_extension_available); -static bool riscv_isa_extension_check(int id) +static int riscv_ext_zicbom_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) { - switch (id) { - case RISCV_ISA_EXT_ZICBOM: - if (!riscv_cbom_block_size) { - pr_err("Zicbom detected in ISA string, disabling as no cbom-block-size found\n"); - return false; - } else if (!is_power_of_2(riscv_cbom_block_size)) { - pr_err("Zicbom disabled as cbom-block-size present, but is not a power-of-2\n"); - return false; - } - return true; - case RISCV_ISA_EXT_ZICBOZ: - if (!riscv_cboz_block_size) { - pr_err("Zicboz detected in ISA string, disabling as no cboz-block-size found\n"); - return false; - } else if (!is_power_of_2(riscv_cboz_block_size)) { - pr_err("Zicboz disabled as cboz-block-size present, but is not a power-of-2\n"); - return false; - } - return true; - case RISCV_ISA_EXT_INVALID: - return false; + if (!riscv_cbom_block_size) { + pr_err("Zicbom detected in ISA string, disabling as no cbom-block-size found\n"); + return -EINVAL; } + if (!is_power_of_2(riscv_cbom_block_size)) { + pr_err("Zicbom disabled as cbom-block-size present, but is not a power-of-2\n"); + return -EINVAL; + } + return 0; +} - return true; +static int riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (!riscv_cboz_block_size) { + pr_err("Zicboz detected in ISA string, disabling as no cboz-block-size found\n"); + return -EINVAL; + } + if (!is_power_of_2(riscv_cboz_block_size)) { + pr_err("Zicboz disabled as cboz-block-size present, but is not a power-of-2\n"); + return -EINVAL; + } + return 0; } -#define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size) { \ - .name = #_name, \ - .property = #_name, \ - .id = _id, \ - .subset_ext_ids = _subset_exts, \ - .subset_ext_size = _subset_exts_size \ +#define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) { \ + .name = #_name, \ + .property = #_name, \ + .id = _id, \ + .subset_ext_ids = _subset_exts, \ + .subset_ext_size = _subset_exts_size, \ + .validate = _validate \ } -#define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0) +#define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, NULL) /* Used to declare pure "lasso" extension (Zk for instance) */ #define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \ - _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, ARRAY_SIZE(_bundled_exts)) + _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ + ARRAY_SIZE(_bundled_exts), NULL) /* Used to declare extensions that are a superset of other extensions (Zvbb for instance) */ #define __RISCV_ISA_EXT_SUPERSET(_name, _id, _sub_exts) \ - _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts)) + _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), NULL) +#define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \ + _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate) static const unsigned int riscv_zk_bundled_exts[] = { RISCV_ISA_EXT_ZBKB, @@ -247,8 +251,10 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(c, RISCV_ISA_EXT_c), __RISCV_ISA_EXT_DATA(v, RISCV_ISA_EXT_v), __RISCV_ISA_EXT_DATA(h, RISCV_ISA_EXT_h), - __RISCV_ISA_EXT_SUPERSET(zicbom, RISCV_ISA_EXT_ZICBOM, riscv_xlinuxenvcfg_exts), - __RISCV_ISA_EXT_SUPERSET(zicboz, RISCV_ISA_EXT_ZICBOZ, riscv_xlinuxenvcfg_exts), + __RISCV_ISA_EXT_SUPERSET_VALIDATE(zicbom, RISCV_ISA_EXT_ZICBOM, riscv_xlinuxenvcfg_exts, + riscv_ext_zicbom_validate), + __RISCV_ISA_EXT_SUPERSET_VALIDATE(zicboz, RISCV_ISA_EXT_ZICBOZ, riscv_xlinuxenvcfg_exts, + riscv_ext_zicboz_validate), __RISCV_ISA_EXT_DATA(zicntr, RISCV_ISA_EXT_ZICNTR), __RISCV_ISA_EXT_DATA(zicond, RISCV_ISA_EXT_ZICOND), __RISCV_ISA_EXT_DATA(zicsr, RISCV_ISA_EXT_ZICSR), @@ -310,33 +316,93 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext); -static void __init match_isa_ext(const struct riscv_isa_ext_data *ext, const char *name, - const char *name_end, struct riscv_isainfo *isainfo) +static void riscv_isa_set_ext(const struct riscv_isa_ext_data *ext, unsigned long *bitmap) { - if ((name_end - name == strlen(ext->name)) && - !strncasecmp(name, ext->name, name_end - name)) { - /* - * If this is a bundle, enable all the ISA extensions that - * comprise the bundle. - */ - if (ext->subset_ext_size) { - for (int i = 0; i < ext->subset_ext_size; i++) { - if (riscv_isa_extension_check(ext->subset_ext_ids[i])) - set_bit(ext->subset_ext_ids[i], isainfo->isa); + if (ext->id != RISCV_ISA_EXT_INVALID) + set_bit(ext->id, bitmap); + + for (int i = 0; i < ext->subset_ext_size; i++) { + if (ext->subset_ext_ids[i] != RISCV_ISA_EXT_INVALID) + set_bit(ext->subset_ext_ids[i], bitmap); + } +} + +static const struct riscv_isa_ext_data *riscv_get_isa_ext_data(unsigned int ext_id) +{ + for (int i = 0; i < riscv_isa_ext_count; i++) { + if (riscv_isa_ext[i].id == ext_id) + return &riscv_isa_ext[i]; + } + + return NULL; +} + +/* + * "Resolve" a source ISA bitmap into one that matches kernel configuration as + * well as correct extension dependencies. Some extensions depends on specific + * kernel configuration to be usable (V needs CONFIG_RISCV_ISA_V for instance) + * and this function will actually validate all the extensions provided in + * source_isa into the resolved_isa based on extensions validate() callbacks. + */ +static void __init riscv_resolve_isa(unsigned long *source_isa, + unsigned long *resolved_isa, unsigned long *this_hwcap, + unsigned long *isa2hwcap) +{ + bool loop; + const struct riscv_isa_ext_data *ext; + DECLARE_BITMAP(prev_resolved_isa, RISCV_ISA_EXT_MAX); + int max_loop_count = riscv_isa_ext_count, ret; + unsigned int bit; + + do { + loop = false; + if (max_loop_count-- < 0) { + pr_err("Failed to reach a stable ISA state\n"); + return; + } + bitmap_copy(prev_resolved_isa, resolved_isa, RISCV_ISA_EXT_MAX); + for_each_set_bit(bit, source_isa, RISCV_ISA_EXT_MAX) { + ext = riscv_get_isa_ext_data(bit); + if (!ext) + continue; + + if (ext->validate) { + ret = ext->validate(ext, resolved_isa); + if (ret == -EPROBE_DEFER) { + loop = true; + continue; + } else if (ret) { + /* Disable the extension entirely */ + clear_bit(ext->id, source_isa); + continue; + } } + + set_bit(ext->id, resolved_isa); + /* No need to keep it in source isa now that it is enabled */ + clear_bit(ext->id, source_isa); + + /* Single letter extensions get set in hwcap */ + if (ext->id < RISCV_ISA_EXT_BASE) + *this_hwcap |= isa2hwcap[ext->id]; } + } while (loop && memcmp(prev_resolved_isa, resolved_isa, sizeof(prev_resolved_isa))); +} - /* - * This is valid even for bundle extensions which uses the RISCV_ISA_EXT_INVALID id - * (rejected by riscv_isa_extension_check()). - */ - if (riscv_isa_extension_check(ext->id)) - set_bit(ext->id, isainfo->isa); +static void __init match_isa_ext(const char *name, const char *name_end, unsigned long *bitmap) +{ + for (int i = 0; i < riscv_isa_ext_count; i++) { + const struct riscv_isa_ext_data *ext = &riscv_isa_ext[i]; + + if ((name_end - name == strlen(ext->name)) && + !strncasecmp(name, ext->name, name_end - name)) { + riscv_isa_set_ext(ext, bitmap); + break; + } } } -static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct riscv_isainfo *isainfo, - unsigned long *isa2hwcap, const char *isa) +static void __init riscv_parse_isa_string(const char *isa, unsigned long *bitmap) { /* * For all possible cpus, we have already validated in @@ -349,7 +415,7 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc while (*isa) { const char *ext = isa++; const char *ext_end = isa; - bool ext_long = false, ext_err = false; + bool ext_err = false; switch (*ext) { case 's': @@ -389,7 +455,6 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc * character itself while eliminating the extensions version number. * A simple re-increment solves this problem. */ - ext_long = true; for (; *isa && *isa != '_'; ++isa) if (unlikely(!isalnum(*isa))) ext_err = true; @@ -469,17 +534,8 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc if (unlikely(ext_err)) continue; - if (!ext_long) { - int nr = tolower(*ext) - 'a'; - 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); - } + match_isa_ext(ext, ext_end, bitmap); } } @@ -506,6 +562,7 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) for_each_possible_cpu(cpu) { struct riscv_isainfo *isainfo = &hart_isa[cpu]; unsigned long this_hwcap = 0; + DECLARE_BITMAP(source_isa, RISCV_ISA_EXT_MAX) = { 0 }; if (acpi_disabled) { node = of_cpu_device_node_get(cpu); @@ -528,7 +585,7 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) } } - riscv_parse_isa_string(&this_hwcap, isainfo, isa2hwcap, isa); + riscv_parse_isa_string(isa, source_isa); /* * These ones were as they were part of the base ISA when the @@ -536,10 +593,10 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) * unconditionally where `i` is in riscv,isa on DT systems. */ if (acpi_disabled) { - set_bit(RISCV_ISA_EXT_ZICSR, isainfo->isa); - set_bit(RISCV_ISA_EXT_ZIFENCEI, isainfo->isa); - set_bit(RISCV_ISA_EXT_ZICNTR, isainfo->isa); - set_bit(RISCV_ISA_EXT_ZIHPM, isainfo->isa); + set_bit(RISCV_ISA_EXT_ZICSR, source_isa); + set_bit(RISCV_ISA_EXT_ZIFENCEI, source_isa); + set_bit(RISCV_ISA_EXT_ZICNTR, source_isa); + set_bit(RISCV_ISA_EXT_ZIHPM, source_isa); } /* @@ -552,9 +609,11 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) */ if (acpi_disabled && boot_vendorid == THEAD_VENDOR_ID && boot_archid == 0x0) { this_hwcap &= ~isa2hwcap[RISCV_ISA_EXT_v]; - clear_bit(RISCV_ISA_EXT_v, isainfo->isa); + clear_bit(RISCV_ISA_EXT_v, source_isa); } + riscv_resolve_isa(source_isa, isainfo->isa, &this_hwcap, isa2hwcap); + /* * All "okay" hart should have same isa. Set HWCAP based on * common capabilities of every "okay" hart, in case they don't @@ -583,6 +642,7 @@ static int __init riscv_fill_hwcap_from_ext_list(unsigned long *isa2hwcap) unsigned long this_hwcap = 0; struct device_node *cpu_node; struct riscv_isainfo *isainfo = &hart_isa[cpu]; + DECLARE_BITMAP(source_isa, RISCV_ISA_EXT_MAX) = { 0 }; cpu_node = of_cpu_device_node_get(cpu); if (!cpu_node) { @@ -602,22 +662,11 @@ static int __init riscv_fill_hwcap_from_ext_list(unsigned long *isa2hwcap) ext->property) < 0) continue; - if (ext->subset_ext_size) { - for (int j = 0; j < ext->subset_ext_size; j++) { - if (riscv_isa_extension_check(ext->subset_ext_ids[j])) - set_bit(ext->subset_ext_ids[j], isainfo->isa); - } - } - - if (riscv_isa_extension_check(ext->id)) { - set_bit(ext->id, isainfo->isa); - - /* Only single letter extensions get set in hwcap */ - if (strnlen(riscv_isa_ext[i].name, 2) == 1) - this_hwcap |= isa2hwcap[riscv_isa_ext[i].id]; - } + riscv_isa_set_ext(ext, source_isa); } + riscv_resolve_isa(source_isa, isainfo->isa, &this_hwcap, isa2hwcap); + of_node_put(cpu_node); /* From patchwork Tue Jun 4 12:45:40 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: 13685247 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 15966C25B78 for ; Tue, 4 Jun 2024 12:47:53 +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=QivfiTTHjK4g7BpnrhTrL+A9N/GfDoJGQlHWDzTL86Q=; b=jDvAHgL6r9vlWR dq9mTlM60qd0SAbQr3lUEdJZW5y9ahVqlpGCwJWlX2fGlbv1t9B6+CK6XNfJR5EtuxcaNi+6JhU1Y q7Khd8zjnvRNMy6Mgy9dBtcoyZfEi0GV+vPVCM3gryGXgk7MckBilJ+DRPY+8aAL2IccqHNEk9wbP Dzu27UgUo3AHdtaCWAu5NZd3BbL+RBgw6oD3w/AVHvmjvOf56W7/3Cmc1mWDPPSFXgT9kVXJ2IspZ mcSBETvFRd2bbZruk3Z0s3+arjdB+cvPEIzEcnz4+GR4/vAGAwUhj40mbX/Iv2b6Ej1LY3LJNwKQD 1XOjx1yTV6Vy5UwIgaMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZr-00000002MBB-3V1V; Tue, 04 Jun 2024 12:47:47 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZn-00000002M6o-2jks for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:47:45 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1f6176b0420so3740505ad.0 for ; Tue, 04 Jun 2024 05:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505261; x=1718110061; 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=MjP9cWqi8MF5LcHAVib0g8zUfroe29LCYWJfLV/r52Y=; b=qAeLLAX1Z4xXV2UaaR1nwOGOafn1I/o5vtjQDcE1tPttNk4yGTWFRR55D0oRO83lyy 2Qws2p9Wve86eJz/gTEWMaQH4d5XJ9j6jJQLYhoQ8RTgTJsVBfaM1UIB4XYnOC6gzPW+ NOYfnEa3L4EsIX0q1HWKG2C9aBel1nVY1wJzNAjWoPPBTgrRTFysYMrbdNs9fbpqAK92 I/Mt9+Jpz8r9vNc9S++gyShQA5BTvwWe1yQK0m+2c3eNwhMamBSZM4YBoi8EHHJ5bObs j0kans5i1X1D9IUei8OaAS04e3DbX0uzq+vTQpPwaEO6C48uHhyxnTdbGgpLezHCd2We p4xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505261; x=1718110061; 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=MjP9cWqi8MF5LcHAVib0g8zUfroe29LCYWJfLV/r52Y=; b=D5d4HVH5wKThkyoEDMtiToDSrN7wv8cCwfjHzTdA+WICfRBHw8uTC4kMGS02RPf/48 cNifCZjvdIvqykFoayBh1Y8/EjSdQLnNqDLGEOVtzqmTIIXInNadZgEm1ouhuJWy9/US 4OU9Icmh+QUG0GHGvIUpu5SK11/6bn960UIuVClvtWLKacw2r5kSjqpZd3lkC7a7tI1B S5G4GFtVxtIrhuHzPslvoX9mQk97MnkiePi3nuLTo9dm1UEoGTT156811MGoy/ey5faB hZ7voOoZwuP+r33kWWoKQLmps2N7WL4h7ytfBh2Kd4aB3s4NB5/xwp93nwHTMG3ZUwJJ k46w== X-Forwarded-Encrypted: i=1; AJvYcCWFrIEi5eLcewtaDbw84neSo5l1olH7hJ89ZVpOEoYvuQTCVzYdYzFEp/hIeeJKCDr9WwOvCl4cX9Z4VqNiMDUmtc+8JFxWz5NyW543T3vj X-Gm-Message-State: AOJu0YyFhd6aelUcd5MLELDtuR9cJrCQMC6uy9YccXEsVG1FChJ1PcqQ 2KglYLBRjYr/k1PeEq4SELq9JzT5isTkXvzWO5I4xLN+nLZQm/WYrp1VMcjeGEM= X-Google-Smtp-Source: AGHT+IE8wijIs7nBE2lAM+asVyiMEjL4UrorzZ1e540mUci5kPZaEXedGsRaMEEhVJegjQvm1F51AQ== X-Received: by 2002:a17:902:ec8c:b0:1f2:ffbc:7156 with SMTP id d9443c01a7336-1f636fcf230mr129979715ad.1.1717505261548; Tue, 04 Jun 2024 05:47:41 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:47:41 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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, Conor Dooley Subject: [PATCH v6 08/16] riscv: add ISA parsing for Zca, Zcf, Zcd and Zcb Date: Tue, 4 Jun 2024 14:45:40 +0200 Message-ID: <20240604124550.3214710-9-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054743_789637_B1C86DBB X-CRM114-Status: GOOD ( 16.58 ) 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 The Zc* standard extension for code reduction introduces new extensions. This patch adds support for Zca, Zcf, Zcd and Zcb. Zce, Zcmt and Zcmp are left out of this patch since they are targeting microcontrollers/ embedded CPUs instead of application processors. Signed-off-by: Clément Léger Reviewed-by: Conor Dooley --- arch/riscv/include/asm/hwcap.h | 5 +++- arch/riscv/kernel/cpufeature.c | 55 +++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 543e3ea2da0e..3915c9cb088b 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -82,7 +82,10 @@ #define RISCV_ISA_EXT_ZACAS 73 #define RISCV_ISA_EXT_XANDESPMU 74 #define RISCV_ISA_EXT_ZIMOP 75 - +#define RISCV_ISA_EXT_ZCA 76 +#define RISCV_ISA_EXT_ZCB 77 +#define RISCV_ISA_EXT_ZCD 78 +#define RISCV_ISA_EXT_ZCF 79 #define RISCV_ISA_EXT_XLINUXENVCFG 127 #define RISCV_ISA_EXT_MAX 128 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index d20e236cec8b..53c7ca590a22 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -111,6 +111,9 @@ static int riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, #define __RISCV_ISA_EXT_DATA(_name, _id) _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, NULL) +#define __RISCV_ISA_EXT_DATA_VALIDATE(_name, _id, _validate) \ + _RISCV_ISA_EXT_DATA(_name, _id, NULL, 0, _validate) + /* Used to declare pure "lasso" extension (Zk for instance) */ #define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) \ _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ @@ -122,6 +125,37 @@ static int riscv_ext_zicboz_validate(const struct riscv_isa_ext_data *data, #define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \ _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate) +static int riscv_ext_zca_depends(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA)) + return 0; + + return -EPROBE_DEFER; +} +static int riscv_ext_zcd_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) && + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_d)) + return 0; + + return -EPROBE_DEFER; +} + +static int riscv_ext_zcf_validate(const struct riscv_isa_ext_data *data, + const unsigned long *isa_bitmap) +{ + if (IS_ENABLED(CONFIG_64BIT)) + return -EINVAL; + + if (__riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_ZCA) && + __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_f)) + return 0; + + return -EPROBE_DEFER; +} + static const unsigned int riscv_zk_bundled_exts[] = { RISCV_ISA_EXT_ZBKB, RISCV_ISA_EXT_ZBKC, @@ -202,6 +236,21 @@ static const unsigned int riscv_xlinuxenvcfg_exts[] = { RISCV_ISA_EXT_XLINUXENVCFG }; +/* + * Zc* spec states that: + * - C always implies Zca + * - C+F implies Zcf (RV32 only) + * - C+D implies Zcd + * + * These extensions will be enabled and then validated depending on the + * availability of F/D RV32. + */ +static const unsigned int riscv_c_exts[] = { + RISCV_ISA_EXT_ZCA, + RISCV_ISA_EXT_ZCF, + RISCV_ISA_EXT_ZCD, +}; + /* * The canonical order of ISA extension names in the ISA string is defined in * chapter 27 of the unprivileged specification. @@ -248,7 +297,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __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), - __RISCV_ISA_EXT_DATA(c, RISCV_ISA_EXT_c), + __RISCV_ISA_EXT_SUPERSET(c, RISCV_ISA_EXT_c, riscv_c_exts), __RISCV_ISA_EXT_DATA(v, RISCV_ISA_EXT_v), __RISCV_ISA_EXT_DATA(h, RISCV_ISA_EXT_h), __RISCV_ISA_EXT_SUPERSET_VALIDATE(zicbom, RISCV_ISA_EXT_ZICBOM, riscv_xlinuxenvcfg_exts, @@ -267,6 +316,10 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __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), + __RISCV_ISA_EXT_DATA(zca, RISCV_ISA_EXT_ZCA), + __RISCV_ISA_EXT_DATA_VALIDATE(zcb, RISCV_ISA_EXT_ZCB, riscv_ext_zca_depends), + __RISCV_ISA_EXT_DATA_VALIDATE(zcd, RISCV_ISA_EXT_ZCD, riscv_ext_zcd_validate), + __RISCV_ISA_EXT_DATA_VALIDATE(zcf, RISCV_ISA_EXT_ZCF, riscv_ext_zcf_validate), __RISCV_ISA_EXT_DATA(zba, RISCV_ISA_EXT_ZBA), __RISCV_ISA_EXT_DATA(zbb, RISCV_ISA_EXT_ZBB), __RISCV_ISA_EXT_DATA(zbc, RISCV_ISA_EXT_ZBC), From patchwork Tue Jun 4 12:45:41 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: 13685248 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 A143DC27C54 for ; Tue, 4 Jun 2024 12:48:01 +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=mWciAhU+GYv+EBf9ChiL8xuImgEczE8cvuoa/6InCyw=; b=QwYXUiAqO9JDk5 23HG0xzUF5hEKSlurtdZOtjc+lE5+YmgkOG94jt6WM+6qnF0oFYp5JX2OzT/keJWt2il2wtiHqvDo p6RAhQGTrzzMabL3+iTuzrBxEg4g/QHEuhkqE4xbJS5AhgJa6UqnLN1iNUDiCW/VsBe0hLKjDbvdT Qq6nFHgXPmAb1bHts/idpxFGb81VXklJKnghF6gVtXqsxf71BVv/MvTCHUTL78RSExyxnePW5a00I i16I+MGtrjkhpemd4MokIYlz/XBBsIJBldnO4ZLfIoDRFEXzYn1DX8rM2mxxn2M3QntoqmRcc83YI 4towQTJQiQ75v1tcsXEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETa1-00000002MJq-0hqI; Tue, 04 Jun 2024 12:47:57 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZy-00000002MH5-005n for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:47:55 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1f63b38e0b7so955775ad.0 for ; Tue, 04 Jun 2024 05:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505273; x=1718110073; 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=I/zDxQ1wNU0fShOzqJmwZ3vgRBHHUpydDqOkR2GCFDo=; b=hBtD7Mps6y82cd1+VJR4O0aoUsBmZGnnXIqyKCSvZSPW9CehYqAHd1Np7tK/JOtxhi hFnmUsZZnjcqGAZwp0tvoa71WGawm4idKwI6jd1CZRea/2lFvuXmbSlS+s00LlCFVl1l 8TbGIwlOGCTEKm2heHDEICHywisErcFtKtlpBcmMH5PWv+C5G/dDtthNdRW4LmDe478/ aUxTjyIMM9LZkyMdVikrUUN6CLM9BG0WeUsbqrPxHEcl3PB/j3N47x/iw0nRjZVfSCQ8 4cLdELCKVyy+qxZYwvXchc598lbUxLU6zpCpYFZrhVHk5Njjw2r3FRu0jSt3kQWmDVLJ O6QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505273; x=1718110073; 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=I/zDxQ1wNU0fShOzqJmwZ3vgRBHHUpydDqOkR2GCFDo=; b=Ioa2QWjNTCDwDinAY5KtMOAxYNTpk7VjpztNA84RKmJO46HfNoTrT/l669VCbq5UOF JXKJypOCDjmTfq5ppwAYmbJEi2jDXMwVfhXDvG/UfHCeaa30GAWWbql9ZSphVwSZGDjO zeAGlIUwJcs13EapruAH83QYdwpxyZwfGOYQTBsi0mHSGJETJ7IlE0rnKzIaD5AHZUyz LEls2sTMxj2POwfu12eO6oeavZ26LknrcsmSRTJ2oWfAKqayYVMGBqV1RbgqOGRjqu4U QBNM2Zi/T8V+aIizZoixkcbgTnmbbNrJ2YJQpwDGPjaZeM84cchQ3lMrwhNK45KWCh3c lGjQ== X-Forwarded-Encrypted: i=1; AJvYcCXBNVzFytOCKjAAu8h3oXwutVd6itLwGjfnkYbGP2iKUS2IMuin2MyUDP0PU9x1llLaMnGuw6VeO3sYg72S0ue4+KdFHg+8q5IuFtl+twmG X-Gm-Message-State: AOJu0YwCg5mpWh/dMJ16MK7eDsz5kGMaz9c4PAYU23YegRD+19qVGIuZ CIwe6QagQUpPLoHPk6juv3GD/9HfvCpZ35XuR2W4a8mRxjCB7vz8P2pkFlAZ8lE= X-Google-Smtp-Source: AGHT+IHL5IgKhDmX6Kc3c3T4qmZjDYR+RyEsuG7i3u6/l8X2M2rVeZab4G99cMOKYRyDxecIvsMepQ== X-Received: by 2002:a17:902:f68b:b0:1f6:39cc:46cb with SMTP id d9443c01a7336-1f639cc52ccmr132738995ad.5.1717505273278; Tue, 04 Jun 2024 05:47:53 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:47:52 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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, Charlie Jenkins Subject: [PATCH v6 09/16] riscv: hwprobe: export Zca, Zcf, Zcd and Zcb ISA extensions Date: Tue, 4 Jun 2024 14:45:41 +0200 Message-ID: <20240604124550.3214710-10-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054754_080639_1C2AC7B8 X-CRM114-Status: GOOD ( 10.92 ) 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 Export Zca, Zcf, Zcd and Zcb ISA extension through hwprobe. Signed-off-by: Clément Léger Reviewed-by: Charlie Jenkins --- Documentation/arch/riscv/hwprobe.rst | 20 ++++++++++++++++++++ arch/riscv/include/uapi/asm/hwprobe.h | 4 ++++ arch/riscv/kernel/sys_hwprobe.c | 4 ++++ 3 files changed, 28 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index 48be38e0b788..cad84f51412d 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -196,6 +196,26 @@ The following keys are defined: supported as defined in the RISC-V ISA manual starting from commit 58220614a5f ("Zimop is ratified/1.0"). + * :c:macro:`RISCV_HWPROBE_EXT_ZCA`: The Zca extension part of Zc* standard + extensions for code size reduction, as ratified in commit 8be3419c1c0 + ("Zcf doesn't exist on RV64 as it contains no instructions") of + riscv-code-size-reduction. + + * :c:macro:`RISCV_HWPROBE_EXT_ZCB`: The Zcb extension part of Zc* standard + extensions for code size reduction, as ratified in commit 8be3419c1c0 + ("Zcf doesn't exist on RV64 as it contains no instructions") of + riscv-code-size-reduction. + + * :c:macro:`RISCV_HWPROBE_EXT_ZCD`: The Zcd extension part of Zc* standard + extensions for code size reduction, as ratified in commit 8be3419c1c0 + ("Zcf doesn't exist on RV64 as it contains no instructions") of + riscv-code-size-reduction. + + * :c:macro:`RISCV_HWPROBE_EXT_ZCF`: The Zcf extension part of Zc* standard + extensions for code size reduction, as ratified in commit 8be3419c1c0 + ("Zcf doesn't exist on RV64 as it contains no instructions") of + riscv-code-size-reduction. + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index 575b95744843..fba3d74154b1 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -61,6 +61,10 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZICOND (1ULL << 35) #define RISCV_HWPROBE_EXT_ZIHINTPAUSE (1ULL << 36) #define RISCV_HWPROBE_EXT_ZIMOP (1ULL << 37) +#define RISCV_HWPROBE_EXT_ZCA (1ULL << 38) +#define RISCV_HWPROBE_EXT_ZCB (1ULL << 39) +#define RISCV_HWPROBE_EXT_ZCD (1ULL << 40) +#define RISCV_HWPROBE_EXT_ZCF (1ULL << 41) #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index fc6f4238f0b3..11def345a42d 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -113,6 +113,8 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZICOND); EXT_KEY(ZIHINTPAUSE); EXT_KEY(ZIMOP); + EXT_KEY(ZCA); + EXT_KEY(ZCB); if (has_vector()) { EXT_KEY(ZVBB); @@ -133,6 +135,8 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZFH); EXT_KEY(ZFHMIN); EXT_KEY(ZFA); + EXT_KEY(ZCD); + EXT_KEY(ZCF); } #undef EXT_KEY } From patchwork Tue Jun 4 12:45:42 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: 13685249 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 59848C25B78 for ; Tue, 4 Jun 2024 12:48:19 +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=HuCwWAG96qb/fgvSCjwG0o7YAgDAW2R5mjzRE7dnexU=; b=m4kH5kuImz2osD Gsb9mSy9Fam3+nKJAvhWZ6zDTP7mvTVD2Ed++tI2d1HymqzQII5tXVlno+o6xYPyEf31OzvuVuNTB D9Xq/wmJT6kBm5V1SX24VanfRCgI81lOo9ulx8MlYxTVDPZ6WriyKQ2cqHox2jCqienI59USMHBMP rtQixWLhPiUbjBnE96K/5cWndbZeK4FZW9PFuSXtEGfkDwciMLkuagvR/aiWtHttYJZstoxG8OBPP pO8bgG3qFxR7mJe8OF5MROkhGcWNmkYwClza3B0V8W8RSvcCt0mKrSgxyxpt02YY1CzA+CN+Wx3Qq I81l2N5pncNiglM1yyxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETaJ-00000002MXF-1Jys; Tue, 04 Jun 2024 12:48:16 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETaC-00000002MOt-3dmD for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:48:12 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-6c8b6e40ea6so337686a12.3 for ; Tue, 04 Jun 2024 05:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505284; x=1718110084; 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=Gs55v193sdHVl0rBHs/P2Y++ez1UXnaq9pE10ZEsFSw=; b=2nDvWW00yp99ZBmS1PfA6/9wxpttVU/LDTExQ2XX66ZUU+J6jM9w8ac7fi6LcL3xg2 7DQlRQSJyNxuYF9ZwFtKvkEE7+S9OYAfRZ+dlKP38CVBBla3y5cuAk68t80l1leqqKI6 OBZ/9sOEt9VsXo9GhEVkXmEX8o4tgMg3eOuiSeSx7GvSx49PIC02+BrmKnj0riHCfmqo pKkGCTS7D85reP0uHuol7VUaTRu6DHPsCgNCyyetq74s+8OfG9rontUzKwFTU9AfSYCU jHYcirvTzC3ghwgdbnMto95SvEUKmlhL+FKq3bVBBniDKQ0kr0e6M+KDF2PGifzftYyK Vyqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505284; x=1718110084; 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=Gs55v193sdHVl0rBHs/P2Y++ez1UXnaq9pE10ZEsFSw=; b=Ubj0t5ByMKM/EvSoIEk9Lmmr5tQ0946oOB7LmeF5bl9tM5seT5MyZHLdiC+gEmYd5H tZPyA8yjl1AVOnAANSDKSrVEtrCfJe+GQ9r9uVqjpH45kyQOT2/mRUIapI6+SAOvwBKJ Yf3lqTtS///SeXVOLHAyGA2F1ysHoWfVd+X2gX3BbVVyZ/5zRCpvkmyrSWZV673Wlk2I CnKP6GEhA0hOwNQkmKJkPNz/Q8Cp0PF9a1yjAhJEBuV/838wPuoJxY6FQEDgNjAIzS9J expRojPP9hXI1WaiwGcndpc/R2Zqn8t3x2aXrJ/mKaICWMlK6naf9J5qZ1i+odXaPK/X TGKw== X-Forwarded-Encrypted: i=1; AJvYcCVNnDdJW9E8l5F1oMQyCEphkrn+VdqAhvBGJb/CKkVp6rXLSl2sVEKpS8ixYrC3LoRZXERfYlFVCMwY7oRsBF0SmaETqF7HyOT6pYxW3nD1 X-Gm-Message-State: AOJu0Yxhsqs3iEsvYlOQSNcCohBxHGegsfAhY1wauacMCdD2dqWgAxFf G49MoXQEbfIvcZsDsFlI5Q7H9KlVsY6AWrZJRs7gBoCm6Y6+E09doccqscix6UM= X-Google-Smtp-Source: AGHT+IEsMZJmc0GRfwnGJXawzgQpJTLYGNhY37MgDtgsSTzGDBp6EPH/FvyBY3q5m6FyKXNVAkhfqw== X-Received: by 2002:a05:6a21:99a6:b0:1af:a4a5:a26a with SMTP id adf61e73a8af0-1b26f0f25c3mr13691235637.1.1717505284134; Tue, 04 Jun 2024 05:48:04 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:48:03 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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 v6 10/16] RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM Date: Tue, 4 Jun 2024 14:45:42 +0200 Message-ID: <20240604124550.3214710-11-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054808_962164_B6908DAF X-CRM114-Status: UNSURE ( 9.82 ) X-CRM114-Notice: Please train this message. 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 Extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zca, Zcf, Zcd and Zcb extensions for Guest/VM. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 4 ++++ arch/riscv/kvm/vcpu_onereg.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index db482ef0ae1e..71b17a6799e6 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -169,6 +169,10 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZACAS, KVM_RISCV_ISA_EXT_SSCOFPMF, KVM_RISCV_ISA_EXT_ZIMOP, + KVM_RISCV_ISA_EXT_ZCA, + KVM_RISCV_ISA_EXT_ZCB, + KVM_RISCV_ISA_EXT_ZCD, + KVM_RISCV_ISA_EXT_ZCF, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index 09f0aa92a4da..f68b15b15f0e 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -49,6 +49,10 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZBKC), KVM_ISA_EXT_ARR(ZBKX), KVM_ISA_EXT_ARR(ZBS), + KVM_ISA_EXT_ARR(ZCA), + KVM_ISA_EXT_ARR(ZCB), + KVM_ISA_EXT_ARR(ZCD), + KVM_ISA_EXT_ARR(ZCF), KVM_ISA_EXT_ARR(ZFA), KVM_ISA_EXT_ARR(ZFH), KVM_ISA_EXT_ARR(ZFHMIN), @@ -134,6 +138,10 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZBKC: case KVM_RISCV_ISA_EXT_ZBKX: case KVM_RISCV_ISA_EXT_ZBS: + case KVM_RISCV_ISA_EXT_ZCA: + case KVM_RISCV_ISA_EXT_ZCB: + case KVM_RISCV_ISA_EXT_ZCD: + case KVM_RISCV_ISA_EXT_ZCF: case KVM_RISCV_ISA_EXT_ZFA: case KVM_RISCV_ISA_EXT_ZFH: case KVM_RISCV_ISA_EXT_ZFHMIN: From patchwork Tue Jun 4 12:45:43 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: 13685250 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 2600EC25B7E for ; Tue, 4 Jun 2024 12:48: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=uitfSKrwAyM4GqfiQ1wNGG6HYoPffQQPr0sT4wZ5Css=; b=VywGLvpTJU3X/P 9pTXEBqHXjqdNyhN/2KpuL5v2OFGyFbIUU/oNXPxTsdyUr4/NdSF81WpykKxBWqTnHzqJ30sBPAa4 eWauJtwiUHBXObWnJgI7OlXnVPiOmp5QrdhQISgOToUn2lc/B/FaAjQIU2xDSl0DbKIMQ0sXAtN1d wZLas53LvkRGEtQ6kzL4DW4ibOMRUBLTavbkkCvq7YfYQXcd8EB6SxZZ99xB/wX38TBdg0QhBYo+R QhclqwfrJCFi17+gzvDlchtCAGQDFMLr7A31iHMbuSp8sW1Sc/P0J6CYTOO7014KjJrlDCBQ81RnX h6dz4Lro0mg7w7mibYhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETaQ-00000002Mc4-49h0; Tue, 04 Jun 2024 12:48:23 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETaM-00000002MYF-2xSI for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:48:21 +0000 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-6c2d04b0833so485623a12.2 for ; Tue, 04 Jun 2024 05:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505296; x=1718110096; 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=pl7e/Uw2TsjVm5w2UCcg19dOQoVq7golKlAiO1RXFLo=; b=ED85k72XdLEuPCWucamhD0inreZ+l7nuWXb9mGA3E3T8jT0yPItR9P3+U6cyxqdTqn RfWpCMAY7Y+Vr0PHV3zvjilKzVD0P4YnLPPAdxu5Dxd5LP55+YjljECdw72m4yaf41SE L3/c6c+wWGIuinDpHP1IRul5Lbvo16MM5GnMEm6dH5x+zBPTIUx80B4sXQYF6rHKf1Nc Z+gpNcIPjOyX9rAidavK+2EvlVUipEj82hmVSGknhMjoHvfx1cgj2c+wVH/eQLAkgMjk C+AJNfA4v4y/OBZJxttQreJu6odelQXpu8GNQ8t+TQIRUr81Ppskvznm+d2juKwOxpyo eN3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505296; x=1718110096; 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=pl7e/Uw2TsjVm5w2UCcg19dOQoVq7golKlAiO1RXFLo=; b=hAT6xipcqS4SxSaahlNzXLVZ02kIRVIkSdCvYSR7s48Q34DYRewAtXhxz1DnwNCt1q yY0LLNaxZCtclYllOWya7N6TkbB5x/7gvH70zZnRBnRE+INLFh3LFvIcSh5qK1sA6Bpu H0mR5PDO0lFhprE27fwa93hY9zSvKVCd5fSkk1NGDZMtU7hXKGF8FGB2yBKh53aNa+oW pUIcavA5EHAyN0GOKMXkftlUjoFm/iCv8OjFge51nYy3Li68HP8dErb1wKXw8jenoxoC YRf6WCowS/94MxDwHkmg22Y4e84Jd1y4mEZX6AMV/RiLS9Rb9v/HG9103mr/f9q6a9Bk 7mNg== X-Forwarded-Encrypted: i=1; AJvYcCXUTQZK9kfazOxsKid/Fo7iOhQaSru15JV2JXnnfw467D1nnpdhnzKDdYjHoK34TOrKuJvcRjLEe3ZFnrg0YdQEXrjudSRqG0LM7Zzf/rbc X-Gm-Message-State: AOJu0YyREiDqkI3wwigTb14kq5JMA5piP5bB9kCSOjdwO+Acxsv0a5XU kaJWpLWGpzxDy/HnFaK6PJ6ifwtEiuiJ7mqSQ1rS9OnXECs2SCAMaDgsJK1SyqY= X-Google-Smtp-Source: AGHT+IHDavkX6lYzEzmyDr28AhE3WeR2xg+16B5HaBHrs9r6naCfkGg0GyGTT03skFYsojMtzKntzA== X-Received: by 2002:a17:902:6541:b0:1f6:226f:cc50 with SMTP id d9443c01a7336-1f69425b1e5mr23526605ad.6.1717505296634; Tue, 04 Jun 2024 05:48:16 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:48:16 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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 v6 11/16] KVM: riscv: selftests: Add some Zc* extensions to get-reg-list test Date: Tue, 4 Jun 2024 14:45:43 +0200 Message-ID: <20240604124550.3214710-12-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054818_863839_B6C34150 X-CRM114-Status: UNSURE ( 9.26 ) X-CRM114-Notice: Please train this message. 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 The KVM RISC-V allows Zca, Zcf, Zcd and Zcb extensions for Guest/VM so add these extensions to get-reg-list test. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 8c8b109ce3ca..864a701ef6c3 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -56,6 +56,10 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBKC: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBKX: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZBS: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCA: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCB: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCD: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCF: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFA: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFH: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFHMIN: @@ -423,6 +427,10 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(ZBKC), KVM_ISA_EXT_ARR(ZBKX), KVM_ISA_EXT_ARR(ZBS), + KVM_ISA_EXT_ARR(ZCA), + KVM_ISA_EXT_ARR(ZCB), + KVM_ISA_EXT_ARR(ZCD), + KVM_ISA_EXT_ARR(ZCF), KVM_ISA_EXT_ARR(ZFA), KVM_ISA_EXT_ARR(ZFH), KVM_ISA_EXT_ARR(ZFHMIN), @@ -948,6 +956,10 @@ KVM_ISA_EXT_SIMPLE_CONFIG(zbkb, ZBKB); KVM_ISA_EXT_SIMPLE_CONFIG(zbkc, ZBKC); KVM_ISA_EXT_SIMPLE_CONFIG(zbkx, ZBKX); KVM_ISA_EXT_SIMPLE_CONFIG(zbs, ZBS); +KVM_ISA_EXT_SIMPLE_CONFIG(zca, ZCA), +KVM_ISA_EXT_SIMPLE_CONFIG(zcb, ZCB), +KVM_ISA_EXT_SIMPLE_CONFIG(zcd, ZCD), +KVM_ISA_EXT_SIMPLE_CONFIG(zcf, ZCF), KVM_ISA_EXT_SIMPLE_CONFIG(zfa, ZFA); KVM_ISA_EXT_SIMPLE_CONFIG(zfh, ZFH); KVM_ISA_EXT_SIMPLE_CONFIG(zfhmin, ZFHMIN); @@ -1005,6 +1017,10 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_zbkc, &config_zbkx, &config_zbs, + &config_zca, + &config_zcb, + &config_zcd, + &config_zcf, &config_zfa, &config_zfh, &config_zfhmin, From patchwork Tue Jun 4 12:45:44 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: 13685251 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 5B65EC25B78 for ; Tue, 4 Jun 2024 12:48:38 +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=vxwIa5J8VNZRTjMarZerMYVxWtOg5TyhO6GSlBERKSM=; b=BoqlyawaQDacLh 5uc6hbB5p8yb2RwGh9/48Ir/rc28hemT9WjoGZK7+o0XkWFlIEMq2C2HYro4r/SmJiVgzf4HzEhIO jcO34Jt+6+Kq3EAvK5Fc70o0tFQoq248ET4U7zFTrDLbtD2TOiJ9ViXPTpMZUkIDQ+J7jtKWysF8I 62IuC/l+p4teGN6LmZlg8YB8Ct3dewk1gFYknjMW8XBRBKM3CsT413oUGE4hQWaE9hAhKFAnHI8XZ Z7lFZsQGyx8EcdCUJAzHnH+sLy5FND2O1e6lx1PTgeOB39OznFpp1fvj+jTeJtBj2YQovspU91OL0 u5fDWjLRvPYCSqH0TsDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETac-00000002MlK-0a2G; Tue, 04 Jun 2024 12:48:34 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETaY-00000002MiM-07Tk for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:48:32 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-64ecc2f111dso648828a12.2 for ; Tue, 04 Jun 2024 05:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505309; x=1718110109; 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=9khxHJjeUp7ScoJAIwKVgLlPlLRtKzhDoxFrt0oOXSQ=; b=GfIp+up18tcumCijF0mZHrpneWzCPl8HOiHtVqwI0K188dLRpIa2ttCzE9jAbM4TYc ahXbIph9QnG2noiNpPop0MsdIm1OFqmYsGa+hFlKqpYYsilqSvN6KWgnxHsEzkDA/a3Q sK6eKJ0+pKECIa/uTkF4qWpODXdcFlBXpYacmaciwqjU2Pyuj7owz6rHIEG4rK4Y3qTg KNQIrA6oSxrXdj/K1b7w12wXHE8Yy/BLm5GLSnIxUXm2HqYm3rpYQ7M6UFVtZD0e6EE5 pXv6ZUrQD0WL/hGqPlKB9lz1ZAxiZZEFLmtyPo+5D+odoTAeMKVVQBZk0uOBaCAl1jG2 dj1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505309; x=1718110109; 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=9khxHJjeUp7ScoJAIwKVgLlPlLRtKzhDoxFrt0oOXSQ=; b=kOM6cOIY696gbSvELGAsQHr+LIL6W5tT40Zzb5xBPNbJn+9Rd44y/BRPntvKQTF3i2 iHjan592pZAaT5cWuzFY3T97qe0vjJZ8nut8l67L7RyBKJMK57irCau1KOihF21YJtA+ LHHQTd1T1+IMgNTNNEtKeHXkC2b/EDgjU11LHbmpN87UhfY3ylHVgJfbWIzfbJiMbsLf 38nmaUvN/yTb7TZSNF/GLoS+edWrSxoiqrRxe9sdkyomiPW/3VXj9vHcltnW9FLWZGxN K0JxBMa3PKcY8qVLvczPb/ngHusfRsHPn/s1XRl2EWrQpfJi7iiiltZewAdgYhdWMfFG Mrag== X-Forwarded-Encrypted: i=1; AJvYcCUthCogC1yYKos9ylqVi+FxNjHWv62QDsb7FDH58h3WTKZfNj0CYsN2S9ykg2jBuB9rlPsCr8BQM1jtQ3/ATBn9yAzpwkoN0ibhhg2zbgJz X-Gm-Message-State: AOJu0YzeSdumBeGJ3HL4i3UZ8z0SVKRXBiEkgbBW9AcpdoviDR0gMX4a 8wdoWl8lqjzRxp7GA9VVi/zHDgIFM/5zfO6oM3W+Cyx140YUEyJEiNa/WL7F9FE= X-Google-Smtp-Source: AGHT+IF51TDxFJuuXTneP6toFhIUeHG25cd2Wj/tvfzjNoZSiWv7LIVIBSZsIbu/lBStuW2IKttk4w== X-Received: by 2002:a17:902:ea0e:b0:1f2:fbc8:643c with SMTP id d9443c01a7336-1f6370f2847mr137386785ad.3.1717505309207; Tue, 04 Jun 2024 05:48:29 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:48:28 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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, Conor Dooley Subject: [PATCH v6 12/16] dt-bindings: riscv: add Zcmop ISA extension description Date: Tue, 4 Jun 2024 14:45:44 +0200 Message-ID: <20240604124550.3214710-13-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054830_147426_44899154 X-CRM114-Status: UNSURE ( 9.42 ) X-CRM114-Notice: Please train this message. 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 Add description for the Zcmop (Compressed May-Be-Operations) ISA extension which was ratified in commit c732a4f39a4c ("Zcmop is ratified/1.0") of the riscv-isa-manual. Signed-off-by: Clément Léger Acked-by: Conor Dooley --- .../devicetree/bindings/riscv/extensions.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 81bce4fa2424..1952d20b8996 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -252,6 +252,11 @@ properties: merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed of zc.adoc to src tree."). + - const: zcmop + description: + The standard Zcmop extension version 1.0, as ratified in commit + c732a4f39a4 ("Zcmop is ratified/1.0") of the riscv-isa-manual. + - const: zfa description: The standard Zfa extension for additional floating point @@ -549,6 +554,13 @@ properties: const: zca - contains: const: f + # Zcmop depends on Zca + - if: + contains: + const: zcmop + then: + contains: + const: zca allOf: # Zcf extension does not exist on rv64 From patchwork Tue Jun 4 12:45:45 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: 13685252 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 73567C25B7E for ; Tue, 4 Jun 2024 12:48:52 +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=6bVDsWBaeVJDqKhA4WTqd4jcdNBQvOVzzkgJxCkffl8=; b=q8nwULcR4eSH5i UJ0pg+KVsZs1D7Pl7YXXmjXekZmN9Jk+02iWHk72baGH3hJ5TyynFwAyC3A83Sc80uaH6CLyKO/pb 6+PFdaAgtfnC/lRqZhqdTItfh0/HMxa9at7y9HzaMa/mYiUHNV3nNpOJQg0Ej+xSfxXCWTNt3iV4E XShrs8+HE2fd/SQLv7msVDQD8XY6rEFd72o3MhMk7aQEignWseumevF6PSn3/DtgZCGvTwBYRLz/R EXOpf7KGxeus/OujdkjFMG5hH4aM0rf3bQyuQH2LcgKNGrZB5TnRYI66tWBVd2q/ir5Vil49e+hod 0lY7/9Io/eiADPi6mq1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETaq-00000002Mwf-3w8c; Tue, 04 Jun 2024 12:48:48 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETam-00000002Mrh-1iZ6 for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:48:46 +0000 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-6c9cd96e485so313895a12.3 for ; Tue, 04 Jun 2024 05:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505322; x=1718110122; 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=+f8PvBYYePzU1WhfRZSwb8yDs46YibFa/aQ6ldPx3Ns=; b=2dmS3eLP134vNtcAkpf20jkQ6BG/LXsZR8GXfnwpYqpWKBrukUXpJQ+Z+5eCThlrbZ Mq0zm+xbDu52RCHtCWTEJLEk6gUWYQOFLyxOEK2OkxW/gCVPAmd6PHobyGofO+Yus9iN lG2NZyLFExY+iU8BJLE9e2Zd/xYyX5/XpM8I+VVnYxhBuUYVB7hweCBjTpdwjwYQYsa0 tGoB6pAbN3ZH6SyxQ7utAmc8XSZ32ji5meNovP+sNTGxgmRA1pentqsURzmIDBLJMNiZ c5eCpuxykvO/3PRkFqMCbPS6VQ9nDMCsLeXhayc/YgjyUnWERnA2b9ATQCKUHmuVO+vX Unkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505322; x=1718110122; 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=+f8PvBYYePzU1WhfRZSwb8yDs46YibFa/aQ6ldPx3Ns=; b=F6w6KS9ypbApZ6Gw+JVvTQ7VcPGckDzA6QkCILTG1moFRTA/e9uLaphBg1oEynSy4g 2gxu/FUmfpUY0C6u22HMUKYr3UF+sxBk5FWA5xz+wLlg009iqWYcxbdzGZMpGh3ciozJ ZMG7gz1STtPzHu+rnbeGp1f8Lnqy5YKBBHpYCJgCpkIIi0VS0oDtTLCpkYEDP2/F9Bho F2djrqpZDbkH7uT+JNSNYomOnaZntg4BWEfK2yQxxi8h8zlwmKp/qyoVVxtT3+fqkHpl 7S1vvqF1hUaMUJwmK5Z6V7l/OskF74Q9ZJEkjoS9IytOGSntAZP5XYJY/jbmvHsrcmfK H9fw== X-Forwarded-Encrypted: i=1; AJvYcCWxJEd45tr9Bzk7ePHq754uqEHo0H51RgMvg9B7/O4B0U7TOFEmRlDjyU0CuO5q0kYAxVjoAh3XheC5sTpU/Cp+7yOy3iO1YEJq40/SyDZZ X-Gm-Message-State: AOJu0Yzo86JztTnOKK74ZICZJEGC9k+JhEIW8h5e6A2sM/oMHORAKPG7 9kojh4LlGt/Qlg3v/Z1UhWrlYuS3TvFIKiVsRXJaFzByVaPPUC0s2Pd35Ld5T/M= X-Google-Smtp-Source: AGHT+IHlZckxUbCS2xW6q2DtBaj93CInAhGV+KC/Lja0MHjxnG9sUtL/5KteefRmvNyH0j8QM/rGkQ== X-Received: by 2002:a05:6a21:789b:b0:1aa:68c4:3271 with SMTP id adf61e73a8af0-1b2a46a884dmr2408655637.3.1717505322181; Tue, 04 Jun 2024 05:48:42 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:48:41 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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, Conor Dooley , Charlie Jenkins Subject: [PATCH v6 13/16] riscv: add ISA extension parsing for Zcmop Date: Tue, 4 Jun 2024 14:45:45 +0200 Message-ID: <20240604124550.3214710-14-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054844_607576_23C1F518 X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. 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 Add parsing for Zcmop ISA extension which was ratified in commit c732a4f39a4c ("Zcmop is ratified/1.0") of the riscv-isa-manual. Signed-off-by: Clément Léger Reviewed-by: Conor Dooley Reviewed-by: Charlie Jenkins --- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 3915c9cb088b..8606b164c696 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -86,6 +86,7 @@ #define RISCV_ISA_EXT_ZCB 77 #define RISCV_ISA_EXT_ZCD 78 #define RISCV_ISA_EXT_ZCF 79 +#define RISCV_ISA_EXT_ZCMOP 80 #define RISCV_ISA_EXT_XLINUXENVCFG 127 #define RISCV_ISA_EXT_MAX 128 diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 53c7ca590a22..ab2953245609 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -320,6 +320,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA_VALIDATE(zcb, RISCV_ISA_EXT_ZCB, riscv_ext_zca_depends), __RISCV_ISA_EXT_DATA_VALIDATE(zcd, RISCV_ISA_EXT_ZCD, riscv_ext_zcd_validate), __RISCV_ISA_EXT_DATA_VALIDATE(zcf, RISCV_ISA_EXT_ZCF, riscv_ext_zcf_validate), + __RISCV_ISA_EXT_DATA_VALIDATE(zcmop, RISCV_ISA_EXT_ZCMOP, riscv_ext_zca_depends), __RISCV_ISA_EXT_DATA(zba, RISCV_ISA_EXT_ZBA), __RISCV_ISA_EXT_DATA(zbb, RISCV_ISA_EXT_ZBB), __RISCV_ISA_EXT_DATA(zbc, RISCV_ISA_EXT_ZBC), From patchwork Tue Jun 4 12:45:46 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: 13685253 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 C24CAC25B78 for ; Tue, 4 Jun 2024 12:49:03 +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=x/XUvS6I6XuuufEngtTm0AehSGaw9/dvfugwQpwtNEo=; b=QJWzM/6WvdDc2t qNy2nQ5g79OehdXvgOthdxjqe7kHDLBiFcIvtR0pCJx2gdLj6OtP9IhXgRkTmge+1idssB1/73C0I wGzLM89S8xHI9Y2xSGpJxYpHd9S1n2nTOhwjtEQFf0xon0SHme2DA4iSR8vR+Afeu0f3S796wZWEF 2G9oVqI8B733KCAMbJ+GROipR43L2TyyNI1FOC0wyn6ZF3h+550Dfcha4VHiEJ+IvGTsoS8QJxBSj OJCprxUdsbd59mCn2bHxi30lViW74qru7yIuunOx+7D8hA9nd0N/ZvV0eSxmStbhtE6a6Xq3izdCG C2T+IQR/GPsibsm7avZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETb1-00000002N4o-0ljt; Tue, 04 Jun 2024 12:48:59 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETax-00000002N1h-1orT for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:48:57 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1f60a17e3e7so5009985ad.1 for ; Tue, 04 Jun 2024 05:48:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505334; x=1718110134; 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=lMpkyLkaSRVaEO/feaH2dKMkG1i5I5KHxmVTKeHtvyc=; b=EkM7jTS5aLqO1zquXXaAPe7ZTDkKlO0RCCUloIVgukP61plnOGiSnUBkuI64dOhl9b xylXfWpvqMRGt3XjR3gvzYf6K+bpNjSjcihmw8Zup0DlM1Ndz5aaZO3bmBV99tKO0GOw +S+yiC3PZJe8R1xcVNjpPaqhkYmidIK+GrENgjagTORZGp5GyTWqIdrle581s7ZZDQYK ODCgQ37wRsA+dxpqaw6+dM3W5wCBB2N865dybmHg3TbMZkSU4Ragce/kKhCtsGZTJZyu TVGCk97PMwxKtgR5k9FGwWeGO/8t4RF2mxuDPLmYfCabXW2TubJetU05euSjJteSTzER PbrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505334; x=1718110134; 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=lMpkyLkaSRVaEO/feaH2dKMkG1i5I5KHxmVTKeHtvyc=; b=vHTtY9OVDJD+yVzzVgQNKpRl8sDXnQ08DmZG1l8tph8l7gkeYbbNNWFq1PqTjwBBsW 1mF+MqLMTi8cK4rFKHwq+v2WVBWLcXhfokyMEmOh5Fhgwi5YInPHnvI3pFDsy54sksU5 hszLKn2doQ3z8AsTjYrA4Us7heCDbAs74y9BdqPi7yMqejyXPOy3/+IAIcWgyg/XJ/DQ uoM63k6Fe1/Y7RF0r/dEE7Mk3iUiSM9Oa6o+rMWhq96kWlUyiLFjm0ObzrnvCWVJq3/w CGQUr7WhyzQdtuytkx3PL2kmcTl1yq+gUmhcgMomxYqs8Zgo0Lk0Hm/CeG4eqFk9ttdd GoMg== X-Forwarded-Encrypted: i=1; AJvYcCWaIKLjHNKe8s8tYwa1jPq7wUSX7rsLJdmk/KDtnw3BOf6Wp2yfjMfWQSy3+ZqShkeaDBNkahr8BHLsQRCgcl2bZHj3atW11SjEKLJt0ril X-Gm-Message-State: AOJu0YxKYQbz6+LpcQHizKQc7ujDY95MzDCML6EzjoZvGjH8McQG/b7N MXo7xJ7ft0buN0MeyPFiUhOm7gp9zjXPse0gkJoflAugLrdclPFNiwJjtugXIJc= X-Google-Smtp-Source: AGHT+IEtbTTmo55M3xpRAMSX5FY5FOioHf0mp6/inxXLLycdHmKwuuvj+1pWBqBBB5zpqi2TeoLukg== X-Received: by 2002:a17:902:ec8c:b0:1f2:ffbc:7156 with SMTP id d9443c01a7336-1f636fcf230mr130005385ad.1.1717505334634; Tue, 04 Jun 2024 05:48:54 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:48:54 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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 v6 14/16] riscv: hwprobe: export Zcmop ISA extension Date: Tue, 4 Jun 2024 14:45:46 +0200 Message-ID: <20240604124550.3214710-15-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054855_634401_7FB33864 X-CRM114-Status: GOOD ( 11.25 ) 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 Export Zcmop ISA extension through hwprobe. Signed-off-by: Clément Léger --- Documentation/arch/riscv/hwprobe.rst | 4 ++++ arch/riscv/include/uapi/asm/hwprobe.h | 1 + arch/riscv/kernel/sys_hwprobe.c | 1 + 3 files changed, 6 insertions(+) diff --git a/Documentation/arch/riscv/hwprobe.rst b/Documentation/arch/riscv/hwprobe.rst index cad84f51412d..9a77b7d14539 100644 --- a/Documentation/arch/riscv/hwprobe.rst +++ b/Documentation/arch/riscv/hwprobe.rst @@ -216,6 +216,10 @@ The following keys are defined: ("Zcf doesn't exist on RV64 as it contains no instructions") of riscv-code-size-reduction. + * :c:macro:`RISCV_HWPROBE_EXT_ZCMOP`: The Zcmop May-Be-Operations extension is + supported as defined in the RISC-V ISA manual starting from commit + c732a4f39a4 ("Zcmop is ratified/1.0"). + * :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: A bitmask that contains performance information about the selected set of processors. diff --git a/arch/riscv/include/uapi/asm/hwprobe.h b/arch/riscv/include/uapi/asm/hwprobe.h index fba3d74154b1..480d7bb01088 100644 --- a/arch/riscv/include/uapi/asm/hwprobe.h +++ b/arch/riscv/include/uapi/asm/hwprobe.h @@ -65,6 +65,7 @@ struct riscv_hwprobe { #define RISCV_HWPROBE_EXT_ZCB (1ULL << 39) #define RISCV_HWPROBE_EXT_ZCD (1ULL << 40) #define RISCV_HWPROBE_EXT_ZCF (1ULL << 41) +#define RISCV_HWPROBE_EXT_ZCMOP (1ULL << 42) #define RISCV_HWPROBE_KEY_CPUPERF_0 5 #define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) #define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c index 11def345a42d..34c95eaf8cd1 100644 --- a/arch/riscv/kernel/sys_hwprobe.c +++ b/arch/riscv/kernel/sys_hwprobe.c @@ -115,6 +115,7 @@ static void hwprobe_isa_ext0(struct riscv_hwprobe *pair, EXT_KEY(ZIMOP); EXT_KEY(ZCA); EXT_KEY(ZCB); + EXT_KEY(ZCMOP); if (has_vector()) { EXT_KEY(ZVBB); From patchwork Tue Jun 4 12:45:47 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: 13685254 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 284A4C25B7E for ; Tue, 4 Jun 2024 12:49:17 +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=SDUWkDOg9otj+QxdD37tlWYU+JkzgG3o+9jEI3NnYN8=; b=H5eBPJQbnEil9S 6WXD/Hi7OpSGYe56MIPECc7zjbOf4LWcERVBS25JItrZ8JIVjKE/NuBrFMMo6Bp2tZ8W8pcDjkGIG ASgQejgV6781a/dKweCV1IIfJQYTd1gCs12NFtCyKa0U84RC4PTrhQZgNWSH2wMS8qro1sWcFyWzh jPcYNiDjhS5GdxsdGrET2sTpWxDmkYVAgb1Ozm7mB6tvqrBwT6hJVSuqN5HcY/jAc31sxnl3nMAmI DamNy2LFpCeSYbsld7YBScqsvZbMUVSPQOrIXs6hnQ9zTFy1+0NBo4mFw/EB8TlN0ASa9jVTt8Ow3 ur6lZUOA7VRi6b8XjTCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETbF-00000002NDj-3xu7; Tue, 04 Jun 2024 12:49:13 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETbC-00000002NA6-17KI for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:49:12 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-6d125d826f4so202990a12.0 for ; Tue, 04 Jun 2024 05:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505348; x=1718110148; 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=6H32tM/kIq9tLTuMJ+qVcoNAPrEuAu35f6jcL7aj1B8=; b=0vfw7lseH9PyvVWxRS+a0CpZt2ISHVVIoj7/xovxFaK60uRZQaVNYVfGHc+7UEJM4o i8XufBghkBs4cdm9HXFQGMoS46VkmrY997QSFFHiW6SekQGLeIaqHcKcaISwRPlLihOB tS5j3MCCNsZIkYn3yiSLLZNJ6cpJOSE3PhPYYRsX0pWJShqXnKkT7SkjQunUWoc1zvLr hReJm+zOO+Htu0XdWpg/Nn/tlZJ5jPSU6LAToDdxsz8aLJFG2zu7Hm3GSkX0PmZZBGLT Zyyp9EOumIRncblXSpx4YAMAHmaPrxcee7IHzeEvsiir3LMpX79kh8HxLPv7lkGHlqwR /eyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505348; x=1718110148; 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=6H32tM/kIq9tLTuMJ+qVcoNAPrEuAu35f6jcL7aj1B8=; b=tuHrI+vBsTnElbDgRMhg7YsrEgY6GjgmXJ9V1hroUef087aINn6dAV5ogE1ze0lhIe UVuEMdHue+DcoILrBgQbqFirTKDmZySl0LG2VptrP6bupsf70qAX21/FjnsdROUr3l5m SKJBIdpZJ/Bxp1FKlqSKfetMxbbBFzKg3J/xHh7Niy5E7Xs5Q4bynIhGw7fAj5ZX5uHX 73IEiY40qyWWvgB6ZUH4u52ESc/A9aFjqAMy7L+UN7UjY5H1DoiVafQXIb+IY+cLNh+s t5Nnr8bKhYFWb0hl/57skg+jziQtabX4Av3fBxjkXeQWzyFfDNdmr1WQsIhjidzJYc+m X9eA== X-Forwarded-Encrypted: i=1; AJvYcCUliuSzOi5AlcUoR1LsKNR5MmUkU6k8AR+XA+s2CGputuWpCc7nMyeW9ZUvztx6594NyPaYesnNG+fJUbRJTtvdt779JAf4eSJARBi2kIky X-Gm-Message-State: AOJu0YwnOsEkxhhbQ0bDtqfPhWY8aIqisRdggqCgsj1GHROuG94dXzkg KrGLZhipVhZJSlWLQN/olrZZrXEPgKpYBZDC8dhAJA75lU4V1e1nbS5oS1GwPRE= X-Google-Smtp-Source: AGHT+IEOlFKJRCl1OGX3feCz8BceiHmgf7WyvD3dckWQnAhBGa2tvUo1bIZmX+1nEEZL2bIqoKxgpw== X-Received: by 2002:a17:902:dac2:b0:1f6:2389:221 with SMTP id d9443c01a7336-1f69424e9c7mr22945345ad.5.1717505348316; Tue, 04 Jun 2024 05:49:08 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:49:07 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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 v6 15/16] RISC-V: KVM: Allow Zcmop extension for Guest/VM Date: Tue, 4 Jun 2024 14:45:47 +0200 Message-ID: <20240604124550.3214710-16-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054910_368833_F26A8599 X-CRM114-Status: UNSURE ( 9.77 ) X-CRM114-Notice: Please train this message. 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 Extend the KVM ISA extension ONE_REG interface to allow KVM user space to detect and enable Zcmop extension for Guest/VM. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu_onereg.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index 71b17a6799e6..a6215634df7c 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -173,6 +173,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZCB, KVM_RISCV_ISA_EXT_ZCD, KVM_RISCV_ISA_EXT_ZCF, + KVM_RISCV_ISA_EXT_ZCMOP, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index f68b15b15f0e..fa5ee544bc69 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -53,6 +53,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZCB), KVM_ISA_EXT_ARR(ZCD), KVM_ISA_EXT_ARR(ZCF), + KVM_ISA_EXT_ARR(ZCMOP), KVM_ISA_EXT_ARR(ZFA), KVM_ISA_EXT_ARR(ZFH), KVM_ISA_EXT_ARR(ZFHMIN), @@ -142,6 +143,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZCB: case KVM_RISCV_ISA_EXT_ZCD: case KVM_RISCV_ISA_EXT_ZCF: + case KVM_RISCV_ISA_EXT_ZCMOP: case KVM_RISCV_ISA_EXT_ZFA: case KVM_RISCV_ISA_EXT_ZFH: case KVM_RISCV_ISA_EXT_ZFHMIN: From patchwork Tue Jun 4 12:45:48 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: 13685255 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 028FEC25B7E for ; Tue, 4 Jun 2024 12:49: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=TapXelcm+7hEn2bhq7Xg7WYuymYVH/DYgQg+KhbPGp4=; b=bu6mDJ7I3aIPn4 MzbV43eddB2YMISd9I7RSFzF7u7w9pvlLlt7daiF1DywtAGja6s5BZuW1quNJq0QBBEyF7NCM2H59 11C1xQL/roHO1qsbAotdFxjb10le6LYBljrdsfIbg4R08xZS8Dutael4lLG4st1VC+sXBWPOV5vzP xUJb/XUe7R0Ts9+PSGMQFo3EGLiE8fKHBjZzMp3IlE0F5pnUF0xMg89Rn3T8fdSrH9sBpUgVRqblD P33jTwdHENV6h2+/LXQSk20pFqOJrGS42gl/yOF168ZmLkl5GAS4LR7tMXKBucloUT9hJCK2zGUDt Qps11r3BY5UUOxvplmfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETbQ-00000002NLT-31m3; Tue, 04 Jun 2024 12:49:24 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETbO-00000002NIr-0fsc for linux-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:49:23 +0000 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-6c8b6e40ea6so337883a12.3 for ; Tue, 04 Jun 2024 05:49:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505360; x=1718110160; 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=hg13op520E0l7vmsGSXJjwrEXGfoFkLadNxxD6X23VY=; b=PZ/YnVOeh2yQyd+kdeWSbIKAVEfJoj2HXorY+8Kqgl/lhUGPvW9Y9fx/P5rWDtp3ZL YwwVOgLtxFakC0n82yPJWHzddgEzn3JcRuV45V8KTaU0kcWEVM//P1xnDXkSyT1n4quD j7KOb0PcQNFWP2Cxyl3f3UTzpvLf5dGWRMvYKNF9WyRr+62d1nT1zmV5NKeqSP+ybUCO 2MSVjN2RC7KElAGKgJjbJU+oDrXfeAX0pc/hBk7SGxQ89YsFliQDrrwwdM8sYIBQBZVF sLlICTYX+MlqLsH+1hR4Ms/pftSoultqgZgT4gkPG72VrsQGalUHXaFKAAjo74eIkC3z 4s1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505360; x=1718110160; 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=hg13op520E0l7vmsGSXJjwrEXGfoFkLadNxxD6X23VY=; b=d+sHnWZl0CKcZfZW1DHeJQ6+UZYzd0AYwFa08zQ2Qf8QEKXeGF7TKtgsz7MdxYWAdm agvd3ULx36/oXbHRY/3TXAdJGJDXOiH9Hczg0iwysaVTLyh1GD0gw8GzvZjUJ4V8s1Qj WF242aDFs16X/Q7qlGrzrWe6AoUwsnqj01+Oj3rpuj6wRrNN9mnCBFiPI0s0ccsf18PI 6IKhxdxAmEIG0seNSKnanFINCZ3k7kamCYN+wZlgxPwJ2aYnQ7rZgq2VBb+n4Vk9Xhxs E8bkyQVKa8KfDvG+t27/VrthR3AvYHT2AzUS5BUA7DpvNxLcViwBYXm4uWeDWdMONfr5 ui6g== X-Forwarded-Encrypted: i=1; AJvYcCWEBnr4QQbmK08qWr8GZrAzjY9mjKs6NyYNr+W7zVcvNkabXb0LMtNs4b7WbVt3tDLv+1VCZZfizzytx0Ngj3VGAn0WbgO7SbO4zHU+m7Rh X-Gm-Message-State: AOJu0Yx2WmT9QOB5YWEe6ZM6SIVJAtR8tScpazO/+KPtFf9AieOllkgf Es4KSwVIbHU81sUXcRXKb9yvvTbNGc8uNcFQCkL4p2KqNvLWBzStUnMbIUz1DW0= X-Google-Smtp-Source: AGHT+IFjRaBoryIbYEQtignrxN6JqLYXY8gztujl1ilZT6KvEZR3UOMAvujw3x8ToyklOBgsdusl/Q== X-Received: by 2002:a17:902:ecc6:b0:1f5:e796:f247 with SMTP id d9443c01a7336-1f6371ff41amr134960595ad.6.1717505360188; Tue, 04 Jun 2024 05:49:20 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:49:19 -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 Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Atish Patra , 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 v6 16/16] KVM: riscv: selftests: Add Zcmop extension to get-reg-list test Date: Tue, 4 Jun 2024 14:45:48 +0200 Message-ID: <20240604124550.3214710-17-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054922_262343_B348B24C X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. 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 The KVM RISC-V allows Zcmop extension for Guest/VM so add this extension to get-reg-list test. Signed-off-by: Clément Léger Reviewed-by: Anup Patel Acked-by: Anup Patel --- tools/testing/selftests/kvm/riscv/get-reg-list.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/kvm/riscv/get-reg-list.c b/tools/testing/selftests/kvm/riscv/get-reg-list.c index 864a701ef6c3..1a5637a6ea1e 100644 --- a/tools/testing/selftests/kvm/riscv/get-reg-list.c +++ b/tools/testing/selftests/kvm/riscv/get-reg-list.c @@ -60,6 +60,7 @@ bool filter_reg(__u64 reg) case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCB: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCD: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCF: + case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZCMOP: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFA: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFH: case KVM_REG_RISCV_ISA_EXT | KVM_REG_RISCV_ISA_SINGLE | KVM_RISCV_ISA_EXT_ZFHMIN: @@ -431,6 +432,7 @@ static const char *isa_ext_single_id_to_str(__u64 reg_off) KVM_ISA_EXT_ARR(ZCB), KVM_ISA_EXT_ARR(ZCD), KVM_ISA_EXT_ARR(ZCF), + KVM_ISA_EXT_ARR(ZCMOP), KVM_ISA_EXT_ARR(ZFA), KVM_ISA_EXT_ARR(ZFH), KVM_ISA_EXT_ARR(ZFHMIN), @@ -960,6 +962,7 @@ KVM_ISA_EXT_SIMPLE_CONFIG(zca, ZCA), KVM_ISA_EXT_SIMPLE_CONFIG(zcb, ZCB), KVM_ISA_EXT_SIMPLE_CONFIG(zcd, ZCD), KVM_ISA_EXT_SIMPLE_CONFIG(zcf, ZCF), +KVM_ISA_EXT_SIMPLE_CONFIG(zcmop, ZCMOP); KVM_ISA_EXT_SIMPLE_CONFIG(zfa, ZFA); KVM_ISA_EXT_SIMPLE_CONFIG(zfh, ZFH); KVM_ISA_EXT_SIMPLE_CONFIG(zfhmin, ZFHMIN); @@ -1021,6 +1024,7 @@ struct vcpu_reg_list *vcpu_configs[] = { &config_zcb, &config_zcd, &config_zcf, + &config_zcmop, &config_zfa, &config_zfh, &config_zfhmin,