Rename X86_FEATURE_* macros to CPUID_* in various tests to free up the
X86_FEATURE_* names for KVM-Unit-Tests style CPUID automagic where the
function, leaf, register, and bit for the feature is embedded in its
macro value.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20220614200707.3315957-3-seanjc@google.com
#define CPUID_SMX (1ul << 6)
#define CPUID_PCID (1ul << 17)
#define CPUID_XSAVE (1ul << 26)
+#define CPUID_OSXSAVE (1ul << 27)
/* CPUID.7.EBX */
#define CPUID_FSGSBASE (1ul << 0)
/* CPUID.0x8000_0001.EDX */
#define CPUID_GBPAGES (1ul << 26)
+/* CPUID.0x8000_000A.EDX */
+#define CPUID_NRIPS BIT(3)
+
/* Page table bitfield declarations */
#define PTE_PRESENT_MASK BIT_ULL(0)
#define PTE_WRITABLE_MASK BIT_ULL(1)
# error This test is 64-bit only
#endif
-#define X86_FEATURE_XSAVE (1 << 26)
-#define X86_FEATURE_OSXSAVE (1 << 27)
-
#define NUM_TILES 8
#define TILE_SIZE 1024
#define XSAVE_SIZE ((NUM_TILES * TILE_SIZE) + PAGE_SIZE)
eax = 1;
ecx = 0;
cpuid(&eax, &ebx, &ecx, &edx);
- if (!(ecx & X86_FEATURE_XSAVE))
+ if (!(ecx & CPUID_XSAVE))
GUEST_ASSERT(!"cpuid: no CPU xsave support!");
- if (!(ecx & X86_FEATURE_OSXSAVE))
+ if (!(ecx & CPUID_OSXSAVE))
GUEST_ASSERT(!"cpuid: no OS xsave support!");
}
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
entry = kvm_get_supported_cpuid_entry(1);
- TEST_REQUIRE(entry->ecx & X86_FEATURE_XSAVE);
+ TEST_REQUIRE(entry->ecx & CPUID_XSAVE);
TEST_REQUIRE(kvm_get_cpuid_max_basic() >= 0xd);
#include "kvm_util.h"
#include "processor.h"
-#define X86_FEATURE_XSAVE (1<<26)
-#define X86_FEATURE_OSXSAVE (1<<27)
-
static inline bool cr4_cpuid_is_sync(void)
{
int func, subfunc;
cr4 = get_cr4();
- return (!!(ecx & X86_FEATURE_OSXSAVE)) == (!!(cr4 & X86_CR4_OSXSAVE));
+ return (!!(ecx & CPUID_OSXSAVE)) == (!!(cr4 & X86_CR4_OSXSAVE));
}
static void guest_code(void)
struct ucall uc;
entry = kvm_get_supported_cpuid_entry(1);
- TEST_REQUIRE(entry->ecx & X86_FEATURE_XSAVE);
+ TEST_REQUIRE(entry->ecx & CPUID_XSAVE);
/* Tell stdout not to buffer its content */
setbuf(stdout, NULL);
#include "kvm_util.h"
#include "processor.h"
-#define X86_FEATURE_MWAIT (1u << 3)
+#define CPUID_MWAIT (1u << 3)
enum monitor_mwait_testcases {
MWAIT_QUIRK_DISABLED = BIT(0),
cpuid = kvm_get_supported_cpuid();
entry = kvm_get_supported_cpuid_index(1, 0);
- entry->ecx &= ~X86_FEATURE_MWAIT;
+ entry->ecx &= ~CPUID_MWAIT;
set_cpuid(cpuid, entry);
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
#include "test_util.h"
#define INT_NR 0x20
-#define X86_FEATURE_NRIPS BIT(3)
static_assert(ATOMIC_INT_LOCK_FREE == 2, "atomic int is not lockless");
nested_svm_check_supported();
cpuid = kvm_get_supported_cpuid_entry(0x8000000a);
- TEST_ASSERT(cpuid->edx & X86_FEATURE_NRIPS,
+ TEST_ASSERT(cpuid->edx & CPUID_NRIPS,
"KVM with nSVM is supposed to unconditionally advertise nRIP Save\n");
atomic_init(&nmi_stage, 0);