Skip to contentSkip to conversation

uboot-script-gen: prevent user mistakes due to DOM0_KERNEL becoming optional

PATCH In review Xenia Ragiadakou 3 participants 11 messages Jun 26, 2022 – Jun 30, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 uboot-script-gen: prevent user mistakes due to DOM0_KERNEL becoming optional

Before enabling true dom0less configuration, the script was failing instantly if DOM0_KERNEL parameter was not specified. This behaviour has changed and this needs to be communicated to the user.

Mention in README.md that for dom0less configurations, the parameter DOM0_KERNEL is optional.

If DOM0_KERNEL is not set, check that no other dom0 specific parameters are specified by the user. Fail the script early with an appropriate error message, if it was invoked with erroneous configuration settings.

Change message "Dom0 kernel is not specified, continue with dom0less setup." to "Dom0 kernel is not specified, continue with true dom0less setup." to refer more accurately to a dom0less setup without dom0.

---
 README.md                |  1 +
 scripts/uboot-script-gen | 21 ++++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)
README.md +1 -0
index 17ff206..cb15ca5 100644
@@ -100,6 +100,7 @@ Where:
   been specified in XEN_PASSTHROUGH_PATHS.
 
 - DOM0_KERNEL specifies the Dom0 kernel file to load.
+  For dom0less configurations, the parameter is optional.
 
 - DOM0_MEM specifies the amount of memory for Dom0 VM in MB. The default
   is 1024. This is only applicable when XEN_CMD is not specified.
scripts/uboot-script-gen +14 -7
index e85c6ec..085e29f 100755
@@ -410,6 +410,20 @@ function find_root_dev()
 
 function xen_config()
 {
+    if test -z "$DOM0_KERNEL"
+    then
+        if test "$NUM_DOMUS" -eq "0"
+        then
+            echo "Neither dom0 or domUs are specified, exiting."
+            exit 1
+        elif test "$DOM0_MEM" || test "$DOM0_VCPUS" || test "$DOM0_COLORS" || test "$DOM0_CMD" || test "$DOM0_RAMDISK" || test "$DOM0_ROOTFS"
+        then
+            echo "For dom0less configuration without dom0, no dom0 specific parameters should be specified, exiting."
+            exit 1
+        fi
+        echo "Dom0 kernel is not specified, continue with true dom0less setup."
+    fi
+
     if [ -z "$XEN_CMD" ]
     then
         if [ -z "$DOM0_MEM" ]
@@ -457,13 +471,6 @@ function xen_config()
     fi
     if test -z "$DOM0_KERNEL"
     then
-        if test "$NUM_DOMUS" -eq "0"
-        then
-            echo "Neither dom0 or domUs are specified, exiting."
-            exit 1
-        fi
-        echo "Dom0 kernel is not specified, continue with dom0less setup."
-        unset DOM0_RAMDISK
         # Remove dom0 specific parameters from the XEN command line.
         local params=($XEN_CMD)
         XEN_CMD="${params[@]/dom0*/}"
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 uboot-script-gen: do not enable direct mapping by default

To be inline with XEN, do not enable direct mapping automatically for all statically allocated domains.

---
 README.md                | 4 ++--
 scripts/uboot-script-gen | 8 ++------
 2 files changed, 4 insertions(+), 8 deletions(-)
README.md +2 -2
index cb15ca5..03e437b 100644
@@ -169,8 +169,8 @@ Where:
   if specified, indicates the host physical address regions
   [baseaddr, baseaddr + size) to be reserved to the VM for static allocation.
 
-- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
-  If set to 1, the VM is direct mapped. The default is 1.
+- DOMU_DIRECT_MAP[number] if set to 1, enables direct mapping.
+  By default, direct mapping is disabled.
   This is only applicable when DOMU_STATIC_MEM is specified.
 
 - LINUX is optional but specifies the Linux kernel for when Xen is NOT
scripts/uboot-script-gen +2 -6
index 085e29f..66ce6f7 100755
@@ -52,7 +52,7 @@ function dt_set()
             echo "fdt set $path $var $array" >> $UBOOT_SOURCE
         elif test $data_type = "bool"
         then
-            if test "$data" -eq 1
+            if test "$data" == "1"
             then
                 echo "fdt set $path $var" >> $UBOOT_SOURCE
             fi
@@ -74,7 +74,7 @@ function dt_set()
             fdtput $FDTEDIT -p -t s $path $var $data
         elif test $data_type = "bool"
         then
-            if test "$data" -eq 1
+            if test "$data" == "1"
             then
                 fdtput $FDTEDIT -p $path $var
             fi
@@ -491,10 +491,6 @@ function xen_config()
         then
             DOMU_CMD[$i]="console=ttyAMA0"
         fi
-        if test -z "${DOMU_DIRECT_MAP[$i]}"
-        then
-             DOMU_DIRECT_MAP[$i]=1
-        fi
         i=$(( $i + 1 ))
     done
 }
