Skip to content

Commit c849bff

Browse files
junjiemao1lijinxia
authored andcommitted
HV: config: adapt to the generated config.h
This patch drops "#include <bsp_cfg.h>" and include the generated config.h in CFLAGS for the configuration data. Also make sure that all configuration data have the 'CONFIG_' prefix. v4 -> v5: * No changes. v3 -> v4: * Add '-include config.h' to hypervisor/bsp/uefi/efi/Makefile. * Update comments mentioning bsp_cfg.h. v2 -> v3: * Include config.h on the command line instead of in any header or source to avoid including config.h multiple times. * Add config.h as an additional dependency for source compilation. v1 -> v2: * No changes. Signed-off-by: Junjie Mao <junjie.mao@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
1 parent f9bb202 commit c849bff

File tree

17 files changed

+46
-48
lines changed

17 files changed

+46
-48
lines changed

hypervisor/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ INCLUDE_PATH += include/common
7777
INCLUDE_PATH += bsp/include
7878
INCLUDE_PATH += bsp/$(PLATFORM)/include/bsp
7979
INCLUDE_PATH += boot/include
80+
INCLUDE_PATH += $(HV_OBJDIR)/include
8081

8182
CC ?= gcc
8283
AS ?= as
@@ -180,7 +181,7 @@ DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
180181
VERSION := bsp/$(PLATFORM)/include/bsp/version.h
181182

182183
.PHONY: all
183-
all: $(BUILD_DEPS) $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
184+
all: $(BUILD_DEPS) $(VERSION) oldconfig $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
184185
rm -f $(VERSION)
185186

186187
ifeq ($(PLATFORM), uefi)
@@ -247,11 +248,10 @@ $(VERSION):
247248
echo "#define HV_BUILD_TIME "\""$$TIME"\""" >> $(VERSION);\
248249
echo "#define HV_BUILD_USER "\""$(USER)"\""" >> $(VERSION)
249250

250-
$(HV_OBJDIR)/%.o: %.c
251+
$(HV_OBJDIR)/%.o: %.c $(HV_OBJDIR)/$(HV_CONFIG_H)
251252
[ ! -e $@ ] && mkdir -p $(dir $@); \
252253
$(CC) $(patsubst %, -I%, $(INCLUDE_PATH)) -I. -c $(CFLAGS) $(ARCH_CFLAGS) $< -o $@
253254

254-
$(HV_OBJDIR)/%.o: %.S
255+
$(HV_OBJDIR)/%.o: %.S $(HV_OBJDIR)/$(HV_CONFIG_H)
255256
[ ! -e $@ ] && mkdir -p $(dir $@); \
256257
$(CC) $(patsubst %, -I%, $(INCLUDE_PATH)) -I. $(ASFLAGS) $(ARCH_ASFLAGS) -c $< -o $@
257-

hypervisor/arch/x86/cpu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ void bsp_boot_init(void)
424424
load_gdtr_and_tr();
425425

426426
/* Switch to run-time stack */
427-
CPU_SP_WRITE(&get_cpu_var(stack)[STACK_SIZE - 1]);
427+
CPU_SP_WRITE(&get_cpu_var(stack)[CONFIG_STACK_SIZE - 1]);
428428

429429
#ifdef STACK_PROTECTOR
430430
set_fs_base();
@@ -456,8 +456,8 @@ void bsp_boot_init(void)
456456
calibrate_tsc();
457457

458458
/* Enable logging */
459-
init_logmsg(LOG_BUF_SIZE,
460-
LOG_DESTINATION);
459+
init_logmsg(CONFIG_LOG_BUF_SIZE,
460+
CONFIG_LOG_DESTINATION);
461461

