Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4223246rwe; Tue, 30 Aug 2022 06:44:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR6OcydbvJKV52kBO+JYWOPkqlAPo//Mqhe6T8sjcwIzTAW6GrWsA3yjHDHLjCcWrfwEatQX X-Received: by 2002:a17:906:9b09:b0:741:8ae4:f7a1 with SMTP id eo9-20020a1709069b0900b007418ae4f7a1mr7314316ejc.18.1661867072538; Tue, 30 Aug 2022 06:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661867072; cv=none; d=google.com; s=arc-20160816; b=WxAv07sJsBLLYLA4Aeqwjy/yTJEr1gv8ToleK0fU7r9C31rO0/gNWlfYcZ85+i4rei mkWZtbs5tHV45OU+LKwgOU2XQCdUUyyB5ey9VWvSmFzHFGYpV6kW61gVBUyfVH8LClk1 7iGPnctzcTJEfdUNqwXHNanCBC8UQqOATRKby+LE2+ksIoQdfN+6/3x/+9E81yki5LmT 6wAAlLIcJUYc8QZssjqG/EZn7AaGX3b+X7aCRVXH8MjsAKFXj9WfahThH2HHB9/XyGod wQF+usncss+9/osh2hD0Q+7oqKf2xW5hiWHZj7PnswnoPyJcUzSQ0G4Bd6jqNBoLdONv COIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xT/Z1OVYlVoOOLO+opUmyDYeXUAC+ZDM47Iv2objFik=; b=LlXQvZwnwSC9U3obZkzD9FVOX1U+YZTdS8GPH/3xFruy6ndHbDBBOdKHYdVgZufyvT 2fhFRJjTD2tnMqhpfPoTNnaK40U4VNRO5+h0Wtb4EjXlyWwToFrsdIqiwBKOsp/4fbW0 W0EWMAZJzka8NSSxv3SxThEHcWcgNwqeSJcNdJJCOe5Dk0NvEy/VP/7ngIvG+tTKXVtH bygvj5vQg+qLcGxNJ3yJ/2bG4UwQDDwwRx5eMfQWt7FLzNf+UB+FqmBNvCgm2BZ1r5qk QQTC3KM7ZaiyX5+Pa0ieL8L2WFkQg+l0Fv7UYQuCXaT7QLfHwk7gngTZ7EkXx/9niE8U MEpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=An2spsmb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i33-20020a0564020f2100b00447e9724023si8130194eda.270.2022.08.30.06.44.05; Tue, 30 Aug 2022 06:44:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=An2spsmb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230141AbiH3NiJ (ORCPT + 99 others); Tue, 30 Aug 2022 09:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230150AbiH3Nhw (ORCPT ); Tue, 30 Aug 2022 09:37:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08921E833A for ; Tue, 30 Aug 2022 06:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661866668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xT/Z1OVYlVoOOLO+opUmyDYeXUAC+ZDM47Iv2objFik=; b=An2spsmbK8QxEFwHpk/L40Gm5LIWrG/OfqdU+ejCRUlCw7Zmu3krU0V4smP5B2p/HOjwxj +ZBkX/MaVyAMjWAeUOPLwmnhJ+QKcOAxRivQRF0F+seCyQxNjRNE/fIMU/3lPtmjPGY6yZ dn8QAWsJC5GH1KLOsj12UAhjcj8vQ8w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-589-BW-Rh0rPNvSMZIxgjdL3yg-1; Tue, 30 Aug 2022 09:37:45 -0400 X-MC-Unique: BW-Rh0rPNvSMZIxgjdL3yg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED1CD1020BA5; Tue, 30 Aug 2022 13:37:44 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.194.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A7212166B26; Tue, 30 Aug 2022 13:37:42 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , Michael Kelley , Yuan Yao , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 02/33] x86/hyperv: Update 'struct hv_enlightened_vmcs' definition Date: Tue, 30 Aug 2022 15:37:06 +0200 Message-Id: <20220830133737.1539624-3-vkuznets@redhat.com> In-Reply-To: <20220830133737.1539624-1-vkuznets@redhat.com> References: <20220830133737.1539624-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Updated Hyper-V Enlightened VMCS specification lists several new fields for the following features: - PerfGlobalCtrl - EnclsExitingBitmap - Tsc Scaling - GuestLbrCtl - CET - SSP Update the definition. Note, the updated spec also provides an additional CPUID feature flag, CPUIDD.0x4000000A.EBX BIT(0), for PerfGlobalCtrl to workaround a Windows 11 quirk. Despite what the TLFS says: Indicates support for the GuestPerfGlobalCtrl and HostPerfGlobalCtrl fields in the enlightened VMCS. guests can safely use the fields if they are enumerated in the architectural VMX MSRs. I.e. KVM-on-HyperV doesn't need to check the CPUID bit, but KVM-as-HyperV must ensure the bit is set if PerfGlobalCtrl fields are exposed to L1. https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/tlfs Signed-off-by: Vitaly Kuznetsov [sean: tweak CPUID name to make it PerfGlobalCtrl only] Signed-off-by: Sean Christopherson --- arch/x86/include/asm/hyperv-tlfs.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 6f0acc45e67a..3089ec352743 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -138,6 +138,9 @@ #define HV_X64_NESTED_GUEST_MAPPING_FLUSH BIT(18) #define HV_X64_NESTED_MSR_BITMAP BIT(19) +/* Nested features #2. These are HYPERV_CPUID_NESTED_FEATURES.EBX bits. */ +#define HV_X64_NESTED_EVMCS1_PERF_GLOBAL_CTRL BIT(0) + /* * This is specific to AMD and specifies that enlightened TLB flush is * supported. If guest opts in to this feature, ASID invalidations only @@ -559,9 +562,20 @@ struct hv_enlightened_vmcs { u64 partition_assist_page; u64 padding64_4[4]; u64 guest_bndcfgs; - u64 padding64_5[7]; + u64 guest_ia32_perf_global_ctrl; + u64 guest_ia32_s_cet; + u64 guest_ssp; + u64 guest_ia32_int_ssp_table_addr; + u64 guest_ia32_lbr_ctl; + u64 padding64_5[2]; u64 xss_exit_bitmap; - u64 padding64_6[7]; + u64 encls_exiting_bitmap; + u64 host_ia32_perf_global_ctrl; + u64 tsc_multiplier; + u64 host_ia32_s_cet; + u64 host_ssp; + u64 host_ia32_int_ssp_table_addr; + u64 padding64_6; } __packed; #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_NONE 0 -- 2.37.2