target/arm: Read generic timer counters without the BQL
cover target/arm: Read generic timer counters without the BQL
ARM_CP_IO both ends the TB and takes the BQL around the hooks.
Split it into ARM_CP_IO_ENDTB and ARM_CP_IO_BQL (ARM_CP_IO is their union, so existing registers are unchanged), then mark CNTPCT/CNTVCT and their SS variants ENDTB only: they are read-only and only use per-CPU state and QEMU_CLOCK_VIRTUAL, read through the timers_state seqlock.
Under MTTCG, counter reads are no longer serialized on the BQL; with icount this relies on the qemu_icount series based-on below.
Note, RISC-V cycle and instret CSR reads reach icount_get() and icount_get_raw() without holding the BQL. Call path:
helper_csrr()
riscv_csrr()
read_hpmcounter()
riscv_pmu_ctr_get_fixed_counters_val()
cycle = icount_get()
instret = icount_get_raw()
Based-on: <[email protected]> "accel/tcg: Do not write qemu_icount from seqlock readers"
Philippe Mathieu-Daudé (2):
target/arm: Split ARM_CP_IO as ARM_CP_IO_ENDTB + ARM_CP_IO_BQL target/arm: Read generic timer counters without the BQL
docs/devel/multi-thread-tcg.rst | 8 +++++--- target/arm/cpregs.h | 11 ++++++++++- target/arm/helper.c | 24 ++++++++++++------------ target/arm/tcg/op_helper.c | 8 ++++---- target/arm/tcg/translate-a64.c | 2 +- target/arm/tcg/translate.c | 2 +- 6 files changed, 33 insertions(+), 22 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/2 target/arm: Split ARM_CP_IO as ARM_CP_IO_ENDTB + ARM_CP_IO_BQL
ARM_CP_IO both ends the TB at translation and takes the BQL around the read/write hooks. Split it into two flags so a register can end the TB without taking the BQL. ARM_CP_IO is now their union, so existing users are unchanged. Update multi-thread-tcg.rst document. No functional change.
--- docs/devel/multi-thread-tcg.rst | 8 +++++--- target/arm/cpregs.h | 11 ++++++++++- target/arm/helper.c | 4 ++-- target/arm/tcg/op_helper.c | 8 ++++---- target/arm/tcg/translate-a64.c | 2 +- target/arm/tcg/translate.c | 2 +- 6 files changed, 23 insertions(+), 12 deletions(-)
docs/devel/multi-thread-tcg.rst +5 -3
@@ -240,9 +240,11 @@ minimise contention. (Current solution) MMIO access automatically serialises hardware emulation by way of the -BQL. Currently Arm targets serialise all ARM_CP_IO register accesses -and also defer the reset/startup of vCPUs to the vCPU context by way -of async_run_on_cpu(). +BQL. Currently Arm targets serialise all ARM_CP_IO_BQL register +accesses (included in ARM_CP_IO) and also defer the reset/startup of +vCPUs to the vCPU context by way of async_run_on_cpu(). Registers only +marked ARM_CP_IO_ENDTB, such as the generic timer counters, end the TB +but run their accessors without the BQL, so these must be thread-safe. Updates to interrupt state are also protected by the BQL as they can often be cross vCPU.
target/arm/cpregs.h +10 -1
@@ -82,8 +82,10 @@ enum {* Flag: Register does I/O and therefore its accesses need to be marked * with translator_io_start() and also end the TB. In particular, * registers which implement clocks or timers require this. +* Without ARM_CP_IO_BQL, the read and write hooks run without the BQL +* and must be thread-safe. */ - ARM_CP_IO = 1 << 9, + ARM_CP_IO_ENDTB = 1 << 9,/* * Flag: Register has no underlying state and does not support raw access * for state saving/loading; it will not be used for either migration or
@@ -154,6 +156,13 @@ enum {* ARM pseudocode function CheckFPMREnabled(). */ ARM_CP_FPMR =1 <<23 , +/* +* Flag: The read and write hooks are called with the BQL held, e.g. +* because they touch timers, interrupt lines or other cross-vCPU state. +*/ +ARM_CP_IO_BQL =1 <<24 , +/* Flags: Register does I/O and its hooks need the BQL */ + ARM_CP_IO = ARM_CP_IO_ENDTB | ARM_CP_IO_BQL, };/*
target/arm/helper.c +2 -2
@@ -3976,7 +3976,7 @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)* virtual interrupts, which are the logical OR of these bits * and the state of the input lines from the GIC. (This requires * that we have the BQL, which is done by marking the -* reginfo structs as ARM_CP_IO.) +* reginfo structs as ARM_CP_IO_BQL.) * Note that if a write to HCR pends a VIRQ or VFIQ or VINMI or * VFNMI, it is never possible for it to be taken immediately * because VIRQ, VFIQ, VINMI and VFNMI are masked unless running
@@ -4179,7 +4179,7 @@ static void hcrx_write(CPUARMState *env, const ARMCPRegInfo *ri,* virtual NMI, which are the logical OR of these bits * and the state of the input lines from the GIC. (This requires * that we have the BQL, which is done by marking the -* reginfo structs as ARM_CP_IO.) +* reginfo structs as ARM_CP_IO_BQL.) * Note that if a write to HCRX pends a VINMI or VFNMI it is never * possible for it to be taken immediately, because VINMI and * VFNMI are masked unless running at EL0 or EL1, and HCRX
target/arm/tcg/op_helper.c +4 -4
@@ -1244,7 +1244,7 @@ void HELPER(set_cp_reg)(CPUARMState *env, const void *rip, uint32_t value) {const ARMCPRegInfo *ri = rip; -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_BQL ) {bql_lock (); ri->writefn (env, ri, value);bql_unlock ();
@@ -1258,7 +1258,7 @@ uint32_t HELPER(get_cp_reg)(CPUARMState *env, const void *rip)const ARMCPRegInfo *ri = rip;uint32_t res; -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_BQL ) {bql_lock (); res = ri->readfn (env, ri);bql_unlock ();
@@ -1273,7 +1273,7 @@ void HELPER(set_cp_reg64)(CPUARMState *env, const void *rip, uint64_t value) {const ARMCPRegInfo *ri = rip; -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_BQL ) {bql_lock (); ri->writefn (env, ri, value);bql_unlock ();
@@ -1287,7 +1287,7 @@ uint64_t HELPER(get_cp_reg64)(CPUARMState *env, const void *rip)const ARMCPRegInfo *ri = rip;uint64_t res; -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_BQL ) {bql_lock (); res = ri->readfn (env, ri);bql_unlock ();
target/arm/tcg/translate-a64.c +1 -1
@@ -3236,7 +3236,7 @@ static void handle_sys(DisasContext *s, bool isread,g_assert_not_reached (); } -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_ENDTB ) {/* I/O operations must end the TB here (whether read or write) */ need_exit_tb =translator_io_start (&s->base); }
target/arm/tcg/translate.c +1 -1
@@ -1893,7 +1893,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64,g_assert_not_reached (); } -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_ENDTB ) {/* I/O operations must end the TB here (whether read or write) */ need_exit_tb =translator_io_start (&s->base); }
Signature · 1 line
2.55.0
Re: [PATCH 1/2] target/arm: Split ARM_CP_IO as ARM_CP_IO_ENDTB + ARM_CP_IO_BQL
Quoted 56 lines · Philippe Mathieu-Daudé
ARM_CP_IOboth ends the TB at translation and takes the BQL around the read/write hooks. Split it into two flags so a register can end the TB without taking the BQL.ARM_CP_IOis now their union, so existing users are unchanged. Updatemulti-thread-tcg.rstdocument. No functional change.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
docs/devel/multi-thread-tcg.rst | 8 +++++--- target/arm/cpregs.h | 11 ++++++++++- target/arm/helper.c | 4 ++-- target/arm/tcg/op_helper.c | 8 ++++---- target/arm/tcg/translate-a64.c | 2 +- target/arm/tcg/translate.c | 2 +- 6 files changed, 23 insertions(+), 12 deletions(-)docs/devel/multi-thread-tcg.rst +0
-0@@ -240,9 +240,11 @@ minimise contention. (Current solution)MMIO access automatically serialises hardware emulation by way of the
docs/devel/multi-thread-tcg.rst +5
-3-BQL. Currently Arm targets serialise all ARM_CP_IO register accesses -and also defer the reset/startup of vCPUs to the vCPU context by way -of async_run_on_cpu(). +BQL. Currently Arm targets serialise all ARM_CP_IO_BQL register +accesses (included in ARM_CP_IO) and also defer the reset/startup of +vCPUs to the vCPU context by way of async_run_on_cpu(). Registers only +marked ARM_CP_IO_ENDTB, such as the generic timer counters, end the TB +but run their accessors without the BQL, so these must be thread-safe.Updates to interrupt state are also protected by the BQL as they can often be cross vCPU.
target/arm/cpregs.h +3
-1@@ -82,8 +82,10 @@ enum {* Flag: Register does I/O and therefore its accesses need to be marked * with translator_io_start() and also end the TB. In particular, * registers which implement clocks or timers require this. +* Without ARM_CP_IO_BQL, the read and write hooks run without the BQL +* and must be thread-safe. */ - ARM_CP_IO = 1 << 9, + ARM_CP_IO_ENDTB = 1 << 9,/* * Flag: Register has no underlying state and does not support raw access * for state saving/loading; it will not be used for either migration or
target/arm/cpregs.h enum { · line 161
Quoted 6 lines
target/arm/cpregs.h +3
-0@@ -154,6 +156,13 @@ enum {* ARM pseudocode function CheckFPMREnabled(). */ ARM_CP_FPMR = 1 << 23, +/* +* Flag: The read and write hooks are called with the BQL held, e.g. +* because they touch timers, interrupt lines or other cross-vCPU state.
Not including reading the timers if the next patch is any indication…
target/arm/cpregs.h enum { · line 166
Quoted 5 lines
target/arm/cpregs.h +4
-0+*/ +ARM_CP_IO_BQL =1 <<24 , +/* Flags: Register does I/O and its hooks need the BQL */ + ARM_CP_IO = ARM_CP_IO_ENDTB | ARM_CP_IO_BQL, };
Hi,
Is it worthwhile to add an assert somewhere in case somebody does ARM_CP_IO_BQL _without_ ARM_CP_IO_ENDTB by mistake?
Apart from that:
Quoted 94 lines
target/arm/cpregs.h +0
-0/* target/arm/helper.c +2
-2@@ -3976,7 +3976,7 @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)* virtual interrupts, which are the logical OR of these bits * and the state of the input lines from the GIC. (This requires * that we have the BQL, which is done by marking the -* reginfo structs as ARM_CP_IO.) +* reginfo structs as ARM_CP_IO_BQL.) * Note that if a write to HCR pends a VIRQ or VFIQ or VINMI or * VFNMI, it is never possible for it to be taken immediately * because VIRQ, VFIQ, VINMI and VFNMI are masked unless running @@ -4179,7 +4179,7 @@ static void hcrx_write(CPUARMState *env, const ARMCPRegInfo *ri,* virtual NMI, which are the logical OR of these bits * and the state of the input lines from the GIC. (This requires * that we have the BQL, which is done by marking the -* reginfo structs as ARM_CP_IO.) +* reginfo structs as ARM_CP_IO_BQL.) * Note that if a write to HCRX pends a VINMI or VFNMI it is never * possible for it to be taken immediately, because VINMI and * VFNMI are masked unless running at EL0 or EL1, and HCRX target/arm/tcg/op_helper.c +4
-4@@ -1244,7 +1244,7 @@ void HELPER(set_cp_reg)(CPUARMState *env, const void *rip, uint32_t value) {const ARMCPRegInfo *ri = rip; -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_BQL ) {bql_lock (); ri->writefn (env, ri, value);bql_unlock ();@@ -1258,7 +1258,7 @@ uint32_t HELPER(get_cp_reg)(CPUARMState *env, const void *rip)const ARMCPRegInfo *ri = rip;uint32_t res; -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_BQL ) {bql_lock (); res = ri->readfn (env, ri);bql_unlock ();@@ -1273,7 +1273,7 @@ void HELPER(set_cp_reg64)(CPUARMState *env, const void *rip, uint64_t value) {const ARMCPRegInfo *ri = rip; -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_BQL ) {bql_lock (); ri->writefn (env, ri, value);bql_unlock ();@@ -1287,7 +1287,7 @@ uint64_t HELPER(get_cp_reg64)(CPUARMState *env, const void *rip)const ARMCPRegInfo *ri = rip;uint64_t res; -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_BQL ) {bql_lock (); res = ri->readfn (env, ri);bql_unlock ();target/arm/tcg/translate-a64.c +1
-1@@ -3236,7 +3236,7 @@ static void handle_sys(DisasContext *s, bool isread,g_assert_not_reached (); } -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_ENDTB ) {/* I/O operations must end the TB here (whether read or write) */ need_exit_tb =translator_io_start (&s->base); }target/arm/tcg/translate.c +1
-1@@ -1893,7 +1893,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64,g_assert_not_reached (); } -if (ri->type &ARM_CP_IO ) { +if (ri->type &ARM_CP_IO_ENDTB ) {/* I/O operations must end the TB here (whether read or write) */ need_exit_tb =translator_io_start (&s->base); }Signature · 1 line
2.55.0
Re: [PATCH 1/2] target/arm: Split ARM_CP_IO as ARM_CP_IO_ENDTB + ARM_CP_IO_BQL
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
ARM_CP_IOboth ends the TB at translation and takes the BQL around the read/write hooks. Split it into two flags so a register can end the TB without taking the BQL.ARM_CP_IOis now their union, so existing users are unchanged. Updatemulti-thread-tcg.rstdocument. No functional change.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 9 lines
--- docs/devel/multi-thread-tcg.rst | 8 +++++--- target/arm/cpregs.h | 11 ++++++++++- target/arm/helper.c | 4 ++-- target/arm/tcg/op_helper.c | 8 ++++---- target/arm/tcg/translate-a64.c | 2 +- target/arm/tcg/translate.c | 2 +- 6 files changed, 23 insertions(+), 12 deletions(-)
After our conversation, looks good to split both cases.
If I'm correct, we probably want to make sure there are no write function on those registers, no?
It seems that all registers in next patch have only read access.
For the naming and bikeshedding, I would favor to keep IO (as the default BQL version), and introduce CP_IO_NO_BQL (or CP_IO_BQL_FREE). The ENDTB thing does not really makes clear it's supposed to be thread_safe, out of its documentation.
Regards,
Pierrick
PATCH 2/2 target/arm: Read generic timer counters without the BQL
In reply to Philippe Mathieu-DaudéCNTPCT, CNTVCT and their self-synchronized variants are read-only; their readfn uses per-CPU state and QEMU_CLOCK_VIRTUAL, which reads through the timers_state seqlock (cpu_get_clock() or icount_get()). Mark them ARM_CP_IO_ENDTB only, so MTTCG vCPUs reading the counter do not contend on the BQL.
--- target/arm/helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
target/arm/helper.c +10 -10
@@ -2333,23 +2333,23 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { },/* The counter itself */ { .name = "CNTPCT", .cp = 15, .crm = 14, .opc1 = 0, - .access = PL0_R, .type = ARM_CP_64BIT | ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_64BIT | ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .accessfn = gt_pct_access, .readfn = gt_cnt_read, }, { .name = "CNTPCT_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 0, .opc2 = 1, - .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .accessfn = gt_pct_access, .readfn = gt_cnt_read, }, { .name = "CNTVCT", .cp = 15, .crm = 14, .opc1 = 1, - .access = PL0_R, .type = ARM_CP_64BIT | ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_64BIT | ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .accessfn = gt_vct_access, .readfn = gt_virt_cnt_read, }, { .name = "CNTVCT_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 0, .opc2 = 2, - .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .accessfn = gt_vct_access, .readfn = gt_virt_cnt_read, }, /* Comparison value, indicating when the timer goes off */
@@ -2434,23 +2434,23 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {*/ static const ARMCPRegInfo gen_timer_ecv_cp_reginfo[] = { { .name ="CNTVCTSS" , .cp =15 , .crm =14 , .opc1 =9 , - .access =PL0_R , .type =ARM_CP_64BIT |ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_64BIT |ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .accessfn = gt_vct_access, .readfn = gt_virt_cnt_read, }, { .name ="CNTVCTSS_EL0" , .state =ARM_CP_STATE_AA64 , .opc0 =3 , .opc1 =3 , .crn =14 , .crm =0 , .opc2 =6 , - .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .accessfn = gt_vct_access, .readfn = gt_virt_cnt_read, }, { .name ="CNTPCTSS" , .cp =15 , .crm =14 , .opc1 =8 , - .access =PL0_R , .type =ARM_CP_64BIT |ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_64BIT |ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .accessfn = gt_pct_access, .readfn = gt_cnt_read, }, { .name ="CNTPCTSS_EL0" , .state =ARM_CP_STATE_AA64 , .opc0 =3 , .opc1 =3 , .crn =14 , .crm =0 , .opc2 =5 , - .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .accessfn = gt_pct_access, .readfn = gt_cnt_read, }, };
@@ -2512,7 +2512,7 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { }, { .name = "CNTVCT_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 0, .opc2 = 2, - .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .readfn = gt_virt_cnt_read, }, };
@@ -2524,7 +2524,7 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {static const ARMCPRegInfo gen_timer_ecv_cp_reginfo[] = { { .name ="CNTVCTSS_EL0" , .state =ARM_CP_STATE_AA64 , .opc0 =3 , .opc1 =3 , .crn =14 , .crm =0 , .opc2 =6 , - .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .readfn = gt_virt_cnt_read, }, };
Signature · 1 line
2.55.0
Quoted 12 lines · Philippe Mathieu-Daudé
CNTPCT, CNTVCT and their self-synchronized variants are read-only; their readfn uses per-CPU state and
QEMU_CLOCK_VIRTUAL, which reads through thetimers_stateseqlock (cpu_get_clock()oricount_get()). Mark themARM_CP_IO_ENDTBonly, so MTTCG vCPUs reading the counter do not contend on the BQL.Suggested-by Pierrick Bouvier <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 65 lines
---
target/arm/helper.c| 20 ++++++++++----------1 file changed, 10 insertions(+), 10 deletions(-)target/arm/helper.c +8
-8@@ -2333,23 +2333,23 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { },/* The counter itself */ { .name = "CNTPCT", .cp = 15, .crm = 14, .opc1 = 0, - .access = PL0_R, .type = ARM_CP_64BIT | ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_64BIT | ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .accessfn = gt_pct_access, .readfn = gt_cnt_read, }, { .name = "CNTPCT_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 0, .opc2 = 1, - .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .accessfn = gt_pct_access, .readfn = gt_cnt_read, }, { .name = "CNTVCT", .cp = 15, .crm = 14, .opc1 = 1, - .access = PL0_R, .type = ARM_CP_64BIT | ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_64BIT | ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .accessfn = gt_vct_access, .readfn = gt_virt_cnt_read, }, { .name = "CNTVCT_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 0, .opc2 = 2, - .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .accessfn = gt_vct_access, .readfn = gt_virt_cnt_read, }, /* Comparison value, indicating when the timer goes off */@@ -2434,23 +2434,23 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {*/ static const ARMCPRegInfo gen_timer_ecv_cp_reginfo[] = { { .name ="CNTVCTSS" , .cp =15 , .crm =14 , .opc1 =9 , - .access =PL0_R , .type =ARM_CP_64BIT |ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_64BIT |ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .accessfn = gt_vct_access, .readfn = gt_virt_cnt_read, }, { .name ="CNTVCTSS_EL0" , .state =ARM_CP_STATE_AA64 , .opc0 =3 , .opc1 =3 , .crn =14 , .crm =0 , .opc2 =6 , - .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .accessfn = gt_vct_access, .readfn = gt_virt_cnt_read, }, { .name ="CNTPCTSS" , .cp =15 , .crm =14 , .opc1 =8 , - .access =PL0_R , .type =ARM_CP_64BIT |ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_64BIT |ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .accessfn = gt_pct_access, .readfn = gt_cnt_read, }, { .name ="CNTPCTSS_EL0" , .state =ARM_CP_STATE_AA64 , .opc0 =3 , .opc1 =3 , .crn =14 , .crm =0 , .opc2 =5 , - .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .accessfn = gt_pct_access, .readfn = gt_cnt_read, }, };
target/arm/helper.c static const ARMCPRegInfo generic_timer_cp_reginfo[] = { · line 2517
Quoted 7 lines
target/arm/helper.c +1
-1@@ -2512,7 +2512,7 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { }, { .name = "CNTVCT_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 14, .crm = 0, .opc2 = 2, - .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO, + .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO_ENDTB, .readfn = gt_virt_cnt_read, },
Small note that I had when reading the diff:
CNTVCT_EL0 here is for linux-user and the earlier one was for system emulation.
Quoted 14 lines
target/arm/helper.c +1
-1};@@ -2524,7 +2524,7 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {static const ARMCPRegInfo gen_timer_ecv_cp_reginfo[] = { { .name ="CNTVCTSS_EL0" , .state =ARM_CP_STATE_AA64 , .opc0 =3 , .opc1 =3 , .crn =14 , .crm =0 , .opc2 =6 , - .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO , + .access =PL0_R , .type =ARM_CP_NO_RAW |ARM_CP_IO_ENDTB , .readfn = gt_virt_cnt_read, }, };Signature · 1 line
2.55.0