[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/23] memory: Fix the memory region type assignment
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 04/23] memory: Fix the memory region type assignment order |
Date: |
Wed, 27 Mar 2019 13:37:42 +0100 |
From: "Singh, Brijesh" <address@hidden>
Currently, a callback registered through the RAMBlock notifier
is not able to get the memory region type (i.e callback is not
able to use memory_region_is_ram_device function). This is
because mr->ram assignment happens _after_ the memory is allocated
whereas the callback is executed during allocation.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1667249
Suggested-by: Alex Williamson <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Reviewed-by: Alex Williamson <address@hidden>
Signed-off-by: Brijesh Singh <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
memory.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/memory.c b/memory.c
index e49369d..9fbca52 100644
--- a/memory.c
+++ b/memory.c
@@ -1649,10 +1649,17 @@ void memory_region_init_ram_device_ptr(MemoryRegion *mr,
uint64_t size,
void *ptr)
{
- memory_region_init_ram_ptr(mr, owner, name, size, ptr);
+ memory_region_init(mr, owner, name, size);
+ mr->ram = true;
+ mr->terminates = true;
mr->ram_device = true;
mr->ops = &ram_device_mem_ops;
mr->opaque = mr;
+ mr->destructor = memory_region_destructor_ram;
+ mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
+ /* qemu_ram_alloc_from_ptr cannot fail with ptr != NULL. */
+ assert(ptr != NULL);
+ mr->ram_block = qemu_ram_alloc_from_ptr(size, ptr, mr, &error_fatal);
}
void memory_region_init_alias(MemoryRegion *mr,
--
1.8.3.1
- [Qemu-devel] [PULL 00/23] Misc patches for QEMU 4.0-rc, mostly Kconfig refinements, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 03/23] kconfig: add dependencies on CONFIG_MSI_NONBROKEN, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 01/23] riscv: plic: Set msi_nonbroken as true, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 05/23] target/i386: sev: Do not pin the ram device memory region, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 04/23] memory: Fix the memory region type assignment order,
Paolo Bonzini <=
- [Qemu-devel] [PULL 06/23] hw/char/parallel: Make it possible to compile also without CONFIG_PARALLEL, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 02/23] kconfig: add CONFIG_MSI_NONBROKEN, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 08/23] prep: do not select I82374, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 07/23] hw/i386/Kconfig: PC uses I8257, not I82374, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 10/23] hw/isa/Kconfig: PIIX4 southbridge requires USB UHCI, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 11/23] hw/i386/Kconfig: enable devices that can be created by default, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 13/23] hw/mips/Kconfig: Fulong 2e board requires ati-vga/rtl8139 PCI devices, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 12/23] hw/mips/Kconfig: Malta machine requires the pcnet network card, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 09/23] hw/isa/Kconfig: i82378 SuperIO requires PC speaker device, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 14/23] hw/ppc/Kconfig: Bamboo machine requires e1000 network card, Paolo Bonzini, 2019/03/27