From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org
Cc: edgar.iglesias@gmail.com, sstabellini@kernel.org,
jgross@suse.com, "Edgar E. Iglesias" <edgar.iglesias@amd.com>,
"David Hildenbrand" <david@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Anthony PERARD" <anthony@xenproject.org>,
"Paul Durrant" <paul@xen.org>,
xen-devel@lists.xenproject.org
Subject: [PATCH v8 3/8] xen: Add xen_mr_is_memory()
Date: Wed, 29 May 2024 16:07:34 +0200 [thread overview]
Message-ID: <20240529140739.1387692-4-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <20240529140739.1387692-1-edgar.iglesias@gmail.com>
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
Add xen_mr_is_memory() to abstract away tests for the
xen_memory MR.
No functional changes.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/xen/xen-hvm-common.c | 10 ++++++++--
include/sysemu/xen.h | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c
index 2d1b032121..a0a0252da0 100644
--- a/hw/xen/xen-hvm-common.c
+++ b/hw/xen/xen-hvm-common.c
@@ -12,6 +12,12 @@
MemoryRegion xen_memory;
+/* Check for xen memory. */
+bool xen_mr_is_memory(MemoryRegion *mr)
+{
+ return mr == &xen_memory;
+}
+
void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr,
Error **errp)
{
@@ -28,7 +34,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr,
return;
}
- if (mr == &xen_memory) {
+ if (xen_mr_is_memory(mr)) {
return;
}
@@ -55,7 +61,7 @@ static void xen_set_memory(struct MemoryListener *listener,
{
XenIOState *state = container_of(listener, XenIOState, memory_listener);
- if (section->mr == &xen_memory) {
+ if (xen_mr_is_memory(section->mr)) {
return;
} else {
if (add) {
diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h
index 754ec2e6cb..3445888e39 100644
--- a/include/sysemu/xen.h
+++ b/include/sysemu/xen.h
@@ -49,4 +49,5 @@ static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
#endif /* CONFIG_XEN_IS_POSSIBLE */
+bool xen_mr_is_memory(MemoryRegion *mr);
#endif
--
2.40.1
next prev parent reply other threads:[~2024-05-29 14:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 14:07 [PATCH v8 0/8] xen: Support grant mappings Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 1/8] xen: mapcache: Make MCACHE_BUCKET_SHIFT runtime configurable Edgar E. Iglesias
2024-06-03 15:57 ` Philippe Mathieu-Daudé
2024-05-29 14:07 ` [PATCH v8 2/8] xen: mapcache: Unmap first entries in buckets Edgar E. Iglesias
2024-07-01 12:55 ` Anthony PERARD
2024-07-01 13:58 ` Edgar E. Iglesias
2024-07-01 14:30 ` Edgar E. Iglesias
2024-07-01 14:34 ` Edgar E. Iglesias
2024-07-01 16:21 ` Anthony PERARD
2024-07-01 21:28 ` Edgar E. Iglesias
2024-05-29 14:07 ` Edgar E. Iglesias [this message]
2024-05-29 14:07 ` [PATCH v8 4/8] softmmu: xen: Always pass offset + addr to xen_map_cache Edgar E. Iglesias
2024-06-03 15:58 ` Philippe Mathieu-Daudé
2024-05-29 14:07 ` [PATCH v8 5/8] softmmu: Replace check for RAMBlock offset 0 with xen_mr_is_memory Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 6/8] xen: mapcache: Pass the ram_addr offset to xen_map_cache() Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 7/8] xen: mapcache: Add support for grant mappings Edgar E. Iglesias
2024-05-29 14:07 ` [PATCH v8 8/8] hw/arm: xen: Enable use of " Edgar E. Iglesias
2024-06-03 16:03 ` [PATCH v8 0/8] xen: Support " Philippe Mathieu-Daudé
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=20240529140739.1387692-4-edgar.iglesias@gmail.com \
--to=edgar.iglesias@gmail.com \
--cc=anthony@xenproject.org \
--cc=david@redhat.com \
--cc=edgar.iglesias@amd.com \
--cc=jgross@suse.com \
--cc=paul@xen.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--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).