qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>,
	Niek Linnenbank <nieklinnenbank@gmail.com>
Cc: qemu-arm <qemu-arm@nongnu.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2 06/10] arm/arm-powerctl: rebuild hflags after setting CP15 bits in arm_set_cpu_on()
Date: Tue, 17 Dec 2019 06:41:52 -1000	[thread overview]
Message-ID: <19e4f2ac-6067-f61f-f340-108545fb0f02@linaro.org> (raw)
In-Reply-To: <CAFEAcA8Viii4Em_bf4Y=AG0jU+EFFFTX6dO-52qd=RT4uHbCVw@mail.gmail.com>

On 12/17/19 6:12 AM, Peter Maydell wrote:
> Cc'ing Richard : this is one for you I think... (surely we
> need to rebuild the hflags from scratch when we power up
> a CPU anyway?)

We do compute hflags from scratch in reset.

It has also turned out that there were a few board models that poked at the
contents of the cpu and needed special help.  Some of that I would imagine
would be fixed properly with the multi-phase reset patches, where we could
rebuild hflags when *leaving* reset.

In arm_set_cpu_on_async_work, we start by resetting the cpu and then start
poking at the contents of some system registers.  So, yes, we do need to
rebuild after doing that.  Also, I'm not sure how this function should fit into
the multi-phase reset future.

So:

>> On Tue, Dec 17, 2019 at 12:36 AM Niek Linnenbank <nieklinnenbank@gmail.com> wrote:
>>>
>>> After setting CP15 bits in arm_set_cpu_on() the cached hflags must
>>> be rebuild to reflect the changed processor state. Without rebuilding,
>>> the cached hflags would be inconsistent until the next call to
>>> arm_rebuild_hflags(). When QEMU is compiled with debugging enabled
>>> (--enable-debug), this problem is captured shortly after the first
>>> call to arm_set_cpu_on() for CPUs running in ARM 32-bit non-secure mode:
>>>
>>>   qemu-system-arm: target/arm/helper.c:11359: cpu_get_tb_cpu_state:
>>>   Assertion `flags == rebuild_hflags_internal(env)' failed.
>>>   Aborted (core dumped)
>>>
>>> Fixes: 0c7f8c43daf65
>>> Signed-off-by: Niek Linnenbank <nieklinnenbank@gmail.com>
>>> ---
>>>  target/arm/arm-powerctl.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c
>>> index b064513d44..b75f813b40 100644
>>> --- a/target/arm/arm-powerctl.c
>>> +++ b/target/arm/arm-powerctl.c
>>> @@ -127,6 +127,9 @@ static void arm_set_cpu_on_async_work(CPUState *target_cpu_state,
>>>          target_cpu->env.regs[0] = info->context_id;
>>>      }
>>>
>>> +    /* CP15 update requires rebuilding hflags */
>>> +    arm_rebuild_hflags(&target_cpu->env);
>>> +
>>>      /* Start the new CPU at the requested address */
>>>      cpu_set_pc(target_cpu_state, info->entry);
>>>

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


  reply	other threads:[~2019-12-17 16:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 23:35 [PATCH v2 00/10] Add Allwinner H3 SoC and Orange Pi PC Machine Niek Linnenbank
2019-12-16 23:35 ` [PATCH v2 01/10] hw: arm: add Allwinner H3 System-on-Chip Niek Linnenbank
2019-12-16 23:35 ` [PATCH v2 02/10] hw: arm: add Xunlong Orange Pi PC machine Niek Linnenbank
2019-12-17  7:31   ` Philippe Mathieu-Daudé
2019-12-18 20:14     ` Niek Linnenbank
2019-12-19 19:06       ` Philippe Mathieu-Daudé
2019-12-16 23:35 ` [PATCH v2 03/10] arm: allwinner-h3: add Clock Control Unit Niek Linnenbank
2019-12-16 23:35 ` [PATCH v2 04/10] arm: allwinner-h3: add USB host controller Niek Linnenbank
2019-12-16 23:35 ` [PATCH v2 05/10] arm: allwinner-h3: add System Control module Niek Linnenbank
2019-12-16 23:35 ` [PATCH v2 06/10] arm/arm-powerctl: rebuild hflags after setting CP15 bits in arm_set_cpu_on() Niek Linnenbank
2019-12-16 23:44   ` Niek Linnenbank
2019-12-17 16:12     ` Peter Maydell
2019-12-17 16:41       ` Richard Henderson [this message]
2019-12-17 17:39         ` Peter Maydell
2019-12-18 21:01         ` Niek Linnenbank
2019-12-18 23:25           ` Richard Henderson
2019-12-16 23:35 ` [PATCH v2 07/10] arm: allwinner-h3: add CPU Configuration module Niek Linnenbank
2019-12-16 23:35 ` [PATCH v2 08/10] arm: allwinner-h3: add Security Identifier device Niek Linnenbank
2019-12-17  7:45   ` Philippe Mathieu-Daudé
2019-12-18 20:49     ` Niek Linnenbank
2019-12-30 14:49       ` Philippe Mathieu-Daudé
2020-01-07 21:53         ` Niek Linnenbank
2019-12-16 23:35 ` [PATCH v2 09/10] arm: allwinner-h3: add SD/MMC host controller Niek Linnenbank
2019-12-16 23:35 ` [PATCH v2 10/10] arm: allwinner-h3: add EMAC ethernet device Niek Linnenbank
2019-12-30 11:28 ` [PATCH v2 00/10] Add Allwinner H3 SoC and Orange Pi PC Machine Niek Linnenbank
2019-12-30 14:56   ` Philippe Mathieu-Daudé
2019-12-30 20:10     ` Niek Linnenbank
2020-01-02 19:52       ` Niek Linnenbank
2020-01-02 21:11         ` Philippe Mathieu-Daudé
2020-01-02 22:06           ` Niek Linnenbank

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=19e4f2ac-6067-f61f-f340-108545fb0f02@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=nieklinnenbank@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --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).