[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH V3 09/10] xen/arm: check "xen,static-mem" property during domain construction


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>
  • From: Penny Zheng <penny.zheng@xxxxxxx>
  • Date: Thu, 15 Jul 2021 05:18:18 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CK13WEPiykjxkYvQEtnQO6uMs6AHKoPn7GF3CJWftbA=; b=F5z5Yth8ptdOpTv7sslxFhTvTiMkIKRZiF5Bab1W1TONYosMLrE2EOj9POHfYjLp0IhyaSca9Uv3bEV4s6znH2CGDAYJGytPnDHQSwzolU9UtUd2dRgP7MICUmQy4N2BDcIgqWBfyrN+O06uQl9ZLPgZcqhEddKKdD08h966KNA3w+Shk+62a43pWk0dZAUCK/k6fIcG7zAzqLXCLnpvv6nG0n/2a8vS4tnM/6WH65Hy6FxCUJ1egggkjrCo++1kYy0O1bI53nCvFVTZ2Ru9Jn/fthMe8oK5fyH03I31nsCTnY/3YJ8LQxf4nZ6mv9cgV6cA8o3hpM/wcLWAHtXvEQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fC7Uma5fVRKFWms6CLHOyyzsl9IqiGSwEJ4+7Qf5zK8pzxy+g/2oX4YAPmpKgffaGt7sdwBvTMjU4zDhLnvbS6xcjKClr89e6VCFWEea2Dt3BAMVHKJfhgd1In84qJ9fs+Pq/eqJbCQCvorpE5Qzm9YzbjwdyGAx9pL07akwDCrH6wG/Mr8U2JxTeUWc1Lbc2E1sTRft4hERRld69QsoRbz+5KFJX3UpQLqgaFnlVwm1+V32kHE1N1Qf6IwkYnA2ylFAfVGKBQfuelLMgtENTXWvyHQqIsxSocsI1kHQV5792M3v4lFFuqChPvX2PepSwgnCrEo/kat8DlGo5vi1Qg==
  • Cc: <Bertrand.Marquis@xxxxxxx>, <Penny.Zheng@xxxxxxx>, <Wei.Chen@xxxxxxx>, <jbeulich@xxxxxxxx>, <nd@xxxxxxx>
  • Delivery-date: Thu, 15 Jul 2021 05:26:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

This commit checks "xen,static-mem" device tree property in /domUx node,
to determine whether domain is on Static Allocation, when constructing
domain during boot-up.

Right now, the implementation of allocate_static_memory is missing, and
will be introduced later. It just BUG() out at the moment.

Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
---
v3 change:
- parse "xen,static-mem" in way of phandle back to property
- The return for dt_property_read_u32() shall be checked.
- "memory" property shall be mandatory
---
 xen/arch/arm/domain_build.c | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 6c86d52781..cdb16f2086 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2425,6 +2425,37 @@ static int __init construct_domU(struct domain *d,
     struct kernel_info kinfo = {};
     int rc;
     u64 mem;
+    const struct dt_property *static_mem_prop;
+    u32 static_mem_addr_cells, static_mem_size_cells;
+    bool static_mem = false;
+
+    /*
+     * Guest RAM could be static memory which will be specified through
+     * "xen,static-mem" property.
+     */
+    static_mem_prop = dt_find_property(node, "xen,static-mem", NULL);
+    if ( static_mem_prop )
+    {
+        static_mem = true;
+
+        if ( !dt_property_read_u32(node, "#xen,static-mem-address-cells",
+                                   &static_mem_addr_cells) )
+        {
+            printk("Error building DomU: cannot read "
+                   "\"#xen,static-mem-address-cells\" property\n");
+            return -EINVAL;
+        }
+
+        if ( !dt_property_read_u32(node, "#xen,static-mem-size-cells",
+                                   &static_mem_size_cells) )
+        {
+            printk("Error building DomU: cannot read "
+                   "\"#xen,static-mem-size-cells\" property\n");
+            return -EINVAL;
+        }
+
+        BUG_ON(static_mem_size_cells > 2 || static_mem_addr_cells > 2);
+    }
 
     rc = dt_property_read_u64(node, "memory", &mem);
     if ( !rc )
@@ -2452,7 +2483,11 @@ static int __init construct_domU(struct domain *d,
     /* type must be set before allocate memory */
     d->arch.type = kinfo.type;
 #endif
-    allocate_memory(d, &kinfo);
+    if ( !static_mem )
+        allocate_memory(d, &kinfo);
+    else
+        /* TODO: allocate_static_memory(...). */
+        BUG();
 
     rc = prepare_dtb_domU(d, &kinfo);
     if ( rc < 0 )
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.