static void kvm_s390_flic_realize(DeviceState *dev, Error **errp)

{

    S390FLICState *fs = S390_FLIC_COMMON(dev);

    KVMS390FLICState *flic_state = KVM_S390_FLIC(dev);

    struct kvm_create_device cd = {0};

    struct kvm_device_attr test_attr = {0};

    int ret;

    Error *errp_local = NULL;



    KVM_S390_FLIC_GET_CLASS(dev)->parent_realize(dev, &errp_local);

    if (errp_local) {

        goto fail;

    }

    flic_state->fd = -1;

    if (!kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) {

        error_setg_errno(&errp_local, errno, "KVM is missing capability"

                         " KVM_CAP_DEVICE_CTRL");

        trace_flic_no_device_api(errno);

        goto fail;

    }



    cd.type = KVM_DEV_TYPE_FLIC;

    ret = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd);

    if (ret < 0) {

        error_setg_errno(&errp_local, errno, "Creating the KVM device failed");

        trace_flic_create_device(errno);

        goto fail;

    }

    flic_state->fd = cd.fd;



    /* Check clear_io_irq support */

    test_attr.group = KVM_DEV_FLIC_CLEAR_IO_IRQ;

    flic_state->clear_io_supported = !ioctl(flic_state->fd,

                                            KVM_HAS_DEVICE_ATTR, test_attr);



    fs->ais_supported = false;

    return;

fail:

    error_propagate(errp, errp_local);

}

static void kvm_s390_flic_realize(DeviceState *dev, Error **errp)

{

    S390FLICState *fs = S390_FLIC_COMMON(dev);

    KVMS390FLICState *flic_state = KVM_S390_FLIC(dev);

    struct kvm_create_device cd = {0};

    struct kvm_device_attr test_attr = {0};

    int ret;

    Error *errp_local = NULL;



    KVM_S390_FLIC_GET_CLASS(dev)->parent_realize(dev, &errp_local);

    if (errp_local) {

        goto fail;

    }

    flic_state->fd = -1;

    if (!kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) {

        error_setg_errno(&errp_local, errno, "KVM is missing capability"

                         " KVM_CAP_DEVICE_CTRL");

        trace_flic_no_device_api(errno);

        goto fail;

    }



    cd.type = KVM_DEV_TYPE_FLIC;

    ret = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd);

    if (ret < 0) {

        error_setg_errno(&errp_local, errno, "Creating the KVM device failed");

        trace_flic_create_device(errno);

        goto fail;

    }

    flic_state->fd = cd.fd;



    

    test_attr.group = KVM_DEV_FLIC_CLEAR_IO_IRQ;

    flic_state->clear_io_supported = !ioctl(flic_state->fd,

                                            KVM_HAS_DEVICE_ATTR, test_attr);



    fs->ais_supported = false;

    return;

fail:

    error_propagate(errp, errp_local);

}

static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)

{

    S390FLICState *fs = S390_FLIC_COMMON(VAR_0);

    KVMS390FLICState *flic_state = KVM_S390_FLIC(VAR_0);

    struct kvm_create_device VAR_2 = {0};

    struct kvm_device_attr VAR_3 = {0};

    int VAR_4;

    Error *errp_local = NULL;



    KVM_S390_FLIC_GET_CLASS(VAR_0)->parent_realize(VAR_0, &errp_local);

    if (errp_local) {

        goto fail;

    }

    flic_state->fd = -1;

    if (!kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) {

        error_setg_errno(&errp_local, errno, "KVM is missing capability"

                         " KVM_CAP_DEVICE_CTRL");

        trace_flic_no_device_api(errno);

        goto fail;

    }



    VAR_2.type = KVM_DEV_TYPE_FLIC;

    VAR_4 = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &VAR_2);

    if (VAR_4 < 0) {

        error_setg_errno(&errp_local, errno, "Creating the KVM device failed");

        trace_flic_create_device(errno);

        goto fail;

    }

    flic_state->fd = VAR_2.fd;



    

    VAR_3.group = KVM_DEV_FLIC_CLEAR_IO_IRQ;

    flic_state->clear_io_supported = !ioctl(flic_state->fd,

                                            KVM_HAS_DEVICE_ATTR, VAR_3);



    fs->ais_supported = false;

    return;

fail:

    error_propagate(VAR_1, errp_local);

}

static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)
{ S390FLICState *fs = S390_FLIC_COMMON(VAR_0); KVMS390FLICState *flic_state = KVM_S390_FLIC(VAR_0); struct kvm_create_device VAR_2 = {0}; struct kvm_device_attr VAR_3 = {0}; int VAR_4; Error *errp_local = NULL; KVM_S390_FLIC_GET_CLASS(VAR_0)->parent_realize(VAR_0, &errp_local); if (errp_local) { goto fail; } flic_state->fd = -1; if (!kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) { error_setg_errno(&errp_local, errno, "KVM is missing capability"
" KVM_CAP_DEVICE_CTRL"); trace_flic_no_device_api(errno); goto fail; } VAR_2.type = KVM_DEV_TYPE_FLIC; VAR_4 = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &VAR_2); if (VAR_4 < 0) { error_setg_errno(&errp_local, errno, "Creating the KVM device failed"); trace_flic_create_device(errno); goto fail; } flic_state->fd = VAR_2.fd; VAR_3.group = KVM_DEV_FLIC_CLEAR_IO_IRQ; flic_state->clear_io_supported = !ioctl(flic_state->fd,
KVM_HAS_DEVICE_ATTR, VAR_3); fs->ais_supported = false; return; fail:
error_propagate(VAR_1, errp_local); }