Lines Matching full:io

37 static void guest_code(struct kvm_coalesced_io *io)  in guest_code()  argument
47 for (i = 0; i < io->ring_size - 1; i++) { in guest_code()
50 outl(io->pio_port, io->pio_port + i); in guest_code()
53 WRITE_ONCE(*io->mmio, io->mmio_gpa + i); in guest_code()
57 outl(io->pio_port, io->pio_port + i); in guest_code()
60 WRITE_ONCE(*io->mmio, io->mmio_gpa + i); in guest_code()
64 WRITE_ONCE(*io->mmio, io->mmio_gpa + i); in guest_code()
66 outl(io->pio_port, io->pio_port + i); in guest_code()
72 struct kvm_coalesced_io *io, in vcpu_run_and_verify_io_exit() argument
77 struct kvm_coalesced_mmio_ring *ring = io->ring; in vcpu_run_and_verify_io_exit()
91 pio_value = *(uint32_t *)((void *)run + run->io.data_offset); in vcpu_run_and_verify_io_exit()
96 run->mmio.phys_addr == io->mmio_gpa && run->mmio.len == 8 && in vcpu_run_and_verify_io_exit()
97 *(uint64_t *)run->mmio.data == io->mmio_gpa + io->ring_size - 1)) || in vcpu_run_and_verify_io_exit()
98 (want_pio && (run->exit_reason == KVM_EXIT_IO && run->io.port == io->pio_port && in vcpu_run_and_verify_io_exit()
99 run->io.direction == KVM_EXIT_IO_OUT && run->io.count == 1 && in vcpu_run_and_verify_io_exit()
100 pio_value == io->pio_port + io->ring_size - 1)), in vcpu_run_and_verify_io_exit()
105 want_pio ? (unsigned long long)io->pio_port : io->mmio_gpa, in vcpu_run_and_verify_io_exit()
106 (want_pio ? io->pio_port : io->mmio_gpa) + io->ring_size - 1, run->exit_reason, in vcpu_run_and_verify_io_exit()
109 run->io.port, run->io.direction, run->io.size, run->io.count, pio_value); in vcpu_run_and_verify_io_exit()
113 struct kvm_coalesced_io *io, in vcpu_run_and_verify_coalesced_io() argument
117 struct kvm_coalesced_mmio_ring *ring = io->ring; in vcpu_run_and_verify_coalesced_io()
120 vcpu_run_and_verify_io_exit(vcpu, io, ring_start, expected_exit); in vcpu_run_and_verify_coalesced_io()
122 TEST_ASSERT((ring->last + 1) % io->ring_size == ring->first, in vcpu_run_and_verify_coalesced_io()
124 ring->first, ring->last, io->ring_size, ring_start); in vcpu_run_and_verify_coalesced_io()
126 for (i = 0; i < io->ring_size - 1; i++) { in vcpu_run_and_verify_coalesced_io()
127 uint32_t idx = (ring->first + i) % io->ring_size; in vcpu_run_and_verify_coalesced_io()
132 TEST_ASSERT(entry->phys_addr == io->pio_port && in vcpu_run_and_verify_coalesced_io()
134 *(uint32_t *)entry->data == io->pio_port + i, in vcpu_run_and_verify_coalesced_io()
136 io->pio_port, io->pio_port + i, i, in vcpu_run_and_verify_coalesced_io()
141 TEST_ASSERT(entry->phys_addr == io->mmio_gpa && in vcpu_run_and_verify_coalesced_io()
144 io->mmio_gpa, io->mmio_gpa + i, i, in vcpu_run_and_verify_coalesced_io()
151 struct kvm_coalesced_io *io, uint32_t ring_start) in test_coalesced_io() argument
153 struct kvm_coalesced_mmio_ring *ring = io->ring; in test_coalesced_io()
155 kvm_vm_register_coalesced_io(vcpu->vm, io->mmio_gpa, 8, false /* pio */); in test_coalesced_io()
157 kvm_vm_register_coalesced_io(vcpu->vm, io->pio_port, 8, true /* pio */); in test_coalesced_io()
160 vcpu_run_and_verify_coalesced_io(vcpu, io, ring_start, KVM_EXIT_MMIO); in test_coalesced_io()
162 vcpu_run_and_verify_coalesced_io(vcpu, io, ring_start, KVM_EXIT_IO); in test_coalesced_io()
177 kvm_vm_unregister_coalesced_io(vcpu->vm, io->mmio_gpa, 8, false /* pio */); in test_coalesced_io()
178 vcpu_run_and_verify_io_exit(vcpu, io, ring_start, KVM_EXIT_MMIO); in test_coalesced_io()
181 kvm_vm_unregister_coalesced_io(vcpu->vm, io->pio_port, 8, true /* pio */); in test_coalesced_io()
182 vcpu_run_and_verify_io_exit(vcpu, io, ring_start, KVM_EXIT_IO); in test_coalesced_io()