static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)

{

    KVMS390StAttribState *sas = KVM_S390_STATTRIB(sa);

    MachineState *machine = MACHINE(qdev_get_machine());

    unsigned long max = machine->maxram_size / TARGET_PAGE_SIZE;

    unsigned long cx, len = 1 << 19;

    int r;

    struct kvm_s390_cmma_log clog = {

        .flags = 0,

        .mask = ~0ULL,

    };



    if (sas->incoming_buffer) {

        for (cx = 0; cx + len <= max; cx += len) {

            clog.start_gfn = cx;

            clog.count = len;

            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);

            r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);

            if (r) {

                error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));

                return;

            }

        }

        if (cx < max) {

            clog.start_gfn = cx;

            clog.count = max - cx;

            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);

            r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);

            if (r) {

                error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));

            }

        }

        g_free(sas->incoming_buffer);

        sas->incoming_buffer = NULL;

    }

}

static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)

{

    KVMS390StAttribState *sas = KVM_S390_STATTRIB(sa);

    MachineState *machine = MACHINE(qdev_get_machine());

    unsigned long max = machine->maxram_size / TARGET_PAGE_SIZE;

    unsigned long cx, len = 1 << 19;

    int r;

    struct kvm_s390_cmma_log clog = {

        .flags = 0,

        .mask = ~0ULL,

    };



    if (sas->incoming_buffer) {

        for (cx = 0; cx + len <= max; cx += len) {

            clog.start_gfn = cx;

            clog.count = len;

            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);

            r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);

            if (r) {

                error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));

                return;

            }

        }

        if (cx < max) {

            clog.start_gfn = cx;

            clog.count = max - cx;

            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);

            r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);

            if (r) {

                error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));

            }

        }

        g_free(sas->incoming_buffer);

        sas->incoming_buffer = NULL;

    }

}

            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);             clog.values = (uint64_t)(sas->incoming_buffer + cx * len);
static void FUNC_0(S390StAttribState *VAR_0)

{

    KVMS390StAttribState *sas = KVM_S390_STATTRIB(VAR_0);

    MachineState *machine = MACHINE(qdev_get_machine());

    unsigned long VAR_1 = machine->maxram_size / TARGET_PAGE_SIZE;

    unsigned long VAR_2, VAR_3 = 1 << 19;

    int VAR_4;

    struct kvm_s390_cmma_log VAR_5 = {

        .flags = 0,

        .mask = ~0ULL,

    };



    if (sas->incoming_buffer) {

        for (VAR_2 = 0; VAR_2 + VAR_3 <= VAR_1; VAR_2 += VAR_3) {

            VAR_5.start_gfn = VAR_2;

            VAR_5.count = VAR_3;

            VAR_5.values = (uint64_t)(sas->incoming_buffer + VAR_2 * VAR_3);

            VAR_4 = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &VAR_5);

            if (VAR_4) {

                error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-VAR_4));

                return;

            }

        }

        if (VAR_2 < VAR_1) {

            VAR_5.start_gfn = VAR_2;

            VAR_5.count = VAR_1 - VAR_2;

            VAR_5.values = (uint64_t)(sas->incoming_buffer + VAR_2 * VAR_3);

            VAR_4 = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &VAR_5);

            if (VAR_4) {

                error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-VAR_4));

            }

        }

        g_free(sas->incoming_buffer);

        sas->incoming_buffer = NULL;

    }

}

static void FUNC_0(S390StAttribState *VAR_0)
{ KVMS390StAttribState *sas = KVM_S390_STATTRIB(VAR_0); MachineState *machine = MACHINE(qdev_get_machine()); unsigned long VAR_1 = machine->maxram_size / TARGET_PAGE_SIZE; unsigned long VAR_2, VAR_3 = 1 << 19; int VAR_4; struct kvm_s390_cmma_log VAR_5 = { .flags = 0,
.mask = ~0ULL,
}; if (sas->incoming_buffer) { for (VAR_2 = 0; VAR_2 + VAR_3 <= VAR_1; VAR_2 += VAR_3) { VAR_5.start_gfn = VAR_2; VAR_5.count = VAR_3; VAR_5.values = (uint64_t)(sas->incoming_buffer + VAR_2 * VAR_3); VAR_4 = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &VAR_5); if (VAR_4) { error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-VAR_4)); return; } } if (VAR_2 < VAR_1) { VAR_5.start_gfn = VAR_2; VAR_5.count = VAR_1 - VAR_2; VAR_5.values = (uint64_t)(sas->incoming_buffer + VAR_2 * VAR_3); VAR_4 = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &VAR_5); if (VAR_4) { error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-VAR_4)); } } g_free(sas->incoming_buffer); sas->incoming_buffer = NULL; } }