Skip to contentSkip to conversation

arm64,xen: add xen_boot support into grup-mkconfig

PATCH Superseded [email protected] 4 participants 12 messages Jul 26, 2016 – Nov 3, 2016

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v6 cover arm64,xen: add xen_boot support into grup-mkconfig

From: Fu Wei <[email protected]>

This patchset add xen_boot support into grup-mkconfig for generating xen boot entrances automatically

Also update the docs/grub.texi for new xen_boot commands.

This patchset has been tested on Foudation model with a bug fix:
http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00205.html

ChangeLog:
v6: http://lists.gnu.org/archive/html/grub-devel/2016-07/
Fix Coding style of util/grub.d/20_linux_xen.in, use soft tab.

v5: http://lists.gnu.org/archive/html/grub-devel/2016-07/msg00008.html
Update the introduction of xen_module commands in docs/grub.texi, according to the suggestion from Julien Grall

v4: http://lists.gnu.org/archive/html/grub-devel/2016-05/
according to the XSM loading mechanism of Xen(upstreamed), update the introduction of xen_module commands in docs/grub.texi

v3: http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00314.html
reorder the patches
update the introduction of xen_module commands in docs/grub.texi

v2: http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00282.html
add "--nounzip" option support in xen_module
use "feature_xen_boot" instead of "grub_xen_boot" update the introduction of xen boot commands in docs/grub.texi

v1 :first upstream patchset:

    http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00264.html

Fu Wei (4):
i386,xen: Add xen_hypervisor and xen_module aliases for i386
arm64: add "--nounzip" option support in xen_module command
* util/grub.d/20_linux_xen.in: Add xen_boot command support
arm64: update the introduction of xen boot commands in docs/grub.texi

 docs/grub.texi                    | 32 +++++++++-----------------------
 grub-core/loader/arm64/xen_boot.c | 17 +++++++++++++++++
 grub-core/loader/i386/xen.c       |  7 +++++++
 grub-core/normal/main.c           |  2 +-
 util/grub.d/20_linux_xen.in       | 13 ++++++++++---
 5 files changed, 44 insertions(+), 27 deletions(-)
Signature · 1 line
2.5.5
#1 lore raw

PATCH v6 1/4 i386, xen: Add xen_hypervisor and xen_module aliases for i386

From: Fu Wei <[email protected]>

---
 grub-core/loader/i386/xen.c | 7 +++++++
 1 file changed, 7 insertions(+)
grub-core/loader/i386/xen.c +7 -0
index c4d9689..15b0727 100644
@@ -689,6 +689,7 @@ fail:
 }
 
 static grub_command_t cmd_xen, cmd_initrd, cmd_module, cmd_multiboot;
+static grub_command_t cmd_xen_hypervisor, cmd_xen_module;
 
 GRUB_MOD_INIT (xen)
 {
@@ -696,10 +697,14 @@ GRUB_MOD_INIT (xen)
 				   0, N_("Load Linux."));
   cmd_multiboot = grub_register_command ("multiboot", grub_cmd_xen,
 					 0, N_("Load Linux."));
+  cmd_xen_hypervisor = grub_register_command ("xen_hypervisor", grub_cmd_xen,
+					      0, N_("Load Linux."));
   cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
 				      0, N_("Load initrd."));
   cmd_module = grub_register_command ("module", grub_cmd_module,
 				      0, N_("Load module."));
+  cmd_xen_module = grub_register_command ("xen_module", grub_cmd_module,
+				      0, N_("Load module."));
   my_mod = mod;
 }
 
@@ -709,4 +714,6 @@ GRUB_MOD_FINI (xen)
   grub_unregister_command (cmd_initrd);
   grub_unregister_command (cmd_multiboot);
   grub_unregister_command (cmd_module);
+  grub_unregister_command (cmd_xen_module);
+  grub_unregister_command (cmd_xen_hypervisor);
 }
