mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: boards: qemu-virt64: use SPDX-License Ids
@ 2020-11-03 11:49 Rouven Czerwinski
  2020-11-03 11:49 ` [PATCH 2/2] ARM: qemu: add support for qemu virt platform Rouven Czerwinski
  2020-11-04  8:00 ` [PATCH 1/2] ARM: boards: qemu-virt64: use SPDX-License Ids Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Rouven Czerwinski @ 2020-11-03 11:49 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Cleanup while looking at the code for virt64.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 arch/arm/boards/qemu-virt64/init.c          | 2 +-
 arch/arm/boards/qemu-virt64/lowlevel.c      | 2 +-
 arch/arm/boards/qemu-virt64/lowlevel_init.S | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/qemu-virt64/init.c b/arch/arm/boards/qemu-virt64/init.c
index 19cfcae1f0..06ae96d474 100644
--- a/arch/arm/boards/qemu-virt64/init.c
+++ b/arch/arm/boards/qemu-virt64/init.c
@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) 2016 Raphaël Poggi <poggi.raph@gmail.com>
  *
- * GPLv2 only
  */
 
 #include <common.h>
diff --git a/arch/arm/boards/qemu-virt64/lowlevel.c b/arch/arm/boards/qemu-virt64/lowlevel.c
index fcb052369a..745e364df6 100644
--- a/arch/arm/boards/qemu-virt64/lowlevel.c
+++ b/arch/arm/boards/qemu-virt64/lowlevel.c
@@ -1,7 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
  *
- * GPLv2 only
  */
 
 #include <common.h>
diff --git a/arch/arm/boards/qemu-virt64/lowlevel_init.S b/arch/arm/boards/qemu-virt64/lowlevel_init.S
index 1967fadb6c..672750fa7b 100644
--- a/arch/arm/boards/qemu-virt64/lowlevel_init.S
+++ b/arch/arm/boards/qemu-virt64/lowlevel_init.S
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* SPDX-License-Identifier: GPL-2.0+ */
 #include <linux/linkage.h>
 #include <asm/barebox-arm64.h>
 
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/2] ARM: qemu: add support for qemu virt platform
  2020-11-03 11:49 [PATCH 1/2] ARM: boards: qemu-virt64: use SPDX-License Ids Rouven Czerwinski
@ 2020-11-03 11:49 ` Rouven Czerwinski
  2020-11-04 10:48   ` Roland Hieber
  2020-11-04  8:00 ` [PATCH 1/2] ARM: boards: qemu-virt64: use SPDX-License Ids Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Rouven Czerwinski @ 2020-11-03 11:49 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Necessary support to boot barebox on ARM qemu virt platforms.
No internal device tree, since it is passed by qemu. Also currently
expects -m 1024M because of the hard set memsize.
Future improvements to read the memory size directly from the dtb
welcome.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 arch/arm/boards/Makefile                  |  1 +
 arch/arm/boards/qemu-virt/Makefile        |  2 ++
 arch/arm/boards/qemu-virt/board.c         | 25 +++++++++++++
 arch/arm/boards/qemu-virt/lowlevel.c      | 43 +++++++++++++++++++++++
 arch/arm/boards/qemu-virt/lowlevel_init.S | 10 ++++++
 arch/arm/mach-qemu/Kconfig                |  7 ++++
 arch/arm/mach-qemu/Makefile               |  2 +-
 7 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/qemu-virt/Makefile
 create mode 100644 arch/arm/boards/qemu-virt/board.c
 create mode 100644 arch/arm/boards/qemu-virt/lowlevel.c
 create mode 100644 arch/arm/boards/qemu-virt/lowlevel_init.S

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index a02d80d2da..8d191f97aa 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -164,6 +164,7 @@ obj-$(CONFIG_MACH_ZYLONITE)			+= zylonite/
 obj-$(CONFIG_MACH_VARISCITE_MX6)		+= variscite-mx6/
 obj-$(CONFIG_MACH_VSCOM_BALTOS)			+= vscom-baltos/
 obj-$(CONFIG_MACH_QEMU_VIRT64)			+= qemu-virt64/
+obj-$(CONFIG_MACH_QEMU_VIRT)			+= qemu-virt/
 obj-$(CONFIG_MACH_WARP7)			+= element14-warp7/
 obj-$(CONFIG_MACH_WEBASTO_CCBV2)		+= webasto-ccbv2/
 obj-$(CONFIG_MACH_VF610_TWR)			+= freescale-vf610-twr/
diff --git a/arch/arm/boards/qemu-virt/Makefile b/arch/arm/boards/qemu-virt/Makefile
new file mode 100644
index 0000000000..03def2a918
--- /dev/null
+++ b/arch/arm/boards/qemu-virt/Makefile
@@ -0,0 +1,2 @@
+lwl-y += lowlevel.o lowlevel_init.o
+obj-y += board.o
diff --git a/arch/arm/boards/qemu-virt/board.c b/arch/arm/boards/qemu-virt/board.c
new file mode 100644
index 0000000000..e39b104705
--- /dev/null
+++ b/arch/arm/boards/qemu-virt/board.c
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 Pengutronix e.K.
+ *
+ */
+#include <common.h>
+#include <init.h>
+#include <asm/armlinux.h>
+#include <asm/system_info.h>
+#include <asm/pgtable64.h>
+#include <mach/devices.h>
+#include <environment.h>
+#include <linux/sizes.h>
+#include <io.h>
+#include <envfs.h>
+#include <globalvar.h>
+#include <asm/mmu.h>
+
+static int virt_console_init(void)
+{
+	virt_register_uart(0);
+
+	return 0;
+}
+console_initcall(virt_console_init);
diff --git a/arch/arm/boards/qemu-virt/lowlevel.c b/arch/arm/boards/qemu-virt/lowlevel.c
new file mode 100644
index 0000000000..9024eed5f9
--- /dev/null
+++ b/arch/arm/boards/qemu-virt/lowlevel.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 Pengutronix e.K.
+ *
+ */
+
+#include <common.h>
+#include <linux/sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <asm/system_info.h>
+#include <asm/unaligned.h>
+
+void qemu_virt_start(uint32_t, uint32_t, uint32_t);
+
+static void virt_entry(uint32_t r2) {
+	void *fdt = NULL;
+    	unsigned long membase = 0x40000000;
+	unsigned long memsize = SZ_512M;
+
+	if (IS_ENABLED(CONFIG_OFDEVICE) &&
+	    get_unaligned_be32((void*)r2) == FDT_MAGIC) {
+		fdt = (void*)r2;
+		/*
+		 * Need to move membase a bit as the PBL wants to relocate
+		 * to the start of RAM, which would overwrite the DTB.
+		 */
+	}
+
+	barebox_arm_entry(membase, memsize, fdt);
+}
+
+void noinline qemu_virt_start(uint32_t r0, uint32_t r1, uint32_t r2)
+{
+	arm_cpu_lowlevel_init();
+
+	relocate_to_current_adr();
+	setup_c();
+	barrier();
+
+	virt_entry(r2);
+}
+
diff --git a/arch/arm/boards/qemu-virt/lowlevel_init.S b/arch/arm/boards/qemu-virt/lowlevel_init.S
new file mode 100644
index 0000000000..3558df0591
--- /dev/null
+++ b/arch/arm/boards/qemu-virt/lowlevel_init.S
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+/* The DRAM is already setup */
+#define STACK_TOP 0x50000000
+
+.globl barebox_arm_reset_vector
+barebox_arm_reset_vector:
+	mov r0, #STACK_TOP
+	mov sp, r0
+	b qemu_virt_start
diff --git a/arch/arm/mach-qemu/Kconfig b/arch/arm/mach-qemu/Kconfig
index d30bae4c6f..dd3ccd8740 100644
--- a/arch/arm/mach-qemu/Kconfig
+++ b/arch/arm/mach-qemu/Kconfig
@@ -14,5 +14,12 @@ config MACH_QEMU_VIRT64
 	select ARM_AMBA
 	select HAVE_CONFIGURABLE_MEMORY_LAYOUT
 
+config MACH_QEMU_VIRT
+	bool "QEMU arm virt machine"
+	select CPU_V7
+	select ARM_AMBA
+	select RELOCATABLE
+	select ARM_PSCI_CLIENT
+
 endchoice
 endif
diff --git a/arch/arm/mach-qemu/Makefile b/arch/arm/mach-qemu/Makefile
index ece277ce0e..8f73aa41a5 100644
--- a/arch/arm/mach-qemu/Makefile
+++ b/arch/arm/mach-qemu/Makefile
@@ -1 +1 @@
-obj-$(CONFIG_MACH_QEMU_VIRT64) += virt_devices.o
+obj-$(CONFIG_ARCH_QEMU) += virt_devices.o
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/2] ARM: boards: qemu-virt64: use SPDX-License Ids
  2020-11-03 11:49 [PATCH 1/2] ARM: boards: qemu-virt64: use SPDX-License Ids Rouven Czerwinski
  2020-11-03 11:49 ` [PATCH 2/2] ARM: qemu: add support for qemu virt platform Rouven Czerwinski
