From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] KVM: ARM: fix the size of TTBCR_{T0SZ,T1SZ} masks
Date: Thu, 26 Sep 2013 09:07:20 -0700 [thread overview]
Message-ID: <20130926160720.GB1389@cbox> (raw)
In-Reply-To: <1380210568-23175-2-git-send-email-jonathan.austin@arm.com>
On Thu, Sep 26, 2013 at 04:49:26PM +0100, Jonathan Austin wrote:
> The T{0,1}SZ fields of TTBCR are 3 bits wide when using the long descriptor
> format. Likewise, the T0SZ field of the HTCR is 3-bits. KVM currently
> defines TTBCR_T{0,1}SZ as 3, not 7.
>
> The T0SZ mask is used to calculate the value for the HTCR, both to pick out
> TTBCR.T0SZ and mask off the equivalent field in the HTCR during
> read-modify-write. The incorrect mask size causes the (UNKNOWN) reset value
> of HTCR.T0SZ to leak in to the calculated HTCR value. Linux will hang when
> initializing KVM if HTCR's reset value has bit 2 set (sometimes the case on
> A7/TC2)
>
> Fixing T0SZ allows A7 cores to boot and T1SZ is also fixed for completeness.
>
> Signed-off-by: Jonathan Austin <jonathan.austin@arm.com>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm/include/asm/kvm_arm.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h
> index 64e9696..d556f03 100644
> --- a/arch/arm/include/asm/kvm_arm.h
> +++ b/arch/arm/include/asm/kvm_arm.h
> @@ -95,12 +95,12 @@
> #define TTBCR_IRGN1 (3 << 24)
> #define TTBCR_EPD1 (1 << 23)
> #define TTBCR_A1 (1 << 22)
> -#define TTBCR_T1SZ (3 << 16)
> +#define TTBCR_T1SZ (7 << 16)
> #define TTBCR_SH0 (3 << 12)
> #define TTBCR_ORGN0 (3 << 10)
> #define TTBCR_IRGN0 (3 << 8)
> #define TTBCR_EPD0 (1 << 7)
> -#define TTBCR_T0SZ 3
> +#define TTBCR_T0SZ (7 << 0)
> #define HTCR_MASK (TTBCR_T0SZ | TTBCR_IRGN0 | TTBCR_ORGN0 | TTBCR_SH0)
>
> /* Hyp System Trap Register */
> --
> 1.7.9.5
>
Good catch!
ack.
-Christoffer
next prev parent reply other threads:[~2013-09-26 16:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-26 15:49 [PATCH 0/3] KVM: ARM: Cortex-A7 support and fixes Jonathan Austin
2013-09-26 15:49 ` [PATCH 1/3] KVM: ARM: fix the size of TTBCR_{T0SZ,T1SZ} masks Jonathan Austin
2013-09-26 16:07 ` Christoffer Dall [this message]
2013-09-26 15:49 ` [PATCH 2/3] KVM: ARM: Fix calculation of virtual CPU ID Jonathan Austin
2013-09-26 16:12 ` Christoffer Dall
2013-09-26 15:49 ` [PATCH 3/3] KVM: ARM: Add support for Cortex-A7 Jonathan Austin
2013-09-26 16:17 ` Christoffer Dall
2013-09-26 16:50 ` Marc Zyngier
2013-09-26 17:09 ` Jonathan Austin
[not found] ` <CA+eFSM1YdhBDMAvyXknMA62Ao3CEntMptdi7RD=NXis1F-BmfQ@mail.gmail.com>
2013-10-06 14:56 ` Peter Maydell
[not found] ` <CA+eFSM0k3mA4uOiEvmE_tfVjnpq8DpXV-=nJXhucUDePJRTYXw@mail.gmail.com>
2013-10-07 8:07 ` Marc Zyngier
2013-10-07 9:17 ` Gavin Guo
2013-10-07 9:29 ` Marc Zyngier
2013-10-09 13:06 ` Diana Craciun
2013-10-08 14:16 ` [PATCH 0/3] KVM: ARM: Cortex-A7 support and fixes Gavin Guo
2013-10-09 9:21 ` Jonathan Austin
2013-10-16 0:25 ` Christoffer Dall
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=20130926160720.GB1389@cbox \
--to=christoffer.dall@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).