Skip to contentSkip to conversation

ARM: parse separate DT properties for different commandlines

Xen-staging Ian Campbell 3 participants 8 messages Sep 18, 2013 – Oct 7, 2013 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 13 lines · On Tue, 2013-09-17 at 14:48 +0000, [email protected] wrote:

commit a8992d62362e0755d3a1929b059769bc3343135d

Author:     Andre Przywara <[email protected]>
AuthorDate: Fri Sep 13 13:49:34 2013 +0100
Commit:     Ian Campbell <[email protected]>
CommitDate: Tue Sep 17 15:29:18 2013 +0100

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.

Quoted 10 lines

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.

So this doesn't seem to be working like I expected...

I have a "bootargs" which contains my hypervisor bootargs, I have neither xen,xen-bootargs nor xen,dom0-bootargs. dom0 args are in the module bootargs property.

But Xen isn't seeing a command line. Is my configuration wrong or is this supposed to work as it used to? I suppose the missing logic is to take into account whether the dom0 bootargs are in a module?

FYI I'm seeing this on fastmodle with bootwrapper (from my xenbits arm32 branch).

Quoted 11 lines
(quoted diff) +6 -1
@@ -261,7 +261,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);
+    }
#2 lore raw
Quoted 26 lines · Ian Campbell
Quoted 13 lines · On Tue, 2013-09-17 at 14:48 +0000, [email protected] wrote:

commit a8992d62362e0755d3a1929b059769bc3343135d

Author:     Andre Przywara <[email protected]>
AuthorDate: Fri Sep 13 13:49:34 2013 +0100
Commit:     Ian Campbell <[email protected]>
CommitDate: Tue Sep 17 15:29:18 2013 +0100

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.

Quoted 10 lines

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.

Quoted 7 lines

So this doesn't seem to be working like I expected...

I have a "bootargs" which contains my hypervisor bootargs, I have neither xen,xen-bootargs nor xen,dom0-bootargs. dom0 args are in the module bootargs property.

But Xen isn't seeing a command line.

The same experience I had yesterday. Using the explicit xen,xen-bootargs for the time being works, though.
I am not sure if that due to that module node patch of mine, which also uses bootargs, though one level deeper. This may be triggered by one of Julien's DTB patches.

I will look into this this afternoon.

Regards,
Andre.

Quoted 21 lines

Is my configuration wrong or is
this supposed to work as it used to? I suppose the missing logic is to take into account whether the dom0 bootargs are in a module?

FYI I'm seeing this on fastmodle with bootwrapper (from my xenbits arm32 branch).

Quoted 11 lines
(quoted diff) +6 -1
@@ -261,7 +261,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);
+    }
#3 lore raw
Quoted 5 lines · Andre Przywara
Quoted 5 lines
Quoted 5 lines
(quoted diff) +0 -0
@@ -261,7 +261,12 @@ const char *device_tree_bootargs(const void *fdt)
      if ( node < 0 )
          return NULL;
 
Quoted 7 lines
Quoted 7 lines

Review const char *device_tree_bootargs(const void *fdt) · line 269

Quoted 7 lines
(quoted diff) +6 -1
-    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);
+    }

The logic seems wrong here, we returns bootargs only if the property "xen,dom0-bootargs" exists. We should also check if the user give the dom0 command line via the multiboot module.

Signature · 2 lines
Julien Grall
Sent from my phone

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

#4 lore raw
Quoted 14 lines · Julien Grall
Quoted 2 lines · Andre Przywara
Quoted 2 lines

Review const char *device_tree_bootargs(const void

Quoted 2 lines
(quoted diff) +0 -0
@@ -261,7 +261,12 @@ const char *device_tree_bootargs(const void

*fdt)

Quoted 8 lines
Quoted 8 lines

Review const char *device_tree_bootargs(const void · line 267

Quoted 8 lines
(quoted diff) +4 -1
      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",
Quoted 8 lines

NULL))

Quoted 2 lines
Quoted 2 lines

Review const char *device_tree_bootargs(const void · line 269

Quoted 2 lines
(quoted diff) +2 -0
+            prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    }

The logic seems wrong here, we returns bootargs only if the property "xen,dom0-bootargs" exists. We should also check if the user give the dom0
command line via the multiboot module.

Anyone investigating this? I've just been using the following, which is obviously bogus!

commit ae37a08fa4776ba8ca3bd5554d7c042e8502fa95

Author: Ian Campbell <[email protected]>
Date:   Fri Sep 20 23:45:34 2013 +0100

HACK: bootargs fixup

xen/common/device_tree.c +1 -1
index 27ee708..d66e392 100644
@@ -252,7 +252,7 @@ const char *device_tree_bootargs(const void *fdt)
     prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
     if ( prop == NULL )
     {
-        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL))
+        //if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL))
             prop = fdt_get_property(fdt, node, "bootargs", NULL);
     }
     if ( prop == NULL )
