All of lore.kernel.org
 help / color / mirror / Atom feed
From: Penny Zheng <Penny.Zheng@arm.com>
To: xen-devel@lists.xenproject.org
Cc: wei.chen@arm.com, Penny Zheng <Penny.Zheng@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Wei Liu <wl@xen.org>,
	Penny Zheng <penny.zheng@arm.com>,
	Julien Grall <jgrall@amazon.com>
Subject: [PATCH v10 5/9] xen/arm: introduce CDF_staticmem
Date: Tue, 16 Aug 2022 10:36:54 +0800	[thread overview]
Message-ID: <20220816023658.3551936-6-Penny.Zheng@arm.com> (raw)
In-Reply-To: <20220816023658.3551936-1-Penny.Zheng@arm.com>

In order to have an easy and quick way to find out whether this domain memory
is statically configured, this commit introduces a new flag CDF_staticmem and a
new helper is_domain_using_staticmem() to tell.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
Acked-by: Julien Grall <jgrall@amazon.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
v10 changes:
- no change
---
v9 changes:
- no change
---
v8 changes:
- #ifdef-ary around is_domain_using_staticmem() is not needed anymore
---
v7 changes:
- IS_ENABLED(CONFIG_STATIC_MEMORY) would not be needed anymore
---
v6 changes:
- move non-zero is_domain_using_staticmem() from ARM header to common
header
---
v5 changes:
- guard "is_domain_using_staticmem" under CONFIG_STATIC_MEMORY
- #define is_domain_using_staticmem zero if undefined
---
v4 changes:
- no changes
---
v3 changes:
- change name from "is_domain_static()" to "is_domain_using_staticmem"
---
v2 changes:
- change name from "is_domain_on_static_allocation" to "is_domain_static()
---
 xen/arch/arm/domain_build.c | 5 ++++-
 xen/include/xen/domain.h    | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 3fd1186b53..b76a84e8f5 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -3287,9 +3287,12 @@ void __init create_domUs(void)
         if ( !dt_device_is_compatible(node, "xen,domain") )
             continue;
 
+        if ( dt_find_property(node, "xen,static-mem", NULL) )
+            flags |= CDF_staticmem;
+
         if ( dt_property_read_bool(node, "direct-map") )
         {
-            if ( !IS_ENABLED(CONFIG_STATIC_MEMORY) || !dt_find_property(node, "xen,static-mem", NULL) )
+            if ( !(flags & CDF_staticmem) )
                 panic("direct-map is not valid for domain %s without static allocation.\n",
                       dt_node_name(node));
 
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index 628b14b086..2c8116afba 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -35,6 +35,14 @@ void arch_get_domain_info(const struct domain *d,
 /* Should domain memory be directly mapped? */
 #define CDF_directmap            (1U << 1)
 #endif
+/* Is domain memory on static allocation? */
+#ifdef CONFIG_STATIC_MEMORY
+#define CDF_staticmem            (1U << 2)
+#else
+#define CDF_staticmem            0
+#endif
+
+#define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem)
 
 /*
  * Arch-specifics.
-- 
2.25.1



  parent reply	other threads:[~2022-08-16  2:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  2:36 [PATCH v10 0/9] populate/unpopulate memory when domain on static allocation Penny Zheng
2022-08-16  2:36 ` [PATCH v10 1/9] xen/arm: rename PGC_reserved to PGC_static Penny Zheng
2022-08-16  2:36 ` [PATCH v10 2/9] xen: do not free reserved memory into heap Penny Zheng
2022-08-16  6:40   ` Jan Beulich
2022-08-24  9:03     ` Julien Grall
2022-08-24  9:27       ` Juergen Gross
2022-08-24  9:31         ` Julien Grall
2022-08-24  9:38           ` Juergen Gross
2022-08-24 10:42       ` Jan Beulich
2022-08-16  2:36 ` [PATCH v10 3/9] xen: do not merge reserved pages in free_heap_pages() Penny Zheng
2022-08-16  2:36 ` [PATCH v10 4/9] xen: add field "flags" to cover all internal CDF_XXX Penny Zheng
2022-08-16  2:36 ` Penny Zheng [this message]
2022-08-16  2:36 ` [PATCH v10 6/9] xen: unpopulate memory when domain is static Penny Zheng
2022-08-17  8:51   ` Jan Beulich
2022-08-24  9:12   ` Julien Grall
2022-08-16  2:36 ` [PATCH v10 7/9] xen: introduce prepare_staticmem_pages Penny Zheng
2022-08-16  2:36 ` [PATCH v10 8/9] xen: retrieve reserved pages on populate_physmap Penny Zheng
2022-08-17 10:04   ` Jan Beulich
2022-09-05  7:08     ` Penny Zheng
2022-09-06  6:33       ` Jan Beulich
2022-09-06  7:14         ` Penny Zheng
2022-09-06  7:19           ` Jan Beulich
2022-08-16  2:36 ` [PATCH v10 9/9] xen: rename free_staticmem_pages to unprepare_staticmem_pages Penny Zheng
2022-08-17 10:07   ` Jan Beulich
2022-08-24  9:54 ` [PATCH v10 0/9] populate/unpopulate memory when domain on static allocation Julien Grall

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=20220816023658.3551936-6-Penny.Zheng@arm.com \
    --to=penny.zheng@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgrall@amazon.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wei.chen@arm.com \
    --cc=wl@xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.