#include "hw/s390x/ap-device.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
-#include "qemu/queue.h"
#include "qemu/option.h"
#include "qemu/config-file.h"
#include "cpu.h"
#include "kvm_s390x.h"
-#include "sysemu/sysemu.h"
+#include "migration/vmstate.h"
+#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)
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;
}
{
int ret;
char *mdevid;
- Error *local_err = NULL;
VFIOGroup *vfio_group;
APDevice *apdev = AP_DEVICE(dev);
VFIOAPDevice *vapdev = VFIO_AP_DEVICE(apdev);
- vfio_group = vfio_ap_get_group(vapdev, &local_err);
+ vfio_group = vfio_ap_get_group(vapdev, errp);
if (!vfio_group) {
- goto out_err;
+ return;
}
vapdev->vdev.ops = &vfio_ap_ops;
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, &local_err);
+ ret = vfio_get_device(vfio_group, mdevid, &vapdev->vdev, errp);
if (ret) {
goto out_get_dev_err;
}
out_get_dev_err:
vfio_ap_put_device(vapdev);
vfio_put_group(vfio_group);
-out_err:
- error_propagate(errp, local_err);
}
-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);
{
DeviceClass *dc = DEVICE_CLASS(klass);
- dc->props = vfio_ap_properties;
+ device_class_set_props(dc, vfio_ap_properties);
dc->vmsd = &vfio_ap_vmstate;
dc->desc = "VFIO-based AP device assignment";
set_bit(DEVICE_CATEGORY_MISC, dc->categories);