HV: modularization: rename mi_cmdline to cmdline in acrn boot info

The name of mi_cmdline in acrn_boot_info structure would cause confusion with
mi_cmdline in multiboot_info structure, rename it to cmdline;

Tracked-On: #5661

Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Victor Sun 2021-05-24 22:39:12 +08:00 committed by wenlingz
parent 56c52d0b95
commit acff2959ff
6 changed files with 14 additions and 9 deletions

View File

@ -45,7 +45,7 @@ static uint32_t parse_seed_arg(void)
uint32_t i = SEED_ARG_NUM - 1U;
uint32_t len;
cmd_src = abi->mi_cmdline;
cmd_src = abi->cmdline;
if (cmd_src != NULL) {
for (i = 0U; seed_arg[i].str != NULL; i++) {

View File

@ -136,13 +136,13 @@ static void init_vm_bootargs_info(struct acrn_vm *vm, const struct acrn_boot_inf
pr_err("failed to fill seed arg to SOS bootargs!");
}
/* If there is cmdline from mbi->mi_cmdline, merge it with configured SOS bootargs.
/* If there is cmdline from abi->cmdline, merge it with configured SOS bootargs.
* This is very helpful when one of configured bootargs need to be revised at GRUB runtime
* (e.g. "root="), since the later one would override the previous one if multiple bootargs exist.
*/
if ((abi->mi_cmdline != NULL) && (*(abi->mi_cmdline) != '\0')) {
if (abi->cmdline[0] != '\0') {
if (strncat_s((char *)vm->sw.bootargs_info.src_addr, MAX_BOOTARGS_SIZE,
abi->mi_cmdline, (MAX_BOOTARGS_SIZE - 1U)) != 0) {
abi->cmdline, (MAX_BOOTARGS_SIZE - 1U)) != 0) {
pr_err("failed to merge mbi cmdline to SOS bootargs!");
}
}

View File

@ -24,7 +24,7 @@
struct acrn_boot_info {
const char *mi_cmdline;
const char cmdline[MAX_BOOTARGS_SIZE];
const char *mi_loader_name;
uint32_t mi_mods_count;

View File

@ -18,7 +18,9 @@ int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info) {
struct multiboot_mmap *mmap = (struct multiboot_mmap *)hpa2hva_early((uint64_t)mbi->mi_mmap_addr);
struct multiboot_module *mods = (struct multiboot_module *)hpa2hva_early((uint64_t)mbi->mi_mods_addr);
abi->mi_cmdline = (char *)hpa2hva_early((uint64_t)mbi->mi_cmdline);
(void)strncpy_s((void *)(abi->cmdline), MAX_BOOTARGS_SIZE, (char *)hpa2hva_early((uint64_t)mbi->mi_cmdline),
strnlen_s((char *)hpa2hva_early((uint64_t)mbi->mi_cmdline), (MAX_BOOTARGS_SIZE - 1U)));
abi->mi_loader_name = (char *)hpa2hva_early((uint64_t)mbi->mi_loader_name);
abi->mi_mmap_entries = mbi->mi_mmap_length / sizeof(struct multiboot_mmap);
abi->mi_mods_count = mbi->mi_mods_count;

View File

@ -77,6 +77,7 @@ int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info)
struct multiboot2_tag *mb2_tag, *mb2_tag_end;
uint32_t mb2_info_size = *(uint32_t *)mb2_info;
uint32_t mod_idx = 0U;
void *str;
/* The start part of multiboot2 info: total mbi size (4 bytes), reserved (4 bytes) */
mb2_tag = (struct multiboot2_tag *)((uint8_t *)mb2_info + 8U);
@ -85,7 +86,9 @@ int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info)
while ((mb2_tag->type != MULTIBOOT2_TAG_TYPE_END) && (mb2_tag < mb2_tag_end)) {
switch (mb2_tag->type) {
case MULTIBOOT2_TAG_TYPE_CMDLINE:
abi->mi_cmdline = ((struct multiboot2_tag_string *)mb2_tag)->string;
str = ((struct multiboot2_tag_string *)mb2_tag)->string;
(void)strncpy_s((void *)(abi->cmdline), MAX_BOOTARGS_SIZE, str,
strnlen_s(str, (MAX_BOOTARGS_SIZE - 1U)));
break;
case MULTIBOOT2_TAG_TYPE_MMAP:
mb2_mmap_to_abi(abi, (const struct multiboot2_tag_mmap *)mb2_tag);

View File

@ -31,9 +31,9 @@ static void parse_hvdbg_cmdline(void)
const char *end = NULL;
struct acrn_boot_info *abi = get_acrn_boot_info();
start = abi->mi_cmdline;
start = abi->cmdline;
while ((start != NULL) && ((*start) != '\0')) {
while ((*start) != '\0') {
while ((*start) == ' ')
start++;
if ((*start) != '\0') {