Revision 62a2744c kvm-all.c

b/kvm-all.c
59 59
    int vmfd;
60 60
    int regs_modified;
61 61
    int coalesced_mmio;
62
#ifdef KVM_CAP_COALESCED_MMIO
63
    struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
64
#endif
62 65
    int broken_set_mem_region;
63 66
    int migration_log;
64 67
    int vcpu_events;
......
200 203
        goto err;
201 204
    }
202 205

  
206
#ifdef KVM_CAP_COALESCED_MMIO
207
    if (s->coalesced_mmio && !s->coalesced_mmio_ring)
208
        s->coalesced_mmio_ring = (void *) env->kvm_run +
209
		s->coalesced_mmio * PAGE_SIZE;
210
#endif
211

  
203 212
    ret = kvm_arch_init_vcpu(env);
204 213
    if (ret == 0) {
205 214
        qemu_register_reset(kvm_reset_vcpu, env);
......
466 475
        goto err;
467 476
    }
468 477

  
478
    s->coalesced_mmio = 0;
469 479
#ifdef KVM_CAP_COALESCED_MMIO
470 480
    s->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO);
471
#else
472
    s->coalesced_mmio = 0;
481
    s->coalesced_mmio_ring = NULL;
473 482
#endif
474 483

  
475 484
    s->broken_set_mem_region = 1;
......
544 553
    return 1;
545 554
}
546 555

  
547
static void kvm_run_coalesced_mmio(CPUState *env, struct kvm_run *run)
556
void kvm_flush_coalesced_mmio_buffer(void)
548 557
{
549 558
#ifdef KVM_CAP_COALESCED_MMIO
550 559
    KVMState *s = kvm_state;
551
    if (s->coalesced_mmio) {
552
        struct kvm_coalesced_mmio_ring *ring;
553

  
554
        ring = (void *)run + (s->coalesced_mmio * TARGET_PAGE_SIZE);
560
    if (s->coalesced_mmio_ring) {
561
        struct kvm_coalesced_mmio_ring *ring = s->coalesced_mmio_ring;
555 562
        while (ring->first != ring->last) {
556 563
            struct kvm_coalesced_mmio *ent;
557 564

  
......
609 616
            abort();
610 617
        }
611 618

  
612
        kvm_run_coalesced_mmio(env, run);
619
        kvm_flush_coalesced_mmio_buffer();
613 620

  
614 621
        ret = 0; /* exit loop */
615 622
        switch (run->exit_reason) {

Also available in: Unified diff