From patchwork Sun May 9 17:14:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12246505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEB79C433ED for ; Sun, 9 May 2021 17:16:44 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3233D61004 for ; Sun, 9 May 2021 17:16:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3233D61004 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QNKfU5JO9W2WcX5SNi17k0n30ZJCSabvj1XfTrEm1dM=; b=dvkoeSLwpvI1B/iqs+N0wU6yR lHiY2WPnSxIvdNcG9G9uPIr0KzVupFLfu70CgZ0/HdtuRwTAiMI2R8TqQSAIBgKoIFXCi+NyAx8KV NJJ0yWKeIGnLepKE+h1pgjy0nmd0gzTnzGN54qaDh5QuPlwk1Y+EqoJKjmbvhtScSiuHjUF5gxAd+ Sm4n5Ys0FOp1ZDEX5gPcR8OqzQIkVzTzTcO5gqBbC2M7GArbhnGhcOBYnfaTj0kUARrrKnNpQ8LL3 sSqGJPD4GJ/+FcAQMeQI6uw7OkNAe9Xj9DACBvl2y3SoCbvVlqqhGW9UWHMlvDUgrkpG5rgxJRxCE YVIRlDc0g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lfn1V-00ByuZ-K2; Sun, 09 May 2021 17:15:21 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lfn18-00BysD-FK for linux-arm-kernel@desiato.infradead.org; Sun, 09 May 2021 17:14:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=GdEsPts6/FPz2ykV0GJlUYI1XtzHN0Ot6bY7JwXZfAw=; b=JVBUWKuprnuy3zqKmbfQvDmRJX GpzAxGEtEAxm24I5BwwAnl8vpzIY9g3ZNU2mx+e8iYE1JN41Z3/ghMm46VzoBGI3c3gTt3woPXPBZ 43USFJvxpyH6sk/LkwI/DktIbuEJssCI5DHYYba1lf1cflzZBcLhCRDFRDym93KgExtHqS+WOyqSD 9D83J32L1V5MGo7rqrPZe6j/OocZLgr1GmQZtKhXyq4b3Rj4+CL8ssT8392lHNlx3eSy4HUN4uZM2 ufaOjNrW7WAQ6lYuVAz/Nn1qSrSsbuQ87ExD5uRCKt6nTh0HBPKXFGkpwOuHvZooP8mlnQ6fySEp+ xPyqVtHA==; Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lfn15-0083UM-Uw for linux-arm-kernel@lists.infradead.org; Sun, 09 May 2021 17:14:57 +0000 Received: by mail-pg1-x52e.google.com with SMTP id m124so11605588pgm.13 for ; Sun, 09 May 2021 10:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GdEsPts6/FPz2ykV0GJlUYI1XtzHN0Ot6bY7JwXZfAw=; b=r5pfr6Y/hYoLMuYvvRNNHKA64Ok3+jbrkRkIszOPN61ZMQratGRruFgiyxq+ooCaI1 qjJD3bMHqmLnCNPAT8Q4VzngjBl7cBes7NxpCzNAYiECpk8VZkW7tiQNwciyHysSs2vP 27lzLYJDmsCTe6h61tGPO1fGq7xaBGJe8Ieho7MgAAp+R6uhIHhv2hQMvdoDcqbpec7+ CI2hD/3GkAKxgBIjSlkpKL9C/Es3OLaR73/pDvqcp7DEb0s+mBJje2VOilQJcnRySRU9 1Yw89sSccgd/xSa8Ac3IzCS2wXYSWneX33H5O6W7nNeg7+Q4UYRP5bV85e/zB+5IEd5K jqYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GdEsPts6/FPz2ykV0GJlUYI1XtzHN0Ot6bY7JwXZfAw=; b=W68/NadOGqhaGex3OVq6QZD48BUlH+DqaiVU+pL6NI68zfpuagmdSh46oNNzR48vFm kFZD+jjmrDdZd6lyeGFhXQJmemyut+OxScvWpmUTT3tdMQNVCdj6RKJNI/pTGbJ8mRji fceXdMr6TD+Oj8mGdqIQPl8H5LaHHOOcal/Y0eOLOOW+HU7i9TUrT4qQ9Bo+PL87tMRd aSnTSn/Cu8t7biiUrNIIVglByMxRIwKfUpu/BMpSxkWlonaVlosKkBxYfz2hnrNphC8T 0yGRQxNBYKYYjGLXbOQhDUseuMtZvAn7/MgvZcjdR9qlm4Tl5jfWHyfJCvGPsMowFbIM 2s7A== X-Gm-Message-State: AOAM530lLu7NjE86dbnvfup+68lc7p3CSK6Sit1kmTtFYFbv+sZTZObF kfeZidXsAnRJDu349YrYu38= X-Google-Smtp-Source: ABdhPJyfTyhcaqaBiwtRrVzVgLHofeVtiicyzC7gqEaLV2wOpnXUqyRn4cBID+JEwF4g1xHRSnV6fQ== X-Received: by 2002:aa7:9885:0:b029:28e:9f7f:f23 with SMTP id r5-20020aa798850000b029028e9f7f0f23mr21585188pfl.75.1620580495157; Sun, 09 May 2021 10:14:55 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id w12sm2121834pff.42.2021.05.09.10.14.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 10:14:54 -0700 (PDT) From: Florian Fainelli To: stable@vger.kernel.org Cc: Ard Biesheuvel , Joel Stanley , Marek Szyprowski , Russell King , Florian Fainelli , Jonathan Corbet , Russell King , Linus Walleij , Nicolas Pitre , Sasha Levin , linux-doc@vger.kernel.org (open list:DOCUMENTATION), linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org (moderated list:ARM PORT), Greg Kroah-Hartman Subject: [PATCH stable 5.4 3/3] ARM: 9020/1: mm: use correct section size macro to describe the FDT virtual address Date: Sun, 9 May 2021 10:14:28 -0700 Message-Id: <20210509171428.1537572-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210509171428.1537572-1-f.fainelli@gmail.com> References: <20210509171428.1537572-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210509_101456_018934_9B3091AC X-CRM114-Status: GOOD ( 19.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 --- arch/arm/include/asm/memory.h | 6 +++--- arch/arm/kernel/setup.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index bb79e52aeb90..f717d7122d9d 100644 --- 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 */ diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index d9bc70f25728..924285d0bccd 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -1080,7 +1080,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) {