Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp178816lqe; Thu, 4 Apr 2024 03:35:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSFP5yqn1tg1HCXJ5HBIysBzzFhfENIj0R0u4mUKDSjcm4A66NkKz8j1JZWnfgmzdl5RrbXly7aDCWzwo4n1GMh9c1FzefuSnwf7X0sw== X-Google-Smtp-Source: AGHT+IE2D0T3fHwqAYOMmjQIYB6bEkkmN7Dt/CyZIRbv7uoxsS1rGGf+X6ebBrkf16pa87fu/0yN X-Received: by 2002:a05:6808:6cf:b0:3c5:d2e0:1aba with SMTP id m15-20020a05680806cf00b003c5d2e01abamr1912352oih.32.1712226939694; Thu, 04 Apr 2024 03:35:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712226939; cv=pass; d=google.com; s=arc-20160816; b=rmX5PrFRB4Da4LuCtg3b0U434RiLZzV5WgK/BWyWuZGpSLnMefDlWY25XI8Xin9Hdv RgXY0GSOi4vPCb7H4aFlOVctigU3Q4gAlHHc2MGCOO5c3E0KSIwY6kZCZ/v7JnwPhFMm v0a52t3w1GYEe+SH2Q0nbEu/dXT6q50Khv8P/WO3AUqfVq8EoPF9OAfpSRdk0itH55Q9 4khTabYyOsVMs9cBwqqDdzmB5Sg5FL7xSAv9xCqRCiW9nN2K48f83eFZoDuS77M9lpf0 /cZGswCh2KNruoiG0rDfesHhxz5lzvAdJMiWi0/4VZWctu2QG232vJ7IK2HUbmdY4BC2 7Zeg== 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=p3qT2c8/AbHM1mLG3KaUUQ1VJHCZOCgVEzdfPOCGq3I=; fh=6Eg7EbddkkJ0AH91YM/XgeTNO2TGIuUEaPXuQmvklxo=; b=aaKAq/p6Ygj5GgjdZV3EtfIAfesme9e4EqVz62l1pUwWiCKTwqtb1EbJSY7vi6ZPfc wF3/soJGdRtkd6yf71EKtEyzODVqc+U/qJpbzFZv7ik3ylpLKubVk2TaAjiAgGZc3Lvm 13tNMOe7L6nXIRW9VQG62aIeYTN+luIRT32yDJ2Z+Qex+xEz6v43TwUAXYtnWkv+wWHP 8vV6oglfIot4UeB0QvsU11KlSgPxSqdQpWvs6+EjUlNPJ/XapzM2eTUpjGSyDNDu7yqJ 321Cgj5kpXhAOAZj4GWK2r52i+ThhqDXr5LrKIEvx22su1yZStRnG3dDJwHekGV+6XD1 7HlQ==; 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=kPtlXCEt; 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-131245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131245-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pe9-20020a05620a850900b00789fc9196dcsi15785711qkn.557.2024.04.04.03.35.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 03:35:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=kPtlXCEt; 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-131245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131245-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 5C4B31C21D16 for ; Thu, 4 Apr 2024 10:35:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0514684D1F; Thu, 4 Apr 2024 10:34:32 +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="kPtlXCEt" Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 E6B3E80C15 for ; Thu, 4 Apr 2024 10:34:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712226871; cv=none; b=mVxULS4g3LboA4iGbbCqA/qTD/B+pwJ70vRs28/+dMQmQ0mUWDJNuSkeycjR7Fh5jFp71Rk/vqEPWS5dYz0gLeIN1QfagBHHt3NsSyFHJG0ATQMu79qGsywRu49bdmt55j0oLj/urlGkGLRDpJglUs4Ha5DDomOLH12D5HibdlU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712226871; c=relaxed/simple; bh=tISoTGebS4407fh89NkrPP6RNVyQwmfvD5bdgCJ5Fi8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uUl6WB7eePP/8DyxwSpxdM1sfALJSCXc2JXgIXAygkzws59wXrPZir8FNo2C+lBTqIPR5AHTsjllMFhF2zW0m8NkzOxn8xHhpoo0hRAca33auy/zcSDZ3s6uGEpflKbxzHuvxnQqr5Hdv0IYC4CcAZq/UhCjeaPrC1iF6Fjri/g= 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=kPtlXCEt; arc=none smtp.client-ip=209.85.128.46 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-f46.google.com with SMTP id 5b1f17b1804b1-41401ee5828so416515e9.0 for ; Thu, 04 Apr 2024 03:34:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712226867; x=1712831667; 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=p3qT2c8/AbHM1mLG3KaUUQ1VJHCZOCgVEzdfPOCGq3I=; b=kPtlXCEt3EGAeK1fE02h12tzNeJyPkb+mlY6384SqmhbD+fyGuNRR+McyQtUivwIC9 6YECsvTAdrIhQbDwYaXq+TRPXDxMwsqpq2UvFZaSYDKx5J+gFkKhSHOjIHl0rMXhnAqv 51ajX7hVamiWHpfS5x8FslulSnfKLKkobQ6CGNQcuihGE/OTocXBYyzPAPDe8NXdBYzI txrqagC2MFiY8L4sybrJAShVvO/nQCh8UNO34OAxd7I1ZY8K86TB3J8lXgdGq6oKi3LW uxvBfeJXbj3rz7TSWJLDFA1kxpjuBkO+9zdCcJ3EfW+4AVgSlHcNbwC6cY3qqve5MjnH 5r+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712226867; x=1712831667; 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=p3qT2c8/AbHM1mLG3KaUUQ1VJHCZOCgVEzdfPOCGq3I=; b=gdqXYaK9/2d1YPURrkKzT3DB1J4UP4Pn2gvqDEFfCfEb9xdWJGWXfqO1As/PZBvFMB 6bzcSdciAjHh22R7z/DDVu0n/ZJPTpugG85tha0+M7ZBJJbeAKmfj52lWEgsnGZf0Zt1 S87AJPYiaLpdAJd0w3Ar0LXRHIesoKO+UTqperthipAyjEtyaoY6rXob4cLxEzdSdY6+ MdCVJhlhh+CeShlHqovzL5QpeJM0By9h1ZMuL0arKpBiC93Z6UHPCAdiTaUB45IahAl1 dXLV71+YNRE8k8ADSkFlnxo9A9MumEqEoe058a5uIugEEjPNKYi6+C8a0t6GZi3ljn+K ki4w== X-Forwarded-Encrypted: i=1; AJvYcCWMT9vA2lWEVUIEEtPwHWpPIqmOpH8U8mz/8YgGcvmgOE3dTQXb/xnrqstR+s63KWnwbcRmJ80olAJkapuOwt0U3IwK7xYWqz8CWD/i X-Gm-Message-State: AOJu0Yx2IJVeUvr9aojuVY6Hsy0IvXUqqI4/PJaRcbMUbSArC/ZqPkKV w+n+GUJy31G4TkWuXEQFJK0y6oJb0H5Zq1TRw9pCKIZyR9/yCdOmw/yS7sCf0x0= X-Received: by 2002:a05:600c:1c13:b0:414:6467:2b1d with SMTP id j19-20020a05600c1c1300b0041464672b1dmr1726188wms.0.1712226867334; Thu, 04 Apr 2024 03:34:27 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:555b:1d2e:132d:dd32]) by smtp.gmail.com with ESMTPSA id ju8-20020a05600c56c800b00416253a0dbdsm2171340wmb.36.2024.04.04.03.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 03:34:26 -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 4/5] RISC-V: KVM: Allow Zimop extension for Guest/VM Date: Thu, 4 Apr 2024 12:32:50 +0200 Message-ID: <20240404103254.1752834-5-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240404103254.1752834-1-cleger@rivosinc.com> References: <20240404103254.1752834-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 Zimop extension for Guest/VM. Signed-off-by: Clément Léger --- 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 b1c503c2959c..35a12aa1953e 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -167,6 +167,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZFA, KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, + KVM_RISCV_ISA_EXT_ZIMOP, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index f4a6124d25c9..c6ee763422f2 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -60,6 +60,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZIHINTNTL), KVM_ISA_EXT_ARR(ZIHINTPAUSE), KVM_ISA_EXT_ARR(ZIHPM), + KVM_ISA_EXT_ARR(ZIMOP), KVM_ISA_EXT_ARR(ZKND), KVM_ISA_EXT_ARR(ZKNE), KVM_ISA_EXT_ARR(ZKNH), @@ -137,6 +138,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZIHINTNTL: case KVM_RISCV_ISA_EXT_ZIHINTPAUSE: case KVM_RISCV_ISA_EXT_ZIHPM: + case KVM_RISCV_ISA_EXT_ZIMOP: case KVM_RISCV_ISA_EXT_ZKND: case KVM_RISCV_ISA_EXT_ZKNE: case KVM_RISCV_ISA_EXT_ZKNH: -- 2.43.0