mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
target/arm/kvm: Use a switch for kvm_arm_cpreg_level
Use a switch instead of a linear search through data. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
dc40d45ebd
commit
d213f5adf5
1 changed files with 9 additions and 23 deletions
|
@ -361,32 +361,18 @@ bool kvm_arm_reg_syncs_via_cpreg_list(uint64_t regidx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct CPRegStateLevel {
|
|
||||||
uint64_t regidx;
|
|
||||||
int level;
|
|
||||||
} CPRegStateLevel;
|
|
||||||
|
|
||||||
/* All system registers not listed in the following table are assumed to be
|
|
||||||
* of the level KVM_PUT_RUNTIME_STATE. If a register should be written less
|
|
||||||
* often, you must add it to this table with a state of either
|
|
||||||
* KVM_PUT_RESET_STATE or KVM_PUT_FULL_STATE.
|
|
||||||
*/
|
|
||||||
static const CPRegStateLevel non_runtime_cpregs[] = {
|
|
||||||
{ KVM_REG_ARM_TIMER_CNT, KVM_PUT_FULL_STATE },
|
|
||||||
{ KVM_REG_ARM_PTIMER_CNT, KVM_PUT_FULL_STATE },
|
|
||||||
};
|
|
||||||
|
|
||||||
int kvm_arm_cpreg_level(uint64_t regidx)
|
int kvm_arm_cpreg_level(uint64_t regidx)
|
||||||
{
|
{
|
||||||
int i;
|
/*
|
||||||
|
* All system registers are assumed to be level KVM_PUT_RUNTIME_STATE.
|
||||||
for (i = 0; i < ARRAY_SIZE(non_runtime_cpregs); i++) {
|
* If a register should be written less often, you must add it here
|
||||||
const CPRegStateLevel *l = &non_runtime_cpregs[i];
|
* with a state of either KVM_PUT_RESET_STATE or KVM_PUT_FULL_STATE.
|
||||||
if (l->regidx == regidx) {
|
*/
|
||||||
return l->level;
|
switch (regidx) {
|
||||||
}
|
case KVM_REG_ARM_TIMER_CNT:
|
||||||
|
case KVM_REG_ARM_PTIMER_CNT:
|
||||||
|
return KVM_PUT_FULL_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return KVM_PUT_RUNTIME_STATE;
|
return KVM_PUT_RUNTIME_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue