diff mbox series

[fixes,1/3] MIPS: Loongson64: Reserve vgabios memory on boot

Message ID 20231101-loongson64_fixes-v1-1-2a2582a4bfa9@flygoat.com (mailing list archive)
State Superseded
Headers show
Series MIPS: Loongson64: Fix some long-term issues | expand

Commit Message

Jiaxun Yang Nov. 1, 2023, 11:39 a.m. UTC
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 <jiaxun.yang@flygoat.com>
---
 arch/mips/loongson64/init.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Sergey Shtylyov Nov. 1, 2023, 4:21 p.m. UTC | #1
On 11/1/23 2:39 PM, Jiaxun Yang wrote:

> 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.

   Reserving? :-)

> Cc: stable@vger.kernel.org
> Fixes: a94e4f24ec83 ("MIPS: init: Drop boot_mem_map")
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
[...]

MBR, Sergey
diff mbox series

Patch

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