From patchwork Tue Jun 4 12:45:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 1943293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=skC0bqa3; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=mw/kqOjz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vtr2Z0W7vz20Tb for ; Tue, 4 Jun 2024 22:47:02 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UK8xPWe7RF+9z7LDzBpjGo1obPuBaSXyJmVGIBByH8U=; b=skC0bqa3O8/Bpu HV//kT05hTG+67G28M2ACvYn98sHp2uP+JJLBwWbK2TPC+zRIRNpiv9QUl3RTVUyVzsPqS9a12+vq /4NK3hMsfpG8Gwva7kGpVPz0KljkrPTrrKl7HmSOiL2+pNX0H5P6Ch94l4AWIoMSWDZDkkejDS3hc 1z6FXszDzroTccsG+eyvcKP4/y3Ybi5GY1MBjfsMFKivziOD8z3ZyiPFAKUnymu/GXbIMtsKj4skv TXjOEM3aTe0nkwd4OeRgOdJ+tDOFRVqCjB7zaFRKA8CHKbSk49d21y0RKH0qTuQP9Ta2Pj2PGliNs DBg8qfjqjRVjcLj5tgkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZ6-00000002Lbq-3SVU; Tue, 04 Jun 2024 12:47:00 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETZ3-00000002LZN-3ioK for kvm-riscv@lists.infradead.org; Tue, 04 Jun 2024 12:46:59 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1f61392237fso1690595ad.1 for ; Tue, 04 Jun 2024 05:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1717505216; x=1718110016; darn=lists.infradead.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=6mFZhmlMUdGr00o3b1f1nxWnxsIbMQJnxaGpqqSRdZE=; b=mw/kqOjzbTddqqdThDOoP5T3tUyfBFs3mLmiyYDS7Rbbg/3DPUW6CucH9sQG0q4Hf4 P7B3wZn1BIJb7to6g8D/qy0Oz95FBGi8DFfBhrJKLlufiesD7Lgjjjkzq1FJx9m5VmxF cizBCG2fZaHVROowGP+3pNMh5W+do4tqQVpkqyj3v17eFiFP/AUWgHw89052nArNwMjZ Qy8EPi+SZLgq5UQPvD0qbK3xR1RHPH5UL2z6yY3ljMqTQfRNvBrNtkxKfP04tGFtafro SkLUvwO1i0C/MFXOscwvvfBsr6NWVGm7D5DqSoHk4IWwoyV0fWJUPr1Md3co6p+GwDx9 FHdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717505216; x=1718110016; 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=6mFZhmlMUdGr00o3b1f1nxWnxsIbMQJnxaGpqqSRdZE=; b=FSkG3M0L24C8lXCUx5jG4BuvScM/VZbisRZlQJBqitM336RxHf3TZVjwrVI0g6v33z p4mOh1SlNIEszIyqtH/78P48gMKUe1+J+mGLzYMjdX7lOaFmv/GjPpRBApF/bxZu/sdK GoLOR9LSd6f2VZQlmzG9OmQUGqk6ES2ZF2kw6xBL8mwjaRv8qRKAA/Ek7bn3SMtyudkB qgtm9VTCTIct1CjAVrexpweqnmZNTaNLRQKEDJ0GHC0QxSSSaxDUxkUV0W9WgAMGyC0j ukMriD+SAeeD4CiANwD7mkhX37or4e6L39286VbnLqgWVR/DaKNIUOQo7WdXuebqy9uK BaNA== X-Forwarded-Encrypted: i=1; AJvYcCWjlqrqmbJf2tlx/Q5ii9WJlaHt/EJXjt9N0PaGwss4UTCnBk5KS1rya0eCHJ8qA7+9hBF4UlU0f6zQfZ6YMqPdplHRy6yPX4hKYcdF+Q== X-Gm-Message-State: AOJu0YxXWnsbJEbjRCDdRNnZlry1dkIKjnEat+irvx9kyhQ/ISMste3g xf/e0VJZe3Ozdk4OrPCiCcUDYqzLOHi9SZ4Nfwth6+0u2OoDgL9p6veoUN6YDGg= X-Google-Smtp-Source: AGHT+IFM41pQHUuJV2gzPwT4wOW9apDVDvAoHL8KWfUvAyFLfhBEBPDzezVMzHLJE7/SomhB0oFg6Q== X-Received: by 2002:a17:902:ceca:b0:1f5:e635:21e9 with SMTP id d9443c01a7336-1f636ff9877mr138756065ad.2.1717505216018; Tue, 04 Jun 2024 05:46:56 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:327b:5ba3:8154:37ed]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323ebc69sm83042885ad.211.2024.06.04.05.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:46:55 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Anup Patel , Shuah Khan Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , 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 v6 04/16] RISC-V: KVM: Allow Zimop extension for Guest/VM Date: Tue, 4 Jun 2024 14:45:36 +0200 Message-ID: <20240604124550.3214710-5-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604124550.3214710-1-cleger@rivosinc.com> References: <20240604124550.3214710-1-cleger@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_054657_965144_1E526D57 X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: =?unknown-8bit?q?Spam_detection_software=2C_running_on_the_sy?= =?unknown-8bit?q?stem_=22bombadil=2Einfradead=2Eorg=22=2C?= =?unknown-8bit?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_ori?= =?unknown-8bit?q?ginal?= =?unknown-8bit?q?_message_has_been_attached_to_this_so_you_can_view_it_or_la?= =?unknown-8bit?q?bel?= =?unknown-8bit?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?= =?unknown-8bit?q?_the_administrator_of_that_system_for_details=2E?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_preview=3A__Extend_the_KVM_ISA_extension_ONE=5FREG?= =?unknown-8bit?q?_interface_to_allow_KVM?= =?unknown-8bit?q?_user_space_to_detect_and_enable_Zimop_extension_for_Guest/?= =?unknown-8bit?q?VM=2E_Signed-off-by=3A?= =?unknown-8bit?q?_Cl=C3=A9ment_L=C3=A9ger_=3Ccleger=40rivosinc=2Ecom=3E_Revi?= =?unknown-8bit?q?ewed-by=3A_Anup_Patel_=3Canup=40brainfault=2Eorg=3E?= =?unknown-8bit?q?_Acked-by=3A_Anup_Patel_=3Canup=40brainfault=2Eorg=3E_---_a?= =?unknown-8bit?q?rch/riscv/include/uapi/asm/kvm=2Eh?= =?unknown-8bit?q?_=7C_1_+_arch/riscv/kvm_=5B=2E=2E=2E=5D_?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_Content_analysis_details=3A___=28-0=2E0_points=2C_5=2E0_re?= =?unknown-8bit?q?quired=29?= =?unknown-8bit?q?_?= =?unknown-8bit?q?_pts_rule_name______________description?= =?unknown-8bit?q?_----_----------------------_------------------------------?= =?unknown-8bit?q?--------------------?= =?unknown-8bit?q?_-0=2E0_RCVD=5FIN=5FDNSWL=5FNONE_____RBL=3A_Sender_listed_a?= =?unknown-8bit?q?t_https=3A//www=2Ednswl=2Eorg/=2C_no?= =?unknown-8bit?q?_trust?= =?unknown-8bit?b?IFsyNjA3OmY4YjA6NDg2NDoyMDowOjA6MDo2MzUgbGlzdGVkIGluXQ==?= =?unknown-8bit?b?IFtsaXN0LmRuc3dsLm9yZ10=?= =?unknown-8bit?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publ?= =?unknown-8bit?q?ish_an_SPF_Record?= =?unknown-8bit?q?_-0=2E0_SPF=5FPASS_______________SPF=3A_sender_matches_SPF_?= =?unknown-8bit?q?record?= =?unknown-8bit?q?_-0=2E1_DKIM=5FVALID_____________Message_has_at_least_one_v?= =?unknown-8bit?q?alid_DKIM_or_DK_signature?= =?unknown-8bit?q?_0=2E1_DKIM=5FSIGNED____________Message_has_a_DKIM_or_DK_si?= =?unknown-8bit?q?gnature=2C_not_necessarily_valid?= =?unknown-8bit?q?_-0=2E0_T=5FSCC=5FBODY=5FTEXT=5FLINE___No_description_avail?= =?unknown-8bit?q?able=2E?= X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 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 e878e7cc3978..db482ef0ae1e 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -168,6 +168,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZTSO, KVM_RISCV_ISA_EXT_ZACAS, KVM_RISCV_ISA_EXT_SSCOFPMF, + 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 c676275ea0a0..09f0aa92a4da 100644 --- a/arch/riscv/kvm/vcpu_onereg.c +++ b/arch/riscv/kvm/vcpu_onereg.c @@ -61,6 +61,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), @@ -143,6 +144,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: