{"id":2222653,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2222653/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260413092240.3719260-7-daniel@thingy.jp/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.1/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},"msgid":"<20260413092240.3719260-7-daniel@thingy.jp>","date":"2026-04-13T09:22:40","name":"[v4,6/6] board: qemu: m68k: Create virtio mmio instances","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"24c8489226d0328f87aee3a0e6ecf27e3332bc63","submitter":{"id":85408,"url":"http://patchwork.ozlabs.org/api/1.1/people/85408/?format=json","name":"Daniel Palmer","email":"daniel@thingy.jp"},"delegate":{"id":14103,"url":"http://patchwork.ozlabs.org/api/1.1/users/14103/?format=json","username":"spectrum","first_name":"Angelo","last_name":"Dureghello","email":"sysamfw@gmail.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260413092240.3719260-7-daniel@thingy.jp/mbox/","series":[{"id":499674,"url":"http://patchwork.ozlabs.org/api/1.1/series/499674/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=499674","date":"2026-04-13T09:22:34","name":"Add virtio-mmio support to m68k virt machine","version":4,"mbox":"http://patchwork.ozlabs.org/series/499674/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2222653/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2222653/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=thingy.jp header.i=@thingy.jp header.a=rsa-sha256\n header.s=google header.b=cq47j6n1;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=thingy.jp","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=thingy.jp header.i=@thingy.jp header.b=\"cq47j6n1\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=thingy.jp","phobos.denx.de; spf=pass smtp.mailfrom=daniel@0x0f.com"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvMRR25s7z1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 19:24:03 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 7CA7B84201;\n\tMon, 13 Apr 2026 11:23:26 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id C2514841CD; Mon, 13 Apr 2026 11:23:24 +0200 (CEST)","from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com\n [IPv6:2607:f8b0:4864:20::102d])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 4964E836AC\n for <u-boot@lists.denx.de>; Mon, 13 Apr 2026 11:23:20 +0200 (CEST)","by mail-pj1-x102d.google.com with SMTP id\n 98e67ed59e1d1-35da1af3e10so4217607a91.3\n for <u-boot@lists.denx.de>; Mon, 13 Apr 2026 02:23:20 -0700 (PDT)","from kinako ([2400:2200:776:9b18:a191:7a74:9fd8:591b])\n by smtp.googlemail.com with ESMTPSA id\n 98e67ed59e1d1-35fb617725esm1055930a91.1.2026.04.13.02.23.15\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 13 Apr 2026 02:23:18 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no\n autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=thingy.jp; s=google; t=1776072199; x=1776676999; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=vvffEMejxyaQs4cvL62eu2mn+EsjXjaofemNueGsB/U=;\n b=cq47j6n1DMeulPCWJJOHrF4uJRJWWF6MXpaXUyoOAyX2+crFakM6O3eraUUEL5QQ50\n votsThCvgR7jZG0i+qAeC658A7HNduPdI3zTu1GojdpqZqVkvU4lwGb4U0YZV6CpTE9I\n 4QwM3yq2a0eV2c+H9WT8K/DR8w91AG7/W1L0Q=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776072199; x=1776676999;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=vvffEMejxyaQs4cvL62eu2mn+EsjXjaofemNueGsB/U=;\n b=R/v7uD1nkYvzWuwcz54eK0BPvO2AX001yKI1d+QvFxPO2qEk9jkFar0qxfGToGWZjS\n NEryCy2pKH2JQ3o9nFqJxEXJR8+Q2Flkolwtmyu0dAV+RYQkIl/pYZB8MVEln9DKoeDM\n MaWcsQirjP1PmvYVLox9DQSnfdvlvunTlFiHnegBLtvWjToTLRowdiED+21MtowrjE/W\n mjUrflRPcWmZEIKisVUaTnx6vW0VbP4bL4XSII0nF4oAj4VLqRVWM+2gpf3wPPBLNaH1\n vkVFMnsUaB+tha8ZWSI7R+Nftg/Qg2Z8pIltwl8mT2VFzsbVwC9u0EHPTTlblQZ0pQOJ\n sBGg==","X-Forwarded-Encrypted":"i=1;\n AFNElJ/GjKu4xnEPHzzbZIIMEgk9vDjr3T/OopFiDKCV73j0b3iBe+S9T9oMAmOioVX1+8ILjQeAFhM=@lists.denx.de","X-Gm-Message-State":"AOJu0YwPKaQg2VNj/J9S0oRvLhls5TqnzWAFvRc/9xpEi9IoPm5Ry7cf\n Rh9DpOwp9wR8vDatKrBqL9ZbS7rkLlUqZfOr3aofBQYsFJWY1uDVI1Kx4QcN3EWLblw=","X-Gm-Gg":"AeBDiev1Hm4k6jPVOAsTk+whNIHEYi8W6wSLovetMQXSncnlEnHnlz7zeIM4C32H6zd\n bqhE1qOiHFSIsZeX2ByMUp5F/WRTd1SdzPtmCvRdXPZMMtO41LrIUq/29CQ9T6L1LgwCYM6N88k\n wqXGDCw9QinB+Iu0MeX4I3OG06yc4PMXkvTVuFQh6ttfZ9BglXT0lZsj7iBJnGVCe1wg3tpU0o7\n YOlVUj1HI9SFkqoLi/1gOUYOKZDvhbEN/bKFkyauNYFDS3Vqmwsh0QrwYcxEoCBR3p6/CQiaL5G\n 5bvEY7FWPceh+LohyI7thrDZv3OaZ8NPChdMtcGbDaSj5PIHe2QbBG16IGxGYS+B7g7nw6YFWWU\n rP3gs0O4iYdnGOIZ+UfvCIZcp4rUdQao3ls3OkIR/+4zXljk19BKtm/mUNLJ/1ywgGiBs/ooAxO\n INJLfu60huv0+VGA==","X-Received":"by 2002:a17:90b:3d48:b0:35d:93ff:284f with SMTP id\n 98e67ed59e1d1-35e4282bdabmr12959241a91.15.1776072198672;\n Mon, 13 Apr 2026 02:23:18 -0700 (PDT)","From":"Daniel Palmer <daniel@thingy.jp>","To":"visitorckw@gmail.com,\n\tangelo@kernel-space.org,\n\tbmeng.cn@gmail.com","Cc":"sjg@chromium.org, u-boot@lists.denx.de, Daniel Palmer <daniel@thingy.jp>","Subject":"[PATCH v4 6/6] board: qemu: m68k: Create virtio mmio instances","Date":"Mon, 13 Apr 2026 18:22:40 +0900","Message-ID":"<20260413092240.3719260-7-daniel@thingy.jp>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20260413092240.3719260-1-daniel@thingy.jp>","References":"<20260413092240.3719260-1-daniel@thingy.jp>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://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 <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"So that you can use virtio network, block etc create the virtio mmio\ninstances. There are 128 of these even if they are not all used, a\nsingle mmio base value is passed via bootinfo.\n\nSigned-off-by: Daniel Palmer <daniel@thingy.jp>\n---\n arch/m68k/Kconfig                     | 14 +++++----\n board/emulation/qemu-m68k/qemu-m68k.c | 45 +++++++++++++++++++++++++++\n 2 files changed, 53 insertions(+), 6 deletions(-)","diff":"diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig\nindex 6ce8f577e3a1..20a112880c87 100644\n--- a/arch/m68k/Kconfig\n+++ b/arch/m68k/Kconfig\n@@ -195,12 +195,14 @@ config TARGET_STMARK2\n         select M54418\n \n config TARGET_QEMU_M68K\n-    bool \"Support QEMU m68k virt\"\n-    select M68040\n-    imply CMD_DM\n-    help\n-      This target supports the QEMU m68k virtual machine (-M virt).\n-      It simulates a Motorola 68040 CPU with Goldfish peripherals.\n+\tbool \"Support QEMU m68k virt\"\n+\tselect M68040\n+\tselect BOARD_EARLY_INIT_R\n+\tselect VIRTIO_MMIO\n+\timply CMD_DM\n+\thelp\n+\t  This target supports the QEMU m68k virtual machine (-M virt).\n+\t  It simulates a Motorola 68040 CPU with Goldfish peripherals.\n \n endchoice\n \ndiff --git a/board/emulation/qemu-m68k/qemu-m68k.c b/board/emulation/qemu-m68k/qemu-m68k.c\nindex d3527aee1128..a19b23a28ce3 100644\n--- a/board/emulation/qemu-m68k/qemu-m68k.c\n+++ b/board/emulation/qemu-m68k/qemu-m68k.c\n@@ -14,9 +14,14 @@\n #include <asm/bootinfo.h>\n #include <asm/global_data.h>\n #include <asm/io.h>\n+#include <dm.h>\n+#include <dm/device-internal.h>\n+#include <dm/lists.h>\n #include <dm/platdata.h>\n+#include <dm/root.h>\n #include <linux/errno.h>\n #include <linux/sizes.h>\n+#include <virtio_mmio.h>\n \n DECLARE_GLOBAL_DATA_PTR;\n \n@@ -25,6 +30,38 @@ static struct goldfish_rtc_plat rtc_plat;\n static struct goldfish_timer_plat timer_plat;\n static struct qemu_virt_ctrl_plat reset_plat;\n \n+#define VIRTIO_MMIO_NUM\t128\n+#define VIRTIO_MMIO_SZ\t0x200\n+\n+static struct virtio_mmio_plat virtio_mmio_plat[VIRTIO_MMIO_NUM];\n+static char virtio_mmio_names[VIRTIO_MMIO_NUM][11];\n+static phys_addr_t virtio_mmio_base;\n+\n+static int create_virtio_mmios(void)\n+{\n+\tstruct driver *drv;\n+\tint i, ret;\n+\n+\tif (!virtio_mmio_base)\n+\t\treturn -ENODEV;\n+\n+\tdrv = lists_driver_lookup_name(\"virtio-mmio\");\n+\tif (!drv)\n+\t\treturn -ENOENT;\n+\n+\tfor (i = 0; i < VIRTIO_MMIO_NUM; i++) {\n+\t\tvirtio_mmio_plat[i].base = virtio_mmio_base + (VIRTIO_MMIO_SZ * i);\n+\t\tsprintf(virtio_mmio_names[i], \"virtio-%d\", i);\n+\n+\t\tret = device_bind(dm_root(), drv, virtio_mmio_names[i],\n+\t\t\t\t  &virtio_mmio_plat[i], ofnode_null(), NULL);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n /*\n  * Theoretical limit derivation:\n  * Max Bootinfo Size (Standard Page) = 4096 bytes\n@@ -65,6 +102,9 @@ static void parse_bootinfo(void)\n \t\tcase BI_VIRT_CTRL_BASE:\n \t\t\treset_plat.reg = base;\n \t\t\tbreak;\n+\t\tcase BI_VIRT_VIRTIO_BASE:\n+\t\t\tvirtio_mmio_base = base;\n+\t\t\tbreak;\n \t\tcase BI_MEMCHUNK:\n \t\t\tgd->ram_size = record->data[1];\n \t\t\tbreak;\n@@ -80,6 +120,11 @@ int board_early_init_f(void)\n \treturn 0;\n }\n \n+int board_early_init_r(void)\n+{\n+\treturn create_virtio_mmios();\n+}\n+\n int checkboard(void)\n {\n \tputs(\"Board: QEMU m68k virt\\n\");\n","prefixes":["v4","6/6"]}