From 79cfb1cf58a58f11fe6438405cddc3f552146ad8 Mon Sep 17 00:00:00 2001 From: "Li, Fei1" Date: Sat, 16 Mar 2019 02:39:44 +0800 Subject: [PATCH] hv: vmconfig: format guest flag with prefix GUEST_FLAG_ To make the code more readable. Tracked-On: #1842 Signed-off-by: Li, Fei1 --- .../arch/x86/configs/apl-mrb/partition_config.h | 4 ++-- .../arch/x86/configs/dnv-cb2/partition_config.h | 4 ++-- hypervisor/arch/x86/configs/sos_vm.h | 2 +- hypervisor/arch/x86/configs/vm_config.c | 4 ++-- hypervisor/arch/x86/guest/vm.c | 8 ++++---- hypervisor/include/arch/x86/vm_config.h | 6 +++--- hypervisor/include/public/acrn_common.h | 12 ++++++------ 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/hypervisor/arch/x86/configs/apl-mrb/partition_config.h b/hypervisor/arch/x86/configs/apl-mrb/partition_config.h index fabe46052..ac1ef2ed3 100644 --- a/hypervisor/arch/x86/configs/apl-mrb/partition_config.h +++ b/hypervisor/arch/x86/configs/apl-mrb/partition_config.h @@ -12,7 +12,7 @@ #define VM0_CONFIG_NAME "PRE-LAUNCHED VM1 for APL-MRB" #define VM0_CONFIG_TYPE PRE_LAUNCHED_VM #define VM0_CONFIG_PCPU_BITMAP (PLUG_CPU(0) | PLUG_CPU(2)) -#define VM0_CONFIG_FLAGS IO_COMPLETION_POLLING +#define VM0_CONFIG_FLAGS GUEST_FLAG_IO_COMPLETION_POLLING #define VM0_CONFIG_MEM_START_HPA 0x100000000UL #define VM0_CONFIG_MEM_SIZE 0x20000000UL @@ -26,7 +26,7 @@ #define VM1_CONFIG_NAME "PRE-LAUNCHED VM2 for APL-MRB" #define VM1_CONFIG_TYPE PRE_LAUNCHED_VM #define VM1_CONFIG_PCPU_BITMAP (PLUG_CPU(1) | PLUG_CPU(3)) -#define VM1_CONFIG_FLAGS IO_COMPLETION_POLLING +#define VM1_CONFIG_FLAGS GUEST_FLAG_IO_COMPLETION_POLLING #define VM1_CONFIG_MEM_START_HPA 0x120000000UL #define VM1_CONFIG_MEM_SIZE 0x20000000UL diff --git a/hypervisor/arch/x86/configs/dnv-cb2/partition_config.h b/hypervisor/arch/x86/configs/dnv-cb2/partition_config.h index 310168e54..13a5275ad 100644 --- a/hypervisor/arch/x86/configs/dnv-cb2/partition_config.h +++ b/hypervisor/arch/x86/configs/dnv-cb2/partition_config.h @@ -12,7 +12,7 @@ #define VM0_CONFIG_NAME "PRE-LAUNCHED VM1 for DNV-CB2" #define VM0_CONFIG_TYPE PRE_LAUNCHED_VM #define VM0_CONFIG_PCPU_BITMAP (PLUG_CPU(0) | PLUG_CPU(2) | PLUG_CPU(4) | PLUG_CPU(6)) -#define VM0_CONFIG_FLAGS LAPIC_PASSTHROUGH | IO_COMPLETION_POLLING +#define VM0_CONFIG_FLAGS LAPIC_PASSTHROUGH | GUEST_FLAG_IO_COMPLETION_POLLING #define VM0_CONFIG_MEM_START_HPA 0x100000000UL #define VM0_CONFIG_MEM_SIZE 0x80000000UL @@ -26,7 +26,7 @@ #define VM1_CONFIG_NAME "PRE-LAUNCHED VM2 for DNV-CB2" #define VM1_CONFIG_TYPE PRE_LAUNCHED_VM #define VM1_CONFIG_PCPU_BITMAP (PLUG_CPU(1) | PLUG_CPU(3) | PLUG_CPU(5) | PLUG_CPU(7)) -#define VM1_CONFIG_FLAGS LAPIC_PASSTHROUGH | IO_COMPLETION_POLLING +#define VM1_CONFIG_FLAGS LAPIC_PASSTHROUGH | GUEST_FLAG_IO_COMPLETION_POLLING #define VM1_CONFIG_MEM_START_HPA 0x180000000UL #define VM1_CONFIG_MEM_SIZE 0x80000000UL diff --git a/hypervisor/arch/x86/configs/sos_vm.h b/hypervisor/arch/x86/configs/sos_vm.h index fe6e93cd5..063db3565 100644 --- a/hypervisor/arch/x86/configs/sos_vm.h +++ b/hypervisor/arch/x86/configs/sos_vm.h @@ -14,7 +14,7 @@ #define SOS_VM_CONFIG_H #define SOS_VM_CONFIG_NAME "ACRN SOS VM" -#define SOS_VM_CONFIG_GUEST_FLAGS IO_COMPLETION_POLLING +#define SOS_VM_CONFIG_GUEST_FLAGS GUEST_FLAG_IO_COMPLETION_POLLING #define SOS_VM_CONFIG_OS_NAME "ACRN Service OS" diff --git a/hypervisor/arch/x86/configs/vm_config.c b/hypervisor/arch/x86/configs/vm_config.c index 6681a4225..07cb0fa1b 100644 --- a/hypervisor/arch/x86/configs/vm_config.c +++ b/hypervisor/arch/x86/configs/vm_config.c @@ -108,7 +108,7 @@ int32_t sanitize_vm_config(void) case SOS_VM: /* Deduct pcpus of PRE_LAUNCHED_VMs */ sos_pcpu_bitmap ^= pre_launch_pcpu_bitmap; - if ((sos_pcpu_bitmap == 0U) || ((vm_config->guest_flags & LAPIC_PASSTHROUGH) != 0U)) { + if ((sos_pcpu_bitmap == 0U) || ((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH) != 0U)) { ret = -EINVAL; } else { vm_config->pcpu_bitmap = sos_pcpu_bitmap; @@ -122,7 +122,7 @@ int32_t sanitize_vm_config(void) break; } - if ((vm_config->guest_flags & CLOS_REQUIRED) != 0U) { + if ((vm_config->guest_flags & GUEST_FLAG_CLOS_REQUIRED) != 0U) { if (cat_cap_info.support && (vm_config->clos <= cat_cap_info.clos_max)) { cat_cap_info.enabled = true; } else { diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index d0a5ee28b..6f796be65 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -68,7 +68,7 @@ bool is_lapic_pt(const struct acrn_vm *vm) { struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id); - return ((vm_config->guest_flags & LAPIC_PASSTHROUGH) != 0U); + return ((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH) != 0U); } /** @@ -78,7 +78,7 @@ bool vm_hide_mtrr(const struct acrn_vm *vm) { struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id); - return ((vm_config->guest_flags & HIDE_MTRR) != 0U); + return ((vm_config->guest_flags & GUEST_FLAG_HIDE_MTRR) != 0U); } /** @@ -349,7 +349,7 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_ } else { /* For PRE_LAUNCHED_VM and NORMAL_VM */ - if ((vm_config->guest_flags & SECURE_WORLD_ENABLED) != 0U) { + if ((vm_config->guest_flags & GUEST_FLAG_SECURE_WORLD_ENABLED) != 0U) { vm->sworld_control.flag.supported = 1U; } if (vm->sworld_control.flag.supported != 0UL) { @@ -419,7 +419,7 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_ /* Populate return VM handle */ *rtn_vm = vm; vm->sw.io_shared_page = NULL; - if ((vm_config->guest_flags & IO_COMPLETION_POLLING) != 0U) { + if ((vm_config->guest_flags & GUEST_FLAG_IO_COMPLETION_POLLING) != 0U) { /* enable IO completion polling mode per its guest flags in vm_config. */ vm->sw.is_completion_polling = true; } diff --git a/hypervisor/include/arch/x86/vm_config.h b/hypervisor/include/arch/x86/vm_config.h index 9eb65a235..40d7805dc 100644 --- a/hypervisor/include/arch/x86/vm_config.h +++ b/hypervisor/include/arch/x86/vm_config.h @@ -49,15 +49,15 @@ struct acrn_vm_config { uint64_t pcpu_bitmap; /* from pcpu bitmap, we could know VM core number */ uint64_t guest_flags; /* VM flags that we want to configure for guest * Now we have two flags: - * SECURE_WORLD_ENABLED - * LAPIC_PASSTHROUGH + * GUEST_FLAG_SECURE_WORLD_ENABLED + * GUEST_FLAG_LAPIC_PASSTHROUGH * We could add more guest flags in future; */ struct acrn_vm_mem_config memory; /* memory configuration of VM */ uint16_t pci_ptdev_num; /* indicate how many PCI PT devices in VM */ struct acrn_vm_pci_ptdev_config *pci_ptdevs; /* point to PCI PT devices BDF list */ struct acrn_vm_os_config os_config; /* OS information the VM */ - uint16_t clos; /* if guest_flags has CLOS_REQUIRED, then VM use this CLOS */ + uint16_t clos; /* if guest_flags has GUEST_FLAG_CLOS_REQUIRED, then VM use this CLOS */ #ifdef CONFIG_PARTITION_MODE bool vm_vuart; diff --git a/hypervisor/include/public/acrn_common.h b/hypervisor/include/public/acrn_common.h index d88a8a03f..c21cf8c22 100644 --- a/hypervisor/include/public/acrn_common.h +++ b/hypervisor/include/public/acrn_common.h @@ -47,11 +47,11 @@ #endif /* Generic VM flags from guest OS */ -#define SECURE_WORLD_ENABLED (1UL << 0U) /* Whether secure world is enabled */ -#define LAPIC_PASSTHROUGH (1UL << 1U) /* Whether LAPIC is passed through */ -#define IO_COMPLETION_POLLING (1UL << 2U) /* Whether need hypervisor poll IO completion */ -#define CLOS_REQUIRED (1UL << 3U) /* Whether CLOS is required */ -#define HIDE_MTRR (1UL << 4U) /* Whether hide MTRR from VM */ +#define GUEST_FLAG_SECURE_WORLD_ENABLED (1UL << 0U) /* Whether secure world is enabled */ +#define GUEST_FLAG_LAPIC_PASSTHROUGH (1UL << 1U) /* Whether LAPIC is passed through */ +#define GUEST_FLAG_IO_COMPLETION_POLLING (1UL << 2U) /* Whether need hypervisor poll IO completion */ +#define GUEST_FLAG_CLOS_REQUIRED (1UL << 3U) /* Whether CLOS is required */ +#define GUEST_FLAG_HIDE_MTRR (1UL << 4U) /* Whether hide MTRR from VM */ /** * @brief Hypercall @@ -347,7 +347,7 @@ struct acrn_create_vm { uint8_t GUID[16]; /* VM flag bits from Guest OS, now used - * SECURE_WORLD_ENABLED (1UL<<0) + * GUEST_FLAG_SECURE_WORLD_ENABLED (1UL<<0) */ uint64_t vm_flag;