uboot-script-gen: add xen xsm policy loading support
From: Grygorii Strashko <[email protected]>
This patch adds Xen XSM policy loading support.
The configuration file XEN_POLICY specifies Xen hypervisor XSM policy binary to load.
--- README.md | 2 ++ scripts/uboot-script-gen | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
README.md +2 -0
@@ -91,6 +91,8 @@ Where: - XEN specifies the Xen hypervisor binary to load. Note that it has to be a regular Xen binary, not a u-boot binary. +- XEN_POLICY specifies the Xen hypervisor XSM policy binary to load. + - XEN_COLORS specifies the colors (cache coloring) to be used for Xen and is in the format startcolor-endcolor
scripts/uboot-script-gen +33 -0
@@ -315,6 +315,15 @@ function xen_device_tree_editing() dt_set "/chosen" "#size-cells" "hex" "0x2" dt_set "/chosen" "xen,xen-bootargs" "str" "$XEN_CMD" + if test "$XEN_POLICY" && test $xen_policy_addr != "-" + then + local node_name="xen-policy@${xen_policy_addr#0x}" + + dt_mknode "/chosen" "$node_name" + dt_set "/chosen/$node_name" "compatible" "str_a" "xen,xsm-policy xen,multiboot-module multiboot,module" + dt_set "/chosen/$node_name" "reg" "hex" "$(split_addr_size $xen_policy_addr $xen_policy_size)" + fi + if test "$DOM0_KERNEL" then local node_name="dom0@${dom0_kernel_addr#0x}"
@@ -900,6 +909,14 @@ xen_file_loading() kernel_addr=$memaddr kernel_path=$XEN load_file "$XEN" "host_kernel" + + xen_policy_addr=="-" + if test "$XEN_POLICY" + then + xen_policy_addr=$memaddr + load_file "$XEN_POLICY" "xen_policy" + xen_policy_size=$filesize + fi } linux_file_loading()
@@ -939,6 +956,22 @@ bitstream_load_and_config() create_its_file_xen() { + if test "$XEN_POLICY" && test $xen_policy_addr != "-" + then + cat >> "$its_file" <<- EOF + xen_policy { + description = "Xen XSM policy binary"; + data = /incbin/("$XEN_POLICY"); + type = "kernel"; + arch = "arm64"; + os = "linux"; + compression = "none"; + load = <$xen_policy_addr>; + $fit_algo + }; + EOF + fi + if test "$DOM0_KERNEL" then if test "$ramdisk_addr" != "-"
Signature · 1 line
2.34.1
As a general question, why using "test" so much, rather than
if [ -n "$FOO" -a "FOO" == ABC ]
Using test seems far harder to read than it needs to be, and single brackets are perfectly valid POSIX shell.
Quoted 31 lines · Grygorii Strashko
From: Grygorii Strashko <[email protected]>
This patch adds Xen XSM policy loading support.
The configuration file
XEN_POLICYspecifies Xen hypervisor XSM policy binary to load.Signed-off-by Grygorii Strashko <[email protected]>--- README.md | 2 ++ scripts/uboot-script-gen | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)README.md +2
-0@@ -91,6 +91,8 @@ Where: - XEN specifies the Xen hypervisor binary to load. Note that it has to be a regular Xen binary, not a u-boot binary. +- XEN_POLICY specifies the Xen hypervisor XSM policy binary to load. + - XEN_COLORS specifies the colors (cache coloring) to be used for Xen and is in the format startcolor-endcolorscripts/uboot-script-gen +0
-0
scripts/uboot-script-gen function xen_device_tree_editing() · line 318
Quoted 4 lines
scripts/uboot-script-gen +1
-0@@ -315,6 +315,15 @@ function xen_device_tree_editing() dt_set "/chosen" "#size-cells" "hex" "0x2" dt_set "/chosen" "xen,xen-bootargs" "str" "$XEN_CMD" + if test "$XEN_POLICY" && test $xen_policy_addr != "-"
If XEN_POLICY is a binary, shouldn't it be "test -f" ? Same later on.
Also, missing quotes around $xen_policy_addr
scripts/uboot-script-gen function xen_device_tree_editing() · line 327
Quoted 9 lines
scripts/uboot-script-gen +8
-0+ then + local node_name="xen-policy@${xen_policy_addr#0x}" + + dt_mknode "/chosen" "$node_name" + dt_set "/chosen/$node_name" "compatible" "str_a" "xen,xsm-policy xen,multiboot-module multiboot,module" + dt_set "/chosen/$node_name" "reg" "hex" "$(split_addr_size $xen_policy_addr $xen_policy_size)" + fi + if test "$DOM0_KERNEL"
test -f?
g
scripts/uboot-script-gen xen_file_loading() · line 913
Quoted 8 lines
scripts/uboot-script-gen +2
-0then local node_name="dom0@${dom0_kernel_addr#0x}"@@ -900,6 +909,14 @@ xen_file_loading() kernel_addr=$memaddr kernel_path=$XEN load_file "$XEN" "host_kernel" + + xen_policy_addr=="-"
Do you mean = ?
Quoted 22 lines
scripts/uboot-script-gen +15
-0+ if test "$XEN_POLICY" + then + xen_policy_addr=$memaddr + load_file "$XEN_POLICY" "xen_policy" + xen_policy_size=$filesize + fi } linux_file_loading()@@ -939,6 +956,22 @@ bitstream_load_and_config() create_its_file_xen() { + if test "$XEN_POLICY" && test $xen_policy_addr != "-" + then + cat >> "$its_file" <<- EOF + xen_policy { + description = "Xen XSM policy binary"; + data = /incbin/("$XEN_POLICY"); + type = "kernel"; + arch = "arm64"; + os = "linux";
scripts/uboot-script-gen bitstream_load_and_config() · line 977
Quoted 10 lines
scripts/uboot-script-gen +7
-0+ compression = "none"; + load = <$xen_policy_addr>; + $fit_algo + }; + EOF + fi + if test "$DOM0_KERNEL" then if test "$ramdisk_addr" != "-"
Cheers,
Alejandro
Quoted 42 lines · Alejandro Vallejo
As a general question, why using "test" so much, rather than
if [ -n "$FOO" -a "FOO" == ABC ]Using test seems far harder to read than it needs to be, and single brackets are perfectly valid POSIX shell.
Quoted 34 lines · Grygorii Strashko
From: Grygorii Strashko <[email protected]>
This patch adds Xen XSM policy loading support.
The configuration file
XEN_POLICYspecifies Xen hypervisor XSM policy binary to load.Signed-off-by Grygorii Strashko <[email protected]>--- README.md | 2 ++ scripts/uboot-script-gen | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)README.md +2
-0@@ -91,6 +91,8 @@ Where: - XEN specifies the Xen hypervisor binary to load. Note that it has to be a regular Xen binary, not a u-boot binary. +- XEN_POLICY specifies the Xen hypervisor XSM policy binary to load. + - XEN_COLORS specifies the colors (cache coloring) to be used for Xen and is in the format startcolor-endcolorscripts/uboot-script-gen +0
-0@@ -315,6 +315,15 @@ function xen_device_tree_editing() dt_set "/chosen" "#size-cells" "hex" "0x2" dt_set "/chosen" "xen,xen-bootargs" "str" "$XEN_CMD"
Quoted 3 lines
scripts/uboot-script-gen function xen_device_tree_editing() · line 318
Quoted 1 line
scripts/uboot-script-gen +1
-0+ if test "$XEN_POLICY" && test $xen_policy_addr != "-"If
XEN_POLICYis a binary, shouldn't it be "test -f" ? Same later on.
On the absent flag:
Nevermind, I see you're using "-n" implicitly instead. I'd rather it be less opaque, but it does function. I do think most uses of test "$FOO" would be better off with an explicit -f or -n. But that's a separate matter.
Cheers,
Alejandro
Hi Alejandro,
Quoted 42 lines · Alejandro Vallejo
As a general question, why using "test" so much, rather than
if [ -n "$FOO" -a "FOO" == ABC ]Using test seems far harder to read than it needs to be, and single brackets are perfectly valid POSIX shell.
Quoted 34 lines · Grygorii Strashko
From: Grygorii Strashko <[email protected]>
This patch adds Xen XSM policy loading support.
The configuration file
XEN_POLICYspecifies Xen hypervisor XSM policy binary to load.Signed-off-by Grygorii Strashko <[email protected]>--- README.md | 2 ++ scripts/uboot-script-gen | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)README.md +2
-0@@ -91,6 +91,8 @@ Where: - XEN specifies the Xen hypervisor binary to load. Note that it has to be a regular Xen binary, not a u-boot binary. +- XEN_POLICY specifies the Xen hypervisor XSM policy binary to load. + - XEN_COLORS specifies the colors (cache coloring) to be used for Xen and is in the format startcolor-endcolorscripts/uboot-script-gen +0
-0@@ -315,6 +315,15 @@ function xen_device_tree_editing() dt_set "/chosen" "#size-cells" "hex" "0x2" dt_set "/chosen" "xen,xen-bootargs" "str" "$XEN_CMD"
Quoted 3 lines
scripts/uboot-script-gen function xen_device_tree_editing() · line 318
Quoted 1 line
scripts/uboot-script-gen +1
-0+ if test "$XEN_POLICY" && test $xen_policy_addr != "-"If
XEN_POLICYis a binary, shouldn't it be "test -f" ? Same later on.
You're right. I'll update it as below...
Quoted 15 lines
Also, missing quotes around $xen_policy_addr
scripts/uboot-script-gen function xen_device_tree_editing() · line 327
Quoted 9 lines
scripts/uboot-script-gen +8
-0+ then + local node_name="xen-policy@${xen_policy_addr#0x}" + + dt_mknode "/chosen" "$node_name" + dt_set "/chosen/$node_name" "compatible" "str_a" "xen,xsm-policy xen,multiboot-module multiboot,module" + dt_set "/chosen/$node_name" "reg" "hex" "$(split_addr_size $xen_policy_addr $xen_policy_size)" + fi + if test "$DOM0_KERNEL"test -f?
g
Quoted 13 lines
scripts/uboot-script-gen xen_file_loading() · line 913
Quoted 8 lines
scripts/uboot-script-gen +2
-0then local node_name="dom0@${dom0_kernel_addr#0x}"@@ -900,6 +909,14 @@ xen_file_loading() kernel_addr=$memaddr kernel_path=$XEN load_file "$XEN" "host_kernel" + + xen_policy_addr=="-"Do you mean = ?
Quoted 2 lines
scripts/uboot-script-gen +2
-0+ if test "$XEN_POLICY" + then
I'll add here:
check_file_type "${XEN_POLICY}" "SE Linux policy"and fix other comments.
Quoted 22 lines
Quoted 22 lines
scripts/uboot-script-gen +15
-0+ xen_policy_addr=$memaddr + load_file "$XEN_POLICY" "xen_policy" + xen_policy_size=$filesize + fi } linux_file_loading()@@ -939,6 +956,22 @@ bitstream_load_and_config() create_its_file_xen() { + if test "$XEN_POLICY" && test $xen_policy_addr != "-" + then + cat >> "$its_file" <<- EOF + xen_policy { + description = "Xen XSM policy binary"; + data = /incbin/("$XEN_POLICY"); + type = "kernel"; + arch = "arm64"; + os = "linux"; + compression = "none"; + load = <$xen_policy_addr>;
Quoted 8 lines
scripts/uboot-script-gen bitstream_load_and_config() · line 977
Quoted 8 lines
scripts/uboot-script-gen +5
-0+ $fit_algo + }; + EOF + fi + if test "$DOM0_KERNEL" then if test "$ramdisk_addr" != "-"
Thanks for your review.
Signature · 2 lines
Best regards, -grygorii