@ 2020-11-04  8:00 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2020-11-04  8:00 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

On Tue, Nov 03, 2020 at 12:49:47PM +0100, Rouven Czerwinski wrote:
> Cleanup while looking at the code for virt64.
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  arch/arm/boards/qemu-virt64/init.c          | 2 +-
>  arch/arm/boards/qemu-virt64/lowlevel.c      | 2 +-
>  arch/arm/boards/qemu-virt64/lowlevel_init.S | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boards/qemu-virt64/init.c b/arch/arm/boards/qemu-virt64/init.c
> index 19cfcae1f0..06ae96d474 100644
> --- a/arch/arm/boards/qemu-virt64/init.c
> +++ b/arch/arm/boards/qemu-virt64/init.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Copyright (C) 2016 Raphaël Poggi <poggi.raph@gmail.com>
>   *
> - * GPLv2 only
>   */
>  
>  #include <common.h>
> diff --git a/arch/arm/boards/qemu-virt64/lowlevel.c b/arch/arm/boards/qemu-virt64/lowlevel.c
> index fcb052369a..745e364df6 100644
> --- a/arch/arm/boards/qemu-virt64/lowlevel.c
> +++ b/arch/arm/boards/qemu-virt64/lowlevel.c
> @@ -1,7 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
>   *
> - * GPLv2 only
>   */
>  
>  #include <common.h>
> diff --git a/arch/arm/boards/qemu-virt64/lowlevel_init.S b/arch/arm/boards/qemu-virt64/lowlevel_init.S
> index 1967fadb6c..672750fa7b 100644
> --- a/arch/arm/boards/qemu-virt64/lowlevel_init.S
> +++ b/arch/arm/boards/qemu-virt64/lowlevel_init.S
> @@ -1,4 +1,4 @@
> -/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/* SPDX-License-Identifier: GPL-2.0+ */

https://spdx.org/licenses/ lists both GPL-2.0-or-later and GPL-2.0+, but
GPL-2.0+ is in the list of deprecated License identifiers, do we use
other lists?

We have 1056 times the former and 996 times the latter in the tree. If
anything, let's do a mass conversion, but not individual files.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 2/2] ARM: qemu: add support for qemu virt platform
  2020-11-03 11:49 ` [PATCH 2/2] ARM: qemu: add support for qemu virt platform Rouven Czerwinski
@ 2020-11-04 10:48   ` Roland Hieber
  0 siblings, 0 replies; 4+ messages in thread
From: Roland Hieber @ 2020-11-04 10:48 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

