Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1282004lqb; Thu, 18 Apr 2024 05:47:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX38EGeC7blDJIOaR1sHJg8YNKGlqiWgKoky/WCsn4caI5Ic19llcqoPIPnht8+QmHBk5YVx05elSCXqNu5gLiQWhZk+3S2PL82tLXkoQ== X-Google-Smtp-Source: AGHT+IH1qhgh0I6U5f0wgieGL3VANGfNjOpLZ6PTXQ4y6E0eKHXGOSi7V9TDh8hGMbDRU5o7vmFa X-Received: by 2002:a17:906:ad85:b0:a52:4394:fff7 with SMTP id la5-20020a170906ad8500b00a524394fff7mr1667078ejb.11.1713444469747; Thu, 18 Apr 2024 05:47:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713444469; cv=pass; d=google.com; s=arc-20160816; b=y9CyDBN81Pt7mqiWDuqT/CJWISTxvg3+I/PEDj1GG5pLiVAAIm38yhtFIhCNLiBppn /aatfR4cSD4FOWz5qPiGZ9ItDFxseDKdrhC8GG+Q7gpEpF0hBNw5XSSTjwIMZS9khXSJ H+a3vXu7YwoslNuvAUJgukQ1CrMf8RvfWEJNNVuOd8SQuEPUNC36xYBWBva48Hsx0b+k n/fT6aP1KMkM+NexinEga1+22pSY0gFxN7x2PL5TB4E0PBbICc9l0jdOF1e4JWOrS4Xz Rhm4q5Ts3P9W/WisjrV6pP6ztTpIEYCn8jCBE8SsLVscDc85BmMhxgJ7r43/fCWUOOVZ a0wQ== 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=FohdVePPG5jzF3AfSRVe1tr20y+8LhH20P3MwlhF1eo=; fh=IKbsYUgAjQizjmWszBQIsw+Az/V5ML1S5N8KeGUQIro=; b=cAPj3NI6qzpe2iOF67hB0fYSGHu9qJMuiA6WTyAWpNkP7M23caGluKQAT3UAHNTyD/ KCBTnwsg9n2dlPTO/V6TiZrPoRMW4+7XKj6Wm2sslAMV39IWYGYj0QOUjIdLQthD+4HD vcFaIu85T9KEfY+3ek9AMFwxCmsY78pyg/WeUgfdUxovKhKw/qpo36rVce3nRuAxHIWr ZbsdTxoyXMXQDjV296DTh9YyfG8nvyTvwISBLKMxjLz2N9X2kUcS1Bcslbzsd3e9So5Y wqH7DG+xHR1HIM8zzpVa7IPVf3FL/VISBLVbcKr/T0bj5w5RUp/7egdwI7zjzG4UZ5yE 2Y6Q==; 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=RnhoPpNU; 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-150088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150088-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id va2-20020a17090711c200b00a54c12e2eabsi796669ejb.324.2024.04.18.05.47.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 05:47:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=RnhoPpNU; 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-150088-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150088-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4CA1A1F21552 for ; Thu, 18 Apr 2024 12:47:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66E1616C854; Thu, 18 Apr 2024 12:44:12 +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="RnhoPpNU" Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 CB07D16C448 for ; Thu, 18 Apr 2024 12:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713444251; cv=none; b=toxqfbcdppMNWoXuiutHQBWRSASm44sXxB4Se3VWHdh7pCAYLiMbaijrzPBd5y/Af9vCmMouqZXVl9UaAdvtvI19BwjLxHlQZiVNXDY78zBQsBjjWhAlN14fs+IDfayHYxq4S/7tGH4+pVEcrUJapvDOmOF1Xg5jfD2+Vrb0Akw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713444251; c=relaxed/simple; bh=HQo5r2yUgakVhWXfDWTWm3kBkPmXvDIfNJUSNTdYREQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ifO5ghdySKnn1Wl82TcIWl8VYK0u2qP7//PuuwKgVNbN3GsmEqHjL8BUt24e8AiAWNNGqUd3A7zZXGYB5iUZGtWDJNIPj3Hxjh03ne8fITc9ZSHipBNMNKA7G0AcA0MIlrWTSK1GAPinSOTpoodyFyiTji0vG4kqm0rJQKTEO6o= 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=RnhoPpNU; arc=none smtp.client-ip=209.85.221.47 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-wr1-f47.google.com with SMTP id ffacd0b85a97d-346407b8c9aso222984f8f.0 for ; Thu, 18 Apr 2024 05:44:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713444248; x=1714049048; 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=FohdVePPG5jzF3AfSRVe1tr20y+8LhH20P3MwlhF1eo=; b=RnhoPpNUqhBHSR8Pqozu9LKSydw7+EgkdOPjEmElmd28nd1AlcMnr85Nh5gCwBi89h ClOviyZQw+YeFsEz+0rA7BluS8rVY3lgZxNxUeenP1KBlLyqYW9NiqPknbFgfDnbXWhJ lJsnOolTeFRIjr5G8qMoNoh7vA//6LI5g0o17bO7IgZBZYmZrDvYe1N8hzE1HiwL8mon t5YJ04UWMFZdsSuAN3v5BdVb2bOtFd5HzKa3NkqTBOoGq1szqMlx8UdwBw5Tof41CKau UK5Ny5Tu+F1cnjv7YeSaXXkStNo6W0K2FABkV4cbLtds7g1p7USBxEADYHYsLg8t6Vqj q0Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713444248; x=1714049048; 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=FohdVePPG5jzF3AfSRVe1tr20y+8LhH20P3MwlhF1eo=; b=Q4DxHhify/Ag4uNp31FpKZOVZRblzW4McwxsROATBYOhmyxxxgFGZJyBbWm+n2sCCK BlfaPyyuWenJIoK+BPAtvdkHpVA15MBiLODIsE+IHkypsNjsSvIqg8iytWbCEnJoIQeB Vxrfu55OlFiW4qmgqKD9faeOCc8Fsn9PJiunebSSPafAKDGm/pZZF6T3dVqYVGnRgvy0 DwNypqnUYXyKlS9Wxjb0dASx1QPdMOohSQxGMWH3zWaxzI9e+GegBtTkbbNQrPYLKgd9 Frnoq5Kl77rCT4lmP4zpOOVIfn85U8StkH/1YD3UcNlj+wt69LLNKWtgFEwS3GDp5gHG pP2w== X-Forwarded-Encrypted: i=1; AJvYcCXpIr5yJXS3usQyb93SXiInw6UjRYCF2HxsWGrnRioX/mERCecpLBp+PRkJt5f2h/r87nOAinikBmhavhhqpKgJCIf2bdMyDjyTpqs6 X-Gm-Message-State: AOJu0YwWj9oM3N5QrDjSDrRa+UuhyejDqkh4JjJ5qZxlQK4vbfPm6gD4 BK1c/EAJHBbTknI8ZX3dWq8AhJHFoaUpNV0r0mm4hIXGqqDMCd9GL0oAcD6/eHw= X-Received: by 2002:adf:f984:0:b0:343:f2e0:449c with SMTP id f4-20020adff984000000b00343f2e0449cmr1668881wrr.0.1713444248202; Thu, 18 Apr 2024 05:44:08 -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.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 05:44:07 -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 11/12] RISC-V: KVM: Allow Zcmop extension for Guest/VM Date: Thu, 18 Apr 2024 14:42:34 +0200 Message-ID: <20240418124300.1387978-12-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 Zcmop 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 57db3fea679f..0366389a0bae 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -172,6 +172,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZCB, KVM_RISCV_ISA_EXT_ZCD, KVM_RISCV_ISA_EXT_ZCF, + KVM_RISCV_ISA_EXT_ZCMOP, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu_onereg.c b/arch/riscv/kvm/vcpu_onereg.c index a2747a6dbdb6..77a0d337faeb 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -52,6 +52,7 @@ static const unsigned long kvm_isa_ext_arr[] = { KVM_ISA_EXT_ARR(ZCB), KVM_ISA_EXT_ARR(ZCD), KVM_ISA_EXT_ARR(ZCF), + KVM_ISA_EXT_ARR(ZCMOP), KVM_ISA_EXT_ARR(ZFA), KVM_ISA_EXT_ARR(ZFH), KVM_ISA_EXT_ARR(ZFHMIN), @@ -136,6 +137,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_ZCB: case KVM_RISCV_ISA_EXT_ZCD: case KVM_RISCV_ISA_EXT_ZCF: + case KVM_RISCV_ISA_EXT_ZCMOP: case KVM_RISCV_ISA_EXT_ZFA: case KVM_RISCV_ISA_EXT_ZFH: case KVM_RISCV_ISA_EXT_ZFHMIN: -- 2.43.0