Skip to content

Commit 79cfb1c

Browse files
lifeixwenlingz
authored andcommitted
hv: vmconfig: format guest flag with prefix GUEST_FLAG_
To make the code more readable. Tracked-On: #1842 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
1 parent c018b85 commit 79cfb1c

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

hypervisor/arch/x86/configs/apl-mrb/partition_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define VM0_CONFIG_NAME "PRE-LAUNCHED VM1 for APL-MRB"
1313
#define VM0_CONFIG_TYPE PRE_LAUNCHED_VM
1414
#define VM0_CONFIG_PCPU_BITMAP (PLUG_CPU(0) | PLUG_CPU(2))
15-
#define VM0_CONFIG_FLAGS IO_COMPLETION_POLLING
15+
#define VM0_CONFIG_FLAGS GUEST_FLAG_IO_COMPLETION_POLLING
1616
#define VM0_CONFIG_MEM_START_HPA 0x100000000UL
1717
#define VM0_CONFIG_MEM_SIZE 0x20000000UL
1818

@@ -26,7 +26,7 @@
2626
#define VM1_CONFIG_NAME "PRE-LAUNCHED VM2 for APL-MRB"
2727
#define VM1_CONFIG_TYPE PRE_LAUNCHED_VM
2828
#define VM1_CONFIG_PCPU_BITMAP (PLUG_CPU(1) | PLUG_CPU(3))
29-
#define VM1_CONFIG_FLAGS IO_COMPLETION_POLLING
29+
#define VM1_CONFIG_FLAGS GUEST_FLAG_IO_COMPLETION_POLLING
3030
#define VM1_CONFIG_MEM_START_HPA 0x120000000UL
3131
#define VM1_CONFIG_MEM_SIZE 0x20000000UL
3232

hypervisor/arch/x86/configs/dnv-cb2/partition_config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define VM0_CONFIG_NAME "PRE-LAUNCHED VM1 for DNV-CB2"
1313
#define VM0_CONFIG_TYPE PRE_LAUNCHED_VM
1414
#define VM0_CONFIG_PCPU_BITMAP (PLUG_CPU(0) | PLUG_CPU(2) | PLUG_CPU(4) | PLUG_CPU(6))
15-
#define VM0_CONFIG_FLAGS LAPIC_PASSTHROUGH | IO_COMPLETION_POLLING
15+
#define VM0_CONFIG_FLAGS LAPIC_PASSTHROUGH | GUEST_FLAG_IO_COMPLETION_POLLING
1616
#define VM0_CONFIG_MEM_START_HPA 0x100000000UL
1717
#define VM0_CONFIG_MEM_SIZE 0x80000000UL
1818

@@ -26,7 +26,7 @@
2626
#define VM1_CONFIG_NAME "PRE-LAUNCHED VM2 for DNV-CB2"
2727
#define VM1_CONFIG_TYPE PRE_LAUNCHED_VM
2828
#define VM1_CONFIG_PCPU_BITMAP (PLUG_CPU(1) | PLUG_CPU(3) | PLUG_CPU(5) | PLUG_CPU(7))
29-
#define VM1_CONFIG_FLAGS LAPIC_PASSTHROUGH | IO_COMPLETION_POLLING
29+
#define VM1_CONFIG_FLAGS LAPIC_PASSTHROUGH | GUEST_FLAG_IO_COMPLETION_POLLING
3030
#define VM1_CONFIG_MEM_START_HPA 0x180000000UL
3131
#define VM1_CONFIG_MEM_SIZE 0x80000000UL
3232

hypervisor/arch/x86/configs/sos_vm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define SOS_VM_CONFIG_H
1515

1616
#define SOS_VM_CONFIG_NAME "ACRN SOS VM"
17-
#define SOS_VM_CONFIG_GUEST_FLAGS IO_COMPLETION_POLLING
17+
#define SOS_VM_CONFIG_GUEST_FLAGS GUEST_FLAG_IO_COMPLETION_POLLING
1818

1919
#define SOS_VM_CONFIG_OS_NAME "ACRN Service OS"
2020