462462
if (HV_RC_VERSION)
463463
pr_acrnlog("HV version %d.%d-rc%d-%s-%s %s build by %s, start time %lluus",
@@ -556,7 +556,7 @@ void cpu_secondary_init(void)
556556
__bitmap_set(get_cpu_id(), &pcpu_active_bitmap);
557557

558558
/* Switch to run-time stack */
559-
CPU_SP_WRITE(&get_cpu_var(stack)[STACK_SIZE - 1]);
559+
CPU_SP_WRITE(&get_cpu_var(stack)[CONFIG_STACK_SIZE - 1]);
560560

561561
#ifdef STACK_PROTECTOR
562562
set_fs_base();
@@ -654,7 +654,7 @@ void start_cpus()
654654
/* Wait until global count is equal to expected CPU up count or
655655
* configured time-out has expired
656656
*/
657-
timeout = CPU_UP_TIMEOUT * 1000;
657+
timeout = CONFIG_CPU_UP_TIMEOUT * 1000;
658658
while ((up_count != expected_up) && (timeout != 0)) {
659659
/* Delay 10us */
660660
udelay(10);
@@ -679,7 +679,7 @@ void stop_cpus()
679679
int i;
680680
uint32_t timeout, expected_up;
681681

682-
timeout = CPU_UP_TIMEOUT * 1000;
682+
timeout = CONFIG_CPU_UP_TIMEOUT * 1000;
683683
for (i = 0; i < phy_cpu_num; i++) {
684684
if (get_cpu_id() == i) /* avoid offline itself */
685685
continue;

hypervisor/arch/x86/gdt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ void load_gdtr_and_tr(void)
3434
/* ring 0 data sel descriptor */
3535
gdt->host_gdt_data_descriptor.value = 0x00cf93000000ffff;
3636

37-
tss->ist1 = (uint64_t)get_cpu_var(mc_stack) + STACK_SIZE;
38-
tss->ist2 = (uint64_t)get_cpu_var(df_stack) + STACK_SIZE;
39-
tss->ist3 = (uint64_t)get_cpu_var(sf_stack) + STACK_SIZE;
37+
tss->ist1 = (uint64_t)get_cpu_var(mc_stack) + CONFIG_STACK_SIZE;
38+
tss->ist2 = (uint64_t)get_cpu_var(df_stack) + CONFIG_STACK_SIZE;
39+
tss->ist3 = (uint64_t)get_cpu_var(sf_stack) + CONFIG_STACK_SIZE;
4040
tss->ist4 = 0L;
4141

4242
/* tss descriptor */

hypervisor/arch/x86/ioapic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void setup_ioapic_irq(void)
304304

305305
spinlock_init(&ioapic_lock);
306306

307-
for (ioapic_id = 0, gsi = 0; ioapic_id < NR_IOAPICS; ioapic_id++) {
307+
for (ioapic_id = 0, gsi = 0; ioapic_id < CONFIG_NR_IOAPICS; ioapic_id++) {
308308
int pin;
309309
int max_pins;
310310
int version;

hypervisor/boot/dmar_parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* SPDX-License-Identifier: BSD-3-Clause
55
*/
6-
#include "bsp_cfg.h"
6+
77
#ifdef CONFIG_DMAR_PARSE_ENABLED
88
#include <hypervisor.h>
99
#include "vtd.h"

hypervisor/bsp/ld/link_ram.ld.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "bsp_cfg.h"
1+
#include "config.h"
22

33
ENTRY(cpu_primary_start_32)
44

@@ -83,4 +83,3 @@ SECTIONS
8383
_ld_ram_size = LENGTH(ram) ;
8484
_ld_ram_end = _ld_ram_size + _ld_ram_start ;
8585
}
86-

hypervisor/bsp/uefi/efi/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ HV_FILE:=acrn
3636
EFI_OBJDIR:=$(HV_OBJDIR)/bsp/uefi/efi
3737
C_SRCS = boot.c pe.c malloc.c
3838
ACRN_OBJS := $(patsubst %.c,$(EFI_OBJDIR)/%.o,$(C_SRCS))
39-
INCLUDE_PATH += ../include/bsp/
39+
INCLUDE_PATH += $(HV_OBJDIR)/include
4040

4141
OBJCOPY=objcopy
4242

@@ -68,7 +68,8 @@ endif
6868

6969
CFLAGS=-I. -I.. -I$(INCDIR)/efi -I$(INCDIR)/efi/$(ARCH) \
7070
-DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \
71-
-Wall -I../fs/ -D$(ARCH) -O2
71+
-Wall -I../fs/ -D$(ARCH) -O2 \
72+
-include config.h
7273

7374
CFLAGS += -mno-mmx -mno-sse -mno-sse2 -mno-80387 -mno-fp-ret-in-387
7475

@@ -107,11 +108,11 @@ install-conf: $(CONF_FILE)
107108
clean:
108109
rm -f $(BOOT) $(HV_OBJDIR)/$(HV_FILE).efi $(EFI_OBJDIR)/boot.so $(ACRN_OBJS) $(FS)
109110

110-
$(EFI_OBJDIR)/%.o:%.S
111+
$(EFI_OBJDIR)/%.o:%.S $(HV_OBJDIR)/$(HV_CONFIG_H)
111112
[ ! -e $@ ] && mkdir -p $(dir $@); \
112113
$(CC) $(CFLAGS) -c -o $@ $<
113114

114-
$(EFI_OBJDIR)/%.o: %.c
115+
$(EFI_OBJDIR)/%.o: %.c $(HV_OBJDIR)/$(HV_CONFIG_H)
115116
[ ! -e $@ ] && mkdir -p $(dir $@); \
116117
$(CC) $(patsubst %, -I%, $(INCLUDE_PATH)) -I. -c $(CFLAGS) $(ARCH_CFLAGS) $< -o $@
117118

hypervisor/bsp/uefi/efi/boot.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *_table)
380380
/*
381381
* If we reach this point, it means we did not receive a specific
382382
* bootloader name to be used. Fall back to the default bootloader
383-
* as specified in bsp_cfg.h
383+
* as specified in config.h
384384
*/
385385
bootloader_name = ch8_2_ch16(CONFIG_UEFI_OS_LOADER_NAME);
386386
}
@@ -454,4 +454,3 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *_table)
454454

455455
return exit(image, err, ERROR_STRING_LENGTH, error_buf);
456456
}
457-

hypervisor/bsp/uefi/efi/boot.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#ifndef __ACRNBOOT_H__
3535
#define __ACRNBOOT_H__
3636

37-
#include <bsp_cfg.h>
3837
#include "multiboot.h"
3938

4039
#define E820_RAM 1
@@ -182,4 +181,3 @@ msr_read(uint32_t reg_num)
182181
}
183182

184183
#endif
185-

hypervisor/common/schedule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static void switch_to(struct vcpu *curr)
169169
* reset stack pointer here. Otherwise, schedule
170170
* is recursive call and stack will overflow finally.
171171
*/
172-
uint64_t cur_sp = (uint64_t)&get_cpu_var(stack)[STACK_SIZE];
172+
uint64_t cur_sp = (uint64_t)&get_cpu_var(stack)[CONFIG_STACK_SIZE];
173173

174174
if (curr == NULL) {
175175
asm volatile ("movq %1, %%rsp\n"

0 commit comments

Comments
 (0)