cmdline: move cmdline to x86

Now risc-v doesn't support cmdline

Tracked-On: #8805
Signed-off-by: Fei Li <fei1.li@intel.com>
This commit is contained in:
Fei Li
2025-09-23 22:49:56 +08:00
committed by acrnsi-robot
parent 9d95a6adb6
commit ac1c79641e
6 changed files with 45 additions and 42 deletions

View File

@@ -40,6 +40,7 @@
#include <thermal.h>
#include <common/notify.h>
#include <cpu.h>
#include <debug/dbg_cmd.h>
static uint16_t phys_cpu_num = 0U;
static uint64_t pcpu_sync = 0UL;
@@ -51,6 +52,9 @@ static void print_hv_banner(void);
static uint16_t get_pcpu_id_from_lapic_id(uint32_t lapic_id);
static uint64_t start_tick __attribute__((__section__(".bss_noinit")));
/* if use INIT to kick pcpu only, if not notification IPI still is used for sharing CPU */
static bool use_init_ipi = false;
/**
* This function will be called by function get_pcpu_nums()
* in common/cpu.c
@@ -588,3 +592,38 @@ uint64_t msr_read_pcpu(uint32_t msr_index, uint16_t pcpu_id)
return ret;
}
bool is_using_init_ipi(void)
{
return use_init_ipi;
}
void arch_parse_hvdbg_cmdline(void)
{
const char *start = NULL;
const char *end = NULL;
struct acrn_boot_info *abi = get_acrn_boot_info();
start = abi->cmdline;
while ((*start) != '\0') {
while ((*start) == ' ') {
start++;
}
if ((*start) != '\0') {
end = start + 1;
while ((*end != ' ') && ((*end) != '\0')) {
end++;
}
if (!handle_dbg_cmd(start, (int32_t)(end - start))) {
/* if not handled by handle_dbg_cmd, it can be handled further */
if (strncmp(start, "USE_INIT_IPI", (size_t)(end - start)) == 0) {
use_init_ipi = true;
}
}
start = end;
}
}
}

View File

@@ -34,6 +34,9 @@ extern uint32_t boot_regs[2];
/*TODO: move into debug module */
static void init_debug_pre(void)
{
/*Parse cmdline to get UART setting*/
arch_parse_hvdbg_cmdline();
/* Initialize console */
console_init();
}

View File

@@ -27,50 +27,11 @@ struct hv_timer console_timer;
#define GUEST_CONSOLE_TO_HV_SWITCH_KEY 'e' /* escape + e to switch back to hv console */
uint16_t console_vmid = CONFIG_CONSOLE_DEFAULT_VM;
/* if use INIT to kick pcpu only, if not notification IPI still is used for sharing CPU */
static bool use_init_ipi = false;
uint16_t console_loglevel = CONFIG_CONSOLE_LOGLEVEL_DEFAULT;
static spinlock_t console_log_lock;
bool is_using_init_ipi(void)
{
return use_init_ipi;
}
static void parse_hvdbg_cmdline(void)
{
const char *start = NULL;
const char *end = NULL;
struct acrn_boot_info *abi = get_acrn_boot_info();
start = abi->cmdline;
while ((*start) != '\0') {
while ((*start) == ' ')
start++;
if ((*start) != '\0') {
end = start + 1;
while ((*end != ' ') && ((*end) != '\0'))
end++;
if (!handle_dbg_cmd(start, (int32_t)(end - start))) {
/* if not handled by handle_dbg_cmd, it can be handled further */
if (strncmp(start, "USE_INIT_IPI", (size_t)(end - start)) == 0) {
use_init_ipi = true;
}
}
start = end;
}
}
}
void console_init(void)
{
/*Parse cmdline to get UART setting*/
parse_hvdbg_cmdline();
/*
* Enable UART as early as possible.
* Then we could use printf for debugging on early boot stage.

View File

@@ -459,6 +459,9 @@ void wait_pcpus_offline(uint64_t mask);
void stop_pcpus(void);
void wait_sync_change(volatile const uint64_t *sync, uint64_t wake_sync);
bool is_using_init_ipi(void);
void arch_parse_hvdbg_cmdline(void);
#define CPU_SEG_READ(seg, result_ptr) \
{ \
asm volatile ("mov %%" STRINGIFY(seg) ", %0": "=r" (*(result_ptr))); \

View File

@@ -41,7 +41,6 @@ void console_vmexit_callback(struct acrn_vcpu *vcpu);
void suspend_console(void);
void resume_console(void);
struct acrn_vuart *vm_console_vuart(struct acrn_vm *vm);
bool is_using_init_ipi(void);
bool console_need_log(uint32_t severity);
void console_log(char *buffer);

View File

@@ -29,8 +29,6 @@ void resume_console(void) {}
bool handle_dbg_cmd(__unused const char *cmd, __unused int32_t len) { return false; }
void console_vmexit_callback(__unused struct acrn_vcpu *vcpu) {}
bool is_using_init_ipi(void) { return false; }
void shell_init(void) {}
void shell_kick(void) {}