Signature · 1 line
2.34.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [Viryaos-discuss] [PATCH 2/2] uboot-script-gen: do not enable direct mapping by default

Quoted 4 lines · Xenia Ragiadakou

To be inline with XEN, do not enable direct mapping automatically for all statically allocated domains.

Quoted 53 lines
---
  README.md                | 4 ++--
  scripts/uboot-script-gen | 8 ++------
  2 files changed, 4 insertions(+), 8 deletions(-)
README.md +2 -2
index cb15ca5..03e437b 100644
@@ -169,8 +169,8 @@ Where:
    if specified, indicates the host physical address regions
    [baseaddr, baseaddr + size) to be reserved to the VM for static allocation.
 
-- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
-  If set to 1, the VM is direct mapped. The default is 1.
+- DOMU_DIRECT_MAP[number] if set to 1, enables direct mapping.
+  By default, direct mapping is disabled.
    This is only applicable when DOMU_STATIC_MEM is specified.
 
  - LINUX is optional but specifies the Linux kernel for when Xen is NOT
scripts/uboot-script-gen +2 -6
index 085e29f..66ce6f7 100755
@@ -52,7 +52,7 @@ function dt_set()
              echo "fdt set $path $var $array" >> $UBOOT_SOURCE
          elif test $data_type = "bool"
          then
-            if test "$data" -eq 1
+            if test "$data" == "1"
              then
                  echo "fdt set $path $var" >> $UBOOT_SOURCE
              fi
@@ -74,7 +74,7 @@ function dt_set()
              fdtput $FDTEDIT -p -t s $path $var $data
          elif test $data_type = "bool"
          then
-            if test "$data" -eq 1
+            if test "$data" == "1"
              then
                  fdtput $FDTEDIT -p $path $var
              fi
@@ -491,10 +491,6 @@ function xen_config()
          then
              DOMU_CMD[$i]="console=ttyAMA0"
          fi
-        if test -z "${DOMU_DIRECT_MAP[$i]}"
-        then
-             DOMU_DIRECT_MAP[$i]=1
-        fi
          i=$(( $i + 1 ))
      done
  }
#3 lore raw

Re: [PATCH 2/2] uboot-script-gen: do not enable direct mapping by default

In reply to Xenia Ragiadakou
Quoted 4 lines · Xenia Ragiadakou

To be inline with XEN, do not enable direct mapping automatically for all statically allocated domains.

Actually I don't know about this one. I think it is OK that ImageBuilder defaults are different from Xen defaults. This is a case where I think it would be good to enable DOMU_DIRECT_MAP by default when DOMU_STATIC_MEM is specified.

Quoted 56 lines
---
 README.md                | 4 ++--
 scripts/uboot-script-gen | 8 ++------
 2 files changed, 4 insertions(+), 8 deletions(-)
README.md +2 -2
index cb15ca5..03e437b 100644
@@ -169,8 +169,8 @@ Where:
   if specified, indicates the host physical address regions
   [baseaddr, baseaddr + size) to be reserved to the VM for static allocation.
 
-- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
-  If set to 1, the VM is direct mapped. The default is 1.
+- DOMU_DIRECT_MAP[number] if set to 1, enables direct mapping.
+  By default, direct mapping is disabled.
   This is only applicable when DOMU_STATIC_MEM is specified.
 
 - LINUX is optional but specifies the Linux kernel for when Xen is NOT
scripts/uboot-script-gen +2 -6
index 085e29f..66ce6f7 100755
@@ -52,7 +52,7 @@ function dt_set()
             echo "fdt set $path $var $array" >> $UBOOT_SOURCE
         elif test $data_type = "bool"
         then
-            if test "$data" -eq 1
+            if test "$data" == "1"
             then
                 echo "fdt set $path $var" >> $UBOOT_SOURCE
             fi
@@ -74,7 +74,7 @@ function dt_set()
             fdtput $FDTEDIT -p -t s $path $var $data
         elif test $data_type = "bool"
         then
-            if test "$data" -eq 1
+            if test "$data" == "1"
             then
                 fdtput $FDTEDIT -p $path $var
             fi
@@ -491,10 +491,6 @@ function xen_config()
         then
             DOMU_CMD[$i]="console=ttyAMA0"
         fi
-        if test -z "${DOMU_DIRECT_MAP[$i]}"
-        then
-             DOMU_DIRECT_MAP[$i]=1
-        fi
         i=$(( $i + 1 ))
     done
 }
Signature · 1 line
2.34.1
author
#4 lore raw

Re: [PATCH 2/2] uboot-script-gen: do not enable direct mapping by default

Hi Stefano,

Quoted 9 lines · Stefano Stabellini
Quoted 4 lines · Xenia Ragiadakou

To be inline with XEN, do not enable direct mapping automatically for all statically allocated domains.

Actually I don't know about this one. I think it is OK that ImageBuilder defaults are different from Xen defaults. This is a case where I think it would be good to enable DOMU_DIRECT_MAP by default when DOMU_STATIC_MEM is specified.

Just realized that I forgot to add [ImageBuilder] tag to the patches. Sorry about that.

I cc Ayan, since the change was suggested by him.
I have no strong preference on the default value.

Xenia

Quoted 56 lines
Quoted 56 lines
---
  README.md                | 4 ++--
  scripts/uboot-script-gen | 8 ++------
  2 files changed, 4 insertions(+), 8 deletions(-)
README.md +2 -2
index cb15ca5..03e437b 100644
@@ -169,8 +169,8 @@ Where:
    if specified, indicates the host physical address regions
    [baseaddr, baseaddr + size) to be reserved to the VM for static allocation.
 
-- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
-  If set to 1, the VM is direct mapped. The default is 1.
+- DOMU_DIRECT_MAP[number] if set to 1, enables direct mapping.
+  By default, direct mapping is disabled.
    This is only applicable when DOMU_STATIC_MEM is specified.
 
  - LINUX is optional but specifies the Linux kernel for when Xen is NOT
scripts/uboot-script-gen +2 -6
index 085e29f..66ce6f7 100755
@@ -52,7 +52,7 @@ function dt_set()
              echo "fdt set $path $var $array" >> $UBOOT_SOURCE
          elif test $data_type = "bool"
          then
-            if test "$data" -eq 1
+            if test "$data" == "1"
              then
                  echo "fdt set $path $var" >> $UBOOT_SOURCE
              fi
@@ -74,7 +74,7 @@ function dt_set()
              fdtput $FDTEDIT -p -t s $path $var $data
          elif test $data_type = "bool"
          then
-            if test "$data" -eq 1
+            if test "$data" == "1"
              then
                  fdtput $FDTEDIT -p $path $var
              fi
@@ -491,10 +491,6 @@ function xen_config()
          then
              DOMU_CMD[$i]="console=ttyAMA0"
          fi
-        if test -z "${DOMU_DIRECT_MAP[$i]}"
-        then
-             DOMU_DIRECT_MAP[$i]=1
-        fi
          i=$(( $i + 1 ))
      done
  }
Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH 2/2] uboot-script-gen: do not enable direct mapping by default

Hi Stefano/Xenia,

