[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 3/8] target/ppc: Fix move-to timebase SPR access permissions
From: |
Nicholas Piggin |
Subject: |
[PATCH v3 3/8] target/ppc: Fix move-to timebase SPR access permissions |
Date: |
Fri, 1 Dec 2023 22:16:31 +1000 |
The move-to timebase registers TBU and TBL can not be read, and they
can not be written in supervisor mode on hypervisor-capable CPUs.
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
target/ppc/helper_regs.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c
index 6f190ab13b..f1493ddca0 100644
--- a/target/ppc/helper_regs.c
+++ b/target/ppc/helper_regs.c
@@ -468,18 +468,33 @@ void register_generic_sprs(PowerPCCPU *cpu)
&spr_read_tbl, SPR_NOACCESS,
&spr_read_tbl, SPR_NOACCESS,
0x00000000);
- spr_register(env, SPR_WR_TBL, "TBL",
- &spr_read_tbl, SPR_NOACCESS,
- &spr_read_tbl, &spr_write_tbl,
- 0x00000000);
spr_register(env, SPR_TBU, "TBU",
&spr_read_tbu, SPR_NOACCESS,
&spr_read_tbu, SPR_NOACCESS,
0x00000000);
- spr_register(env, SPR_WR_TBU, "TBU",
- &spr_read_tbu, SPR_NOACCESS,
- &spr_read_tbu, &spr_write_tbu,
- 0x00000000);
+#ifndef CONFIG_USER_ONLY
+ if (env->has_hv_mode) {
+ spr_register_hv(env, SPR_WR_TBL, "TBL",
+ SPR_NOACCESS, SPR_NOACCESS,
+ SPR_NOACCESS, SPR_NOACCESS,
+ SPR_NOACCESS, &spr_write_tbl,
+ 0x00000000);
+ spr_register_hv(env, SPR_WR_TBU, "TBU",
+ SPR_NOACCESS, SPR_NOACCESS,
+ SPR_NOACCESS, SPR_NOACCESS,
+ SPR_NOACCESS, &spr_write_tbu,
+ 0x00000000);
+ } else {
+ spr_register(env, SPR_WR_TBL, "TBL",
+ SPR_NOACCESS, SPR_NOACCESS,
+ SPR_NOACCESS, &spr_write_tbl,
+ 0x00000000);
+ spr_register(env, SPR_WR_TBU, "TBU",
+ SPR_NOACCESS, SPR_NOACCESS,
+ SPR_NOACCESS, &spr_write_tbu,
+ 0x00000000);
+ }
+#endif
}
void register_non_embedded_sprs(CPUPPCState *env)
--
2.42.0
- [PATCH v3 0/8] ppc: pnv ChipTOD and various timebase fixes, Nicholas Piggin, 2023/12/01
- [PATCH v3 4/8] pnv/chiptod: Add POWER9/10 chiptod model, Nicholas Piggin, 2023/12/01
- [PATCH v3 5/8] ppc/pnv: Wire ChipTOD model to powernv9 and powernv10 machines, Nicholas Piggin, 2023/12/01
- [PATCH v3 7/8] target/ppc: Implement core timebase state machine and TFMR, Nicholas Piggin, 2023/12/01
- [PATCH v3 8/8] target/ppc: Add SMT support to time facilities, Nicholas Piggin, 2023/12/01
- [PATCH v3 1/8] target/ppc: Rename TBL to TB on 64-bit, Nicholas Piggin, 2023/12/01
- [PATCH v3 3/8] target/ppc: Fix move-to timebase SPR access permissions,
Nicholas Piggin <=
- [PATCH v3 2/8] target/ppc: Improve timebase register defines naming, Nicholas Piggin, 2023/12/01
- [PATCH v3 6/8] pnv/chiptod: Implement the ChipTOD to Core transfer, Nicholas Piggin, 2023/12/01