From 07427b4ca9ea25fdfb1a422901d2d7dd1dda3b04 Mon Sep 17 00:00:00 2001 From: Jason Chen CJ Date: Mon, 10 Dec 2018 13:15:38 +0800 Subject: [PATCH] modulization: move virtual cpuid stuff into guest dir functions like set_vcpuid_entries & guest_cpuid should only server for virtual cpuid, so move such kind of functions to guest/vcpuid.c. and all native cpuid APIs will keep in cpuid.h Tracked-On: #1842 Signed-off-by: Jason Chen CJ Acked-by: Eddie Dong --- hypervisor/Makefile | 2 +- hypervisor/arch/x86/{cpuid.c => guest/vcpuid.c} | 0 hypervisor/include/arch/x86/cpuid.h | 5 ----- hypervisor/include/arch/x86/guest/vcpuid.h | 15 +++++++++++++++ hypervisor/include/arch/x86/hv_arch.h | 1 + 5 files changed, 17 insertions(+), 6 deletions(-) rename hypervisor/arch/x86/{cpuid.c => guest/vcpuid.c} (100%) create mode 100644 hypervisor/include/arch/x86/guest/vcpuid.h diff --git a/hypervisor/Makefile b/hypervisor/Makefile index 9203e8b70..9dd2892f3 100644 --- a/hypervisor/Makefile +++ b/hypervisor/Makefile @@ -133,7 +133,6 @@ S_SRCS += arch/x86/idt.S C_SRCS += arch/x86/ioapic.c C_SRCS += arch/x86/lapic.c C_SRCS += arch/x86/cpu.c -C_SRCS += arch/x86/cpuid.c C_SRCS += arch/x86/mmu.c C_SRCS += arch/x86/e820.c C_SRCS += arch/x86/pagetable.c @@ -157,6 +156,7 @@ C_SRCS += arch/x86/pm.c S_SRCS += arch/x86/wakeup.S C_SRCS += arch/x86/static_checks.c C_SRCS += arch/x86/trampoline.c +C_SRCS += arch/x86/guest/vcpuid.c C_SRCS += arch/x86/guest/vcpu.c C_SRCS += arch/x86/guest/vm.c C_SRCS += arch/x86/guest/vlapic.c diff --git a/hypervisor/arch/x86/cpuid.c b/hypervisor/arch/x86/guest/vcpuid.c similarity index 100% rename from hypervisor/arch/x86/cpuid.c rename to hypervisor/arch/x86/guest/vcpuid.c diff --git a/hypervisor/include/arch/x86/cpuid.h b/hypervisor/include/arch/x86/cpuid.h index 5034ca0df..ea7ea7043 100644 --- a/hypervisor/include/arch/x86/cpuid.h +++ b/hypervisor/include/arch/x86/cpuid.h @@ -135,9 +135,4 @@ static inline void cpuid_subleaf(uint32_t leaf, uint32_t subleaf, asm_cpuid(eax, ebx, ecx, edx); } -int32_t set_vcpuid_entries(struct acrn_vm *vm); -void guest_cpuid(struct acrn_vcpu *vcpu, - uint32_t *eax, uint32_t *ebx, - uint32_t *ecx, uint32_t *edx); - #endif /* CPUID_H_ */ diff --git a/hypervisor/include/arch/x86/guest/vcpuid.h b/hypervisor/include/arch/x86/guest/vcpuid.h new file mode 100644 index 000000000..2cf42538a --- /dev/null +++ b/hypervisor/include/arch/x86/guest/vcpuid.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2018 Intel Corporation. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef VCPUID_H_ +#define VCPUID_H_ + +int32_t set_vcpuid_entries(struct acrn_vm *vm); +void guest_cpuid(struct acrn_vcpu *vcpu, + uint32_t *eax, uint32_t *ebx, + uint32_t *ecx, uint32_t *edx); + +#endif /* VCPUID_H_ */ diff --git a/hypervisor/include/arch/x86/hv_arch.h b/hypervisor/include/arch/x86/hv_arch.h index ff0140908..59ecde85a 100644 --- a/hypervisor/include/arch/x86/hv_arch.h +++ b/hypervisor/include/arch/x86/hv_arch.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include