Skip to content

Commit

Permalink
kvm: unify listeners for PIO address space
Browse files Browse the repository at this point in the history
Since we now assume that ioeventfds are present, kvm_io_listener is always
registered.  Merge it with kvm_coalesced_pio_listener in a single
listener.  Since PIO space does not have KVM memslots attached to it,
the priority is irrelevant.

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed Oct 25, 2023
1 parent 126e7f7 commit 2cb81af
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions accel/kvm/kvm-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,13 +1105,6 @@ static void kvm_coalesce_pio_del(MemoryListener *listener,
}
}

static MemoryListener kvm_coalesced_pio_listener = {
.name = "kvm-coalesced-pio",
.coalesced_io_add = kvm_coalesce_pio_add,
.coalesced_io_del = kvm_coalesce_pio_del,
.priority = MEMORY_LISTENER_PRIORITY_MIN,
};

int kvm_check_extension(KVMState *s, unsigned int extension)
{
int ret;
Expand Down Expand Up @@ -1768,6 +1761,8 @@ void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,

static MemoryListener kvm_io_listener = {
.name = "kvm-io",
.coalesced_io_add = kvm_coalesce_pio_add,
.coalesced_io_del = kvm_coalesce_pio_del,
.eventfd_add = kvm_io_ioeventfd_add,
.eventfd_del = kvm_io_ioeventfd_del,
.priority = MEMORY_LISTENER_PRIORITY_DEV_BACKEND,
Expand Down Expand Up @@ -2598,8 +2593,6 @@ static int kvm_init(MachineState *ms)
&address_space_memory, 0, "kvm-memory");
memory_listener_register(&kvm_io_listener,
&address_space_io);
memory_listener_register(&kvm_coalesced_pio_listener,
&address_space_io);

s->sync_mmu = !!kvm_vm_check_extension(kvm_state, KVM_CAP_SYNC_MMU);
if (!s->sync_mmu) {
Expand Down

0 comments on commit 2cb81af

Please sign in to comment.