diff options
author | Paul Mackerras <paulus@samba.org> | 2012-08-05 20:03:28 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2012-08-16 08:14:52 -0400 |
commit | 04f995a544d1289ffb8108849cd71b1325c5af6a (patch) | |
tree | da83b019ef1dfc8a0997a3c42de5359f9d7b599d /arch/powerpc | |
parent | 439793d4b3c99e550daebd868bbd58967c93d0b3 (diff) |
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: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_rmhandlers.S | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 5a84c8d3d040..44b72feaff7d 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -1421,13 +1421,13 @@ _GLOBAL(kvmppc_h_cede) | |||
1421 | sync /* order setting ceded vs. testing prodded */ | 1421 | sync /* order setting ceded vs. testing prodded */ |
1422 | lbz r5,VCPU_PRODDED(r3) | 1422 | lbz r5,VCPU_PRODDED(r3) |
1423 | cmpwi r5,0 | 1423 | cmpwi r5,0 |
1424 | bne 1f | 1424 | bne kvm_cede_prodded |
1425 | li r0,0 /* set trap to 0 to say hcall is handled */ | 1425 | li r0,0 /* set trap to 0 to say hcall is handled */ |
1426 | stw r0,VCPU_TRAP(r3) | 1426 | stw r0,VCPU_TRAP(r3) |
1427 | li r0,H_SUCCESS | 1427 | li r0,H_SUCCESS |
1428 | std r0,VCPU_GPR(R3)(r3) | 1428 | std r0,VCPU_GPR(R3)(r3) |
1429 | BEGIN_FTR_SECTION | 1429 | BEGIN_FTR_SECTION |
1430 | b 2f /* just send it up to host on 970 */ | 1430 | b kvm_cede_exit /* just send it up to host on 970 */ |
1431 | END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) | 1431 | END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) |
1432 | 1432 | ||
1433 | /* | 1433 | /* |
@@ -1446,7 +1446,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) | |||
1446 | or r4,r4,r0 | 1446 | or r4,r4,r0 |
1447 | PPC_POPCNTW(R7,R4) | 1447 | PPC_POPCNTW(R7,R4) |
1448 | cmpw r7,r8 | 1448 | cmpw r7,r8 |
1449 | bge 2f | 1449 | bge kvm_cede_exit |
1450 | stwcx. r4,0,r6 | 1450 | stwcx. r4,0,r6 |
1451 | bne 31b | 1451 | bne 31b |
1452 | li r0,1 | 1452 | li r0,1 |
@@ -1555,7 +1555,8 @@ kvm_end_cede: | |||
1555 | b hcall_real_fallback | 1555 | b hcall_real_fallback |
1556 | 1556 | ||
1557 | /* cede when already previously prodded case */ | 1557 | /* cede when already previously prodded case */ |
1558 | 1: li r0,0 | 1558 | kvm_cede_prodded: |
1559 | li r0,0 | ||
1559 | stb r0,VCPU_PRODDED(r3) | 1560 | stb r0,VCPU_PRODDED(r3) |
1560 | sync /* order testing prodded vs. clearing ceded */ | 1561 | sync /* order testing prodded vs. clearing ceded */ |
1561 | stb r0,VCPU_CEDED(r3) | 1562 | stb r0,VCPU_CEDED(r3) |
@@ -1563,7 +1564,8 @@ kvm_end_cede: | |||
1563 | blr | 1564 | blr |
1564 | 1565 | ||
1565 | /* we've ceded but we want to give control to the host */ | 1566 | /* we've ceded but we want to give control to the host */ |
1566 | 2: li r3,H_TOO_HARD | 1567 | kvm_cede_exit: |
1568 | li r3,H_TOO_HARD | ||
1567 | blr | 1569 | blr |
1568 | 1570 | ||
1569 | secondary_too_late: | 1571 | secondary_too_late: |