From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Nikita Ostrenkov <n.ostrenkov@gmail.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: Re: [PATCH] fsl-imx: Add simple RTC emulation for i.MX6 and i.MX7 boards
Date: Wed, 13 Dec 2023 20:16:07 +0100 [thread overview]
Message-ID: <e4ce3b41-8a40-4a30-a615-a520ae881121@linaro.org> (raw)
In-Reply-To: <CAFEAcA-NVrx+q6XLX02vuwD274THh5N7NJExVzvtD5zKaFa4HQ@mail.gmail.com>
On 13/12/23 18:20, Peter Maydell wrote:
> On Wed, 13 Dec 2023 at 17:17, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Hi Peter,
>>
>> On 12/12/23 15:18, Peter Maydell wrote:
>>> On Sun, 12 Nov 2023 at 09:22, Nikita Ostrenkov <n.ostrenkov@gmail.com> wrote:
>>>
>>> Hi; thanks for this patch, and sorry I haven't got round
>>> to reviewing it earlier.
>>>
>>>> Signed-off-by: Nikita Ostrenkov <n.ostrenkov@gmail.com>
>>>> ---
>>>> hw/misc/imx7_snvs.c | 59 ++++++++++++++++++++++++++++++++-----
>>>> hw/misc/trace-events | 4 +--
>>>> include/hw/misc/imx7_snvs.h | 14 ++++++++-
>>>> 3 files changed, 67 insertions(+), 10 deletions(-)
>>
>>
>>>> @@ -31,6 +33,16 @@ struct IMX7SNVSState {
>>>> SysBusDevice parent_obj;
>>>>
>>>> MemoryRegion mmio;
>>>> +
>>>> + /*
>>>> + * Needed to preserve the tick_count across migration, even if the
>>>> + * absolute value of the rtc_clock is different on the source and
>>>> + * destination.
>>>> + */
>>>> + int64_t tick_offset_vmstate;
>>>
>>> You don't need tick_offset_vmstate -- it is only in the p031
>>> RTC device as a backwards-compatibility thing for older versions
>>> of QEMU. Migrating tick_offset alone is sufficient in a new
>>> device. (It seems to have been unfortunately copied-and-pasted
>>> into the goldfish RTC device; we should probably fix that bug.)
>>>
>>>> + int64_t tick_offset;
>>>> +
>>>> + uint64_t lpcr;
>>>
>>> We've now added state to this device, which means that it needs
>>> a VMState structure to handle migration, and it needs a reset
>>> function.
>>
>> I just noticed your v1 review after reviewing v2. Indeed
>> 'tick_offset' need to be migrated. Now about reset(), RTC
>> are somehow different. When resetting a machine in the same
>> QEMU process I'd expect the RTC offset to not be reset.
>>
>> Could this be clarified by adding a reset handler with no
>> code but a comment /* RTC state is usually kept by CMOS
>> battery and is not reset */ maybe?
>
> The lpcr register state needs to be reset.
Oh, I missed its access in imx7_snvs_read().
> thanks
> -- PMM
prev parent reply other threads:[~2023-12-13 19:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-12 9:22 [PATCH] fsl-imx: Add simple RTC emulation for i.MX6 and i.MX7 boards Nikita Ostrenkov
2023-12-12 14:18 ` Peter Maydell
2023-12-13 15:23 ` Nikita Ostrenkov
2023-12-13 17:17 ` Philippe Mathieu-Daudé
2023-12-13 17:20 ` Peter Maydell
2023-12-13 19:16 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e4ce3b41-8a40-4a30-a615-a520ae881121@linaro.org \
--to=philmd@linaro.org \
--cc=andrew.smirnov@gmail.com \
--cc=n.ostrenkov@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).