From patchwork Fri Sep 16 05:46:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mayuresh Chitale X-Patchwork-Id: 1678532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=B8SESxQZ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=Fsj5zXLt; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MTNPY74nZz1yp7 for ; Fri, 16 Sep 2022 15:47:11 +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: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:In-Reply-To:References: List-Owner; bh=0ai+lo6Quuiy9FbOlzQwp9zzx1sm1rJMg3wmrb5WU2c=; b=B8SESxQZFXa/vx avarqEnNFUtHA9N9Sgtmn6ji0DCRZAmFNmOq2Z3j4pXl2JCTDn+kIxqtjBt2aRfsVJjajNFa2rKrn E8G1qRSUjsKNmKGouK0z7K0ZMytjkUYHwSzpRmTnF4EPVs5xDagHG3u/+ObnXWSENJZVEVx/z2MS2 sJDGja523KBihn4a0hV8eDxWIyqycGJP3HUqgExRZh+Hs3L2k5zgpb/Pep6f7cd4r3Df2PXgJbUWY cEBzOtsu11P/Ce8v3Ej/Bh1QFnEZBQG0DrdY7vlibRR4CwVAn+yaF1C+wVR4N2aotlknArqI+CaqP V5d8IQrsaCcpv92hRY8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oZ4Bt-008XEX-5Q; Fri, 16 Sep 2022 05:47:05 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oZ4Bo-008WvV-KG for kvm-riscv@lists.infradead.org; Fri, 16 Sep 2022 05:47:02 +0000 Received: by mail-pj1-x1029.google.com with SMTP id bu5-20020a17090aee4500b00202e9ca2182so983994pjb.0 for ; Thu, 15 Sep 2022 22:46:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=KR++kMsMWKOlc+go1l1Yf8GVj8KL9Cb61pjIboyyqR8=; b=Fsj5zXLtgwH/YZdlmfmkLFEPytAU1NquWJW8OQgjDyPxeRbtlhcW3+1Sa9n9LoEz2I NJD5/hmDPbgcTXEuKOk9adR/ws5N30EhCBhRkoir9JwMUMyHtYuLWGkd/D6iMPAXMEDf V4KlSCrDceX65VEDuaQyJm0ERVc/K8j43Nbj/sk9ZJv6/5SUwBj9ZpucRa5/p41yHhdq ljm61ZpCDMq5ERFu7NBe09WfMLrkIRWHykT6kAueXQiXTs6+VHUSHdJftASW6azzgDdg 8lWnJgsEOpvqrLBoCmPK9SQvPrzQBlDA8qSI+9q89YDHBfTL0jP58Y09etUNMd9eOQuF E5Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=KR++kMsMWKOlc+go1l1Yf8GVj8KL9Cb61pjIboyyqR8=; b=2B/YwX0CYx6qPjpDATfGMg8bLbxvvuo89hVQr9q9xhkixeT5af8ba2uM09KmvAuiqi Wceh/OSwoFCcNp7+HNZkJhIynT7J0BIaD4Pi8eCbbWPv2Vvb8wO7Cj/jZjSJA2qi+s1W sOyYsUgPIThRx91CJeUdplTJ4rC+zv8gRRMEt4dSJEiWpwuu7VWKxA97WtVasu2xlxXA sRxwg+Covp+PYdK590+2mAUgtMFG/txFnU4HpTPbY/r+LU8GWvNJtqjekCsHF++cDCOa E/5lT09ddkzGJwVZuhwDpy0AS9kSm9yM8c4rByajqphkvv4X49fOetu6kk8ZuUR3q/uv t1ug== X-Gm-Message-State: ACrzQf3M+uuKLOVbBbUyVkuA311HJTAmOQilElNUYf5phMDtXKuIk4Cg LgZeqclS3F7yedabXmZPogz8Pc3ba6uSpA== X-Google-Smtp-Source: AMsMyM4JBGvTNh7fQE8NpCvxngyrCkqFd4GiiY6UYjLCpIUP4L1QeuUxrbS9VFy/56AEnLRQg/hg4Q== X-Received: by 2002:a17:902:c950:b0:178:4544:55c1 with SMTP id i16-20020a170902c95000b00178454455c1mr3048836pla.168.1663307211793; Thu, 15 Sep 2022 22:46:51 -0700 (PDT) Received: from ThinkPad-T490.dc1.ventanamicro.com ([182.70.62.242]) by smtp.googlemail.com with ESMTPSA id t20-20020a62d154000000b0053e7d3b8d6dsm13400601pfl.1.2022.09.15.22.46.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 22:46:51 -0700 (PDT) From: Mayuresh Chitale To: Anup Patel , Atish Patra Cc: Mayuresh Chitale , kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org Subject: [PATCH v1] RISC-V: KVM: Allow Guest use Zihintpause extension Date: Fri, 16 Sep 2022 11:16:37 +0530 Message-Id: <20220916054637.24133-1-mchitale@ventanamicro.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220915_224700_712800_677761FA X-CRM114-Status: UNSURE ( 7.62 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We should advertise Zihintpause ISA extension to KVM user-space whenever host supports it. This will allow KVM user-space (i.e. QEMU or KVMTOOL) to pass on this information to Guest via ISA string. Signed-off-by: Mayuresh Chitale --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu.c | 2 ++ 2 files changed, 3 insertions(+) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1029 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 We should advertise Zihintpause ISA extension to KVM user-space whenever host supports it. This will allow KVM user-space (i.e. QEMU or KVMTOOL) to pass on this information to Guest via ISA string. Signed-off-by: Mayuresh Chitale Reviewed-by: Andrew Jones --- arch/riscv/include/uapi/asm/kvm.h | 1 + arch/riscv/kvm/vcpu.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 b6770ee08872..9085b90cf324 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -99,6 +99,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_SVPBMT, KVM_RISCV_ISA_EXT_SSTC, KVM_RISCV_ISA_EXT_SVINVAL, + KVM_RISCV_ISA_EXT_ZIHINTPAUSE, KVM_RISCV_ISA_EXT_MAX, }; diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index 901bb5c0cb50..0de0dd22e734 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -54,6 +54,7 @@ static const unsigned long kvm_isa_ext_arr[] = { RISCV_ISA_EXT_SVPBMT, RISCV_ISA_EXT_SSTC, RISCV_ISA_EXT_SVINVAL, + RISCV_ISA_EXT_ZIHINTPAUSE, }; static unsigned long kvm_riscv_vcpu_base2isa_ext(unsigned long base_ext) @@ -89,6 +90,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_M: case KVM_RISCV_ISA_EXT_SSTC: case KVM_RISCV_ISA_EXT_SVINVAL: + case KVM_RISCV_ISA_EXT_ZIHINTPAUSE: return false; default: break;