Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9043326pxu; Mon, 28 Dec 2020 05:15:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyW7OjZYKsxHBX6rs11oVLs8OwKK9ny8qFX/W9++ZxWQDg+lvwk2WAC7WRT0XoSmj7bUxPG X-Received: by 2002:a50:d50a:: with SMTP id u10mr41598629edi.58.1609161299903; Mon, 28 Dec 2020 05:14:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609161299; cv=none; d=google.com; s=arc-20160816; b=mRBHyWLj4LuFnpMdKdRM8iL4qMP84jbnEw3w3nfD1DHNKdQUDqv21nVR6bytcgGtvv qUA3xKoV3yADLaAyFF6MX7yJGWgNQ/08clIopEcM7xW/0X17rVZeE2X7uI8DJ09A/p70 7lzq+adCUunsazN7MeRxrs1cxOPi+ugzFgavJ8YQKzLiBQDsckkclPwr9aaUL4YdmCk5 J4HIkz4Lab70XOCgnKj2qQ5IMssSX2poEcp4bfpsNVxDm/rYlDXTNdb2xHq1j4wm7AH2 eBKuo01lamRwI8oFPwFrQC08ECuL0xJd1LOlLvdR1dmuO0M6jngvce8s8IskIf0CGpVx 87fA== 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=DAAdZ5QNtpH3duNP0GTSirWp7zQEUKEQ1LgjZmAd0bQ=; b=0RUZrJS2hrVDJolfMle7PQMF9pkpVkHL5KFHnJBFoc3U3JVeQuA0ISS34wZb/wbL1P uXcp3VzB1kGhAbDIy7Tt/uq0Gubt/wsFBes5bgFS2ZZQsivYNfaYSqFq6o9fCumKUi8W e4jmtf8CvHhUAqSAMWxKgO5BFchaQDKK5HJYlEmhGHjnhsbfhSudxNRcZBmu2vXy5RJO acfpQg46q9eo8Od+9gDqg57o9NP1/0mcPNyt3KXWOTcRTa7a0pTZTqLnJ4qsOC/pbwJt WleWcPIEhmEfa5NnS4foreCJaD7aLajznrEZ0McJdHDDHBujtVLEtSK9cDbIY3oKRJjr ap0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F03/f9a2"; 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 n6si17949538ejc.567.2020.12.28.05.14.36; Mon, 28 Dec 2020 05:14:59 -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="F03/f9a2"; 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 S1732126AbgL1NMj (ORCPT + 99 others); Mon, 28 Dec 2020 08:12:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:39566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732060AbgL1NM1 (ORCPT ); Mon, 28 Dec 2020 08:12:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 467DF22BEA; Mon, 28 Dec 2020 13:12:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161131; bh=QQZtdrtNDL2KFOEHs3fB6urx7WxcNySkqdHC+ILRyuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F03/f9a2uYXIRZpBQuWQpsFOsnXBywuynLsKGvS/5VfzIDiG49klwQBMp00Kk9zG0 flY5KJ+kPN+rVRTKTBPsdF+0cgP1vtZvPDjO3jWG2LCxucSro6l/zzq9KIObGOZJGg +s69Nywe9D5em1gVSaYYP2baagozD9JTQQS76Cbs= 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.14 072/242] ARM: p2v: fix handling of LPAE translation in BE mode Date: Mon, 28 Dec 2020 13:47:57 +0100 Message-Id: <20201228124908.229667365@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 6b1148cafffdb..90add5ded3f1f 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -674,12 +674,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 @@ -688,7 +684,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