#5 lore raw
Quoted 19 lines · Ian Campbell
Quoted 18 lines · Julien Grall
Quoted 2 lines · Andre Przywara
Quoted 2 lines

Review const char *device_tree_bootargs(const void

Quoted 2 lines
(quoted diff) +0 -0
@@ -261,7 +261,12 @@ const char *device_tree_bootargs(const void

*fdt)

Quoted 8 lines
Quoted 8 lines

Review const char *device_tree_bootargs(const void · line 267

Quoted 8 lines
(quoted diff) +4 -1
      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))

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2 -0
+            prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    }
Quoted 7 lines
Quoted 4 lines

The logic seems wrong here, we returns bootargs only if the property "xen,dom0-bootargs" exists. We should also check if the user give the dom0
command line via the multiboot module.

Anyone investigating this? I've just been using the following, which is obviously bogus!

How about this:
8<------------------------------------

Quoted 1 line

From a158dee49bb59e76c0f9103f512bb4bf9489f770 Mon Sep 17 00:00:00 2001

From: Ian Campbell <[email protected]>
Date: Fri, 20 Sep 2013 23:45:34 +0100
Subject: [PATCH] xen: arm: fix usage of bootargs for Xen.

The chosen node's bootargs property should be used for Xen if there is a dom0 kernel multiboot module with a command line, not just if xen,dom0-bootargs is present.

---
 xen/common/device_tree.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
xen/common/device_tree.c +8 -2
index 27ee708..fe25508 100644
@@ -242,7 +242,7 @@ static int __init device_tree_for_each_node(const void *fdt,
  */
 const char *device_tree_bootargs(const void *fdt)
 {
-    int node; 
+    int node;
     const struct fdt_property *prop;
 
     node = fdt_path_offset(fdt, "/chosen");
@@ -252,7 +252,13 @@ const char *device_tree_bootargs(const void *fdt)
     prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
     if ( prop == NULL )
     {
-        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL))
+        struct dt_mb_module *dom0_mod = NULL;
+
+        if ( early_info.modules.nr_mods >= MOD_KERNEL )
+            dom0_mod = &early_info.modules.module[MOD_KERNEL];
+
+        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
+            ( dom0_mod && dom0_mod->cmdline[0] ) )
             prop = fdt_get_property(fdt, node, "bootargs", NULL);
     }
     if ( prop == NULL )
Signature · 1 line
1.7.10.4
#6 lore raw
Quoted 36 lines · Ian Campbell
Quoted 19 lines · Ian Campbell
Quoted 18 lines · Julien Grall
Quoted 2 lines · Andre Przywara
Quoted 2 lines

Review const char *device_tree_bootargs(const void

Quoted 2 lines
(quoted diff) +0 -0
@@ -261,7 +261,12 @@ const char *device_tree_bootargs(const void

*fdt)

Quoted 8 lines
Quoted 8 lines

Review const char *device_tree_bootargs(const void · line 267

Quoted 8 lines
(quoted diff) +4 -1
      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))

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2 -0
+            prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    }
Quoted 7 lines
Quoted 4 lines

The logic seems wrong here, we returns bootargs only if the property "xen,dom0-bootargs" exists. We should also check if the user give the dom0
command line via the multiboot module.

Anyone investigating this? I've just been using the following, which is obviously bogus!

How about this:
8<------------------------------------

From a158dee49bb59e76c0f9103f512bb4bf9489f770 Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Fri, 20 Sep 2013 23:45:34 +0100
Subject: [PATCH] xen: arm: fix usage of bootargs for Xen.

Quoted 5 lines

The chosen node's bootargs property should be used for Xen if there is a dom0 kernel multiboot module with a command line, not just if xen,dom0-bootargs is present.

From docs/misc/arm/device-tree/booting.txt:

If no Xen specific properties are present, bootargs is for Dom0.

The current behaviour seems logic. Can you update the documentation?

Quoted 34 lines
---
 xen/common/device_tree.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
xen/common/device_tree.c +8 -2
index 27ee708..fe25508 100644
@@ -242,7 +242,7 @@ static int __init device_tree_for_each_node(const void *fdt,
  */
 const char *device_tree_bootargs(const void *fdt)
 {
-    int node; 
+    int node;
     const struct fdt_property *prop;
 
     node = fdt_path_offset(fdt, "/chosen");
@@ -252,7 +252,13 @@ const char *device_tree_bootargs(const void *fdt)
     prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
     if ( prop == NULL )
     {
-        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL))
+        struct dt_mb_module *dom0_mod = NULL;
+
+        if ( early_info.modules.nr_mods >= MOD_KERNEL )
+            dom0_mod = &early_info.modules.module[MOD_KERNEL];
+
+        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
+            ( dom0_mod && dom0_mod->cmdline[0] ) )
             prop = fdt_get_property(fdt, node, "bootargs", NULL);
     }
     if ( prop == NULL )
