All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC v3 0/4] MIPS: add vmlinu{x,z}.bin appended dtb support
@ 2015-04-12 10:24 ` Jonas Gorski
  0 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:24 UTC (permalink / raw)
  To: linux-mips-6z/3iImG2C8G8FEW9MqTrA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Ralf Baechle, John Crispin,
	Kevin Cernekee, Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

This patch series implements vmlinux.bin and vmlinuz.bin appended dtb
support, and adds a user for the vmlinux one.

The first two patches add the appropriate support for vmlinux.bin and
vmlinuz.bin. Since enabling it for both does not make sense (and is
potentially dangerous) I made it a choice for which variant it should be
enabled.

Patches three and four then add BMIPS as a test user for this
implementation. vmlinuz.bin was tested by selecting SYS_SUPPORTS_ZBOOT
and setting zload-y to 0x81000000 (ramstart + 16 MiB, so the kernel
is loaded behind CFE), then wrapping vmlinuz_w_dtb.bin in the CFE
expected lzma with appropriate header to unpack there.

For easier testing/using I changed boot/dts/brcm to build all dts files
as dtb blobs in case no built in dtb is selected.

Completely untested on anything except MIPS32 / big endian.

Obviously it won't work with an ELF kernel. I did not have a reasonable
idea how to do that except by parsing the elf header from head.S, and
that seemed a bit insane.

Regards
Jonas

Changes RFC v2 -> v3
* Switched to UHI specs interface instead of manipulating initial_boot_params
* fixed boot on !SMP
* Changed PTR_LW to lw and PTR_LI to li to ensure 32bit loads/
  comparisons are done also on 64 bit
* Added vmlinuz.bin support
* Added bmips as a user

Changes RFC v1 -> v2

* changed all occurences of vmlinux to vmlinux.bin
* clarified this applies to the raw vmlinux.bin without decompressor
* s/initial_device_params/initial_boot_params/



Jonas Gorski (4):
  MIPS: add support for vmlinux.bin appended dtb
  MIPS: add support for vmlinuz.bin appended dtb
  MIPS: BMIPS: build all dtbs if no builtin dtb
  MIPS: BMIPS: accept UHI interface for passing a dtb

 arch/mips/Kconfig                   |   45 +++++++++++++++++++++++++++++++++++
 arch/mips/bmips/setup.c             |    2 ++
 arch/mips/boot/compressed/head.S    |   16 +++++++++++++
 arch/mips/boot/compressed/ld.script |    6 ++++-
 arch/mips/boot/dts/brcm/Makefile    |   13 ++++++++++
 arch/mips/kernel/head.S             |   16 +++++++++++++
 arch/mips/kernel/vmlinux.lds.S      |    8 ++++++-
 7 files changed, 104 insertions(+), 2 deletions(-)

-- 
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH RFC v3 0/4] MIPS: add vmlinu{x,z}.bin appended dtb support
@ 2015-04-12 10:24 ` Jonas Gorski
  0 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:24 UTC (permalink / raw)
  To: linux-mips
  Cc: devicetree, Ralf Baechle, John Crispin, Kevin Cernekee,
	Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

This patch series implements vmlinux.bin and vmlinuz.bin appended dtb
support, and adds a user for the vmlinux one.

The first two patches add the appropriate support for vmlinux.bin and
vmlinuz.bin. Since enabling it for both does not make sense (and is
potentially dangerous) I made it a choice for which variant it should be
enabled.

Patches three and four then add BMIPS as a test user for this
implementation. vmlinuz.bin was tested by selecting SYS_SUPPORTS_ZBOOT
and setting zload-y to 0x81000000 (ramstart + 16 MiB, so the kernel
is loaded behind CFE), then wrapping vmlinuz_w_dtb.bin in the CFE
expected lzma with appropriate header to unpack there.

For easier testing/using I changed boot/dts/brcm to build all dts files
as dtb blobs in case no built in dtb is selected.

Completely untested on anything except MIPS32 / big endian.

Obviously it won't work with an ELF kernel. I did not have a reasonable
idea how to do that except by parsing the elf header from head.S, and
that seemed a bit insane.

Regards
Jonas

Changes RFC v2 -> v3
* Switched to UHI specs interface instead of manipulating initial_boot_params
* fixed boot on !SMP
* Changed PTR_LW to lw and PTR_LI to li to ensure 32bit loads/
  comparisons are done also on 64 bit
* Added vmlinuz.bin support
* Added bmips as a user

Changes RFC v1 -> v2

* changed all occurences of vmlinux to vmlinux.bin
* clarified this applies to the raw vmlinux.bin without decompressor
* s/initial_device_params/initial_boot_params/



Jonas Gorski (4):
  MIPS: add support for vmlinux.bin appended dtb
  MIPS: add support for vmlinuz.bin appended dtb
  MIPS: BMIPS: build all dtbs if no builtin dtb
  MIPS: BMIPS: accept UHI interface for passing a dtb

 arch/mips/Kconfig                   |   45 +++++++++++++++++++++++++++++++++++
 arch/mips/bmips/setup.c             |    2 ++
 arch/mips/boot/compressed/head.S    |   16 +++++++++++++
 arch/mips/boot/compressed/ld.script |    6 ++++-
 arch/mips/boot/dts/brcm/Makefile    |   13 ++++++++++
 arch/mips/kernel/head.S             |   16 +++++++++++++
 arch/mips/kernel/vmlinux.lds.S      |    8 ++++++-
 7 files changed, 104 insertions(+), 2 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH RFC v3 1/4] MIPS: add support for vmlinux.bin appended dtb
  2015-04-12 10:24 ` Jonas Gorski
@ 2015-04-12 10:24     ` Jonas Gorski
  -1 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:24 UTC (permalink / raw)
  To: linux-mips-6z/3iImG2C8G8FEW9MqTrA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Ralf Baechle, John Crispin,
	Kevin Cernekee, Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

Add support for detecting a vmlinux.bin appended dtb and overriding
the boot arguments to match the UHI interface.

Due to the PERCPU section being empty for !SMP, but still modifying
the current address by aligning it to the page size, do not define
it for !SMP builds to allow __appended_dtb to still point to
the actual end of the data.

Signed-off-by: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
---
Changes RFC v2 -> v3

* Switched to UHI interface instead of manipulating initial_boot_params
* fixed boot on !SMP
* Changed PTR_LW to lw and PTR_LI to li to ensure 32bit loads/
  comparisons are done on 64 bit

Changes RFC v1 -> v2

* changed all occurences of vmlinux to vmlinux.bin
* clarified this applies to the raw vmlinux.bin without decompressor
* s/initial_device_params/initial_boot_params/

 arch/mips/Kconfig              |   27 +++++++++++++++++++++++++++
 arch/mips/kernel/head.S        |   16 ++++++++++++++++
 arch/mips/kernel/vmlinux.lds.S |    8 +++++++-
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 779dcae..0986619 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2672,6 +2672,33 @@ config USE_OF
 config BUILTIN_DTB
 	bool
 
+choice
+	prompt "Kernel appended dtb support" if OF
+	default MIPS_NO_APPENDED_DTB
+
+	config MIPS_NO_APPENDED_DTB
+		bool "None"
+		help
+		  Do not enable appended dtb support.
+
+	config MIPS_RAW_APPENDED_DTB
+		bool "vmlinux.bin"
+		help
+		  With this option, the boot code will look for a device tree binary
+		  DTB) appended to raw vmlinux.bin (without decompressor).
+		  (e.g. cat vmlinux.bin <filename>.dtb > vmlinux_w_dtb).
+
+		  This is meant as a backward compatibility convenience for those
+		  systems with a bootloader that can't be upgraded to accommodate
+		  the documented boot protocol using a device tree.
+
+		  Beware that there is very little in terms of protection against
+		  this option being confused by leftover garbage in memory that might
+		  look like a DTB header after a reboot if no actual DTB is appended
+		  to vmlinux.bin.  Do not leave this option active in a production kernel
+		  if you don't intend to always append a DTB.
+endchoice
+
 endmenu
 
 config LOCKDEP_SUPPORT
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 95afd66..4e4cc5b 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -94,6 +94,22 @@ NESTED(kernel_entry, 16, sp)			# kernel entry point
 	jr	t0
 0:
 
