[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allo
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory() |
Date: |
Thu, 6 Jul 2017 18:13:05 +0100 |
On 5 July 2017 at 13:21, Paolo Bonzini <address@hidden> wrote:
>
>
> On 04/07/2017 19:02, Peter Maydell wrote:
>> Many board models and several devices need to create auxiliary
>> regions of RAM (in addition to the main lump of 'system' memory),
>> to model static RAMs, video memory, ROMs, etc. Currently they do
>> this with a sequence like:
>> memory_region_init_ram(sram, NULL, "sram", 0x10000, &error_fatal);
>> vmstate_register_ram_global(sram);
>
> Instead of vmstate_register_ram_global, you should use
>
> vmstate_register_ram(mr, owner);
>
> You should even do it for all memory regions, probably.
Slightly awkward because owner is an Object but vmstate_register_ram()
needs a DeviceState. Is this OK, or too much magic?
DeviceState *owner_dev;
Error *err = NULL;
memory_region_init_ram(mr, owner, name, ram_size, &err);
if (err) {
error_propagate(errp, err);
return;
}
/* Note that owner_dev may be NULL if owner is not a DeviceState;
* in that case this is equivalent to calling vmstate_register_ram_global().
*/
owner_dev = object_dynamic_cast(owner, TYPE_DEVICE);
vmstate_register_ram(mr, owner_dev);
thanks
-- PMM
- [Qemu-devel] [PATCH 3/3] hw: Use new memory_region_allocate_aux_memory() function, (continued)
- [Qemu-devel] [PATCH 3/3] hw: Use new memory_region_allocate_aux_memory() function, Peter Maydell, 2017/07/04
- Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Paolo Bonzini, 2017/07/05
- Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Peter Maydell, 2017/07/06
- Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Paolo Bonzini, 2017/07/06
- Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Peter Maydell, 2017/07/06
- Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Paolo Bonzini, 2017/07/06
- Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Igor Mammedov, 2017/07/07
- Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Peter Maydell, 2017/07/07
- Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Peter Maydell, 2017/07/17
- Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Igor Mammedov, 2017/07/07
Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(),
Peter Maydell <=
Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Peter Maydell, 2017/07/07
Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory(), Paolo Bonzini, 2017/07/07