Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Paul Mackerras and committed by
Alexander Graf
04f995a5 439793d4

+7 -5
+7 -5
arch/powerpc/kvm/book3s_hv_rmhandlers.S
··· 1421 1421 sync /* order setting ceded vs. testing prodded */ 1422 1422 lbz r5,VCPU_PRODDED(r3) 1423 1423 cmpwi r5,0 1424 - bne 1f 1424 + bne kvm_cede_prodded 1425 1425 li r0,0 /* set trap to 0 to say hcall is handled */ 1426 1426 stw r0,VCPU_TRAP(r3) 1427 1427 li r0,H_SUCCESS 1428 1428 std r0,VCPU_GPR(R3)(r3) 1429 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 1431 END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) 1432 1432 1433 1433 /* ··· 1446 1446 or r4,r4,r0 1447 1447 PPC_POPCNTW(R7,R4) 1448 1448 cmpw r7,r8 1449 - bge 2f 1449 + bge kvm_cede_exit 1450 1450 stwcx. r4,0,r6 1451 1451 bne 31b 1452 1452 li r0,1 ··· 1555 1555 b hcall_real_fallback 1556 1556 1557 1557 /* cede when already previously prodded case */ 1558 - 1: li r0,0 1558 + kvm_cede_prodded: 1559 + li r0,0 1559 1560 stb r0,VCPU_PRODDED(r3) 1560 1561 sync /* order testing prodded vs. clearing ceded */ 1561 1562 stb r0,VCPU_CEDED(r3) ··· 1564 1563 blr 1565 1564 1566 1565 /* we've ceded but we want to give control to the host */ 1567 - 2: li r3,H_TOO_HARD 1566 + kvm_cede_exit: 1567 + li r3,H_TOO_HARD 1568 1568 blr 1569 1569 1570 1570 secondary_too_late: