qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: Re: [PATCH] target/arm: Fix reads of CNTFRQ_EL0 in linux-user mode
Date: Mon, 13 Oct 2025 19:26:13 +0200	[thread overview]
Message-ID: <e06b47fa-361b-4e6c-9477-61b556808670@linaro.org> (raw)
In-Reply-To: <20251013161040.216819-1-peter.maydell@linaro.org>

On 13/10/25 18:10, Peter Maydell wrote:
> In commit bd8e9ddf6f6 ("target/arm: Refactor default generic timer
> frequency handling") we changed how we initialized the generic timer
> frequency as reported in the CNTFRQ_EL0 register.  As part of that,
> we chanegd the linux-user version of the CNTFRQ_EL0 sysreg from

"changed"

> having a constant value set at compile time through the .resetvalue
> field to having a reset value which we compute in a .resetfn.
> 
> This accidentally broke the reading of CNTFRQ_EL0 in linux-user mode,
> because the cpreg is marked as ARM_CP_CONST, which means we translate
> it as a read of the compile-time constant value in the .resetvalue
> field.  This is now zero, so userspace sees a 0 frequency value.
> 
> Fix the bug by dropping the ARM_CP_CONST marking.  This will cause us
> to translate the read as a load of the value from the CPU state
> struct cp15.c14_cntfrq field, which is where the real frequency value
> now lives.
> 
> Cc: qemu-stable@nongnu.org
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3159
> Fixes: bd8e9ddf6f6 ("target/arm: Refactor default generic timer frequency handling")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   target/arm/helper.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



      reply	other threads:[~2025-10-13 17:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 16:10 [PATCH] target/arm: Fix reads of CNTFRQ_EL0 in linux-user mode Peter Maydell
2025-10-13 17:26 ` 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=e06b47fa-361b-4e6c-9477-61b556808670@linaro.org \
    --to=philmd@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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).