Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/trapnr: Add event type macros to <asm/trapnr.h>

Intel VT-x classifies events into eight different types, which is inherited
by FRED for event identification. As such, event types becomes a common x86
concept, and should be defined in a common x86 header.

Add event type macros to <asm/trapnr.h>, and use them in <asm/vmx.h>.

Suggested-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Xin Li <xin3.li@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Shan Kang <shan.kang@intel.com>
Link: https://lore.kernel.org/r/20231205105030.8698-4-xin3.li@intel.com

authored by

Xin Li and committed by
Thomas Gleixner
8df71934 3167b37f

+21 -8
+12
arch/x86/include/asm/trapnr.h
··· 2 2 #ifndef _ASM_X86_TRAPNR_H 3 3 #define _ASM_X86_TRAPNR_H 4 4 5 + /* 6 + * Event type codes used by FRED, Intel VT-x and AMD SVM 7 + */ 8 + #define EVENT_TYPE_EXTINT 0 // External interrupt 9 + #define EVENT_TYPE_RESERVED 1 10 + #define EVENT_TYPE_NMI 2 // NMI 11 + #define EVENT_TYPE_HWEXC 3 // Hardware originated traps, exceptions 12 + #define EVENT_TYPE_SWINT 4 // INT n 13 + #define EVENT_TYPE_PRIV_SWEXC 5 // INT1 14 + #define EVENT_TYPE_SWEXC 6 // INTO, INT3 15 + #define EVENT_TYPE_OTHER 7 // FRED SYSCALL/SYSENTER, VT-x MTF 16 + 5 17 /* Interrupts/Exceptions */ 6 18 7 19 #define X86_TRAP_DE 0 /* Divide-by-zero */
+9 -8
arch/x86/include/asm/vmx.h
··· 17 17 #include <linux/types.h> 18 18 19 19 #include <uapi/asm/vmx.h> 20 + #include <asm/trapnr.h> 20 21 #include <asm/vmxfeatures.h> 21 22 22 23 #define VMCS_CONTROL_BIT(x) BIT(VMX_FEATURE_##x & 0x1f) ··· 375 374 #define VECTORING_INFO_DELIVER_CODE_MASK INTR_INFO_DELIVER_CODE_MASK 376 375 #define VECTORING_INFO_VALID_MASK INTR_INFO_VALID_MASK 377 376 378 - #define INTR_TYPE_EXT_INTR (0 << 8) /* external interrupt */ 379 - #define INTR_TYPE_RESERVED (1 << 8) /* reserved */ 380 - #define INTR_TYPE_NMI_INTR (2 << 8) /* NMI */ 381 - #define INTR_TYPE_HARD_EXCEPTION (3 << 8) /* processor exception */ 382 - #define INTR_TYPE_SOFT_INTR (4 << 8) /* software interrupt */ 383 - #define INTR_TYPE_PRIV_SW_EXCEPTION (5 << 8) /* ICE breakpoint - undocumented */ 384 - #define INTR_TYPE_SOFT_EXCEPTION (6 << 8) /* software exception */ 385 - #define INTR_TYPE_OTHER_EVENT (7 << 8) /* other event */ 377 + #define INTR_TYPE_EXT_INTR (EVENT_TYPE_EXTINT << 8) /* external interrupt */ 378 + #define INTR_TYPE_RESERVED (EVENT_TYPE_RESERVED << 8) /* reserved */ 379 + #define INTR_TYPE_NMI_INTR (EVENT_TYPE_NMI << 8) /* NMI */ 380 + #define INTR_TYPE_HARD_EXCEPTION (EVENT_TYPE_HWEXC << 8) /* processor exception */ 381 + #define INTR_TYPE_SOFT_INTR (EVENT_TYPE_SWINT << 8) /* software interrupt */ 382 + #define INTR_TYPE_PRIV_SW_EXCEPTION (EVENT_TYPE_PRIV_SWEXC << 8) /* ICE breakpoint */ 383 + #define INTR_TYPE_SOFT_EXCEPTION (EVENT_TYPE_SWEXC << 8) /* software exception */ 384 + #define INTR_TYPE_OTHER_EVENT (EVENT_TYPE_OTHER << 8) /* other event */ 386 385 387 386 /* GUEST_INTERRUPTIBILITY_INFO flags. */ 388 387 #define GUEST_INTR_STATE_STI 0x00000001