[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 1/9] hw/core/clock: introduce clock object
From: |
Damien Hedde |
Subject: |
Re: [PATCH v7 1/9] hw/core/clock: introduce clock object |
Date: |
Tue, 25 Feb 2020 10:48:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
On 2/25/20 1:02 AM, Alistair Francis wrote:
> On Mon, Feb 24, 2020 at 9:05 AM Damien Hedde <address@hidden> wrote:
>>
>> This object may be used to represent a clock inside a clock tree.
>>
>> A clock may be connected to another clock so that it receives update,
>> through a callback, whenever the source/parent clock is updated.
>>
>> Although only the root clock of a clock tree controls the values
>> (represented as periods) of all clocks in tree, each clock holds
>> a local state containing the current value so that it can be fetched
>> independently. It will allows us to fullfill migration requirements
>> by migrating each clock independently of others.
>>
>> This is based on the original work of Frederic Konrad.
>>
>> Signed-off-by: Damien Hedde <address@hidden>
>> --
>>
>> v7:
>> + merge ClockIn & ClockOut into a single type Clock
>> + switch clock state to a period with 2^-32ns unit
>> + add some Hz and ns helpers
>> + propagate clock period when setting the source so that
>> clocks with fixed period are easy to handle.
>> ---
>> include/hw/clock.h | 216 ++++++++++++++++++++++++++++++++++++++++++
>> hw/core/clock.c | 131 +++++++++++++++++++++++++
>> hw/core/Makefile.objs | 2 +
>> hw/core/trace-events | 7 ++
>> 4 files changed, 356 insertions(+)
>> create mode 100644 include/hw/clock.h
>> create mode 100644 hw/core/clock.c
>>
>> diff --git a/include/hw/clock.h b/include/hw/clock.h
>> new file mode 100644
>> index 0000000000..30ac9a9946
>> --- /dev/null
>> +++ b/include/hw/clock.h
>> @@ -0,0 +1,216 @@
[...]
>
>> + clock_disconnect(clk);
>> +
>> + g_free(clk->canonical_path);
>> + clk->canonical_path = NULL;
>
> You shouldn't need to set this to NULL.
ok.
>
>> +}
>> +
>> +static const TypeInfo clock_info = {
>> + .name = TYPE_CLOCK,
>> + .parent = TYPE_OBJECT,
>> + .instance_size = sizeof(Clock),
>> + .instance_init = clock_initfn,
>> + .instance_finalize = clock_finalizefn,
>> +};
>> +
>> +static void clock_register_types(void)
>> +{
>> + type_register_static(&clock_info);
>> +}
>> +
>> +type_init(clock_register_types)
>> diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
>> index 6215e7c208..d7080edf89 100644
>> --- a/hw/core/Makefile.objs
>> +++ b/hw/core/Makefile.objs
>> @@ -7,10 +7,12 @@ common-obj-y += hotplug.o
>> common-obj-y += vmstate-if.o
>> # irq.o needed for qdev GPIO handling:
>> common-obj-y += irq.o
>> +common-obj-y += clock.o
>>
>> common-obj-$(CONFIG_SOFTMMU) += reset.o
>> common-obj-$(CONFIG_SOFTMMU) += qdev-fw.o
>> common-obj-$(CONFIG_SOFTMMU) += fw-path-provider.o
>> +common-obj-$(CONFIG_SOFTMMU) += hotplug.o
>
> I don't think this should be here.
Oops, I missed this rebase artifact.
Thanks,
Damien
- [PATCH v7 5/9] docs/clocks: add device's clock documentation, (continued)
- [PATCH v7 5/9] docs/clocks: add device's clock documentation, Damien Hedde, 2020/02/24
- [PATCH v7 2/9] hw/core/clock-vmstate: define a vmstate entry for clock state, Damien Hedde, 2020/02/24
- [PATCH v7 4/9] qdev-clock: introduce an init array to ease the device construction, Damien Hedde, 2020/02/24
- [PATCH v7 8/9] hw/arm/xilinx_zynq: connect uart clocks to slcr, Damien Hedde, 2020/02/24
- [PATCH v7 3/9] qdev: add clock input&output support to devices., Damien Hedde, 2020/02/24
- [PATCH v7 1/9] hw/core/clock: introduce clock object, Damien Hedde, 2020/02/24
- [PATCH v7 7/9] hw/char/cadence_uart: add clock support, Damien Hedde, 2020/02/24
- Re: [PATCH v7 0/9] Clock framework API, no-reply, 2020/02/24
- Re: [PATCH v7 0/9] Clock framework API, no-reply, 2020/02/24