From patchwork Tue Apr 23 12:43:24 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: 13640025 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 D4C4FC4345F for ; Tue, 23 Apr 2024 12:45:16 +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=mrXGf4V+SUfS526+G6EVworOfyPCtDnpxG9VwyCk+a4=; b=YXfXW2QKXvyyxE yFk+hRjuaUC/MO6LdqcS9BnQcgxvoieDzRKDUE8AFsJYSNc9JU7ogorkRYUTXRFIFs3ergpCAzwbr qEvqNcZ+TlrZyqlZAAA2CCjRrABwf7fncQ2Xp6RdZ5UBQbGGqbhpYPZYa40KlKQNXVGdLDifregpF OE+3JRBE9CudMmLNxI63HK28Hf8WuGsvGyS67PWv5yujXPKdpIOevqqsark9f2ciYWPkDAz7sEaUO 7cKo0Fw6depPK55iBtmvQCwTRU0nIE3HIg1tGB4seD+Txb106KVA6CKkIAwW5Fkqg5YyTYZF2v+g7 yNEezfHlWUN9y+TWZIKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFWI-0000000HTYg-45hL; Tue, 23 Apr 2024 12:45:11 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVE-0000000HSct-1UHM for linux-riscv@bombadil.infradead.org; Tue, 23 Apr 2024 12:44:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; b=Rg65TR96fRtFaRTSfaLnCigzUn vy9jb2aj76EcUaOUJ3b3607oWudaEedPDRQrKvrD3rLk5XfsYJ1FybdD1JYq+rNuYAIykO+jyoR/U oi9T3xmX0YdZ3cwDX7uFkV4xA5v/+2Y0KI0CmtJ8Dyk0LIOWgcNJFZNFo6ngTDvmOqlhJF6d/zjSj /oJO3cR8Lgvh5C0EYPn6TWEoULgrREW4nMFC5S0tkaD64TutorQxXtRLNl7m5IFnciks9wVkKvgAr 6PCeL56WO1Xo5FxjD31vnV4BoWfX9XywoM5l2BcA2/jrQHpnYzZwTH+noOMI9MDOiuQ5ghKR9cT3u yDM8GfYQ==; Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzFVA-0000000E1zt-07iL for linux-riscv@lists.infradead.org; Tue, 23 Apr 2024 12:44:02 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-346407b8c9aso1491801f8f.0 for ; Tue, 23 Apr 2024 05:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876232; x=1714481032; 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=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; b=X9jPqhXjrno0uqP1GCRYHmnTFpz55KWpsHWF7zqXSChsXhbuBwWuHJNbcwd2HUW7DI 54fA+wnHlL25LitdXNWLxnmdWS75OqmlGDTnE75WS7YSFLQpcnTFlGdOPVg4KoDZvNcY CJIHlxWBoA/s+dphaNOb5nGMib1ma1IYfEc7SdGq9/DSpjF7doxW+50lpiVv3IwK2pFE bVGVQDTgLCa+AydUcp8vsNe6tByRrfLoxy3+1f7xTAo6fiHu9/CY4AHfxHXJzLj06NnS hTY97NX0piKKQz1jfk2TfJ2gGj2eihxvUmfXOvlqGpN+mTGDNXCsYaw9ZoS4NKHjuiQt o7iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876232; x=1714481032; 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=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; b=RRhz5/Okr8s78gQBiLr2M71LmPO8Hl3g6z+XPwxBdrTGCaeSlJgpqbWyfzu5Yj0t6m TT7MRzogoLUc3YLl3Zrz/hnNfxsIG56tgNViJATYdK3MYuWsaPh3GVI279MrP54wl6Ls Tzslyq40VTTRJF8njSg8RWh6He1NpBSYVLFDZ9rdp/yawVrIs7tDZZFjCGxQlqVlaZar WwtJ7VmcCeQrBjTXapClwCqq/4dWdspeqv3MSR9BtAM6yD/M34p/ED2VxPuWuKm34470 +jOxuUeIV/6ra7MgRkfPPYjp4xeGUOL4SjiC0/lx3Vax9e3WM71USToSpjaT+3G+8p/s nT2Q== X-Forwarded-Encrypted: i=1; AJvYcCWyKW+8FQoyTulDfkRhdoNaUtIbBbwAS9DaAwPEhruYTWYMcIpNfncZSjQFg6ApWoSVqjy4sVGuMotXj+CB2sk2GEppHZUWv0nLRK8rrL89 X-Gm-Message-State: AOJu0YyJOakQb8fCNtQTjqUzcR0cqeRvDvBd7gLN5xSS+8CdRh03ozIo UV6oHHKZTVeCuaEAd5gpthWASaIBC59WqNeQhSiovwZoO62Wnu/o+2YHC5Kx3z4= X-Google-Smtp-Source: AGHT+IG8Y0QuKdCdamw6m12y/zyBhHBAXQlGn8wgQVKcyAjav27SlxD5OClQSLzPK55ylnTNKzC2Ow== X-Received: by 2002:a05:600c:3d95:b0:41a:c4fe:b0a5 with SMTP id bi21-20020a05600c3d9500b0041ac4feb0a5mr958105wmb.4.1713876232338; Tue, 23 Apr 2024 05:43:52 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:51 -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 v3 10/11] RISC-V: KVM: Allow Zcmop extension for Guest/VM Date: Tue, 23 Apr 2024 14:43:24 +0200 Message-ID: <20240423124326.2532796-11-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_134400_372856_E038EB64 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 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 57db3fea679f..0366389a0bae 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -172,6 +172,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 a2747a6dbdb6..77a0d337faeb 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -52,6 +52,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), @@ -136,6 +137,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: