KVM: PPC: Book3S HV: Fix computation of tlbie operand
authorPaul Mackerras <paulus@samba.org>
Mon, 3 Nov 2014 04:51:56 +0000 (15:51 +1100)
committerAlexander Graf <agraf@suse.de>
Mon, 15 Dec 2014 12:27:23 +0000 (13:27 +0100)
commitd506735b1a3c78e2efb9dc4019c76e9d3938a160
tree411c5ade75edecfa70d13770ac66b96517be4473
parentf6fb9e848c39d65516caf7614fc8e0b28f5301ce
KVM: PPC: Book3S HV: Fix computation of tlbie operand

The B (segment size) field in the RB operand for the tlbie
instruction is two bits, which we get from the top two bits of
the first doubleword of the HPT entry to be invalidated.  These
bits go in bits 8 and 9 of the RB operand (bits 54 and 55 in IBM
bit numbering).

The compute_tlbie_rb() function gets these bits as v >> (62 - 8),
which is not correct as it will bring in the top 10 bits, not
just the top two.  These extra bits could corrupt the AP, AVAL
and L fields in the RB value.  To fix this we shift right 62 bits
and then shift left 8 bits, so we only get the two bits of the
B field.

The first doubleword of the HPT entry is under the control of the
guest kernel.  In fact, Linux guests will always put zeroes in bits
54 -- 61 (IBM bits 2 -- 9), but we should not rely on guests doing
this.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/include/asm/kvm_book3s_64.h