mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Raphaël Poggi" <poggi.raph@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 12/12] arm: boards: add virt board
Date: Tue, 7 Jun 2016 09:13:05 +0200	[thread overview]
Message-ID: <CACqcpZAzXFB_iDgD1Z09Xow0e=EDxh75FnFxSE37AcTFYLHLng@mail.gmail.com> (raw)
In-Reply-To: <20160603085058.GX31666@pengutronix.de>

Hi,

2016-06-03 10:50 GMT+02:00 Sascha Hauer <s.hauer@pengutronix.de>:
> On Thu, Jun 02, 2016 at 10:06:58AM +0200, Raphael Poggi wrote:
>> Add qemu virt board which emulates arm64 board.
>>
>> Signed-off-by: Raphael Poggi <poggi.raph@gmail.com>
>> ---
>>  arch/arm/Kconfig                           |  9 ++++
>>  arch/arm/boards/Makefile                   |  1 +
>>  arch/arm/boards/virt/Kconfig               |  8 ++++
>>  arch/arm/boards/virt/Makefile              |  1 +
>>  arch/arm/boards/virt/env/bin/_update       | 36 ++++++++++++++++
>>  arch/arm/boards/virt/env/bin/boot          | 38 +++++++++++++++++
>>  arch/arm/boards/virt/env/bin/init          | 20 +++++++++
>>  arch/arm/boards/virt/env/bin/update_kernel |  8 ++++
>>  arch/arm/boards/virt/env/bin/update_root   |  8 ++++
>>  arch/arm/boards/virt/env/config            | 38 +++++++++++++++++
>>  arch/arm/boards/virt/env/init/mtdparts-nor | 11 +++++
>>  arch/arm/boards/virt/init.c                | 67 ++++++++++++++++++++++++++++++
>>  arch/arm/configs/virt_defconfig            | 55 ++++++++++++++++++++++++
>>  arch/arm/mach-virt/Kconfig                 | 15 +++++++
>>  arch/arm/mach-virt/Makefile                |  3 ++
>>  arch/arm/mach-virt/devices.c               | 30 +++++++++++++
>>  arch/arm/mach-virt/include/mach/debug_ll.h | 24 +++++++++++
>>  arch/arm/mach-virt/include/mach/devices.h  | 13 ++++++
>>  arch/arm/mach-virt/lowlevel.c              | 19 +++++++++
>>  arch/arm/mach-virt/reset.c                 | 24 +++++++++++
>>  20 files changed, 428 insertions(+)
>>  create mode 100644 arch/arm/boards/virt/Kconfig
>>  create mode 100644 arch/arm/boards/virt/Makefile
>>  create mode 100644 arch/arm/boards/virt/env/bin/_update
>>  create mode 100644 arch/arm/boards/virt/env/bin/boot
>>  create mode 100644 arch/arm/boards/virt/env/bin/init
>>  create mode 100644 arch/arm/boards/virt/env/bin/update_kernel
>>  create mode 100644 arch/arm/boards/virt/env/bin/update_root
>>  create mode 100644 arch/arm/boards/virt/env/config
>>  create mode 100644 arch/arm/boards/virt/env/init/mtdparts-nor
>>  create mode 100644 arch/arm/boards/virt/init.c
>>  create mode 100644 arch/arm/configs/virt_defconfig
>>  create mode 100644 arch/arm/mach-virt/Kconfig
>>  create mode 100644 arch/arm/mach-virt/Makefile
>>  create mode 100644 arch/arm/mach-virt/devices.c
>>  create mode 100644 arch/arm/mach-virt/include/mach/debug_ll.h
>>  create mode 100644 arch/arm/mach-virt/include/mach/devices.h
>>  create mode 100644 arch/arm/mach-virt/lowlevel.c
>>  create mode 100644 arch/arm/mach-virt/reset.c
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 986fdaa..71b90e7 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -255,6 +255,14 @@ config ARCH_ZYNQ
>>       bool "Xilinx Zynq-based boards"
>>       select HAS_DEBUG_LL
>>
>> +config ARCH_VIRT
>> +     bool "ARM QEMU virt boards"
>> +     select HAS_DEBUG_LL
>> +     select CPU_V8
>> +     select SYS_SUPPORTS_64BIT_KERNEL
>> +     select ARM_AMBA
>> +     select HAVE_CONFIGURABLE_MEMORY_LAYOUT
>
> This should have 64 somewhere in the name to distinguish between 64 and
> 32 bit qemu platforms.

Only in the Kconfig entry or also in the mach/board name (virt64 or
something like that) ?

>
>> +
>>  endchoice
>>
>>  source arch/arm/cpu/Kconfig
>> @@ -280,6 +288,7 @@ source arch/arm/mach-vexpress/Kconfig
>>  source arch/arm/mach-tegra/Kconfig
>>  source arch/arm/mach-uemd/Kconfig
>>  source arch/arm/mach-zynq/Kconfig
>> +source arch/arm/mach-virt/Kconfig
>>
>>  config ARM_ASM_UNIFIED
>>       bool
>> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
>> index 5a755c9..da0af74 100644
>> --- a/arch/arm/boards/Makefile
>> +++ b/arch/arm/boards/Makefile
>> @@ -134,3 +134,4 @@ obj-$(CONFIG_MACH_VIRT2REAL)                      += virt2real/
>>  obj-$(CONFIG_MACH_ZEDBOARD)                  += avnet-zedboard/
>>  obj-$(CONFIG_MACH_ZYLONITE)                  += zylonite/
>>  obj-$(CONFIG_MACH_VARISCITE_MX6)             += variscite-mx6/
>> +obj-$(CONFIG_MACH_VIRT)                      += virt/
>> diff --git a/arch/arm/boards/virt/Kconfig b/arch/arm/boards/virt/Kconfig
>> new file mode 100644
>> index 0000000..b239127
>> --- /dev/null
>> +++ b/arch/arm/boards/virt/Kconfig
>> @@ -0,0 +1,8 @@
>> +
>> +if MACH_VIRT
>> +
>> +config ARCH_TEXT_BASE
>> +     hex
>> +     default 0x40000000
>> +
>> +endif
>> diff --git a/arch/arm/boards/virt/Makefile b/arch/arm/boards/virt/Makefile
>> new file mode 100644
>> index 0000000..eb072c0
>> --- /dev/null
>> +++ b/arch/arm/boards/virt/Makefile
>> @@ -0,0 +1 @@
>> +obj-y += init.o
>> diff --git a/arch/arm/boards/virt/env/bin/_update b/arch/arm/boards/virt/env/bin/_update
>
> Please drop these environment files. New boards for sure should use
> defenv2 and normally for this you don't need any board specific
> environment files.
>
>> diff --git a/arch/arm/boards/virt/init.c b/arch/arm/boards/virt/init.c
>> new file mode 100644
>> index 0000000..9626067
>> --- /dev/null
>> +++ b/arch/arm/boards/virt/init.c
>> @@ -0,0 +1,67 @@
>> +/*
>> + * Copyright (C) 2016 Raphaël Poggi <poggi.raph@gmail.com>
>> + *
>> + * GPLv2 only
>> + */
>> +
>> +#include <common.h>
>> +#include <init.h>
>> +#include <asm/armlinux.h>
>> +#include <asm/system_info.h>
>> +#include <mach/devices.h>
>> +#include <environment.h>
>> +#include <linux/sizes.h>
>> +#include <io.h>
>> +#include <globalvar.h>
>> +#include <asm/mmu.h>
>> +
>> +static int virt_mem_init(void)
>> +{
>> +     virt_add_ddram(SZ_512M);
>> +
>> +     add_cfi_flash_device(0, 0x00000000, SZ_4M, 0);
>> +
>> +     devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self0");
>> +     devfs_add_partition("nor0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env0");
>> +
>> +     return 0;
>> +}
>> +mem_initcall(virt_mem_init);
>> +
>> +static int virt_console_init(void)
>> +{
>> +     virt_register_uart(0);
>> +
>> +     return 0;
>> +}
>> +console_initcall(virt_console_init);
>> +
>> +static int virt_core_init(void)
>> +{
>> +     char *hostname = "virt";
>> +
>> +     if (cpu_is_cortex_a53())
>> +             hostname = "virt-a53";
>> +     else if (cpu_is_cortex_a57())
>> +             hostname = "virt-a57";
>> +
>> +     barebox_set_model("ARM QEMU virt");
>> +     barebox_set_hostname(hostname);
>> +
>> +     return 0;
>> +}
>> +postcore_initcall(virt_core_init);
>> +
>> +static int virt_mmu_enable(void)
>> +{
>> +     /* Mapping all periph range */
>> +     arch_remap_range(0x09000000, 0x01000000, PMD_SECT_DEF_CACHED);
>> +
>> +     /* Mapping all flash range */
>> +     arch_remap_range(0x00000000, 0x08000000, PMD_SECT_DEF_CACHED);
>
> Hm, mapping the peripherals and the flash cached? This seems wrong.
> Either the mapping does not work or your periphals do not work ;)

