1/* 2 * Copyright 2017, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: GPL-2.0-only 5 */ 6 7/* This file contains macros for CPUID emulation in x86. 8 * Most of the code in this file is from arch/x86/kvm/cpuid.h Linux 3.8.8 9 * This file should used only by cpuid.c 10 * 11 * Authors: 12 * Qian Ge 13 */ 14 15#pragma once 16 17#include <utils/util.h> 18 19#define F(x) BIT( (X86_FEATURE_##x) & 31) 20 21/* Basic information for the processor P4 hyperthread. */ 22#define VMM_CPUID_EAX_P4_HT 0x5 23#define VMM_CPUID_P4_FAMILY (6 << 8) 24#define VMM_CPUID_P4_MODLE (7 << 4) 25#define VMM_CPUID_P4_STEP (1) 26 27/* Extended function information for p4 ht. */ 28#define VMM_CPUID_P4_MAX_EXTFUNCTION 0x80000008 29 30/* 32 bit for both phy & vir address space*/ 31#define VMM_CPUID_P4_PHYADDR_SIZE 0x20 32#define VMM_CPUID_P4_VIRADDR_SIZE 0x20 33 34/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx if running under KVM. */ 35#define VMM_CPUID_KVM_SIGNATURE 0x40000000 36/* This CPUID returns a feature bitmap in eax */ 37#define VMM_CPUID_KVM_FEATURES 0x40000001 38 39/* CPUID instruction return value. */ 40struct cpuid_val { 41 unsigned int eax; 42 unsigned int ebx; 43 unsigned int ecx; 44 unsigned int edx; 45}; 46 47