Re: [PATCH 3/3] tests/qtest/cmsdk-apb-watchdog-test: Test INTEN as counter enable

2024-11-15 Thread Roque Arcudia Hernandez
Thanks for pointing this out. For now I'll be adding the extra line in
the version 2 of this patch.

On Thu, Nov 14, 2024 at 5:01 AM Peter Maydell  wrote:
>
> On Fri, 8 Nov 2024 at 19:10, Roque Arcudia Hernandez  
> wrote:
> >
> > The following tests focus on making sure the counter is not running
> > out of reset and the proper use of INTEN as the counter enable. As
> > described in:
> >
> > https://developer.arm.com/documentation/ddi0479/d/apb-components/apb-watchdog/programmers-model
> >
> > The new tests have to target an MPS2 machine because the original
> > machine used by the test (stellaris) has a variation of the
> > cmsdk_apb_watchdog that locks INTEN when it is programmed to 1. The
> > stellaris machine also does not reproduce the problem of the counter
> > running out of cold reset due to the way the clocks are initialized.
> >
> > Signed-off-by: Roque Arcudia Hernandez 
> > Reviewed-by: Stephen Longfield 
> > ---
> >  tests/qtest/cmsdk-apb-watchdog-test.c | 214 ++
> >  1 file changed, 214 insertions(+)
> >
> > diff --git a/tests/qtest/cmsdk-apb-watchdog-test.c 
> > b/tests/qtest/cmsdk-apb-watchdog-test.c
> > index fe535a553c..3777b7bd59 100644
> > --- a/tests/qtest/cmsdk-apb-watchdog-test.c
> > +++ b/tests/qtest/cmsdk-apb-watchdog-test.c
> > @@ -68,6 +68,15 @@ static const CMSDKAPBWatchdogTestArgs machine_info[] = {
> >  },
> >  };
> >
> > +static void system_reset(QTestState *qtest)
> > +{
> > +QDict *resp;
> > +
> > +resp = qtest_qmp(qtest, "{'execute': 'system_reset'}");
> > +g_assert(qdict_haskey(resp, "return"));
> > +qobject_unref(resp);
> > +}
>
> The system_reset QMP command only requests a reset; it does
> not wait for it to actually happen. For that you need to
>qtest_qmp_eventwait(qtest, "RESET");
>
> We seem to already have several implementations of this
> kind of "reset the system under test" function, several
> of which have this bug. That suggests to me that we ought
> to provide it as a utility method qtest_system_reset()
> in libqtest.
>
> thanks
> -- PMM



Re: [PATCH 3/3] tests/qtest/cmsdk-apb-watchdog-test: Test INTEN as counter enable

2024-11-14 Thread Peter Maydell
On Fri, 8 Nov 2024 at 19:10, Roque Arcudia Hernandez  wrote:
>
> The following tests focus on making sure the counter is not running
> out of reset and the proper use of INTEN as the counter enable. As
> described in:
>
> https://developer.arm.com/documentation/ddi0479/d/apb-components/apb-watchdog/programmers-model
>
> The new tests have to target an MPS2 machine because the original
> machine used by the test (stellaris) has a variation of the
> cmsdk_apb_watchdog that locks INTEN when it is programmed to 1. The
> stellaris machine also does not reproduce the problem of the counter
> running out of cold reset due to the way the clocks are initialized.
>
> Signed-off-by: Roque Arcudia Hernandez 
> Reviewed-by: Stephen Longfield 
> ---
>  tests/qtest/cmsdk-apb-watchdog-test.c | 214 ++
>  1 file changed, 214 insertions(+)
>
> diff --git a/tests/qtest/cmsdk-apb-watchdog-test.c 
> b/tests/qtest/cmsdk-apb-watchdog-test.c
> index fe535a553c..3777b7bd59 100644
> --- a/tests/qtest/cmsdk-apb-watchdog-test.c
> +++ b/tests/qtest/cmsdk-apb-watchdog-test.c
> @@ -68,6 +68,15 @@ static const CMSDKAPBWatchdogTestArgs machine_info[] = {
>  },
>  };
>
> +static void system_reset(QTestState *qtest)
> +{
> +QDict *resp;
> +
> +resp = qtest_qmp(qtest, "{'execute': 'system_reset'}");
> +g_assert(qdict_haskey(resp, "return"));
> +qobject_unref(resp);
> +}

The system_reset QMP command only requests a reset; it does
not wait for it to actually happen. For that you need to
   qtest_qmp_eventwait(qtest, "RESET");

We seem to already have several implementations of this
kind of "reset the system under test" function, several
of which have this bug. That suggests to me that we ought
to provide it as a utility method qtest_system_reset()
in libqtest.

thanks
-- PMM