Skip to contentSkip to conversation

libxl: use correct command line for arm guests.

PATCH In review Ian Campbell 2 participants 3 messages Aug 6, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: use correct command line for arm guests.

We need to use libxl__domain_build_state.pv_cmdline in order to pickup the correct args when using pygrub. libxl_domain_build_info.cmdline is any args statically configured by the user.

This is consistent with the call to xc_domain_allocate, which takes the cmdline too (in that case for x86/PV usage).

state->pv_cmdline is also set for non-pygrub guests, since libxl_bootloader_run propagates info->cmdline if no bootloader is condfigured.

---
For 4.6: This makes pygrub work on ARM.

Should also be backported.

---
 tools/libxl/libxl_arm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tools/libxl/libxl_arm.c +5 -3
index 42ab6d8..a310737 100644
@@ -260,6 +260,7 @@ static int make_root_properties(libxl__gc *gc,
 }
 
 static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk,
+                            libxl__domain_build_state *state,
                             const libxl_domain_build_info *info)
 {
     int res;
@@ -268,8 +269,9 @@ static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk,
     res = fdt_begin_node(fdt, "chosen");
     if (res) return res;
 
-    if (info->cmdline) {
-        res = fdt_property_string(fdt, "bootargs", info->cmdline);
+    if (state->pv_cmdline) {
+        LOG(DEBUG, "/chosen/bootargs = %s", state->pv_cmdline);
+        res = fdt_property_string(fdt, "bootargs", state->pv_cmdline);
         if (res) return res;
     }
 
@@ -831,7 +833,7 @@ next_resize:
         FDT( fdt_begin_node(fdt, "") );
 
         FDT( make_root_properties(gc, vers, fdt) );
-        FDT( make_chosen_node(gc, fdt, !!dom->ramdisk_blob, info) );
+        FDT( make_chosen_node(gc, fdt, !!dom->ramdisk_blob, state, info) );
         FDT( make_cpus_node(gc, fdt, info->max_vcpus, ainfo) );
         FDT( make_psci_node(gc, fdt) );
 
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Ian Campbell

We need to use libxl__domain_build_state.pv_cmdline in order to pickup the correct args when using pygrub. libxl_domain_build_info.cmdline is any args statically configured by the user.

This is consistent with the call to xc_domain_allocate, which takes the cmdline too (in that case for x86/PV usage).

state->pv_cmdline is also set for non-pygrub guests, since libxl_bootloader_run propagates info->cmdline if no bootloader is

libxl__bootloader_run

Quoted 3 lines

condfigured.

Quoted 3 lines

---
For 4.6: This makes pygrub work on ARM.

It's very low risk. Apply as you see fit.

Quoted 40 lines

Should also be backported.

---
 tools/libxl/libxl_arm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tools/libxl/libxl_arm.c +5 -3
index 42ab6d8..a310737 100644
@@ -260,6 +260,7 @@ static int make_root_properties(libxl__gc *gc,
 }
 
 static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk,
+                            libxl__domain_build_state *state,
                             const libxl_domain_build_info *info)
 {
     int res;
@@ -268,8 +269,9 @@ static int make_chosen_node(libxl__gc *gc, void *fdt, bool ramdisk,
     res = fdt_begin_node(fdt, "chosen");
     if (res) return res;
 
-    if (info->cmdline) {
-        res = fdt_property_string(fdt, "bootargs", info->cmdline);
+    if (state->pv_cmdline) {
+        LOG(DEBUG, "/chosen/bootargs = %s", state->pv_cmdline);
+        res = fdt_property_string(fdt, "bootargs", state->pv_cmdline);
         if (res) return res;
     }
 
@@ -831,7 +833,7 @@ next_resize:
         FDT( fdt_begin_node(fdt, "") );
 
         FDT( make_root_properties(gc, vers, fdt) );
-        FDT( make_chosen_node(gc, fdt, !!dom->ramdisk_blob, info) );
+        FDT( make_chosen_node(gc, fdt, !!dom->ramdisk_blob, state, info) );
         FDT( make_cpus_node(gc, fdt, info->max_vcpus, ainfo) );
         FDT( make_psci_node(gc, fdt) );
 
Signature · 1 line
2.1.4
#2 lore raw
Quoted 5 lines · Wei Liu
Quoted 4 lines · Ian Campbell

We need to use libxl__domain_build_state.pv_cmdline in order to pickup the correct args when using pygrub. libxl_domain_build_info.cmdline is any args statically configured by the user.

Quoted 7 lines
Quoted 5 lines

This is consistent with the call to xc_domain_allocate, which takes the cmdline too (in that case for x86/PV usage).

state->pv_cmdline is also set for non-pygrub guests, since libxl_bootloader_run propagates info->cmdline if no bootloader is

libxl__bootloader_run

Fixed.

Quoted 1 line
Quoted 1 line

condfigured.

... and this.

Quoted 4 lines
Quoted 2 lines

Thanks.

Quoted 6 lines
Quoted 4 lines

---
For 4.6: This makes pygrub work on ARM.

It's very low risk. Apply as you see fit.

Done, thanks.