Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5866297rwb; Wed, 21 Sep 2022 13:42:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TXy5+HSdMYke5IQwlCuW1KfGS304s4KT5I0kJ3Hap9lGZM8OgrW5dfhh00orV2OXfUcV2 X-Received: by 2002:a17:902:c40e:b0:178:4931:cc4d with SMTP id k14-20020a170902c40e00b001784931cc4dmr6452140plk.97.1663792930118; Wed, 21 Sep 2022 13:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663792930; cv=none; d=google.com; s=arc-20160816; b=kniTsxSWpa2mAMN9dzMYLQ+LMDpdYy1J6eNp2bf3APhNRwXZa9Idf4kprEseagtrIz Gpl5kzUj0D4TNX+TLOed+K1gk0ZJzIefe1K3pRLAVFLDQLb6tDjHGtPaup4JnxP1WOZ9 L9MZnr5udZ916C1mo24ymSL8sx+4dbNJGpIPCgKj17+kJIAoaEmvRkTn4osQ5VLOfNaI iKVIh4yTo03brnvg479m/DSsim/C+juAyg1zM4vGqkLRIPvNQzeqaGYMe6+kKul8KuVq Tp0m/IpKH3nZJhZNezqmd74cpEwDgaSE4wgyNwChOB9kWBj760kkVOA0bEZkijljhq4o 6p0A== 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=9UwbrQ0jbfkdWibvQjcC8zTWLX7OGdH/X8ruvlS1WMg=; b=T81IWZJCLEpZ/8nb8opmkTtIMvOaQEj+G2kpPZfuJ2OSFffxDNPiMPc6SEDN63fG5d 7F0Y+AEsGJTQGfNdZzHz/C6Ni+A35ldDrKVh1Ip6n1FKSlG1hVbqF9x1+viTAEF6TbtW IY8Je5bmOVmA1Bo7kQKwV899pmVRu0y8GY8sTGy5m9UqtgPCavArNheX4fRjOQ0dpH0L 53fA1vk0HqFFoxnkSD6GhyxMZaFL16aSw3XJEj4LUAVhATWhkApiTtSDFeb3PkoWJWJi 5Du02b0HVyu7kUPfhL41qB+KD8yOFMPxFBlPbu4ujozwkkPoK0wMgvS8eP2BkZ9uX4tj UUiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=d6OxGnQw; 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 h69-20020a638348000000b004388dba7961si3797128pge.713.2022.09.21.13.41.57; Wed, 21 Sep 2022 13:42:10 -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=d6OxGnQw; 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 S230490AbiIUUQV (ORCPT + 99 others); Wed, 21 Sep 2022 16:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230475AbiIUUQQ (ORCPT ); Wed, 21 Sep 2022 16:16:16 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E897A4B0F for ; Wed, 21 Sep 2022 13:16:14 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id bu13-20020a056902090d00b00671743601f1so6193787ybb.0 for ; Wed, 21 Sep 2022 13:16:14 -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=9UwbrQ0jbfkdWibvQjcC8zTWLX7OGdH/X8ruvlS1WMg=; b=d6OxGnQwB6PfvAxP09aDlfsT7F+vltfemklLt+BdEo9n3HeF5TNxtuhbxj95cNx1OX 4YGu4iYzkQN5Ev8cwMJSQ5djfM0aw7Zw94hSpNKrxRfotDdC0JTQWVUJy23fYusp5S5X B2PGbCjiSWD1+qdythdWEj2fHw7RFJnUVJewsM+/yYxUVpQAljsB+LJXxUXbFxMyE8sl whhTLh+BC5S5B3avSV8SuylbxXaiDiSVFrEwImHUcTnHEU+cGdeCZe1x4u4tiILhKll0 7y5FUfiRtE4tOIXhUj2vd8/+vIPN6TPW/O8sk3U2l0JFvs2J4KU2hzO30G+IfuB+yGE+ 1y1g== 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=9UwbrQ0jbfkdWibvQjcC8zTWLX7OGdH/X8ruvlS1WMg=; b=SudK4mfFuAq2/6TXPFSE3uAKygwkydW7vOAfmBGpy0+12jTHZMSEoTt2C4faHS0NkB kbdLJ44fUfdlAzu2BPxCkQs+Cm6GBQTMTEA42gHeU30bBsXH5NJt47CV1uWrpXVXHFfg WVFKLASkdxRLo8qN9ZJqSMj6niJYWJG9gfRkY6crir7EFAV/lJxORGN+eeI4Osv9TmvY 8nUEFpkBqCUbhzH4cnvtzj6ysDcCPsbkKSNBoWSVwyxI7sAlMQ5pJlNqiYRXvbGqOTyF ygQT5gYApKF/HC+51rLMuJmxYGc1bk+xDBxqhzssrVbirJEQfEX1CGAcq5vZ4DV+61tf UmWw== X-Gm-Message-State: ACrzQf3OSdnTZ9h9JTcERIgEcbxqoamDO9AcSZ+eAciuNH7xhyyl/7W4 kIDA6y95xwldHd3okz+ewbCS527F1Fs= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:2187:0:b0:6b0:1abc:2027 with SMTP id h129-20020a252187000000b006b01abc2027mr110766ybh.348.1663791372853; Wed, 21 Sep 2022 13:16:12 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 21 Sep 2022 20:16:05 +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-3-seanjc@google.com> Subject: [PATCH 2/4] KVM: selftests: Move "struct hv_enlightenments" to x86_64/svm.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 "struct hv_enlightenments" to the svm.h header so that the struct can be referenced in "struct vmcb_control_area". Alternatively, a dedicated header for SVM+Hyper-V could be added, a la x86_64/evmcs.h, but it doesn't appear that Hyper-V will end up needing a wholesale replacement for the VMCB. No functional change intended. Signed-off-by: Sean Christopherson --- .../testing/selftests/kvm/include/x86_64/svm.h | 17 +++++++++++++++++ .../selftests/kvm/x86_64/hyperv_svm_test.c | 18 ------------------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/tools/testing/selftests/kvm/include/x86_64/svm.h b/tools/testing/selftests/kvm/include/x86_64/svm.h index c8343ff84f7f..10b9d0d4e0ec 100644 --- a/tools/testing/selftests/kvm/include/x86_64/svm.h +++ b/tools/testing/selftests/kvm/include/x86_64/svm.h @@ -58,6 +58,23 @@ enum { INTERCEPT_RDPRU, }; +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 (1U << 31) struct __attribute__ ((__packed__)) vmcb_control_area { u32 intercept_cr; diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_svm_test.c b/tools/testing/selftests/kvm/x86_64/hyperv_svm_test.c index a380ad7bb9b3..b366b197759f 100644 --- a/tools/testing/selftests/kvm/x86_64/hyperv_svm_test.c +++ b/tools/testing/selftests/kvm/x86_64/hyperv_svm_test.c @@ -23,24 +23,6 @@ #define L2_GUEST_STACK_SIZE 256 -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 (1U << 31) - void l2_guest_code(void) { GUEST_SYNC(3); -- 2.37.3.968.ga6b4b080e4-goog