target/arm: use FIELD macro for CNTHCTL bit definitions
We prefer the FIELD macro over ad-hoc #defines for register bits; switch CNTHCTL to that style before we add any more bits. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20240301183219.2424889-4-peter.maydell@linaro.org
This commit is contained in:
parent
1e8d14037b
commit
c6b0ecb236
@ -2652,8 +2652,8 @@ static void gt_update_irq(ARMCPU *cpu, int timeridx)
|
||||
* It is RES0 in Secure and NonSecure state.
|
||||
*/
|
||||
if ((ss == ARMSS_Root || ss == ARMSS_Realm) &&
|
||||
((timeridx == GTIMER_VIRT && (cnthctl & CNTHCTL_CNTVMASK)) ||
|
||||
(timeridx == GTIMER_PHYS && (cnthctl & CNTHCTL_CNTPMASK)))) {
|
||||
((timeridx == GTIMER_VIRT && (cnthctl & R_CNTHCTL_CNTVMASK_MASK)) ||
|
||||
(timeridx == GTIMER_PHYS && (cnthctl & R_CNTHCTL_CNTPMASK_MASK)))) {
|
||||
irqstate = 0;
|
||||
}
|
||||
|
||||
@ -2968,12 +2968,11 @@ static void gt_cnthctl_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
{
|
||||
ARMCPU *cpu = env_archcpu(env);
|
||||
uint32_t oldval = env->cp15.cnthctl_el2;
|
||||
|
||||
raw_write(env, ri, value);
|
||||
|
||||
if ((oldval ^ value) & CNTHCTL_CNTVMASK) {
|
||||
if ((oldval ^ value) & R_CNTHCTL_CNTVMASK_MASK) {
|
||||
gt_update_irq(cpu, GTIMER_VIRT);
|
||||
} else if ((oldval ^ value) & CNTHCTL_CNTPMASK) {
|
||||
} else if ((oldval ^ value) & R_CNTHCTL_CNTPMASK_MASK) {
|
||||
gt_update_irq(cpu, GTIMER_PHYS);
|
||||
}
|
||||
}
|
||||
|
@ -224,8 +224,31 @@ FIELD(VTCR, SL2, 33, 1)
|
||||
#define HSTR_TTEE (1 << 16)
|
||||
#define HSTR_TJDBX (1 << 17)
|
||||
|
||||
#define CNTHCTL_CNTVMASK (1 << 18)
|
||||
#define CNTHCTL_CNTPMASK (1 << 19)
|
||||
/*
|
||||
* Depending on the value of HCR_EL2.E2H, bits 0 and 1
|
||||
* have different bit definitions, and EL1PCTEN might be
|
||||
* bit 0 or bit 10. We use _E2H1 and _E2H0 suffixes to
|
||||
* disambiguate if necessary.
|
||||
*/
|
||||
FIELD(CNTHCTL, EL0PCTEN_E2H1, 0, 1)
|
||||
FIELD(CNTHCTL, EL0VCTEN_E2H1, 1, 1)
|
||||
FIELD(CNTHCTL, EL1PCTEN_E2H0, 0, 1)
|
||||
FIELD(CNTHCTL, EL1PCEN_E2H0, 1, 1)
|
||||
FIELD(CNTHCTL, EVNTEN, 2, 1)
|
||||
FIELD(CNTHCTL, EVNTDIR, 3, 1)
|
||||
FIELD(CNTHCTL, EVNTI, 4, 4)
|
||||
FIELD(CNTHCTL, EL0VTEN, 8, 1)
|
||||
FIELD(CNTHCTL, EL0PTEN, 9, 1)
|
||||
FIELD(CNTHCTL, EL1PCTEN_E2H1, 10, 1)
|
||||
FIELD(CNTHCTL, EL1PTEN, 11, 1)
|
||||
FIELD(CNTHCTL, ECV, 12, 1)
|
||||
FIELD(CNTHCTL, EL1TVT, 13, 1)
|
||||
FIELD(CNTHCTL, EL1TVCT, 14, 1)
|
||||
FIELD(CNTHCTL, EL1NVPCT, 15, 1)
|
||||
FIELD(CNTHCTL, EL1NVVCT, 16, 1)
|
||||
FIELD(CNTHCTL, EVNTIS, 17, 1)
|
||||
FIELD(CNTHCTL, CNTVMASK, 18, 1)
|
||||
FIELD(CNTHCTL, CNTPMASK, 19, 1)
|
||||
|
||||
/* We use a few fake FSR values for internal purposes in M profile.
|
||||
* M profile cores don't have A/R format FSRs, but currently our
|
||||
|
Loading…
Reference in New Issue
Block a user