Skip to content

Commit 80a79fe

Browse files
KaigeFulijinxia
authored andcommitted
HV: Replace printf with pr_acrnlog after logmsg init
There are some massages which is not fatal error but should to print to serial and sbuf(hvlog) at the same time. pr_fatal is for fatal error massages and it is not good choice for the situation above. Introduce a new API pr_acrnlog to deal with the situation. And replace the following printf with pr_acrnlog for massages should be print to sbuf and serial. Then developers can get those massages on serial and BTM(Boot Time Measurement) can use acrnlog to get those massages from sbuf. BTM refers to Boot Time Measurement which will read acrnlog file to get timestamps of steps we want. Signed-off-by: Kaige Fu <kaige.fu@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
1 parent 9af38e1 commit 80a79fe

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

hypervisor/arch/x86/cpu.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static int hardware_detect_support(void)
239239
if (ret)
240240
return ret;
241241

242-
printf("hardware support HV\n");
242+
pr_acrnlog("hardware support HV");
243243
return 0;
244244
}
245245

@@ -484,20 +484,20 @@ void bsp_boot_init(void)
484484
LOG_DESTINATION);
485485

486486
if (HV_RC_VERSION)
487-
printf("HV version %d.%d-rc%d-%s-%s %s build by %s, start time %lluus\r\n",
487+
pr_acrnlog("HV version %d.%d-rc%d-%s-%s %s build by %s, start time %lluus",
488488
HV_MAJOR_VERSION, HV_MINOR_VERSION, HV_RC_VERSION,
489489
HV_BUILD_TIME, HV_BUILD_VERSION, HV_BUILD_TYPE,
490490
HV_BUILD_USER, TICKS_TO_US(start_tsc));
491491
else
492-
printf("HV version %d.%d-%s-%s %s build by %s, start time %lluus\r\n",
492+
pr_acrnlog("HV version %d.%d-%s-%s %s build by %s, start time %lluus",
493493
HV_MAJOR_VERSION, HV_MINOR_VERSION,
494494
HV_BUILD_TIME, HV_BUILD_VERSION, HV_BUILD_TYPE,
495495
HV_BUILD_USER, TICKS_TO_US(start_tsc));
496496

497-
printf("API version %d.%d\r\n",
497+
pr_acrnlog("API version %d.%d",
498498
HV_API_MAJOR_VERSION, HV_API_MINOR_VERSION);
499499

500-
printf("Detect processor: %s\n", boot_cpu_data.model_name);
500+
pr_acrnlog("Detect processor: %s", boot_cpu_data.model_name);
501501

502502
pr_dbg("Core %d is up", CPU_BOOT_ID);
503503

hypervisor/bsp/sbl/include/bsp/bsp_cfg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
#define MALLOC_ALIGN 16
4040
#define NUM_ALLOC_PAGES 4096
4141
#define HEAP_SIZE 0x100000
42-
#define CONSOLE_LOGLEVEL_DEFAULT 2
43-
#define MEM_LOGLEVEL_DEFAULT 4
42+
#define CONSOLE_LOGLEVEL_DEFAULT 3
43+
#define MEM_LOGLEVEL_DEFAULT 5
4444
#define CONFIG_LOW_RAM_START 0x00001000
4545
#define CONFIG_LOW_RAM_SIZE 0x000CF000
4646
#define CONFIG_RAM_START 0x6E000000

hypervisor/bsp/uefi/include/bsp/bsp_cfg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
#define MALLOC_ALIGN 16
4040
#define NUM_ALLOC_PAGES 4096
4141
#define HEAP_SIZE 0x100000
42-
#define CONSOLE_LOGLEVEL_DEFAULT 2
43-
#define MEM_LOGLEVEL_DEFAULT 4
42+
#define CONSOLE_LOGLEVEL_DEFAULT 3
43+
#define MEM_LOGLEVEL_DEFAULT 5
4444
#define CONFIG_LOW_RAM_START 0x00008000
4545
#define CONFIG_LOW_RAM_SIZE 0x00010000
4646
#define CONFIG_RAM_START 0x20000000

hypervisor/include/debug/logmsg.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333

3434
/* Logging severity levels */
3535
#define LOG_FATAL 1
36-
#define LOG_ERROR 2
37-
#define LOG_WARNING 3
38-
#define LOG_INFO 4
39-
#define LOG_DEBUG 5
36+
/* For msg should be write to console and sbuf meanwhile but not fatal error */
37+
#define LOG_ACRN 2
38+
#define LOG_ERROR 3
39+
#define LOG_WARNING 4
40+
#define LOG_INFO 5
41+
#define LOG_DEBUG 6
4042

4143
/* Logging flags */
4244
#define LOG_FLAG_STDOUT 0x00000001
@@ -77,6 +79,11 @@ static inline void print_logmsg_buffer(__unused uint32_t cpu_id)
7779
do_logmsg(LOG_FATAL, pr_prefix __VA_ARGS__); \
7880
} while (0)
7981

82+
#define pr_acrnlog(...) \
83+
do { \
84+
do_logmsg(LOG_ACRN, pr_prefix __VA_ARGS__); \
85+
} while (0)
86+
8087
#define pr_err(...) \
8188
do { \
8289
do_logmsg(LOG_ERROR, pr_prefix __VA_ARGS__); \

0 commit comments

Comments
 (0)