Patch "ARM: 9020/1: mm: use correct section size macro to describe the FDT virtual address" has been added to the 5.10-stable tree

gregkh at linuxfoundation.org gregkh at linuxfoundation.org
Mon May 17 04:37:58 PDT 2021


This is a note to let you know that I've just added the patch titled

    ARM: 9020/1: mm: use correct section size macro to describe the FDT virtual address

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm-9020-1-mm-use-correct-section-size-macro-to-describe-the-fdt-virtual-address.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable at vger.kernel.org> know about it.


>From foo at baz Mon May 17 01:35:13 PM CEST 2021
From: Florian Fainelli <f.fainelli at gmail.com>
Date: Mon, 10 May 2021 06:21:10 -0700
Subject: ARM: 9020/1: mm: use correct section size macro to describe the FDT virtual address
To: stable at vger.kernel.org
Cc: Ard Biesheuvel <ardb at kernel.org>, Joel Stanley <joel at jms.id.au>, Marek Szyprowski <m.szyprowski at samsung.com>, Russell King <rmk+kernel at armlinux.org.uk>, Florian Fainelli <f.fainelli at gmail.com>, Jonathan Corbet <corbet at lwn.net>, Russell King <linux at armlinux.org.uk>, Nicolas Pitre <nico at fluxnic.net>, Linus Walleij <linus.walleij at linaro.org>, Mike Rapoport <rppt at kernel.org>, Andrew Morton <akpm at linux-foundation.org>, Nick Desaulniers <ndesaulniers at google.com>, Joe Perches <joe at perches.com>, Max Filippov <jcmvbkbc at gmail.com>, Tian Tao <tiantao6 at hisilicon.com>, linux-doc at vger.kernel.org (open list:DOCUMENTATION), linux-kernel at vger.kernel.org (open list), linux-arm-kernel at lists.infradead.org (moderated list:ARM PORT), Greg Kroah-Hartman <gregkh at linuxfoundation.org>, Sasha Levin <sashal at kernel.org>
Message-ID: <20210510132111.1690943-4-f.fainelli at gmail.com>

From: Ard Biesheuvel <ardb at kernel.org>

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 <joel at jms.id.au>
Tested-by: Marek Szyprowski <m.szyprowski at samsung.com>
Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
Signed-off-by: Russell King <rmk+kernel at armlinux.org.uk>
Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 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) {


Patches currently in stable-queue which might be from f.fainelli at gmail.com are

queue-5.10/arm-9020-1-mm-use-correct-section-size-macro-to-describe-the-fdt-virtual-address.patch
queue-5.10/arm-9011-1-centralize-phys-to-virt-conversion-of-dt-atags-address.patch
queue-5.10/arm-9027-1-head.s-explicitly-map-dt-even-if-it-lives-in-the-first-physical-section.patch
queue-5.10/arm-9012-1-move-device-tree-mapping-out-of-linear-region.patch



More information about the linux-arm-kernel mailing list