+#ifdef CONFIG_MIPS_RAW_APPENDED_DTB
+	PTR_LA		t0, __appended_dtb
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+	li		t1, 0xd00dfeed
+#else
+	li		t1, 0xedfe0dd0
+#endif
+	lw		t2, (t0)
+	bne		t1, t2, not_found
+	 nop
+
+	move		a1, t0
+	PTR_LI		a0, -2
+not_found:
+#endif
 	PTR_LA		t0, __bss_start		# clear .bss
 	LONG_S		zero, (t0)
 	PTR_LA		t1, __bss_stop - LONGSIZE
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 3b46f7c..07d32a4 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -125,8 +125,14 @@ SECTIONS
 	.exit.data : {
 		EXIT_DATA
 	}
-
+#ifdef CONFIG_SMP
 	PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
+#endif
+#ifdef CONFIG_MIPS_RAW_APPENDED_DTB
+	__appended_dtb = .;
+	/* leave space for appended DTB */
+	. += 0x100000;
+#endif
 	/*
 	 * Align to 64K in attempt to eliminate holes before the
 	 * .bss..swapper_pg_dir section at the start of .bss.  This
-- 
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH RFC v3 1/4] MIPS: add support for vmlinux.bin appended dtb
@ 2015-04-12 10:24     ` Jonas Gorski
  0 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:24 UTC (permalink / raw)
  To: linux-mips
  Cc: devicetree, Ralf Baechle, John Crispin, Kevin Cernekee,
	Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

Add support for detecting a vmlinux.bin appended dtb and overriding
the boot arguments to match the UHI interface.

Due to the PERCPU section being empty for !SMP, but still modifying
the current address by aligning it to the page size, do not define
it for !SMP builds to allow __appended_dtb to still point to
the actual end of the data.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
Changes RFC v2 -> v3

* Switched to UHI interface instead of manipulating initial_boot_params
* fixed boot on !SMP
* Changed PTR_LW to lw and PTR_LI to li to ensure 32bit loads/
  comparisons are done on 64 bit

Changes RFC v1 -> v2

* changed all occurences of vmlinux to vmlinux.bin
* clarified this applies to the raw vmlinux.bin without decompressor
* s/initial_device_params/initial_boot_params/

 arch/mips/Kconfig              |   27 +++++++++++++++++++++++++++
 arch/mips/kernel/head.S        |   16 ++++++++++++++++
 arch/mips/kernel/vmlinux.lds.S |    8 +++++++-
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 779dcae..0986619 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2672,6 +2672,33 @@ config USE_OF
 config BUILTIN_DTB
 	bool
 
+choice
+	prompt "Kernel appended dtb support" if OF
+	default MIPS_NO_APPENDED_DTB
+
+	config MIPS_NO_APPENDED_DTB
+		bool "None"
+		help
+		  Do not enable appended dtb support.
+
+	config MIPS_RAW_APPENDED_DTB
+		bool "vmlinux.bin"
+		help
+		  With this option, the boot code will look for a device tree binary
+		  DTB) appended to raw vmlinux.bin (without decompressor).
+		  (e.g. cat vmlinux.bin <filename>.dtb > vmlinux_w_dtb).
+
+		  This is meant as a backward compatibility convenience for those
+		  systems with a bootloader that can't be upgraded to accommodate
+		  the documented boot protocol using a device tree.
+
+		  Beware that there is very little in terms of protection against
+		  this option being confused by leftover garbage in memory that might
+		  look like a DTB header after a reboot if no actual DTB is appended
+		  to vmlinux.bin.  Do not leave this option active in a production kernel
+		  if you don't intend to always append a DTB.
+endchoice
+
 endmenu
 
 config LOCKDEP_SUPPORT
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 95afd66..4e4cc5b 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -94,6 +94,22 @@ NESTED(kernel_entry, 16, sp)			# kernel entry point
 	jr	t0
 0:
 
+#ifdef CONFIG_MIPS_RAW_APPENDED_DTB
+	PTR_LA		t0, __appended_dtb
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+	li		t1, 0xd00dfeed
+#else
+	li		t1, 0xedfe0dd0
+#endif
+	lw		t2, (t0)
+	bne		t1, t2, not_found
+	 nop
+
+	move		a1, t0
+	PTR_LI		a0, -2
+not_found:
+#endif
 	PTR_LA		t0, __bss_start		# clear .bss
 	LONG_S		zero, (t0)
 	PTR_LA		t1, __bss_stop - LONGSIZE
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 3b46f7c..07d32a4 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -125,8 +125,14 @@ SECTIONS
 	.exit.data : {
 		EXIT_DATA
 	}
-
+#ifdef CONFIG_SMP
 	PERCPU_SECTION(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
+#endif
+#ifdef CONFIG_MIPS_RAW_APPENDED_DTB
+	__appended_dtb = .;
+	/* leave space for appended DTB */
+	. += 0x100000;
+#endif
 	/*
 	 * Align to 64K in attempt to eliminate holes before the
 	 * .bss..swapper_pg_dir section at the start of .bss.  This
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH RFC v3 2/4] MIPS: add support for vmlinuz.bin appended dtb
  2015-04-12 10:24 ` Jonas Gorski
@ 2015-04-12 10:24     ` Jonas Gorski
  -1 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:24 UTC (permalink / raw)
  To: linux-mips-6z/3iImG2C8G8FEW9MqTrA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Ralf Baechle, John Crispin,
	Kevin Cernekee, Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

Add support for detecting a vmlinuz.bin appended dtb and overriding
the boot arguments to match the UHI interface.

To ensure _edata / __apendend_dtb points to the actual end of the
binary, align the data section to 16 bytes instead of the address
cursor.

Due to ld.script not going through the preprocessor, we can't check
for MIPS_ZBOOT_APPENDED_DTB being enabled, so always reserve space
for it. It should have no consequences for booting without it enabled
except 1 MiB more ram usage during the uncompressing stage.

Signed-off-by: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
---
 arch/mips/Kconfig                   |   18 ++++++++++++++++++
 arch/mips/boot/compressed/head.S    |   16 ++++++++++++++++
 arch/mips/boot/compressed/ld.script |    6 +++++-
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 0986619..8aef377 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2697,6 +2697,24 @@ choice
 		  look like a DTB header after a reboot if no actual DTB is appended
 		  to vmlinux.bin.  Do not leave this option active in a production kernel
 		  if you don't intend to always append a DTB.
+
+	config MIPS_ZBOOT_APPENDED_DTB
+		bool "vmlinuz.bin"
+		depends on SYS_SUPPORTS_ZBOOT
+		help
+		  With this option, the boot code will look for a device tree binary
+		  DTB) appended to raw vmlinuz.bin (with decompressor).
+		  (e.g. cat vmlinuz.bin <filename>.dtb > vmlinuz_w_dtb).
+
+		  This is meant as a backward compatibility convenience for those
+		  systems with a bootloader that can't be upgraded to accommodate
+		  the documented boot protocol using a device tree.
+
+		  Beware that there is very little in terms of protection against
+		  this option being confused by leftover garbage in memory that might
+		  look like a DTB header after a reboot if no actual DTB is appended
+		  to vmlinuz.bin.  Do not leave this option active in a production kernel
+		  if you don't intend to always append a DTB.
 endchoice
 
 endmenu
diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
index 409cb48..c580e85 100644
--- a/arch/mips/boot/compressed/head.S
+++ b/arch/mips/boot/compressed/head.S
@@ -25,6 +25,22 @@ start:
 	move	s2, a2
 	move	s3, a3
 
+#ifdef CONFIG_MIPS_ZBOOT_APPENDED_DTB
+	PTR_LA	t0, __appended_dtb
+#ifdef CONFIG_CPU_BIG_ENDIAN
+	li	t1, 0xd00dfeed
+#else
+	li	t1, 0xedfe0dd0
+#endif
+	lw	t2, (t0)
+	bne	t1, t2, not_found
+	 nop
+
+	move	s1, t0
+	PTR_LI	s0, -2
+not_found:
+#endif
+
 	/* Clear BSS */
 	PTR_LA	a0, _edata
 	PTR_LA	a2, _end
diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
index 5a33409..2ed08fb 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/ld.script
@@ -29,8 +29,12 @@ SECTIONS
 		*(.image)
 		__image_end = .;
 		CONSTRUCTORS
+		. = ALIGN(16);
 	}
-	. = ALIGN(16);
+	__appended_dtb = .;
+	/* leave space for appended DTB */
+	. += 0x100000;
+
 	_edata = .;
 	/* End of data section */
 
-- 
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH RFC v3 2/4] MIPS: add support for vmlinuz.bin appended dtb
@ 2015-04-12 10:24     ` Jonas Gorski
  0 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:24 UTC (permalink / raw)
  To: linux-mips
  Cc: devicetree, Ralf Baechle, John Crispin, Kevin Cernekee,
	Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

Add support for detecting a vmlinuz.bin appended dtb and overriding
the boot arguments to match the UHI interface.

To ensure _edata / __apendend_dtb points to the actual end of the
binary, align the data section to 16 bytes instead of the address
cursor.

Due to ld.script not going through the preprocessor, we can't check
for MIPS_ZBOOT_APPENDED_DTB being enabled, so always reserve space
for it. It should have no consequences for booting without it enabled
except 1 MiB more ram usage during the uncompressing stage.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 arch/mips/Kconfig                   |   18 ++++++++++++++++++
 arch/mips/boot/compressed/head.S    |   16 ++++++++++++++++
 arch/mips/boot/compressed/ld.script |    6 +++++-
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 0986619..8aef377 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2697,6 +2697,24 @@ choice
 		  look like a DTB header after a reboot if no actual DTB is appended
 		  to vmlinux.bin.  Do not leave this option active in a production kernel
 		  if you don't intend to always append a DTB.
+
+	config MIPS_ZBOOT_APPENDED_DTB
+		bool "vmlinuz.bin"
+		depends on SYS_SUPPORTS_ZBOOT
+		help
+		  With this option, the boot code will look for a device tree binary
+		  DTB) appended to raw vmlinuz.bin (with decompressor).
+		  (e.g. cat vmlinuz.bin <filename>.dtb > vmlinuz_w_dtb).
+
+		  This is meant as a backward compatibility convenience for those
+		  systems with a bootloader that can't be upgraded to accommodate
+		  the documented boot protocol using a device tree.
+
+		  Beware that there is very little in terms of protection against
+		  this option being confused by leftover garbage in memory that might
+		  look like a DTB header after a reboot if no actual DTB is appended
+		  to vmlinuz.bin.  Do not leave this option active in a production kernel
+		  if you don't intend to always append a DTB.
 endchoice
 
 endmenu
diff --git a/arch/mips/boot/compressed/head.S b/arch/mips/boot/compressed/head.S
index 409cb48..c580e85 100644
--- a/arch/mips/boot/compressed/head.S
+++ b/arch/mips/boot/compressed/head.S
@@ -25,6 +25,22 @@ start:
 	move	s2, a2
 	move	s3, a3
 
+#ifdef CONFIG_MIPS_ZBOOT_APPENDED_DTB
+	PTR_LA	t0, __appended_dtb
+#ifdef CONFIG_CPU_BIG_ENDIAN
+	li	t1, 0xd00dfeed
+#else
+	li	t1, 0xedfe0dd0
+#endif
+	lw	t2, (t0)
+	bne	t1, t2, not_found
+	 nop
+
+	move	s1, t0
+	PTR_LI	s0, -2
+not_found:
+#endif
+
 	/* Clear BSS */
 	PTR_LA	a0, _edata
 	PTR_LA	a2, _end
diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
index 5a33409..2ed08fb 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/ld.script
@@ -29,8 +29,12 @@ SECTIONS
 		*(.image)
 		__image_end = .;
 		CONSTRUCTORS
+		. = ALIGN(16);
 	}
-	. = ALIGN(16);
+	__appended_dtb = .;
+	/* leave space for appended DTB */
+	. += 0x100000;
+
 	_edata = .;
 	/* End of data section */
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH RFC v3 3/4] MIPS: BMIPS: build all dtbs if no builtin dtb
  2015-04-12 10:24 ` Jonas Gorski
@ 2015-04-12 10:25     ` Jonas Gorski
  -1 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:25 UTC (permalink / raw)
  To: linux-mips-6z/3iImG2C8G8FEW9MqTrA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Ralf Baechle, John Crispin,
	Kevin Cernekee, Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

Build all available dtbs to allow them to be appended to the resulting
kernel in case there is no builtin dtb.

Signed-off-by: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
---
 arch/mips/boot/dts/brcm/Makefile |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/mips/boot/dts/brcm/Makefile b/arch/mips/boot/dts/brcm/Makefile
index 1c8353b..c641216 100644
--- a/arch/mips/boot/dts/brcm/Makefile
+++ b/arch/mips/boot/dts/brcm/Makefile
@@ -10,6 +10,19 @@ dtb-$(CONFIG_DT_BCM97362SVMB)		+= bcm97362svmb.dtb
 dtb-$(CONFIG_DT_BCM97420C)		+= bcm97420c.dtb
 dtb-$(CONFIG_DT_BCM97425SVMB)		+= bcm97425svmb.dtb
 
+dtb-$(CONFIG_DT_NONE)			+= \
+						bcm93384wvg.dtb		\
+						bcm93384wvg_viper.dtb	\
+						bcm96368mvwg.dtb	\
+						bcm9ejtagprb.dtb	\
+						bcm97125cbmb.dtb	\
+						bcm97346dbsmb.dtb	\
+						bcm97358svmb.dtb	\
+						bcm97360svmb.dtb	\
+						bcm97362svmb.dtb	\
+						bcm97420c.dtb		\
+						bcm97425svmb.dtb
+
 obj-y				+= $(patsubst %.dtb, %.dtb.o, $(dtb-y))
 
 # Force kbuild to make empty built-in.o if necessary
-- 
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH RFC v3 3/4] MIPS: BMIPS: build all dtbs if no builtin dtb
@ 2015-04-12 10:25     ` Jonas Gorski
  0 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:25 UTC (permalink / raw)
  To: linux-mips
  Cc: devicetree, Ralf Baechle, John Crispin, Kevin Cernekee,
	Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

Build all available dtbs to allow them to be appended to the resulting
kernel in case there is no builtin dtb.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 arch/mips/boot/dts/brcm/Makefile |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/mips/boot/dts/brcm/Makefile b/arch/mips/boot/dts/brcm/Makefile
index 1c8353b..c641216 100644
--- a/arch/mips/boot/dts/brcm/Makefile
+++ b/arch/mips/boot/dts/brcm/Makefile
@@ -10,6 +10,19 @@ dtb-$(CONFIG_DT_BCM97362SVMB)		+= bcm97362svmb.dtb
 dtb-$(CONFIG_DT_BCM97420C)		+= bcm97420c.dtb
 dtb-$(CONFIG_DT_BCM97425SVMB)		+= bcm97425svmb.dtb
 
+dtb-$(CONFIG_DT_NONE)			+= \
+						bcm93384wvg.dtb		\
+						bcm93384wvg_viper.dtb	\
+						bcm96368mvwg.dtb	\
+						bcm9ejtagprb.dtb	\
+						bcm97125cbmb.dtb	\
+						bcm97346dbsmb.dtb	\
+						bcm97358svmb.dtb	\
+						bcm97360svmb.dtb	\
+						bcm97362svmb.dtb	\
+						bcm97420c.dtb		\
+						bcm97425svmb.dtb
+
 obj-y				+= $(patsubst %.dtb, %.dtb.o, $(dtb-y))
 
 # Force kbuild to make empty built-in.o if necessary
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH RFC v3 4/4] MIPS: BMIPS: accept UHI interface for passing a dtb
  2015-04-12 10:24 ` Jonas Gorski
@ 2015-04-12 10:25     ` Jonas Gorski
  -1 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:25 UTC (permalink / raw)
  To: linux-mips-6z/3iImG2C8G8FEW9MqTrA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Ralf Baechle, John Crispin,
	Kevin Cernekee, Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

Detect and use passed dtb address using the UHI interface. This allows for
booting with a vmlinux.bin appended dtb instead of using a built-in one.

Signed-off-by: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
---
 arch/mips/bmips/setup.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
index fae800e..526ec27 100644
--- a/arch/mips/bmips/setup.c
+++ b/arch/mips/bmips/setup.c
@@ -149,6 +149,8 @@ void __init plat_mem_setup(void)
 	/* intended to somewhat resemble ARM; see Documentation/arm/Booting */
 	if (fw_arg0 == 0 && fw_arg1 == 0xffffffff)
 		dtb = phys_to_virt(fw_arg2);
+	else if (fw_arg0 == -2) /* UHI interface */
+		dtb = (void *)fw_arg1;
 	else if (__dtb_start != __dtb_end)
 		dtb = (void *)__dtb_start;
 	else
-- 
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH RFC v3 4/4] MIPS: BMIPS: accept UHI interface for passing a dtb
@ 2015-04-12 10:25     ` Jonas Gorski
  0 siblings, 0 replies; 12+ messages in thread
From: Jonas Gorski @ 2015-04-12 10:25 UTC (permalink / raw)
  To: linux-mips
  Cc: devicetree, Ralf Baechle, John Crispin, Kevin Cernekee,
	Florian Fainelli, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

Detect and use passed dtb address using the UHI interface. This allows for
booting with a vmlinux.bin appended dtb instead of using a built-in one.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
---
 arch/mips/bmips/setup.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
index fae800e..526ec27 100644
--- a/arch/mips/bmips/setup.c
+++ b/arch/mips/bmips/setup.c
@@ -149,6 +149,8 @@ void __init plat_mem_setup(void)
 	/* intended to somewhat resemble ARM; see Documentation/arm/Booting */
 	if (fw_arg0 == 0 && fw_arg1 == 0xffffffff)
 		dtb = phys_to_virt(fw_arg2);
+	else if (fw_arg0 == -2) /* UHI interface */
+		dtb = (void *)fw_arg1;
 	else if (__dtb_start != __dtb_end)
 		dtb = (void *)__dtb_start;
 	else
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH RFC v3 4/4] MIPS: BMIPS: accept UHI interface for passing a dtb
  2015-04-12 10:25     ` Jonas Gorski
@ 2015-04-18  3:09         ` Florian Fainelli
  -1 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2015-04-18  3:09 UTC (permalink / raw)
  To: Jonas Gorski, linux-mips-6z/3iImG2C8G8FEW9MqTrA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Ralf Baechle, John Crispin,
	Kevin Cernekee, Aaro Koskinen, Markos Chandras,
	Andrew Bresticker, Daniel Schwierzeck, Paul Burton,
	James Hartley

Le 12/04/2015 03:25, Jonas Gorski a écrit :
> Detect and use passed dtb address using the UHI interface. This allows for
> booting with a vmlinux.bin appended dtb instead of using a built-in one.

No particular objections to this change, current platforms support by
this change fall under 3 categories:

- BCM7xxx using a CFE providing a firmware interface you call into using
code from arch/mips/fw/cfe/
- BCM63xx CFE
- BCM33xx using Aeolus [1]

The first two are likely not going to be changed since these are
currently deployed products/systems, however the latter could be changed
to match UHI as Kevin proposed a while ago.

> 
> Signed-off-by: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
> ---
>  arch/mips/bmips/setup.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
> index fae800e..526ec27 100644
> --- a/arch/mips/bmips/setup.c
> +++ b/arch/mips/bmips/setup.c
> @@ -149,6 +149,8 @@ void __init plat_mem_setup(void)
>  	/* intended to somewhat resemble ARM; see Documentation/arm/Booting */
>  	if (fw_arg0 == 0 && fw_arg1 == 0xffffffff)
>  		dtb = phys_to_virt(fw_arg2);
> +	else if (fw_arg0 == -2) /* UHI interface */
> +		dtb = (void *)fw_arg1;
>  	else if (__dtb_start != __dtb_end)
>  		dtb = (void *)__dtb_start;
>  	else
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH RFC v3 4/4] MIPS: BMIPS: accept UHI interface for passing a dtb
@ 2015-04-18  3:09         ` Florian Fainelli
  0 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2015-04-18  3:09 UTC (permalink / raw)
  To: Jonas Gorski, linux-mips
  Cc: devicetree, Ralf Baechle, John Crispin, Kevin Cernekee,
	Aaro Koskinen, Markos Chandras, Andrew Bresticker,
	Daniel Schwierzeck, Paul Burton, James Hartley

Le 12/04/2015 03:25, Jonas Gorski a écrit :
> Detect and use passed dtb address using the UHI interface. This allows for
> booting with a vmlinux.bin appended dtb instead of using a built-in one.

No particular objections to this change, current platforms support by
this change fall under 3 categories:

- BCM7xxx using a CFE providing a firmware interface you call into using
code from arch/mips/fw/cfe/
- BCM63xx CFE
- BCM33xx using Aeolus [1]

The first two are likely not going to be changed since these are
currently deployed products/systems, however the latter could be changed
to match UHI as Kevin proposed a while ago.

> 
> Signed-off-by: Jonas Gorski <jogo@openwrt.org>
> ---
>  arch/mips/bmips/setup.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
> index fae800e..526ec27 100644
> --- a/arch/mips/bmips/setup.c
> +++ b/arch/mips/bmips/setup.c
> @@ -149,6 +149,8 @@ void __init plat_mem_setup(void)
>  	/* intended to somewhat resemble ARM; see Documentation/arm/Booting */
>  	if (fw_arg0 == 0 && fw_arg1 == 0xffffffff)
>  		dtb = phys_to_virt(fw_arg2);
> +	else if (fw_arg0 == -2) /* UHI interface */
> +		dtb = (void *)fw_arg1;
>  	else if (__dtb_start != __dtb_end)
>  		dtb = (void *)__dtb_start;
>  	else
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-04-18  3:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-12 10:24 [PATCH RFC v3 0/4] MIPS: add vmlinu{x,z}.bin appended dtb support Jonas Gorski
2015-04-12 10:24 ` Jonas Gorski
     [not found] ` <1428834301-12721-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-04-12 10:24   ` [PATCH RFC v3 1/4] MIPS: add support for vmlinux.bin appended dtb Jonas Gorski
2015-04-12 10:24     ` Jonas Gorski
2015-04-12 10:24   ` [PATCH RFC v3 2/4] MIPS: add support for vmlinuz.bin " Jonas Gorski
2015-04-12 10:24     ` Jonas Gorski
2015-04-12 10:25   ` [PATCH RFC v3 3/4] MIPS: BMIPS: build all dtbs if no builtin dtb Jonas Gorski
2015-04-12 10:25     ` Jonas Gorski
2015-04-12 10:25   ` [PATCH RFC v3 4/4] MIPS: BMIPS: accept UHI interface for passing a dtb Jonas Gorski
2015-04-12 10:25     ` Jonas Gorski
     [not found]     ` <1428834301-12721-5-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-04-18  3:09       ` Florian Fainelli
2015-04-18  3:09         ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.