xref: /qemu/hw/vfio/amd-xgbe.c (revision 513823e7521a09ed7ad1e32e6454bac3b2cbf52d)
1 /*
2  * AMD XGBE VFIO device
3  *
4  * Copyright Linaro Limited, 2015
5  *
6  * Authors:
7  *  Eric Auger <eric.auger@linaro.org>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  *
12  */
13 
14 #include "qemu/osdep.h"
15 #include "hw/vfio/vfio-amd-xgbe.h"
16 #include "migration/vmstate.h"
17 #include "qemu/module.h"
18 
19 static void amd_xgbe_realize(DeviceState *dev, Error **errp)
20 {
21     VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
22     VFIOAmdXgbeDeviceClass *k = VFIO_AMD_XGBE_DEVICE_GET_CLASS(dev);
23 
24     vdev->compat = g_strdup("amd,xgbe-seattle-v1a");
25     vdev->num_compat = 1;
26 
27     k->parent_realize(dev, errp);
28 }
29 
30 static const VMStateDescription vfio_platform_amd_xgbe_vmstate = {
31     .name = "vfio-amd-xgbe",
32     .unmigratable = 1,
33 };
34 
35 static void vfio_amd_xgbe_class_init(ObjectClass *klass, void *data)
36 {
37     DeviceClass *dc = DEVICE_CLASS(klass);
38     VFIOAmdXgbeDeviceClass *vcxc =
39         VFIO_AMD_XGBE_DEVICE_CLASS(klass);
40     device_class_set_parent_realize(dc, amd_xgbe_realize,
41                                     &vcxc->parent_realize);
42     dc->desc = "VFIO AMD XGBE";
43     dc->vmsd = &vfio_platform_amd_xgbe_vmstate;
44 }
45 
46 static const TypeInfo vfio_amd_xgbe_dev_info = {
47     .name = TYPE_VFIO_AMD_XGBE,
48     .parent = TYPE_VFIO_PLATFORM,
49     .instance_size = sizeof(VFIOAmdXgbeDevice),
50     .class_init = vfio_amd_xgbe_class_init,
51     .class_size = sizeof(VFIOAmdXgbeDeviceClass),
52 };
53 
54 static void register_amd_xgbe_dev_type(void)
55 {
56     type_register_static(&vfio_amd_xgbe_dev_info);
57 }
58 
59 type_init(register_amd_xgbe_dev_type)
60