Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9037989pxu; Mon, 28 Dec 2020 05:07:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJx37vSImpMsNW4kQ6qMVhs0IMByrDHaRcMzP5RB87KpehldsgBlcBoGDuhr361ZVdLhITcx X-Received: by 2002:a17:906:168f:: with SMTP id s15mr40739322ejd.180.1609160822735; Mon, 28 Dec 2020 05:07:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609160822; cv=none; d=google.com; s=arc-20160816; b=HbtZiKF1khdjHEks2yZT4vxh/0VIxAGd+P9wi3/WqEuQXo4ByqSGA9KeXMuxaoGOL8 wXxmw/ie4nO7z5m+RKvWQ71yrCzO4a80Eh++bOXAAXBhTP4FHHoqH4CAtnrNKjKCUkBp LAfmq8Ltoi6+JHiJCVmjbYLVkM0nLcNPnpgMqz5rz52HylLgbCtgKI4RU5zu+QtFENCi pwVaMV1AHPcJyZuZgZfHqUWl4e5qXXhpA9ekUp0dqjmJpPoZGWNzxSuKOoPIjBZF5Pu1 FKyLxoZ5oe0d2/F362cZmfYgws7OsCMSw++leh84Nq5pa1IuyBdP+RoMFRlShFeSKW9V l4iQ== 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=A9yr+z3g8PLFDtoUzDgD20eIvb4J7yRUc+xCRjWaIug=; b=aTyTj48DOxKInESCemfeqYz5nq4bBogl5zXNGqeyQ06TAUFur2gtJPa9FqOapVzOJ0 GNlJIYvluFkhOH6TyyOCNiGfJvrl//p6rt5zeVqcA9ceWJB8GCaV9IY+Uy48Ydpbs9IX U2t8IVMDoRrL8KAGQP7RSK1bVjHYwsCFcC3Y4kgnboQrNs/OsiF6VU8+ukkZICP+kQP8 lARmE1mn13XN87yzZRup+NWp8I/CARS7yIr4/O9fONPlA1bNeRjRPow5p4osnSs60kyk b0Sc5SfCm/XZ9PFbK4ddPZwT3QKxul/brLJuSh2i3iXo02N/oT2MNloUPrua7K6TtTQ+ hs8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=porwXkBn; 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 hp33si17450662ejc.250.2020.12.28.05.06.39; Mon, 28 Dec 2020 05:07:02 -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=porwXkBn; 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 S1729805AbgL1NBb (ORCPT + 99 others); Mon, 28 Dec 2020 08:01:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:56678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729589AbgL1NBA (ORCPT ); Mon, 28 Dec 2020 08:01:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1A9B322582; Mon, 28 Dec 2020 13:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160444; bh=YStn6+xfoChb/ZUebmuhPMCzr1wh5qHt8/j/I5c1E2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=porwXkBnm5bSJDxom3qbz8z0QDLkHbsEeKjjZOBbYU4F0Z0fM08iNmBc24+prxeA+ rMdlNjHeSRQWXDMs0TcyH7Hkr3wtTIz0sf90uokz2Fp0YVRE9dTdQfhMnUyklSb+B8 6LpwRaM6GIDnGR46rD7tspO0OywfsUGoW2RDVdu8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Pitre , Linus Walleij , Ard Biesheuvel , Sasha Levin Subject: [PATCH 4.9 052/175] ARM: p2v: fix handling of LPAE translation in BE mode Date: Mon, 28 Dec 2020 13:48:25 +0100 Message-Id: <20201228124855.773909374@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 4e79f0211b473f8e1eab8211a9fd50cc41a3a061 ] When running in BE mode on LPAE hardware with a PA-to-VA translation that exceeds 4 GB, we patch bits 39:32 of the offset into the wrong byte of the opcode. So fix that, by rotating the offset in r0 to the right by 8 bits, which will put the 8-bit immediate in bits 31:24. Note that this will also move bit #22 in its correct place when applying the rotation to the constant #0x400000. Fixes: d9a790df8e984 ("ARM: 7883/1: fix mov to mvn conversion in case of 64 bit phys_addr_t and BE") Acked-by: Nicolas Pitre Reviewed-by: Linus Walleij Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin --- arch/arm/kernel/head.S | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 04286fd9e09ce..2e336acd68b0a 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -673,12 +673,8 @@ ARM_BE8(rev16 ip, ip) ldrcc r7, [r4], #4 @ use branch for delay slot bcc 1b bx lr -#else -#ifdef CONFIG_CPU_ENDIAN_BE8 - moveq r0, #0x00004000 @ set bit 22, mov to mvn instruction #else moveq r0, #0x400000 @ set bit 22, mov to mvn instruction -#endif b 2f 1: ldr ip, [r7, r3] #ifdef CONFIG_CPU_ENDIAN_BE8 @@ -687,7 +683,7 @@ ARM_BE8(rev16 ip, ip) tst ip, #0x000f0000 @ check the rotation field orrne ip, ip, r6, lsl #24 @ mask in offset bits 31-24 biceq ip, ip, #0x00004000 @ clear bit 22 - orreq ip, ip, r0 @ mask in offset bits 7-0 + orreq ip, ip, r0, ror #8 @ mask in offset bits 7-0 #else bic ip, ip, #0x000000ff tst ip, #0xf00 @ check the rotation field -- 2.27.0