aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorEdgar E. Iglesias <edgar.iglesias@amd.com>2024-04-30 18:49:36 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-06-04 11:53:34 +0200
commit1be974bc2658b2f1d9a3aaacda2657dc85c208d2 (patch)
treefff73fd943effeb7014cf262e35bf745609fa9cf /hw
parent638181a180bd4815eb4db64cfc50092cc3e5035e (diff)
downloadqemu-1be974bc2658b2f1d9a3aaacda2657dc85c208d2.zip
qemu-1be974bc2658b2f1d9a3aaacda2657dc85c208d2.tar.gz
qemu-1be974bc2658b2f1d9a3aaacda2657dc85c208d2.tar.bz2
xen: Add xen_mr_is_memory()
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> Message-ID: <20240529140739.1387692-4-edgar.iglesias@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/xen/xen-hvm-common.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c
index 2d1b032..a0a0252 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) {