target/i386: reimplement 0x0f 0x50-0x5f, add AVX
[qemu.git] / tests / qtest / virtio-rng-test.c
blob64e131cd8c9aa2396da4471a723ba32b57c95f8a
1 /*
2 * QTest testcase for VirtIO RNG
4 * Copyright (c) 2014 SUSE LINUX Products GmbH
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
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"
16 #define PCI_SLOT_HP 0x06
18 static void rng_hotplug(void *obj, void *data, QGuestAllocator *alloc)
20 QVirtioPCIDevice *dev = obj;
21 QTestState *qts = dev->pdev->bus->qts;
23 if (dev->pdev->bus->not_hotpluggable) {
24 g_test_skip("pci bus does not support hotplug");
25 return;
28 const char *arch = qtest_get_arch();
30 qtest_qmp_device_add(qts, "virtio-rng-pci", "rng1",
31 "{'addr': %s}", stringify(PCI_SLOT_HP));
33 if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
34 qpci_unplug_acpi_device_test(qts, "rng1", PCI_SLOT_HP);
38 static void register_virtio_rng_test(void)
40 qos_add_test("hotplug", "virtio-rng-pci", rng_hotplug, NULL);
43 libqos_init(register_virtio_rng_test);