Quoted 7 lines · xenia

Hi Stefano,

Quoted 4 lines · Stefano Stabellini
Quoted 3 lines · Xenia Ragiadakou

To be inline with XEN, do not enable direct mapping automatically for all statically allocated domains.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Actually I don't know about this one. I think it is OK that ImageBuilder defaults are different from Xen defaults. This is a case where I think it would be good to enable DOMU_DIRECT_MAP by default when DOMU_STATIC_MEM is specified.

Just realized that I forgot to add [ImageBuilder] tag to the patches. Sorry about that.

@Stefano, why do you wish the Imagebuilder's behaviour to differ from Xen ? Is there any use-case that helps.

- Ayan

Quoted 60 lines

I cc Ayan, since the change was suggested by him.
I have no strong preference on the default value.

Xenia

Quoted 54 lines
Quoted 54 lines

---
  README.md                | 4 ++--
  scripts/uboot-script-gen | 8 ++------

  2 files changed, 4 insertions(+), 8 deletions(-)
README.md +0 -0
index cb15ca5..03e437b 100644
@@ -169,8 +169,8 @@ Where:

    if specified, indicates the host physical address regions [baseaddr, baseaddr + size) to be reserved to the VM for static allocation. -- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
-  If set to 1, the VM is direct mapped. The default is 1.
+- DOMU_DIRECT_MAP[number] if set to 1, enables direct mapping.
+  By default, direct mapping is disabled.
    This is only applicable when DOMU_STATIC_MEM is specified.
    - LINUX is optional but specifies the Linux kernel for when Xen is NOT

scripts/uboot-script-gen +0 -0
index 085e29f..66ce6f7 100755
@@ -52,7 +52,7 @@ function dt_set()

              echo "fdt set $path $var $array" >> $UBOOT_SOURCE elif test $data_type = "bool"
          then
-            if test "$data" -eq 1
+            if test "$data" == "1"
              then
                  echo "fdt set $path $var" >> $UBOOT_SOURCE fi

scripts/uboot-script-gen +0 -0
@@ -74,7 +74,7 @@ function dt_set()

              fdtput $FDTEDIT -p -t s $path $var $data elif test $data_type = "bool"
          then
-            if test "$data" -eq 1
+            if test "$data" == "1"
              then
                  fdtput $FDTEDIT -p $path $var fi

scripts/uboot-script-gen +0 -0
@@ -491,10 +491,6 @@ function xen_config()

          then
              DOMU_CMD[$i]="console=ttyAMA0"
          fi
-        if test -z "${DOMU_DIRECT_MAP[$i]}"
-        then
-             DOMU_DIRECT_MAP[$i]=1
-        fi
          i=$(( $i + 1 ))
      done
  }

Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH 2/2] uboot-script-gen: do not enable direct mapping by default

Quoted 16 lines · Ayan Kumar Halder

Hi Stefano/Xenia,

Quoted 13 lines · xenia

Hi Stefano,

Quoted 10 lines · Stefano Stabellini
Quoted 5 lines · Xenia Ragiadakou

To be inline with XEN, do not enable direct mapping automatically for all
statically allocated domains.

Actually I don't know about this one. I think it is OK that ImageBuilder defaults are different from Xen defaults. This is a case where I think it would be good to enable DOMU_DIRECT_MAP by default when DOMU_STATIC_MEM is specified.

Quoted 5 lines
Quoted 2 lines

Just realized that I forgot to add [ImageBuilder] tag to the patches. Sorry about that.

@Stefano, why do you wish the Imagebuilder's behaviour to differ from Xen ? Is there any use-case that helps.

As background, ImageBuilder is meant to be very simple to use especially for the most common configurations. In fact, I think ImageBuilder doesn't necessarely have to support all the options that Xen offers, only the most common and important.

If someone wants an esoteric option, they can always edit the generated boot.source and make any necessary changes. I make sure to explain that editing boot.source is always a possibility in all the talks I gave about ImageBuilder.

