From patchwork Sun Jan 11 13:10:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 42951 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C5AD12055F for ; Sun, 11 Jan 2015 13:11:59 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id p9sf7917549lbv.1 for ; Sun, 11 Jan 2015 05:11:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=E/eRFDztzlN8EUTtUyihGvuQlvIx0o7F1RxlhwB/Ijk=; b=XzkQgk+JUGraeIDw1ONw0DsxU30uIy4i4k7Pjm5Rz39HRSPxjARN2xC7PZMfnkKkqE JGZNBvbs+6QF8qBpbH6kY7DeePjbURa8c9uLkCAnhXsHJ/TGuVRkPiayB4+k+SvfLJLd RyHW0CuGhP3EEcPv3aCqYNFa1FIrFaS7AXO6gKNoJXjsw5r3+pX8UNa+efONRjEUjnku BawA6cX5slqoZPLL4FY2QgaX6sJRF1BBabCprla+FzpCT5vsxfvK+g15RiSPDk61ybYi XtH7ABG+v/q9EZJo5Nah/HA+YKxhwbDtV+ZtQTj/qOSO+Kvn2DVfuWgK0Ouz3k+6gMXE 3QLg== X-Gm-Message-State: ALoCoQmo8GzM/3zcuJv0y5M1FkXL2g1e9zwkSTG6dHm7NpzYnS1R/niN8PjhA4u6/DEylqySp1Ip X-Received: by 10.180.108.101 with SMTP id hj5mr1497614wib.3.1420981918612; Sun, 11 Jan 2015 05:11:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.1 with SMTP id s1ls584657lal.23.gmail; Sun, 11 Jan 2015 05:11:58 -0800 (PST) X-Received: by 10.112.130.34 with SMTP id ob2mr31869373lbb.78.1420981918317; Sun, 11 Jan 2015 05:11:58 -0800 (PST) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id lf5si18669978lbc.46.2015.01.11.05.11.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 11 Jan 2015 05:11:58 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id gf13so20486619lab.7 for ; Sun, 11 Jan 2015 05:11:58 -0800 (PST) X-Received: by 10.152.18.135 with SMTP id w7mr30776698lad.47.1420981918240; Sun, 11 Jan 2015 05:11:58 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp831160lbb; Sun, 11 Jan 2015 05:11:57 -0800 (PST) X-Received: by 10.66.63.34 with SMTP id d2mr37703162pas.143.1420981916292; Sun, 11 Jan 2015 05:11:56 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id r9si20372832pdo.28.2015.01.11.05.11.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Jan 2015 05:11:56 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YAIHy-0005Fo-TX; Sun, 11 Jan 2015 13:10:42 +0000 Received: from mail-la0-f41.google.com ([209.85.215.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YAIHT-0003nk-Si for linux-arm-kernel@lists.infradead.org; Sun, 11 Jan 2015 13:10:12 +0000 Received: by mail-la0-f41.google.com with SMTP id hv19so20547847lab.0 for ; Sun, 11 Jan 2015 05:09:49 -0800 (PST) X-Received: by 10.152.27.8 with SMTP id p8mr31844140lag.69.1420981789562; Sun, 11 Jan 2015 05:09:49 -0800 (PST) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id q17sm3279475lal.2.2015.01.11.05.09.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 11 Jan 2015 05:09:48 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [GIT PULL 2/2] arm64: KVM: Fix HCR setting for 32bit guests Date: Sun, 11 Jan 2015 14:10:11 +0100 Message-Id: <1420981811-18731-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1420981811-18731-1-git-send-email-christoffer.dall@linaro.org> References: <1420981811-18731-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150111_051012_170690_CED72C43 X-CRM114-Status: GOOD ( 11.14 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.41 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.215.41 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Marc Zyngier , Christoffer Dall , kvm@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Marc Zyngier Commit b856a59141b1 (arm/arm64: KVM: Reset the HCR on each vcpu when resetting the vcpu) moved the init of the HCR register to happen later in the init of a vcpu, but left out the fixup done in kvm_reset_vcpu when preparing for a 32bit guest. As a result, the 32bit guest is run as a 64bit guest, but the rest of the kernel still manages it as a 32bit. Fun follows. Moving the fixup to vcpu_reset_hcr solves the problem for good. Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm64/include/asm/kvm_emulate.h | 2 ++ arch/arm64/kvm/reset.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index 8127e45..865a7e2 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h @@ -41,6 +41,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr); static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu) { vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS; + if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) + vcpu->arch.hcr_el2 &= ~HCR_RW; } static inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu) diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index 70a7816..0b43265 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c @@ -90,7 +90,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) if (!cpu_has_32bit_el1()) return -EINVAL; cpu_reset = &default_regs_reset32; - vcpu->arch.hcr_el2 &= ~HCR_RW; } else { cpu_reset = &default_regs_reset; }