From patchwork Tue Sep 26 14:57:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 114266 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3930747qgf; Tue, 26 Sep 2017 07:57:06 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBtdEWnErISvU/0huH25vOMxxZjuMyBtESAe717ndrZPlVoh3EiULc+tX4d9Vvbq8Fvqvrn X-Received: by 10.98.21.150 with SMTP id 144mr11123209pfv.188.1506437826344; Tue, 26 Sep 2017 07:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506437826; cv=none; d=google.com; s=arc-20160816; b=sIIw8EtBf7Wi9huApiAg2Jy9ElrjwqeEsuC4aH/uoW5k4JTa7EfSPD5IOdw9sKslDt RknRkZ9B1fZiDNK8V3AYaTalesDmhO3Upjeyhlla5NbQf7QwoIcrDQV7nQdclDJg6TQj EjGg2Sc7N2ofo0ilKhbs+UQ/FDqRheZR5fbovuE3dM/mdzqWt+FgfSp/D4pO7rRBw/3W 9G04IDym73Vi3vYDcf4jweDdOUByMGlIdXb00rWfbIfLqJ2BeSHeiUD+/Z+gUm58HngW FGPj1mNU3qCQDrDpU5e1ViqDmoZdG7q4EVub1m0o8X5PkYSw3WMOPR+4kE8V6XHnnNDo qwPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=se9aYbwS5Z48tTR9Xy6Xrx9tjRBvHcOFk+P6LA2JWEA=; b=QY22QArE8aAiuZ5cWqWl3nYwHUN8yoRtRSqzxjWmrkCYrn+pNnfO8WrSOS5iTUnvxM uocprIFDelkw1i+cirxTMDf0pI8Nd7J2Fr41awIElqk8iE/k/idIdrAWW6AQ+U0E3ZIb RG+9btxG+qp3vTMF4WvfoCc4SZCWxVQCxyFB5ocosBTMNE0cBzpqO4NGg3Jg7HZvGhOr HmRJnZ4wm48xspLxbgDLz1tULf/gIUWew8Q3S/2bx4WLdOlQKTyUmQY9HYwlO2c8dm/Y oTuBt3tkzfmTgR+7hgq+89nmRLwV6RuJhEe31jfhpzEFQOmy/zIXROCVdF9re1yFHSch MNgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n81si2628032pfb.373.2017.09.26.07.57.05; Tue, 26 Sep 2017 07:57:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031120AbdIZO5E (ORCPT + 8 others); Tue, 26 Sep 2017 10:57:04 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:35202 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031076AbdIZO5E (ORCPT ); Tue, 26 Sep 2017 10:57:04 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C095880D; Tue, 26 Sep 2017 07:57:03 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 915FE3F53D; Tue, 26 Sep 2017 07:57:03 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 88B131AE0DAD; Tue, 26 Sep 2017 15:57:17 +0100 (BST) From: Will Deacon To: linux-arm-kernel@lists.infradead.org Cc: mark.rutland@arm.com, Marc Zyngier , , Will Deacon Subject: [PATCH] arm64: Make sure SPsel is always set Date: Tue, 26 Sep 2017 15:57:16 +0100 Message-Id: <1506437836-18736-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier When the kernel is entered at EL2 on an ARMv8.0 system, we construct the EL1 pstate and make sure this uses the the EL1 stack pointer (we perform an exception return to EL1h). But if the kernel is either entered at EL1 or stays at EL2 (because we're on a VHE-capable system), we fail to set SPsel, and use whatever stack selection the higher exception level has choosen for us. Let's not take any chance, and make sure that SPsel is set to one before we decide the mode we're going to run in. Cc: Acked-by: Mark Rutland Signed-off-by: Marc Zyngier Signed-off-by: Will Deacon --- arch/arm64/kernel/head.S | 1 + 1 file changed, 1 insertion(+) -- 2.1.4 diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 7434ec0c7a27..0b243ecaf7ac 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -384,6 +384,7 @@ ENTRY(kimage_vaddr) * booted in EL1 or EL2 respectively. */ ENTRY(el2_setup) + msr SPsel, #1 // We want to use SP_EL{1,2} mrs x0, CurrentEL cmp x0, #CurrentEL_EL2 b.eq 1f