Now to answer the specific question. I am positive that the most common configuration for people that wants static memory is to have direct_map. That is because the two go hand-in-hand in configuration where the IOMMU is not used. So I think that from an ImageBuilder perspective direct_map should default to enabled when static memory is requested. It can always be disabled, both using DOMU_DIRECT_MAP, or editing boot.source.

Quoted 62 lines
Quoted 61 lines

I cc Ayan, since the change was suggested by him.
I have no strong preference on the default value.

Xenia

Quoted 56 lines
Quoted 56 lines

---
  README.md                | 4 ++--
  scripts/uboot-script-gen | 8 ++------

  2 files changed, 4 insertions(+), 8 deletions(-)
README.md +0 -0
index cb15ca5..03e437b 100644
@@ -169,8 +169,8 @@ Where:

    if specified, indicates the host physical address regions [baseaddr, baseaddr + size) to be reserved to the VM for static allocation.
  -- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
-  If set to 1, the VM is direct mapped. The default is 1. +- DOMU_DIRECT_MAP[number] if set to 1, enables direct mapping. +  By default, direct mapping is disabled.
    This is only applicable when DOMU_STATIC_MEM is specified.
    - LINUX is optional but specifies the Linux kernel for when Xen is NOT

scripts/uboot-script-gen +0 -0
index 085e29f..66ce6f7 100755
@@ -52,7 +52,7 @@ function dt_set()

              echo "fdt set $path $var $array" >> $UBOOT_SOURCE elif test $data_type = "bool"
          then
-            if test "$data" -eq 1
+            if test "$data" == "1"
              then
                  echo "fdt set $path $var" >> $UBOOT_SOURCE fi

scripts/uboot-script-gen +0 -0
@@ -74,7 +74,7 @@ function dt_set()

              fdtput $FDTEDIT -p -t s $path $var $data elif test $data_type = "bool"
          then
-            if test "$data" -eq 1
+            if test "$data" == "1"
              then
                  fdtput $FDTEDIT -p $path $var fi

scripts/uboot-script-gen +0 -0
@@ -491,10 +491,6 @@ function xen_config()

          then
              DOMU_CMD[$i]="console=ttyAMA0"
          fi
-        if test -z "${DOMU_DIRECT_MAP[$i]}"
-        then
-             DOMU_DIRECT_MAP[$i]=1
-        fi
          i=$(( $i + 1 ))
      done
  }

Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH 2/2] uboot-script-gen: do not enable direct mapping by default

Quoted 31 lines · Stefano Stabellini
Quoted 12 lines · Ayan Kumar Halder

Hi Stefano/Xenia,

Quoted 9 lines · xenia

Hi Stefano,

Quoted 6 lines · Stefano Stabellini
Quoted 5 lines · Xenia Ragiadakou

To be inline with XEN, do not enable direct mapping automatically for all
statically allocated domains.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Actually I don't know about this one. I think it is OK that ImageBuilder defaults are different from Xen defaults. This is a case where I think it would be good to enable DOMU_DIRECT_MAP by default when DOMU_STATIC_MEM is specified.

Just realized that I forgot to add [ImageBuilder] tag to the patches. Sorry about that.

@Stefano, why do you wish the Imagebuilder's behaviour to differ from Xen ? Is there any use-case that helps.

As background, ImageBuilder is meant to be very simple to use especially for the most common configurations. In fact, I think ImageBuilder doesn't necessarely have to support all the options that Xen offers, only the most common and important.

If someone wants an esoteric option, they can always edit the generated boot.source and make any necessary changes. I make sure to explain that editing boot.source is always a possibility in all the talks I gave about ImageBuilder.

Quoted 6 lines

Now to answer the specific question. I am positive that the most common configuration for people that wants static memory is to have direct_map. That is because the two go hand-in-hand in configuration where the IOMMU is not used. So I think that from an ImageBuilder perspective direct_map should default to enabled when static memory is requested. It can always be disabled, both using DOMU_DIRECT_MAP, or editing boot.source.

Many thanks for the explanation. This makes sense.

I think this patch can be dropped then.

Xenia, apologies for suggesting you to do this in the first place.

- Ayan

