From: Julien Grall <julien@xen.org>
To: Penny Zheng <penny.zheng@arm.com>,
xen-devel@lists.xenproject.org, sstabellini@kernel.org
Cc: Bertrand.Marquis@arm.com, Wei.Chen@arm.com, nd@arm.com
Subject: Re: [PATCH V4 09/10] xen/arm: check "xen,static-mem" property during domain construction
Date: Fri, 13 Aug 2021 14:12:15 +0100 [thread overview]
Message-ID: <bf4f8cb1-b8c1-a8f5-0aa4-1616cf161f2b@xen.org> (raw)
In-Reply-To: <20210728102758.3269446-10-penny.zheng@arm.com>
Hi,
On 28/07/2021 11:27, Penny Zheng wrote:
> 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.
I think the code is small enough to fold it in patch #10. In fact...
>
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>
> ---
> 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;
You don't need those information outside of allocate_static_memory(). So
I think it would be best to move the code in that function.
> +
> + /*
> + * 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");
We don't split comment over multi-line (even they are more than 80
characters). This is to help grep message in the code.
Although for this one I would replaced "Error building Domu:" with
simply with the domain ID (you can use %pd and 'd'). The caller will
then print there was an error during building.
> + 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");
My remark applies here as well.
> + return -EINVAL;
> + }
> +
> + BUG_ON(static_mem_size_cells > 2 || static_mem_addr_cells > 2);
Did we validate the DT before hand? If not, then I think
> + }
>
> 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 )
With my suggestion above, the check can be replaced with:
if ( !dt_find_property(node, "xen,static-mem", NULL) )
> + allocate_memory(d, &kinfo);
> + else
> + /* TODO: allocate_static_memory(...). */
> + BUG();
>
> rc = prepare_dtb_domU(d, &kinfo);
> if ( rc < 0 )
>
Cheers,
--
Julien Grall
next prev parent reply other threads:[~2021-08-13 13:12 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-28 10:27 [PATCH V4 00/10] Domain on Static Allocation Penny Zheng
2021-07-28 10:27 ` [PATCH V4 01/10] xen/arm: introduce domain " Penny Zheng
2021-08-11 13:32 ` Julien Grall
2021-08-16 5:21 ` Penny Zheng
2021-08-16 17:27 ` Julien Grall
2021-08-17 2:28 ` Penny Zheng
2021-07-28 10:27 ` [PATCH V4 02/10] xen/arm: introduce new helper device_tree_get_meminfo Penny Zheng
2021-08-11 13:35 ` Julien Grall
2021-08-16 5:27 ` Penny Zheng
2021-07-28 10:27 ` [PATCH V4 03/10] xen/arm: handle static memory in dt_unreserved_regions Penny Zheng
2021-08-11 13:48 ` Julien Grall
2021-08-16 6:00 ` Penny Zheng
2021-08-16 17:33 ` Julien Grall
2021-07-28 10:27 ` [PATCH V4 04/10] xen: introduce mark_page_free Penny Zheng
2021-08-11 14:08 ` Julien Grall
2021-07-28 10:27 ` [PATCH V4 05/10] xen/arm: static memory initialization Penny Zheng
2021-08-04 15:54 ` Jan Beulich
2021-08-13 12:20 ` Julien Grall
2021-08-16 6:12 ` Penny Zheng
2021-08-13 12:38 ` Julien Grall
2021-08-16 7:00 ` Wei Chen
2021-07-28 10:27 ` [PATCH V4 06/10] xen/arm: introduce PGC_reserved Penny Zheng
2021-08-13 12:21 ` Julien Grall
2021-08-16 6:13 ` Penny Zheng
2021-07-28 10:27 ` [PATCH V4 07/10] xen: re-define assign_pages and introduce assign_page Penny Zheng
2021-08-05 6:34 ` Jan Beulich
2021-08-13 12:27 ` Julien Grall
2021-08-13 12:32 ` Jan Beulich
2021-08-17 8:21 ` Penny Zheng
2021-07-28 10:27 ` [PATCH V4 08/10] xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages Penny Zheng
2021-08-05 6:52 ` Jan Beulich
2021-08-13 13:00 ` Julien Grall
2021-08-16 6:43 ` Penny Zheng
2021-08-16 17:43 ` Julien Grall
2021-08-17 2:33 ` Penny Zheng
2021-07-28 10:27 ` [PATCH V4 09/10] xen/arm: check "xen,static-mem" property during domain construction Penny Zheng
2021-08-13 13:12 ` Julien Grall [this message]
2021-08-16 6:53 ` Penny Zheng
2021-07-28 10:27 ` [PATCH V4 10/10] xen/arm: introduce allocate_static_memory Penny Zheng
2021-08-13 13:36 ` Julien Grall
2021-08-16 7:51 ` Penny Zheng
2021-08-16 17:55 ` Julien Grall
2021-08-17 2:36 ` Penny Zheng
2021-07-28 10:27 ` [PATCH V4 04/10] xen: introduce mark_page_free Penny Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bf4f8cb1-b8c1-a8f5-0aa4-1616cf161f2b@xen.org \
--to=julien@xen.org \
--cc=Bertrand.Marquis@arm.com \
--cc=Wei.Chen@arm.com \
--cc=nd@arm.com \
--cc=penny.zheng@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).