Skip to contentSkip to conversation

microblaze: remove early_printk

PATCH In review Rob Herring 3 participants 8 messages Mar 28, 2018 – Apr 23, 2018

Subsystems (2)
lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

v2 cover microblaze: remove early_printk

This started with removing 'linux,stdout-path' which dtc now warns about, but I noticed the early_printk support only supports that. The early_printk support is redundant with earlycon support since the 2 Xilinx UARTs support earlycon now.

I got this to kind of work in QEMU. QEMU hangs sometime around timer setup, but earlycon is up and working before that point.

Rob

Rob Herring (3):
microblaze: remove unnecessary prom.h includes
microblaze: remove redundant early_printk support
microblaze: dts: replace 'linux,stdout-path' with 'stdout-path'

 arch/microblaze/Kconfig.debug         |   8 --
 arch/microblaze/boot/dts/system.dts   |   2 +-
 arch/microblaze/include/asm/cpuinfo.h |   2 +-
 arch/microblaze/include/asm/pci.h     |   1 -
 arch/microblaze/include/asm/prom.h    |  27 -----
 arch/microblaze/include/asm/setup.h   |   5 -
 arch/microblaze/kernel/Makefile       |   1 -
 arch/microblaze/kernel/early_printk.c | 184 ----------------------------------
 arch/microblaze/kernel/misc.S         |  35 -------
 arch/microblaze/kernel/platform.c     |   1 -
 arch/microblaze/kernel/prom.c         |  82 ---------------
 arch/microblaze/kernel/setup.c        |  17 +---
 arch/microblaze/pci/indirect_pci.c    |   1 -
 13 files changed, 6 insertions(+), 360 deletions(-)
 delete mode 100644 arch/microblaze/include/asm/prom.h
 delete mode 100644 arch/microblaze/kernel/early_printk.c
Signature · 1 line
2.14.1
author maintainer
#1 lore raw

PATCH v2 1/3 microblaze: remove unnecessary prom.h includes

In preparation to remove prom.h, remove unnecessary prom.h includes.

---
v2: no change

 arch/microblaze/include/asm/cpuinfo.h | 2 +-
 arch/microblaze/include/asm/pci.h     | 1 -
 arch/microblaze/kernel/platform.c     | 1 -
 arch/microblaze/pci/indirect_pci.c    | 1 -
 4 files changed, 1 insertion(+), 4 deletions(-)
arch/microblaze/include/asm/cpuinfo.h +1 -1
index 3337417fcdca..8f4996730552 100644
@@ -13,7 +13,7 @@
 #ifndef _ASM_MICROBLAZE_CPUINFO_H
 #define _ASM_MICROBLAZE_CPUINFO_H
 
