target/arm/arm-semi: Use set_swi_errno() in gdbstub callback functions
[qemu/ar7.git] / hw / vfio / platform.c
blobd7598c615299acde3e0b619b0f9233a385a0dea7
1 /*
2 * vfio based device assignment support - platform devices
4 * Copyright Linaro Limited, 2014
6 * Authors:
7 * Kim Phillips <kim.phillips@linaro.org>
8 * Eric Auger <eric.auger@linaro.org>
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
13 * Based on vfio based PCI device assignment support:
14 * Copyright Red Hat, Inc. 2012
17 #include "qemu/osdep.h"
18 #include "qapi/error.h"
19 #include <sys/ioctl.h>
20 #include <linux/vfio.h>
22 #include "hw/vfio/vfio-platform.h"
23 #include "migration/vmstate.h"
24 #include "qemu/error-report.h"
25 #include "qemu/main-loop.h"
26 #include "qemu/module.h"
27 #include "qemu/range.h"
28 #include "exec/memory.h"
29 #include "exec/address-spaces.h"
30 #include "qemu/queue.h"
31 #include "hw/sysbus.h"
32 #include "trace.h"
33 #include "hw/irq.h"
34 #include "hw/platform-bus.h"
35 #include "hw/qdev-properties.h"
36 #include "sysemu/kvm.h"
39 * Functions used whatever the injection method
42 static inline bool vfio_irq_is_automasked(VFIOINTp *intp)
44 return intp->flags & VFIO_IRQ_INFO_AUTOMASKED;
47 /**
48 * vfio_init_intp - allocate, initialize the IRQ struct pointer
49 * and add it into the list of IRQs
50 * @vbasedev: the VFIO device handle
51 * @info: irq info struct retrieved from VFIO driver
52 * @errp: error object
54 static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,
55 struct vfio_irq_info info, Error **errp)
57 int ret;
58 VFIOPlatformDevice *vdev =
59 container_of(vbasedev, VFIOPlatformDevice, vbasedev);
60 SysBusDevice *sbdev = SYS_BUS_DEVICE(vdev);
61 VFIOINTp *intp;
63 intp = g_malloc0(sizeof(*intp));
64 intp->vdev = vdev;
65 intp->pin = info.index;
66 intp->flags = info.flags;
67 intp->state = VFIO_IRQ_INACTIVE;
68 intp->kvm_accel = false;
70 sysbus_init_irq(sbdev, &intp->qemuirq);
72 /* Get an eventfd for trigger */
73 intp->interrupt = g_malloc0(sizeof(EventNotifier));
74 ret = event_notifier_init(intp->interrupt, 0);
75 if (ret) {
76 g_free(intp->interrupt);
77 g_free(intp);
78 error_setg_errno(errp, -ret,
79 "failed to initialize trigger eventfd notifier");
80 return NULL;
82 if (vfio_irq_is_automasked(intp)) {
83 /* Get an eventfd for resample/unmask */
84 intp->unmask = g_malloc0(sizeof(EventNotifier));
85 ret = event_notifier_init(intp->unmask, 0);
86 if (ret) {
87 g_free(intp->interrupt);
88 g_free(intp->unmask);
89 g_free(intp);
90 error_setg_errno(errp, -ret,
91 "failed to initialize resample eventfd notifier");
92 return NULL;
96 QLIST_INSERT_HEAD(&vdev->intp_list, intp, next);
97 return intp;
101 * vfio_set_trigger_eventfd - set VFIO eventfd handling
103 * @intp: IRQ struct handle
104 * @handler: handler to be called on eventfd signaling
106 * Setup VFIO signaling and attach an optional user-side handler
107 * to the eventfd
109 static int vfio_set_trigger_eventfd(VFIOINTp *intp,
110 eventfd_user_side_handler_t handler)
112 VFIODevice *vbasedev = &intp->vdev->vbasedev;
113 int32_t fd = event_notifier_get_fd(intp->interrupt);
114 Error *err = NULL;
115 int ret;
117 qemu_set_fd_handler(fd, (IOHandler *)handler, NULL, intp);
119 ret = vfio_set_irq_signaling(vbasedev, intp->pin, 0,
120 VFIO_IRQ_SET_ACTION_TRIGGER, fd, &err);
121 if (ret) {
122 error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name);
123 qemu_set_fd_handler(fd, NULL, NULL, NULL);
126 return ret;
130 * Functions only used when eventfds are handled on user-side
131 * ie. without irqfd
135 * vfio_mmap_set_enabled - enable/disable the fast path mode
136 * @vdev: the VFIO platform device
137 * @enabled: the target mmap state
139 * enabled = true ~ fast path = MMIO region is mmaped (no KVM TRAP);
140 * enabled = false ~ slow path = MMIO region is trapped and region callbacks
141 * are called; slow path enables to trap the device IRQ status register reset
144 static void vfio_mmap_set_enabled(VFIOPlatformDevice *vdev, bool enabled)
146 int i;
148 for (i = 0; i < vdev->vbasedev.num_regions; i++) {
149 vfio_region_mmaps_set_enabled(vdev->regions[i], enabled);
154 * vfio_intp_mmap_enable - timer function, restores the fast path
155 * if there is no more active IRQ
156 * @opaque: actually points to the VFIO platform device
158 * Called on mmap timer timout, this function checks whether the
159 * IRQ is still active and if not, restores the fast path.
160 * by construction a single eventfd is handled at a time.
161 * if the IRQ is still active, the timer is re-programmed.
163 static void vfio_intp_mmap_enable(void *opaque)
165 VFIOINTp *tmp;
166 VFIOPlatformDevice *vdev = (VFIOPlatformDevice *)opaque;
168 qemu_mutex_lock(&vdev->intp_mutex);
169 QLIST_FOREACH(tmp, &vdev->intp_list, next) {
170 if (tmp->state == VFIO_IRQ_ACTIVE) {
171 trace_vfio_platform_intp_mmap_enable(tmp->pin);
172 /* re-program the timer to check active status later */
173 timer_mod(vdev->mmap_timer,
174 qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
175 vdev->mmap_timeout);
176 qemu_mutex_unlock(&vdev->intp_mutex);
177 return;
180 vfio_mmap_set_enabled(vdev, true);
181 qemu_mutex_unlock(&vdev->intp_mutex);
185 * vfio_intp_inject_pending_lockheld - Injects a pending IRQ
186 * @opaque: opaque pointer, in practice the VFIOINTp handle
188 * The function is called on a previous IRQ completion, from
189 * vfio_platform_eoi, while the intp_mutex is locked.
190 * Also in such situation, the slow path already is set and
191 * the mmap timer was already programmed.
193 static void vfio_intp_inject_pending_lockheld(VFIOINTp *intp)
195 trace_vfio_platform_intp_inject_pending_lockheld(intp->pin,
196 event_notifier_get_fd(intp->interrupt));
198 intp->state = VFIO_IRQ_ACTIVE;
200 /* trigger the virtual IRQ */
201 qemu_set_irq(intp->qemuirq, 1);
205 * vfio_intp_interrupt - The user-side eventfd handler
206 * @opaque: opaque pointer which in practice is the VFIOINTp handle
208 * the function is entered in event handler context:
209 * the vIRQ is injected into the guest if there is no other active
210 * or pending IRQ.
212 static void vfio_intp_interrupt(VFIOINTp *intp)
214 int ret;
215 VFIOINTp *tmp;
216 VFIOPlatformDevice *vdev = intp->vdev;
217 bool delay_handling = false;
219 qemu_mutex_lock(&vdev->intp_mutex);
220 if (intp->state == VFIO_IRQ_INACTIVE) {
221 QLIST_FOREACH(tmp, &vdev->intp_list, next) {
222 if (tmp->state == VFIO_IRQ_ACTIVE ||
223 tmp->state == VFIO_IRQ_PENDING) {
224 delay_handling = true;
225 break;
229 if (delay_handling) {
231 * the new IRQ gets a pending status and is pushed in
232 * the pending queue
234 intp->state = VFIO_IRQ_PENDING;
235 trace_vfio_intp_interrupt_set_pending(intp->pin);
236 QSIMPLEQ_INSERT_TAIL(&vdev->pending_intp_queue,
237 intp, pqnext);
238 ret = event_notifier_test_and_clear(intp->interrupt);
239 qemu_mutex_unlock(&vdev->intp_mutex);
240 return;
243 trace_vfio_platform_intp_interrupt(intp->pin,
244 event_notifier_get_fd(intp->interrupt));
246 ret = event_notifier_test_and_clear(intp->interrupt);
247 if (!ret) {
248 error_report("Error when clearing fd=%d (ret = %d)",
249 event_notifier_get_fd(intp->interrupt), ret);
252 intp->state = VFIO_IRQ_ACTIVE;
254 /* sets slow path */
255 vfio_mmap_set_enabled(vdev, false);
257 /* trigger the virtual IRQ */
258 qemu_set_irq(intp->qemuirq, 1);
261 * Schedule the mmap timer which will restore fastpath when no IRQ
262 * is active anymore
264 if (vdev->mmap_timeout) {
265 timer_mod(vdev->mmap_timer,
266 qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
267 vdev->mmap_timeout);
269 qemu_mutex_unlock(&vdev->intp_mutex);
273 * vfio_platform_eoi - IRQ completion routine
274 * @vbasedev: the VFIO device handle
276 * De-asserts the active virtual IRQ and unmasks the physical IRQ
277 * (effective for level sensitive IRQ auto-masked by the VFIO driver).
278 * Then it handles next pending IRQ if any.
279 * eoi function is called on the first access to any MMIO region
280 * after an IRQ was triggered, trapped since slow path was set.
281 * It is assumed this access corresponds to the IRQ status
282 * register reset. With such a mechanism, a single IRQ can be
283 * handled at a time since there is no way to know which IRQ
284 * was completed by the guest (we would need additional details
285 * about the IRQ status register mask).
287 static void vfio_platform_eoi(VFIODevice *vbasedev)
289 VFIOINTp *intp;
290 VFIOPlatformDevice *vdev =
291 container_of(vbasedev, VFIOPlatformDevice, vbasedev);
293 qemu_mutex_lock(&vdev->intp_mutex);
294 QLIST_FOREACH(intp, &vdev->intp_list, next) {
295 if (intp->state == VFIO_IRQ_ACTIVE) {
296 trace_vfio_platform_eoi(intp->pin,
297 event_notifier_get_fd(intp->interrupt));
298 intp->state = VFIO_IRQ_INACTIVE;
300 /* deassert the virtual IRQ */
301 qemu_set_irq(intp->qemuirq, 0);
303 if (vfio_irq_is_automasked(intp)) {
304 /* unmasks the physical level-sensitive IRQ */
305 vfio_unmask_single_irqindex(vbasedev, intp->pin);
308 /* a single IRQ can be active at a time */
309 break;
312 /* in case there are pending IRQs, handle the first one */
313 if (!QSIMPLEQ_EMPTY(&vdev->pending_intp_queue)) {
314 intp = QSIMPLEQ_FIRST(&vdev->pending_intp_queue);
315 vfio_intp_inject_pending_lockheld(intp);
316 QSIMPLEQ_REMOVE_HEAD(&vdev->pending_intp_queue, pqnext);
318 qemu_mutex_unlock(&vdev->intp_mutex);
322 * vfio_start_eventfd_injection - starts the virtual IRQ injection using
323 * user-side handled eventfds
324 * @sbdev: the sysbus device handle
325 * @irq: the qemu irq handle
328 static void vfio_start_eventfd_injection(SysBusDevice *sbdev, qemu_irq irq)
330 VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
331 VFIOINTp *intp;
333 QLIST_FOREACH(intp, &vdev->intp_list, next) {
334 if (intp->qemuirq == irq) {
335 break;
338 assert(intp);
340 if (vfio_set_trigger_eventfd(intp, vfio_intp_interrupt)) {
341 abort();
346 * Functions used for irqfd
350 * vfio_set_resample_eventfd - sets the resamplefd for an IRQ
351 * @intp: the IRQ struct handle
352 * programs the VFIO driver to unmask this IRQ when the
353 * intp->unmask eventfd is triggered
355 static int vfio_set_resample_eventfd(VFIOINTp *intp)
357 int32_t fd = event_notifier_get_fd(intp->unmask);
358 VFIODevice *vbasedev = &intp->vdev->vbasedev;
359 Error *err = NULL;
360 int ret;
362 qemu_set_fd_handler(fd, NULL, NULL, NULL);
363 ret = vfio_set_irq_signaling(vbasedev, intp->pin, 0,
364 VFIO_IRQ_SET_ACTION_UNMASK, fd, &err);
365 if (ret) {
366 error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name);
368 return ret;
372 * vfio_start_irqfd_injection - starts the virtual IRQ injection using
373 * irqfd
375 * @sbdev: the sysbus device handle
376 * @irq: the qemu irq handle
378 * In case the irqfd setup fails, we fallback to userspace handled eventfd
380 static void vfio_start_irqfd_injection(SysBusDevice *sbdev, qemu_irq irq)
382 VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
383 VFIOINTp *intp;
385 if (!kvm_irqfds_enabled() || !kvm_resamplefds_enabled() ||
386 !vdev->irqfd_allowed) {
387 goto fail_irqfd;
390 QLIST_FOREACH(intp, &vdev->intp_list, next) {
391 if (intp->qemuirq == irq) {
392 break;
395 assert(intp);
397 if (kvm_irqchip_add_irqfd_notifier(kvm_state, intp->interrupt,
398 intp->unmask, irq) < 0) {
399 goto fail_irqfd;
402 if (vfio_set_trigger_eventfd(intp, NULL) < 0) {
403 goto fail_vfio;
405 if (vfio_irq_is_automasked(intp)) {
406 if (vfio_set_resample_eventfd(intp) < 0) {
407 goto fail_vfio;
409 trace_vfio_platform_start_level_irqfd_injection(intp->pin,
410 event_notifier_get_fd(intp->interrupt),
411 event_notifier_get_fd(intp->unmask));
412 } else {
413 trace_vfio_platform_start_edge_irqfd_injection(intp->pin,
414 event_notifier_get_fd(intp->interrupt));
417 intp->kvm_accel = true;
419 return;
420 fail_vfio:
421 kvm_irqchip_remove_irqfd_notifier(kvm_state, intp->interrupt, irq);
422 abort();
423 fail_irqfd:
424 vfio_start_eventfd_injection(sbdev, irq);
425 return;
428 /* VFIO skeleton */
430 static void vfio_platform_compute_needs_reset(VFIODevice *vbasedev)
432 vbasedev->needs_reset = true;
435 /* not implemented yet */
436 static int vfio_platform_hot_reset_multi(VFIODevice *vbasedev)
438 return -1;
442 * vfio_populate_device - Allocate and populate MMIO region
443 * and IRQ structs according to driver returned information
444 * @vbasedev: the VFIO device handle
445 * @errp: error object
448 static int vfio_populate_device(VFIODevice *vbasedev, Error **errp)
450 VFIOINTp *intp, *tmp;
451 int i, ret = -1;
452 VFIOPlatformDevice *vdev =
453 container_of(vbasedev, VFIOPlatformDevice, vbasedev);
455 if (!(vbasedev->flags & VFIO_DEVICE_FLAGS_PLATFORM)) {
456 error_setg(errp, "this isn't a platform device");
457 return ret;
460 vdev->regions = g_new0(VFIORegion *, vbasedev->num_regions);
462 for (i = 0; i < vbasedev->num_regions; i++) {
463 char *name = g_strdup_printf("VFIO %s region %d\n", vbasedev->name, i);
465 vdev->regions[i] = g_new0(VFIORegion, 1);
466 ret = vfio_region_setup(OBJECT(vdev), vbasedev,
467 vdev->regions[i], i, name);
468 g_free(name);
469 if (ret) {
470 error_setg_errno(errp, -ret, "failed to get region %d info", i);
471 goto reg_error;
475 vdev->mmap_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL,
476 vfio_intp_mmap_enable, vdev);
478 QSIMPLEQ_INIT(&vdev->pending_intp_queue);
480 for (i = 0; i < vbasedev->num_irqs; i++) {
481 struct vfio_irq_info irq = { .argsz = sizeof(irq) };
483 irq.index = i;
484 ret = ioctl(vbasedev->fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
485 if (ret) {
486 error_setg_errno(errp, -ret, "failed to get device irq info");
487 goto irq_err;
488 } else {
489 trace_vfio_platform_populate_interrupts(irq.index,
490 irq.count,
491 irq.flags);
492 intp = vfio_init_intp(vbasedev, irq, errp);
493 if (!intp) {
494 ret = -1;
495 goto irq_err;
499 return 0;
500 irq_err:
501 timer_del(vdev->mmap_timer);
502 QLIST_FOREACH_SAFE(intp, &vdev->intp_list, next, tmp) {
503 QLIST_REMOVE(intp, next);
504 g_free(intp);
506 reg_error:
507 for (i = 0; i < vbasedev->num_regions; i++) {
508 if (vdev->regions[i]) {
509 vfio_region_finalize(vdev->regions[i]);
511 g_free(vdev->regions[i]);
513 g_free(vdev->regions);
514 return ret;
517 /* specialized functions for VFIO Platform devices */
518 static VFIODeviceOps vfio_platform_ops = {
519 .vfio_compute_needs_reset = vfio_platform_compute_needs_reset,
520 .vfio_hot_reset_multi = vfio_platform_hot_reset_multi,
521 .vfio_eoi = vfio_platform_eoi,
525 * vfio_base_device_init - perform preliminary VFIO setup
526 * @vbasedev: the VFIO device handle
527 * @errp: error object
529 * Implement the VFIO command sequence that allows to discover
530 * assigned device resources: group extraction, device
531 * fd retrieval, resource query.
532 * Precondition: the device name must be initialized
534 static int vfio_base_device_init(VFIODevice *vbasedev, Error **errp)
536 VFIOGroup *group;
537 VFIODevice *vbasedev_iter;
538 char *tmp, group_path[PATH_MAX], *group_name;
539 ssize_t len;
540 struct stat st;
541 int groupid;
542 int ret;
544 /* @sysfsdev takes precedence over @host */
545 if (vbasedev->sysfsdev) {
546 g_free(vbasedev->name);
547 vbasedev->name = g_path_get_basename(vbasedev->sysfsdev);
548 } else {
549 if (!vbasedev->name || strchr(vbasedev->name, '/')) {
550 error_setg(errp, "wrong host device name");
551 return -EINVAL;
554 vbasedev->sysfsdev = g_strdup_printf("/sys/bus/platform/devices/%s",
555 vbasedev->name);
558 if (stat(vbasedev->sysfsdev, &st) < 0) {
559 error_setg_errno(errp, errno,
560 "failed to get the sysfs host device file status");
561 return -errno;
564 tmp = g_strdup_printf("%s/iommu_group", vbasedev->sysfsdev);
565 len = readlink(tmp, group_path, sizeof(group_path));
566 g_free(tmp);
568 if (len < 0 || len >= sizeof(group_path)) {
569 ret = len < 0 ? -errno : -ENAMETOOLONG;
570 error_setg_errno(errp, -ret, "no iommu_group found");
571 return ret;
574 group_path[len] = 0;
576 group_name = basename(group_path);
577 if (sscanf(group_name, "%d", &groupid) != 1) {
578 error_setg_errno(errp, errno, "failed to read %s", group_path);
579 return -errno;
582 trace_vfio_platform_base_device_init(vbasedev->name, groupid);
584 group = vfio_get_group(groupid, &address_space_memory, errp);
585 if (!group) {
586 return -ENOENT;
589 QLIST_FOREACH(vbasedev_iter, &group->device_list, next) {
590 if (strcmp(vbasedev_iter->name, vbasedev->name) == 0) {
591 error_setg(errp, "device is already attached");
592 vfio_put_group(group);
593 return -EBUSY;
596 ret = vfio_get_device(group, vbasedev->name, vbasedev, errp);
597 if (ret) {
598 vfio_put_group(group);
599 return ret;
602 ret = vfio_populate_device(vbasedev, errp);
603 if (ret) {
604 vfio_put_group(group);
607 return ret;
611 * vfio_platform_realize - the device realize function
612 * @dev: device state pointer
613 * @errp: error
615 * initialize the device, its memory regions and IRQ structures
616 * IRQ are started separately
618 static void vfio_platform_realize(DeviceState *dev, Error **errp)
620 VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
621 SysBusDevice *sbdev = SYS_BUS_DEVICE(dev);
622 VFIODevice *vbasedev = &vdev->vbasedev;
623 int i, ret;
625 vbasedev->type = VFIO_DEVICE_TYPE_PLATFORM;
626 vbasedev->dev = dev;
627 vbasedev->ops = &vfio_platform_ops;
629 qemu_mutex_init(&vdev->intp_mutex);
631 trace_vfio_platform_realize(vbasedev->sysfsdev ?
632 vbasedev->sysfsdev : vbasedev->name,
633 vdev->compat);
635 ret = vfio_base_device_init(vbasedev, errp);
636 if (ret) {
637 goto out;
640 if (!vdev->compat) {
641 GError *gerr = NULL;
642 gchar *contents;
643 gsize length;
644 char *path;
646 path = g_strdup_printf("%s/of_node/compatible", vbasedev->sysfsdev);
647 if (!g_file_get_contents(path, &contents, &length, &gerr)) {
648 error_setg(errp, "%s", gerr->message);
649 g_error_free(gerr);
650 g_free(path);
651 return;
653 g_free(path);
654 vdev->compat = contents;
655 for (vdev->num_compat = 0; length; vdev->num_compat++) {
656 size_t skip = strlen(contents) + 1;
657 contents += skip;
658 length -= skip;
662 for (i = 0; i < vbasedev->num_regions; i++) {
663 if (vfio_region_mmap(vdev->regions[i])) {
664 warn_report("%s mmap unsupported, performance may be slow",
665 memory_region_name(vdev->regions[i]->mem));
667 sysbus_init_mmio(sbdev, vdev->regions[i]->mem);
669 out:
670 if (!ret) {
671 return;
674 if (vdev->vbasedev.name) {
675 error_prepend(errp, VFIO_MSG_PREFIX, vdev->vbasedev.name);
676 } else {
677 error_prepend(errp, "vfio error: ");
681 static const VMStateDescription vfio_platform_vmstate = {
682 .name = "vfio-platform",
683 .unmigratable = 1,
686 static Property vfio_platform_dev_properties[] = {
687 DEFINE_PROP_STRING("host", VFIOPlatformDevice, vbasedev.name),
688 DEFINE_PROP_STRING("sysfsdev", VFIOPlatformDevice, vbasedev.sysfsdev),
689 DEFINE_PROP_BOOL("x-no-mmap", VFIOPlatformDevice, vbasedev.no_mmap, false),
690 DEFINE_PROP_UINT32("mmap-timeout-ms", VFIOPlatformDevice,
691 mmap_timeout, 1100),
692 DEFINE_PROP_BOOL("x-irqfd", VFIOPlatformDevice, irqfd_allowed, true),
693 DEFINE_PROP_END_OF_LIST(),
696 static void vfio_platform_class_init(ObjectClass *klass, void *data)
698 DeviceClass *dc = DEVICE_CLASS(klass);
699 SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
701 dc->realize = vfio_platform_realize;
702 dc->props = vfio_platform_dev_properties;
703 dc->vmsd = &vfio_platform_vmstate;
704 dc->desc = "VFIO-based platform device assignment";
705 sbc->connect_irq_notifier = vfio_start_irqfd_injection;
706 set_bit(DEVICE_CATEGORY_MISC, dc->categories);
707 /* Supported by TYPE_VIRT_MACHINE */
708 dc->user_creatable = true;
711 static const TypeInfo vfio_platform_dev_info = {
712 .name = TYPE_VFIO_PLATFORM,
713 .parent = TYPE_SYS_BUS_DEVICE,
714 .instance_size = sizeof(VFIOPlatformDevice),
715 .class_init = vfio_platform_class_init,
716 .class_size = sizeof(VFIOPlatformDeviceClass),
719 static void register_vfio_platform_dev_type(void)
721 type_register_static(&vfio_platform_dev_info);
724 type_init(register_vfio_platform_dev_type)