Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp79665lqb; Tue, 4 Jun 2024 05:52:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUijXrFIYqV5bHBFOTs+Se7KmEHtMk1LrQKQGJbMWyIdr5LFM8TknEqUgLd6Xij/EqGALNWqfUtpTuER2UaCZO1SSNzyk6/zU0VYwpTRg== X-Google-Smtp-Source: AGHT+IGu0ldZYGX9SPMKg5YgfMwVsqpPxlowPsCMA6AMqyt23BGSowFLdDAUK2DFtMKbd+1DTH88 X-Received: by 2002:a17:903:2449:b0:1f4:985a:ba83 with SMTP id d9443c01a7336-1f63707e78emr143921895ad.48.1717505523167; Tue, 04 Jun 2024 05:52:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717505523; cv=pass; d=google.com; s=arc-20160816; b=yN9ig7vcWFyTHpk8+ccILr8U99a7oQGbkhLgfJzDPmBkuSpsxojAoi+Myy/eq0Faaa qpFGWuQw1uQqkdEUOGi+d01RD/bmGOIaQxVrrT+c2J2ZmnP0EtBKS+dN6Xz+8EgaIpiZ w9l7WhBpotGZ1OeaN3n5+8OOVxTUs4CiYbHpqgnkbIdQ6K1ZjHeJJfXu+I62ghKt6gDT lfGMGvgWNcaNZUovUsDcB0O1Sm3DoEV1M8SbPCZLjiDTLtip2iGCXmO0ORUbPwKDQucJ Ef//vUr7KjGheFlkzF/nLpvQTXM0GRj9HKz64KIqDrEPlD82dcbmNC6p1K91wXGtfpTB nNjw== 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=Gs55v193sdHVl0rBHs/P2Y++ez1UXnaq9pE10ZEsFSw=; fh=uQSsxrL7h1ljYHPQpED1i9aNed3q4rukmyQLT6IFDEQ=; b=wnQEzPpt4dhVyDmpqSXKs2SmJqEyiMKEliXTX5xqmaZu3vrd/Z1oo1TP3J8Wpjhj6u ndCwG6ggyX3MZw9NmXJ7UcF3D9L91a/PHwikO7C35CncU67lpQ4sqMClNZ/n0H9jiYGr xMZHCfH38xvLTRLwzNMPe6gzaVYmE0CKGnw/Mqnhkq84CyT4aXRmYPWwDJDoU226tVOe GhkjcRYCwtdkk2T+00PfZOPHm80votgkUCsIBdJeP0Pso9IDQddfVD6TSV6lkTzdnMmU DaOjXb5JrsIZz/fia5BRMIuQRbIv1jv/SLOwPYrmydqsex3kaWLwNWLgkbI8KAC3giQF WvVg==; 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=00ZnnNIt; 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-200639-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200639-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f67ca3b7fcsi35843335ad.412.2024.06.04.05.52.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:52:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200639-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=00ZnnNIt; 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-200639-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200639-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 12C94284E10 for ; Tue, 4 Jun 2024 12:51:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BAFF149C7A; Tue, 4 Jun 2024 12:48:07 +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="00ZnnNIt" Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 0BDEB149C67 for ; Tue, 4 Jun 2024 12:48:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717505286; cv=none; b=YKZew3uBmT4vvhT70LlI3jkMXWhjmmE8eDKleD+GKo0FQa5e66qz5sv2k6hk32WCYGAK96S50S+FQcxUo2Dr23D5CDTSePSfGB+tklKfD71mYUolJkMINCvCNQ02RXkTJb6Q6osSRqysxyNJdnQznkyWH+uNt1uyB1BxsQ6xEMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717505286; c=relaxed/simple; bh=ZohCCwLLKDWdWTtROOn+XtuALbMR8Hmvwe3YoT+NpEU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qGL8mNNMfgXZKAfykvHNyoOjispbdq7osu7B878jMjMb10m9qIDSCj48oar8kzU5AeNRQzN5vnn80DLR5asWl3+BalMxEBoNXtD5BRfsUs9QwOuuWiQVTJJN/tTLNtzvZCQ9Tc8UsUE5JnwH3PyVpSV0OtyF/NftawLI5mOfduA= 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=00ZnnNIt; arc=none smtp.client-ip=209.85.215.180 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-pg1-f180.google.com with SMTP id 41be03b00d2f7-64ecc2f111dso648737a12.2 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=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=Gs55v193sdHVl0rBHs/P2Y++ez1UXnaq9pE10ZEsFSw=; b=00ZnnNItS/Pw+S6qBsfKb/toNYH3b2xRDcbYdOIUbiMEJeQoMgKR3aN6zsT0Q2oX+5 ooXYunPbsuk0Ux+K+21ifbQQOQ9P8ujK4wBpZ8eMFikF7rEj1zDX0dKVcCVktgP2cyJP qcyDizhg5ZH+sZG6PjLfp9pYucx0lAQS+f+yXFxvX5T6lRdUF6roW4pPUtIUfJAoXvbw riNhuff4DLt+q27QLpUp3hsGJR2FaXx1Aev8WxN7IDlVYVcGXKok6WFP90T+FbeOpnAG bsyvmbrsk262K0HdbvCM/LG2P9tUZMC7sIIacs2IYs9J8czQVndy9zh2EKWpD5s7jHh+ XCew== 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=J9jy7Gft0Ed2oLs1x5k+sEGkTNB8hu8AXYpc2lrwAFdMDDg0lr3XA2qURdMedMTZo7 ippXH1CQYpjbT0hD989alBxPfPGpPsOhkRohJvvi4IV1785iaexYLTlzCIz0qZKFNExK 7f7/5VFLymVpL8vgZcSgVTpU6OB8tSUKoG8c479wUPx895IyK0Y42s1ZoZq5GvsASx65 7fQ/u5gu9rsyH8kwswnbsHFCsda8euyABP/NY5+6o9ePp7+n2IWGLGqyMIzS1DiPCxIc RpDXDTts4ZZXWpGNIq07Q0PsOFJkV9yb690lHJRAMNqiiZxSiIMUkg3LZXjDYZ63oAZX O61Q== X-Forwarded-Encrypted: i=1; AJvYcCW233HKLQve6WicpZ/LPpZQAqgkTXCwed/lahEsXtCig8MjGbnurkXd23YZWF0Bc1umvGqkM0AAKd5pO6Kb4obHV01Bq1lmtePaaa9H X-Gm-Message-State: AOJu0YzoITCxEYuf6c55Nb7QigGM0Ee+CaePi33AdpnIRfFB5TiiVsoy mxPKCZ0CBgY/vPn+6x1Ykavyr+zNjkSfGZIB0EjwuF3Lu00TVr9BCl3d4esM41s= 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?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 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> 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 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: -- 2.45.1