From: Jonathan Cameron via <qemu-arm@nongnu.org>
To: Cornelia Huck <cohuck@redhat.com>
Cc: <qemu-arm@nongnu.org>, <qemu-devel@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>,
Eric Auger <eric.auger@redhat.com>
Subject: Re: [PATCH RFC 1/3] arm: handle demuxed ID registers
Date: Wed, 21 Jan 2026 09:40:44 +0000 [thread overview]
Message-ID: <20260121094044.000019a8@huawei.com> (raw)
In-Reply-To: <20260119172732.140613-2-cohuck@redhat.com>
On Mon, 19 Jan 2026 18:27:30 +0100
Cornelia Huck <cohuck@redhat.com> wrote:
> For some registers, we do not have a single ID register, but actually
> an array of values (e.g. CCSIDR_EL1, where the actual value is
> determined by whatever CSSELR_EL1 points to.) If we want to avoid
> using a different way to handle registers like that for every
> instance, we should provide some kind of infrastructure. Therefore,
> add accessors {GET,SET}_IDREG_DEMUX that are similar to the accessors
> we already use for regular ID registers.
>
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> ---
> target/arm/cpu-sysregs.h | 5 +++++
> target/arm/cpu.h | 20 ++++++++++++++++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/target/arm/cpu-sysregs.h b/target/arm/cpu-sysregs.h
> index 7877a3b06a8e..31f82c6a0afc 100644
> --- a/target/arm/cpu-sysregs.h
> +++ b/target/arm/cpu-sysregs.h
> @@ -35,6 +35,11 @@ typedef enum ARMSysRegs {
>
> #undef DEF
>
> +/* ID registers that vary based upon another register */
> +typedef enum ARMIDRegisterDemuxIdx {
> + NUM_ID_DEMUX_IDX,
> +} ARMIDRegisterDemuxIdx;
> +
> extern const uint32_t id_register_sysreg[NUM_ID_IDX];
>
> int get_sysreg_idx(ARMSysRegs sysreg);
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index 08b7d3fb936a..f7bd19f26fbd 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -905,6 +905,25 @@ typedef struct {
> i_->idregs[REG ## _EL1_IDX]; \
> })
>
> +#define SET_IDREG_DEMUX(ISAR, REG, INDEX, VALUE) \
> + ({ \
> + ARMISARegisters *i_ = (ISAR); \
> + i_->idregs_demux[REG ## _EL1_DEMUX_IDX][INDEX] = VALUE; \
> + })
> +
> +#define GET_IDREG_DEMUX(ISAR, REG, INDEX) \
> + ({ \
> + ARMISARegisters *i_ = (ISAR); \
> + i_->idregs_demux[REG ## _EL1_DEMUX_IDX][INDEX]; \
> + })
> +
> +#define COPY_IDREG_DEMUX(ISAR, REG, FROM_INDEX, TO_INDEX) \
> + ({ \
> + ARMISARegisters *i_ = (ISAR); \
> + i_->idregs_demux[REG ## _EL1_DEMUX_IDX][TO_INDEX] = \
> + i_->idregs_demux[REG ## _EL1_DEMUX_IDX][FROM_INDEX]; \
> + })
> +
> /**
> * ARMCPU:
> * @env: #CPUARMState
> @@ -1083,6 +1102,7 @@ struct ArchCPU {
> uint32_t dbgdevid1;
> uint64_t reset_pmcr_el0;
> uint64_t idregs[NUM_ID_IDX];
> + uint64_t idregs_demux[NUM_ID_DEMUX_IDX][16];
Hi,
Trivial, but I'd like a comment on why 16. I assume because that's
the biggest you've seen so far (8 levels, 2 types for CCSIDR)
Just good to have a bread crumb here for future readers.
Otherwise seems reasonable to me.
> } isar;
> uint64_t midr;
> uint32_t revidr;
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron via qemu development <qemu-devel@nongnu.org>
To: Cornelia Huck <cohuck@redhat.com>
Cc: <qemu-arm@nongnu.org>, <qemu-devel@nongnu.org>,
Peter Maydell <peter.maydell@linaro.org>,
Eric Auger <eric.auger@redhat.com>
Subject: Re: [PATCH RFC 1/3] arm: handle demuxed ID registers
Date: Wed, 21 Jan 2026 09:40:44 +0000 [thread overview]
Message-ID: <20260121094044.000019a8@huawei.com> (raw)
In-Reply-To: <20260119172732.140613-2-cohuck@redhat.com>
On Mon, 19 Jan 2026 18:27:30 +0100
Cornelia Huck <cohuck@redhat.com> wrote:
> For some registers, we do not have a single ID register, but actually
> an array of values (e.g. CCSIDR_EL1, where the actual value is
> determined by whatever CSSELR_EL1 points to.) If we want to avoid
> using a different way to handle registers like that for every
> instance, we should provide some kind of infrastructure. Therefore,
> add accessors {GET,SET}_IDREG_DEMUX that are similar to the accessors
> we already use for regular ID registers.
>
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> ---
> target/arm/cpu-sysregs.h | 5 +++++
> target/arm/cpu.h | 20 ++++++++++++++++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/target/arm/cpu-sysregs.h b/target/arm/cpu-sysregs.h
> index 7877a3b06a8e..31f82c6a0afc 100644
> --- a/target/arm/cpu-sysregs.h
> +++ b/target/arm/cpu-sysregs.h
> @@ -35,6 +35,11 @@ typedef enum ARMSysRegs {
>
> #undef DEF
>
> +/* ID registers that vary based upon another register */
> +typedef enum ARMIDRegisterDemuxIdx {
> + NUM_ID_DEMUX_IDX,
> +} ARMIDRegisterDemuxIdx;
> +
> extern const uint32_t id_register_sysreg[NUM_ID_IDX];
>
> int get_sysreg_idx(ARMSysRegs sysreg);
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index 08b7d3fb936a..f7bd19f26fbd 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -905,6 +905,25 @@ typedef struct {
> i_->idregs[REG ## _EL1_IDX]; \
> })
>
> +#define SET_IDREG_DEMUX(ISAR, REG, INDEX, VALUE) \
> + ({ \
> + ARMISARegisters *i_ = (ISAR); \
> + i_->idregs_demux[REG ## _EL1_DEMUX_IDX][INDEX] = VALUE; \
> + })
> +
> +#define GET_IDREG_DEMUX(ISAR, REG, INDEX) \
> + ({ \
> + ARMISARegisters *i_ = (ISAR); \
> + i_->idregs_demux[REG ## _EL1_DEMUX_IDX][INDEX]; \
> + })
> +
> +#define COPY_IDREG_DEMUX(ISAR, REG, FROM_INDEX, TO_INDEX) \
> + ({ \
> + ARMISARegisters *i_ = (ISAR); \
> + i_->idregs_demux[REG ## _EL1_DEMUX_IDX][TO_INDEX] = \
> + i_->idregs_demux[REG ## _EL1_DEMUX_IDX][FROM_INDEX]; \
> + })
> +
> /**
> * ARMCPU:
> * @env: #CPUARMState
> @@ -1083,6 +1102,7 @@ struct ArchCPU {
> uint32_t dbgdevid1;
> uint64_t reset_pmcr_el0;
> uint64_t idregs[NUM_ID_IDX];
> + uint64_t idregs_demux[NUM_ID_DEMUX_IDX][16];
Hi,
Trivial, but I'd like a comment on why 16. I assume because that's
the biggest you've seen so far (8 levels, 2 types for CCSIDR)
Just good to have a bread crumb here for future readers.
Otherwise seems reasonable to me.
> } isar;
> uint64_t midr;
> uint32_t revidr;
next prev parent reply other threads:[~2026-01-21 9:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-19 17:27 [PATCH RFC 0/3] arm: demuxed ID registers (CCSIDR_EL1) Cornelia Huck
2026-01-19 17:27 ` [PATCH RFC 1/3] arm: handle demuxed ID registers Cornelia Huck
2026-01-21 9:40 ` Jonathan Cameron via [this message]
2026-01-21 9:40 ` Jonathan Cameron via qemu development
2026-01-21 16:25 ` Cornelia Huck
2026-01-19 17:27 ` [PATCH RFC 2/3] arm: handle CCSIDR_EL1 as a demuxed register Cornelia Huck
2026-01-19 17:27 ` [PATCH RFC 3/3] arm/kvm: get demuxed ID registers from kvm Cornelia Huck
2026-01-20 11:44 ` [PATCH RFC 0/3] arm: demuxed ID registers (CCSIDR_EL1) Alireza Sanaee via
2026-01-20 11:44 ` Alireza Sanaee via qemu development
2026-01-21 16:28 ` Cornelia Huck
2026-01-22 13:31 ` Alireza Sanaee via
2026-01-22 13:31 ` Alireza Sanaee via qemu development
2026-01-20 15:40 ` Sebastian Ott
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=20260121094044.000019a8@huawei.com \
--to=qemu-arm@nongnu.org \
--cc=cohuck@redhat.com \
--cc=eric.auger@redhat.com \
--cc=jonathan.cameron@huawei.com \
--cc=peter.maydell@linaro.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 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.