Signature · 1 line
2.5.5
#2 lore raw

Re: [PATCH v6 1/4] i386, xen: Add xen_hypervisor and xen_module aliases for i386

Quoted 35 lines · On Tue, Jul 26, 2016 at 05:13:40PM +0800, [email protected] wrote:

From: Fu Wei <[email protected]>

---
 grub-core/loader/i386/xen.c | 7 +++++++
 1 file changed, 7 insertions(+)
grub-core/loader/i386/xen.c +5 -0
index c4d9689..15b0727 100644
@@ -689,6 +689,7 @@ fail:
 }
 
 static grub_command_t cmd_xen, cmd_initrd, cmd_module, cmd_multiboot;
+static grub_command_t cmd_xen_hypervisor, cmd_xen_module;
 
 GRUB_MOD_INIT (xen)
 {
@@ -696,10 +697,14 @@ GRUB_MOD_INIT (xen)
 				   0, N_("Load Linux."));
   cmd_multiboot = grub_register_command ("multiboot", grub_cmd_xen,
 					 0, N_("Load Linux."));
+  cmd_xen_hypervisor = grub_register_command ("xen_hypervisor", grub_cmd_xen,
+					      0, N_("Load Linux."));
   cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
 				      0, N_("Load initrd."));
   cmd_module = grub_register_command ("module", grub_cmd_module,
 				      0, N_("Load module."));
+  cmd_xen_module = grub_register_command ("xen_module", grub_cmd_module,
+				      0, N_("Load module."));
   my_mod = mod;
 }
 

grub-core/loader/i386/xen.c GRUB_MOD_FINI (xen) · line 718

Quoted 5 lines
grub-core/loader/i386/xen.c +2 -0
@@ -709,4 +714,6 @@ GRUB_MOD_FINI (xen)
   grub_unregister_command (cmd_initrd);
   grub_unregister_command (cmd_multiboot);
   grub_unregister_command (cmd_module);
+  grub_unregister_command (cmd_xen_module);
+  grub_unregister_command (cmd_xen_hypervisor);

Hmmm... This whole patch does not make sense for me. Why are you adding aliases for ARM Xen hypervisor et consortes load commands (AIUI) in i386 PV guest loader?

Daniel

#3 lore raw

PATCH v6 2/4 arm64: add "--nounzip" option support in xen_module command

In reply to [email protected]

From: Fu Wei <[email protected]>

This patch adds "--nounzip" option support in order to be compatible with the module command of i386, then we can simplify grub-mkconfig support code.

---
 grub-core/loader/arm64/xen_boot.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
grub-core/loader/arm64/xen_boot.c +17 -0
index a914eb8..0878364 100644
@@ -20,6 +20,7 @@
 #include <grub/charset.h>
 #include <grub/command.h>
 #include <grub/err.h>
+#include <grub/env.h>
 #include <grub/file.h>
 #include <grub/fdt.h>
 #include <grub/list.h>
@@ -379,6 +380,20 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)),
 
   struct xen_boot_binary *module = NULL;
   grub_file_t file = 0;
