From patchwork Tue Nov 7 11:15:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13448523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83DE8C4167D for ; Tue, 7 Nov 2023 11:15:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234176AbjKGLPu (ORCPT ); Tue, 7 Nov 2023 06:15:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233980AbjKGLPt (ORCPT ); Tue, 7 Nov 2023 06:15:49 -0500 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9424FED; Tue, 7 Nov 2023 03:15:46 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0E9BC5C023F; Tue, 7 Nov 2023 06:15:46 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 07 Nov 2023 06:15:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1699355746; x=1699442146; bh=40sUdJj73bfBxLsZPe0Q+r0SogTHEc7qeg3 Eq8ciTbw=; b=0iQPVbQ8mrxnoOxPg+RCSLetUnI4nXjDZjur8d0W9AebnFQ87UF PLK0QUPhQh5Iod39xjUAn2R4SZ9Ubnevttvd2Nce3yDiSx/RG+elzQvIFoClPM42 TsdG5PmrRq65FpvmUK8VKzsOhY15L6fV2UFZL68CQUQKCH3yKk5mA90NLrVh3It1 d4JAKsbtuNir779mYDDIWQ/ZbV4sa2q0XrzvSgd5G3zAnHWvQYNAdfKMWtVB+DqT qxWbb/bQVGFteOHoFnws9kuQo6WYYq5e8YfKPk2yyoZY+k3Jz4+UxodupIzBKFkF evyDa15XrpJWtSn+74Bsj37+LETS7seejKw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1699355746; x=1699442146; bh=40sUdJj73bfBxLsZPe0Q+r0SogTHEc7qeg3 Eq8ciTbw=; b=q9RxcSs/VxR/qMsDV4mTzHR9oq0hKPhQN4AMhf3kZY8qN6mjORu CWiWPm9Y5Dah7Wx81eI1OJwLNxYLz+2H1bafkIH0Gh/dlR1hsptTxKKOxwlMANKV 9P4HPl7+pm7tBq/5soXrl0jDKN3mWfFNHdsqZw9Yc5ozmto/YdL0G6fMREAMFPob whRnqvSfW9kkU4EINxhxWNDqNS7iSXNUM2s0+UWTuOj/kx+AyWnBsznFNoNyVwok TBOCxV6q3vYu63JqdAzs5NlBVcIy9HkD1q9rUi33Ch+xWGqaZwQeDz7ugM1+Z/k7 7SPaMA45wgs0I0YHgMCEYh+d7teFLdUQazg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudduiedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffekgedugefhtdduudeghfeu veegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Nov 2023 06:15:44 -0500 (EST) From: Jiaxun Yang Date: Tue, 07 Nov 2023 11:15:18 +0000 Subject: [PATCH fixes v2 1/3] MIPS: Loongson64: Reserve vgabios memory on boot MIME-Version: 1.0 Message-Id: <20231107-loongson64_fixes-v2-1-5c49ceed7950@flygoat.com> References: <20231107-loongson64_fixes-v2-0-5c49ceed7950@flygoat.com> In-Reply-To: <20231107-loongson64_fixes-v2-0-5c49ceed7950@flygoat.com> To: Thomas Bogendoerfer Cc: Huacai Chen , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Shtylyov , Jiaxun Yang , stable@vger.kernel.org X-Mailer: b4 0.12.4 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org vgabios is passed from firmware to kernel on Loongson64 systems. Sane firmware will keep this pointer in reserved memory space passed from the firmware but insane firmware keeps it in low memory before kernel entry that is not reserved. Previously kernel won't try to allocate memory from low memory before kernel entry on boot, but after converting to memblock it will do that. Fix by resversing those memory on early boot. Cc: stable@vger.kernel.org Fixes: a94e4f24ec83 ("MIPS: init: Drop boot_mem_map") Signed-off-by: Jiaxun Yang --- v2: - Fix typo in commit message (Sergey) --- arch/mips/loongson64/init.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c index ee8de1735b7c..d62262f93069 100644 --- a/arch/mips/loongson64/init.c +++ b/arch/mips/loongson64/init.c @@ -88,6 +88,11 @@ void __init szmem(unsigned int node) break; } } + + /* Reserve vgabios if it comes from firmware */ + if (loongson_sysconf.vgabios_addr) + memblock_reserve(virt_to_phys((void *)loongson_sysconf.vgabios_addr), + SZ_256K); } #ifndef CONFIG_NUMA