Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2921726lqt; Tue, 23 Apr 2024 06:00:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfG4vE8Eaq2vbCFF34sAxVwkQWqgz3G61x37SiSD4c8QzTNju4FMKNMLiHejEquLD94PakY2ebH1QgfR5OO73x47p0GQuia2SWEya8JQ== X-Google-Smtp-Source: AGHT+IENDjOfprQpbnxuP7+OFG71Ec/mP4QKHfy7t583lag5Lrdu/Nz71FuDKuvNLl6Y5lwqZGoN X-Received: by 2002:a17:902:7886:b0:1e4:64ac:caad with SMTP id q6-20020a170902788600b001e464accaadmr11684475pll.66.1713877233599; Tue, 23 Apr 2024 06:00:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713877233; cv=pass; d=google.com; s=arc-20160816; b=HjDtaoOj0ClMmReoNgVJr5WbF0rnnsYrWeppMsXBgf41I56Ef78BQvW9Iy2D9m64bv t9W02Z7bKYsAu9drnyfCQOObsvma6JNhunfQsQwZTCHP0zbKfeJ8QhaflCiDZ5RCVLoJ +BC6114DMrK2A2GHgQryd3YIJDqmmdM79O3lyMDe/n3U26+DMjgqKFnltrwkY58/ll4J iVKZwR/xaCOoXxlwOt13kWjsYv9sBmhXloe76snotxsFCsp0W+VXRVV/EMl2EckKw2ow /9epzdU6hnULh9eSlrDRRGjWF0NxXeeVmdhijQEePkRJH70+nUUhpjE3kiBe3Diw7b+L X3VQ== 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=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; fh=wDhi/+Kw1o6QwV/G22MBnrvLBSbWa7opB1dyul4IrT4=; b=OMLC9Vaiq71QHQJXKGVHl+BnozxjOhDaIKesZpZdI2NlaLKiw2w6B/+JMVkr1lfj3+ b7pI/7jvh6hozawbn/OgmqWH24yu5ilH283X9t8iEj5RprAQvQ1CulkTfkIPUt4Eco2x khqbq6gpzMv7OQle71q/MGyuvhmTcZU+mJmQV5UZjLkYo2qEyZoigI9jWjmgP/PzNN+n YaFljo+8oFGn4eAKtvQy9ir/bOgSqvKOOiqi/Rf79ZWYZTNCdtUH5H8OvbFQe5tSEJ3B Vcy7C5PxW4A+9jKGh3uobXIPRzPFozTcRR4f8ITau7HHirvD2CTJjRMDTD6iFdj2+ODA Vj5A==; 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=c0XJltOj; 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-155204-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155204-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id n2-20020a170902f60200b001e7d3e39b1dsi9607960plg.322.2024.04.23.06.00.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:00:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155204-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=c0XJltOj; 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-155204-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155204-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D6027B21E5A for ; Tue, 23 Apr 2024 12:47:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14F3F13AA36; Tue, 23 Apr 2024 12:43:57 +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="c0XJltOj" Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 BB9A0137C45 for ; Tue, 23 Apr 2024 12:43:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713876235; cv=none; b=QHezAHILPNgPdFc2rnP6rwpFCHb/SAYmxpMuzrpFFS12YerQ2MFhzse1n0ZQScDbUfIgVBAa7D/c1GrWxUy+60BOW+NswN59lq5+OLXYEh+8wTsNePMEJPYH4IemA+SwlL3qjW2YydKdpEc2soPcDyaGpqYdKGrnTNbxTdVyG54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713876235; c=relaxed/simple; bh=a0XzsdggPUj0Ja28kYjSZ2eAp6PAvvyuna/HjP+bSA0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=db8zsPq/n/l7XQBSh8lPAk4sc5g85HmxJBGXSCJJLRnu4dIfwM0on+W8i/huliL6oyKPsAYOrNNhEYiQ3wbRyu6SAYTeOKWg7WXWuKbtnxQZfHSH51GOI7pC/+kIyW7VdMqoJBU1jX9yUsf4bNIJX5yIVRVDvsdgFfgY/knfT9I= 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=c0XJltOj; arc=none smtp.client-ip=209.85.221.52 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-f52.google.com with SMTP id ffacd0b85a97d-349a33a9667so872021f8f.3 for ; Tue, 23 Apr 2024 05:43:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713876232; x=1714481032; 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=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; b=c0XJltOjiNF57/b+YdDEOIGt4isxWKV7BV1IoApSsRcpNWY86kZV/VygOxWAyB84j8 ZTMKTaN5gtrvhH/+1CbR66Il1a1Z9vWoCEAZEqYgwxsEJLHgyFWV+jtcC8mtvWV1jk7r 0KiVugH8UiGRIYxtPvfBf+/B/v/GSwvf0o354DuroONxu+k01hX4IWDtIMB8MddqKieD PP7LRF3WzfJ+tx/yHAZcZWHekpnL08XTsIps85/ZWA55DptlHhloyDWIsDbHiZ75+UEr uoiyBUQ/UxODKLAKol5tZulk6YZ3q2sZQmfnoTnAkFqPBxcZJ10xBBjSF6ziHrq40JlN dwjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713876232; x=1714481032; 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=GCiDEygHIpDe3Ww8uIgQjb2MclVWFXcZkaD66mBe1pc=; b=wwbLjojGenfGLQE8WOR9TbgkYA8QFXsTj57z2wZj2fTE4RuFI0VsdfJCHEjYmOnBjk ehZ4c5bFzrmB2XgGA5QX4R8TIsW+J6KNc1s/oWkKme4cr+iJHFL3cfo87DY71suAAmjh pOCLrFGivaquT2Vifq3zk+SGRFqnc2/HBRuUMzUjojmJIs5kkgXI24czMuiZRSMy12PR mC9wAX6wwkE8UDfiKaQlMQXm3pt5WLM2uVmA1eA1Bs4NN4CxilHWDtbNm5ZJVhNpc+ki FaWkbCDGcfQcDMjZfv+VBbaMiMUoxHQrgEbIC8BQBZOyVc1iZ6KMP/hce+L0Id7Xrrb4 iGpw== X-Forwarded-Encrypted: i=1; AJvYcCV9eFSWQPRm0LfWjmhLARQXBzcabkJiItFdqef88G8wFzMINSBZ366Aj8tbM3WKts9zUNl/hJktjFE8Ikxc0ssHaBheUwpAsSTdM/du X-Gm-Message-State: AOJu0YwRLiG1b853ZkB4uNDZ52x7xKsfULfk1ZiY3n2o+KDFF+ecOZNg Q7sZzA2SffSU2fzjmK2Ga113DCCKQjIoip5CKJ9kFGFiGHA+hVxBqJL148fQyeM= X-Received: by 2002:a05:600c:3d95:b0:41a:c4fe:b0a5 with SMTP id bi21-20020a05600c3d9500b0041ac4feb0a5mr958105wmb.4.1713876232338; Tue, 23 Apr 2024 05:43:52 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:71cb:1f75:7053:849c]) by smtp.gmail.com with ESMTPSA id v10-20020a05600c470a00b00418a386c059sm19975709wmo.42.2024.04.23.05.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:43:51 -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 v3 10/11] RISC-V: KVM: Allow Zcmop extension for Guest/VM Date: Tue, 23 Apr 2024 14:43:24 +0200 Message-ID: <20240423124326.2532796-11-cleger@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240423124326.2532796-1-cleger@rivosinc.com> References: <20240423124326.2532796-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 Reviewed-by: Anup Patel Acked-by: Anup Patel --- 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