monitor: add PPC BookE SPRs
PATCH 1/1 monitor: add PPC BookE SPRs
Read them via KVM_GET_SREGS in kvm_arch_get_registers(), and display them in "info registers".
Also get CR and PID from the existing KVM_GET_REGS.
--- hw/ppc.c | 12 +++++ monitor.c | 71 +++++++++++++++++++++++++++- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++- target-ppc/translate.c | 82 +++++++++++++++++++++++++++++++- 5 files changed, 282 insertions(+), 7 deletions(-)
hw/ppc.c +12 -0
@@ -452,6 +452,10 @@ uint64_t cpu_ppc_load_tbl (CPUState *env)ppc_tb_t *tb_env = env->tb_env;uint64_t tb; +if (kvm_enabled ()) { +return env->spr[SPR_TBL ]; + } + tb =cpu_ppc_get_tb (tb_env,qemu_get_clock_ns (vm_clock), tb_env->tb_offset);LOG_TB ("%s: tb %016" PRIx64"\n" , __func__, tb);
@@ -471,6 +475,10 @@ static inline uint32_t _cpu_ppc_load_tbu(CPUState *env)uint32_t cpu_ppc_load_tbu (CPUState *env) { +if (kvm_enabled ()) { +return env->spr[SPR_TBU ]; + } +return _cpu_ppc_load_tbu (env); }
@@ -616,6 +624,10 @@ uint32_t cpu_ppc_load_decr (CPUState *env) {ppc_tb_t *tb_env = env->tb_env; +if (kvm_enabled ()) { +return env->spr[SPR_DECR ]; + } +return _cpu_ppc_load_decr (env, tb_env->decr_next); }
monitor.c +70 -1
77 lines not on this page · raw message
target-ppc/cpu.h +1 -0
@@ -1016,6 +1016,7 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)#define SPR_HSPRG1 (0x131)#define SPR_HDSISR (0x132)#define SPR_HDAR (0x133) +#define SPR_BOOKE_EPCR (0x133)#define SPR_SPURR (0x134)#define SPR_BOOKE_DBCR0 (0x134)#define SPR_IBCR (0x135)
target-ppc/kvm.c +120 -3
158 lines not on this page · raw message
target-ppc/translate.c +79 -3
94 lines not on this page · raw message
Signature · 1 line
1.7.1
Quoted 14 lines · Scott Wood
Read them via
KVM_GET_SREGSinkvm_arch_get_registers(), and display them in "info registers".Also get CR and PID from the existing
KVM_GET_REGS.Signed-off-by Scott Wood <[email protected]>--- hw/ppc.c | 12 +++++ monitor.c | 71 +++++++++++++++++++++++++++- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++- target-ppc/translate.c | 82 +++++++++++++++++++++++++++++++- 5 files changed, 282 insertions(+), 7 deletions(-)
...
target-ppc/kvm.c int kvm_arch_get_registers(CPUState *env) · line 206
Quoted 11 lines
target-ppc/kvm.c +4
-0@@ -191,11 +197,122 @@ int kvm_arch_get_registers(CPUState *env) env->spr[SPR_SPRG6 ] = regs.sprg6; env->spr[SPR_SPRG7 ] = regs.sprg7; + env->spr[SPR_BOOKE_PID ] = regs.pid; +for (i =0 ;i <32 ; i++) env->gpr[i] = regs.gpr[i]; +#ifdef KVM_CAP_PPC_BOOKE_SREGS +if (kvm_check_extension (env->kvm_state,KVM_CAP_PPC_BOOKE_SREGS )) {
You probably want to cache the result of this syscall during init and check that here. There are plenty examples for this pattern around.
target-ppc/kvm.c int kvm_arch_get_registers(CPUState *env) · line 209
Quoted 3 lines
target-ppc/kvm.c +3
-0+ ret =kvm_vcpu_ioctl (env,KVM_GET_SREGS , &sregs); +if (ret <0 ) +return ret;
Please use chechpatch.pl before submitting.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 6 lines · On Fri, 29 Apr 2011 14:05:23 +0200 Jan Kiszka <[email protected]> wrote:
target-ppc/kvm.c int kvm_arch_get_registers(CPUState *env) · line 206
Quoted 2 lines · Scott Wood
target-ppc/kvm.c +2
-0+#ifdef KVM_CAP_PPC_BOOKE_SREGS +if (kvm_check_extension (env->kvm_state,KVM_CAP_PPC_BOOKE_SREGS )) {You probably want to cache the result of this syscall during init and check that here. There are plenty examples for this pattern around.
OK.
Quoted 5 lines
target-ppc/kvm.c int kvm_arch_get_registers(CPUState *env) · line 209
Quoted 3 lines
target-ppc/kvm.c +3
-0+ ret =kvm_vcpu_ioctl (env,KVM_GET_SREGS , &sregs); +if (ret <0 ) +return ret;Please use chechpatch.pl before submitting.
Doh, will fix.
-Scott