Quoted 63 lines
Quoted 63 lines
Quoted 63 lines

I cc Ayan, since the change was suggested by him.
I have no strong preference on the default value.

Xenia

Quoted 56 lines
Quoted 56 lines
---
   README.md                | 4 ++--
   scripts/uboot-script-gen | 8 ++------
   2 files changed, 4 insertions(+), 8 deletions(-)
README.md +0 -0
index cb15ca5..03e437b 100644
@@ -169,8 +169,8 @@ Where:
     if specified, indicates the host physical address regions
     [baseaddr, baseaddr + size) to be reserved to the VM for static

allocation.
  -- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
-  If set to 1, the VM is direct mapped. The default is 1. +- DOMU_DIRECT_MAP[number] if set to 1, enables direct mapping. +  By default, direct mapping is disabled.
    This is only applicable when DOMU_STATIC_MEM is specified.
    - LINUX is optional but specifies the Linux kernel for when Xen is
NOT

scripts/uboot-script-gen +2 -6
index 085e29f..66ce6f7 100755
@@ -52,7 +52,7 @@ function dt_set()
               echo "fdt set $path $var $array" >> $UBOOT_SOURCE
           elif test $data_type = "bool"
           then
-            if test "$data" -eq 1
+            if test "$data" == "1"
               then
                   echo "fdt set $path $var" >> $UBOOT_SOURCE
               fi
@@ -74,7 +74,7 @@ function dt_set()
               fdtput $FDTEDIT -p -t s $path $var $data
           elif test $data_type = "bool"
           then
-            if test "$data" -eq 1
+            if test "$data" == "1"
               then
                   fdtput $FDTEDIT -p $path $var
               fi
@@ -491,10 +491,6 @@ function xen_config()
           then
               DOMU_CMD[$i]="console=ttyAMA0"
           fi
-        if test -z "${DOMU_DIRECT_MAP[$i]}"
-        then
-             DOMU_DIRECT_MAP[$i]=1
-        fi
           i=$(( $i + 1 ))
       done
   }
Signature · 1 line
2.34.1
author
#8 lore raw

Re: [PATCH 2/2] uboot-script-gen: do not enable direct mapping by default

Hi Ayan,

Quoted 41 lines · Ayan Kumar Halder
Quoted 32 lines · Stefano Stabellini
Quoted 16 lines · Ayan Kumar Halder

Hi Stefano/Xenia,

Quoted 13 lines · xenia

Hi Stefano,

Quoted 10 lines · Stefano Stabellini
Quoted 5 lines · Xenia Ragiadakou

To be inline with XEN, do not enable direct mapping automatically for all
statically allocated domains.

Actually I don't know about this one. I think it is OK that ImageBuilder defaults are different from Xen defaults. This is a case where I think it would be good to enable DOMU_DIRECT_MAP by default when DOMU_STATIC_MEM is specified.

Quoted 5 lines
Quoted 2 lines

Just realized that I forgot to add [ImageBuilder] tag to the patches. Sorry about that.

@Stefano, why do you wish the Imagebuilder's behaviour to differ from Xen ? Is
there any use-case that helps.

As background, ImageBuilder is meant to be very simple to use especially for the most common configurations. In fact, I think ImageBuilder doesn't necessarely have to support all the options that Xen offers, only the most common and important.

If someone wants an esoteric option, they can always edit the generated boot.source and make any necessary changes. I make sure to explain that editing boot.source is always a possibility in all the talks I gave about ImageBuilder.

Quoted 6 lines

Now to answer the specific question. I am positive that the most common configuration for people that wants static memory is to have direct_map. That is because the two go hand-in-hand in configuration where the IOMMU is not used. So I think that from an ImageBuilder perspective direct_map should default to enabled when static memory is requested. It can always be disabled, both using DOMU_DIRECT_MAP, or editing boot.source.

Quoted 5 lines

Many thanks for the explanation. This makes sense.

I think this patch can be dropped then.

Xenia, apologies for suggesting you to do this in the first place.

No worries, it 's all part of the process :)