hypervisor/arch/x86/configs/vm_config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int32_t sanitize_vm_config(void)
108108
case SOS_VM:
109109
/* Deduct pcpus of PRE_LAUNCHED_VMs */
110110
sos_pcpu_bitmap ^= pre_launch_pcpu_bitmap;
111-
if ((sos_pcpu_bitmap == 0U) || ((vm_config->guest_flags & LAPIC_PASSTHROUGH) != 0U)) {
111+
if ((sos_pcpu_bitmap == 0U) || ((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH) != 0U)) {
112112
ret = -EINVAL;
113113
} else {
114114
vm_config->pcpu_bitmap = sos_pcpu_bitmap;
@@ -122,7 +122,7 @@ int32_t sanitize_vm_config(void)
122122
break;
123123
}
124124

125-
if ((vm_config->guest_flags & CLOS_REQUIRED) != 0U) {
125+
if ((vm_config->guest_flags & GUEST_FLAG_CLOS_REQUIRED) != 0U) {
126126
if (cat_cap_info.support && (vm_config->clos <= cat_cap_info.clos_max)) {
127127
cat_cap_info.enabled = true;
128128
} else {

hypervisor/arch/x86/guest/vm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ bool is_lapic_pt(const struct acrn_vm *vm)
6868
{
6969
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
7070

71-
return ((vm_config->guest_flags & LAPIC_PASSTHROUGH) != 0U);
71+
return ((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH) != 0U);
7272
}
7373

7474
/**
@@ -78,7 +78,7 @@ bool vm_hide_mtrr(const struct acrn_vm *vm)
7878
{
7979
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
8080

81-
return ((vm_config->guest_flags & HIDE_MTRR) != 0U);
81+
return ((vm_config->guest_flags & GUEST_FLAG_HIDE_MTRR) != 0U);
8282
}
8383

8484
/**
@@ -349,7 +349,7 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_
349349

350350
} else {
351351
/* For PRE_LAUNCHED_VM and NORMAL_VM */
352-
if ((vm_config->guest_flags & SECURE_WORLD_ENABLED) != 0U) {
352+
if ((vm_config->guest_flags & GUEST_FLAG_SECURE_WORLD_ENABLED) != 0U) {
353353
vm->sworld_control.flag.supported = 1U;
354354
}
355355
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_
419419
/* Populate return VM handle */
420420
*rtn_vm = vm;
421421
vm->sw.io_shared_page = NULL;
422-
if ((vm_config->guest_flags & IO_COMPLETION_POLLING) != 0U) {
422+
if ((vm_config->guest_flags & GUEST_FLAG_IO_COMPLETION_POLLING) != 0U) {
423423
/* enable IO completion polling mode per its guest flags in vm_config. */
424424
vm->sw.is_completion_polling = true;
425425
}

hypervisor/include/arch/x86/vm_config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ struct acrn_vm_config {
4949
uint64_t pcpu_bitmap; /* from pcpu bitmap, we could know VM core number */
5050
uint64_t guest_flags; /* VM flags that we want to configure for guest
5151
* Now we have two flags:
52-
* SECURE_WORLD_ENABLED
53-
* LAPIC_PASSTHROUGH
52+
* GUEST_FLAG_SECURE_WORLD_ENABLED
53+
* GUEST_FLAG_LAPIC_PASSTHROUGH
5454
* We could add more guest flags in future;
5555
*/
5656
struct acrn_vm_mem_config memory; /* memory configuration of VM */
5757
uint16_t pci_ptdev_num; /* indicate how many PCI PT devices in VM */
5858
struct acrn_vm_pci_ptdev_config *pci_ptdevs; /* point to PCI PT devices BDF list */
5959
struct acrn_vm_os_config os_config; /* OS information the VM */
60-
uint16_t clos; /* if guest_flags has CLOS_REQUIRED, then VM use this CLOS */
60+
uint16_t clos; /* if guest_flags has GUEST_FLAG_CLOS_REQUIRED, then VM use this CLOS */
6161

6262
#ifdef CONFIG_PARTITION_MODE
6363
bool vm_vuart;

hypervisor/include/public/acrn_common.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
#endif
4848

4949
/* Generic VM flags from guest OS */
50-
#define SECURE_WORLD_ENABLED (1UL << 0U) /* Whether secure world is enabled */
51-
#define LAPIC_PASSTHROUGH (1UL << 1U) /* Whether LAPIC is passed through */
52-
#define IO_COMPLETION_POLLING (1UL << 2U) /* Whether need hypervisor poll IO completion */
53-
#define CLOS_REQUIRED (1UL << 3U) /* Whether CLOS is required */
54-
#define HIDE_MTRR (1UL << 4U) /* Whether hide MTRR from VM */
50+
#define GUEST_FLAG_SECURE_WORLD_ENABLED (1UL << 0U) /* Whether secure world is enabled */
51+
#define GUEST_FLAG_LAPIC_PASSTHROUGH (1UL << 1U) /* Whether LAPIC is passed through */
52+
#define GUEST_FLAG_IO_COMPLETION_POLLING (1UL << 2U) /* Whether need hypervisor poll IO completion */
53+
#define GUEST_FLAG_CLOS_REQUIRED (1UL << 3U) /* Whether CLOS is required */
54+
#define GUEST_FLAG_HIDE_MTRR (1UL << 4U) /* Whether hide MTRR from VM */
5555

5656
/**
5757
* @brief Hypercall
@@ -347,7 +347,7 @@ struct acrn_create_vm {
347347
uint8_t GUID[16];
348348

349349
/* VM flag bits from Guest OS, now used
350-
* SECURE_WORLD_ENABLED (1UL<<0)
350+
* GUEST_FLAG_SECURE_WORLD_ENABLED (1UL<<0)
351351
*/
352352
uint64_t vm_flag;
353353

0 commit comments

Comments
 (0)