|
Pablo Greco |
e6a3ae |
From c3d30392ea7f29823de3b4514ce3b75d7254ee58 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
e6a3ae |
From: Gary R Hook <ghook@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Date: Wed, 10 Apr 2019 00:08:02 +0100
|
|
Pablo Greco |
e6a3ae |
Subject: [PATCH 2/5] memory: Fix the memory region type assignment order
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
RH-Author: Gary R Hook <ghook@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-id: <20190410000803.1744-2-ghook@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Patchwork-id: 85543
|
|
Pablo Greco |
e6a3ae |
O-Subject: [RHEL-8.1 virt 1/2] memory: Fix the memory region type assignment order
|
|
Pablo Greco |
e6a3ae |
Bugzilla: 1667249
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
BZ: 1667249
|
|
Pablo Greco |
e6a3ae |
Branch: rhel-8.1.0
|
|
Pablo Greco |
e6a3ae |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1667249
|
|
Pablo Greco |
e6a3ae |
Upstream Status: 4.0.0-rc1
|
|
Pablo Greco |
e6a3ae |
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=20980582
|
|
Pablo Greco |
e6a3ae |
Conflicts: None
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
commit 2ddb89b00f947f785c9ca6742f28f954e3b75e62
|
|
Pablo Greco |
e6a3ae |
Author: Singh, Brijesh <brijesh.singh@amd.com>
|
|
Pablo Greco |
e6a3ae |
Date: Mon Feb 4 22:23:39 2019 +0000
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
memory: Fix the memory region type assignment order
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Currently, a callback registered through the RAMBlock notifier
|
|
Pablo Greco |
e6a3ae |
is not able to get the memory region type (i.e callback is not
|
|
Pablo Greco |
e6a3ae |
able to use memory_region_is_ram_device function). This is
|
|
Pablo Greco |
e6a3ae |
because mr->ram assignment happens _after_ the memory is allocated
|
|
Pablo Greco |
e6a3ae |
whereas the callback is executed during allocation.
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1667249
|
|
Pablo Greco |
e6a3ae |
Suggested-by: Alex Williamson <alex.williamson@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
|
|
Pablo Greco |
e6a3ae |
Message-Id: <20190204222322.26766-2-brijesh.singh@amd.com>
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Cc: qemu-devel@nongnu.org
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
Pablo Greco |
e6a3ae |
---
|
|
Pablo Greco |
e6a3ae |
memory.c | 9 ++++++++-
|
|
Pablo Greco |
e6a3ae |
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
diff --git a/memory.c b/memory.c
|
|
Pablo Greco |
e6a3ae |
index 4974f97..04ff5e9 100644
|
|
Pablo Greco |
e6a3ae |
--- a/memory.c
|
|
Pablo Greco |
e6a3ae |
+++ b/memory.c
|
|
Pablo Greco |
e6a3ae |
@@ -1631,10 +1631,17 @@ void memory_region_init_ram_device_ptr(MemoryRegion *mr,
|
|
Pablo Greco |
e6a3ae |
uint64_t size,
|
|
Pablo Greco |
e6a3ae |
void *ptr)
|
|
Pablo Greco |
e6a3ae |
{
|
|
Pablo Greco |
e6a3ae |
- memory_region_init_ram_ptr(mr, owner, name, size, ptr);
|
|
Pablo Greco |
e6a3ae |
+ memory_region_init(mr, owner, name, size);
|
|
Pablo Greco |
e6a3ae |
+ mr->ram = true;
|
|
Pablo Greco |
e6a3ae |
+ mr->terminates = true;
|
|
Pablo Greco |
e6a3ae |
mr->ram_device = true;
|
|
Pablo Greco |
e6a3ae |
mr->ops = &ram_device_mem_ops;
|
|
Pablo Greco |
e6a3ae |
mr->opaque = mr;
|
|
Pablo Greco |
e6a3ae |
+ mr->destructor = memory_region_destructor_ram;
|
|
Pablo Greco |
e6a3ae |
+ mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
|
|
Pablo Greco |
e6a3ae |
+ /* qemu_ram_alloc_from_ptr cannot fail with ptr != NULL. */
|
|
Pablo Greco |
e6a3ae |
+ assert(ptr != NULL);
|
|
Pablo Greco |
e6a3ae |
+ mr->ram_block = qemu_ram_alloc_from_ptr(size, ptr, mr, &error_fatal);
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
void memory_region_init_alias(MemoryRegion *mr,
|
|
Pablo Greco |
e6a3ae |
--
|
|
Pablo Greco |
e6a3ae |
1.8.3.1
|
|
Pablo Greco |
e6a3ae |
|