From patchwork Tue Nov 1 14:53:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 13699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3020332wru; Tue, 1 Nov 2022 07:57:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nMNtf6CY9c9sRE/dxy87h8UqmaFDjPZj2TJuowSW4O7PdRhY786SL7c5D58jK3n75OkGG X-Received: by 2002:a17:907:9493:b0:796:1166:70c4 with SMTP id dm19-20020a170907949300b00796116670c4mr18049342ejc.59.1667314637503; Tue, 01 Nov 2022 07:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667314637; cv=none; d=google.com; s=arc-20160816; b=b8pmn/oy363KPegWepBNm0BaH5qOx8PLMwtU8V8e3oZ2zmyrxCDQT1v5BilZiBIgds Y4MBn4T1YccMsWtozGdi9bVv2IpPEdMTESVbwtAHEc6Uwn7GE1LQ5wMwcggS/tVwvG5O BDzNRxJ57JwR5YQQZmzT2idnm+U/ta5yz9GYBEaQ1hJbdx4ogTmxZ3//CPzpnDGOX5Lt Il4XdHLSxa9Wybtb8fAn3LnuSKR3o1cEo+ALaxfLeauPtA0WOcBp1be3cBHdSijZWCTu iux6xN1QJzi7on/ygwU3jcSwvy4klKpTav2FfZESVYeeiNmThNYQffjDYTZuobtsTiHT 8AVA== 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=QFxOQ3PtGIbBD+RVLQskRjxlIhD002VdmDFB8+zh1fI=; b=AnV3Rx6pqHcT2iiY0eLVk6SY1dPznE+tOWDZM+vraBHcAOTjkZpwjDiVX52gFPfQOY zJfOmu0Og0Kn2ti4qz9C2BIZ9Png4E/62AQS1j2I3qhNrjSiaXB0P9eOYdN1IkKurxQS onLiLkGp3B5OcYnJHk6Cds8h6ee7ZDaiHoYIwt5SjTQigOaXaGgb6rgPaDi8+eDLCzHT 1vZj+6ai3utEDyZ+p4GSf6j59+y6chEBnS1pbvdkTzLT/xno+LmcLcljvRgAK9I4qw7P W5KGeKJDP8Muia+rEUU1KG3/+DSz0HVZ6p6S1+tEHGuvErlf4lF71kC9LUERHia9RDbY 7Ziw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eJGk9FSk; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w3-20020a05640234c300b0043dfc949d31si14218439edc.25.2022.11.01.07.56.54; Tue, 01 Nov 2022 07:57:17 -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=eJGk9FSk; 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 S230406AbiKAOzs (ORCPT + 99 others); Tue, 1 Nov 2022 10:55:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230374AbiKAOzl (ORCPT ); Tue, 1 Nov 2022 10:55:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53E516301 for ; Tue, 1 Nov 2022 07:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314481; 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=QFxOQ3PtGIbBD+RVLQskRjxlIhD002VdmDFB8+zh1fI=; b=eJGk9FSkUZX1uwt7cXozQY+I7M+l08BMHx7M314dGdBm9qNsGNXOjWm8aYU4YB9wAjnaqN ZMkGUdbNp5RDEK23K8ekAh5LPEVGA6HLCxTbfjI6TSjfO8VVzxbhv93xpSyEXVixrFHWKf SKMrK2TO/vMAtch3Wsjrpfh8ophSMkw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-632-Os-v50pzP_mqHSE14eF0Cg-1; Tue, 01 Nov 2022 10:54:37 -0400 X-MC-Unique: Os-v50pzP_mqHSE14eF0Cg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EEC9F3C32C42; Tue, 1 Nov 2022 14:54:36 +0000 (UTC) Received: from ovpn-194-149.brq.redhat.com (ovpn-194-149.brq.redhat.com [10.40.194.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48F99C15BA5; Tue, 1 Nov 2022 14:54:34 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: Wanpeng Li , Jim Mattson , Michael Kelley , Siddharth Chandrasekaran , Yuan Yao , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v13 02/48] KVM: selftests: Move "struct hv_enlightenments" to x86_64/svm.h Date: Tue, 1 Nov 2022 15:53:40 +0100 Message-Id: <20221101145426.251680-3-vkuznets@redhat.com> In-Reply-To: <20221101145426.251680-1-vkuznets@redhat.com> References: <20221101145426.251680-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748306113228137036?= X-GMAIL-MSGID: =?utf-8?q?1748306113228137036?= From: Sean Christopherson 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 Signed-off-by: Vitaly Kuznetsov --- .../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..89ce2c6b57fe 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 HV_VMCB_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 5060fcfe1760..2fd64b419928 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 HV_VMCB_NESTED_ENLIGHTENMENTS (1U << 31) - void l2_guest_code(void) { GUEST_SYNC(3);