Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9085041pxu; Mon, 28 Dec 2020 06:16:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXfBW2optpjygZKxWzozP3EBm94Gs7NKuSrftPsW9Tv+7dlH3aDWiFeKnvSo7lUt95mIeN X-Received: by 2002:a17:906:4809:: with SMTP id w9mr41575726ejq.139.1609164977362; Mon, 28 Dec 2020 06:16:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164977; cv=none; d=google.com; s=arc-20160816; b=GQnKqQOQdW0edDVXKmGPuF1HG0glhPx92daj0kmPTmQxXQNAuBXXsfVH76UY7SNKtG bsrn9CZgyaDoWElr8PyLc9j0hBFwvF3p1fZjrEuixuRBQXNEBE01aOnOPfHl3ZiVpVyx DgJCSIVkBwju7BCnTtyX85Hi/f0QYn0JcojxtzdulptrYgghU2t/VLz+43+/rZVIUCyY fkdUW24CDy0QudaFC9oozsMDX89T3H++6CIXh43AJK4eANnESmoN4ngEDosgVAwZZoxF tMdW0hHxIu9KQf3wsqCu5siSN/swUcMZyLc7c9ugHfi6Ns180WXn2pqO7czZfhmciYdw oqXg== 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=LpiOMeRZsmDBfy+bX4OtuyRBmFXhI8YNVh3+9UaimBk=; b=dhorD6wbBCV8DpRU9dK/ATxjaNCAuQQsIJkAPYX4xdeBaPmcv41Cbc7rFAC2EatXFI NSPLVv/4UyKSyqyJVwOtKnbQqsAGktLCGzYpFsLaJB42Y5QjhWZiZOErSnUZthNRJqtA Lem/WdoXy670JwiwViWg41KF7tG40juZ9W24XfMiWdrPQmXrsh2MEafKISqtUkcKcYUF L/32fqLxkQOQCIwY0U7Bt45SQntM+SXsszTqcIJIsf2OjTL6q4p1v6OHdlD+9RzxaQTn GByR1wDVDNHpJZg7L0+VdHmd4MIwnO6RERVnir1Shvu0iUTYe01Wx8j4XdGcrJuUf7J2 a30Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LrinNhfd; 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 n22si15990965edv.49.2020.12.28.06.15.55; Mon, 28 Dec 2020 06:16:17 -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=LrinNhfd; 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 S2440307AbgL1OOC (ORCPT + 99 others); Mon, 28 Dec 2020 09:14:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:48914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440248AbgL1ON5 (ORCPT ); Mon, 28 Dec 2020 09:13:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E69A622CB2; Mon, 28 Dec 2020 14:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164796; bh=isl4+ySKdxpAqkV8qastGXs+Tt8IJeVjB/0Mlkibikc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LrinNhfdJb1u733SOFzqoiWa6ot4m8b3R/SktPR0gHNorcE59FLkDKPMFFe9kjCcd 1BVnAv34J1syF7OwYIDE8zX+V1137s+VnjR09+NlKVxgM5mQq8t0uduV4nm76j/YSN C2t10BOB3CygtKHiVYJn0T766z8GSkuGTn42MGrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Sverdlin , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.10 301/717] MIPS: Dont round up kernel sections size for memblock_add() Date: Mon, 28 Dec 2020 13:44:59 +0100 Message-Id: <20201228125035.450181086@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Alexander Sverdlin [ Upstream commit d121f125af22a16f0f679293756d28a9691fa46d ] Linux doesn't own the memory immediately after the kernel image. On Octeon bootloader places a shared structure right close after the kernel _end, refer to "struct cvmx_bootinfo *octeon_bootinfo" in cavium-octeon/setup.c. If check_kernel_sections_mem() rounds the PFNs up, first memblock_alloc() inside early_init_dt_alloc_memory_arch() <= device_tree_init() returns memory block overlapping with the above octeon_bootinfo structure, which is being overwritten afterwards. Fixes: a94e4f24ec83 ("MIPS: init: Drop boot_mem_map") Signed-off-by: Alexander Sverdlin Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index ca579deef9391..9d11f68a9e8bb 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -498,8 +498,8 @@ static void __init request_crashkernel(struct resource *res) static void __init check_kernel_sections_mem(void) { - phys_addr_t start = PFN_PHYS(PFN_DOWN(__pa_symbol(&_text))); - phys_addr_t size = PFN_PHYS(PFN_UP(__pa_symbol(&_end))) - start; + phys_addr_t start = __pa_symbol(&_text); + phys_addr_t size = __pa_symbol(&_end) - start; if (!memblock_is_region_memory(start, size)) { pr_info("Kernel sections are not in the memory maps\n"); -- 2.27.0