From ea3476d22d2ac00758e6244c92f717000e2de0dc Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Wed, 11 Dec 2019 12:29:21 +0800 Subject: [PATCH] HV: rename CONFIG_MAX_PCPU_NUM to MAX_PCPU_NUM rename the macro since MAX_PCPU_NUM could be parsed from board file and it is not a configurable item anymore. Tracked-On: #4230 Signed-off-by: Victor Sun Acked-by: Eddie Dong --- hypervisor/arch/x86/configs/apl-mrb/misc_cfg.h | 2 +- hypervisor/arch/x86/configs/apl-up2/misc_cfg.h | 2 +- hypervisor/arch/x86/configs/dnv-cb2/misc_cfg.h | 2 +- hypervisor/arch/x86/configs/generic/misc_cfg.h | 2 +- hypervisor/arch/x86/configs/nuc6cayh/misc_cfg.h | 2 +- hypervisor/arch/x86/configs/nuc7i7dnb/misc_cfg.h | 2 +- hypervisor/arch/x86/configs/vacpi.c | 2 +- hypervisor/arch/x86/cpu.c | 12 ++++++------ hypervisor/arch/x86/guest/assign.c | 2 +- hypervisor/arch/x86/lapic.c | 4 ++-- hypervisor/arch/x86/notify.c | 2 +- hypervisor/boot/acpi_base.c | 6 +++--- hypervisor/boot/include/acpi.h | 2 +- hypervisor/debug/profiling.c | 4 ++-- hypervisor/debug/shell.c | 2 +- hypervisor/include/arch/x86/cpu.h | 2 +- hypervisor/include/arch/x86/per_cpu.h | 2 +- hypervisor/include/dm/vacpi.h | 2 +- hypervisor/scenarios/sdc/vm_configurations.c | 2 +- 19 files changed, 28 insertions(+), 28 deletions(-) diff --git a/hypervisor/arch/x86/configs/apl-mrb/misc_cfg.h b/hypervisor/arch/x86/configs/apl-mrb/misc_cfg.h index 9a88cbb91..bb3cbdd29 100644 --- a/hypervisor/arch/x86/configs/apl-mrb/misc_cfg.h +++ b/hypervisor/arch/x86/configs/apl-mrb/misc_cfg.h @@ -7,7 +7,7 @@ #ifndef MISC_CFG_H #define MISC_CFG_H -#define CONFIG_MAX_PCPU_NUM 4U +#define MAX_PCPU_NUM 4U #define MAX_PLATFORM_CLOS_NUM 0U #define ROOTFS_0 "root=/dev/sda3 " diff --git a/hypervisor/arch/x86/configs/apl-up2/misc_cfg.h b/hypervisor/arch/x86/configs/apl-up2/misc_cfg.h index 162507731..655b6dad6 100644 --- a/hypervisor/arch/x86/configs/apl-up2/misc_cfg.h +++ b/hypervisor/arch/x86/configs/apl-up2/misc_cfg.h @@ -7,7 +7,7 @@ #ifndef MISC_CFG_H #define MISC_CFG_H -#define CONFIG_MAX_PCPU_NUM 4U +#define MAX_PCPU_NUM 4U #define MAX_PLATFORM_CLOS_NUM 4U #define ROOTFS_0 "root=/dev/sda3 " diff --git a/hypervisor/arch/x86/configs/dnv-cb2/misc_cfg.h b/hypervisor/arch/x86/configs/dnv-cb2/misc_cfg.h index 1d09f2b5e..8630b4282 100644 --- a/hypervisor/arch/x86/configs/dnv-cb2/misc_cfg.h +++ b/hypervisor/arch/x86/configs/dnv-cb2/misc_cfg.h @@ -7,7 +7,7 @@ #ifndef MISC_CFG_H #define MISC_CFG_H -#define CONFIG_MAX_PCPU_NUM 8U +#define MAX_PCPU_NUM 8U #define MAX_PLATFORM_CLOS_NUM 0U #define ROOTFS_0 "root=/dev/sda3 " diff --git a/hypervisor/arch/x86/configs/generic/misc_cfg.h b/hypervisor/arch/x86/configs/generic/misc_cfg.h index 340647af2..622205d26 100644 --- a/hypervisor/arch/x86/configs/generic/misc_cfg.h +++ b/hypervisor/arch/x86/configs/generic/misc_cfg.h @@ -7,7 +7,7 @@ #ifndef MISC_CFG_H #define MISC_CFG_H -#define CONFIG_MAX_PCPU_NUM 4U +#define MAX_PCPU_NUM 4U #define MAX_PLATFORM_CLOS_NUM 0U #define ROOTFS_0 "root=/dev/sda3 " diff --git a/hypervisor/arch/x86/configs/nuc6cayh/misc_cfg.h b/hypervisor/arch/x86/configs/nuc6cayh/misc_cfg.h index aaa23ae16..ec2955b4a 100644 --- a/hypervisor/arch/x86/configs/nuc6cayh/misc_cfg.h +++ b/hypervisor/arch/x86/configs/nuc6cayh/misc_cfg.h @@ -7,7 +7,7 @@ #ifndef MISC_CFG_H #define MISC_CFG_H -#define CONFIG_MAX_PCPU_NUM 4U +#define MAX_PCPU_NUM 4U #define MAX_PLATFORM_CLOS_NUM 0U #define ROOTFS_0 "root=/dev/sda3 " diff --git a/hypervisor/arch/x86/configs/nuc7i7dnb/misc_cfg.h b/hypervisor/arch/x86/configs/nuc7i7dnb/misc_cfg.h index c47a1bfaa..5e23727c9 100644 --- a/hypervisor/arch/x86/configs/nuc7i7dnb/misc_cfg.h +++ b/hypervisor/arch/x86/configs/nuc7i7dnb/misc_cfg.h @@ -7,7 +7,7 @@ #ifndef MISC_CFG_H #define MISC_CFG_H -#define CONFIG_MAX_PCPU_NUM 4U +#define MAX_PCPU_NUM 4U #define MAX_PLATFORM_CLOS_NUM 0U #define ROOTFS_0 "root=/dev/sda3 " diff --git a/hypervisor/arch/x86/configs/vacpi.c b/hypervisor/arch/x86/configs/vacpi.c index ece3969c3..0e63f64eb 100644 --- a/hypervisor/arch/x86/configs/vacpi.c +++ b/hypervisor/arch/x86/configs/vacpi.c @@ -53,7 +53,7 @@ static struct acpi_table_info acpi_table_template[CONFIG_MAX_VM_NUM] = { .lint = 0x1U, }, .lapic_array = { - [0U ... (CONFIG_MAX_PCPU_NUM - 1U)] = { + [0U ... (MAX_PCPU_NUM - 1U)] = { .header.type = ACPI_MADT_TYPE_LOCAL_APIC, .header.length = sizeof(struct acpi_madt_local_apic), .lapic_flags = 0x1U, /* Processor Enabled=1, Runtime Online Capable=0 */ diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index c40d64622..f1fe41a9f 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -32,7 +32,7 @@ #define CPU_UP_TIMEOUT 100U /* millisecond */ #define CPU_DOWN_TIMEOUT 100U /* millisecond */ -struct per_cpu_region per_cpu_data[CONFIG_MAX_PCPU_NUM] __aligned(PAGE_SIZE); +struct per_cpu_region per_cpu_data[MAX_PCPU_NUM] __aligned(PAGE_SIZE); static uint16_t phys_cpu_num = 0U; static uint64_t pcpu_sync = 0UL; static uint64_t startup_paddr = 0UL; @@ -47,18 +47,18 @@ static uint16_t get_pcpu_id_from_lapic_id(uint32_t lapic_id); static uint64_t start_tsc __attribute__((__section__(".bss_noinit"))); /** - * @pre phys_cpu_num <= CONFIG_MAX_PCPU_NUM + * @pre phys_cpu_num <= MAX_PCPU_NUM */ static bool init_percpu_lapic_id(void) { uint16_t i; - uint32_t lapic_id_array[CONFIG_MAX_PCPU_NUM]; + uint32_t lapic_id_array[MAX_PCPU_NUM]; bool success = false; /* Save all lapic_id detected via parse_mdt in lapic_id_array */ phys_cpu_num = parse_madt(lapic_id_array); - if ((phys_cpu_num != 0U) && (phys_cpu_num <= CONFIG_MAX_PCPU_NUM)) { + if ((phys_cpu_num != 0U) && (phys_cpu_num <= MAX_PCPU_NUM)) { for (i = 0U; i < phys_cpu_num; i++) { per_cpu(lapic_id, i) = lapic_id_array[i]; } @@ -82,7 +82,7 @@ static void pcpu_set_current_state(uint16_t pcpu_id, enum pcpu_boot_state state) } /* - * @post return <= CONFIG_MAX_PCPU_NUM + * @post return <= MAX_PCPU_NUM */ uint16_t get_pcpu_nums(void) { @@ -174,7 +174,7 @@ void init_pcpu_pre(bool is_bsp) early_init_lapic(); pcpu_id = get_pcpu_id_from_lapic_id(get_cur_lapic_id()); - if (pcpu_id >= CONFIG_MAX_PCPU_NUM) { + if (pcpu_id >= MAX_PCPU_NUM) { panic("Invalid pCPU ID!"); } } diff --git a/hypervisor/arch/x86/guest/assign.c b/hypervisor/arch/x86/guest/assign.c index 239115c64..1171e5dde 100644 --- a/hypervisor/arch/x86/guest/assign.c +++ b/hypervisor/arch/x86/guest/assign.c @@ -67,7 +67,7 @@ static uint32_t calculate_logical_dest_mask(uint64_t pdmask) uint16_t pcpu_id; pcpu_id = ffs64(pcpu_mask); - while (pcpu_id < CONFIG_MAX_PCPU_NUM) { + while (pcpu_id < MAX_PCPU_NUM) { bitmap_clear_nolock(pcpu_id, &pcpu_mask); dest_mask |= per_cpu(lapic_ldr, pcpu_id); pcpu_id = ffs64(pcpu_mask); diff --git a/hypervisor/arch/x86/lapic.c b/hypervisor/arch/x86/lapic.c index c06daaab7..200833cc0 100644 --- a/hypervisor/arch/x86/lapic.c +++ b/hypervisor/arch/x86/lapic.c @@ -240,7 +240,7 @@ void send_dest_ipi_mask(uint32_t dest_mask, uint32_t vector) pcpu_id = ffs64(mask); - while (pcpu_id < CONFIG_MAX_PCPU_NUM) { + while (pcpu_id < MAX_PCPU_NUM) { bitmap32_clear_nolock(pcpu_id, &mask); if (is_pcpu_active(pcpu_id)) { icr.value_32.hi_32 = per_cpu(lapic_id, pcpu_id); @@ -270,7 +270,7 @@ void send_single_ipi(uint16_t pcpu_id, uint32_t vector) } /** - * @pre pcpu_id < CONFIG_MAX_PCPU_NUM + * @pre pcpu_id < MAX_PCPU_NUM * * @return None */ diff --git a/hypervisor/arch/x86/notify.c b/hypervisor/arch/x86/notify.c index 85a0dcc40..6c8aafd02 100644 --- a/hypervisor/arch/x86/notify.c +++ b/hypervisor/arch/x86/notify.c @@ -44,7 +44,7 @@ void smp_call_function(uint64_t mask, smp_call_func_t func, void *data) /* wait for previous smp call complete, which may run on other cpus */ while (atomic_cmpxchg64(&smp_call_mask, 0UL, mask & INVALID_BIT_INDEX) != 0UL); pcpu_id = ffs64(mask); - while (pcpu_id < CONFIG_MAX_PCPU_NUM) { + while (pcpu_id < MAX_PCPU_NUM) { bitmap_clear_nolock(pcpu_id, &mask); if (is_pcpu_active(pcpu_id)) { smp_call = &per_cpu(smp_call_info, pcpu_id); diff --git a/hypervisor/boot/acpi_base.c b/hypervisor/boot/acpi_base.c index b34cd5a88..7084c7733 100644 --- a/hypervisor/boot/acpi_base.c +++ b/hypervisor/boot/acpi_base.c @@ -159,7 +159,7 @@ void *get_acpi_tbl(const char *signature) * of Type 0 */ static uint16_t -local_parse_madt(struct acpi_table_madt *madt, uint32_t lapic_id_array[CONFIG_MAX_PCPU_NUM]) +local_parse_madt(struct acpi_table_madt *madt, uint32_t lapic_id_array[MAX_PCPU_NUM]) { uint16_t pcpu_num = 0U; struct acpi_madt_local_apic *processor; @@ -181,7 +181,7 @@ local_parse_madt(struct acpi_table_madt *madt, uint32_t lapic_id_array[CONFIG_MA if (entry->type == ACPI_MADT_TYPE_LOCAL_APIC) { processor = (struct acpi_madt_local_apic *)iterator; if ((processor->lapic_flags & ACPI_MADT_ENABLED) != 0U) { - if (pcpu_num < CONFIG_MAX_PCPU_NUM) { + if (pcpu_num < MAX_PCPU_NUM) { lapic_id_array[pcpu_num] = processor->id; } pcpu_num++; @@ -227,7 +227,7 @@ ioapic_parse_madt(void *madt, struct ioapic_info *ioapic_id_array) } /* The lapic_id info gotten from madt will be returned in lapic_id_array */ -uint16_t parse_madt(uint32_t lapic_id_array[CONFIG_MAX_PCPU_NUM]) +uint16_t parse_madt(uint32_t lapic_id_array[MAX_PCPU_NUM]) { uint16_t ret = 0U; struct acpi_table_rsdp *rsdp = NULL; diff --git a/hypervisor/boot/include/acpi.h b/hypervisor/boot/include/acpi.h index e0a269260..8641dcbd1 100644 --- a/hypervisor/boot/include/acpi.h +++ b/hypervisor/boot/include/acpi.h @@ -202,7 +202,7 @@ struct acpi_dmar_device_scope { void *get_acpi_tbl(const char *signature); struct ioapic_info; -uint16_t parse_madt(uint32_t lapic_id_array[CONFIG_MAX_PCPU_NUM]); +uint16_t parse_madt(uint32_t lapic_id_array[MAX_PCPU_NUM]); uint16_t parse_madt_ioapic(struct ioapic_info *ioapic_id_array); #ifdef CONFIG_ACPI_PARSE_ENABLED diff --git a/hypervisor/debug/profiling.c b/hypervisor/debug/profiling.c index afaa48808..3c0ce2d6c 100644 --- a/hypervisor/debug/profiling.c +++ b/hypervisor/debug/profiling.c @@ -812,7 +812,7 @@ static void profiling_stop_pmu(void) int32_t profiling_msr_ops_all_cpus(struct acrn_vm *vm, uint64_t addr) { uint16_t i; - struct profiling_msr_ops_list msr_list[CONFIG_MAX_PCPU_NUM]; + struct profiling_msr_ops_list msr_list[MAX_PCPU_NUM]; uint16_t pcpu_nums = get_pcpu_nums(); dev_dbg(ACRN_DBG_PROFILING, "%s: entering", __func__); @@ -1256,7 +1256,7 @@ int32_t profiling_get_pcpu_id(struct acrn_vm *vm, uint64_t addr) int32_t profiling_get_status_info(struct acrn_vm *vm, uint64_t gpa) { uint16_t i; - struct profiling_status pstats[CONFIG_MAX_PCPU_NUM]; + struct profiling_status pstats[MAX_PCPU_NUM]; uint16_t pcpu_nums = get_pcpu_nums(); dev_dbg(ACRN_DBG_PROFILING, "%s: entering", __func__); diff --git a/hypervisor/debug/shell.c b/hypervisor/debug/shell.c index ccd5d377a..9e8b1ae87 100644 --- a/hypervisor/debug/shell.c +++ b/hypervisor/debug/shell.c @@ -26,7 +26,7 @@ #define MAX_STR_SIZE 256U #define SHELL_PROMPT_STR "ACRN:\\>" -#define SHELL_LOG_BUF_SIZE (PAGE_SIZE * CONFIG_MAX_PCPU_NUM / 2U) +#define SHELL_LOG_BUF_SIZE (PAGE_SIZE * MAX_PCPU_NUM / 2U) static char shell_log_buf[SHELL_LOG_BUF_SIZE]; /* Input Line Other - Switch to the "other" input line (there are only two diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index 259c759b4..76959113e 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -658,7 +658,7 @@ static inline void clac(void) } /* - * @post return <= CONFIG_MAX_PCPU_NUM + * @post return <= MAX_PCPU_NUM */ uint16_t get_pcpu_nums(void); bool is_pcpu_active(uint16_t pcpu_id); diff --git a/hypervisor/include/arch/x86/per_cpu.h b/hypervisor/include/arch/x86/per_cpu.h index 1a667ab31..02f780176 100644 --- a/hypervisor/include/arch/x86/per_cpu.h +++ b/hypervisor/include/arch/x86/per_cpu.h @@ -60,7 +60,7 @@ struct per_cpu_region { uint64_t tsc_suspend; } __aligned(PAGE_SIZE); /* per_cpu_region size aligned with PAGE_SIZE */ -extern struct per_cpu_region per_cpu_data[CONFIG_MAX_PCPU_NUM]; +extern struct per_cpu_region per_cpu_data[MAX_PCPU_NUM]; /* * get percpu data for pcpu_id. */ diff --git a/hypervisor/include/dm/vacpi.h b/hypervisor/include/dm/vacpi.h index 81efeb672..3288bdc61 100644 --- a/hypervisor/include/dm/vacpi.h +++ b/hypervisor/include/dm/vacpi.h @@ -54,7 +54,7 @@ struct acpi_table_info { struct { struct acpi_table_madt madt; struct acpi_madt_local_apic_nmi lapic_nmi; - struct acpi_madt_local_apic lapic_array[CONFIG_MAX_PCPU_NUM]; + struct acpi_madt_local_apic lapic_array[MAX_PCPU_NUM]; } __packed; }; diff --git a/hypervisor/scenarios/sdc/vm_configurations.c b/hypervisor/scenarios/sdc/vm_configurations.c index ff16f6206..66270cde8 100644 --- a/hypervisor/scenarios/sdc/vm_configurations.c +++ b/hypervisor/scenarios/sdc/vm_configurations.c @@ -46,7 +46,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = { .uuid = {0xd2U, 0x79U, 0x54U, 0x38U, 0x25U, 0xd6U, 0x11U, 0xe8U, \ 0x86U, 0x4eU, 0xcbU, 0x7aU, 0x18U, 0xb3U, 0x46U, 0x43U}, /* d2795438-25d6-11e8-864e-cb7a18b34643 */ - .vcpu_num = CONFIG_MAX_PCPU_NUM - CONFIG_MAX_KATA_VM_NUM - 1U, + .vcpu_num = MAX_PCPU_NUM - CONFIG_MAX_KATA_VM_NUM - 1U, .vcpu_affinity = VM1_CONFIG_VCPU_AFFINITY, .vuart[0] = { .type = VUART_LEGACY_PIO,