On Tue, Nov 03, 2020 at 12:49:48PM +0100, Rouven Czerwinski wrote:
> Necessary support to boot barebox on ARM qemu virt platforms.
> No internal device tree, since it is passed by qemu. Also currently
> expects -m 1024M because of the hard set memsize.
> Future improvements to read the memory size directly from the dtb
> welcome.
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  arch/arm/boards/Makefile                  |  1 +
>  arch/arm/boards/qemu-virt/Makefile        |  2 ++
>  arch/arm/boards/qemu-virt/board.c         | 25 +++++++++++++
>  arch/arm/boards/qemu-virt/lowlevel.c      | 43 +++++++++++++++++++++++
>  arch/arm/boards/qemu-virt/lowlevel_init.S | 10 ++++++
>  arch/arm/mach-qemu/Kconfig                |  7 ++++
>  arch/arm/mach-qemu/Makefile               |  2 +-
>  7 files changed, 89 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/boards/qemu-virt/Makefile
>  create mode 100644 arch/arm/boards/qemu-virt/board.c
>  create mode 100644 arch/arm/boards/qemu-virt/lowlevel.c
>  create mode 100644 arch/arm/boards/qemu-virt/lowlevel_init.S
> 
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index a02d80d2da..8d191f97aa 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -164,6 +164,7 @@ obj-$(CONFIG_MACH_ZYLONITE)			+= zylonite/
>  obj-$(CONFIG_MACH_VARISCITE_MX6)		+= variscite-mx6/
>  obj-$(CONFIG_MACH_VSCOM_BALTOS)			+= vscom-baltos/
>  obj-$(CONFIG_MACH_QEMU_VIRT64)			+= qemu-virt64/
> +obj-$(CONFIG_MACH_QEMU_VIRT)			+= qemu-virt/
>  obj-$(CONFIG_MACH_WARP7)			+= element14-warp7/
>  obj-$(CONFIG_MACH_WEBASTO_CCBV2)		+= webasto-ccbv2/
>  obj-$(CONFIG_MACH_VF610_TWR)			+= freescale-vf610-twr/
> diff --git a/arch/arm/boards/qemu-virt/Makefile b/arch/arm/boards/qemu-virt/Makefile
> new file mode 100644
> index 0000000000..03def2a918
> --- /dev/null
> +++ b/arch/arm/boards/qemu-virt/Makefile
> @@ -0,0 +1,2 @@
> +lwl-y += lowlevel.o lowlevel_init.o
> +obj-y += board.o
> diff --git a/arch/arm/boards/qemu-virt/board.c b/arch/arm/boards/qemu-virt/board.c
> new file mode 100644
> index 0000000000..e39b104705
> --- /dev/null
> +++ b/arch/arm/boards/qemu-virt/board.c
> @@ -0,0 +1,25 @@
> +// SPDX-License-Identifier: GPL-2.0+

Here you're also using the deprecated identifiers. Please use
GPL-2.0-or-later instead.

> +/*
> + * Copyright (C) 2020 Pengutronix e.K.
> + *
> + */
> +#include <common.h>
> +#include <init.h>
> +#include <asm/armlinux.h>
> +#include <asm/system_info.h>
> +#include <asm/pgtable64.h>
> +#include <mach/devices.h>
> +#include <environment.h>
> +#include <linux/sizes.h>
> +#include <io.h>
> +#include <envfs.h>
> +#include <globalvar.h>
> +#include <asm/mmu.h>
> +
> +static int virt_console_init(void)
> +{
> +	virt_register_uart(0);
> +
> +	return 0;
> +}
> +console_initcall(virt_console_init);
> diff --git a/arch/arm/boards/qemu-virt/lowlevel.c b/arch/arm/boards/qemu-virt/lowlevel.c
> new file mode 100644
> index 0000000000..9024eed5f9
> --- /dev/null
> +++ b/arch/arm/boards/qemu-virt/lowlevel.c
> @@ -0,0 +1,43 @@
> +// SPDX-License-Identifier: GPL-2.0+

here too

> +/*
> + * Copyright (C) 2020 Pengutronix e.K.
> + *
> + */
> +
> +#include <common.h>
> +#include <linux/sizes.h>
> +#include <asm/barebox-arm-head.h>
> +#include <asm/barebox-arm.h>
> +#include <asm/system_info.h>
> +#include <asm/unaligned.h>
> +
> +void qemu_virt_start(uint32_t, uint32_t, uint32_t);
> +
> +static void virt_entry(uint32_t r2) {
> +	void *fdt = NULL;
> +    	unsigned long membase = 0x40000000;
> +	unsigned long memsize = SZ_512M;
> +
> +	if (IS_ENABLED(CONFIG_OFDEVICE) &&
> +	    get_unaligned_be32((void*)r2) == FDT_MAGIC) {
> +		fdt = (void*)r2;
> +		/*
> +		 * Need to move membase a bit as the PBL wants to relocate
> +		 * to the start of RAM, which would overwrite the DTB.
> +		 */
> +	}
> +
> +	barebox_arm_entry(membase, memsize, fdt);
> +}
> +
> +void noinline qemu_virt_start(uint32_t r0, uint32_t r1, uint32_t r2)
> +{
> +	arm_cpu_lowlevel_init();
> +
> +	relocate_to_current_adr();
> +	setup_c();
> +	barrier();
> +
> +	virt_entry(r2);
> +}
> +
> diff --git a/arch/arm/boards/qemu-virt/lowlevel_init.S b/arch/arm/boards/qemu-virt/lowlevel_init.S
> new file mode 100644
> index 0000000000..3558df0591
> --- /dev/null
> +++ b/arch/arm/boards/qemu-virt/lowlevel_init.S
> @@ -0,0 +1,10 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */

and here.

 - Roland

> +
> +/* The DRAM is already setup */
> +#define STACK_TOP 0x50000000
> +
> +.globl barebox_arm_reset_vector
> +barebox_arm_reset_vector:
> +	mov r0, #STACK_TOP
> +	mov sp, r0
> +	b qemu_virt_start
> diff --git a/arch/arm/mach-qemu/Kconfig b/arch/arm/mach-qemu/Kconfig
> index d30bae4c6f..dd3ccd8740 100644
> --- a/arch/arm/mach-qemu/Kconfig
> +++ b/arch/arm/mach-qemu/Kconfig
> @@ -14,5 +14,12 @@ config MACH_QEMU_VIRT64
>  	select ARM_AMBA
>  	select HAVE_CONFIGURABLE_MEMORY_LAYOUT
>  
> +config MACH_QEMU_VIRT
> +	bool "QEMU arm virt machine"
> +	select CPU_V7
> +	select ARM_AMBA
> +	select RELOCATABLE
> +	select ARM_PSCI_CLIENT
> +
>  endchoice
>  endif
> diff --git a/arch/arm/mach-qemu/Makefile b/arch/arm/mach-qemu/Makefile
> index ece277ce0e..8f73aa41a5 100644
> --- a/arch/arm/mach-qemu/Makefile
> +++ b/arch/arm/mach-qemu/Makefile
> @@ -1 +1 @@
> -obj-$(CONFIG_MACH_QEMU_VIRT64) += virt_devices.o
> +obj-$(CONFIG_ARCH_QEMU) += virt_devices.o
> -- 
> 2.28.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-11-04 10:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03 11:49 [PATCH 1/2] ARM: boards: qemu-virt64: use SPDX-License Ids Rouven Czerwinski
2020-11-03 11:49 ` [PATCH 2/2] ARM: qemu: add support for qemu virt platform Rouven Czerwinski
2020-11-04 10:48   ` Roland Hieber
2020-11-04  8:00 ` [PATCH 1/2] ARM: boards: qemu-virt64: use SPDX-License Ids Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox