KVM: selftests: Use port 0x80 in invalid nVMX guest state test

Use port 0x80 instead of 0x2000 to trigger an L2 => L0 VM-Exit in the nVMX
invalid guest state test, so that the test can be expanded to cover RSM in
the L2 => SMI => L2 path without having to manually encode a MOV to DX (the
immediate form of IN only supports an imm8).

Use port 0x80 as it's a well-known port and is used by other tests, e.g. in
the coalesced I/O test.

Link: https://patch.msgid.link/20260731173340.2644656-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
Sean Christopherson 2026-07-31 10:33:38 -07:00
parent 9fd7a4433d
commit 6fc510e1f1

View File

@ -9,7 +9,7 @@
#include "kselftest.h"
#define ARBITRARY_IO_PORT 0x2000
#define ARBITRARY_IO_PORT 0x80
static struct kvm_vm *vm;
@ -19,8 +19,8 @@ static void l2_guest_code(void)
* Generate an exit to L0 userspace, i.e. main(), via I/O to an
* arbitrary port.
*/
asm volatile("inb %%dx, %%al"
: : [port] "d" (ARBITRARY_IO_PORT) : "rax");
asm volatile("inb $" __stringify(ARBITRARY_IO_PORT) ", %%al"
::: "rax");
}
static void l1_guest_code(struct vmx_pages *vmx_pages)