mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manuel Andreas <manuel.andreas@tum.de>
To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	pbonzini@redhat.com, Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: Re: [PATCH] x86/hyper-v: Don't WARN on VM-Enter if eVMCS sees VMFUNC[63:32] != 0
Date: Tue, 20 Oct 2026 21:36:37 +0200	[thread overview]
Message-ID: <9f68d7e4-7182-443c-80e5-457194c800b2@tum.de> (raw)
In-Reply-To: <f1f39118-2e1b-476b-9a84-ef7d56412bdc@tum.de>

If relevant I utilized the following KVM unit test to trigger the WARN_ON_ONCE:

---
 x86/unittests.cfg |  6 ++++++
 x86/vmx.h         |  1 +
 x86/vmx_tests.c   | 17 +++++++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index ae731a93..e46ecad1 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -482,6 +482,12 @@ arch = x86_64
 groups = vmx nested_exception
 check = /sys/module/kvm_intel/parameters/allow_smaller_maxphyaddr=Y

+[vmx_hyperv_vm_func_ctrls_warn]
+file = vmx.flat
+extra_params = -cpu max,+vmx,hv-vapic,hv-evmcs -append vmx_hyperv_vm_func_ctrls_warn
+arch = x86_64
+groups = vmx
+
 [debug]
 file = debug.flat
 arch = x86_64
diff --git a/x86/vmx.h b/x86/vmx.h
index f27ecd72..8d26b1a5 100644
--- a/x86/vmx.h
+++ b/x86/vmx.h
@@ -207,6 +207,7 @@ enum Encoding {
 	APIC_VIRT_ADDR		= 0x2012ul,
 	APIC_ACCS_ADDR		= 0x2014ul,
 	POSTED_INTR_DESC_ADDR	= 0x2016ul,
+	VM_FUNCTION_CONTROL     = 0x2018ul,
 	EPTP			= 0x201aul,
 	EPTP_HI			= 0x201bul,
 	VMREAD_BITMAP           = 0x2026ul,
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 2c0feca0..287336be 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -12084,6 +12084,22 @@ static void vmx_cet_test(void)
 	test_set_guest_finished();
 }

+static void vmx_hyperv_vm_func_ctrls_warn_guest(void) {
+	vmcall();
+}
+
+static void vmx_hyperv_vm_func_ctrls_warn(void)
+{
+	/* Set the unsupported bit */
+	vmcs_write(VM_FUNCTION_CONTROL, 1UL << 32UL);
+
+	test_set_guest(vmx_hyperv_vm_func_ctrls_warn_guest);
+	enter_guest();
+
+	test_set_guest_finished();
+	report(true, "hyperv warn on should have triggered!");
+}
+
 #define TEST(name) { #name, .v2 = name }

 /* name/init/guest_main/exit_handler/vmfail_handler */
@@ -12202,5 +12218,6 @@ struct vmx_test vmx_tests[] = {
 	TEST(vmx_canonical_test),
 	/* "Load CET" VM-entry/exit controls tests. */
 	TEST(vmx_cet_test),
+	TEST(vmx_hyperv_vm_func_ctrls_warn),
 	{ NULL, NULL, NULL, NULL },
 };
--
2.47.3

  reply	other threads:[~2026-10-20 19:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 19:34 Manuel Andreas
2026-10-20 19:36 ` Manuel Andreas [this message]
2026-10-20 22:56 ` Sean Christopherson
2026-10-21 11:42   ` Manuel Andreas
2026-10-21 12:05     ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f68d7e4-7182-443c-80e5-457194c800b2@tum.de \
    --to=manuel.andreas@tum.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®