[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 18/21] target/ppc: Remove msr_ts macro
From: |
Víctor Colombo |
Subject: |
[PATCH v2 18/21] target/ppc: Remove msr_ts macro |
Date: |
Mon, 2 May 2022 11:39:31 -0300 |
msr_ts macro hides the usage of env->msr, which is a bad
behavior. Substitute it with FIELD_EX64 calls that explicitly use
env->msr as a parameter.
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Víctor Colombo <victor.colombo@eldorado.org.br>
---
v2: Remove M_MSR_TS* and use FIELD_EX64 instead.
Signed-off-by: Víctor Colombo <victor.colombo@eldorado.org.br>
---
target/ppc/cpu.h | 2 +-
target/ppc/kvm.c | 4 ++--
target/ppc/machine.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 5fce8f00da..0b861660ae 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -354,6 +354,7 @@ typedef enum {
#define MSR_RI 1 /* Recoverable interrupt 1 */
#define MSR_LE 0 /* Little-endian mode 1 hflags */
+FIELD(MSR, TS, MSR_TS0, 2)
FIELD(MSR, CM, MSR_CM, 1)
FIELD(MSR, GS, MSR_GS, 1)
FIELD(MSR, POW, MSR_POW, 1)
@@ -487,7 +488,6 @@ FIELD(MSR, LE, MSR_LE, 1)
#else
#define msr_hv (0)
#endif
-#define msr_ts ((env->msr >> MSR_TS1) & 3)
#define DBCR0_ICMP (1 << 27)
#define DBCR0_BRT (1 << 26)
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 8276326de9..59db1b9227 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -973,7 +973,7 @@ int kvm_arch_put_registers(CPUState *cs, int level)
}
#ifdef TARGET_PPC64
- if (msr_ts) {
+ if (FIELD_EX64(env->msr, MSR, TS)) {
for (i = 0; i < ARRAY_SIZE(env->tm_gpr); i++) {
kvm_set_one_reg(cs, KVM_REG_PPC_TM_GPR(i), &env->tm_gpr[i]);
}
@@ -1281,7 +1281,7 @@ int kvm_arch_get_registers(CPUState *cs)
}
#ifdef TARGET_PPC64
- if (msr_ts) {
+ if (FIELD_EX64(env->msr, MSR, TS)) {
for (i = 0; i < ARRAY_SIZE(env->tm_gpr); i++) {
kvm_get_one_reg(cs, KVM_REG_PPC_TM_GPR(i), &env->tm_gpr[i]);
}
diff --git a/target/ppc/machine.c b/target/ppc/machine.c
index e673944597..7104a5c67e 100644
--- a/target/ppc/machine.c
+++ b/target/ppc/machine.c
@@ -417,7 +417,7 @@ static bool tm_needed(void *opaque)
{
PowerPCCPU *cpu = opaque;
CPUPPCState *env = &cpu->env;
- return msr_ts;
+ return FIELD_EX64(env->msr, MSR, TS);
}
static const VMStateDescription vmstate_tm = {
--
2.25.1
- Re: [PATCH v2 13/21] target/ppc: Remove msr_me macro, (continued)
- [PATCH v2 14/21] target/ppc: Remove msr_ir macro, Víctor Colombo, 2022/05/02
- [PATCH v2 15/21] target/ppc: Remove msr_dr macro, Víctor Colombo, 2022/05/02
- [PATCH v2 16/21] target/ppc: Remove msr_ep macro, Víctor Colombo, 2022/05/02
- [PATCH v2 17/21] target/ppc: Remove msr_fe0 and msr_fe1 macros, Víctor Colombo, 2022/05/02
- [PATCH v2 18/21] target/ppc: Remove msr_ts macro,
Víctor Colombo <=
- [PATCH v2 19/21] target/ppc: Remove msr_hv macro, Víctor Colombo, 2022/05/02
- [PATCH v2 20/21] target/ppc: Add unused msr bits FIELDs, Víctor Colombo, 2022/05/02
- [PATCH v2 21/21] target/ppc: Change MSR_* to follow POWER ISA numbering convention, Víctor Colombo, 2022/05/02
- Re: [PATCH v2 00/21] target/ppc: Remove hidden usages of *env, Cédric Le Goater, 2022/05/02