Commit 04f995a5 authored by Paul Mackerras's avatar Paul Mackerras Committed by Alexander Graf

KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code

In handling the H_CEDE hypercall, if this vcpu has already been
prodded (with the H_PROD hypercall, which Linux guests don't in fact
use), we branch to a numeric label '1f'.  Unfortunately there is
another '1:' label before the one that we want to jump to.  This fixes
the problem by using a textual label, 'kvm_cede_prodded'.  It also
changes the label for another longish branch from '2:' to
'kvm_cede_exit' to avoid a possible future problem if code modifications
add another numeric '2:' label in between.
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent 439793d4
...@@ -1421,13 +1421,13 @@ _GLOBAL(kvmppc_h_cede) ...@@ -1421,13 +1421,13 @@ _GLOBAL(kvmppc_h_cede)
sync /* order setting ceded vs. testing prodded */ sync /* order setting ceded vs. testing prodded */
lbz r5,VCPU_PRODDED(r3) lbz r5,VCPU_PRODDED(r3)
cmpwi r5,0 cmpwi r5,0
bne 1f bne kvm_cede_prodded
li r0,0 /* set trap to 0 to say hcall is handled */ li r0,0 /* set trap to 0 to say hcall is handled */
stw r0,VCPU_TRAP(r3) stw r0,VCPU_TRAP(r3)
li r0,H_SUCCESS li r0,H_SUCCESS
std r0,VCPU_GPR(R3)(r3) std r0,VCPU_GPR(R3)(r3)
BEGIN_FTR_SECTION BEGIN_FTR_SECTION
b 2f /* just send it up to host on 970 */ b kvm_cede_exit /* just send it up to host on 970 */
END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
/* /*
...@@ -1446,7 +1446,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) ...@@ -1446,7 +1446,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
or r4,r4,r0 or r4,r4,r0
PPC_POPCNTW(R7,R4) PPC_POPCNTW(R7,R4)
cmpw r7,r8 cmpw r7,r8
bge 2f bge kvm_cede_exit
stwcx. r4,0,r6 stwcx. r4,0,r6
bne 31b bne 31b
li r0,1 li r0,1
...@@ -1555,7 +1555,8 @@ kvm_end_cede: ...@@ -1555,7 +1555,8 @@ kvm_end_cede:
b hcall_real_fallback b hcall_real_fallback
/* cede when already previously prodded case */ /* cede when already previously prodded case */
1: li r0,0 kvm_cede_prodded:
li r0,0
stb r0,VCPU_PRODDED(r3) stb r0,VCPU_PRODDED(r3)
sync /* order testing prodded vs. clearing ceded */ sync /* order testing prodded vs. clearing ceded */
stb r0,VCPU_CEDED(r3) stb r0,VCPU_CEDED(r3)
...@@ -1563,7 +1564,8 @@ kvm_end_cede: ...@@ -1563,7 +1564,8 @@ kvm_end_cede:
blr blr
/* we've ceded but we want to give control to the host */ /* we've ceded but we want to give control to the host */
2: li r3,H_TOO_HARD kvm_cede_exit:
li r3,H_TOO_HARD
blr blr
secondary_too_late: secondary_too_late:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment