]> git.proxmox.com Git - mirror_qemu.git/blobdiff - hw/vfio/ap.c
Move QOM typedefs and add missing includes
[mirror_qemu.git] / hw / vfio / ap.c
index 8649ac15f9465fbe5e9c73cf0b4deca82484b7cd..eb74e57b23d89a29b2820a56bc5d170c9f0c5345 100644 (file)
 #include "hw/qdev-properties.h"
 #include "hw/s390x/ap-bridge.h"
 #include "exec/address-spaces.h"
+#include "qom/object.h"
 
 #define VFIO_AP_DEVICE_TYPE      "vfio-ap"
 
-typedef struct VFIOAPDevice {
+struct VFIOAPDevice {
     APDevice apdev;
     VFIODevice vdev;
-} VFIOAPDevice;
+};
+typedef struct VFIOAPDevice VFIOAPDevice;
 
 #define VFIO_AP_DEVICE(obj) \
         OBJECT_CHECK(VFIOAPDevice, (obj), VFIO_AP_DEVICE_TYPE)
@@ -71,6 +73,7 @@ static VFIOGroup *vfio_ap_get_group(VFIOAPDevice *vapdev, Error **errp)
     if (!group_path) {
         error_setg(errp, "%s: no iommu_group found for %s: %s",
                    VFIO_AP_DEVICE_TYPE, vapdev->vdev.sysfsdev, gerror->message);
+        g_error_free(gerror);
         return NULL;
     }
 
@@ -105,12 +108,12 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)
     vapdev->vdev.dev = dev;
 
     /*
-     * vfio-ap devices operate in a way compatible with
-     * memory ballooning, as no pages are pinned in the host.
+     * vfio-ap devices operate in a way compatible with discarding of
+     * memory in RAM blocks, as no pages are pinned in the host.
      * This needs to be set before vfio_get_device() for vfio common to
-     * handle the balloon inhibitor.
+     * handle ram_block_discard_disable().
      */
-    vapdev->vdev.balloon_allowed = true;
+    vapdev->vdev.ram_block_discard_allowed = true;
 
     ret = vfio_get_device(vfio_group, mdevid, &vapdev->vdev, errp);
     if (ret) {
@@ -124,7 +127,7 @@ out_get_dev_err:
     vfio_put_group(vfio_group);
 }
 
-static void vfio_ap_unrealize(DeviceState *dev, Error **errp)
+static void vfio_ap_unrealize(DeviceState *dev)
 {
     APDevice *apdev = AP_DEVICE(dev);
     VFIOAPDevice *vapdev = VFIO_AP_DEVICE(apdev);