Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1431600lqa; Mon, 29 Apr 2024 08:17:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+FEBAgaSHFq9AY4E6S4pbUXmkHZlAnH3akEWk/AyLwqM1mU75cHOEP2yXldLvteC4VAGVzoGMQeVB3hZB8HuM1oYbHSzMLjHdipyYoQ== X-Google-Smtp-Source: AGHT+IFIsJbWsoxH21zVAEi+HXJhq0r+eQlbEgno9ZJyhplx4SUIv1o+oOR95PHeG49vf2RGsZkv X-Received: by 2002:a05:6214:1c4c:b0:6a0:cf21:abc9 with SMTP id if12-20020a0562141c4c00b006a0cf21abc9mr4476794qvb.6.1714403844306; Mon, 29 Apr 2024 08:17:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714403844; cv=pass; d=google.com; s=arc-20160816; b=Go6/HwAXFIeg6DmkXjdttH2wDLt+7edgmo9+fmBHe5ryaRNJvMsk3jGTj/y/oGlG7F K3n8nVjDlr/pu7pmqO3cbFGxEDhn26LLgYEck24hHGjDzp8yqprumdjgJ5faNpfqK01P 6Csl/ZZDNEAw2BVvnj6Ijyyoow5chWARylUw7cgZntyuiITCpw0u2CArFLfK7Z/o7Dq9 02wv9VMi1CG4/URc5uDDvn1MHruqIfz4KYX/notEYS0T9pgCOCVDmuX04iJmKJj0RKtA xr8jUA4wQQGv+sMLh+i0UGXEyaYMZID01ROQwtM13Rt9B0bXghhxF6eJo3bAhx/wHGuG DUog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; fh=RIrmdEqijreVrShwzOIirtn42Fv+Sxxvij0Iq+aI6i4=; b=ww6BxNoqs5B92Yh6//64GF3tSByfjFovGXjjx7TYLqfR6Z3STDd6jCAzDXxX4gqKzQ h1G1pGUG5CKoaEvBWut8h7aM0LayZl8B1b4LOEfsXH6lKqMAvUDPyTuoMXS/PJCvjRkW Hj9RNZTyU2DZC7bobmu5QJN5XQsBLeUWwBe39Qmv4H9YOIWCgYQo90durXrlD35QBvqD 99uBr5X/pw/Lvqwhak/AIsczTZ3oF1QHlCUpdQH2GSUhKlkHFUZFi4WmV8Tuoz06eQzv uVDj+cfzjC7AbCGr5wa/6VZUGOE8m/D2QrzqFO1NV8rYX9d2xnW0CwyQONIoVYSbujEK Ecrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=aWAbxd8O; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-162549-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162549-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h2-20020a0562140da200b006a0cc9b3589si3141198qvh.218.2024.04.29.08.17.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:17:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162549-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=aWAbxd8O; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-162549-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162549-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 001061C21197 for ; Mon, 29 Apr 2024 15:17:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC68E1311A2; Mon, 29 Apr 2024 15:06:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="aWAbxd8O" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DCE4130E25 for ; Mon, 29 Apr 2024 15:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403210; cv=none; b=YmOMeA1cvVrA2lcP4LSeW2VOt9DTqE/8qJJtXcMK4d1xGtuStJrHX9kX7qKgm6pPTPABktobCBMeZVfS3JH0ULVD7VBAsnq9r/jDVBBmJz0ZHfMs9TacS217NEZSfeBREGXuzD9FEo4HTK+dOqXOHyLIkH3XDV6fqv7qv8eNg90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403210; c=relaxed/simple; bh=a0XzsdggPUj0Ja28kYjSZ2eAp6PAvvyuna/HjP+bSA0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dCLhbx2P+eD/GK6SktRIIzIYPwVYN602Km35zj+oC7z9a+h49R2IQU7/qNGi0fXq5zsov1lpCUetSIH5Av8x5BtMxSXuEZmi/tzO43PEETVlN3qJTDk4sibwawotQwyvl7f/6mHmVwZqJbL64+HkXT+ZJKtkkivssdZJBvkYwDg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=aWAbxd8O; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-516ced2f94cso1093250e87.1 for ; Mon, 29 Apr 2024 08:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1714403206; x=1715008006; darn=vger.kernel.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=aWAbxd8OjrQcQBQSTsyapDR89j7Hvn6V4YW+znYTughYnB6q1FhjTG7cvzLseH0R2b MgyjjNrhALQX3CmNyN7WlGgprfPS4rV7IWiNpD1j5i9EDQ7FApvNLV2m46n1UtcBN9Rp SkxDjSfTP5daVZrUzMAVFW+B0VZZCFZSkbozB1Z6+LXWH0q4aFcUeXNzqTWJB+kgz+r1 QqgpQa2JURgUOXG3TqSS0H1OSYY0hwpWCMBH+C2lMiBl6UuE641jBKUc7Om639SPTxNO WKXbZQ92OIlg/Let5OK2c5cO/ohU/KpP8qiojdrn/3Se2ZxN0brgR67SOF+6kYzB8xCn KzKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403206; x=1715008006; 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=Z+F3s8QKcjP0BQHfn6aWbOLEWFOoUoQwCnpcsU7pdC6BBeUwDaN+RSG1xASLaCZeeO 2MWFb7jALn6+KspbgI56a7zzKx2NBhKYnzkvK9QuK0ShjH4E/tYkNurRpXJgG+STQyp3 6EnArqO5Nyh3o/J7J0b/S9u8xeSNCjqgzQq14LaV1kED71hDpIXJJyVfLafCbkkaANx8 vjKlYTfKDf+DmsrFbEqFW/N/Rpsk8OIKpiEx+85BIFBijmfBSu8JLQOWx9+bPo/ymCKn H3WA91taJJG/knOrU1vXD+fCI0bgH5slm2N4XU9Y7LacvK8dfsNE4/grniMUu4TiZRc2 LfeA== X-Forwarded-Encrypted: i=1; AJvYcCUIbr278w1WKIL3x/Hstpzh0nW5k99nESIimLOG6kyRhLWb+vWxY4tzL8E/QzR6IBEI8VwEfJiNTP0xxlYnYfD1XnCkQ5mHgvO76sao X-Gm-Message-State: AOJu0YzYZYQombYB08Nf5XXURBW+4dCExylCM4DBktylsJzecmguT0ud Pv+9SL8RT7WrvcBdYWQ0aFLfUfHScxLwmWZnaz54xxnC0s79+lo4vGIQR/LgDSA= X-Received: by 2002:ac2:4d8a:0:b0:51b:abbf:7585 with SMTP id g10-20020ac24d8a000000b0051babbf7585mr6945804lfe.5.1714403206709; Mon, 29 Apr 2024 08:06:46 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:2fec:d20:2b60:e334]) by smtp.gmail.com with ESMTPSA id l23-20020a05600c1d1700b00418f99170f2sm39646638wms.32.2024.04.29.08.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:06:46 -0700 (PDT) From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , 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 v4 10/11] RISC-V: KVM: Allow Zcmop extension for Guest/VM Date: Mon, 29 Apr 2024 17:05:03 +0200 Message-ID: <20240429150553.625165-11-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240429150553.625165-1-cleger@rivosinc.com> References: <20240429150553.625165-1-cleger@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: -- 2.43.0