Skip to contentSkip to conversation

ARM: parse separate DT properties for different commandlines

PATCH In review Andre Przywara 5 participants 9 messages Jun 3, 2013 – Aug 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: parse separate DT properties for different commandlines

Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader.
I also have a simple patch for u-boot to transfer the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property.
I will post the u-boot patch to their ML later.

Changes from v1:
- fix whitespace issues

---
 xen/arch/arm/domain_build.c | 13 ++++++++++---
 xen/common/device_tree.c    |  7 ++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +10 -3
index b92c64b..5809489 100644
@@ -139,6 +139,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
                             u32 address_cells, u32 size_cells)
 {
     const char *bootargs = NULL;
+    int had_dom0_bootargs = 0;
     int prop;
 
     if ( early_info.modules.nr_mods >= 1 &&
@@ -169,11 +170,17 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
          */
         if ( device_tree_node_matches(fdt, node, "chosen") )
         {
-            if ( strcmp(prop_name, "bootargs") == 0 )
+            if ( strcmp(prop_name, "xen,xen-bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
+            {
+                had_dom0_bootargs = 1;
+                bootargs = prop_data;
                 continue;
-            else if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
+            }
+            if ( strcmp(prop_name, "bootargs") == 0 )
             {
-                if ( !bootargs )
+                if ( !bootargs  && !had_dom0_bootargs )
                     bootargs = prop_data;
                 continue;
             }
xen/common/device_tree.c +6 -1
index 84d704d..e22bd22 100644
@@ -325,7 +325,12 @@ const char *device_tree_bootargs(const void *fdt)
     if ( node < 0 )
         return NULL;
 
-    prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
+    if ( prop == NULL )
+    {
+        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL))
+            prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    }
     if ( prop == NULL )
         return NULL;
 
Signature · 1 line
1.7.12.1
#1 lore raw
Quoted 8 lines · Andre Przywara

Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained:

Quoted 7 lines

- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.

Could you add this logic in misc/arm/device-tree/booting.txt?

Quoted 31 lines

The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader.
I also have a simple patch for u-boot to transfer the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property.
I will post the u-boot patch to their ML later.

Changes from v1:
- fix whitespace issues

---
 xen/arch/arm/domain_build.c | 13 ++++++++++---
 xen/common/device_tree.c    |  7 ++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +1 -0
index b92c64b..5809489 100644
@@ -139,6 +139,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
                             u32 address_cells, u32 size_cells)
 {
     const char *bootargs = NULL;
+    int had_dom0_bootargs = 0;
     int prop;
 
     if ( early_info.modules.nr_mods >= 1 &&

xen/arch/arm/domain_build.c static int write_properties(struct domain *d, struct kernel_info *kinfo, · line 174

Quoted 6 lines
xen/arch/arm/domain_build.c +2 -1
@@ -169,11 +170,17 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
          */
         if ( device_tree_node_matches(fdt, node, "chosen") )
         {
-            if ( strcmp(prop_name, "bootargs") == 0 )
+            if ( strcmp(prop_name, "xen,xen-bootargs") == 0 )
+                continue;

Could you complete the above comment to specify we are removing xen,xen-bootargs?

Thanks,

Julien

#2 lore raw
In reply to Andre Przywara
Quoted 24 lines · Andre Przywara

Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader.
I also have a simple patch for u-boot to transfer the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property.
I will post the u-boot patch to their ML later.

Quoted 2 lines

Changes from v1:
- fix whitespace issues

Any news about this patch ? :)

Quoted 19 lines
---
 xen/arch/arm/domain_build.c | 13 ++++++++++---
 xen/common/device_tree.c    |  7 ++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +1 -0
index b92c64b..5809489 100644
@@ -139,6 +139,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
                             u32 address_cells, u32 size_cells)
 {
     const char *bootargs = NULL;
+    int had_dom0_bootargs = 0;
     int prop;
 
     if ( early_info.modules.nr_mods >= 1 &&

xen/arch/arm/domain_build.c static int write_properties(struct domain *d, struct kernel_info *kinfo, · line 178

Quoted 10 lines
xen/arch/arm/domain_build.c +6 -1
@@ -169,11 +170,17 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
          */
         if ( device_tree_node_matches(fdt, node, "chosen") )
         {
-            if ( strcmp(prop_name, "bootargs") == 0 )
+            if ( strcmp(prop_name, "xen,xen-bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
+            {
+                had_dom0_bootargs = 1;
+                bootargs = prop_data;

Here, you overwrite the previous "bootargs". This variable is set if the module node contains "bootargs" property
(see process_multiboot_node in common/device_tree.c)

Could you either:
1) Remove the possibility to set the command line via the custom multiboot
2) Check if "bootargs" was not set

I think nobody uses the custom multiboot with the command line. So the first solution seems to be the best.

--
Julien Grall

#3 lore raw
Quoted 25 lines · Julien Grall
Quoted 24 lines · Andre Przywara

Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader.
I also have a simple patch for u-boot to transfer the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property.
I will post the u-boot patch to their ML later.

Quoted 4 lines
Quoted 2 lines

Changes from v1:
- fix whitespace issues

Any news about this patch ? :)

Sorry for the lag ;-)

Quoted 18 lines
Quoted 18 lines
---
  xen/arch/arm/domain_build.c | 13 ++++++++++---
  xen/common/device_tree.c    |  7 ++++++-
  2 files changed, 16 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +1 -0
index b92c64b..5809489 100644
@@ -139,6 +139,7 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
                              u32 address_cells, u32 size_cells)
  {
      const char *bootargs = NULL;
+    int had_dom0_bootargs = 0;
      int prop;
 
Quoted 16 lines

xen/arch/arm/domain_build.c static int write_properties(struct domain *d, struct kernel_info *kinfo, · line 178

Quoted 12 lines
xen/arch/arm/domain_build.c +6 -1
      if ( early_info.modules.nr_mods >= 1 &&
@@ -169,11 +170,17 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
           */
          if ( device_tree_node_matches(fdt, node, "chosen") )
          {
-            if ( strcmp(prop_name, "bootargs") == 0 )
+            if ( strcmp(prop_name, "xen,xen-bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
+            {
+                had_dom0_bootargs = 1;
+                bootargs = prop_data;

Here, you overwrite the previous "bootargs". This variable is set if the module node contains "bootargs" property
(see process_multiboot_node in common/device_tree.c)

I'd say that is intended. I think those command lines directly under /chosen should have the highest priority. If someone has /chosen/xen,dom0-bootargs, that should be used instead of a most likely hard-coded value under modules.

I have incorporated your previous comments and will send out a new version ASAP.

Regards,
Andre.

Quoted 16 lines

Could you either:
1) Remove the possibility to set the command line via the custom multiboot
2) Check if "bootargs" was not set

I think nobody uses the custom multiboot with the command line. So the first solution seems to be the best.

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 77 lines · Andre Przywara
Quoted 27 lines · Julien Grall
Quoted 25 lines · Andre Przywara

Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader.
I also have a simple patch for u-boot to transfer the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property.
I will post the u-boot patch to their ML later.

Quoted 5 lines
Quoted 2 lines

Changes from v1:
- fix whitespace issues

Any news about this patch ? :)

Sorry for the lag ;-)

Quoted 29 lines
Quoted 29 lines
---
  xen/arch/arm/domain_build.c | 13 ++++++++++---
  xen/common/device_tree.c    |  7 ++++++-
  2 files changed, 16 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +1 -0
index b92c64b..5809489 100644
@@ -139,6 +139,7 @@ static int write_properties(struct domain *d, struct
 kernel_info *kinfo,
                              u32 address_cells, u32 size_cells)
  {
      const char *bootargs = NULL;
+    int had_dom0_bootargs = 0;
      int prop;
 
      if ( early_info.modules.nr_mods >= 1 &&
xen/arch/arm/domain_build.c +3 -1
@@ -169,11 +170,17 @@ static int write_properties(struct domain *d,
 struct kernel_info *kinfo,
           */
          if ( device_tree_node_matches(fdt, node, "chosen") )
          {
-            if ( strcmp(prop_name, "bootargs") == 0 )
+            if ( strcmp(prop_name, "xen,xen-bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
Quoted 8 lines

xen/arch/arm/domain_build.c static int write_properties(struct domain *d, struct kernel_info *kinfo, · line 178

Quoted 3 lines
xen/arch/arm/domain_build.c +3 -0
+            {
+                had_dom0_bootargs = 1;
+                bootargs = prop_data;

Here, you overwrite the previous "bootargs". This variable is set if the module node contains "bootargs" property
(see process_multiboot_node in common/device_tree.c)

Quoted 4 lines

I'd say that is intended. I think those command lines directly under /chosen should have the highest priority. If someone has /chosen/xen,dom0-bootargs, that should be used instead of a most likely hard-coded value under modules.

I don't think people use bootargs in module. So we can get a rid of this code. Ian, what do you think?

Cheers,

Signature · 1 line
Julien Grall
#5 lore raw
Quoted 78 lines · Julien Grall
Quoted 77 lines · Andre Przywara
Quoted 27 lines · Julien Grall
Quoted 25 lines · Andre Przywara

Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader.
I also have a simple patch for u-boot to transfer the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property.
I will post the u-boot patch to their ML later.

Quoted 5 lines
Quoted 2 lines

Changes from v1:
- fix whitespace issues

Any news about this patch ? :)

Sorry for the lag ;-)

Quoted 37 lines
Quoted 22 lines
---
  xen/arch/arm/domain_build.c | 13 ++++++++++---
  xen/common/device_tree.c    |  7 ++++++-
  2 files changed, 16 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +1 -0
index b92c64b..5809489 100644
@@ -139,6 +139,7 @@ static int write_properties(struct domain *d, struct
 kernel_info *kinfo,
                              u32 address_cells, u32 size_cells)
  {
      const char *bootargs = NULL;
+    int had_dom0_bootargs = 0;
      int prop;
 
      if ( early_info.modules.nr_mods >= 1 &&
xen/arch/arm/domain_build.c +0 -0
@@ -169,11 +170,17 @@ static int write_properties(struct domain *d,
 struct kernel_info *kinfo,

xen/arch/arm/domain_build.c static int write_properties(struct domain *d, · line 179

Quoted 10 lines
xen/arch/arm/domain_build.c +6 -1
           */
          if ( device_tree_node_matches(fdt, node, "chosen") )
          {
-            if ( strcmp(prop_name, "bootargs") == 0 )
+            if ( strcmp(prop_name, "xen,xen-bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
+            {
+                had_dom0_bootargs = 1;
+                bootargs = prop_data;

Here, you overwrite the previous "bootargs". This variable is set if the module node contains "bootargs" property
(see process_multiboot_node in common/device_tree.c)

Quoted 6 lines
Quoted 4 lines

I'd say that is intended. I think those command lines directly under /chosen should have the highest priority. If someone has /chosen/xen,dom0-bootargs, that should be used instead of a most likely hard-coded value under modules.

I don't think people use bootargs in module.

They are documented as existing in docs/misc/arm/device-tree/booting.txt, so something would need to change in either the code or the docs I think.

I don't think I mind which options take precedence so long as it is clearly documented what is what. Although there is something nice about having the stuff under modules be a complete consistent set of address +cmdline I guess.

Ian.

Quoted 5 lines

So we can get a rid of this code.
Ian, what do you think?

Cheers,

#6 lore raw
Quoted 84 lines · Ian Campbell
Quoted 83 lines · Julien Grall
Quoted 81 lines · Andre Przywara
Quoted 27 lines · Julien Grall
Quoted 25 lines · Andre Przywara

Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader.
I also have a simple patch for u-boot to transfer the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property.
I will post the u-boot patch to their ML later.

Quoted 5 lines
Quoted 2 lines

Changes from v1:
- fix whitespace issues

Any news about this patch ? :)

Sorry for the lag ;-)

Quoted 29 lines
Quoted 29 lines
---
  xen/arch/arm/domain_build.c | 13 ++++++++++---
  xen/common/device_tree.c    |  7 ++++++-
  2 files changed, 16 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +1 -0
index b92c64b..5809489 100644
@@ -139,6 +139,7 @@ static int write_properties(struct domain *d, struct
 kernel_info *kinfo,
                              u32 address_cells, u32 size_cells)
  {
      const char *bootargs = NULL;
+    int had_dom0_bootargs = 0;
      int prop;
 
      if ( early_info.modules.nr_mods >= 1 &&
xen/arch/arm/domain_build.c +3 -1
@@ -169,11 +170,17 @@ static int write_properties(struct domain *d,
 struct kernel_info *kinfo,
           */
          if ( device_tree_node_matches(fdt, node, "chosen") )
          {
-            if ( strcmp(prop_name, "bootargs") == 0 )
+            if ( strcmp(prop_name, "xen,xen-bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
Quoted 8 lines

xen/arch/arm/domain_build.c static int write_properties(struct domain *d, struct kernel_info *kinfo, · line 178

Quoted 3 lines
xen/arch/arm/domain_build.c +3 -0
+            {
+                had_dom0_bootargs = 1;
+                bootargs = prop_data;

Here, you overwrite the previous "bootargs". This variable is set if the module node contains "bootargs" property
(see process_multiboot_node in common/device_tree.c)

I'd say that is intended. I think those command lines directly under /chosen should have the highest priority. If someone has /chosen/xen,dom0-bootargs, that should be used instead of a most likely hard-coded value under modules.

Quoted 5 lines
Quoted 1 line

I don't think people use bootargs in module.

They are documented as existing in docs/misc/arm/device-tree/booting.txt, so something would need to change in either the code or the docs I think.

The wiki page only mentions xen,dom0-bootargs solution :).

BTW, Andre, can you document this patch at least in docs/misc/arm?

Quoted 4 lines

I don't think I mind which options take precedence so long as it is clearly documented what is what. Although there is something nice about having the stuff under modules be a complete consistent set of address +cmdline I guess.

If we plan to use multiboot in the next few months, it's not a good idea to keep 2 ways
(in fact even 3 now) to set Linux command line.

I guess people mostly follow the wiki page, so they don't you the module@0/bootargs
solution.

Signature · 1 line
Julien Grall
#7 lore raw
Quoted 85 lines · Julien Grall
Quoted 84 lines · Ian Campbell
Quoted 83 lines · Julien Grall
Quoted 81 lines · Andre Przywara
Quoted 27 lines · Julien Grall
Quoted 25 lines · Andre Przywara

Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader.
I also have a simple patch for u-boot to transfer the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property.
I will post the u-boot patch to their ML later.

Quoted 5 lines
Quoted 2 lines

Changes from v1:
- fix whitespace issues

Any news about this patch ? :)

Sorry for the lag ;-)

Quoted 29 lines
Quoted 29 lines
---
  xen/arch/arm/domain_build.c | 13 ++++++++++---
  xen/common/device_tree.c    |  7 ++++++-
  2 files changed, 16 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +1 -0
index b92c64b..5809489 100644
@@ -139,6 +139,7 @@ static int write_properties(struct domain *d, struct
 kernel_info *kinfo,
                              u32 address_cells, u32 size_cells)
  {
      const char *bootargs = NULL;
+    int had_dom0_bootargs = 0;
      int prop;
 
      if ( early_info.modules.nr_mods >= 1 &&
xen/arch/arm/domain_build.c +3 -1
@@ -169,11 +170,17 @@ static int write_properties(struct domain *d,
 struct kernel_info *kinfo,
           */
          if ( device_tree_node_matches(fdt, node, "chosen") )
          {
-            if ( strcmp(prop_name, "bootargs") == 0 )
+            if ( strcmp(prop_name, "xen,xen-bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
Quoted 8 lines

xen/arch/arm/domain_build.c static int write_properties(struct domain *d, struct kernel_info *kinfo, · line 178

Quoted 3 lines
xen/arch/arm/domain_build.c +3 -0
+            {
+                had_dom0_bootargs = 1;
+                bootargs = prop_data;

Here, you overwrite the previous "bootargs". This variable is set if the module node contains "bootargs" property
(see process_multiboot_node in common/device_tree.c)

I'd say that is intended. I think those command lines directly under /chosen should have the highest priority. If someone has /chosen/xen,dom0-bootargs, that should be used instead of a most likely hard-coded value under modules.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I don't think people use bootargs in module.

They are documented as existing in docs/misc/arm/device-tree/booting.txt, so something would need to change in either the code or the docs I think.

The wiki page only mentions xen,dom0-bootargs solution :).

Do the wiki pages use the /modules stuff at all? If not then would not expect they would use /module/N/bootargs either.

Quoted 1 line

BTW, Andre, can you document this patch at least in docs/misc/arm?

I think this is a must. In fact IIRC this was the main reason the patch wasn't just applied.

Ian.

#8 lore raw
Quoted 88 lines · Ian Campbell
Quoted 87 lines · Julien Grall
Quoted 86 lines · Ian Campbell
Quoted 84 lines · Julien Grall
Quoted 77 lines · Andre Przywara
Quoted 27 lines · Julien Grall
Quoted 25 lines · Andre Przywara

Currently we use the chosen/bootargs property as the Xen commandline and rely on xen,dom0-bootargs for Dom0. However this brings issues with bootloaders, which usually build bootargs by bootscripts for a Linux kernel - and not for the entirely different Xen hypervisor. Introduce a new possible device tree property "xen,xen-bootargs" explicitly for the Xen hypervisor and make the selection of which to use more fine grained:
- If xen,xen-bootargs is present, it will be used for Xen.
- If xen,dom0-bootargs is present, it will be used for Dom0.
- If xen,xen-bootargs is _not_ present, but xen,dom0-bootargs is, bootargs will be used for Xen. Like the current situation.
- If no Xen specific properties are present, bootargs is for Dom0.
- If xen,xen-bootargs is present, but xen,dom0-bootargs is missing, bootargs will be used for Dom0.

The aim is to allow common bootscripts to boot both Xen and native Linux with the same device tree blob. If needed, one could hard-code the Xen commandline into the DTB, leaving bootargs for Dom0 to be set by the (non Xen-aware) bootloader.
I also have a simple patch for u-boot to transfer the content of the "xen_bootargs" environment variable into the xen,xen-bootargs dtb property.
I will post the u-boot patch to their ML later.

Quoted 5 lines
Quoted 2 lines

Changes from v1:
- fix whitespace issues

Any news about this patch ? :)

Sorry for the lag ;-)

Quoted 29 lines
Quoted 29 lines
---
  xen/arch/arm/domain_build.c | 13 ++++++++++---
  xen/common/device_tree.c    |  7 ++++++-
  2 files changed, 16 insertions(+), 4 deletions(-)
xen/arch/arm/domain_build.c +1 -0
index b92c64b..5809489 100644
@@ -139,6 +139,7 @@ static int write_properties(struct domain *d, struct
 kernel_info *kinfo,
                              u32 address_cells, u32 size_cells)
  {
      const char *bootargs = NULL;
+    int had_dom0_bootargs = 0;
      int prop;
 
      if ( early_info.modules.nr_mods >= 1 &&
xen/arch/arm/domain_build.c +3 -1
@@ -169,11 +170,17 @@ static int write_properties(struct domain *d,
 struct kernel_info *kinfo,
           */
          if ( device_tree_node_matches(fdt, node, "chosen") )
          {
-            if ( strcmp(prop_name, "bootargs") == 0 )
+            if ( strcmp(prop_name, "xen,xen-bootargs") == 0 )
+                continue;
+            if ( strcmp(prop_name, "xen,dom0-bootargs") == 0 )
Quoted 8 lines

xen/arch/arm/domain_build.c static int write_properties(struct domain *d, · line 179

Quoted 3 lines
xen/arch/arm/domain_build.c +3 -0
+            {
+                had_dom0_bootargs = 1;
+                bootargs = prop_data;

Here, you overwrite the previous "bootargs". This variable is set if the module node contains "bootargs" property
(see process_multiboot_node in common/device_tree.c)

Quoted 4 lines

I'd say that is intended. I think those command lines directly under /chosen should have the highest priority. If someone has /chosen/xen,dom0-bootargs, that should be used instead of a most likely hard-coded value under modules.

I don't think people use bootargs in module.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

They are documented as existing in docs/misc/arm/device-tree/booting.txt, so something would need to change in either the code or the docs I think.

The wiki page only mentions xen,dom0-bootargs solution :).

Do the wiki pages use the /modules stuff at all? If not then would not expect they would use /module/N/bootargs either.

Nothing. The versatile express loads the Linux Image from the an hardcoded address in the flash.

The arndale board uses /modules/... but it already set up in the provided device tree.

That's why I think we can remove module@0/bootargs.

Quoted 4 lines
Quoted 1 line

BTW, Andre, can you document this patch at least in docs/misc/arm?

I think this is a must. In fact IIRC this was the main reason the patch wasn't just applied.

Indeed. I forgot that I have already asked few mails before :).

Signature · 1 line
Julien Grall