qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 1/4] hw/timer: add sunxi timer device


From: Peter Crosthwaite
Subject: Re: [Qemu-devel] [PATCH v4 1/4] hw/timer: add sunxi timer device
Date: Tue, 26 Nov 2013 19:25:49 +1000

On Tue, Nov 26, 2013 at 7:19 PM, Li Guang <address@hidden> wrote:
> Peter Crosthwaite wrote:
>>
>> On Tue, Nov 26, 2013 at 6:59 PM, Li Guang<address@hidden>  wrote:
>>
>>>
>>> Peter Crosthwaite wrote:
>>>
>>>>
>>>> On Tue, Nov 26, 2013 at 5:22 PM, liguang<address@hidden>
>>>> wrote:
>>>>
>>>>
>>>>>
>>>>> Signed-off-by: liguang<address@hidden>
>>>>> ---
>>>>>    default-configs/arm-softmmu.mak |    2 +
>>>>>    hw/timer/Makefile.objs          |    1 +
>>>>>    hw/timer/sunxi-pit.c            |  295
>>>>> +++++++++++++++++++++++++++++++++++++++
>>>>>    include/hw/timer/sunxi-pit.h    |   37 +++++
>>>>>    4 files changed, 335 insertions(+), 0 deletions(-)
>>>>>    create mode 100644 hw/timer/sunxi-pit.c
>>>>>    create mode 100644 include/hw/timer/sunxi-pit.h
>>>>>
>>>>> diff --git a/default-configs/arm-softmmu.mak
>>>>> b/default-configs/arm-softmmu.mak
>>>>> index a555eef..7bf5ad0 100644
>>>>> --- a/default-configs/arm-softmmu.mak
>>>>> +++ b/default-configs/arm-softmmu.mak
>>>>> @@ -81,3 +81,5 @@ CONFIG_VERSATILE_I2C=y
>>>>>
>>>>>    CONFIG_SDHCI=y
>>>>>    CONFIG_INTEGRATOR_DEBUG=y
>>>>> +
>>>>> +CONFIG_SUNXI_PIT=y
>>>>> diff --git a/hw/timer/Makefile.objs b/hw/timer/Makefile.objs
>>>>> index eca5905..f7888e9 100644
>>>>> --- a/hw/timer/Makefile.objs
>>>>> +++ b/hw/timer/Makefile.objs
>>>>> @@ -27,3 +27,4 @@ obj-$(CONFIG_SH4) += sh_timer.o
>>>>>    obj-$(CONFIG_TUSB6010) += tusb6010.o
>>>>>
>>>>>    obj-$(CONFIG_MC146818RTC) += mc146818rtc.o
>>>>> +obj-$(CONFIG_SUNXI_PIT) += sunxi-pit.o
>>>>> diff --git a/hw/timer/sunxi-pit.c b/hw/timer/sunxi-pit.c
>>>>> new file mode 100644
>>>>> index 0000000..39b84ab
>>>>> --- /dev/null
>>>>> +++ b/hw/timer/sunxi-pit.c
>>>>> @@ -0,0 +1,295 @@
>>>>> +/*
>>>>> + * Allwinner sunxi timer device emulation
>>>>> + *
>>>>> + * Copyright (C) 2013 Li Guang
>>>>> + * Written by Li Guang<address@hidden>
>>>>> + *
>>>>> + * This program is free software; you can redistribute it and/or
>>>>> modify
>>>>> it
>>>>> + * under the terms of the GNU General Public License as published by
>>>>> the
>>>>> + * Free Software Foundation; either version 2 of the License, or
>>>>> + * (at your option) any later version.
>>>>> + *
>>>>> + * This program is distributed in the hope that it will be useful, but
>>>>> WITHOUT
>>>>> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
>>>>> or
>>>>> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
>>>>> License
>>>>> + * for more details.
>>>>> + */
>>>>> +
>>>>> +#include "hw/sysbus.h"
>>>>> +#include "hw/ptimer.h"
>>>>> +#include "sysemu/sysemu.h"
>>>>> +#include "hw/timer/sunxi-pit.h"
>>>>> +
>>>>> +
>>>>> +typedef struct SunxiTimer {
>>>>> +    ptimer_state *timer;
>>>>> +} SunxiTimer;
>>>>> +
>>>>>
>>>>>
>>>>
>>>> I don't understand the need for this struct. What was wrong with the
>>>> direct array of ptimers you had before?
>>>>
>>>>
>>>
>>>
>>> because I have to pack timer array into VMSD,
>>> and there's no VMSTATE_PTIMER_ARRAY for ptimer_state.
>>>
>>>
>>
>> Anyway you can just use VMSTATE_STRUCT_ARRAY on ptimers own VMSD
>> definition?
>>
>> If you cant, then I think you make a reasonable case for moving the
>> relevant bits and pieces to headers so they are visible. That or
>> implement VMSTATE_PTIMER_ARRAY.
>>
>>
>
>
> right, but that seems be in a separated patch,
> I consider to use current way, can I?
>

Well you have effectively implemented VMSTATE_PTIMER_ARRAY here
locally. Its probably best to just fix ptimer as first patch in this
series and it keeps your device model cleaner from the start. You may
have already done the hard work.

Regards,
Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]