From patchwork Wed Oct 16 00:49:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 3049611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CAA39BF924 for ; Wed, 16 Oct 2013 01:24:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EADCE202E6 for ; Wed, 16 Oct 2013 01:24:26 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DEE24202B8 for ; Wed, 16 Oct 2013 01:24:25 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VWFKp-0002Cy-9d; Wed, 16 Oct 2013 00:51:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VWFK8-0002dx-Rn; Wed, 16 Oct 2013 00:50:52 +0000 Received: from mail-pb0-f52.google.com ([209.85.160.52]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VWFJ5-0002VE-7W for linux-arm-kernel@lists.infradead.org; Wed, 16 Oct 2013 00:49:48 +0000 Received: by mail-pb0-f52.google.com with SMTP id wz12so41603pbc.39 for ; Tue, 15 Oct 2013 17:49:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OqeDW87BE7N5eLuPJtsdVaBn84FgcBD8Jw/eOuDtaXE=; b=nDpwrUxoahOsowzYnDIpDKhOLBCKJu5dsPF6SyjCIr2Xu5aLf09HLQRXUHNv8V29P7 UwgIVlzkxhn6DsLLxbnfxVJg7rkPqbsXosbJDkQaeMhdgPvk0aS9gwpKVghXZ/Wi07up vqXMd6lcXPXGK7qgoJ5HKAHH8lTHlV80gXqV6ZeddqcrAJnjbnDFWzEA9ulshd1/9z6V vKOGefvvmNQ2i4dUgUfmM4URaLc5A6TvXKA7pHw6bm01RkUrD2050fqgtYaGLMSIIJB5 exGQFJ7VU1/pMed8L/Ldi1OzvXs2aY2fkgT20ZF0gfb8K2tPvLotuNE9XKIK3izMvMFB yKXQ== X-Gm-Message-State: ALoCoQnvZrfsk8NDpP9jUiPeMxpljzY2ualhgAdgZ5W17vTnT2k9NFrQwLJJgZ+pkA4C0yD8xxwC X-Received: by 10.66.118.129 with SMTP id km1mr568081pab.127.1381884565901; Tue, 15 Oct 2013 17:49:25 -0700 (PDT) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id bp4sm84715543pbb.42.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Oct 2013 17:49:25 -0700 (PDT) From: Christoffer Dall To: Gleb Natapov , Paolo Bonzini Subject: [PATCH 7/9] KVM: ARM: fix the size of TTBCR_{T0SZ,T1SZ} masks Date: Tue, 15 Oct 2013 17:49:35 -0700 Message-Id: <1381884577-24747-8-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1381884577-24747-1-git-send-email-christoffer.dall@linaro.org> References: <1381884577-24747-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131015_204947_398655_2EAB0AF3 X-CRM114-Status: GOOD ( 12.13 ) X-Spam-Score: -2.6 (--) Cc: linux-arm-kernel@lists.infradead.org, Christoffer Dall , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Jonathan Austin X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jonathan Austin 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 Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall --- 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 */