PPC: KVM: fix set_one_reg
cover PPC: KVM: fix set_one_reg
This fixes set-one-register mechanism in KVM and a bug with AMR occured after fixing it.
Alexey Kardashevskiy (2):
target-ppc: fix Authority Mask Register init value
PPC: KVM: fix "set one register"
target-ppc/translate_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.4.rc4
PATCH 1/2 target-ppc: fix Authority Mask Register init value
The existing default value (-1) of the AMR register forbids data access to all 32 classes. Since the guest linux does not change this register, we end up with the guest hanging right after switching from the real to protected mode.
This sets the default AMR value to zero what enables data access for all classes.
The only reason for not hitting this bug before is that kvm_arch_put_registers() did not put any SPR to KVM due to missing assignment of @one_reg_id in _spr_register() (which is going to be fixed by a separate patch).
--- target-ppc/translate_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/translate_init.c +1 -1
@@ -1064,7 +1064,7 @@ static void gen_spr_amr (CPUPPCState *env)spr_register_kvm (env,SPR_AMR ,"AMR" ,SPR_NOACCESS ,SPR_NOACCESS , &spr_read_generic, &spr_write_generic, -KVM_REG_PPC_AMR ,0xffffffffffffffffULL ); +KVM_REG_PPC_AMR ,0 ); spr_register_kvm(env, SPR_UAMOR, "UAMOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic,
Signature · 1 line
1.8.4.rc4
Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/2] target-ppc: fix Authority Mask Register init value
Quoted 8 lines · On Mon, 6 Jan 2014 16:36:39 +1100 Alexey Kardashevskiy <[email protected]> wrote:
The existing default value (-1) of the AMR register forbids data access to all 32 classes. Since the guest linux does not change this register, we end up with the guest hanging right after switching from the real to protected mode.
This sets the default AMR value to zero what enables data access for all classes.
Quoted 6 lines
The only reason for not hitting this bug before is that
kvm_arch_put_registers()did not put any SPR to KVM due to missing assignment of @one_reg_id in_spr_register()(which is going to be fixed by a separate patch).Signed-off-by Alexey Kardashevskiy <[email protected]>
Quoted 17 lines
--- target-ppc/translate_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target-ppc/translate_init.c +1
-1@@ -1064,7 +1064,7 @@ static void gen_spr_amr (CPUPPCState *env)spr_register_kvm (env,SPR_AMR ,"AMR" ,SPR_NOACCESS ,SPR_NOACCESS , &spr_read_generic, &spr_write_generic, -KVM_REG_PPC_AMR ,0xffffffffffffffffULL ); +KVM_REG_PPC_AMR ,0 ); spr_register_kvm(env, SPR_UAMOR, "UAMOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic,
Signature · 7 lines
Gregory Kurz [email protected] [email protected] Software Engineer @ IBM/Meiosys http://www.ibm.com Tel +33 (0)562 165 496 "Anarchy is about taking complete responsibility for yourself." Alan Moore.
PATCH 2/2 PPC: KVM: fix "set one register"
In reply to Alexey KardashevskiyDue to missing @one_reg_id assignment in _spr_register(), the kvm_get_one_reg/kvm_set_one_reg API has never really been working.
This enabled the API and removes use of the API for LPCR as kvm_arch_get_registers/kvm_arch_put_registers run a loop for all 1024 SPR and LPCR is one of them.
--- target-ppc/translate_init.c | 3 +++ 1 file changed, 3 insertions(+)
target-ppc/translate_init.c +3 -0
@@ -628,6 +628,9 @@ static inline void _spr_register(CPUPPCState *env, int num, spr->oea_read = oea_read; spr->oea_write = oea_write;#endif +#if defined(CONFIG_KVM ) + spr->one_reg_id = one_reg_id, +#endif env->spr[num] = initial_value; }
Signature · 1 line
1.8.4.rc4
Re: [Qemu-devel] [PATCH 2/2] PPC: KVM: fix "set one register"
Quoted 6 lines · Alexey Kardashevskiy
Due to missing @one_reg_id assignment in
_spr_register(), the kvm_get_one_reg/kvm_set_one_reg API has never really been working.This enabled the API and removes use of the API for LPCR as kvm_arch_get_registers/kvm_arch_put_registers run a loop for all 1024 SPR and LPCR is one of them.
Agrh.
The commit message must be:
===
Due to missing @one_reg_id assignment in _spr_register(), the kvm_get_one_reg/kvm_set_one_reg API has never really been working.
This reenables the API by assigning the @one_reg_id field in the SPR descriptor.
===
Repost?
Quoted 21 lines
Signed-off-by Alexey Kardashevskiy <[email protected]>--- target-ppc/translate_init.c | 3 +++ 1 file changed, 3 insertions(+)target-ppc/translate_init.c +3
-0@@ -628,6 +628,9 @@ static inline void _spr_register(CPUPPCState *env, int num, spr->oea_read = oea_read; spr->oea_write = oea_write;#endif +#if defined(CONFIG_KVM ) + spr->one_reg_id = one_reg_id, +#endif env->spr[num] = initial_value; }
Signature · 1 line
Alexey
RFC 1/1 PPC: KVM: add support for LPCR
The LPCR special purpose register was introduced with the PowerPC 970MP family.
This patch initializes LPCR for the following families:
- 970 MP
- POWER5+
- POWER7
- POWER8
---
Along with Alexey's fixes for the get/put one reg API, I could drop the target-ppc/kvm.c bits from:
http://patchwork.ozlabs.org/patch/300210/
and have cross-endian virtio working.
Thanks Alexey. :)
target-ppc/translate_init.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
target-ppc/translate_init.c +15 -1
@@ -2582,7 +2582,6 @@ static void gen_spr_8xx (CPUPPCState *env)* HSRR0 => SPR 314 (Power 2.04 hypv) * HSRR1 => SPR 315 (Power 2.04 hypv) * LPIDR => SPR 317 (970) -* LPCR => SPR 318 (970) * EPR => SPR 702 (Power 2.04 emb) * perf => 768-783 (Power 2.04) * perf => 784-799 (Power 2.04)
@@ -6831,6 +6830,11 @@ static void init_proc_970MP (CPUPPCState *env)SPR_NOACCESS ,SPR_NOACCESS , &spr_read_hior, &spr_write_hior, 0x00000000); +/* Logical partitionning */ +spr_register_kvm (env,SPR_LPCR ,"LPCR" , +SPR_NOACCESS ,SPR_NOACCESS , + &spr_read_generic, &spr_write_generic, +KVM_REG_PPC_LPCR ,0x00000000 );#if !defined(CONFIG_USER_ONLY ) env->slb_nr =32 ;#endif
@@ -6915,6 +6919,11 @@ static void init_proc_power5plus(CPUPPCState *env) &spr_read_generic, &spr_write_generic, &spr_read_generic, &spr_write_generic, 0x00000000); +/* Logical partitionning */ +spr_register_kvm (env,SPR_LPCR ,"LPCR" , +SPR_NOACCESS ,SPR_NOACCESS , + &spr_read_generic, &spr_write_generic, +KVM_REG_PPC_LPCR ,0x00000000 );#if !defined(CONFIG_USER_ONLY ) env->slb_nr =64 ;#endif
@@ -7019,6 +7028,11 @@ static void init_proc_POWER7 (CPUPPCState *env) &spr_read_generic, &spr_write_generic, &spr_read_generic, &spr_write_generic, 0x00000000); +/* Logical partitionning */ +spr_register_kvm (env,SPR_LPCR ,"LPCR" , +SPR_NOACCESS ,SPR_NOACCESS , + &spr_read_generic, &spr_write_generic, +KVM_REG_PPC_LPCR ,0x00000000 );#if !defined(CONFIG_USER_ONLY ) env->slb_nr =32 ;#endif
Re: [Qemu-devel] [Qemu-ppc] [RFC] PPC: KVM: add support for LPCR
Quoted 9 lines · Greg Kurz
The LPCR special purpose register was introduced with the PowerPC 970MP family.
This patch initializes LPCR for the following families:
- 970 MP
- POWER5+
- POWER7
- POWER8Signed-off-by Greg Kurz <[email protected]>
Very nice and simple. Thanks, applied to ppc-next.
Alex
Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] PPC: KVM: fix "set one register"
In reply to Alexey KardashevskiyQuoted 8 lines · On Mon, 6 Jan 2014 16:36:40 +1100 Alexey Kardashevskiy <[email protected]> wrote:
Due to missing @one_reg_id assignment in
_spr_register(), the kvm_get_one_reg/kvm_set_one_reg API has never really been working.This enabled the API and removes use of the API for LPCR as kvm_arch_get_registers/kvm_arch_put_registers run a loop for all 1024 SPR and LPCR is one of them.
Signed-off-by Alexey Kardashevskiy <[email protected]>
Quoted 18 lines
--- target-ppc/translate_init.c | 3 +++ 1 file changed, 3 insertions(+)target-ppc/translate_init.c +3
-0@@ -628,6 +628,9 @@ static inline void _spr_register(CPUPPCState *env, int num, spr->oea_read = oea_read; spr->oea_write = oea_write;#endif +#if defined(CONFIG_KVM ) + spr->one_reg_id = one_reg_id, +#endif env->spr[num] = initial_value; }
Signature · 7 lines
Gregory Kurz [email protected] [email protected] Software Engineer @ IBM/Meiosys http://www.ibm.com Tel +33 (0)562 165 496 "Anarchy is about taking complete responsibility for yourself." Alan Moore.
Alexander Graf
AppliedQuoted 1 line · Alexey Kardashevskiy
This fixes set-one-register mechanism in KVM and a bug with AMR occured after fixing it.
Thanks, applied to ppc-next (with fixed commit message for 2/2).
Alex