Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5867375rwb; Wed, 21 Sep 2022 13:43:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74OFkgQNxUzaX3QHj9M0/bZrfMDUNaxQ20TNFATvuc/p7/keD84lQNurXFZVQe21UmQoB7 X-Received: by 2002:a05:6a00:4206:b0:545:68f2:292e with SMTP id cd6-20020a056a00420600b0054568f2292emr95219pfb.76.1663793001964; Wed, 21 Sep 2022 13:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663793001; cv=none; d=google.com; s=arc-20160816; b=0bOkfZiFgvrM73fZCCOxUU6ICUTE1GUY1qS/b30o8mxOCYL2sB3MStKmes5m6Frvlu zFDZazZUfW+1+BkRJB9m+LBBFT4x2gaX6iYPywa5QuHrqfuStVCdkj6UVReziOf1oWDi xAIDSJMIrgOyScyfOxYyFDq+vEyv20Z+mzgjiU/Ms+AZ/ZB40B7Fegr6rFalWdvgAPNy RLo67FbK/XmdZuZ5FHnhXp7DSMrQJSGYEPNHzdIMGglrPBiU8GZuPwFmwCmolCK0N8W+ xFC5cK65apm66FAoKycf2ocqwvkYg+gV+T7c5JYJPwgXHDJ/HuxoEp6L9aNaX/jrt3Cl P+gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=85AbQQlrxSyNOvkklUzdnLL8SyGBcXrNMjiPdjNbViM=; b=CYGUCf8H32evkN4uNV9EDnsj36/kWebGJm03r3FR4sr1jTjqeNudzc7WSQbTkt0FHi DRxkNp2BdxZj2ZqWC1qgOaYkKB0Ddqtr9nMnAJ5/yEA9ECRITUgVRG5CMv7dRzAVMVcg L3l/2felmy2znUp1wfzFaW4QvcBfCxqjhe4gQmXldqilRKuutsCYgDH6LFkL7LUVhb8d kEjejKeww0zX4BD8R6irPsqqkKXauuChUQdZptGGGtxZyJ/KGvOZGpOtuQx55CODmuNR sjbtT7S4MQwEcT1R5mmr2V+TshTHL2s/N6pS0BWl1BC2io1J7uiSZ3kSLAEjEemBNbWV ugvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=GRc1XP6p; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj3-20020a17090b4d8300b00200a22064afsi3844090pjb.41.2022.09.21.13.43.10; Wed, 21 Sep 2022 13:43:21 -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=@google.com header.s=20210112 header.b=GRc1XP6p; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230467AbiIUUQR (ORCPT + 99 others); Wed, 21 Sep 2022 16:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230380AbiIUUQO (ORCPT ); Wed, 21 Sep 2022 16:16:14 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D642A9CCF4 for ; Wed, 21 Sep 2022 13:16:11 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id m188-20020a633fc5000000b00434dccacd4aso4020851pga.10 for ; Wed, 21 Sep 2022 13:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date; bh=85AbQQlrxSyNOvkklUzdnLL8SyGBcXrNMjiPdjNbViM=; b=GRc1XP6pFfXy+MKZXSkWMWzT1GELN5Jwabnv/SNslVgH962Xpspgo2fYtTGD0wD1yO EyDnc2Iv8VL1SoB8JGww4seaGNzIiBGtGJqoEhn0/65bfykOoJr1AqSl9cwPSjHF4gBG 9BT3JzcOSNTQYZ+EulPuwyqOdBLoRsUsD0iWuGQLzB3RslV8e1ku2UbmzEOs4ddC6jbo kwM2kdb7P0yFMuASjfoCnlNLOHjHhlEkAvncZI346xaZBoDAHc9Sefwl3j/AnJ3rxFs1 eLY6FCz8ZRiHCXxP4cRVO6OWSGPra020qJUeYughUtf5Pko4ioaDFSo1epv/kfT1VBAQ a1gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date; bh=85AbQQlrxSyNOvkklUzdnLL8SyGBcXrNMjiPdjNbViM=; b=JK7KvuAk51luiUhMRjycdkCPA/IS+HfuQcM8cIX4ZGj9q6DuO0aScVke7gzyhEK8/v C+QJJgh+/6GXXat1htqcg4zTGBHTpQCdFpyDRTmhX+7PCzEpTEOCHaNRj0ZIoHCfKw07 XYJUgrNZ5e2yF7HEht/OI56H/eCTyfm0cGg7CvoVbFMZo8/LnrF4YU7ms3QgzNtcpAFM z/1s8e4dHQu5aiItkcuSAvvFjjS6CTXHA2LLzNRDsjIIkRtf+jk/C9p/EdmXbcn74j14 Fv8BjbVbewV9GSGxqY7/LgNduvxzkHveXQeDMQUVYzQHJ/ypgZ/Woj8KDKdTKIK3stgj hRZg== X-Gm-Message-State: ACrzQf2x8zzGJjciBesRmOF4dR/QzY46dy5iEIbuTH+pNTSyieVugKLz 2UxMo8yyRUHirGqsFjxKwcuZitau8Yo= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:2402:b0:52c:81cf:8df2 with SMTP id z2-20020a056a00240200b0052c81cf8df2mr30477098pfh.40.1663791370910; Wed, 21 Sep 2022 13:16:10 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 21 Sep 2022 20:16:04 +0000 In-Reply-To: <20220921201607.3156750-1-seanjc@google.com> Mime-Version: 1.0 References: <20220921201607.3156750-1-seanjc@google.com> X-Mailer: git-send-email 2.37.3.968.ga6b4b080e4-goog Message-ID: <20220921201607.3156750-2-seanjc@google.com> Subject: [PATCH 1/4] x86/hyperv: Move VMCB enlightenment definitions to hyperv-tlfs.h From: Sean Christopherson To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Sean Christopherson , Paolo Bonzini , Vitaly Kuznetsov Cc: linux-hyperv@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 Move Hyper-V's VMCB enlightenment definitions to the TLFS header; the definitions come directly from the TLFS[*], not from KVM. No functional change intended. [*] https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/datatypes/hv_svm_enlightened_vmcb_fields Signed-off-by: Sean Christopherson --- arch/x86/include/asm/hyperv-tlfs.h | 22 +++++++++++++++++++ arch/x86/kvm/svm/hyperv.h | 35 ------------------------------ arch/x86/kvm/svm/svm_onhyperv.h | 3 ++- 3 files changed, 24 insertions(+), 36 deletions(-) delete mode 100644 arch/x86/kvm/svm/hyperv.h diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 0a9407dc0859..4c4f81daf5a2 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -584,6 +584,28 @@ struct hv_enlightened_vmcs { #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_ALL 0xFFFF +/* + * Hyper-V uses the software reserved 32 bytes in VMCB control area to expose + * SVM enlightenments to guests. + */ +struct hv_enlightenments { + struct __packed hv_enlightenments_control { + u32 nested_flush_hypercall:1; + u32 msr_bitmap:1; + u32 enlightened_npt_tlb: 1; + u32 reserved:29; + } __packed hv_enlightenments_control; + u32 hv_vp_id; + u64 hv_vm_id; + u64 partition_assist_page; + u64 reserved; +} __packed; + +/* + * Hyper-V uses the software reserved clean bit in VMCB. + */ +#define VMCB_HV_NESTED_ENLIGHTENMENTS 31 + struct hv_partition_assist_pg { u32 tlb_lock_count; }; diff --git a/arch/x86/kvm/svm/hyperv.h b/arch/x86/kvm/svm/hyperv.h deleted file mode 100644 index 7d6d97968fb9..000000000000 --- a/arch/x86/kvm/svm/hyperv.h +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Common Hyper-V on KVM and KVM on Hyper-V definitions (SVM). - */ - -#ifndef __ARCH_X86_KVM_SVM_HYPERV_H__ -#define __ARCH_X86_KVM_SVM_HYPERV_H__ - -#include - -#include "../hyperv.h" - -/* - * Hyper-V uses the software reserved 32 bytes in VMCB - * control area to expose SVM enlightenments to guests. - */ -struct hv_enlightenments { - struct __packed hv_enlightenments_control { - u32 nested_flush_hypercall:1; - u32 msr_bitmap:1; - u32 enlightened_npt_tlb: 1; - u32 reserved:29; - } __packed hv_enlightenments_control; - u32 hv_vp_id; - u64 hv_vm_id; - u64 partition_assist_page; - u64 reserved; -} __packed; - -/* - * Hyper-V uses the software reserved clean bit in VMCB - */ -#define VMCB_HV_NESTED_ENLIGHTENMENTS VMCB_SW - -#endif /* __ARCH_X86_KVM_SVM_HYPERV_H__ */ diff --git a/arch/x86/kvm/svm/svm_onhyperv.h b/arch/x86/kvm/svm/svm_onhyperv.h index e2fc59380465..8d02654ad6f8 100644 --- a/arch/x86/kvm/svm/svm_onhyperv.h +++ b/arch/x86/kvm/svm/svm_onhyperv.h @@ -8,8 +8,9 @@ #if IS_ENABLED(CONFIG_HYPERV) +#include + #include "kvm_onhyperv.h" -#include "svm/hyperv.h" static struct kvm_x86_ops svm_x86_ops; -- 2.37.3.968.ga6b4b080e4-goog