Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1280921lqb; Thu, 18 Apr 2024 05:45:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV0Z4omhXH/EGymfT76m6lnAXFQb0ovmQzAf5PsW8LPxDnVFl0ZLfpHjgUTBHc1hAeGKZ1Wa+Hd0hvGo+xvT8YQVjJ3ycGt0ZGLJl9k0Q== X-Google-Smtp-Source: AGHT+IEl+NMivmCm3j4/cMumiHz4MK909S/Y4QGv6sxxKo6KRLZUladlIFn0V1Y0TnCPj+oTyrAh X-Received: by 2002:a05:6870:eca7:b0:22e:a3b0:34fd with SMTP id eo39-20020a056870eca700b0022ea3b034fdmr3697611oab.21.1713444350558; Thu, 18 Apr 2024 05:45:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713444350; cv=pass; d=google.com; s=arc-20160816; b=XEVyONE7M1J8We4iG4D8EAD6w6AXw8HPESV487H9kas8zOHg8LlsxQvAAQTdT9EkV2 V7k6iIb0UMh1v4OWSAK1WHPuTAUeROXo97bIydYksU6gyLHAkM1OK2+o1VU6N5fiev9E AXRWKMkehmN2eH4iT2PkIKLnqyL58IkQ/dwSDSSE9yDlYNfgUNJTSUil55D8bxC89M4O b5n/DoG5Jfw7g86NyFJ1pI/saK+CP59TH1cM0tCLxh/zENvpaUF6sZmmbcPnylpqEx+7 ytp6A6gP02CffC/eSQzOyM1yA3dGQy2leBR5RGkhrK8lRkfbmytkbnJzii9E/oAi9a/Y wW8g== 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=av0fCRvJ5d6BdL5At0wE/CNS0oRVP43ZLfrJceTJ89w=; fh=htPA+MzuHz8LPV17/LrObvD8QSf9k7jtuXR3CvuzcxY=; b=kjmnuUM2cLGyhv6OXnHd7rYkfdh5m2gg09tU6ZEH4bh13ptnAszhfYU5M75edwQkvp TrbuOAfP81v2crLvEUociOofF96mnte+9w297qHVrc1LwVaxgnTx7RTLEPix/MCGSZLk YTT7xP62UW+7XmkB4ab7ZkVphm7HuZczCKhl4+a/Nbq2WPmxo7CoMh0/QmsFKLvmHl60 7v4LPlLqy1Gble45APe9wvkW6X+gXfAtAe/QSB5l4sxwVYIiYSn/WdELT27+Z3AUtUen BwUo6/+HTgmXsOL2NzqrkasNVdpCiSNKW2E3j9YYBfWaQj54DkotvZhHC8HipWVze16x mh9Q==; 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=orXBAWIl; 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-150083-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150083-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k24-20020a63d858000000b005e49edf6458si1230371pgj.753.2024.04.18.05.45.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 05:45:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150083-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=orXBAWIl; 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-150083-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150083-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 303E6283376 for ; Thu, 18 Apr 2024 12:45:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B8470163AA7; Thu, 18 Apr 2024 12:44:05 +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="orXBAWIl" Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 E6C45161321 for ; Thu, 18 Apr 2024 12:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713444244; cv=none; b=k9suw1bKDX8NmFmRjuAiMBauI9Nmk7J1priPJsD8JFa7lb9aBe0iqMRuqZNVgf0aaIrwNGj1J29VlmFFH3+KSFUopVC/v3vZZFN+ZBjwp0BLZ2xwEY4AGjnVhbTfbSbb4QHyC9uCVde1rK38LyRKQB0kcVJ2Z7G4SWKnuqpyizI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713444244; c=relaxed/simple; bh=2meeqYrGqS6N+9ES03sW/IZ0HWVimfJczOdorGfrJB4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Gw3TbyUZ4lmgTJFa+SRwhEauAzmJIoD4RycWIX5MX4Zz5KAInUMRu9+QlEOaQFlr9d2ZCukUGbzdxqBSVMLrIlDRlnZCpJG5+D/BpZXEf9RnZoc4iJfwOJ9fzv+qMCp2PCa2jUXctuRu8/X+CfV4FxcMHNXo9/Y7MNWhz22ezHU= 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=orXBAWIl; arc=none smtp.client-ip=209.85.208.172 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-lj1-f172.google.com with SMTP id 38308e7fff4ca-2da4e54549fso228131fa.1 for ; Thu, 18 Apr 2024 05:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713444241; x=1714049041; 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=av0fCRvJ5d6BdL5At0wE/CNS0oRVP43ZLfrJceTJ89w=; b=orXBAWIlCbFEPZnXQnevS9f95mR5781Pc2yepFZQDAFvlJNBdvAcLHH8vprt+kGonx u/y21dbj5GkzC7GC9zD2/TDSztHegfMNMN2C/DhINA2H23Kk5mfXmCCyvY+gHjagQ+Hx oaNLoRtTXs5HQDI1JZgqE/2mtGYT+M2IaaZRjHo1RF13bMsHsiJE5d1wYa2P4OdVwI/A 7BVKyu+mMSKhRKMcLyd/ObTNE0DshORErxAfHhUT+3WDt27HEN2cxYP1ZMIOX/m2Rzmg m50MJceZivYeNEpP/zgsWdA0CNd/KAvsGenYKqMMettqNaLTycWsPrXjixBOhvkaLotl ORBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713444241; x=1714049041; 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=av0fCRvJ5d6BdL5At0wE/CNS0oRVP43ZLfrJceTJ89w=; b=K+2la+8GfbsBcSfPThgbcCxDIpPYG0aiqnG444IMCT5ulAi82lpVuBSOZRYUr8ZMC8 fcJu66V0TFf+N6fA4OVDM0RuZGcBB0fXTTsCtMhtZRXm6PZpvMvMtB3GyzHEUzLR1b5h tUV2S65WAivW9T5xiziLPBFUDXrW3Ngo1n1pae422x+/C5F4DXVX/mKSskjTVLgnUjWB mC6IcTe2PMtjHZPwSE/VvBkkuwHAG1YSom8v9rxNDJGD08sY7xgAlA3eeWLg9kPOKcJj 7J5I53PmgFKHX/QbjCHn7XkIX9Ecez5wmrhfJDIYj8y1zQOvLTszWzuItlQ+AI4qrb+o wBsQ== X-Forwarded-Encrypted: i=1; AJvYcCW4j2wexB+/ms3F9HJrN7pLaIqtUU9NR1SZKMjXswEWL3sWObyRdjzWirHce+AVKGfJZLOpzLKdqn0iA9DPH8sn8WUpOvfGVyp9jG6S X-Gm-Message-State: AOJu0Yx4cd9lKWVrq+olz7fX5Zai+nsMn1dZQBebZksVgMor/hqAWWFm EsGYbs1i+P7qiocYYMg0/Y4ocgOgkTCEJVPSNy4FbStxLcMGVUVyo66RV5HOjD8= X-Received: by 2002:a2e:3a19:0:b0:2da:320a:6739 with SMTP id h25-20020a2e3a19000000b002da320a6739mr1487240lja.1.1713444241121; Thu, 18 Apr 2024 05:44:01 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:7b64:4d1d:16d8:e38b]) by smtp.gmail.com with ESMTPSA id bi18-20020a05600c3d9200b00418d5b16fa2sm3373412wmb.30.2024.04.18.05.43.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 05:44:00 -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 v2 06/12] RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM Date: Thu, 18 Apr 2024 14:42:29 +0200 Message-ID: <20240418124300.1387978-7-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240418124300.1387978-1-cleger@rivosinc.com> References: <20240418124300.1387978-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 Zca, Zcf, Zcd and Zcb extensions for Guest/VM. Signed-off-by: Clément Léger --- 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 35a12aa1953e..57db3fea679f 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -168,6 +168,10 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, 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 12436f6f0d20..a2747a6dbdb6 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -48,6 +48,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), @@ -128,6 +132,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: -- 2.43.0