* [PATCH] virtio: Add vhost-user-rtc and vhost-user-rtc-pci
@ 2026-04-16 5:54 Manos Pitsidianakis
2026-04-16 7:18 ` Daniel P. Berrangé
0 siblings, 1 reply; 4+ messages in thread
From: Manos Pitsidianakis @ 2026-04-16 5:54 UTC (permalink / raw)
To: qemu-devel
Cc: Mitsuya Ikuya (三ツ屋 郁哉),
KUZU KAZUKI (葛生 一樹),
Stefano Garzarella, Alex Bennée, Michael S. Tsirkin,
Manos Pitsidianakis
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
---
include/hw/virtio/vhost-user-rtc.h | 22 ++++++++++
MAINTAINERS | 6 +++
docs/system/devices/virtio/vhost-user.rst | 3 ++
hw/virtio/Kconfig | 5 +++
hw/virtio/meson.build | 3 ++
hw/virtio/vhost-user-rtc-pci.c | 70 +++++++++++++++++++++++++++++++
hw/virtio/vhost-user-rtc.c | 64 ++++++++++++++++++++++++++++
7 files changed, 173 insertions(+)
diff --git a/include/hw/virtio/vhost-user-rtc.h b/include/hw/virtio/vhost-user-rtc.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b7b53c28f93032886d82687199585aba0edd917
--- /dev/null
+++ b/include/hw/virtio/vhost-user-rtc.h
@@ -0,0 +1,22 @@
+/*
+ * Vhost-user RTC virtio device
+ *
+ * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
+ * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef QEMU_VHOST_USER_RTC_H
+#define QEMU_VHOST_USER_RTC_H
+
+#include "hw/virtio/vhost-user-base.h"
+
+#define TYPE_VHOST_USER_RTC "vhost-user-rtc"
+OBJECT_DECLARE_SIMPLE_TYPE(VHostUserRTC, VHOST_USER_RTC)
+
+struct VHostUserRTC {
+ VHostUserBase parent_obj;
+};
+
+#endif /* QEMU_VHOST_USER_RTC_H */
diff --git a/MAINTAINERS b/MAINTAINERS
index ad215eced84d1ac58956ea374ee012acbb3cbd18..da6376b0f5e6fa99495504e88da9fef5a7a969e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2573,6 +2573,12 @@ S: Maintained
F: include/hw/virtio/vhost-user-spi.h
F: hw/virtio/vhost-user-spi*
+vhost-user-rtc
+M: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
+S: Supported
+F: include/hw/virtio/vhost-user-rtc.h
+F: hw/virtio/vhost-user-rtc*
+
virtio-crypto
M: Gonglei <arei.gonglei@huawei.com>
S: Supported
diff --git a/docs/system/devices/virtio/vhost-user.rst b/docs/system/devices/virtio/vhost-user.rst
index 2806d81ca201551a91246a10e0d98fd36d74200b..acfbd609d0f9c87e3af684797adf156a8a61bc88 100644
--- a/docs/system/devices/virtio/vhost-user.rst
+++ b/docs/system/devices/virtio/vhost-user.rst
@@ -61,6 +61,9 @@ platform details for what sort of virtio bus to use.
* - vhost-user-spi
- Proxy spi devices to host
- `vhost-device-spi <https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-spi>`_
+ * - vhost-user-rtc
+ - Real time clock
+ - `vhost-device-rtc <https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-rtc>`_
The referenced *daemons* are not exhaustive, any conforming backend
implementing the device and using the vhost-user protocol should work.
diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
index 8895682c619402eb3c9cd7269d3319f39711b4bd..2ebdac16b31aec3ec283c0285a4dcfa67f0a5157 100644
--- a/hw/virtio/Kconfig
+++ b/hw/virtio/Kconfig
@@ -136,3 +136,8 @@ config VHOST_USER_TEST
bool
default y
depends on VIRTIO && VHOST_USER
+
+config VHOST_USER_RTC
+ bool
+ default y
+ depends on VIRTIO && VHOST_USER
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index 415e359e9fc79b6b1adbbcfc4f87a7106ef1d4a6..e0566a60de7989c4048956e268f151659467fe34 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -27,6 +27,7 @@ if have_vhost
system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SND', if_true: files('vhost-user-snd.c'))
system_virtio_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c'))
system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SPI', if_true: files('vhost-user-spi.c'))
+ system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RTC', if_true: files('vhost-user-rtc.c'))
# PCI Stubs
system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_TEST'],
@@ -43,6 +44,8 @@ if have_vhost
if_true: files('vhost-user-input-pci.c'))
system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SPI'],
if_true: files('vhost-user-spi-pci.c'))
+ system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_RTC'],
+ if_true: files('vhost-user-rtc-pci.c'))
endif
if have_vhost_vdpa
system_virtio_ss.add(files('vhost-vdpa.c'))
diff --git a/hw/virtio/vhost-user-rtc-pci.c b/hw/virtio/vhost-user-rtc-pci.c
new file mode 100644
index 0000000000000000000000000000000000000000..449368d27009acde20aa4af2542a912ac8b82cbc
--- /dev/null
+++ b/hw/virtio/vhost-user-rtc-pci.c
@@ -0,0 +1,70 @@
+/*
+ * Vhost-user RTC virtio device PCI glue
+ *
+ * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
+ * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/virtio/vhost-user-rtc.h"
+#include "hw/virtio/virtio-pci.h"
+
+struct VHostUserRTCPCI {
+ VirtIOPCIProxy parent_obj;
+ VHostUserRTC vdev;
+};
+
+typedef struct VHostUserRTCPCI VHostUserRTCPCI;
+
+#define TYPE_VHOST_USER_RTC_PCI "vhost-user-rtc-pci-base"
+
+DECLARE_INSTANCE_CHECKER(VHostUserRTCPCI, VHOST_USER_RTC_PCI,
+ TYPE_VHOST_USER_RTC_PCI)
+
+static void vhost_user_rtc_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
+{
+ VHostUserRTCPCI *dev = VHOST_USER_RTC_PCI(vpci_dev);
+ DeviceState *vdev = DEVICE(&dev->vdev);
+
+ vpci_dev->nvectors = 1;
+
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
+}
+
+static void vhost_user_rtc_pci_class_init(ObjectClass *klass, const void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
+ PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
+ k->realize = vhost_user_rtc_pci_realize;
+ set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+ pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
+ pcidev_k->device_id = 0; /* Set by virtio-pci based on virtio id */
+ pcidev_k->revision = 0x00;
+ pcidev_k->class_id = PCI_CLASS_SYSTEM_RTC;
+}
+
+static void vhost_user_rtc_pci_instance_init(Object *obj)
+{
+ VHostUserRTCPCI *dev = VHOST_USER_RTC_PCI(obj);
+
+ virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+ TYPE_VHOST_USER_RTC);
+}
+
+static const VirtioPCIDeviceTypeInfo vhost_user_rtc_pci_info = {
+ .base_name = TYPE_VHOST_USER_RTC_PCI,
+ .non_transitional_name = "vhost-user-rtc-pci",
+ .instance_size = sizeof(VHostUserRTCPCI),
+ .instance_init = vhost_user_rtc_pci_instance_init,
+ .class_init = vhost_user_rtc_pci_class_init,
+};
+
+static void vhost_user_rtc_pci_register(void)
+{
+ virtio_pci_types_register(&vhost_user_rtc_pci_info);
+}
+
+type_init(vhost_user_rtc_pci_register);
diff --git a/hw/virtio/vhost-user-rtc.c b/hw/virtio/vhost-user-rtc.c
new file mode 100644
index 0000000000000000000000000000000000000000..88b0c70b903363fc9ac7ccb65a1b1755e095c6bc
--- /dev/null
+++ b/hw/virtio/vhost-user-rtc.c
@@ -0,0 +1,64 @@
+/*
+ * Vhost-user RTC virtio device
+ *
+ * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
+ * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
+ *
+ * Simple wrapper of the generic vhost-user-device.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/virtio/vhost-user-rtc.h"
+#include "standard-headers/linux/virtio_ids.h"
+
+static const VMStateDescription vu_rtc_vmstate = {
+ .name = "vhost-user-rtc",
+ .unmigratable = 1,
+};
+
+static const Property vrtc_properties[] = {
+ DEFINE_PROP_CHR("chardev", VHostUserBase, chardev),
+};
+
+static void vu_rtc_base_realize(DeviceState *dev, Error **errp)
+{
+ VHostUserBase *vub = VHOST_USER_BASE(dev);
+ VHostUserBaseClass *vubs = VHOST_USER_BASE_GET_CLASS(dev);
+
+ vub->virtio_id = VIRTIO_ID_CLOCK;
+ vub->num_vqs = 2;
+ vub->config_size = 0;
+ vub->vq_size = 1024;
+
+ vubs->parent_realize(dev, errp);
+}
+
+static void vu_rtc_class_init(ObjectClass *klass, const void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ VHostUserBaseClass *vubc = VHOST_USER_BASE_CLASS(klass);
+
+ dc->vmsd = &vu_rtc_vmstate;
+ device_class_set_props(dc, vrtc_properties);
+ device_class_set_parent_realize(dc, vu_rtc_base_realize,
+ &vubc->parent_realize);
+
+ set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+}
+
+static const TypeInfo vu_rtc_info = {
+ .name = TYPE_VHOST_USER_RTC,
+ .parent = TYPE_VHOST_USER_BASE,
+ .instance_size = sizeof(VHostUserRTC),
+ .class_init = vu_rtc_class_init,
+};
+
+static void vu_rtc_register_types(void)
+{
+ type_register_static(&vu_rtc_info);
+}
+
+type_init(vu_rtc_register_types)
---
base-commit: da6c4fe60fee30dd77267764d55b38af9cb89d4b
change-id: 20260416-vhost-user-rtc-ce8ff0377356
--
γαῖα πυρί μιχθήτω
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] virtio: Add vhost-user-rtc and vhost-user-rtc-pci
2026-04-16 5:54 [PATCH] virtio: Add vhost-user-rtc and vhost-user-rtc-pci Manos Pitsidianakis
@ 2026-04-16 7:18 ` Daniel P. Berrangé
2026-04-16 7:23 ` Manos Pitsidianakis
0 siblings, 1 reply; 4+ messages in thread
From: Daniel P. Berrangé @ 2026-04-16 7:18 UTC (permalink / raw)
To: Manos Pitsidianakis
Cc: qemu-devel,
Mitsuya Ikuya (三ツ屋 郁哉),
KUZU KAZUKI (葛生 一樹),
Stefano Garzarella, Alex Bennée, Michael S. Tsirkin
Missing commit message.....
On Thu, Apr 16, 2026 at 08:54:40AM +0300, Manos Pitsidianakis wrote:
> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> ---
> include/hw/virtio/vhost-user-rtc.h | 22 ++++++++++
> MAINTAINERS | 6 +++
> docs/system/devices/virtio/vhost-user.rst | 3 ++
> hw/virtio/Kconfig | 5 +++
> hw/virtio/meson.build | 3 ++
> hw/virtio/vhost-user-rtc-pci.c | 70 +++++++++++++++++++++++++++++++
> hw/virtio/vhost-user-rtc.c | 64 ++++++++++++++++++++++++++++
> 7 files changed, 173 insertions(+)
>
> diff --git a/include/hw/virtio/vhost-user-rtc.h b/include/hw/virtio/vhost-user-rtc.h
> new file mode 100644
> index 0000000000000000000000000000000000000000..6b7b53c28f93032886d82687199585aba0edd917
> --- /dev/null
> +++ b/include/hw/virtio/vhost-user-rtc.h
> @@ -0,0 +1,22 @@
> +/*
> + * Vhost-user RTC virtio device
> + *
> + * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> + * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
This commit is only signed off by yourself, as @linaro.org but the
newest copyright is from Panasonic. What is the situation with
authorship here ?
If it was co-authored by people from multiple companies then I'd
expect to see multiple signed-off-bys, so that each company is
represented.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef QEMU_VHOST_USER_RTC_H
> +#define QEMU_VHOST_USER_RTC_H
> +
> +#include "hw/virtio/vhost-user-base.h"
> +
> +#define TYPE_VHOST_USER_RTC "vhost-user-rtc"
> +OBJECT_DECLARE_SIMPLE_TYPE(VHostUserRTC, VHOST_USER_RTC)
> +
> +struct VHostUserRTC {
> + VHostUserBase parent_obj;
> +};
> +
> +#endif /* QEMU_VHOST_USER_RTC_H */
> diff --git a/MAINTAINERS b/MAINTAINERS
> index ad215eced84d1ac58956ea374ee012acbb3cbd18..da6376b0f5e6fa99495504e88da9fef5a7a969e3 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2573,6 +2573,12 @@ S: Maintained
> F: include/hw/virtio/vhost-user-spi.h
> F: hw/virtio/vhost-user-spi*
>
> +vhost-user-rtc
> +M: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> +S: Supported
> +F: include/hw/virtio/vhost-user-rtc.h
> +F: hw/virtio/vhost-user-rtc*
> +
> virtio-crypto
> M: Gonglei <arei.gonglei@huawei.com>
> S: Supported
> diff --git a/docs/system/devices/virtio/vhost-user.rst b/docs/system/devices/virtio/vhost-user.rst
> index 2806d81ca201551a91246a10e0d98fd36d74200b..acfbd609d0f9c87e3af684797adf156a8a61bc88 100644
> --- a/docs/system/devices/virtio/vhost-user.rst
> +++ b/docs/system/devices/virtio/vhost-user.rst
> @@ -61,6 +61,9 @@ platform details for what sort of virtio bus to use.
> * - vhost-user-spi
> - Proxy spi devices to host
> - `vhost-device-spi <https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-spi>`_
> + * - vhost-user-rtc
> + - Real time clock
> + - `vhost-device-rtc <https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-rtc>`_
>
> The referenced *daemons* are not exhaustive, any conforming backend
> implementing the device and using the vhost-user protocol should work.
> diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
> index 8895682c619402eb3c9cd7269d3319f39711b4bd..2ebdac16b31aec3ec283c0285a4dcfa67f0a5157 100644
> --- a/hw/virtio/Kconfig
> +++ b/hw/virtio/Kconfig
> @@ -136,3 +136,8 @@ config VHOST_USER_TEST
> bool
> default y
> depends on VIRTIO && VHOST_USER
> +
> +config VHOST_USER_RTC
> + bool
> + default y
> + depends on VIRTIO && VHOST_USER
> diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
> index 415e359e9fc79b6b1adbbcfc4f87a7106ef1d4a6..e0566a60de7989c4048956e268f151659467fe34 100644
> --- a/hw/virtio/meson.build
> +++ b/hw/virtio/meson.build
> @@ -27,6 +27,7 @@ if have_vhost
> system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SND', if_true: files('vhost-user-snd.c'))
> system_virtio_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c'))
> system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SPI', if_true: files('vhost-user-spi.c'))
> + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RTC', if_true: files('vhost-user-rtc.c'))
>
> # PCI Stubs
> system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_TEST'],
> @@ -43,6 +44,8 @@ if have_vhost
> if_true: files('vhost-user-input-pci.c'))
> system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SPI'],
> if_true: files('vhost-user-spi-pci.c'))
> + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_RTC'],
> + if_true: files('vhost-user-rtc-pci.c'))
> endif
> if have_vhost_vdpa
> system_virtio_ss.add(files('vhost-vdpa.c'))
> diff --git a/hw/virtio/vhost-user-rtc-pci.c b/hw/virtio/vhost-user-rtc-pci.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..449368d27009acde20aa4af2542a912ac8b82cbc
> --- /dev/null
> +++ b/hw/virtio/vhost-user-rtc-pci.c
> @@ -0,0 +1,70 @@
> +/*
> + * Vhost-user RTC virtio device PCI glue
> + *
> + * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> + * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "hw/virtio/vhost-user-rtc.h"
> +#include "hw/virtio/virtio-pci.h"
> +
> +struct VHostUserRTCPCI {
> + VirtIOPCIProxy parent_obj;
> + VHostUserRTC vdev;
> +};
> +
> +typedef struct VHostUserRTCPCI VHostUserRTCPCI;
> +
> +#define TYPE_VHOST_USER_RTC_PCI "vhost-user-rtc-pci-base"
> +
> +DECLARE_INSTANCE_CHECKER(VHostUserRTCPCI, VHOST_USER_RTC_PCI,
> + TYPE_VHOST_USER_RTC_PCI)
> +
> +static void vhost_user_rtc_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
> +{
> + VHostUserRTCPCI *dev = VHOST_USER_RTC_PCI(vpci_dev);
> + DeviceState *vdev = DEVICE(&dev->vdev);
> +
> + vpci_dev->nvectors = 1;
> +
> + qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
> +}
> +
> +static void vhost_user_rtc_pci_class_init(ObjectClass *klass, const void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(klass);
> + VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
> + PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
> + k->realize = vhost_user_rtc_pci_realize;
> + set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> + pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
> + pcidev_k->device_id = 0; /* Set by virtio-pci based on virtio id */
> + pcidev_k->revision = 0x00;
> + pcidev_k->class_id = PCI_CLASS_SYSTEM_RTC;
> +}
> +
> +static void vhost_user_rtc_pci_instance_init(Object *obj)
> +{
> + VHostUserRTCPCI *dev = VHOST_USER_RTC_PCI(obj);
> +
> + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
> + TYPE_VHOST_USER_RTC);
> +}
> +
> +static const VirtioPCIDeviceTypeInfo vhost_user_rtc_pci_info = {
> + .base_name = TYPE_VHOST_USER_RTC_PCI,
> + .non_transitional_name = "vhost-user-rtc-pci",
> + .instance_size = sizeof(VHostUserRTCPCI),
> + .instance_init = vhost_user_rtc_pci_instance_init,
> + .class_init = vhost_user_rtc_pci_class_init,
> +};
> +
> +static void vhost_user_rtc_pci_register(void)
> +{
> + virtio_pci_types_register(&vhost_user_rtc_pci_info);
> +}
> +
> +type_init(vhost_user_rtc_pci_register);
> diff --git a/hw/virtio/vhost-user-rtc.c b/hw/virtio/vhost-user-rtc.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..88b0c70b903363fc9ac7ccb65a1b1755e095c6bc
> --- /dev/null
> +++ b/hw/virtio/vhost-user-rtc.c
> @@ -0,0 +1,64 @@
> +/*
> + * Vhost-user RTC virtio device
> + *
> + * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> + * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
> + *
> + * Simple wrapper of the generic vhost-user-device.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qapi/error.h"
> +#include "hw/virtio/vhost-user-rtc.h"
> +#include "standard-headers/linux/virtio_ids.h"
> +
> +static const VMStateDescription vu_rtc_vmstate = {
> + .name = "vhost-user-rtc",
> + .unmigratable = 1,
> +};
> +
> +static const Property vrtc_properties[] = {
> + DEFINE_PROP_CHR("chardev", VHostUserBase, chardev),
> +};
> +
> +static void vu_rtc_base_realize(DeviceState *dev, Error **errp)
> +{
> + VHostUserBase *vub = VHOST_USER_BASE(dev);
> + VHostUserBaseClass *vubs = VHOST_USER_BASE_GET_CLASS(dev);
> +
> + vub->virtio_id = VIRTIO_ID_CLOCK;
> + vub->num_vqs = 2;
> + vub->config_size = 0;
> + vub->vq_size = 1024;
> +
> + vubs->parent_realize(dev, errp);
> +}
> +
> +static void vu_rtc_class_init(ObjectClass *klass, const void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS(klass);
> + VHostUserBaseClass *vubc = VHOST_USER_BASE_CLASS(klass);
> +
> + dc->vmsd = &vu_rtc_vmstate;
> + device_class_set_props(dc, vrtc_properties);
> + device_class_set_parent_realize(dc, vu_rtc_base_realize,
> + &vubc->parent_realize);
> +
> + set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> +}
> +
> +static const TypeInfo vu_rtc_info = {
> + .name = TYPE_VHOST_USER_RTC,
> + .parent = TYPE_VHOST_USER_BASE,
> + .instance_size = sizeof(VHostUserRTC),
> + .class_init = vu_rtc_class_init,
> +};
> +
> +static void vu_rtc_register_types(void)
> +{
> + type_register_static(&vu_rtc_info);
> +}
> +
> +type_init(vu_rtc_register_types)
>
> ---
> base-commit: da6c4fe60fee30dd77267764d55b38af9cb89d4b
> change-id: 20260416-vhost-user-rtc-ce8ff0377356
>
> --
> γαῖα πυρί μιχθήτω
>
>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] virtio: Add vhost-user-rtc and vhost-user-rtc-pci
2026-04-16 7:18 ` Daniel P. Berrangé
@ 2026-04-16 7:23 ` Manos Pitsidianakis
2026-04-16 7:55 ` Daniel P. Berrangé
0 siblings, 1 reply; 4+ messages in thread
From: Manos Pitsidianakis @ 2026-04-16 7:23 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: qemu-devel,
Mitsuya Ikuya (三ツ屋 郁哉),
KUZU KAZUKI (葛生 一樹),
Stefano Garzarella, Alex Bennée, Michael S. Tsirkin
On Thu, Apr 16, 2026 at 10:18 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
>
>
> Missing commit message.....
Commit title is self-explanatory.
>
>
> On Thu, Apr 16, 2026 at 08:54:40AM +0300, Manos Pitsidianakis wrote:
> > Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > ---
> > include/hw/virtio/vhost-user-rtc.h | 22 ++++++++++
> > MAINTAINERS | 6 +++
> > docs/system/devices/virtio/vhost-user.rst | 3 ++
> > hw/virtio/Kconfig | 5 +++
> > hw/virtio/meson.build | 3 ++
> > hw/virtio/vhost-user-rtc-pci.c | 70 +++++++++++++++++++++++++++++++
> > hw/virtio/vhost-user-rtc.c | 64 ++++++++++++++++++++++++++++
> > 7 files changed, 173 insertions(+)
> >
> > diff --git a/include/hw/virtio/vhost-user-rtc.h b/include/hw/virtio/vhost-user-rtc.h
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..6b7b53c28f93032886d82687199585aba0edd917
> > --- /dev/null
> > +++ b/include/hw/virtio/vhost-user-rtc.h
> > @@ -0,0 +1,22 @@
> > +/*
> > + * Vhost-user RTC virtio device
> > + *
> > + * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > + * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
>
> This commit is only signed off by yourself, as @linaro.org but the
> newest copyright is from Panasonic. What is the situation with
> authorship here ?
>
> If it was co-authored by people from multiple companies then I'd
> expect to see multiple signed-off-bys, so that each company is
> represented.
It is authored solely by me for Panasonic, but based on existing
vhost-user devices I wrote in 2025, so the copyright is mixed.
>
> > + *
> > + * SPDX-License-Identifier: GPL-2.0-or-later
> > + */
> > +
> > +#ifndef QEMU_VHOST_USER_RTC_H
> > +#define QEMU_VHOST_USER_RTC_H
> > +
> > +#include "hw/virtio/vhost-user-base.h"
> > +
> > +#define TYPE_VHOST_USER_RTC "vhost-user-rtc"
> > +OBJECT_DECLARE_SIMPLE_TYPE(VHostUserRTC, VHOST_USER_RTC)
> > +
> > +struct VHostUserRTC {
> > + VHostUserBase parent_obj;
> > +};
> > +
> > +#endif /* QEMU_VHOST_USER_RTC_H */
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index ad215eced84d1ac58956ea374ee012acbb3cbd18..da6376b0f5e6fa99495504e88da9fef5a7a969e3 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -2573,6 +2573,12 @@ S: Maintained
> > F: include/hw/virtio/vhost-user-spi.h
> > F: hw/virtio/vhost-user-spi*
> >
> > +vhost-user-rtc
> > +M: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > +S: Supported
> > +F: include/hw/virtio/vhost-user-rtc.h
> > +F: hw/virtio/vhost-user-rtc*
> > +
> > virtio-crypto
> > M: Gonglei <arei.gonglei@huawei.com>
> > S: Supported
> > diff --git a/docs/system/devices/virtio/vhost-user.rst b/docs/system/devices/virtio/vhost-user.rst
> > index 2806d81ca201551a91246a10e0d98fd36d74200b..acfbd609d0f9c87e3af684797adf156a8a61bc88 100644
> > --- a/docs/system/devices/virtio/vhost-user.rst
> > +++ b/docs/system/devices/virtio/vhost-user.rst
> > @@ -61,6 +61,9 @@ platform details for what sort of virtio bus to use.
> > * - vhost-user-spi
> > - Proxy spi devices to host
> > - `vhost-device-spi <https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-spi>`_
> > + * - vhost-user-rtc
> > + - Real time clock
> > + - `vhost-device-rtc <https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-rtc>`_
> >
> > The referenced *daemons* are not exhaustive, any conforming backend
> > implementing the device and using the vhost-user protocol should work.
> > diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
> > index 8895682c619402eb3c9cd7269d3319f39711b4bd..2ebdac16b31aec3ec283c0285a4dcfa67f0a5157 100644
> > --- a/hw/virtio/Kconfig
> > +++ b/hw/virtio/Kconfig
> > @@ -136,3 +136,8 @@ config VHOST_USER_TEST
> > bool
> > default y
> > depends on VIRTIO && VHOST_USER
> > +
> > +config VHOST_USER_RTC
> > + bool
> > + default y
> > + depends on VIRTIO && VHOST_USER
> > diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
> > index 415e359e9fc79b6b1adbbcfc4f87a7106ef1d4a6..e0566a60de7989c4048956e268f151659467fe34 100644
> > --- a/hw/virtio/meson.build
> > +++ b/hw/virtio/meson.build
> > @@ -27,6 +27,7 @@ if have_vhost
> > system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SND', if_true: files('vhost-user-snd.c'))
> > system_virtio_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c'))
> > system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SPI', if_true: files('vhost-user-spi.c'))
> > + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RTC', if_true: files('vhost-user-rtc.c'))
> >
> > # PCI Stubs
> > system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_TEST'],
> > @@ -43,6 +44,8 @@ if have_vhost
> > if_true: files('vhost-user-input-pci.c'))
> > system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SPI'],
> > if_true: files('vhost-user-spi-pci.c'))
> > + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_RTC'],
> > + if_true: files('vhost-user-rtc-pci.c'))
> > endif
> > if have_vhost_vdpa
> > system_virtio_ss.add(files('vhost-vdpa.c'))
> > diff --git a/hw/virtio/vhost-user-rtc-pci.c b/hw/virtio/vhost-user-rtc-pci.c
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..449368d27009acde20aa4af2542a912ac8b82cbc
> > --- /dev/null
> > +++ b/hw/virtio/vhost-user-rtc-pci.c
> > @@ -0,0 +1,70 @@
> > +/*
> > + * Vhost-user RTC virtio device PCI glue
> > + *
> > + * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > + * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
> > + *
> > + * SPDX-License-Identifier: GPL-2.0-or-later
> > + */
> > +
> > +#include "qemu/osdep.h"
> > +#include "hw/virtio/vhost-user-rtc.h"
> > +#include "hw/virtio/virtio-pci.h"
> > +
> > +struct VHostUserRTCPCI {
> > + VirtIOPCIProxy parent_obj;
> > + VHostUserRTC vdev;
> > +};
> > +
> > +typedef struct VHostUserRTCPCI VHostUserRTCPCI;
> > +
> > +#define TYPE_VHOST_USER_RTC_PCI "vhost-user-rtc-pci-base"
> > +
> > +DECLARE_INSTANCE_CHECKER(VHostUserRTCPCI, VHOST_USER_RTC_PCI,
> > + TYPE_VHOST_USER_RTC_PCI)
> > +
> > +static void vhost_user_rtc_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
> > +{
> > + VHostUserRTCPCI *dev = VHOST_USER_RTC_PCI(vpci_dev);
> > + DeviceState *vdev = DEVICE(&dev->vdev);
> > +
> > + vpci_dev->nvectors = 1;
> > +
> > + qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
> > +}
> > +
> > +static void vhost_user_rtc_pci_class_init(ObjectClass *klass, const void *data)
> > +{
> > + DeviceClass *dc = DEVICE_CLASS(klass);
> > + VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
> > + PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
> > + k->realize = vhost_user_rtc_pci_realize;
> > + set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> > + pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
> > + pcidev_k->device_id = 0; /* Set by virtio-pci based on virtio id */
> > + pcidev_k->revision = 0x00;
> > + pcidev_k->class_id = PCI_CLASS_SYSTEM_RTC;
> > +}
> > +
> > +static void vhost_user_rtc_pci_instance_init(Object *obj)
> > +{
> > + VHostUserRTCPCI *dev = VHOST_USER_RTC_PCI(obj);
> > +
> > + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
> > + TYPE_VHOST_USER_RTC);
> > +}
> > +
> > +static const VirtioPCIDeviceTypeInfo vhost_user_rtc_pci_info = {
> > + .base_name = TYPE_VHOST_USER_RTC_PCI,
> > + .non_transitional_name = "vhost-user-rtc-pci",
> > + .instance_size = sizeof(VHostUserRTCPCI),
> > + .instance_init = vhost_user_rtc_pci_instance_init,
> > + .class_init = vhost_user_rtc_pci_class_init,
> > +};
> > +
> > +static void vhost_user_rtc_pci_register(void)
> > +{
> > + virtio_pci_types_register(&vhost_user_rtc_pci_info);
> > +}
> > +
> > +type_init(vhost_user_rtc_pci_register);
> > diff --git a/hw/virtio/vhost-user-rtc.c b/hw/virtio/vhost-user-rtc.c
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..88b0c70b903363fc9ac7ccb65a1b1755e095c6bc
> > --- /dev/null
> > +++ b/hw/virtio/vhost-user-rtc.c
> > @@ -0,0 +1,64 @@
> > +/*
> > + * Vhost-user RTC virtio device
> > + *
> > + * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > + * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
> > + *
> > + * Simple wrapper of the generic vhost-user-device.
> > + *
> > + * SPDX-License-Identifier: GPL-2.0-or-later
> > + */
> > +
> > +#include "qemu/osdep.h"
> > +#include "qapi/error.h"
> > +#include "hw/virtio/vhost-user-rtc.h"
> > +#include "standard-headers/linux/virtio_ids.h"
> > +
> > +static const VMStateDescription vu_rtc_vmstate = {
> > + .name = "vhost-user-rtc",
> > + .unmigratable = 1,
> > +};
> > +
> > +static const Property vrtc_properties[] = {
> > + DEFINE_PROP_CHR("chardev", VHostUserBase, chardev),
> > +};
> > +
> > +static void vu_rtc_base_realize(DeviceState *dev, Error **errp)
> > +{
> > + VHostUserBase *vub = VHOST_USER_BASE(dev);
> > + VHostUserBaseClass *vubs = VHOST_USER_BASE_GET_CLASS(dev);
> > +
> > + vub->virtio_id = VIRTIO_ID_CLOCK;
> > + vub->num_vqs = 2;
> > + vub->config_size = 0;
> > + vub->vq_size = 1024;
> > +
> > + vubs->parent_realize(dev, errp);
> > +}
> > +
> > +static void vu_rtc_class_init(ObjectClass *klass, const void *data)
> > +{
> > + DeviceClass *dc = DEVICE_CLASS(klass);
> > + VHostUserBaseClass *vubc = VHOST_USER_BASE_CLASS(klass);
> > +
> > + dc->vmsd = &vu_rtc_vmstate;
> > + device_class_set_props(dc, vrtc_properties);
> > + device_class_set_parent_realize(dc, vu_rtc_base_realize,
> > + &vubc->parent_realize);
> > +
> > + set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> > +}
> > +
> > +static const TypeInfo vu_rtc_info = {
> > + .name = TYPE_VHOST_USER_RTC,
> > + .parent = TYPE_VHOST_USER_BASE,
> > + .instance_size = sizeof(VHostUserRTC),
> > + .class_init = vu_rtc_class_init,
> > +};
> > +
> > +static void vu_rtc_register_types(void)
> > +{
> > + type_register_static(&vu_rtc_info);
> > +}
> > +
> > +type_init(vu_rtc_register_types)
> >
> > ---
> > base-commit: da6c4fe60fee30dd77267764d55b38af9cb89d4b
> > change-id: 20260416-vhost-user-rtc-ce8ff0377356
> >
> > --
> > γαῖα πυρί μιχθήτω
> >
> >
>
> With regards,
> Daniel
> --
> |: https://berrange.com ~~ https://hachyderm.io/@berrange :|
> |: https://libvirt.org ~~ https://entangle-photo.org :|
> |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
>
--
Manos Pitsidianakis
Emulation and Virtualization Engineer at Linaro Ltd
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] virtio: Add vhost-user-rtc and vhost-user-rtc-pci
2026-04-16 7:23 ` Manos Pitsidianakis
@ 2026-04-16 7:55 ` Daniel P. Berrangé
0 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2026-04-16 7:55 UTC (permalink / raw)
To: Manos Pitsidianakis
Cc: qemu-devel,
Mitsuya Ikuya (三ツ屋 郁哉),
KUZU KAZUKI (葛生 一樹),
Stefano Garzarella, Alex Bennée, Michael S. Tsirkin
On Thu, Apr 16, 2026 at 10:23:12AM +0300, Manos Pitsidianakis wrote:
> On Thu, Apr 16, 2026 at 10:18 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> >
> > Missing commit message.....
>
>
> Commit title is self-explanatory.
The unusual authorship/copyright situation requires explanation in the
commit message
> > On Thu, Apr 16, 2026 at 08:54:40AM +0300, Manos Pitsidianakis wrote:
> > > Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > > ---
> > > include/hw/virtio/vhost-user-rtc.h | 22 ++++++++++
> > > MAINTAINERS | 6 +++
> > > docs/system/devices/virtio/vhost-user.rst | 3 ++
> > > hw/virtio/Kconfig | 5 +++
> > > hw/virtio/meson.build | 3 ++
> > > hw/virtio/vhost-user-rtc-pci.c | 70 +++++++++++++++++++++++++++++++
> > > hw/virtio/vhost-user-rtc.c | 64 ++++++++++++++++++++++++++++
> > > 7 files changed, 173 insertions(+)
> > >
> > > diff --git a/include/hw/virtio/vhost-user-rtc.h b/include/hw/virtio/vhost-user-rtc.h
> > > new file mode 100644
> > > index 0000000000000000000000000000000000000000..6b7b53c28f93032886d82687199585aba0edd917
> > > --- /dev/null
> > > +++ b/include/hw/virtio/vhost-user-rtc.h
> > > @@ -0,0 +1,22 @@
> > > +/*
> > > + * Vhost-user RTC virtio device
> > > + *
> > > + * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > > + * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
> >
> > This commit is only signed off by yourself, as @linaro.org but the
> > newest copyright is from Panasonic. What is the situation with
> > authorship here ?
> >
> > If it was co-authored by people from multiple companies then I'd
> > expect to see multiple signed-off-bys, so that each company is
> > represented.
>
>
> It is authored solely by me for Panasonic, but based on existing
> vhost-user devices I wrote in 2025, so the copyright is mixed.
Please include that in the commit message.
>
>
> >
> > > + *
> > > + * SPDX-License-Identifier: GPL-2.0-or-later
> > > + */
> > > +
> > > +#ifndef QEMU_VHOST_USER_RTC_H
> > > +#define QEMU_VHOST_USER_RTC_H
> > > +
> > > +#include "hw/virtio/vhost-user-base.h"
> > > +
> > > +#define TYPE_VHOST_USER_RTC "vhost-user-rtc"
> > > +OBJECT_DECLARE_SIMPLE_TYPE(VHostUserRTC, VHOST_USER_RTC)
> > > +
> > > +struct VHostUserRTC {
> > > + VHostUserBase parent_obj;
> > > +};
> > > +
> > > +#endif /* QEMU_VHOST_USER_RTC_H */
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index ad215eced84d1ac58956ea374ee012acbb3cbd18..da6376b0f5e6fa99495504e88da9fef5a7a969e3 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -2573,6 +2573,12 @@ S: Maintained
> > > F: include/hw/virtio/vhost-user-spi.h
> > > F: hw/virtio/vhost-user-spi*
> > >
> > > +vhost-user-rtc
> > > +M: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > > +S: Supported
> > > +F: include/hw/virtio/vhost-user-rtc.h
> > > +F: hw/virtio/vhost-user-rtc*
> > > +
> > > virtio-crypto
> > > M: Gonglei <arei.gonglei@huawei.com>
> > > S: Supported
> > > diff --git a/docs/system/devices/virtio/vhost-user.rst b/docs/system/devices/virtio/vhost-user.rst
> > > index 2806d81ca201551a91246a10e0d98fd36d74200b..acfbd609d0f9c87e3af684797adf156a8a61bc88 100644
> > > --- a/docs/system/devices/virtio/vhost-user.rst
> > > +++ b/docs/system/devices/virtio/vhost-user.rst
> > > @@ -61,6 +61,9 @@ platform details for what sort of virtio bus to use.
> > > * - vhost-user-spi
> > > - Proxy spi devices to host
> > > - `vhost-device-spi <https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-spi>`_
> > > + * - vhost-user-rtc
> > > + - Real time clock
> > > + - `vhost-device-rtc <https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-rtc>`_
> > >
> > > The referenced *daemons* are not exhaustive, any conforming backend
> > > implementing the device and using the vhost-user protocol should work.
> > > diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
> > > index 8895682c619402eb3c9cd7269d3319f39711b4bd..2ebdac16b31aec3ec283c0285a4dcfa67f0a5157 100644
> > > --- a/hw/virtio/Kconfig
> > > +++ b/hw/virtio/Kconfig
> > > @@ -136,3 +136,8 @@ config VHOST_USER_TEST
> > > bool
> > > default y
> > > depends on VIRTIO && VHOST_USER
> > > +
> > > +config VHOST_USER_RTC
> > > + bool
> > > + default y
> > > + depends on VIRTIO && VHOST_USER
> > > diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
> > > index 415e359e9fc79b6b1adbbcfc4f87a7106ef1d4a6..e0566a60de7989c4048956e268f151659467fe34 100644
> > > --- a/hw/virtio/meson.build
> > > +++ b/hw/virtio/meson.build
> > > @@ -27,6 +27,7 @@ if have_vhost
> > > system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SND', if_true: files('vhost-user-snd.c'))
> > > system_virtio_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c'))
> > > system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SPI', if_true: files('vhost-user-spi.c'))
> > > + system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RTC', if_true: files('vhost-user-rtc.c'))
> > >
> > > # PCI Stubs
> > > system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_TEST'],
> > > @@ -43,6 +44,8 @@ if have_vhost
> > > if_true: files('vhost-user-input-pci.c'))
> > > system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SPI'],
> > > if_true: files('vhost-user-spi-pci.c'))
> > > + system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_RTC'],
> > > + if_true: files('vhost-user-rtc-pci.c'))
> > > endif
> > > if have_vhost_vdpa
> > > system_virtio_ss.add(files('vhost-vdpa.c'))
> > > diff --git a/hw/virtio/vhost-user-rtc-pci.c b/hw/virtio/vhost-user-rtc-pci.c
> > > new file mode 100644
> > > index 0000000000000000000000000000000000000000..449368d27009acde20aa4af2542a912ac8b82cbc
> > > --- /dev/null
> > > +++ b/hw/virtio/vhost-user-rtc-pci.c
> > > @@ -0,0 +1,70 @@
> > > +/*
> > > + * Vhost-user RTC virtio device PCI glue
> > > + *
> > > + * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > > + * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
> > > + *
> > > + * SPDX-License-Identifier: GPL-2.0-or-later
> > > + */
> > > +
> > > +#include "qemu/osdep.h"
> > > +#include "hw/virtio/vhost-user-rtc.h"
> > > +#include "hw/virtio/virtio-pci.h"
> > > +
> > > +struct VHostUserRTCPCI {
> > > + VirtIOPCIProxy parent_obj;
> > > + VHostUserRTC vdev;
> > > +};
> > > +
> > > +typedef struct VHostUserRTCPCI VHostUserRTCPCI;
> > > +
> > > +#define TYPE_VHOST_USER_RTC_PCI "vhost-user-rtc-pci-base"
> > > +
> > > +DECLARE_INSTANCE_CHECKER(VHostUserRTCPCI, VHOST_USER_RTC_PCI,
> > > + TYPE_VHOST_USER_RTC_PCI)
> > > +
> > > +static void vhost_user_rtc_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
> > > +{
> > > + VHostUserRTCPCI *dev = VHOST_USER_RTC_PCI(vpci_dev);
> > > + DeviceState *vdev = DEVICE(&dev->vdev);
> > > +
> > > + vpci_dev->nvectors = 1;
> > > +
> > > + qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
> > > +}
> > > +
> > > +static void vhost_user_rtc_pci_class_init(ObjectClass *klass, const void *data)
> > > +{
> > > + DeviceClass *dc = DEVICE_CLASS(klass);
> > > + VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
> > > + PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
> > > + k->realize = vhost_user_rtc_pci_realize;
> > > + set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> > > + pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
> > > + pcidev_k->device_id = 0; /* Set by virtio-pci based on virtio id */
> > > + pcidev_k->revision = 0x00;
> > > + pcidev_k->class_id = PCI_CLASS_SYSTEM_RTC;
> > > +}
> > > +
> > > +static void vhost_user_rtc_pci_instance_init(Object *obj)
> > > +{
> > > + VHostUserRTCPCI *dev = VHOST_USER_RTC_PCI(obj);
> > > +
> > > + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
> > > + TYPE_VHOST_USER_RTC);
> > > +}
> > > +
> > > +static const VirtioPCIDeviceTypeInfo vhost_user_rtc_pci_info = {
> > > + .base_name = TYPE_VHOST_USER_RTC_PCI,
> > > + .non_transitional_name = "vhost-user-rtc-pci",
> > > + .instance_size = sizeof(VHostUserRTCPCI),
> > > + .instance_init = vhost_user_rtc_pci_instance_init,
> > > + .class_init = vhost_user_rtc_pci_class_init,
> > > +};
> > > +
> > > +static void vhost_user_rtc_pci_register(void)
> > > +{
> > > + virtio_pci_types_register(&vhost_user_rtc_pci_info);
> > > +}
> > > +
> > > +type_init(vhost_user_rtc_pci_register);
> > > diff --git a/hw/virtio/vhost-user-rtc.c b/hw/virtio/vhost-user-rtc.c
> > > new file mode 100644
> > > index 0000000000000000000000000000000000000000..88b0c70b903363fc9ac7ccb65a1b1755e095c6bc
> > > --- /dev/null
> > > +++ b/hw/virtio/vhost-user-rtc.c
> > > @@ -0,0 +1,64 @@
> > > +/*
> > > + * Vhost-user RTC virtio device
> > > + *
> > > + * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> > > + * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
> > > + *
> > > + * Simple wrapper of the generic vhost-user-device.
> > > + *
> > > + * SPDX-License-Identifier: GPL-2.0-or-later
> > > + */
> > > +
> > > +#include "qemu/osdep.h"
> > > +#include "qapi/error.h"
> > > +#include "hw/virtio/vhost-user-rtc.h"
> > > +#include "standard-headers/linux/virtio_ids.h"
> > > +
> > > +static const VMStateDescription vu_rtc_vmstate = {
> > > + .name = "vhost-user-rtc",
> > > + .unmigratable = 1,
> > > +};
> > > +
> > > +static const Property vrtc_properties[] = {
> > > + DEFINE_PROP_CHR("chardev", VHostUserBase, chardev),
> > > +};
> > > +
> > > +static void vu_rtc_base_realize(DeviceState *dev, Error **errp)
> > > +{
> > > + VHostUserBase *vub = VHOST_USER_BASE(dev);
> > > + VHostUserBaseClass *vubs = VHOST_USER_BASE_GET_CLASS(dev);
> > > +
> > > + vub->virtio_id = VIRTIO_ID_CLOCK;
> > > + vub->num_vqs = 2;
> > > + vub->config_size = 0;
> > > + vub->vq_size = 1024;
> > > +
> > > + vubs->parent_realize(dev, errp);
> > > +}
> > > +
> > > +static void vu_rtc_class_init(ObjectClass *klass, const void *data)
> > > +{
> > > + DeviceClass *dc = DEVICE_CLASS(klass);
> > > + VHostUserBaseClass *vubc = VHOST_USER_BASE_CLASS(klass);
> > > +
> > > + dc->vmsd = &vu_rtc_vmstate;
> > > + device_class_set_props(dc, vrtc_properties);
> > > + device_class_set_parent_realize(dc, vu_rtc_base_realize,
> > > + &vubc->parent_realize);
> > > +
> > > + set_bit(DEVICE_CATEGORY_MISC, dc->categories);
> > > +}
> > > +
> > > +static const TypeInfo vu_rtc_info = {
> > > + .name = TYPE_VHOST_USER_RTC,
> > > + .parent = TYPE_VHOST_USER_BASE,
> > > + .instance_size = sizeof(VHostUserRTC),
> > > + .class_init = vu_rtc_class_init,
> > > +};
> > > +
> > > +static void vu_rtc_register_types(void)
> > > +{
> > > + type_register_static(&vu_rtc_info);
> > > +}
> > > +
> > > +type_init(vu_rtc_register_types)
> > >
> > > ---
> > > base-commit: da6c4fe60fee30dd77267764d55b38af9cb89d4b
> > > change-id: 20260416-vhost-user-rtc-ce8ff0377356
> > >
> > > --
> > > γαῖα πυρί μιχθήτω
> > >
> > >
> >
> > With regards,
> > Daniel
> > --
> > |: https://berrange.com ~~ https://hachyderm.io/@berrange :|
> > |: https://libvirt.org ~~ https://entangle-photo.org :|
> > |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
> >
>
>
>
> --
> Manos Pitsidianakis
> Emulation and Virtualization Engineer at Linaro Ltd
>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-16 7:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-16 5:54 [PATCH] virtio: Add vhost-user-rtc and vhost-user-rtc-pci Manos Pitsidianakis
2026-04-16 7:18 ` Daniel P. Berrangé
2026-04-16 7:23 ` Manos Pitsidianakis
2026-04-16 7:55 ` Daniel P. Berrangé
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.