Quoted 64 lines

- Ayan

Quoted 62 lines
Quoted 62 lines
Quoted 62 lines

I cc Ayan, since the change was suggested by him.
I have no strong preference on the default value.

Xenia

Quoted 56 lines
Quoted 56 lines

---
   README.md                | 4 ++--
   scripts/uboot-script-gen | 8 ++------

   2 files changed, 4 insertions(+), 8 deletions(-)
README.md +0 -0
index cb15ca5..03e437b 100644
@@ -169,8 +169,8 @@ Where:

     if specified, indicates the host physical address regions [baseaddr, baseaddr + size) to be reserved to the VM for static allocation.
   -- DOMU_DIRECT_MAP[number] can be set to 1 or 0.
-  If set to 1, the VM is direct mapped. The default is 1. +- DOMU_DIRECT_MAP[number] if set to 1, enables direct mapping. +  By default, direct mapping is disabled.
     This is only applicable when DOMU_STATIC_MEM is specified.
     - LINUX is optional but specifies the Linux kernel for when Xen is NOT

scripts/uboot-script-gen +0 -0
index 085e29f..66ce6f7 100755
@@ -52,7 +52,7 @@ function dt_set()

               echo "fdt set $path $var $array" >> $UBOOT_SOURCE elif test $data_type = "bool"
           then
-            if test "$data" -eq 1
+            if test "$data" == "1"
               then
                   echo "fdt set $path $var" >> $UBOOT_SOURCE fi

scripts/uboot-script-gen +0 -0
@@ -74,7 +74,7 @@ function dt_set()

               fdtput $FDTEDIT -p -t s $path $var $data elif test $data_type = "bool"
           then
-            if test "$data" -eq 1
+            if test "$data" == "1"
               then
                   fdtput $FDTEDIT -p $path $var fi

scripts/uboot-script-gen +0 -0
@@ -491,10 +491,6 @@ function xen_config()

           then
               DOMU_CMD[$i]="console=ttyAMA0"
           fi
-        if test -z "${DOMU_DIRECT_MAP[$i]}"
-        then
-             DOMU_DIRECT_MAP[$i]=1
-        fi
           i=$(( $i + 1 ))
       done
   }

Signature · 1 line
2.34.1
Reviewed-by on v1 1/2
#9 lore raw
In reply to Xenia Ragiadakou
Quoted 11 lines · Xenia Ragiadakou

Before enabling true dom0less configuration, the script was failing instantly if DOM0_KERNEL parameter was not specified. This behaviour has changed and this needs to be communicated to the user.

Mention in README.md that for dom0less configurations, the parameter DOM0_KERNEL is optional.

If DOM0_KERNEL is not set, check that no other dom0 specific parameters are specified by the user. Fail the script early with an appropriate error message, if it was invoked with erroneous configuration settings.

Quoted 5 lines

Change message "Dom0 kernel is not specified, continue with dom0less setup." to "Dom0 kernel is not specified, continue with true dom0less setup." to refer more accurately to a dom0less setup without dom0.

Quoted 56 lines
---
  README.md                |  1 +
  scripts/uboot-script-gen | 21 ++++++++++++++-------
  2 files changed, 15 insertions(+), 7 deletions(-)
README.md +1 -0
index 17ff206..cb15ca5 100644
@@ -100,6 +100,7 @@ Where:
    been specified in XEN_PASSTHROUGH_PATHS.
 
  - DOM0_KERNEL specifies the Dom0 kernel file to load.
+  For dom0less configurations, the parameter is optional.
 
  - DOM0_MEM specifies the amount of memory for Dom0 VM in MB. The default
    is 1024. This is only applicable when XEN_CMD is not specified.
scripts/uboot-script-gen +14 -7
index e85c6ec..085e29f 100755
@@ -410,6 +410,20 @@ function find_root_dev()
 
  function xen_config()
  {
+    if test -z "$DOM0_KERNEL"
+    then
+        if test "$NUM_DOMUS" -eq "0"
+        then
+            echo "Neither dom0 or domUs are specified, exiting."
+            exit 1
+        elif test "$DOM0_MEM" || test "$DOM0_VCPUS" || test "$DOM0_COLORS" || test "$DOM0_CMD" || test "$DOM0_RAMDISK" || test "$DOM0_ROOTFS"
+        then
+            echo "For dom0less configuration without dom0, no dom0 specific parameters should be specified, exiting."
+            exit 1
+        fi
+        echo "Dom0 kernel is not specified, continue with true dom0less setup."
+    fi
+
      if [ -z "$XEN_CMD" ]
      then
          if [ -z "$DOM0_MEM" ]
@@ -457,13 +471,6 @@ function xen_config()
      fi
      if test -z "$DOM0_KERNEL"
      then
-        if test "$NUM_DOMUS" -eq "0"
-        then
-            echo "Neither dom0 or domUs are specified, exiting."
-            exit 1
-        fi
-        echo "Dom0 kernel is not specified, continue with dom0less setup."
-        unset DOM0_RAMDISK
          # Remove dom0 specific parameters from the XEN command line.
          local params=($XEN_CMD)
          XEN_CMD="${params[@]/dom0*/}"
Reviewed-by on v1 1/2
#10 lore raw
In reply to Xenia Ragiadakou
Quoted 11 lines · Xenia Ragiadakou

Before enabling true dom0less configuration, the script was failing instantly if DOM0_KERNEL parameter was not specified. This behaviour has changed and this needs to be communicated to the user.

Mention in README.md that for dom0less configurations, the parameter DOM0_KERNEL is optional.

If DOM0_KERNEL is not set, check that no other dom0 specific parameters are specified by the user. Fail the script early with an appropriate error message, if it was invoked with erroneous configuration settings.

Quoted 5 lines

Change message "Dom0 kernel is not specified, continue with dom0less setup." to "Dom0 kernel is not specified, continue with true dom0less setup." to refer more accurately to a dom0less setup without dom0.

Quoted 59 lines
---
 README.md                |  1 +
 scripts/uboot-script-gen | 21 ++++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)
README.md +1 -0
index 17ff206..cb15ca5 100644
@@ -100,6 +100,7 @@ Where:
   been specified in XEN_PASSTHROUGH_PATHS.
 
 - DOM0_KERNEL specifies the Dom0 kernel file to load.
+  For dom0less configurations, the parameter is optional.
 
 - DOM0_MEM specifies the amount of memory for Dom0 VM in MB. The default
   is 1024. This is only applicable when XEN_CMD is not specified.
scripts/uboot-script-gen +14 -7
index e85c6ec..085e29f 100755
@@ -410,6 +410,20 @@ function find_root_dev()
 
 function xen_config()
 {
+    if test -z "$DOM0_KERNEL"
+    then
+        if test "$NUM_DOMUS" -eq "0"
+        then
+            echo "Neither dom0 or domUs are specified, exiting."
+            exit 1
+        elif test "$DOM0_MEM" || test "$DOM0_VCPUS" || test "$DOM0_COLORS" || test "$DOM0_CMD" || test "$DOM0_RAMDISK" || test "$DOM0_ROOTFS"
+        then
+            echo "For dom0less configuration without dom0, no dom0 specific parameters should be specified, exiting."
+            exit 1
+        fi
+        echo "Dom0 kernel is not specified, continue with true dom0less setup."
+    fi
+
     if [ -z "$XEN_CMD" ]
     then
         if [ -z "$DOM0_MEM" ]
@@ -457,13 +471,6 @@ function xen_config()
     fi
     if test -z "$DOM0_KERNEL"
     then
-        if test "$NUM_DOMUS" -eq "0"
-        then
-            echo "Neither dom0 or domUs are specified, exiting."
-            exit 1
-        fi
-        echo "Dom0 kernel is not specified, continue with dom0less setup."
-        unset DOM0_RAMDISK
         # Remove dom0 specific parameters from the XEN command line.
         local params=($XEN_CMD)
         XEN_CMD="${params[@]/dom0*/}"
Signature · 1 line
2.34.1