From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [RFC PATCH 27/35] target/arm: wrap event_register in a union
Date: Tue, 07 Apr 2026 11:35:20 +0100 [thread overview]
Message-ID: <87zf3fawif.fsf@draig.linaro.org> (raw)
In-Reply-To: <0877e0da-c083-4293-bba2-5c1d2e2315b7@linaro.org> (Richard Henderson's message of "Mon, 6 Apr 2026 10:37:17 +1000")
Richard Henderson <richard.henderson@linaro.org> writes:
> On 3/21/26 00:05, Alex Bennée wrote:
>> While the event register is either set or not due to the
>> implementation defined nature of bool types we can't set it directly
>> from TCG code. By wrapping in a union we can alias a 32 bit value to
>> the bool in a future patch.
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>> target/arm/cpu.h | 9 +++++++--
>> hw/intc/armv7m_nvic.c | 2 +-
>> target/arm/machine.c | 4 ++--
>> target/arm/tcg/m_helper.c | 4 ++--
>> target/arm/tcg/op_helper.c | 6 +++---
>> 5 files changed, 15 insertions(+), 10 deletions(-)
>> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
>> index bf6cf74c2e1..9c25b60ae83 100644
>> --- a/target/arm/cpu.h
>> +++ b/target/arm/cpu.h
>> @@ -763,9 +763,14 @@ typedef struct CPUArchState {
>> /*
>> * The event register is shared by all ARM profiles (A/R/M),
>> * so it is stored in the top-level CPU state.
>> - * WFE/SEV handling is currently implemented only for M-profile.
>> + *
>> + * It is treated as a boolean but we need the union so we can set
>> + * it from TCG.
>> */
>> - bool event_register;
>> + union {
>> + bool as_bool;
>> + uint32_t as_uint32;
>> + } event_register;
>
> What are you attempting here? This smells like a big-endian bug.
>
> TCG is certainly capable of storing to a bool, via tcg_gen_st8_*.
So the problem I had was I don't know what size bool will be as its up
to each architecture to define the size. I originally had a compile time
assert but that failed. Hence this hack to put something that would
plausibly overlap.
I wonder if there would be a way to use a Generic so tcg_gen_st8_bool
would always map to the right size whichever arch we are on?
>
>
> r~
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2026-04-07 19:28 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 13:05 [RFC PATCH 00/35] target/arm: fully model WFxT instructions for A-profile Alex Bennée
2026-03-20 13:05 ` [RFC PATCH 01/35] target/arm: migrate basic syndrome helpers to registerfields Alex Bennée
2026-04-01 5:36 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 02/35] target/arm: migrate system/cp trap syndromes " Alex Bennée
2026-04-01 5:39 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 03/35] target/arm: migrate FP/SIMD " Alex Bennée
2026-04-01 5:43 ` Richard Henderson
2026-04-01 12:50 ` Alex Bennée
2026-04-01 15:48 ` Peter Maydell
2026-04-01 17:54 ` Pierrick Bouvier
2026-03-20 13:05 ` [RFC PATCH 04/35] target/arm: migrate eret " Alex Bennée
2026-04-05 23:21 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 05/35] target/arm: migrate SME " Alex Bennée
2026-04-05 23:22 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 06/35] target/arm: migrate PAC " Alex Bennée
2026-04-05 23:23 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 07/35] target/arm: migrate BTI " Alex Bennée
2026-04-05 23:28 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 08/35] target/arm: migrate BXJ " Alex Bennée
2026-04-05 23:29 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 09/35] target/arm: migrate Granule Protection traps " Alex Bennée
2026-04-05 23:30 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 10/35] target/arm: migrate fault syndromes " Alex Bennée
2026-04-05 23:32 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 11/35] target/arm: migrate debug " Alex Bennée
2026-04-05 23:37 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 12/35] target/arm: migrate wfx " Alex Bennée
2026-04-05 23:41 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 13/35] target/arm: migrate gcs " Alex Bennée
2026-04-05 23:43 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 14/35] target/arm: migrate memory op " Alex Bennée
2026-04-05 23:44 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 15/35] target/arm: migrate check_hcr_el2_trap to use syndrome helper Alex Bennée
2026-04-06 0:01 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 16/35] target/arm: use syndrome helpers in arm_cpu_do_interrupt_aarch32_hyp Alex Bennée
2026-04-06 0:06 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 17/35] target/arm: use syndrome helpers to set SAME_EL EC bit Alex Bennée
2026-04-06 0:07 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 18/35] target/arm: make whpx use syndrome helpers for decode Alex Bennée
2026-04-06 0:08 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 19/35] target/arm: make hvf " Alex Bennée
2026-04-06 0:08 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 20/35] target/arm: use syndrome helpers in merge_syn_data_abort Alex Bennée
2026-04-06 0:15 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 21/35] target/arm: use syndrome helpers to query VNCR bit Alex Bennée
2026-04-06 0:17 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 22/35] target/arm: remove old syndrome defines Alex Bennée
2026-04-06 0:17 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 23/35] target/arm: report register in WFIT syndromes Alex Bennée
2026-04-06 0:24 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 24/35] target/arm: remove event_register check from arm_cpu_has_work Alex Bennée
2026-04-10 8:47 ` Peter Maydell
2026-04-10 9:35 ` Alex Bennée
2026-04-10 16:19 ` Alex Bennée
2026-03-20 13:05 ` [RFC PATCH 25/35] target/arm: redefine event stream fields Alex Bennée
2026-04-06 0:30 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 26/35] target/arm: add gt_calc_next_event_stream Alex Bennée
2026-04-06 0:34 ` Richard Henderson
2026-03-20 13:05 ` [RFC PATCH 27/35] target/arm: wrap event_register in a union Alex Bennée
2026-04-06 0:37 ` Richard Henderson
2026-04-07 10:35 ` Alex Bennée [this message]
2026-04-08 5:41 ` Richard Henderson
2026-04-08 9:57 ` Peter Maydell
2026-03-20 13:05 ` [RFC PATCH 28/35] target/arm: ensure aarch64 DISAS_WFE will exit Alex Bennée
2026-04-06 3:00 ` Richard Henderson
2026-03-20 13:06 ` [RFC PATCH 29/35] target/arm: implements SEV/SEVL for all modes Alex Bennée
2026-04-06 3:22 ` Richard Henderson
2026-03-20 13:06 ` [RFC PATCH 30/35] target/arm: implement global monitor events Alex Bennée
2026-04-10 9:16 ` Peter Maydell
2026-03-20 13:06 ` [RFC PATCH 31/35] target/arm: enable event stream on WFE instructions Alex Bennée
2026-03-20 13:06 ` [RFC PATCH 32/35] target/arm: implement WFET Alex Bennée
2026-03-20 13:06 ` [RFC PATCH 33/35] tests/tcg: split stage 1 between devices and RAM Alex Bennée
2026-03-20 13:06 ` [RFC PATCH 34/35] tests/tcg: create a mini-gic3 library Alex Bennée
2026-03-20 13:06 ` [RFC PATCH 35/35] tests/tcg: add basic test for aarch64 wf[ie][t] insns Alex Bennée
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=87zf3fawif.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.