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: