Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp659158pxj; Tue, 18 May 2021 11:12:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPz9H+MR7ZhOHMM8IAu5axDTj57fCXS+Av6pSjHhWBTlIiRW1N3VmKs1ePT+jb7Bor0bT+ X-Received: by 2002:aa7:c24d:: with SMTP id y13mr8472344edo.155.1621361550241; Tue, 18 May 2021 11:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621361550; cv=none; d=google.com; s=arc-20160816; b=Xerd2pKjFsBG3Kd3svoChYI+UBAuS0xgCvrKkPFKwRWKllBkWZH5jkNKmJA9GrWtu5 t1DGi56vdKavQYwN3t0O33KR9uZBK+wGMyz/to6u1xOZQR7mo1hkDCHgefQhKa+FeD5I tNDV+ja2KquI76u5bA/d3kt12thjQ/dZJM3Xwju3RevbkGVWwL0r3mLGOiYhDmBn93px QD8ekgBgfHYkwLA3XTbM1nURLUku+G6NBouJ3htwnrlTRAh6pLGDexMkt/WolEPn2HTz 7rg43OkC9Ld0MYfB+u/tGOch74EL1clE3DAhJSN5Es94alrC+0gTieC435U61cCCm4oA +srA== 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=A1voReIkYZBkvSAYw1tC+kEVdjRd1B48CuXM0W7OMw4=; b=aOzSe9rfq1sVWqvTDBi3hBsQwco/VnmS0SJ4b8FB4xHmL8URVtvcTS7p+DHtPQ+Yfx X8B3Iya0soIMdmg9myc7kTVpm2+ukr5h83I/MKqGYOsxYSOeMFBfm4s923NPOMZ10kCz Gul3JdaLhemdYe72qWdFvxfKrhKFFihd5WMbMkixOXZ6Cq69Q8tUDdFAVWj6KHgvDuYh x1l7Hhhrq0hDfVwateNo/QaMG4G34/WDI3lxfC19pUABT7/g7UxhQuLIvSuEVLNRdhGs njyXaB83wLHJKHyypdPiDFEilzDSKZK+IUffbtmok3/cDjkASqu2X/V3zBpQqgIONSCu byyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x2sKoNSD; 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 ne35si8264017ejc.666.2021.05.18.11.12.07; Tue, 18 May 2021 11:12:30 -0700 (PDT) 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=x2sKoNSD; 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 S1344476AbhEQQMG (ORCPT + 99 others); Mon, 17 May 2021 12:12:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:35758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245174AbhEQPsS (ORCPT ); Mon, 17 May 2021 11:48:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BFF6A61D40; Mon, 17 May 2021 14:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262708; bh=lue57tV8oA1EXdfL+lbVZxqvPFzdnVFaPZD8vKlkt60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x2sKoNSDb2h1JjQrQ/t5xYQP0pFlR2JdyxvIeH4FZ3foGo8rjnm/mU6eAFMl9JZ7t O3H7kBX7hgSOUWjU62c2Y11Je1+Q3veX0Bteat/x+UWh6ubof+eGJP5TYUeeTgEZFR R+/IgaN5otzHX//zAjsNACEuQUB1EGQm4wTDVmG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Joel Stanley , Marek Szyprowski , Ard Biesheuvel , Russell King , Florian Fainelli Subject: [PATCH 5.10 273/289] ARM: 9020/1: mm: use correct section size macro to describe the FDT virtual address Date: Mon, 17 May 2021 16:03:18 +0200 Message-Id: <20210517140314.331553505@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 commit fc2933c133744305236793025b00c2f7d258b687 upstream Commit 149a3ffe62b9dbc3 ("9012/1: move device tree mapping out of linear region") created a permanent, read-only section mapping of the device tree blob provided by the firmware, and added a set of macros to get the base and size of the virtually mapped FDT based on the physical address. However, while the mapping code uses the SECTION_SIZE macro correctly, the macros use PMD_SIZE instead, which means something entirely different on ARM when using short descriptors, and is therefore not the right quantity to use here. So replace PMD_SIZE with SECTION_SIZE. While at it, change the names of the macro and its parameter to clarify that it returns the virtual address of the start of the FDT, based on the physical address in memory. Tested-by: Joel Stanley Tested-by: Marek Szyprowski Signed-off-by: Ard Biesheuvel Signed-off-by: Russell King Signed-off-by: Florian Fainelli Signed-off-by: Greg Kroah-Hartman --- arch/arm/include/asm/memory.h | 6 +++--- arch/arm/kernel/setup.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -68,8 +68,8 @@ #define XIP_VIRT_ADDR(physaddr) (MODULES_VADDR + ((physaddr) & 0x000fffff)) #define FDT_FIXED_BASE UL(0xff800000) -#define FDT_FIXED_SIZE (2 * PMD_SIZE) -#define FDT_VIRT_ADDR(physaddr) ((void *)(FDT_FIXED_BASE | (physaddr) % PMD_SIZE)) +#define FDT_FIXED_SIZE (2 * SECTION_SIZE) +#define FDT_VIRT_BASE(physbase) ((void *)(FDT_FIXED_BASE | (physbase) % SECTION_SIZE)) #if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE) /* @@ -111,7 +111,7 @@ extern unsigned long vectors_base; #define MODULES_VADDR PAGE_OFFSET #define XIP_VIRT_ADDR(physaddr) (physaddr) -#define FDT_VIRT_ADDR(physaddr) ((void *)(physaddr)) +#define FDT_VIRT_BASE(physbase) ((void *)(physbase)) #endif /* !CONFIG_MMU */ --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -1086,7 +1086,7 @@ void __init setup_arch(char **cmdline_p) void *atags_vaddr = NULL; if (__atags_pointer) - atags_vaddr = FDT_VIRT_ADDR(__atags_pointer); + atags_vaddr = FDT_VIRT_BASE(__atags_pointer); setup_processor(); if (atags_vaddr) {