From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Paul Mackerras <paulus@samba.org>, Alexander Graf <agraf@suse.de>,
kvm-ppc@vger.kernel.org
Cc: kvm@vger.kernel.org, Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH 1/5] KVM: PPC: Book3S HV: Fix computation of tlbie operand
Date: Mon, 03 Nov 2014 06:11:43 +0000 [thread overview]
Message-ID: <87d294hlio.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1414990320-6378-2-git-send-email-paulus@samba.org>
Paul Mackerras <paulus@samba.org> writes:
> 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.
Good catch.
>
> 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.
>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Signed-off-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
> arch/powerpc/include/asm/kvm_book3s_64.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h
> index 0aa8179..a37f1a4 100644
> --- a/arch/powerpc/include/asm/kvm_book3s_64.h
> +++ b/arch/powerpc/include/asm/kvm_book3s_64.h
> @@ -148,7 +148,7 @@ static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
> /* This covers 14..54 bits of va*/
> rb = (v & ~0x7fUL) << 16; /* AVA field */
>
> - rb |= v >> (62 - 8); /* B field */
> + rb |= (v >> HPTE_V_SSIZE_SHIFT) << 8; /* B field */
> /*
> * AVA in v had cleared lower 23 bits. We need to derive
> * that from pteg index
> --
> 2.1.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-11-03 6:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 4:51 [PATCH 0/5] Some fixes for HV KVM on PPC Paul Mackerras
2014-11-03 4:51 ` [PATCH 1/5] KVM: PPC: Book3S HV: Fix computation of tlbie operand Paul Mackerras
2014-11-03 6:11 ` Aneesh Kumar K.V [this message]
2014-11-03 6:41 ` Aneesh Kumar K.V
2014-11-03 4:51 ` [PATCH 2/5] KVM: PPC: Book3S HV: Fix an issue where guest is paused on receiving HMI Paul Mackerras
2014-11-20 17:32 ` Alexander Graf
2014-11-03 4:51 ` [PATCH 3/5] KVM: PPC: Book3S HV: Fix KSM memory corruption Paul Mackerras
2014-11-03 4:51 ` [PATCH 4/5] KVM: PPC: Book3S HV: Fix inaccuracies in ICP emulation for H_IPI Paul Mackerras
2014-11-03 4:52 ` [PATCH 5/5] KVM: PPC: Book3S HV: Check wait conditions before sleeping in kvmppc_vcore_blocked Paul Mackerras
2014-11-20 17:36 ` Alexander Graf
2014-11-20 19:31 ` Suresh E. Warrier
2014-11-23 0:41 ` Alexander Graf
2014-11-20 17:36 ` [PATCH 0/5] Some fixes for HV KVM on PPC Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d294hlio.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).