-#include <asm/prom.h>
+#include <linux/of.h>
 
 /* CPU Version and FPGA Family code conversion table type */
 struct cpu_ver_key {
arch/microblaze/include/asm/pci.h +0 -1
index 114b93488193..c1ee76d30aed 100644
@@ -19,7 +19,6 @@
 #include <linux/scatterlist.h>
 
 #include <asm/io.h>
-#include <asm/prom.h>
 #include <asm/pci-bridge.h>
 
 #define PCIBIOS_MIN_IO		0x1000
arch/microblaze/kernel/platform.c +0 -1
index b9529caa507a..2540d60610d9 100644
@@ -12,7 +12,6 @@
 
 #include <linux/init.h>
 #include <linux/of_platform.h>
-#include <asm/prom.h>
 #include <asm/setup.h>
 
 static struct of_device_id xilinx_of_bus_ids[] __initdata = {
arch/microblaze/pci/indirect_pci.c +0 -1
index ae4fca46c9f6..24030837a425 100644
@@ -16,7 +16,6 @@
 #include <linux/init.h>
 
 #include <linux/io.h>
-#include <asm/prom.h>
 #include <asm/pci-bridge.h>
 
 static int
Signature · 1 line
2.14.1
author maintainer
#2 lore raw

PATCH v2 2/3 microblaze: remove redundant early_printk support

In reply to Rob Herring

With earlycon support now enabled, the arch specific early_printk support can be removed.

---
v2:
- Fix booting. The setup_memory call needed to be before the parse_early_param call. And we want to do both before unflattening so the earlycon is up.
- Remove some unused function declarations.

 arch/microblaze/Kconfig.debug         |   8 --
 arch/microblaze/include/asm/prom.h    |  27 -----
 arch/microblaze/include/asm/setup.h   |   5 -
 arch/microblaze/kernel/Makefile       |   1 -
 arch/microblaze/kernel/early_printk.c | 184 ----------------------------------
 arch/microblaze/kernel/misc.S         |  35 -------
 arch/microblaze/kernel/prom.c         |  82 ---------------
 arch/microblaze/kernel/setup.c        |  17 +---
 8 files changed, 4 insertions(+), 355 deletions(-)
 delete mode 100644 arch/microblaze/include/asm/prom.h
 delete mode 100644 arch/microblaze/kernel/early_printk.c
arch/microblaze/Kconfig.debug +0 -8
index 012e377330cd..331a3bb66297 100644
@@ -8,14 +8,6 @@ config TRACE_IRQFLAGS_SUPPORT
 
 source "lib/Kconfig.debug"
 
-config EARLY_PRINTK
-	bool "Early printk function for kernel"
-	depends on SERIAL_UARTLITE_CONSOLE || SERIAL_8250_CONSOLE
-	default n
-	help
-	  This option turns on/off early printk messages to console.
-	  First Uartlite node is taken.
-
 config HEART_BEAT
 	bool "Heart beat function for kernel"
 	default n
arch/microblaze/include/asm/prom.h deleted +0 -27
deleted file mode 100644
index 2f03ac815851..000000000000
@@ -1,27 +0,0 @@
-/*
- * Definitions for talking to the Open Firmware PROM on
- * Power Macintosh computers.
- *
- * Copyright (C) 1996-2005 Paul Mackerras.
- *
- * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-#ifndef _ASM_MICROBLAZE_PROM_H
-#define _ASM_MICROBLAZE_PROM_H
-
-#include <linux/of.h>
-
-/* Other Prototypes */
-enum early_consoles {
-	UARTLITE = 1,
-	UART16550 = 2,
-};
-
-extern int of_early_console(void *version);
-
-#endif /* _ASM_MICROBLAZE_PROM_H */
arch/microblaze/include/asm/setup.h +0 -5
index 7c968c1d1729..d5384f6f36f7 100644
@@ -19,16 +19,11 @@ extern char cmd_line[COMMAND_LINE_SIZE];
 
 extern char *klimit;
 
-int setup_early_printk(char *opt);
-void remap_early_printk(void);
-void disable_early_printk(void);
-
 void microblaze_heartbeat(void);
 void microblaze_setup_heartbeat(void);
 
 #   ifdef CONFIG_MMU
 extern void mmu_reset(void);
-extern void early_console_reg_tlb_alloc(unsigned int addr);
 #   endif /* CONFIG_MMU */
 
 extern void of_platform_reset_gpio_probe(void);
arch/microblaze/kernel/Makefile +0 -1
index 0da76fa1ab17..7e99cf6984a1 100644
@@ -22,7 +22,6 @@ obj-y += dma.o exceptions.o \
 
 obj-y += cpu/
 
-obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_HEART_BEAT)	+= heartbeat.o
 obj-$(CONFIG_MODULES)		+= microblaze_ksyms.o module.o
 obj-$(CONFIG_MMU)		+= misc.o
arch/microblaze/kernel/early_printk.c deleted +0 -184

184 lines not on this page · raw message

arch/microblaze/kernel/misc.S +0 -35
index 1dafddeb8a0b..6759af688451 100644
@@ -63,38 +63,3 @@ _tlbie_1:
 	nop
 
 	.size  _tlbie, . - _tlbie
-
-/*
- * Allocate TLB entry for early console
- */
-.globl early_console_reg_tlb_alloc;
-.type  early_console_reg_tlb_alloc, @function
-.align 4;
-early_console_reg_tlb_alloc:
-	/*
-	 * Load a TLB entry for the UART, so that microblaze_progress() can use
-	 * the UARTs nice and early.  We use a 4k real==virtual mapping.
-	 */
-	lwi	r4, r0, tlb_skip
-	mts	rtlbx, r4 /* TLB slot 63 */
-
-	or	r4,r5,r0
-	andi	r4,r4,0xfffff000
-	ori	r4,r4,(TLB_WR|TLB_I|TLB_M|TLB_G)
-
-	andi	r5,r5,0xfffff000
-	ori	r5,r5,(TLB_VALID | TLB_PAGESZ(PAGESZ_4K))
-
-	mts	rtlblo,r4 /* Load the data portion of the entry */
-	nop
-	mts	rtlbhi,r5 /* Load the tag portion of the entry */
-	nop
-
-	lwi	r5, r0, tlb_skip
-	addik	r5, r5, 1
-	swi	r5, r0, tlb_skip
-
-	rtsd	r15, 8
-	nop
-
-	.size  early_console_reg_tlb_alloc, . - early_console_reg_tlb_alloc
arch/microblaze/kernel/prom.c +0 -82

99 lines not on this page · raw message

arch/microblaze/kernel/setup.c +4 -13
index be98ffe28ca8..bbd6968ce55b 100644
@@ -27,13 +27,12 @@
 #include <linux/param.h>
 #include <linux/pci.h>
 #include <linux/cache.h>
-#include <linux/of_platform.h>
+#include <linux/of.h>
 #include <linux/dma-mapping.h>
 #include <asm/cacheflush.h>
 #include <asm/entry.h>
 #include <asm/cpuinfo.h>
 
-#include <asm/prom.h>
 #include <asm/pgtable.h>
 
 DEFINE_PER_CPU(unsigned int, KSP);	/* Saved kernel stack pointer */
@@ -54,6 +53,9 @@ void __init setup_arch(char **cmdline_p)
 {
 	*cmdline_p = boot_command_line;
 
+	setup_memory();
+	parse_early_param();
+
 	console_verbose();
 
 	unflatten_device_tree();
@@ -62,13 +64,6 @@ void __init setup_arch(char **cmdline_p)
 
 	microblaze_cache_init();
 
-	setup_memory();
-
-#ifdef CONFIG_EARLY_PRINTK
-	/* remap early console to virtual address */
-	remap_early_printk();
-#endif
-
 	xilinx_pci_init();
 
 #if defined(CONFIG_DUMMY_CONSOLE)
@@ -133,10 +128,6 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
 /* initialize device tree for usage in early_printk */
 	early_init_devtree(_fdt_start);
 
-#ifdef CONFIG_EARLY_PRINTK
-	setup_early_printk(NULL);
-#endif
-
 	/* setup kernel_tlb after BSS cleaning
 	 * Maybe worth to move to asm code */
 	kernel_tlb = tlb0 + tlb1;
Signature · 1 line
2.14.1
#3 lore raw

Re: [PATCH v2 2/3] microblaze: remove redundant early_printk support

Hi Rob,

Quoted 2 lines · Rob Herring

With earlycon support now enabled, the arch specific early_printk support can be removed.

earlycon is not the full replacement of early_printk support as is designed right now.
Definitely current early_printk is pretty old and contains code duplication but it starts much earlier then earlycon.

Quoted 7 lines

---
v2:
- Fix booting. The setup_memory call needed to be before the parse_early_param call.

What's the reason for calling setup_memory before parse_early_param? Is there any dependency?

Thanks,
Michal

author maintainer
#4 lore raw

Re: [PATCH v2 2/3] microblaze: remove redundant early_printk support

Quoted 10 lines · Michal Simek

Hi Rob,

Quoted 2 lines · Rob Herring

With earlycon support now enabled, the arch specific early_printk support can be removed.

earlycon is not the full replacement of early_printk support as is designed right now.
Definitely current early_printk is pretty old and contains code duplication but it starts much earlier then earlycon.

Yes, essentially it's after MMU enabling rather than before. But it is still before any h/w specific setup (dependent on the DT) which is where one would typically fail to boot. Generally, I've found before DT unflattening to be early enough. What can go wrong at this early stage? Memory is flaky or you've passed in bad memory ranges or image locations. An earlier console may or may not help there and those problems are easier to debug in the bootloader.

So it is a question of what you want to maintain.

Quoted 9 lines
Quoted 6 lines

---
v2:
- Fix booting. The setup_memory call needed to be before the parse_early_param call.

What's the reason for calling setup_memory before parse_early_param? Is there any dependency?

Yes, either fixmap or ioremap (in your case) has to be functional when earlycon is setup which happens via parse_early_param.

Rob

maintainer
#5 lore raw

Re: [PATCH v2 2/3] microblaze: remove redundant early_printk support

Quoted 29 lines · Rob Herring
Quoted 10 lines · Michal Simek

Hi Rob,

Quoted 2 lines · Rob Herring

With earlycon support now enabled, the arch specific early_printk support can be removed.

earlycon is not the full replacement of early_printk support as is designed right now.
Definitely current early_printk is pretty old and contains code duplication but it starts much earlier then earlycon.

Yes, essentially it's after MMU enabling rather than before. But it is still before any h/w specific setup (dependent on the DT) which is where one would typically fail to boot. Generally, I've found before DT unflattening to be early enough. What can go wrong at this early stage? Memory is flaky or you've passed in bad memory ranges or image locations. An earlier console may or may not help there and those problems are easier to debug in the bootloader.

So it is a question of what you want to maintain.

Quoted 7 lines
Quoted 6 lines

---
v2:
- Fix booting. The setup_memory call needed to be before the parse_early_param call.

Quoted 5 lines
Quoted 2 lines

What's the reason for calling setup_memory before parse_early_param? Is there any dependency?

Yes, either fixmap or ioremap (in your case) has to be functional when earlycon is setup which happens via parse_early_param.

Ok. Let's add it and see if there is any issue. Do you have any code which depends on this series?

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs
author maintainer
#6 lore raw

Re: [PATCH v2 2/3] microblaze: remove redundant early_printk support

Quoted 30 lines · Michal Simek
Quoted 29 lines · Rob Herring
Quoted 10 lines · Michal Simek

Hi Rob,

Quoted 2 lines · Rob Herring

With earlycon support now enabled, the arch specific early_printk support can be removed.

earlycon is not the full replacement of early_printk support as is designed right now.
Definitely current early_printk is pretty old and contains code duplication but it starts much earlier then earlycon.

Yes, essentially it's after MMU enabling rather than before. But it is still before any h/w specific setup (dependent on the DT) which is where one would typically fail to boot. Generally, I've found before DT unflattening to be early enough. What can go wrong at this early stage? Memory is flaky or you've passed in bad memory ranges or image locations. An earlier console may or may not help there and those problems are easier to debug in the bootloader.

So it is a question of what you want to maintain.

Quoted 7 lines
Quoted 6 lines

---
v2:
- Fix booting. The setup_memory call needed to be before the parse_early_param call.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

What's the reason for calling setup_memory before parse_early_param? Is there any dependency?

Yes, either fixmap or ioremap (in your case) has to be functional when earlycon is setup which happens via parse_early_param.

Ok. Let's add it and see if there is any issue. Do you have any code which depends on this series?

No, I don't.

Rob

author maintainer
#7 lore raw

PATCH v2 3/3 microblaze: dts: replace 'linux,stdout-path' with 'stdout-path'

In reply to Rob Herring

'linux,stdout-path' has been deprecated for some time in favor of 'stdout-path'. Now dtc will warn on occurrences of 'linux,stdout-path'. Search and replace the one occurrence with 'stdout-path'.

---
 arch/microblaze/boot/dts/system.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/microblaze/boot/dts/system.dts +1 -1
index b620da23febb..8a420c6702eb 100644
@@ -44,7 +44,7 @@
 	} ;
 	chosen {
 		bootargs = "console=ttyUL0,115200 highres=on";
-		linux,stdout-path = "/plb@0/serial@84000000";
+		stdout-path = "/plb@0/serial@84000000";
 	} ;
 	cpus {
 		#address-cells = <1>;
Signature · 1 line
2.14.1