From patchwork Tue Mar 4 18:23:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 25714 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 74E5820540 for ; Tue, 4 Mar 2014 18:25:00 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id hl1sf3800604igb.0 for ; Tue, 04 Mar 2014 10:24:59 -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:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=cSWO1hwGNKf83BV65YBf0qVXrYGoiu5Ajptus4W5eus=; b=As1RnptUZfcBOC/c7Pd8ShqrQNERyFVigD+/UZPJz5w0ZnYQtJ/4UeYOoLpNQ1dFrY YZtgEwZPhGikekvvMPavPdhvPRcNUaLx3gbznRY7CgFL1uETB1iXjHa4aOScGPwuiBt0 dK6qf7OLKE6t+puoAe5Qvk5RobTavMPImXOheYzqVfgyQ2JMn7NW7r21vdulsyx2ZgfU u+Qx2uxKfSQ1gasdbwo+nr7ljw/EO/1bOVVfJJBpdp0IzDuIOFu3FhD51D8LnJzLSO9s oX4hjkj0LifaXl4Cz37WrgE91Aq2g7O1DwCPVXneuvDLc+pR3yCgjkLbbW78ALLctPVv 6ogw== X-Gm-Message-State: ALoCoQlTG97IK8ruQB2TmC7j8JmcbDzi3zECX9xuBERZAo6Fy8rOmmLgdi7j4b/NCSnD3SMZtC8M X-Received: by 10.42.78.197 with SMTP id o5mr465247ick.9.1393957499772; Tue, 04 Mar 2014 10:24:59 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.136 with SMTP id 8ls2648309qgh.43.gmail; Tue, 04 Mar 2014 10:24:59 -0800 (PST) X-Received: by 10.52.190.1 with SMTP id gm1mr527629vdc.21.1393957499610; Tue, 04 Mar 2014 10:24:59 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id dq2si4511322veb.145.2014.03.04.10.24.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Mar 2014 10:24:59 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id cz12so6089911veb.2 for ; Tue, 04 Mar 2014 10:24:59 -0800 (PST) X-Received: by 10.221.29.137 with SMTP id ry9mr712431vcb.6.1393957499526; Tue, 04 Mar 2014 10:24:59 -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.220.130.193 with SMTP id u1csp145825vcs; Tue, 4 Mar 2014 10:24:59 -0800 (PST) X-Received: by 10.194.10.68 with SMTP id g4mr1538463wjb.94.1393957498509; Tue, 04 Mar 2014 10:24:58 -0800 (PST) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id 14si16941127wjq.73.2014.03.04.10.24.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Mar 2014 10:24:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKu0k-0004R9-Us; Tue, 04 Mar 2014 18:24:15 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKu0c-0006Q3-Hp; Tue, 04 Mar 2014 18:24:06 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKu0Z-0006Ot-K6 for linux-arm-kernel@lists.infradead.org; Tue, 04 Mar 2014 18:24:04 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 04 Mar 2014 18:23:39 +0000 Received: from e102568-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 4 Mar 2014 18:23:45 +0000 From: Lorenzo Pieralisi To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH] arm: kernel: sleep: restore HYP mode configuration in cpu_resume Date: Tue, 4 Mar 2014 18:23:33 +0000 Message-Id: <1393957413-2962-1-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 1.8.2.2 X-OriginalArrivalTime: 04 Mar 2014 18:23:45.0719 (UTC) FILETIME=[E12A0470:01CF37D6] X-MC-Unique: 114030418233900401 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140304_132403_810689_561CC095 X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [91.220.42.44 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Lorenzo Pieralisi , Russell King , Nicolas Pitre , Marc Zyngier , Dave Martin , Christoffer Dall 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lorenzo.pieralisi@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 On CPUs with virtualization extensions the kernel installs HYP mode configuration on both primary and secondary cpus upon cold boot. On platforms where CPUs are shutdown in idle paths (ie CPU core gating), when a CPU resumes from low-power states it currently does not execute code that reinstalls the HYP configuration, which means that the kernel cannot run eg KVM properly on such machines. This patch, mirroring cold-boot behaviour, executes position independent code that reinstalls HYP configuration and drops to SVC mode safely on warmboot, so that deep idle states can be enabled in kernel running as hosts on platforms with power management HW. Cc: Christoffer Dall Cc: Dave Martin Cc: Marc Zyngier Cc: Nicolas Pitre Cc: Russell King Signed-off-by: Lorenzo Pieralisi Acked-by: Marc Zyngier --- arch/arm/kernel/sleep.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S index b907d9b..1b880db 100644 --- a/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S @@ -127,6 +127,10 @@ ENDPROC(cpu_resume_after_mmu) .align ENTRY(cpu_resume) ARM_BE8(setend be) @ ensure we are in BE mode +#ifdef CONFIG_ARM_VIRT_EXT + bl __hyp_stub_install_secondary +#endif + safe_svcmode_maskall r1 mov r1, #0 ALT_SMP(mrc p15, 0, r0, c0, c0, 5) ALT_UP_B(1f) @@ -144,7 +148,6 @@ ARM_BE8(setend be) @ ensure we are in BE mode ldr r0, [r0, #SLEEP_SAVE_SP_PHYS] ldr r0, [r0, r1, lsl #2] - setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r1 @ set SVC, irqs off @ load phys pgd, stack, resume fn ARM( ldmia r0!, {r1, sp, pc} ) THUMB( ldmia r0!, {r1, r2, r3} )