Eric Auger | 62d9551 | 2016-02-19 09:42:29 -0700 | [diff] [blame] | 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 | |
Peter Maydell | 974dc73 | 2016-02-23 12:00:47 +0000 | [diff] [blame] | 14 | #include "qemu/osdep.h" |
Eric Auger | 62d9551 | 2016-02-19 09:42:29 -0700 | [diff] [blame] | 15 | #include "hw/vfio/vfio-amd-xgbe.h" |
| 16 | |
| 17 | static void amd_xgbe_realize(DeviceState *dev, Error **errp) |
| 18 | { |
| 19 | VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev); |
| 20 | VFIOAmdXgbeDeviceClass *k = VFIO_AMD_XGBE_DEVICE_GET_CLASS(dev); |
| 21 | |
| 22 | vdev->compat = g_strdup("amd,xgbe-seattle-v1a"); |
| 23 | |
| 24 | k->parent_realize(dev, errp); |
| 25 | } |
| 26 | |
| 27 | static const VMStateDescription vfio_platform_amd_xgbe_vmstate = { |
| 28 | .name = TYPE_VFIO_AMD_XGBE, |
| 29 | .unmigratable = 1, |
| 30 | }; |
| 31 | |
| 32 | static void vfio_amd_xgbe_class_init(ObjectClass *klass, void *data) |
| 33 | { |
| 34 | DeviceClass *dc = DEVICE_CLASS(klass); |
| 35 | VFIOAmdXgbeDeviceClass *vcxc = |
| 36 | VFIO_AMD_XGBE_DEVICE_CLASS(klass); |
Philippe Mathieu-Daudé | bf85388 | 2018-01-13 23:04:12 -0300 | [diff] [blame^] | 37 | device_class_set_parent_realize(dc, amd_xgbe_realize, |
| 38 | &vcxc->parent_realize); |
Eric Auger | 62d9551 | 2016-02-19 09:42:29 -0700 | [diff] [blame] | 39 | dc->desc = "VFIO AMD XGBE"; |
| 40 | dc->vmsd = &vfio_platform_amd_xgbe_vmstate; |
Eduardo Habkost | e4f4fb1 | 2017-05-03 17:35:45 -0300 | [diff] [blame] | 41 | /* Supported by TYPE_VIRT_MACHINE */ |
| 42 | dc->user_creatable = true; |
Eric Auger | 62d9551 | 2016-02-19 09:42:29 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | static const TypeInfo vfio_amd_xgbe_dev_info = { |
| 46 | .name = TYPE_VFIO_AMD_XGBE, |
| 47 | .parent = TYPE_VFIO_PLATFORM, |
| 48 | .instance_size = sizeof(VFIOAmdXgbeDevice), |
| 49 | .class_init = vfio_amd_xgbe_class_init, |
| 50 | .class_size = sizeof(VFIOAmdXgbeDeviceClass), |
| 51 | }; |
| 52 | |
| 53 | static void register_amd_xgbe_dev_type(void) |
| 54 | { |
| 55 | type_register_static(&vfio_amd_xgbe_dev_info); |
| 56 | } |
| 57 | |
| 58 | type_init(register_amd_xgbe_dev_type) |