From: Jamin Lin <jamin_lin@aspeedtech.com>
To: "philmd@oss.qualcomm.com" <philmd@oss.qualcomm.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Troy Lee" <leetroy@gmail.com>,
"Kane Chen" <kane_chen@aspeedtech.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>,
"Ani Sinha" <anisinha@redhat.com>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: Jamin Lin <jamin_lin@aspeedtech.com>, Troy Lee <troy_lee@aspeedtech.com>
Subject: [PATCH v2 01/12] hw/misc/unimp: Add create_unimplemented_devices() helper
Date: Mon, 12 Oct 2026 06:44:47 +0000 [thread overview]
Message-ID: <20261012064445.2571633-2-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20261012064445.2571633-1-jamin_lin@aspeedtech.com>
Several boards and SoCs create many unimplemented devices. Each of them
uses its own structure and helper to describe and map these devices.
Add an UnimplementedDeviceConfig structure and a
create_unimplemented_devices() helper. The helper creates an
unimplemented device for each entry of a table, adds it as a QOM child
of the parent object, and maps it in a memory region container with
the given priority. The table is terminated by an empty entry.
Suggested-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
include/hw/misc/unimp.h | 21 +++++++++++++++++++++
hw/misc/unimp.c | 20 ++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/include/hw/misc/unimp.h b/include/hw/misc/unimp.h
index 77a5077511..073575159d 100644
--- a/include/hw/misc/unimp.h
+++ b/include/hw/misc/unimp.h
@@ -25,6 +25,27 @@ struct UnimplementedDeviceState {
uint64_t size;
};
+typedef struct UnimplementedDeviceConfig {
+ const char *qom_name;
+ const char *region_name;
+ uint64_t offset;
+ uint64_t size;
+ int priority;
+} UnimplementedDeviceConfig;
+
+/**
+ * create_unimplemented_devices:
+ * @parentobj: the parent object
+ * @container: a #MemoryRegion within which @addr is a relative address
+ * @devconfigs: NULL terminated array of #UnimplementedDeviceConfig
+ *
+ * For each entries in @devconfigs, create a TYPE_UNIMPLEMENTED_DEVICE
+ * and mmap it in @container at UnimplementedDeviceConfig::offset.
+ * @container is expected to be a QOM child of @parentobj.
+ */
+void create_unimplemented_devices(Object *parentobj, MemoryRegion *container,
+ const UnimplementedDeviceConfig *devconfigs);
+
/**
* create_unimplemented_device: create and map a dummy device
* @name: name of the device for debug logging
diff --git a/hw/misc/unimp.c b/hw/misc/unimp.c
index 521b84bf20..4c8dcbdff3 100644
--- a/hw/misc/unimp.c
+++ b/hw/misc/unimp.c
@@ -96,3 +96,23 @@ static void unimp_register_types(void)
}
type_init(unimp_register_types)
+
+void create_unimplemented_devices(Object *parentobj, MemoryRegion *container,
+ const UnimplementedDeviceConfig *devconfigs)
+{
+ const UnimplementedDeviceConfig *cfg;
+
+ for (cfg = devconfigs; cfg->qom_name; cfg++) {
+ DeviceState *dev = qdev_new(TYPE_UNIMPLEMENTED_DEVICE);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+
+ object_property_add_child(parentobj, cfg->qom_name, OBJECT(dev));
+ qdev_prop_set_string(dev, "name", cfg->region_name);
+ qdev_prop_set_uint64(dev, "size", cfg->size);
+ sysbus_realize_and_unref(sbd, &error_fatal);
+
+ memory_region_add_subregion_overlap(container, cfg->offset,
+ sysbus_mmio_get_region(sbd, 0),
+ cfg->priority);
+ }
+}
--
2.53.0
next prev parent reply other threads:[~2026-10-12 6:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 6:44 [PATCH v2 00/12] hw/arm/aspeed: Use a table for unimplemented devices Jamin Lin
2026-10-12 6:44 ` Jamin Lin [this message]
2026-10-13 8:31 ` [PATCH v2 01/12] hw/misc/unimp: Add create_unimplemented_devices() helper Philippe Mathieu-Daudé
2026-10-12 6:44 ` [PATCH v2 02/12] hw/arm/aspeed_ast2400: Use a table for unimplemented devices Jamin Lin
2026-10-12 6:44 ` [PATCH v2 03/12] hw/arm/aspeed_ast2600: " Jamin Lin
2026-10-12 6:44 ` [PATCH v2 04/12] hw/arm/aspeed_ast27x0: " Jamin Lin
2026-10-12 6:44 ` [PATCH v2 05/12] hw/arm/aspeed_ast10x0: " Jamin Lin
2026-10-12 6:44 ` [PATCH v2 06/12] hw/arm/aspeed_ast1040: " Jamin Lin
2026-10-12 6:44 ` [PATCH v2 07/12] hw/arm/aspeed: Remove unused unimplemented device fields Jamin Lin
2026-10-12 6:44 ` [PATCH v2 08/12] hw/arm/aspeed_ast27x0: Use a table for unimplemented devices for SSP/TSP Jamin Lin
2026-10-12 6:44 ` [PATCH v2 09/12] hw/arm/aspeed_coprocessor: Remove unused unimplemented device fields Jamin Lin
2026-10-12 6:44 ` [PATCH v2 10/12] hw/arm/aspeed_ast1700: Use a table for unimplemented devices Jamin Lin
2026-10-12 6:44 ` [PATCH v2 11/12] hw/arm/aspeed_ast1700: Remove unused unimplemented device field Jamin Lin
2026-10-12 6:44 ` [PATCH v2 12/12] hw/arm/aspeed: Remove unused aspeed_mmio_map_unimplemented() Jamin Lin
2026-10-12 17:04 ` [PATCH v2 00/12] hw/arm/aspeed: Use a table for unimplemented devices Cédric Le Goater
2026-10-13 8:33 ` Philippe Mathieu-Daudé
2026-10-13 12:23 ` Cédric Le Goater
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=20261012064445.2571633-2-jamin_lin@aspeedtech.com \
--to=jamin_lin@aspeedtech.com \
--cc=andrew@codeconstruct.com.au \
--cc=anisinha@redhat.com \
--cc=clg@kaod.org \
--cc=joel@jms.id.au \
--cc=kane_chen@aspeedtech.com \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=troy_lee@aspeedtech.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.