Coverage Report

Created: 2026-10-31 08:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qemu/hw/virtio/vhost-user-rtc.c
Line
Count
Source
1
/*
2
 * Vhost-user RTC virtio device
3
 *
4
 * Copyright (c) 2025 Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
5
 * Copyright 2026 Panasonic Automotive Systems Co., Ltd.
6
 *
7
 * Simple wrapper of the generic vhost-user-device.
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include "qemu/osdep.h"
13
#include "qapi/error.h"
14
#include "hw/virtio/vhost-user-rtc.h"
15
#include "standard-headers/linux/virtio_ids.h"
16
17
static const VMStateDescription vu_rtc_vmstate = {
18
    .name = "vhost-user-rtc",
19
    .unmigratable = 1,
20
};
21
22
static const Property vrtc_properties[] = {
23
    DEFINE_PROP_CHR("chardev", VHostUserBase, chardev),
24
};
25
26
static void vu_rtc_base_realize(DeviceState *dev, Error **errp)
27
0
{
28
0
    VHostUserBase *vub = VHOST_USER_BASE(dev);
29
0
    VHostUserBaseClass *vubs = VHOST_USER_BASE_GET_CLASS(dev);
30
31
0
    vub->virtio_id = VIRTIO_ID_CLOCK;
32
0
    vub->num_vqs = 2;
33
0
    vub->config_size = 0;
34
0
    vub->vq_size = 1024;
35
36
0
    vubs->parent_realize(dev, errp);
37
0
}
38
39
static void vu_rtc_class_init(ObjectClass *klass, const void *data)
40
61
{
41
61
    DeviceClass *dc = DEVICE_CLASS(klass);
42
61
    VHostUserBaseClass *vubc = VHOST_USER_BASE_CLASS(klass);
43
44
61
    dc->vmsd = &vu_rtc_vmstate;
45
61
    device_class_set_props(dc, vrtc_properties);
46
61
    device_class_set_parent_realize(dc, vu_rtc_base_realize,
47
61
                                    &vubc->parent_realize);
48
49
61
    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
50
61
}
51
52
static const TypeInfo vu_rtc_info = {
53
    .name = TYPE_VHOST_USER_RTC,
54
    .parent = TYPE_VHOST_USER_BASE,
55
    .instance_size = sizeof(VHostUserRTC),
56
    .class_init = vu_rtc_class_init,
57
};
58
59
static void vu_rtc_register_types(void)
60
61
{
61
61
    type_register_static(&vu_rtc_info);
62
61
}
63
64
type_init(vu_rtc_register_types)