+  int nounzip = 0;
+
+  if (!argc)
+    {
+      grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
+      goto fail;
+    }
+
+  if (grub_strcmp (argv[0], "--nounzip") == 0)
+    {
+      argv++;
+      argc--;
+      nounzip = 1;
+    }
 
   if (!argc)
     {
@@ -403,6 +418,8 @@ grub_cmd_xen_module (grub_command_t cmd __attribute__((unused)),
 
   grub_dprintf ("xen_loader", "Init module and node info\n");
 
+  if (nounzip)
+    grub_file_filter_disable_compression ();
   file = grub_file_open (argv[0]);
   if (!file)
     goto fail;
Signature · 7 lines
2.5.5


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#4 lore raw

Re: [PATCH v6 2/4] arm64: add "--nounzip" option support in xen_module command

Quoted 16 lines · On Tue, Jul 26, 2016 at 05:13:41PM +0800, [email protected] wrote:

From: Fu Wei <[email protected]>

This patch adds "--nounzip" option support in order to be compatible with the module command of i386, then we can simplify grub-mkconfig support code.

---
 grub-core/loader/arm64/xen_boot.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
grub-core/loader/arm64/xen_boot.c +0 -0
index a914eb8..0878364 100644

grub-core/loader/arm64/xen_boot.c line 23

Quoted 4 lines
grub-core/loader/arm64/xen_boot.c +1 -0
@@ -20,6 +20,7 @@
 #include <grub/charset.h>
 #include <grub/command.h>
 #include <grub/err.h>
+#include <grub/env.h>

Is it really needed?

Daniel

#5 lore raw

PATCH v6 3/4 * util/grub.d/20_linux_xen.in: Add xen_boot command support

In reply to [email protected]

From: Fu Wei <[email protected]>

This patch adds the support of xen_boot command:
xen_hypervisor
xen_module

Also add a new "feature_xen_boot" to indicate this grub support xen_boot command.

---
 grub-core/normal/main.c     |  2 +-
 util/grub.d/20_linux_xen.in | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)
grub-core/normal/main.c +1 -1
index 78a70a8..3402a05 100644
@@ -488,7 +488,7 @@ static const char *features[] = {
   "feature_chainloader_bpb", "feature_ntldr", "feature_platform_search_hint",
   "feature_default_font_path", "feature_all_video_module",
   "feature_menuentry_id", "feature_menuentry_options", "feature_200_final",
-  "feature_nativedisk_cmd", "feature_timeout_style"
+  "feature_nativedisk_cmd", "feature_timeout_style", "feature_xen_boot"
 };
 
 GRUB_MOD_INIT(normal)
util/grub.d/20_linux_xen.in +10 -3
index c48af94..231e640 100644
@@ -122,16 +122,23 @@ linux_entry ()
         else
             xen_rm_opts="no-real-mode edd=off"
         fi
-	multiboot	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
+        if [ "x\$feature_xen_boot" != xy ]; then
+            xen_loader="multiboot"
+            module_loader="module"
+        else
+            xen_loader="xen_hypervisor"
+            module_loader="xen_module"
+        fi
+        \${xen_loader}	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
 	echo	'$(echo "$lmessage" | grub_quote)'
-	module	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
+        \${module_loader}	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
 EOF
   if test -n "${initrd}" ; then
     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
     message="$(gettext_printf "Loading initial ramdisk ...")"
     sed "s/^/$submenu_indentation/" << EOF
 	echo	'$(echo "$message" | grub_quote)'
-	module	--nounzip   ${rel_dirname}/${initrd}
+        \${module_loader} --nounzip	${rel_dirname}/${initrd}
 EOF
   fi
   sed "s/^/$submenu_indentation/" << EOF
Signature · 1 line
2.5.5
#6 lore raw

Re: [PATCH v6 3/4] * util/grub.d/20_linux_xen.in: Add xen_boot command support

Quoted 20 lines · On Tue, Jul 26, 2016 at 05:13:42PM +0800, [email protected] wrote:

From: Fu Wei <[email protected]>

This patch adds the support of xen_boot command:
xen_hypervisor
xen_module

Also add a new "feature_xen_boot" to indicate this grub support xen_boot command.

---
 grub-core/normal/main.c     |  2 +-
 util/grub.d/20_linux_xen.in | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)
grub-core/normal/main.c +0 -0
index 78a70a8..3402a05 100644

