[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 6/8] register: Add block initialise helper
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v8 6/8] register: Add block initialise helper |
Date: |
Mon, 27 Jun 2016 17:44:24 +0100 |
On 27 June 2016 at 17:16, Alistair Francis <address@hidden> wrote:
> On Mon, Jun 27, 2016 at 7:31 AM, Peter Maydell <address@hidden> wrote:
>> On 24 June 2016 at 16:42, Alistair Francis <address@hidden> wrote:
>>> +/**
>>> + * This function should be called to cleanup the registers that were
>>> initialized
>>> + * when calling register_init_block32()
>>> + *
>>> + * @r_array: An structure containing all of the registers. The caller is in
>>> + * charge of cleaning up the memory region (r_array->mem).
>>
>> What cleanup does the memory region require?
>
> The device init function that calls the register init function will
> also call memory_region_add_subregion(). Doesn't it need to call
> memory_region_del_subregion() afterwards?
Somebody also needs to call object_unparent() if the MemoryRegion
is part of a lump of memory that's being g_free()d (see docs/memory.txt).
That probably ought to be this code, and we should say that this
function should only be called from the owner device's instance_finalize.
More generally: I think we should be specific, not vague, about
exactly what the caller's responsibilities are [what they are
expected to have done before calling this function; when they
are permitted to call it]; otherwise the callers will likely get
it wrong.
thanks
-- PMM
- [Qemu-devel] [PATCH v8 1/8] bitops: Add MAKE_64BIT_MASK macro, (continued)
- [Qemu-devel] [PATCH v8 1/8] bitops: Add MAKE_64BIT_MASK macro, Alistair Francis, 2016/06/24
- [Qemu-devel] [PATCH v8 2/8] register: Add Register API, Alistair Francis, 2016/06/24
- [Qemu-devel] [PATCH v8 4/8] register: Define REG and FIELD macros, Alistair Francis, 2016/06/24
- [Qemu-devel] [PATCH v8 3/8] register: Add Memory API glue, Alistair Francis, 2016/06/24
- [Qemu-devel] [PATCH v8 5/8] register: QOMify, Alistair Francis, 2016/06/24
- [Qemu-devel] [PATCH v8 6/8] register: Add block initialise helper, Alistair Francis, 2016/06/24
- [Qemu-devel] [PATCH v8 7/8] dma: Add Xilinx Zynq devcfg device model, Alistair Francis, 2016/06/24
- [Qemu-devel] [PATCH v8 8/8] xilinx_zynq: Connect devcfg to the Zynq machine model, Alistair Francis, 2016/06/24