You are right, in fact I figure out that qemu does not handle
instruction or data cache, that's why it was working...

>
>> +
>> +     mmu_enable();
>> +
>> +     return 0;
>> +}
>> +postmmu_initcall(virt_mmu_enable);
>> diff --git a/arch/arm/mach-virt/reset.c b/arch/arm/mach-virt/reset.c
>> new file mode 100644
>> index 0000000..fb895eb
>> --- /dev/null
>> +++ b/arch/arm/mach-virt/reset.c
>> @@ -0,0 +1,24 @@
>> +/*
>> + * Copyright (C) 2016 Raphaël Poggi <poggi.raph@gmail.com>
>> + *
>> + * GPLv2 only
>> + */
>> +
>> +#include <common.h>
>> +#include <io.h>
>> +#include <init.h>
>> +#include <restart.h>
>> +#include <mach/devices.h>
>> +
>> +static void virt_reset_soc(struct restart_handler *rst)
>> +{
>> +     hang();
>> +}
>> +
>> +static int restart_register_feature(void)
>> +{
>> +     restart_handler_register_fn(virt_reset_soc);
>> +
>> +     return 0;
>> +}
>> +coredevice_initcall(restart_register_feature);
>
> You can drop this. When no restart_handler is registered then hang() is
> the default behaviour anyway.
>
> Sascha
>
> --
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 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

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

  reply	other threads:[~2016-06-07  7:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02  8:06 [PATCH 0/12] Add basic support for arm64 Raphael Poggi
2016-06-02  8:06 ` [PATCH 01/12] arm: add armv8 Kconfig entries Raphael Poggi
2016-06-02  8:06 ` [PATCH 02/12] arm: Makefile: rework makefile to handle armv8 Raphael Poggi
2016-06-03  7:27   ` Sascha Hauer
2016-06-03  7:33     ` Raphaël Poggi
2016-06-02  8:06 ` [PATCH 03/12] arm: introduce lib64 for arm64 related stuff Raphael Poggi
2016-06-03  8:01   ` Sascha Hauer
2016-06-02  8:06 ` [PATCH 04/12] arm: cpu: add arm64 specific code Raphael Poggi
2016-06-03  8:07   ` Sascha Hauer
2016-06-02  8:06 ` [PATCH 05/12] arm: include: system: add arm64 helper functions Raphael Poggi
2016-06-02  8:06 ` [PATCH 06/12] arm: cpu: start: arm64 does not support relocation Raphael Poggi
2016-06-02  8:06 ` [PATCH 07/12] arm: include: bitops: arm64 use generic __fls Raphael Poggi
2016-06-02  8:06 ` [PATCH 08/12] arm: include: system_info: add armv8 identification Raphael Poggi
2016-06-02  8:06 ` [PATCH 09/12] arm: cpu: cpuinfo: add armv8 support Raphael Poggi
2016-06-02  8:06 ` [PATCH 10/12] arm: cpu: disable code portion in armv8 case Raphael Poggi
2016-06-02  8:06 ` [PATCH 11/12] arm: cpu: add basic arm64 mmu support Raphael Poggi
2016-06-03  8:30   ` Sascha Hauer
2016-06-02  8:06 ` [PATCH 12/12] arm: boards: add virt board Raphael Poggi
2016-06-03  8:50   ` Sascha Hauer
2016-06-07  7:13     ` Raphaël Poggi [this message]
2016-06-07 11:00   ` Antony Pavlov
2016-06-07 11:53     ` Raphaël Poggi
2016-06-07 12:59       ` Antony Pavlov
2016-06-07 13:16         ` Raphaël Poggi
2016-06-03  9:16 ` [PATCH 0/12] Add basic support for arm64 Sascha Hauer
2016-06-03  9:25   ` Raphaël Poggi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACqcpZAzXFB_iDgD1Z09Xow0e=EDxh75FnFxSE37AcTFYLHLng@mail.gmail.com' \
    --to=poggi.raph@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox