{"id":2222650,"url":"http://patchwork.ozlabs.org/api/patches/2222650/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260413092240.3719260-4-daniel@thingy.jp/","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":"<20260413092240.3719260-4-daniel@thingy.jp>","list_archive_url":null,"date":"2026-04-13T09:22:37","name":"[v4,3/6] virtio: mmio: Allow instantiation via platform data","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"0c6becc94633c915f3ad9a5859426ccd2867d65b","submitter":{"id":85408,"url":"http://patchwork.ozlabs.org/api/people/85408/?format=json","name":"Daniel Palmer","email":"daniel@thingy.jp"},"delegate":{"id":14103,"url":"http://patchwork.ozlabs.org/api/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-4-daniel@thingy.jp/mbox/","series":[{"id":499674,"url":"http://patchwork.ozlabs.org/api/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/2222650/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2222650/checks/","tags":{},"related":[],"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=dytH0SdH;\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=\"dytH0SdH\";\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 4fvMQt1JZJz1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 19:23:34 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 496B9841D7;\n\tMon, 13 Apr 2026 11:23:12 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 464748419C; Mon, 13 Apr 2026 11:23:11 +0200 (CEST)","from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com\n [IPv6:2607:f8b0:4864:20::1029])\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 08D93841CD\n for <u-boot@lists.denx.de>; Mon, 13 Apr 2026 11:23:09 +0200 (CEST)","by mail-pj1-x1029.google.com with SMTP id\n 98e67ed59e1d1-35da9692ec3so3989843a91.1\n for <u-boot@lists.denx.de>; Mon, 13 Apr 2026 02:23:08 -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.03\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 13 Apr 2026 02:23:07 -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=1776072187; x=1776676987; 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=rkfdQl5o/95RN5trxCmFHCvaQaWp54iAYT6nSL+SCRg=;\n b=dytH0SdHyugleUR07CgvdNm0CpRqjSX9LHykqdLZ/TVdqgD9NXUUZpCV67ErxwvJkB\n Nnpkq3kBb5ika0eBaOyreB4SNF5Extk6w+10nRLK7+Ei0VVwV++rECjU3idQGpT/uQmb\n WCoqM7/T+e57ASsyN3EbMqbYHUN52OOlL6bow=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776072187; x=1776676987;\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=rkfdQl5o/95RN5trxCmFHCvaQaWp54iAYT6nSL+SCRg=;\n b=lEzDEUK2A2hJX3sUmzw1OWnXatRiKLVXszmI/attlXojAKFu/lJ9bbgexsNicXytUd\n vdZAsETMJ/4olCXD6LR8zCTqrLGkxrV5/q+kTrQQ3hlW8FEvkKqFWktBWpuP96A6wjaW\n h8IvMzk8kV73sE64D76KjQTR4/O3LBoEiPcWIYX8DaFxPz4MontEdI7x7HmvRra1OQXG\n HtR3sG4JJ4JQ051VLmKdwCIkdmzTwpdwaWTmzhZHb3tVpJRAlDGvGerj0L0rNkRElTs0\n QxqZ1uEOCyXzoXl+yOtFNylh/PffAwQ8iy19Ms/ZDRrL6zDOVknKnBcGUHy6kTrfNrNS\n JjRA==","X-Forwarded-Encrypted":"i=1;\n AFNElJ+nU3sN0+kNn1YbXhiXvzKyNzeKdJRMY2A+MtOFPkvq3QVQneiROqiEpO5iYmJ3SLI5rel0+eY=@lists.denx.de","X-Gm-Message-State":"AOJu0YwXLSHz31Zq3AOFw61Q2p+7dN2rdESUVin/BuaEq/fhnnVqp03N\n L8nL46e4rlcem+z9wP3QUqhJwsLF+JEN1NUfftIZ+iYUIW4WLPzimSBra9xb15oQcdc=","X-Gm-Gg":"AeBDiev3EkvyBVr2fwlDYPi/379YUs8SwuqmJjTxDfQUo4Qyj53o1I9K2snJnoNzRMA\n icSNWIrCOHmzIvBBAcPbRyGK/ROct+EcPgWWcgUNEC3MXvDguns2aA9XyBCJYDJJ8h7DlS+f14j\n x4T2fjbfloImzX77jwluvJaSWKMv+hlwimMLxdhaIdhSGvo9J7sun4+YdkCA9K2n/HeSfYRk07q\n LTPzxJAWnlwwN0SYUfSN+k5b+Y9x748JQVy/OVJ9Cwcd5aY4RLc6jrqqq8PIprt9XEAlN/UcmEH\n He7/z3fZo7h6HZxsqpPZJ1g5AUV/QxjPpB9knE/7z5ZxbY3nBHdFK0OrwIYysFhazvorfuInAZq\n I7fXZQYet/wpELcSO4V/AO20j5FrzYai35QWjTYVgt3NnEwWlBlya7pcKSBYIl3EuLhXBrSzJfS\n SWcSGZx3YhWW7BYA==","X-Received":"by 2002:a17:90b:5625:b0:359:f43d:4a6e with SMTP id\n 98e67ed59e1d1-35e424548aamr14816401a91.0.1776072187530;\n Mon, 13 Apr 2026 02:23:07 -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 3/6] virtio: mmio: Allow instantiation via platform data","Date":"Mon, 13 Apr 2026 18:22:37 +0900","Message-ID":"<20260413092240.3719260-4-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":"The m68k QEMU virt machine doesn't use devicetree, yet, so\nallow it to create virtio-mmio instances via platform data.\n\nSigned-off-by: Daniel Palmer <daniel@thingy.jp>\nReviewed-by: Simon Glass <sjg@chromium.org>\n---\n drivers/virtio/virtio_mmio.c | 27 ++++++++++++++++++---------\n include/virtio_mmio.h        | 12 ++++++++++++\n 2 files changed, 30 insertions(+), 9 deletions(-)\n create mode 100644 include/virtio_mmio.h","diff":"diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c\nindex 1cd737aca249..28b46ab66238 100644\n--- a/drivers/virtio/virtio_mmio.c\n+++ b/drivers/virtio/virtio_mmio.c\n@@ -12,6 +12,7 @@\n #include <virtio_types.h>\n #include <virtio.h>\n #include <virtio_ring.h>\n+#include <virtio_mmio.h>\n #include <linux/bug.h>\n #include <linux/compat.h>\n #include <linux/err.h>\n@@ -335,21 +336,28 @@ static int virtio_mmio_notify(struct udevice *udev, struct virtqueue *vq)\n \n static int virtio_mmio_of_to_plat(struct udevice *udev)\n {\n-\tstruct virtio_mmio_priv *priv = dev_get_priv(udev);\n+\tstruct virtio_mmio_plat *plat = dev_get_plat(udev);\n+\tfdt_addr_t addr;\n+\n+\taddr = dev_read_addr(udev);\n \n-\tpriv->base = (void __iomem *)(ulong)dev_read_addr(udev);\n-\tif (priv->base == (void __iomem *)FDT_ADDR_T_NONE)\n+\tif (addr == FDT_ADDR_T_NONE)\n \t\treturn -EINVAL;\n \n+\tplat->base = addr;\n+\n \treturn 0;\n }\n \n static int virtio_mmio_probe(struct udevice *udev)\n {\n+\tstruct virtio_mmio_plat *plat = dev_get_plat(udev);\n \tstruct virtio_mmio_priv *priv = dev_get_priv(udev);\n \tstruct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);\n \tu32 magic;\n \n+\tpriv->base = (void __iomem *)plat->base;\n+\n \t/* Check magic value */\n \tmagic = readl(priv->base + VIRTIO_MMIO_MAGIC_VALUE);\n \tif (magic != ('v' | 'i' << 8 | 'r' << 16 | 't' << 24)) {\n@@ -405,11 +413,12 @@ static const struct udevice_id virtio_mmio_ids[] = {\n };\n \n U_BOOT_DRIVER(virtio_mmio) = {\n-\t.name\t= \"virtio-mmio\",\n-\t.id\t= UCLASS_VIRTIO,\n-\t.of_match = virtio_mmio_ids,\n-\t.ops\t= &virtio_mmio_ops,\n-\t.probe\t= virtio_mmio_probe,\n+\t.name       = \"virtio-mmio\",\n+\t.id         = UCLASS_VIRTIO,\n+\t.of_match   = virtio_mmio_ids,\n+\t.ops        = &virtio_mmio_ops,\n+\t.probe      = virtio_mmio_probe,\n \t.of_to_plat = virtio_mmio_of_to_plat,\n-\t.priv_auto\t= sizeof(struct virtio_mmio_priv),\n+\t.priv_auto  = sizeof(struct virtio_mmio_priv),\n+\t.plat_auto  = sizeof(struct virtio_mmio_plat),\n };\ndiff --git a/include/virtio_mmio.h b/include/virtio_mmio.h\nnew file mode 100644\nindex 000000000000..8c072826db55\n--- /dev/null\n+++ b/include/virtio_mmio.h\n@@ -0,0 +1,12 @@\n+/* SPDX-License-Identifier: GPL-2.0+ */\n+\n+#ifndef __VIRTIO_MMIO_H__\n+#define __VIRTIO_MMIO_H__\n+\n+#include <linux/types.h>\n+\n+struct virtio_mmio_plat {\n+\tphys_addr_t base;\n+};\n+\n+#endif /* __VIRTIO_MMIO_H__ */\n","prefixes":["v4","3/6"]}