From patchwork Sun Jun 19 12:43:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 12886641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3EA5FC43334 for ; Sun, 19 Jun 2022 12:44:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.352154.578878 (Exim 4.92) (envelope-from ) id 1o2uH9-0001dl-RM; Sun, 19 Jun 2022 12:43:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 352154.578878; Sun, 19 Jun 2022 12:43:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o2uH9-0001de-Oj; Sun, 19 Jun 2022 12:43:35 +0000 Received: by outflank-mailman (input) for mailman id 352154; Sun, 19 Jun 2022 12:43:33 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o2uH7-0001dY-RU for xen-devel@lists.xenproject.org; Sun, 19 Jun 2022 12:43:33 +0000 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [2a00:1450:4864:20::62b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6d3521fb-efcd-11ec-bd2d-47488cf2e6aa; Sun, 19 Jun 2022 14:43:32 +0200 (CEST) Received: by mail-ej1-x62b.google.com with SMTP id h23so16360810ejj.12 for ; Sun, 19 Jun 2022 05:43:32 -0700 (PDT) Received: from uni.. (adsl-190.37.6.169.tellas.gr. [37.6.169.190]) by smtp.googlemail.com with ESMTPSA id b9-20020a17090630c900b006feba31171bsm4602659ejb.11.2022.06.19.05.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 05:43:31 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 6d3521fb-efcd-11ec-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CS7wHEgbN/XsLDJgzi/19eu8SiPOp/J5RpTdMpBDJdA=; b=EMNeEY8rLc23qGQmjjJ5BFqADCmKnTpLa0xdCmjd2B9L6SzxRTpAQsdrXg1kkh3WBv ZzZ7tG+llGz+MW1n2v239yLazmVz8/bTrGudujcq0h1udjl1SE9MRyD16hDBgV4hl9m9 R7j2NVu3/k5394K0h3xYgp8J129j1wM0a1QnQf/jDGl2nhUkkYfXpNZa9+/nI0OvV8Jo MpeAnZFohq2noOd+zTdciwXnMqxw7hV+v+H/PPRoYYZ3Z1yfJaw7jMG6vYF7eyIZ/UUe 8jaBAmAIYIQPHFxAmoDRGNhA+ru/fgMucDoREUu8Hk5e70lWkczi33DmYODOvnUONapm vOEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=CS7wHEgbN/XsLDJgzi/19eu8SiPOp/J5RpTdMpBDJdA=; b=St1azipwATxBdQTTYOOzBFpMMPSIqunDW85me9CVG/mebwwZI+6vihTlAsEYVer6EJ ftMBRrJ5KPcmYM98xxF+Y1t+16QF2F7rEXP21AlXMW9/22S+IppFkNjhOLOiFkUYWOqQ V8zh+yqh5FRPRu02wEAxBBXsDYoRc2gcOYYBD6qCoEyHeb9h4zGpulLTM3N1BYKxaqv1 Mo8E5x2L/lq9FQkxwFeGvWqAnQOyt7qzUefXcylti+Fh2gmZemMXpbE0PotYCro7wsWj E9YKfqmJ/LpIPxBZ/8tmf9fDYl2e8XDgLguwLDIArMrO15BmtBR2adq3ZCHsyq2HmPXP C+nQ== X-Gm-Message-State: AJIora9E7fVXVSoNDV2bS6rudDpOXkQkSN0jBXYQcojZpBdv2vFriNoB zT4zR+JHp+F/kNASaMq8sH0jnnSjc+k= X-Google-Smtp-Source: AGRyM1vSS2u2BGatiyktffiPRe1xvubluqHFA/6ivxwHJPxGXAxGWgJmzCaXYdYVFH9NyzTThezW+w== X-Received: by 2002:a17:906:74d8:b0:712:b97:f14f with SMTP id z24-20020a17090674d800b007120b97f14fmr16313471ejl.112.1655642611717; Sun, 19 Jun 2022 05:43:31 -0700 (PDT) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, viryaos-discuss@lists.sourceforge.net, Xenia Ragiadakou Subject: [ImageBuilder] [PATCH 1/2] uboot-script-gen: Skip dom0 instead of exiting if DOM0_KERNEL is not set Date: Sun, 19 Jun 2022 15:43:15 +0300 Message-Id: <20220619124316.378365-1-burzalodowa@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 When the parameter DOM0_KERNEL is not specified and NUM_DOMUS is not 0, instead of failing the script, just skip any dom0 specific setup. This way the script can be used to boot XEN in dom0less mode. Signed-off-by: Xenia Ragiadakou Reviewed-by: Stefano Stabellini --- scripts/uboot-script-gen | 60 ++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index 455b4c0..bdc8a6b 100755 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -168,10 +168,15 @@ function xen_device_tree_editing() dt_set "/chosen" "#address-cells" "hex" "0x2" dt_set "/chosen" "#size-cells" "hex" "0x2" dt_set "/chosen" "xen,xen-bootargs" "str" "$XEN_CMD" - dt_mknode "/chosen" "dom0" - dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module" - dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf "0x%x" $dom0_kernel_size)" - dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" + + if test "$DOM0_KERNEL" + then + dt_mknode "/chosen" "dom0" + dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module" + dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf "0x%x" $dom0_kernel_size)" + dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD" + fi + if test "$DOM0_RAMDISK" && test $ramdisk_addr != "-" then dt_mknode "/chosen" "dom0-ramdisk" @@ -203,7 +208,10 @@ function xen_device_tree_editing() add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" fi dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" - dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled" + if test "$DOM0_KERNEL" + then + dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled" + fi if test "${DOMU_COLORS[$i]}" then @@ -433,6 +441,19 @@ function xen_config() DOM0_CMD="$DOM0_CMD root=$root_dev" fi 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*/}" + fi i=0 while test $i -lt $NUM_DOMUS do @@ -490,11 +511,13 @@ generate_uboot_images() xen_file_loading() { - check_compressed_file_type $DOM0_KERNEL "executable" - dom0_kernel_addr=$memaddr - load_file $DOM0_KERNEL "dom0_linux" - dom0_kernel_size=$filesize - + if test "$DOM0_KERNEL" + then + check_compressed_file_type $DOM0_KERNEL "executable" + dom0_kernel_addr=$memaddr + load_file $DOM0_KERNEL "dom0_linux" + dom0_kernel_size=$filesize + fi if test "$DOM0_RAMDISK" then check_compressed_file_type $DOM0_RAMDISK "cpio archive" @@ -597,14 +620,16 @@ bitstream_load_and_config() create_its_file_xen() { - if test "$ramdisk_addr" != "-" + if test "$DOM0_KERNEL" then - load_files="\"dom0_linux\", \"dom0_ramdisk\"" - else - load_files="\"dom0_linux\"" - fi - # xen below - cat >> "$its_file" <<- EOF + if test "$ramdisk_addr" != "-" + then + load_files="\"dom0_linux\", \"dom0_ramdisk\"" + else + load_files="\"dom0_linux\"" + fi + # xen below + cat >> "$its_file" <<- EOF dom0_linux { description = "dom0 linux kernel binary"; data = /incbin/("$DOM0_KERNEL"); @@ -616,6 +641,7 @@ create_its_file_xen() $fit_algo }; EOF + fi # domUs i=0 while test $i -lt $NUM_DOMUS From patchwork Sun Jun 19 12:43:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 12886642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A62DC433EF for ; Sun, 19 Jun 2022 12:44:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.352155.578889 (Exim 4.92) (envelope-from ) id 1o2uHH-0001u4-4G; Sun, 19 Jun 2022 12:43:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 352155.578889; Sun, 19 Jun 2022 12:43:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o2uHH-0001tx-11; Sun, 19 Jun 2022 12:43:43 +0000 Received: by outflank-mailman (input) for mailman id 352155; Sun, 19 Jun 2022 12:43:42 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o2uHG-0001dY-EM for xen-devel@lists.xenproject.org; Sun, 19 Jun 2022 12:43:42 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 72c43af4-efcd-11ec-bd2d-47488cf2e6aa; Sun, 19 Jun 2022 14:43:41 +0200 (CEST) Received: by mail-ed1-x52b.google.com with SMTP id ej4so7713417edb.7 for ; Sun, 19 Jun 2022 05:43:41 -0700 (PDT) Received: from uni.. (adsl-190.37.6.169.tellas.gr. [37.6.169.190]) by smtp.googlemail.com with ESMTPSA id b9-20020a17090630c900b006feba31171bsm4602659ejb.11.2022.06.19.05.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 05:43:40 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 72c43af4-efcd-11ec-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FjZNmxi+2WT8F5w+hlZIxGF+xmDyxTtCYBnFYEEitNo=; b=iwCNl++eIweW8fcKZ+9+ip7WKlT0EFV8s2Ho07eIdsHUuDn85ZGDbXcdOZHTLjJe5U lFDTISGPUkGip4D1d9J1WnSiPTenBnZcYJtpTg/MAIDNHcVl850/stNpY4NWfdxkU5Qk 0jqn4zqB689aNQ+6zzEyFG3xyE9ZcKl3quiVR8KWoTDOX1ySsDnyJgc2jZ9wKPaklnZN 9qDZ/GKYvLVSnH+qzukSNRv/XTbrUKyZhD9XYQ6GLAOEbObyoKn1wQHP34dofNn+5uDU 9ugpuoQvwcWZiBUNCp83fTzgjkGmc67AzqgqulzIZTO7m1iYMPSfOHGmr1nInsmVhN7k KtYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FjZNmxi+2WT8F5w+hlZIxGF+xmDyxTtCYBnFYEEitNo=; b=0K/bUyr4v+CLuLxboe1WEx1nyreohAtNWTj9Zmd60Npm9M1oByChsnJ/nkZ3x5TxAd OpkIMhFMS3yiEdTUZobeaQqtd7hg9ZnTInKO0nKg+lvNMbi3doxcIbVNe/9W+bGMH8MO PTE6xGEtXgljiha/Ifjq/rj73AcY2+GH1o2GVfCBwIfYJ1s9aUuIo5qGs45ZtqWk0J+1 y85NtsMd90P+CgNnxda7KztKmqBYUvnJo3zAFkvvM99O+9+JYnIsmoOSD1J6dbuBe1Ji rJGrrLm3Eyq7Di7EznJaHp0MXlRb9ioY+XDD4v/ieaMPIZF+RYDEuFdmWArF0rOFke3p M/zg== X-Gm-Message-State: AJIora+dR6TIzSHxc7yIj/GKUAKdtWXlrS/C+nBipbtulelcz3XQdIBM CwJSiLhef4cRbBgaqwksROfi5XvcoxA= X-Google-Smtp-Source: AGRyM1s+EnV1hRSzk8o7pv5EPl82xJMr9HVxhgKyCD3hsOOIbTnzSFUAlIo+abrnHJdIfQPZ1rfUwA== X-Received: by 2002:a05:6402:2706:b0:430:6238:78d5 with SMTP id y6-20020a056402270600b00430623878d5mr24049336edd.413.1655642621005; Sun, 19 Jun 2022 05:43:41 -0700 (PDT) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, viryaos-discuss@lists.sourceforge.net, Xenia Ragiadakou Subject: [ImageBuilder] [PATCH 2/2] uboot-script-gen: Enable direct mapping of statically allocated memory Date: Sun, 19 Jun 2022 15:43:16 +0300 Message-Id: <20220619124316.378365-2-burzalodowa@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220619124316.378365-1-burzalodowa@gmail.com> References: <20220619124316.378365-1-burzalodowa@gmail.com> MIME-Version: 1.0 Direct mapping for dom0less VMs is disabled by default in XEN and can be enabled through the 'direct-map' property. Add a new config parameter DOMU_DIRECT_MAP to be able to enable or disable direct mapping, i.e set to 1 for enabling and to 0 for disabling. This parameter is optional. Direct mapping is enabled by default for all dom0less VMs with static allocation. The property 'direct-map' is a boolean property. Boolean properties are true if present and false if missing. Add a new data_type 'bool' in function dt_set() to setup a boolean property. Signed-off-by: Xenia Ragiadakou Reviewed-by: Stefano Stabellini --- README.md | 4 ++++ scripts/uboot-script-gen | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/README.md b/README.md index c52e4b9..17ff206 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,10 @@ 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. + This is only applicable when DOMU_STATIC_MEM is specified. + - LINUX is optional but specifies the Linux kernel for when Xen is NOT used. To enable this set any LINUX\_\* variables and do NOT set the XEN variable. diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen index bdc8a6b..e85c6ec 100755 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -27,6 +27,7 @@ function dt_mknode() # hex # str # str_a +# bool function dt_set() { local path=$1 @@ -49,6 +50,12 @@ function dt_set() array+=" \"$element\"" done echo "fdt set $path $var $array" >> $UBOOT_SOURCE + elif test $data_type = "bool" + then + if test "$data" -eq 1 + then + echo "fdt set $path $var" >> $UBOOT_SOURCE + fi else echo "fdt set $path $var \"$data\"" >> $UBOOT_SOURCE fi @@ -65,6 +72,12 @@ function dt_set() elif test $data_type = "str_a" then fdtput $FDTEDIT -p -t s $path $var $data + elif test $data_type = "bool" + then + if test "$data" -eq 1 + then + fdtput $FDTEDIT -p $path $var + fi else fdtput $FDTEDIT -p -t s $path $var "$data" fi @@ -206,6 +219,7 @@ function xen_device_tree_editing() if test "${DOMU_STATIC_MEM[$i]}" then add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}" + dt_set "/chosen/domU$i" "direct-map" "bool" "${DOMU_DIRECT_MAP[$i]}" fi dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" if test "$DOM0_KERNEL" @@ -470,6 +484,10 @@ 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 }