Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1311748pxu; Mon, 23 Nov 2020 18:03:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1QGADwtVR0Os27xuWwlglBEuWOSTsdFp7gOaGTMUjYf89CO/QdZHsynQjxcQe5QJuIbYp X-Received: by 2002:a17:906:4009:: with SMTP id v9mr2153295ejj.97.1606183405225; Mon, 23 Nov 2020 18:03:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606183405; cv=none; d=google.com; s=arc-20160816; b=V9lyHFAoEi4bZE+oih/AmgJWZ2I54BIrosEU7uDPyBpaGgFM5ekpulgMRDrFgRti9K yEUEeiJAvEhirakn4j8fK3NqaChc4l8N3bmK9L4vKio3ZiClgkCWSS2gc8Ww3NJCRe4N Cxy4C6E6xH03DB61Gz/updMwjidJ9IaJg8k7hbHnIoCC+zhyTwMU89egorTmy5hePXoM hL+gSW118DARrsUNtRurnVB+XrIlw2FxrfZFMDjrWZ9dxAwWEU3f3kmeazMmv4aGw60P CImu/6D1TZM49Joic2qNGKbR2YLRNPQfddwwUJrT5ExQl2GXby8mXuiVf9U1MZF1fCQh SNZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AJ8J6vJ7JiRmqdKcs+YZDuo4qvBG7PZxJ4/l/greUcY=; b=UhgGgTg1IxOJunjL1h/1jXw0d4VOJATlSaWv8IamscM0QTbvq/CeSuNxK9Yegy8Lgx Nm2fmUc01fSKp4y2NDyQUZ09SE2oLBVXslw/prLaYxSKUEhX7LsptaIF713YWsjpQ7kg RHDabIKS6UkY4l7+HYp3FvwJx3Mua/4XqwLHpAMY2/WGJLnWDuvd+PK7EgXOsE88RQ7l d78M4H0N0cJwyHoNP6sU3MZlSAEUUisAPvov9DejDYBT5/3gY6ndN7akTZ8mypEhIJNG wxeRQr6MGqUxopYABQT+9lUF2P2WEjc9y9855js66Ux7IJ4HksZc4eZ/ahARG5vwb+Dd TkVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jWDhxPGP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m16si7477548ejc.357.2020.11.23.18.03.02; Mon, 23 Nov 2020 18:03:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jWDhxPGP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732745AbgKWM4q (ORCPT + 99 others); Mon, 23 Nov 2020 07:56:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:34278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732886AbgKWMtT (ORCPT ); Mon, 23 Nov 2020 07:49:19 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8364020657; Mon, 23 Nov 2020 12:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135757; bh=e/9RmL65GabLycN58Tjmo7Bmxt74EK95SdaR3fKmy38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWDhxPGPpcef4b5KdtHjcDx3qGXh+e46VqED2i1/pGlY98kG+lsmW5f/OqaN4GUn0 zX+Q10GnJfx/Ut117TmqqSKvkLimMDMZmELnA8GOMf4tX4iXSvg8JamFcfg1HIP1Bf 1tf0OXMsaCR1tk100w6ARE1RNwXErTtK4H0PLgRg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Sasha Levin Subject: [PATCH 5.9 177/252] efi/arm: set HSCTLR Thumb2 bit correctly for HVC calls from HYP Date: Mon, 23 Nov 2020 13:22:07 +0100 Message-Id: <20201123121844.138489055@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121835.580259631@linuxfoundation.org> References: <20201123121835.580259631@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel [ Upstream commit fbc81ec5b85d43a4b22e49ec0e643fa7dec2ea40 ] Commit db227c19e68db353 ("ARM: 8985/1: efi/decompressor: deal with HYP mode boot gracefully") updated the EFI entry code to permit firmware to invoke the EFI stub loader in HYP mode, with the MMU either enabled or disabled, neither of which is permitted by the EFI spec, but which does happen in the field. In the MMU on case, we remain in HYP mode as configured by the firmware, and rely on the fact that any HVC instruction issued in this mode will be dispatched via the SVC slot in the HYP vector table. However, this slot will point to a Thumb2 symbol if the kernel is built in Thumb2 mode, and so we have to configure HSCTLR to ensure that the exception handlers are invoked in Thumb2 mode as well. Fixes: db227c19e68db353 ("ARM: 8985/1: efi/decompressor: deal with HYP mode boot gracefully") Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin --- arch/arm/boot/compressed/head.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 434a16982e344..19499d636bc88 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -1476,6 +1476,9 @@ ENTRY(efi_enter_kernel) @ issued from HYP mode take us to the correct handler code. We @ will disable the MMU before jumping to the kernel proper. @ + ARM( bic r1, r1, #(1 << 30) ) @ clear HSCTLR.TE + THUMB( orr r1, r1, #(1 << 30) ) @ set HSCTLR.TE + mcr p15, 4, r1, c1, c0, 0 adr r0, __hyp_reentry_vectors mcr p15, 4, r0, c12, c0, 0 @ set HYP vector base (HVBAR) isb -- 2.27.0