Signature · 1 line
Julien Grall
#7 lore raw
Quoted 37 lines · Julien Grall
Quoted 36 lines · Ian Campbell
Quoted 19 lines · Ian Campbell
Quoted 18 lines · Julien Grall
Quoted 2 lines · Andre Przywara
Quoted 2 lines

Review const char *device_tree_bootargs(const void

Quoted 2 lines
(quoted diff) +0 -0
@@ -261,7 +261,12 @@ const char *device_tree_bootargs(const void

*fdt)

Quoted 8 lines
Quoted 8 lines

Review const char *device_tree_bootargs(const void · line 267

Quoted 8 lines
(quoted diff) +4 -1
      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))

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2 -0
+            prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    }
Quoted 7 lines
Quoted 4 lines

The logic seems wrong here, we returns bootargs only if the property "xen,dom0-bootargs" exists. We should also check if the user give the dom0
command line via the multiboot module.

Anyone investigating this? I've just been using the following, which is obviously bogus!

How about this:
8<------------------------------------

From a158dee49bb59e76c0f9103f512bb4bf9489f770 Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Fri, 20 Sep 2013 23:45:34 +0100
Subject: [PATCH] xen: arm: fix usage of bootargs for Xen.

Quoted 8 lines
Quoted 3 lines

The chosen node's bootargs property should be used for Xen if there is a dom0 kernel multiboot module with a command line, not just if xen,dom0-bootargs is present.

From docs/misc/arm/device-tree/booting.txt:
If no Xen specific properties are present, bootargs is for Dom0.

The current behaviour seems logic. Can you update the documentation?

You mean the patch is good but the docs need updating? Sure.

Quoted 37 lines
Quoted 35 lines
---
 xen/common/device_tree.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
xen/common/device_tree.c +8 -2
index 27ee708..fe25508 100644
@@ -242,7 +242,7 @@ static int __init device_tree_for_each_node(const void *fdt,
  */
 const char *device_tree_bootargs(const void *fdt)
 {
-    int node; 
+    int node;
     const struct fdt_property *prop;
 
     node = fdt_path_offset(fdt, "/chosen");
@@ -252,7 +252,13 @@ const char *device_tree_bootargs(const void *fdt)
     prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
     if ( prop == NULL )
     {
-        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL))
+        struct dt_mb_module *dom0_mod = NULL;
+
+        if ( early_info.modules.nr_mods >= MOD_KERNEL )
+            dom0_mod = &early_info.modules.module[MOD_KERNEL];
+
+        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
+            ( dom0_mod && dom0_mod->cmdline[0] ) )
             prop = fdt_get_property(fdt, node, "bootargs", NULL);
     }
     if ( prop == NULL )
#8 lore raw
Quoted 42 lines · Ian Campbell
Quoted 41 lines · Julien Grall
Quoted 39 lines · Ian Campbell
Quoted 19 lines · Ian Campbell
Quoted 18 lines · Julien Grall
Quoted 2 lines · Andre Przywara
Quoted 2 lines

Review const char *device_tree_bootargs(const void

Quoted 2 lines
(quoted diff) +0 -0
@@ -261,7 +261,12 @@ const char *device_tree_bootargs(const void

*fdt)

Quoted 8 lines
Quoted 8 lines

Review const char *device_tree_bootargs(const void · line 267

Quoted 8 lines
(quoted diff) +4 -1
      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))

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2 -0
+            prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    }
Quoted 7 lines
Quoted 4 lines

The logic seems wrong here, we returns bootargs only if the property "xen,dom0-bootargs" exists. We should also check if the user give the dom0
command line via the multiboot module.

Anyone investigating this? I've just been using the following, which is obviously bogus!

How about this:
8<------------------------------------

From a158dee49bb59e76c0f9103f512bb4bf9489f770 Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Fri, 20 Sep 2013 23:45:34 +0100
Subject: [PATCH] xen: arm: fix usage of bootargs for Xen.

The chosen node's bootargs property should be used for Xen if there is a dom0 kernel multiboot module with a command line, not just if xen,dom0-bootargs is present.

Quoted 6 lines
Quoted 4 lines

From docs/misc/arm/device-tree/booting.txt:
If no Xen specific properties are present, bootargs is for Dom0.

The current behaviour seems logic. Can you update the documentation?

You mean the patch is good but the docs need updating? Sure.

Yes.

Signature · 1 line
Julien Grall