Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1429915lqa; Mon, 29 Apr 2024 08:15:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU2p7a3TCeyy3J1+U+HRf8/1lOvBH9J9vhxR4yhipehB7KM0hx0LRdN4JsmE1dwIx/0JdK00AZI4cNYIaO46ic/KpD09+EbzjPqmAI9gg== X-Google-Smtp-Source: AGHT+IGYP6P5qds5RCUujMYEH3tXhbc3P0hT2o2FXKDhFIJLsaJD1FL2MLN3iHtND2sPN+vEo0xR X-Received: by 2002:a05:620a:8c84:b0:790:c15b:e192 with SMTP id ra4-20020a05620a8c8400b00790c15be192mr8772227qkn.32.1714403721077; Mon, 29 Apr 2024 08:15:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714403721; cv=pass; d=google.com; s=arc-20160816; b=zroRPasuFsPZyHVbCoJzVvgS68CAVm0jXJQuPJ4lXdS4eSk8wMwjB79pKPwOKTAjl1 4Uwstw14IiR8TUFEB9qsXR1UWtopgNg9frPMNcVvrgXhBmd7/NlJURs5yLq9eHPhz+Q9 FS+HtSQGrp+eHJYP/4H1RBhCqSgD4kzs1pXCJc4Y6Tefy9MNNxkwpeCjXAleLioF4G9/ lErGVs47ru5MwJTEm4+evvRCQ3uYdAO9jQdkV5I9xdpIIYOERrGlM6XzmNyn6ieOxLcG m55ntbEYsAlbJL7AmmRYyU7FQHR/uA2Y5jNQ0LTeoJa0PF6cew3RWSOxkG8Xroks15ZP qtsQ== 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=rKUXibPhUwjjSXA/KBDdbbKS1P63ijLLovqIt9fNrZc=; fh=yaZsts1QUZdFAdYlik2SAuc+AqRPPNXijT1Cf3buPZI=; b=eVftPZnJPvAnD3oe49xQYSW1+bdNNeERk1JfFn144CsxBywtOJ5ZG1kza01NUnSo9a oqZMfo+ad9ZP5cwQ7zp5PKgOvUFXMBORFiq5IqbWLS41qUjfg12EOxDgjX/f6iQhFAs3 aCCuzk4htuM4NOWj99P8rJuahCCwCsxIFb53/wFGiZbQs72q170MQdGHXI3ZWiSKZABy otaHsjRflD06K9Ay9KE1FjOL5oq88fFHzpjPENCnjyTdSo3SqsbAUL4ku4oWxPELWBFV /SdE8maEf8JrwrkX+EK9yiEaOlk5STXeUrvZYfBAoAA9G+9QE5HsYopbT/GTHfmYeYn2 Cn8A==; 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=fUpvo53l; 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-162544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162544-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 f21-20020a05620a15b500b0078ee1fed4easi26026679qkk.543.2024.04.29.08.15.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:15:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162544-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=fUpvo53l; 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-162544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162544-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 B0A421C20ADD for ; Mon, 29 Apr 2024 15:15:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAF6912FF76; Mon, 29 Apr 2024 15:06:41 +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="fUpvo53l" Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.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 7C37212F58B for ; Mon, 29 Apr 2024 15:06:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403200; cv=none; b=qy+TItfszHPtC1vVAiSQ+wAyz7EO4b6+MzPNNz+GWmhE+Xdv+G2WR8k49qxW2/HDTB9yIG66O0y4Y/JnwePFFyu7eLUQOqUWNwB85t4F02HSr5L1ThECAwGqYpoEC4pgkFxUTEuU/BlttqVqSRK7IjpzjTz4GDHcAUCHuHozpcE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403200; c=relaxed/simple; bh=bVEuZKlZZ0yffOCE7tYaM0ZOFAKNB5aKfkAz8DnA8Vs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SnmINi688R514huf5pFstZSOS42NAVMtzFjaOZCjPhPZo57m94WN1ob2RFI2xj0mzgTjDNg04vyVx0vzvdd1rQ0F2u4/O2HRRPcmOQsyx2/8nOLKernZD2hSPKjYxieID3gZRPuWclVWjB4bRbx1+7NxYYJL2rXegSKaWNkojM0= 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=fUpvo53l; arc=none smtp.client-ip=209.85.167.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-lf1-f50.google.com with SMTP id 2adb3069b0e04-51d9d8c2c3dso210906e87.0 for ; Mon, 29 Apr 2024 08:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1714403197; x=1715007997; 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=rKUXibPhUwjjSXA/KBDdbbKS1P63ijLLovqIt9fNrZc=; b=fUpvo53lbBf4n2bA5Sg7YpH7HFBUTMQ5sv01vh+iiAgUZVxq5BKtHj+7Z0BsXSNBnO Ll55fUAgRh6/FpzCn/3iUY4S1bohNESIBNwD+t8fRgtjeWA4MoxbZWIX+0VzUjb28yBU 1o3N26Ter3YfPz3cq0plSad3gDEdmrratuNskZ55uHmwygcbL2ZPtOtMBMYi5xW5ytni /yCXNdfOA7eMA/PVNcb9cRKqF+jzJivF6m84UTR+ckjsPQw3gHBjaBgKs+u6+RYqFzRO NjDiE/M5MTgyhiyAb3ybRvTzeW63NaOCFxsCRCj+ZwLRZGbNkxkVn/OUJwwxlcJLTwOE +Elg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403197; x=1715007997; 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=rKUXibPhUwjjSXA/KBDdbbKS1P63ijLLovqIt9fNrZc=; b=iQJAeGetYV7PEr24ML7KKFX+Jx6RQCJuH4plnRuSvVrS8jOJs4WKQ7WhUaMObpZlLY dtIhtK6Wt5swBePLEr1enPZgLP0APYnW6ZuugXZz6Ux/3RnbB++VK9zxxHYrnVF5/I1B GZhonNDkCWir0aWWlvv+fM84h93XDANTHuCXpcnVVO9b9cg4C/m1ziLUs7kjiaLsWX1Z qKze9pYkhEW7Ag5Rdcnrf922OEfTwzC0UmZT66z08Asifkj/cSq+c0jpeaOLpU/yiJQr mT3bDGyQMkYEy5CKKWLX8xW9Y4biCIA03Pzzxi+b8O8IPPP1y2rD85AcBF/yDPdHriNr hEnw== X-Forwarded-Encrypted: i=1; AJvYcCWslT0BO4AK2b53vWSQlf9ZsbDkxyOju7UIONBb8pd8U6b4Jt5tWrkRVVLW+1VnJw02OjVWr6PCzK1miDcoZp6Gqkrm8umTbWF9N57N X-Gm-Message-State: AOJu0Yxn0x+5XlImkZNlKhMhIBQu/ZeZgz+Oj0dWZowCeiyWRTE9bgLd E8o8ltvrbDz35vqVidUxf2ruvUvt4H8KtuTk4JX69Kb3BwbL6nODo2stg6mLEWk= X-Received: by 2002:a2e:910a:0:b0:2dd:60d3:7664 with SMTP id m10-20020a2e910a000000b002dd60d37664mr6737706ljg.5.1714403196813; Mon, 29 Apr 2024 08:06:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:06:36 -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 05/11] RISC-V: KVM: Allow Zca, Zcf, Zcd and Zcb extensions for Guest/VM Date: Mon, 29 Apr 2024 17:04:58 +0200 Message-ID: <20240429150553.625165-6-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 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 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