Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1001409lqo; Fri, 17 May 2024 08:00:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmT8Fk+8DKHXuYys5FAZ4lkTPTChEIE/mE682D2rgqL62829lkAKpQ9eWuJieMpIgJS4JTcLe6lk3PxyGpwJwgbJaIJTa+dOz6c0q2Lw== X-Google-Smtp-Source: AGHT+IHpMj3ojaEpo0cMaiwC7lizNc5SovOtX0XtUgHldbeGWorwE6stQxEt2D6lDTBDUtsEmKk5 X-Received: by 2002:a05:6a00:2e22:b0:6f3:e9bc:7ed5 with SMTP id d2e1a72fcca58-6f4e0299e3bmr22218797b3a.4.1715957999770; Fri, 17 May 2024 07:59:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715957999; cv=pass; d=google.com; s=arc-20160816; b=VddHZ+Cm6bXSjp2byAG5GQxrcsaihNsq+ObAzyPSwE0gDAHc0wDh/mJmfyVpjMpQOJ fCnHIOYEcNesVAdktEJav9Mruh8x5bLaoR4ZC9406BkB1dM7DkaQTSBFRKBhJ7ZPJD6P zJmVsMqkINaObLBc498jbCPR9eiw3m2mnS3n6Tge13NIYdWcBDwnaTD994o/PkTRE+h/ aes/SC9PNupowrTNfoi4iqTrnHEZMtmIzjrWrsRz4r4uGmMXkcdyvWefWRb8uBJkYhxb mS21YdrZS7KtV4sNYcTjkOM7GTyWcAC+PnNe2ArjLIKLayy1XEymM3B2TjebTv9+O4F5 aDEg== 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=Hr5In3BbQWy4/7yql16kLnv72/rLlL/nlq3+ywvvEUQ=; fh=uR2y+zlpQRVyDhaT/AbOy6XJJ2E41o7sHQqWnzCnGH4=; b=g1Zw/yiYKk1zuR9iH2Q6MQ0EkPl7lUwBfG2QWlW84hdotIkG66X839TI/fWhDPeVHM QEsn85Z22P9UmzZJDDV+7s1U9P8YP8WBVWkvmpgBQBlExZgub2HnOMG24aAJ91WKIDtI v5jxaA4xLsPnrrauzBcCYyne8SCSGFfanRGzgYLtfXB60FagGdU5/ML5JqypvOrBFcMI 1Y9lQQW0fWrqImvVYyg+ZLH2tIs85JMFc7JWt1ERJ+Ub+FZk6howdZ76HkAJu3eF8X6X Zwl42sT9+/pX2yA6jToLx7uon+P8F9vkDua1jnGsFe3m74noxbJdh9qucuoxQr4TsgCk 2tKw==; 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=JGxiFnGt; 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-182250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182250-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 d2e1a72fcca58-6f66af49a40si7815223b3a.34.2024.05.17.07.59.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:59:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182250-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=JGxiFnGt; 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-182250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182250-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 204F72883EE for ; Fri, 17 May 2024 14:57:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CBB67A158; Fri, 17 May 2024 14:53:33 +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="JGxiFnGt" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 6EE9C763F9 for ; Fri, 17 May 2024 14:53:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715957612; cv=none; b=DKGz7Hz5orSeV3xP3mo2dmEAnfS8reBhBAR83LLyqJVuzKUEsDhqaQ4ELXepQFB2ijmZAnZuxISKLFdBTFGnECeSOgS9ZQfPv9gzu+t4DI3b8Hps4aiPIFee88MrM5M0TdwDnfhFIETtm/6L3YmwSPsM6cZ10ywT1zTNJyV1USI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715957612; c=relaxed/simple; bh=9OibV1wByq0xP/I1LcPZzJnAYq8k248mAeEZPcsASkA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nzMs4spKOE/fYS4YTV1cIEbH4dQMN+zymbJ1Fu8x1ZnyaOLbAT6xSeTEn7t12GHiVnEGa8WeRvRh1c1LUgHKKpnLzUkItZLsMwTSQnD0oOsffqxzg9xdreQKG41v50Ue1/TH1/KeW7k4E3AtnN5eII9zZAkrJUo4YHeFT5G+rzk= 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=JGxiFnGt; arc=none smtp.client-ip=209.85.128.50 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-wm1-f50.google.com with SMTP id 5b1f17b1804b1-420139ea1c4so351865e9.0 for ; Fri, 17 May 2024 07:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715957609; x=1716562409; 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=Hr5In3BbQWy4/7yql16kLnv72/rLlL/nlq3+ywvvEUQ=; b=JGxiFnGtT8DQqA6X+fofoAQsi1YIazBetsWmP+L2OIVIasIE5TRdbPW2bRKCxtiGle s6MZLw5KseM1uz5V0uJGskOWZzTtpHexzfm1Gst0DcsEr51HBrJFm/UN7XZ0divx/LdR 8lkOJ2aaMJ7m21hNbxJQDQG9hwgx21YgGvZzlrrOkgGzBgksCayU3TvdkqRn4eG50Emi GH6Pmg6AHiDcgm6Kw7pA/Pq0oghSZ/X9H630cM5Zs/xe32+vd/IUu16hpBs6Il8G8ska HL2M6mDJ9ev6qoyj1NhfJWWu87mJBnxIXZ/NB8dliWwV6HfI8bb5mP8SHe9EXF6RKP9O WOZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715957609; x=1716562409; 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=Hr5In3BbQWy4/7yql16kLnv72/rLlL/nlq3+ywvvEUQ=; b=lF4AWEq3CBEYm89/K/c/CQbAycE6O3Wvx9fk0wtf7yiBHYMzna72aXJXKv8sqjE88P 28aMI+CCjJhUia5y2l/PhzEaMpaL+NmWlHAa11sizEsSQBLZfVfF/1TjyEDAIi0hj4EU webMm47fsp0hgNg3Vo0Pk3WzYy0Qb7TDo4HY2torQn7FVrQVeOhBr/0+T1dUcIZspIz7 I/YuGw0C4rNbcfCxvY0Ipx3p7C5Cw7i/txJUTDrl0GUTmayPHsY6Ixw/5kZ98xq2zfKt WOXRY2h1VbAVhSQAlZ2s9ZcJE7MFIskdJx22wWYqb992Bp//shFegiLQwATMBLgnNksj SAAQ== X-Forwarded-Encrypted: i=1; AJvYcCWHNOHWsYIKZz0Y+nJqkMmaAmAZ7sjMw6VM9dJUE75buWFvmGyfoPP9aC3n/OnEeyQ1vu5COsDCIlHvLgws+1Gbbt8RA1fT7+s/38Pg X-Gm-Message-State: AOJu0Yx0+aITcxJLCk59E801dufQVnYhdZ90FPRgE07ZINlrrS8sfaT+ UE9fMzEqooKJHcXn6mmFdk8GzpQNjogDENev4xlAjWYQLAZfJP+C9MIKKB/IdvA= X-Received: by 2002:a05:600c:1d0a:b0:41b:e58c:e007 with SMTP id 5b1f17b1804b1-41fead7a643mr161943585e9.4.1715957609019; Fri, 17 May 2024 07:53:29 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:46f0:3724:aa77:c1f8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce9431sm301723695e9.28.2024.05.17.07.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 07:53:28 -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 v5 10/16] RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM Date: Fri, 17 May 2024 16:52:50 +0200 Message-ID: <20240517145302.971019-11-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240517145302.971019-1-cleger@rivosinc.com> References: <20240517145302.971019-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 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 c6ee763422f2..7d47fc910bd9 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