{"id":815816,"url":"http://patchwork.ozlabs.org/api/patches/815816/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20170919201808.11433-6-tuomas.tynkkynen@iki.fi/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170919201808.11433-6-tuomas.tynkkynen@iki.fi>","list_archive_url":null,"date":"2017-09-19T20:18:07","name":"[U-Boot,v2,5/6] ARM: Add a new arch + board for QEMU's 'virt' machine","commit_ref":"32f11829266f2ede9afac051f980d4ae9b52f963","pull_url":null,"state":"accepted","archived":false,"hash":"95f9b6723c8006101b88891557bbb3afdb62f7b2","submitter":{"id":32296,"url":"http://patchwork.ozlabs.org/api/people/32296/?format=json","name":"Tuomas Tynkkynen","email":"tuomas.tynkkynen@iki.fi"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170919201808.11433-6-tuomas.tynkkynen@iki.fi/mbox/","series":[{"id":3961,"url":"http://patchwork.ozlabs.org/api/series/3961/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=3961","date":"2017-09-19T20:18:02","name":"Board for QEMU's '-machine virt' on ARM","version":2,"mbox":"http://patchwork.ozlabs.org/series/3961/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/815816/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/815816/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ID6ZG1D4\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxZ5z0t89z9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 20 Sep 2017 06:21:43 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid DCBA4C21DC1; Tue, 19 Sep 2017 20:19:38 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 50B57C21DD0;\n\tTue, 19 Sep 2017 20:18:49 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid DD05AC21DD0; Tue, 19 Sep 2017 20:18:34 +0000 (UTC)","from mail-lf0-f68.google.com (mail-lf0-f68.google.com\n\t[209.85.215.68])\n\tby lists.denx.de (Postfix) with ESMTPS id 6E509C21DA2\n\tfor <u-boot@lists.denx.de>; Tue, 19 Sep 2017 20:18:30 +0000 (UTC)","by mail-lf0-f68.google.com with SMTP id m199so347027lfe.5\n\tfor <u-boot@lists.denx.de>; Tue, 19 Sep 2017 13:18:30 -0700 (PDT)","from localhost.localdomain (85-76-68-181-nat.elisa-mobile.fi.\n\t[85.76.68.181]) by smtp.gmail.com with ESMTPSA id\n\ta197sm21154lfe.95.2017.09.19.13.18.28\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 19 Sep 2017 13:18:28 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=2hCyi0G2GCDqYcJP72S2Sw7HeniNhWvsojSzlaxN+os=;\n\tb=ID6ZG1D4mhG2yXcFARE0KnKT5BRwqHfy646D+IGbQCK5HCV/kd9ObCQZTDarAQDWcF\n\tT4CztgSdAyJryQHjXl4vjL756GtLbvAJbZqMfMLY+7m9+4/DB9ckLn8Q9K+X7L5TwiEo\n\tyzoXYKs7chOonX12LdrpmKB+YE09Ddeq9YgBAWDIvBR3oQ8v/3Pee9gxjRsiFTsV5lGP\n\tWCIORQe+WW7QTq9qE+aaD1dB16E+npHBnqgmrslulJZJkp7Rr0xpRE0rrsKuE2p4/qYI\n\tm0PRdCjqXPX7MR5ZzpgT35bs2s+1GWIEVenVcV4APgYu2QKbAi6whXl7RjyHOPlJgTCN\n\tQlJw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=2hCyi0G2GCDqYcJP72S2Sw7HeniNhWvsojSzlaxN+os=;\n\tb=W3UNH389PWZrKKqxmm/+gOSEXIdbDjqvV2m+sA1nyEw92ab/WpCG55pJ2AMl5JVwwb\n\tIlHRNk95PT1l/P+hHDWGLYEDcMSljNRSJUPPJj+UmFUd2cuF/VkGKgb7C1BRvbo/bpvQ\n\tWK9QRBPwXcnNUTNCDHCk9wb9WvE8eA3SwnY3H/UhiIdNf59z/JS9OJXhbuM6r0TOVNYi\n\tZtmWC5FnvNN7p8y6qh/HxdzCtm91dnsaX94Gd1BnKSotp/DHDP7GT60AeMqnDdowvep7\n\t1PdAynH/tl7eNjYucKvS8TdK7ef8MuacTszQO+ZRSd2Fs3UxnpGqQwmpTtw7ogSCIan5\n\thARQ==","X-Gm-Message-State":"AHPjjUiOwW1+WxTGbKu+QdVmnAOrUhNTnGSXTBzBovL7j8UZBuuq5uO8\n\ttIPfTmJWVVCIHCrSHgRhDKa7gg==","X-Google-Smtp-Source":"AOwi7QDu7C1vCAI9VND9kWSWnpi1HJt0x2Bvp/nPnENxJ3TcYafwZCg0QCtUES6H3o8MrYkzYud5VQ==","X-Received":"by 10.25.79.8 with SMTP id d8mr966602lfb.118.1505852309562;\n\tTue, 19 Sep 2017 13:18:29 -0700 (PDT)","From":"Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>","To":"u-boot@lists.denx.de","Date":"Tue, 19 Sep 2017 23:18:07 +0300","Message-Id":"<20170919201808.11433-6-tuomas.tynkkynen@iki.fi>","X-Mailer":"git-send-email 2.13.0","In-Reply-To":"<20170919201808.11433-1-tuomas.tynkkynen@iki.fi>","References":"<20170919201808.11433-1-tuomas.tynkkynen@iki.fi>","Cc":"Tom Rini <trini@konsulko.com>","Subject":"[U-Boot] [PATCH v2 5/6] ARM: Add a new arch + board for QEMU's\n\t'virt' machine","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"This board builds an U-Boot binary that is bootable with QEMU's 'virt'\nmachine on ARM. The minimal QEMU command line is:\n\n    qemu-system-arm -machine virt,highmem=off -bios u-boot.bin\n\n(Note that the 'highmem=off' parameter to the 'virt' machine is required for\nPCI to work in U-Boot.) This command line enables the following:\n    - u-boot.bin loaded and executing in the emulated flash at address 0x0\n    - A generated device tree blob placed at the start of RAM\n    - A freely configurable amount of RAM, described by the DTB\n    - A PL011 serial port, discoverable via the DTB\n    - An ARMv7 architected timer\n    - PSCI for rebooting the system\n    - A generic ECAM-based PCI host controller, discoverable via the DTB\n\nAdditionally, QEMU allows plugging a bunch of useful peripherals to the PCI bus.\nThe following ones are supported by both U-Boot and Linux:\n\n- To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.:\n    -drive if=none,file=disk.img,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0\n- To add an Intel E1000 network adapter, pass e.g.:\n    -net nic,model=e1000 -net user\n- To add an EHCI-compliant USB host controller, pass e.g.:\n    -device usb-ehci,id=ehci\n- To add a NVMe disk, pass e.g.:\n    -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo\n\nSigned-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>\n---\nv2:\n- enable CONFIG_NVME\n- alphasort correctly\n- remove unnecessary gd declaration\n- move board under board/emulation\n- add MAINTAINERS\n---\n arch/arm/Kconfig                     | 10 +++++++\n arch/arm/mach-qemu/Kconfig           | 12 ++++++++\n board/emulation/qemu-arm/MAINTAINERS |  6 ++++\n board/emulation/qemu-arm/Makefile    |  5 ++++\n board/emulation/qemu-arm/qemu-arm.c  | 33 ++++++++++++++++++++\n configs/qemu_arm_defconfig           | 28 +++++++++++++++++\n include/configs/qemu-arm.h           | 58 ++++++++++++++++++++++++++++++++++++\n 7 files changed, 152 insertions(+)\n create mode 100644 arch/arm/mach-qemu/Kconfig\n create mode 100644 board/emulation/qemu-arm/MAINTAINERS\n create mode 100644 board/emulation/qemu-arm/Makefile\n create mode 100644 board/emulation/qemu-arm/qemu-arm.c\n create mode 100644 configs/qemu_arm_defconfig\n create mode 100644 include/configs/qemu-arm.h","diff":"diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig\nindex 53eae8953e..1de5be7a72 100644\n--- a/arch/arm/Kconfig\n+++ b/arch/arm/Kconfig\n@@ -630,6 +630,14 @@ config ARCH_MX5\n \tselect CPU_V7\n \tselect BOARD_EARLY_INIT_F\n \n+config ARCH_QEMU\n+\tbool \"QEMU Virtual Platform\"\n+\tselect CPU_V7\n+\tselect ARCH_SUPPORT_PSCI\n+\tselect DM\n+\tselect DM_SERIAL\n+\tselect OF_CONTROL\n+\n config ARCH_RMOBILE\n \tbool \"Renesas ARM SoCs\"\n \tselect DM\n@@ -1142,6 +1150,8 @@ source \"arch/arm/mach-rmobile/Kconfig\"\n \n source \"arch/arm/mach-meson/Kconfig\"\n \n+source \"arch/arm/mach-qemu/Kconfig\"\n+\n source \"arch/arm/mach-rockchip/Kconfig\"\n \n source \"arch/arm/mach-s5pc1xx/Kconfig\"\ndiff --git a/arch/arm/mach-qemu/Kconfig b/arch/arm/mach-qemu/Kconfig\nnew file mode 100644\nindex 0000000000..3500b56cb0\n--- /dev/null\n+++ b/arch/arm/mach-qemu/Kconfig\n@@ -0,0 +1,12 @@\n+if ARCH_QEMU\n+\n+config SYS_VENDOR\n+\tdefault \"emulation\"\n+\n+config SYS_BOARD\n+\tdefault \"qemu-arm\"\n+\n+config SYS_CONFIG_NAME\n+\tdefault \"qemu-arm\"\n+\n+endif\ndiff --git a/board/emulation/qemu-arm/MAINTAINERS b/board/emulation/qemu-arm/MAINTAINERS\nnew file mode 100644\nindex 0000000000..a803061ff4\n--- /dev/null\n+++ b/board/emulation/qemu-arm/MAINTAINERS\n@@ -0,0 +1,6 @@\n+QEMU ARM 'VIRT' BOARD\n+M:\tTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>\n+S:\tMaintained\n+F:\tboard/emulation/qemu-arm/\n+F:\tinclude/configs/qemu-arm.h\n+F:\tconfigs/qemu_arm_defconfig\ndiff --git a/board/emulation/qemu-arm/Makefile b/board/emulation/qemu-arm/Makefile\nnew file mode 100644\nindex 0000000000..716a6e9c28\n--- /dev/null\n+++ b/board/emulation/qemu-arm/Makefile\n@@ -0,0 +1,5 @@\n+#\n+# SPDX-License-Identifier:\tGPL-2.0+\n+#\n+\n+obj-y\t+= qemu-arm.o\ndiff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c\nnew file mode 100644\nindex 0000000000..e29ba4630f\n--- /dev/null\n+++ b/board/emulation/qemu-arm/qemu-arm.c\n@@ -0,0 +1,33 @@\n+/*\n+ * Copyright (c) 2017 Tuomas Tynkkynen\n+ *\n+ * SPDX-License-Identifier:\tGPL-2.0+\n+ */\n+#include <common.h>\n+#include <fdtdec.h>\n+\n+int board_init(void)\n+{\n+\treturn 0;\n+}\n+\n+int dram_init(void)\n+{\n+\tif (fdtdec_setup_memory_size() != 0)\n+\t\treturn -EINVAL;\n+\n+\treturn 0;\n+}\n+\n+int dram_init_banksize(void)\n+{\n+\tfdtdec_setup_memory_banksize();\n+\n+\treturn 0;\n+}\n+\n+void *board_fdt_blob_setup(void)\n+{\n+\t/* QEMU loads a generated DTB for us at the start of RAM. */\n+\treturn (void *)CONFIG_SYS_SDRAM_BASE;\n+}\ndiff --git a/configs/qemu_arm_defconfig b/configs/qemu_arm_defconfig\nnew file mode 100644\nindex 0000000000..2a8594d472\n--- /dev/null\n+++ b/configs/qemu_arm_defconfig\n@@ -0,0 +1,28 @@\n+CONFIG_ARM=y\n+CONFIG_ARM_SMCCC=y\n+CONFIG_ARCH_QEMU=y\n+CONFIG_AHCI=y\n+CONFIG_DISTRO_DEFAULTS=y\n+# CONFIG_DISPLAY_CPUINFO is not set\n+# CONFIG_DISPLAY_BOARDINFO is not set\n+# CONFIG_CMD_IMLS is not set\n+CONFIG_CMD_PCI=y\n+CONFIG_CMD_USB=y\n+CONFIG_OF_BOARD=y\n+CONFIG_AHCI_PCI=y\n+CONFIG_BLK=y\n+# CONFIG_MMC is not set\n+CONFIG_DM_ETH=y\n+CONFIG_E1000=y\n+CONFIG_NVME=y\n+CONFIG_PCI=y\n+CONFIG_DM_PCI=y\n+CONFIG_PCIE_ECAM_GENERIC=y\n+CONFIG_SCSI=y\n+CONFIG_DM_SCSI=y\n+CONFIG_SYSRESET=y\n+CONFIG_SYSRESET_PSCI=y\n+CONFIG_USB=y\n+CONFIG_DM_USB=y\n+CONFIG_USB_EHCI_HCD=y\n+CONFIG_USB_EHCI_PCI=y\ndiff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h\nnew file mode 100644\nindex 0000000000..4376a24787\n--- /dev/null\n+++ b/include/configs/qemu-arm.h\n@@ -0,0 +1,58 @@\n+/*\n+ * Copyright (c) 2017 Tuomas Tynkkynen\n+ *\n+ * SPDX-License-Identifier:\tGPL-2.0+\n+ */\n+\n+#ifndef __CONFIG_H\n+#define __CONFIG_H\n+\n+#include <linux/sizes.h>\n+\n+/* Physical memory map */\n+#define CONFIG_SYS_TEXT_BASE\t\t0x00000000\n+\n+#define CONFIG_NR_DRAM_BANKS\t\t1\n+#define CONFIG_SYS_SDRAM_BASE\t\t0x40000000\n+\n+/* The DTB generated by QEMU is placed at start of RAM, stay away from there */\n+#define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SYS_SDRAM_BASE + SZ_2M)\n+#define CONFIG_SYS_LOAD_ADDR\t\t(CONFIG_SYS_SDRAM_BASE + SZ_2M)\n+#define CONFIG_SYS_MALLOC_LEN\t\tSZ_16M\n+\n+/* QEMU's PL011 serial port is detected via FDT using the device model */\n+#define CONFIG_PL01X_SERIAL\n+\n+/* QEMU implements a 62.5MHz architected timer */\n+/* FIXME: can we rely on CNTFREQ instead of hardcoding this fact here? */\n+#define CONFIG_SYS_ARCH_TIMER\n+#define CONFIG_SYS_HZ                       1000\n+#define CONFIG_SYS_HZ_CLOCK                 62500000\n+\n+/* For block devices, QEMU emulates an ICH9 AHCI controller over PCI */\n+#define CONFIG_SYS_SCSI_MAX_SCSI_ID 6\n+#define CONFIG_SCSI_AHCI\n+#define CONFIG_LIBATA\n+\n+/* Environment options */\n+#define CONFIG_ENV_SIZE\t\t\t\tSZ_64K\n+\n+#include <config_distro_defaults.h>\n+\n+#define BOOT_TARGET_DEVICES(func) \\\n+\tfunc(SCSI, scsi, 0)\n+\n+#include <config_distro_bootcmd.h>\n+\n+#define CONFIG_PREBOOT \"pci enum\"\n+#define CONFIG_EXTRA_ENV_SETTINGS \\\n+\t\"fdt_high=0xffffffff\\0\" \\\n+\t\"initrd_high=0xffffffff\\0\" \\\n+\t\"fdt_addr=0x40000000\\0\" \\\n+\t\"scriptaddr=0x40200000\\0\" \\\n+\t\"pxefile_addr_r=0x40300000\\0\" \\\n+\t\"kernel_addr_r=0x40400000\\0\" \\\n+\t\"ramdisk_addr_r=0x44000000\\0\" \\\n+\tBOOTENV\n+\n+#endif /* __CONFIG_H */\n","prefixes":["U-Boot","v2","5/6"]}