1
2
3
4
5
6
7
8
9
10#include "qemu/osdep.h"
11#include "libqtest.h"
12#include "libqos/qgraph.h"
13#include "libqos/virtio-rng.h"
14
15#define PCI_SLOT_HP 0x06
16
17static void rng_hotplug(void *obj, void *data, QGuestAllocator *alloc)
18{
19 const char *arch = qtest_get_arch();
20
21 qtest_qmp_device_add("virtio-rng-pci", "rng1",
22 "{'addr': %s}", stringify(PCI_SLOT_HP));
23
24 if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
25 qpci_unplug_acpi_device_test("rng1", PCI_SLOT_HP);
26 }
27}
28
29static void register_virtio_rng_test(void)
30{
31 qos_add_test("hotplug", "virtio-rng-pci", rng_hotplug, NULL);
32}
33
34libqos_init(register_virtio_rng_test);
35