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