grub-core/normal/main.c static const char *features[] = { · line 491

Quoted 5 lines
grub-core/normal/main.c +1 -1
@@ -488,7 +488,7 @@ static const char *features[] = {
   "feature_chainloader_bpb", "feature_ntldr", "feature_platform_search_hint",
   "feature_default_font_path", "feature_all_video_module",
   "feature_menuentry_id", "feature_menuentry_options", "feature_200_final",
-  "feature_nativedisk_cmd", "feature_timeout_style"
+  "feature_nativedisk_cmd", "feature_timeout_style", "feature_xen_boot"

I do not like it. This is not generic feature but ARM specific one. Hence, we should not announce it as generic stuff. Then...

util/grub.d/20_linux_xen.in linux_entry () · line 125

Quoted 13 lines
grub-core/normal/main.c +0 -0
 };
 
 GRUB_MOD_INIT(normal)
util/grub.d/20_linux_xen.in +1 -1
index c48af94..231e640 100644
@@ -122,16 +122,23 @@ linux_entry ()
         else
             xen_rm_opts="no-real-mode edd=off"
         fi
-	multiboot	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
+        if [ "x\$feature_xen_boot" != xy ]; then

...we should consult $grub_platform and/or $grub_cpu here.

Daniel

#7 lore raw

PATCH v6 4/4 arm64: update the introduction of xen boot commands in docs/grub.texi

In reply to [email protected]

From: Fu Wei <[email protected]>

delete: xen_linux, xen_initrd, xen_xsm
add: xen_module

This update bases on
commit 0edd750e50698854068358ea53528100a9192902
Author: Vladimir Serbinenko <[email protected]>
Date: Fri Jan 22 10:18:47 2016 +0100

xen_boot: Remove obsolete module type distinctions.

Also bases on the module loading mechanism of Xen code:
488c2a8 docs/arm64: clarify the documention for loading XSM support 67831c4 docs/arm64: update the documentation for loading XSM support ca32012 xen/arm64: check XSM Magic from the second unknown module.

---
 docs/grub.texi | 32 +++++++++-----------------------
 1 file changed, 9 insertions(+), 23 deletions(-)
docs/grub.texi +9 -23
index 82f6fa4..85c913e 100644
@@ -3861,9 +3861,7 @@ you forget a command, you can run the command @command{help}
 * videoinfo::                   List available video modes
 @comment * xen_*::              Xen boot commands
 * xen_hypervisor::              Load xen hypervisor binary
-* xen_linux::                   Load dom0 kernel for xen hypervisor
-* xen_initrd::                  Load dom0 initrd for dom0 kernel
-* xen_xsm::                     Load xen security module for xen hypervisor
+* xen_module::                  Load xen modules for xen hypervisor
 @end menu
 
 
@@ -5141,30 +5139,18 @@ verbatim as the @dfn{kernel command-line}. Any other binaries must be
 reloaded after using this command.
 @end deffn
 
-@node xen_linux
-@subsection xen_linux
+@node xen_module
+@subsection xen_module
 
-@deffn Command xen_linux file [arguments]
-Load a dom0 kernel image for xen hypervisor at the booting process of xen.
+@deffn Command xen_module [--nounzip] file [arguments]
+Load a module for xen hypervisor at the booting process of xen.
 The rest of the line is passed verbatim as the module command line.
+Modules should be loaded in the following order:
+ - dom0 kernel image
+ - dom0 ramdisk if present
+ - XSM policy if present
 @end deffn
 
-@node xen_initrd
-@subsection xen_initrd
-
-@deffn Command xen_initrd file
-Load a initrd image for dom0 kernel at the booting process of xen.
-@end deffn
-
-@node xen_xsm
-@subsection xen_xsm
-
-@deffn Command xen_xsm file
-Load a xen security module for xen hypervisor at the booting process of xen.
-See @uref{http://wiki.xen.org/wiki/XSM} for more detail.
-@end deffn
-
-
 @node Networking commands
 @section The list of networking commands
 
Signature · 7 lines
2.5.5


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#8 lore raw

Re: [PATCH v6 4/4] arm64: update the introduction of xen boot commands in docs/grub.texi

Quoted 46 lines · On Tue, Jul 26, 2016 at 05:13:43PM +0800, [email protected] wrote:

From: Fu Wei <[email protected]>

delete: xen_linux, xen_initrd, xen_xsm
add: xen_module

This update bases on
commit 0edd750e50698854068358ea53528100a9192902
Author: Vladimir Serbinenko <[email protected]>
Date: Fri Jan 22 10:18:47 2016 +0100

xen_boot: Remove obsolete module type distinctions.

Also bases on the module loading mechanism of Xen code:
488c2a8 docs/arm64: clarify the documention for loading XSM support 67831c4 docs/arm64: update the documentation for loading XSM support ca32012 xen/arm64: check XSM Magic from the second unknown module.

---
 docs/grub.texi | 32 +++++++++-----------------------
 1 file changed, 9 insertions(+), 23 deletions(-)
docs/grub.texi +3 -5
index 82f6fa4..85c913e 100644
@@ -3861,9 +3861,7 @@ you forget a command, you can run the command @command{help}
 * videoinfo::                   List available video modes
 @comment * xen_*::              Xen boot commands
 * xen_hypervisor::              Load xen hypervisor binary
-* xen_linux::                   Load dom0 kernel for xen hypervisor
-* xen_initrd::                  Load dom0 initrd for dom0 kernel
-* xen_xsm::                     Load xen security module for xen hypervisor
+* xen_module::                  Load xen modules for xen hypervisor
 @end menu
 
 
@@ -5141,30 +5139,18 @@ verbatim as the @dfn{kernel command-line}. Any other binaries must be
 reloaded after using this command.
 @end deffn
 
-@node xen_linux
-@subsection xen_linux
+@node xen_module
+@subsection xen_module

docs/grub.texi verbatim as the @dfn{kernel command-line}. Any other binaries must be · line 5151

Quoted 10 lines
docs/grub.texi +6 -2
 
-@deffn Command xen_linux file [arguments]
-Load a dom0 kernel image for xen hypervisor at the booting process of xen.
+@deffn Command xen_module [--nounzip] file [arguments]
+Load a module for xen hypervisor at the booting process of xen.
 The rest of the line is passed verbatim as the module command line.
+Modules should be loaded in the following order:
+ - dom0 kernel image
+ - dom0 ramdisk if present
+ - XSM policy if present

What happens if somebody wants to use XSM without ramdisk?

Please do not forget to mention somewhere that xen_hypervisor and xen_module commands are ARM specific.

Daniel

#9 lore raw

Re: [PATCH v6 0/4] arm64, xen: add xen_boot support into grup-mkconfig

In reply to [email protected]

Hi Daniel,

I have heard you became co-maintainer of GRUB. Congratulations for that :).

We have a couple series (this series and [1]) to allow grub booting Xen on ARM that have been waiting on the GRUB ML for a while to be pushed.

Those patches have been tested and already integrated in some distributions. It would be nice to get them in GRUB upstream.

Would it be possible for you to take a look?

Regards,

[1] https://lists.gnu.org/archive/html/grub-devel/2016-02/msg00205.html

Quoted 47 lines · On 26/07/16 10:13, [email protected] wrote:

From: Fu Wei <[email protected]>

This patchset add xen_boot support into grup-mkconfig for generating xen boot entrances automatically

Also update the docs/grub.texi for new xen_boot commands.

This patchset has been tested on Foudation model with a bug fix:
http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00205.html

ChangeLog:
v6: http://lists.gnu.org/archive/html/grub-devel/2016-07/
Fix Coding style of util/grub.d/20_linux_xen.in, use soft tab.

v5: http://lists.gnu.org/archive/html/grub-devel/2016-07/msg00008.html
Update the introduction of xen_module commands in docs/grub.texi, according to the suggestion from Julien Grall

v4: http://lists.gnu.org/archive/html/grub-devel/2016-05/
according to the XSM loading mechanism of Xen(upstreamed), update the introduction of xen_module commands in docs/grub.texi

v3: http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00314.html
reorder the patches
update the introduction of xen_module commands in docs/grub.texi

v2: http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00282.html
add "--nounzip" option support in xen_module
use "feature_xen_boot" instead of "grub_xen_boot" update the introduction of xen boot commands in docs/grub.texi

v1 :first upstream patchset:

    http://lists.gnu.org/archive/html/grub-devel/2016-02/msg00264.html

Fu Wei (4):
i386,xen: Add xen_hypervisor and xen_module aliases for i386
arm64: add "--nounzip" option support in xen_module command
* util/grub.d/20_linux_xen.in: Add xen_boot command support
arm64: update the introduction of xen boot commands in docs/grub.texi

 docs/grub.texi                    | 32 +++++++++-----------------------
 grub-core/loader/arm64/xen_boot.c | 17 +++++++++++++++++
 grub-core/loader/i386/xen.c       |  7 +++++++
 grub-core/normal/main.c           |  2 +-
 util/grub.d/20_linux_xen.in       | 13 ++++++++++---
 5 files changed, 44 insertions(+), 27 deletions(-)
Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#10 lore raw

Re: [PATCH v6 0/4] arm64, xen: add xen_boot support into grup-mkconfig

Hey Julien,

Quoted 3 lines · Julien Grall

Hi Daniel,

I have heard you became co-maintainer of GRUB. Congratulations for that :).

