blob: 96bd608b8dd0bd46764236989d581057aacd0f58 [file] [log] [blame]
Eric Auger62d95512016-02-19 09:42:29 -07001/*
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
Peter Maydell974dc732016-02-23 12:00:47 +000014#include "qemu/osdep.h"
Eric Auger62d95512016-02-19 09:42:29 -070015#include "hw/vfio/vfio-amd-xgbe.h"
Markus Armbrusterd6454272019-08-12 07:23:45 +020016#include "migration/vmstate.h"
Markus Armbruster0b8fa322019-05-23 16:35:07 +020017#include "qemu/module.h"
Eric Auger62d95512016-02-19 09:42:29 -070018
19static 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");
Eric Augera49531e2018-10-15 10:52:09 -060025 vdev->num_compat = 1;
Eric Auger62d95512016-02-19 09:42:29 -070026
27 k->parent_realize(dev, errp);
28}
29
30static const VMStateDescription vfio_platform_amd_xgbe_vmstate = {
Li Qiangda56e332019-05-21 08:15:41 -070031 .name = "vfio-amd-xgbe",
Eric Auger62d95512016-02-19 09:42:29 -070032 .unmigratable = 1,
33};
34
35static 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);
Philippe Mathieu-Daudébf853882018-01-13 23:04:12 -030040 device_class_set_parent_realize(dc, amd_xgbe_realize,
41 &vcxc->parent_realize);
Eric Auger62d95512016-02-19 09:42:29 -070042 dc->desc = "VFIO AMD XGBE";
43 dc->vmsd = &vfio_platform_amd_xgbe_vmstate;
Eduardo Habkoste4f4fb12017-05-03 17:35:45 -030044 /* Supported by TYPE_VIRT_MACHINE */
45 dc->user_creatable = true;
Eric Auger62d95512016-02-19 09:42:29 -070046}
47
48static const TypeInfo vfio_amd_xgbe_dev_info = {
49 .name = TYPE_VFIO_AMD_XGBE,
50 .parent = TYPE_VFIO_PLATFORM,
51 .instance_size = sizeof(VFIOAmdXgbeDevice),
52 .class_init = vfio_amd_xgbe_class_init,
53 .class_size = sizeof(VFIOAmdXgbeDeviceClass),
54};
55
56static void register_amd_xgbe_dev_type(void)
57{
58 type_register_static(&vfio_amd_xgbe_dev_info);
59}
60
61type_init(register_amd_xgbe_dev_type)