From: Jon Kohler <jon@nutanix.com>
To: seanjc@google.com, pbonzini@redhat.com, kvm@vger.kernel.org
Cc: Jon Kohler <jon@nutanix.com>
Subject: [kvm-unit-tests PATCH 16/17] x86/vmx: switch to new vmx.h interrupt defs
Date: Tue, 16 Sep 2025 10:22:45 -0700 [thread overview]
Message-ID: <20250916172247.610021-17-jon@nutanix.com> (raw)
In-Reply-To: <20250916172247.610021-1-jon@nutanix.com>
Migrate to new vmx.h's interrupt definitions, which makes it easier to
grok from one code base to another.
No functional change intended.
Signed-off-by: Jon Kohler <jon@nutanix.com>
---
x86/vmx.h | 22 ----------------------
x86/vmx_tests.c | 12 ++++++------
2 files changed, 6 insertions(+), 28 deletions(-)
diff --git a/x86/vmx.h b/x86/vmx.h
index 8bb49d8e..99ba7e52 100644
--- a/x86/vmx.h
+++ b/x86/vmx.h
@@ -406,31 +406,9 @@ enum Reason {
VMX_XRSTORS = 64,
};
-enum Intr_type {
- VMX_INTR_TYPE_EXT_INTR = 0,
- VMX_INTR_TYPE_NMI_INTR = 2,
- VMX_INTR_TYPE_HARD_EXCEPTION = 3,
- VMX_INTR_TYPE_SOFT_INTR = 4,
- VMX_INTR_TYPE_SOFT_EXCEPTION = 6,
-};
-
-/*
- * Interruption-information format
- */
-#define INTR_INFO_VECTOR_MASK 0xff /* 7:0 */
-#define INTR_INFO_INTR_TYPE_MASK 0x700 /* 10:8 */
-#define INTR_INFO_DELIVER_CODE_MASK 0x800 /* 11 */
-#define INTR_INFO_UNBLOCK_NMI_MASK 0x1000 /* 12 */
-#define INTR_INFO_VALID_MASK 0x80000000 /* 31 */
#define INTR_INFO_INTR_TYPE_SHIFT 8
-/*
- * Guest interruptibility state
- */
-#define GUEST_INTR_STATE_MOVSS (1 << 1)
-#define GUEST_INTR_STATE_ENCLAVE (1 << 4)
-
#define SAVE_GPR \
"xchg %rax, regs\n\t" \
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 2f9858a3..338e39b0 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -1763,7 +1763,7 @@ static int interrupt_exit_handler(union exit_reason exit_reason)
vmcs_write(GUEST_ACTV_STATE, ACTV_HLT);
vmcs_write(ENT_INTR_INFO,
TIMER_VECTOR |
- (VMX_INTR_TYPE_EXT_INTR << INTR_INFO_INTR_TYPE_SHIFT) |
+ INTR_TYPE_EXT_INTR |
INTR_INFO_VALID_MASK);
break;
}
@@ -8803,7 +8803,7 @@ static void vmx_nmi_window_test(void)
* is one byte.)
*/
report_prefix_push("active, blocking by MOV-SS");
- vmcs_write(GUEST_INTR_STATE, GUEST_INTR_STATE_MOVSS);
+ vmcs_write(GUEST_INTR_STATE, GUEST_INTR_STATE_MOV_SS);
enter_guest();
verify_nmi_window_exit(nop_addr + 1);
report_prefix_pop();
@@ -8969,7 +8969,7 @@ static void vmx_intr_window_test(void)
* instruction. (NOP is one byte.)
*/
report_prefix_push("active, blocking by MOV-SS, RFLAGS.IF=1");
- vmcs_write(GUEST_INTR_STATE, GUEST_INTR_STATE_MOVSS);
+ vmcs_write(GUEST_INTR_STATE, GUEST_INTR_STATE_MOV_SS);
enter_guest();
verify_intr_window_exit(nop_addr + 1);
report_prefix_pop();
@@ -9479,7 +9479,7 @@ static void single_step_guest(const char *test_name, u64 starting_dr6,
vmcs_write(GUEST_RFLAGS, X86_EFLAGS_FIXED | X86_EFLAGS_TF);
if (pending_debug_exceptions) {
vmcs_write(GUEST_PENDING_DEBUG, pending_debug_exceptions);
- vmcs_write(GUEST_INTR_STATE, GUEST_INTR_STATE_MOVSS);
+ vmcs_write(GUEST_INTR_STATE, GUEST_INTR_STATE_MOV_SS);
}
enter_guest();
}
@@ -10982,9 +10982,9 @@ static void handle_exception_in_l1(u32 vector)
enter_guest();
if (vector == BP_VECTOR || vector == OF_VECTOR)
- intr_type = VMX_INTR_TYPE_SOFT_EXCEPTION;
+ intr_type = EVENT_TYPE_SWEXC;
else
- intr_type = VMX_INTR_TYPE_HARD_EXCEPTION;
+ intr_type = EVENT_TYPE_HWEXC;
intr_info = vmcs_read(EXI_INTR_INFO);
report((vmcs_read(EXI_REASON) == VMX_EXC_NMI) &&
--
2.43.0
next prev parent reply other threads:[~2025-09-16 16:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 17:22 [kvm-unit-tests PATCH 00/17] x86/vmx: align with Linux kernel VMX definitions Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 01/17] lib: add linux vmx.h clone from 6.16 Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 02/17] lib: add linux trapnr.h " Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 03/17] lib: add vmxfeatures.h " Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 04/17] lib: define __aligned() in compiler.h Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 05/17] x86/vmx: basic integration for new vmx.h Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 06/17] x86/vmx: switch to new vmx.h EPT violation defs Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 07/17] x86/vmx: switch to new vmx.h EPT RWX defs Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 08/17] x86/vmx: switch to new vmx.h EPT access and dirty defs Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 09/17] x86/vmx: switch to new vmx.h EPT capability and memory type defs Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 10/17] x86/vmx: switch to new vmx.h primary processor-based VM-execution controls Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 11/17] x86/vmx: switch to new vmx.h secondary execution control bit Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 12/17] x86/vmx: switch to new vmx.h secondary execution controls Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 13/17] x86/vmx: switch to new vmx.h pin based VM-execution controls Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 14/17] x86/vmx: switch to new vmx.h exit controls Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 15/17] x86/vmx: switch to new vmx.h entry controls Jon Kohler
2025-09-16 17:22 ` Jon Kohler [this message]
2025-09-16 17:22 ` [kvm-unit-tests PATCH 17/17] x86/vmx: align exit reasons with Linux uapi Jon Kohler
2025-11-12 19:02 ` [kvm-unit-tests PATCH 00/17] x86/vmx: align with Linux kernel VMX definitions Sean Christopherson
2025-11-14 14:52 ` Jon Kohler
2025-11-17 17:41 ` 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=20250916172247.610021-17-jon@nutanix.com \
--to=jon@nutanix.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.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