From nobody Sun May 19 08:26:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1655373480; cv=none; d=zohomail.com; s=zohoarc; b=mUHsVUptVVZHr00ZwQcXnjgEtrqSkcbu0HFYc2ez4ANWqEU2mC5CrJY2krn5YJfTzAQ60wECPcBF8SvbprsjRRWjN4tpK7uoch/+hQqD9CWRXuU2KPmP+CU5UPJY9JXqSoWocvqkV5VizTwVmb6bWH3NiL/57pGKI5RNsao+M60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655373480; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=4yF/dBZvUdI7jPmuRQj/KahNk9taCdE/KQDKfwzRreY=; b=CM9KPLSJkm7Vjq8sM03F1RGcQDinJVuPv+qa5PafxoLslj2B+1lHMyx9Tf3KLApR/2IE2DxCzBscqoNTHSMCPHc6nGjQrnxzHo4k6qQ/Ar4MlXPOFd6DSjJDNRyjEKH4P1uYrfFE/6YK1OrZ0LVYTU5tdfw8lDi1Qw3I7ukxCRM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655373480852842.5883434083025; Thu, 16 Jun 2022 02:58:00 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.350514.576877 (Exim 4.92) (envelope-from ) id 1o1mFu-0002Al-0J; Thu, 16 Jun 2022 09:57:38 +0000 Received: by outflank-mailman (output) from mailman id 350514.576877; Thu, 16 Jun 2022 09:57:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o1mFt-0002Ae-TX; Thu, 16 Jun 2022 09:57:37 +0000 Received: by outflank-mailman (input) for mailman id 350514; Thu, 16 Jun 2022 09:57:36 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o1mFs-0002AY-AG for xen-devel@lists.xenproject.org; Thu, 16 Jun 2022 09:57:36 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bd99c3ee-ed5a-11ec-ab14-113154c10af9; Thu, 16 Jun 2022 11:57:35 +0200 (CEST) Received: by mail-ed1-x532.google.com with SMTP id g7so1456214eda.3 for ; Thu, 16 Jun 2022 02:57:32 -0700 (PDT) Received: from uni.. (adsl-190.37.6.169.tellas.gr. [37.6.169.190]) by smtp.googlemail.com with ESMTPSA id n22-20020a1709065e1600b0070b1ecdc12bsm568285eju.112.2022.06.16.02.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 02:57:31 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: bd99c3ee-ed5a-11ec-ab14-113154c10af9 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=4yF/dBZvUdI7jPmuRQj/KahNk9taCdE/KQDKfwzRreY=; b=NiFREroozi+yeGJILk2A376YU2UvEatLQBh1WJdrfYNAy6AO5371RsixdtawB4yP4A W41rYxKt5aGiO7fGIOi3dgHgP5vUq1SCWnSkVzAHEo7Sv2k4zWYt2p+2MJ1fBLIDoml1 +l6CRJF1jJpXjVl3tbgxbaqOPZHOTJoM2Mzt5GdhzDR2TFP84i1cbBS9S4v2uK6BRu3d FAIyFhV004exrYlQNO+Qv09TLy5z0NC1YbYrxuzk+QIigWwVJUlvbjOMgwuTCOk/Uz9q Aqt8NkeNyyZGCd4zQz5sOSq1Jp5AtgiR4APZiMxhb6T4T7zahpgrn/13PhPy51vGsDa2 aUMw== 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=4yF/dBZvUdI7jPmuRQj/KahNk9taCdE/KQDKfwzRreY=; b=6UZVCjQV56gW8CIUai1ih3xKJk3GhYfuLmnJMfZKpkqaLNkV8au9f44Zetx9nX6zaf w+zW07Zw1N9tPC4w6a3rt/OE+W1HJyJEMMJeoTsnZDd5ElR9SN8Go9eibs/u5At6VGZh d3NzACOaJxxIPnaPTgoNpZQsm6nsFkEAq825sm+JqEGwqEFxrFDkUeyAAZv56IsnXk+F erULoHmiHh/dOirNTG0jy3t7p9+CiTvl0Od87lnO+xl95XR+x+3i8LW5btX0E8XxUTRA K1XuQ4Cq7F4Yw15jJpVPBNFwKSMILA2ky/CRZfWcCcJvFpldG7iuYD/8+kFpGjGUFJ7X GBDg== X-Gm-Message-State: AJIora9Y0qRTPaRkGjr5x3EDhM0dykACu0aeQH7+3mxSRe6eVxyMO7lU tmSYrJivcdKtY968h8+tWwxl6bkN+cc= X-Google-Smtp-Source: AGRyM1tl9OemBVv83q1e06HFaXP3z3u2SIDqEiy486RImFNK3Jc7opTNHnQfhZbMK63W66WJ+xIYcg== X-Received: by 2002:a05:6402:a4f:b0:42d:db40:f685 with SMTP id bt15-20020a0564020a4f00b0042ddb40f685mr5335455edb.384.1655373451905; Thu, 16 Jun 2022 02:57:31 -0700 (PDT) From: Xenia Ragiadakou To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, viryaos-discuss@lists.sourceforge.net Subject: [ImageBuilder] [PATCH v3] uboot-script-gen: Add DOMU_STATIC_MEM Date: Thu, 16 Jun 2022 12:56:39 +0300 Message-Id: <20220616095639.305510-1-burzalodowa@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1655373482720100001 Content-Type: text/plain; charset="utf-8" Add a new config parameter to configure a dom0less VM with static allocatio= n. DOMU_STATIC_MEM[number]=3D"baseaddr1 size1 ... baseaddrN sizeN" The parameter specifies the host physical address regions to be statically allocated to the VM. Each region is defined by its start address and size. For instance, DOMU_STATIC_MEM[0]=3D"0x30000000 0x10000000 0x50000000 0x20000000" indicates that the host memory regions [0x30000000, 0x40000000) and [0x50000000, 0x70000000) are statically allocated to the first dom0less VM. Since currently it is not possible for a VM to have a mix of both statically and non-statically allocated memory regions, when DOMU_STATIC_MEM is specif= ied, adjust VM's memory size to equal the amount of statically allocated memory. Signed-off-by: Xenia Ragiadakou --- Changes in v2 - in add_device_tree_static_mem(), replace 'i' with 'val' because variable = 'i' is already in use as an index Changes in v3 - fix indentation - in add_device_tree_static_mem(), declare 'cells' and 'val' variables local to not mess up any global variables by accident - add a new function add_device_tree_mem() responsible for setting up the memory property in the device tree, as well as for adjusting the memory size accordingly when static mem is specified README.md | 4 ++++ scripts/uboot-script-gen | 48 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ce13f0..876e46d 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,10 @@ Where: automatically at boot as dom0-less guest. It can still be created later from Dom0. =20 +- DOMU_STATIC_MEM[number]=3D"baseaddr1 size1 ... baseaddrN sizeN" + if specified, indicates the host physical address regions + [baseaddr, baseaddr + size) to be reserved to the VM for static allocati= on. + - 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 0adf523..7781714 100755 --- a/scripts/uboot-script-gen +++ b/scripts/uboot-script-gen @@ -108,6 +108,48 @@ function add_device_tree_passthrough() dt_set "$path/module$addr" "reg" "hex" "0x0 $addr 0x0 $(printf "0x%x"= $size)" } =20 +function add_device_tree_mem() +{ + local path=3D$1 + local memory=3D$2 + + # When the DOMU is configured with static allocation, + # the size of DOMU's memory must match the size of DOMU's static memor= y. + if test "${DOMU_STATIC_MEM[$i]}" + then + local array=3D(${DOMU_STATIC_MEM[$i]}) + local index + + memory=3D0 + for (( index=3D1; index<${#array[@]}; index+=3D2 )) + do + (( memory +=3D ${array[$index]} )) + done + # The property "memory" is in KB. + (( memory >>=3D 10 )) + fi + + dt_set "$path" "memory" "int" "0 $memory" +} + +function add_device_tree_static_mem() +{ + local path=3D$1 + local regions=3D$2 + local cells=3D() + local val + + dt_set "$path" "#xen,static-mem-address-cells" "hex" "0x2" + dt_set "$path" "#xen,static-mem-size-cells" "hex" "0x2" + + for val in ${regions[@]} + do + cells+=3D("$(printf "0x%x 0x%x" $(($val >> 32)) $(($val & ((1 << 3= 2) - 1))))") + done + + dt_set "$path" "xen,static-mem" "hex" "${cells[*]}" +} + function xen_device_tree_editing() { dt_set "/chosen" "#address-cells" "hex" "0x2" @@ -141,8 +183,12 @@ function xen_device_tree_editing() dt_set "/chosen/domU$i" "compatible" "str" "xen,domain" dt_set "/chosen/domU$i" "#address-cells" "hex" "0x2" dt_set "/chosen/domU$i" "#size-cells" "hex" "0x2" - dt_set "/chosen/domU$i" "memory" "int" "0 ${DOMU_MEM[$i]}" + add_device_tree_mem "/chosen/domU$i" ${DOMU_MEM[$i]} dt_set "/chosen/domU$i" "cpus" "int" "${DOMU_VCPUS[$i]}" + if test "${DOMU_STATIC_MEM[$i]}" + then + add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM= [$i]}" + fi dt_set "/chosen/domU$i" "vpl011" "hex" "0x1" add_device_tree_kernel "/chosen/domU$i" ${domU_kernel_addr[$i]} ${= domU_kernel_size[$i]} "${DOMU_CMD[$i]}" if test "${domU_ramdisk_addr[$i]}" --=20 2.34.1