Thanks a lot!

Quoted 6 lines

We have a couple series (this series and [1]) to allow grub booting Xen on ARM that have been waiting on the GRUB ML for a while to be pushed.

Those patches have been tested and already integrated in some distributions. It would be nice to get them in GRUB upstream.

As I can see at least some of them listed here:
https://docs.google.com/document/d/1O6wveo1_WsAyEHMD041xMYvhDTDp3jQYzmqkgBx57HM/

So, this is good sign. Currently, we are agreeing what should be taken into 2.02 train. We are considering just most important things and fixes. Hence, I am not able to promise that we include in 2.02 all ARM patches mentioned by you if they are not on the above list right now. However, if it does not happen I will put them on the list for release after 2.02 (assuming that they are OK).

Quoted 1 line

Would it be possible for you to take a look?

Sure thing. However, I am working on some stuff for Xen 4.8 and as you may know deadline is quite close. So, I will take care of GRUB2 things in the second half of September. Stay tuned...

Daniel

#11 lore raw

Re: [Xen-devel] [PATCH v6 0/4] arm64, xen: add xen_boot support into grup-mkconfig

Quoted 1 line · Daniel Kiper

Hey Julien,

Hi Daniel,

Quoted 11 lines · Julien Grall
Quoted 6 lines

We have a couple series (this series and [1]) to allow grub booting Xen on ARM that have been waiting on the GRUB ML for a while to be pushed.

Those patches have been tested and already integrated in some distributions. It would be nice to get them in GRUB upstream.

As I can see at least some of them listed here:
https://docs.google.com/document/d/1O6wveo1_WsAyEHMD041xMYvhDTDp3jQYzmqkgBx57HM/

Quoted 6 lines

So, this is good sign. Currently, we are agreeing what should be taken into 2.02 train. We are considering just most important things and fixes. Hence, I am not able to promise that we include in 2.02 all ARM patches mentioned by you if they are not on the above list right now. However, if it does not happen I will put them on the list for release after 2.02 (assuming that they are OK).

So it looks like that this series is in the list. However, the patch [1] is missing. It is a requirement for this series, without it Xen will crash when booting with GRUB.

Quoted 6 lines
Quoted 2 lines

Would it be possible for you to take a look?

Sure thing. However, I am working on some stuff for Xen 4.8 and as you may know deadline is quite close. So, I will take care of GRUB2 things in the second half of September. Stay tuned...

It is fine by me.

Thank you,

[1] https://lists.gnu.org/archive/html/grub-devel/2016-02/msg00205.html

Signature · 1 line
Julien Grall