diff --git a/hypervisor/arch/x86/io.c b/hypervisor/arch/x86/io.c index 61a817b63..c2905c233 100644 --- a/hypervisor/arch/x86/io.c +++ b/hypervisor/arch/x86/io.c @@ -257,7 +257,7 @@ hv_emulate_mmio(struct vcpu *vcpu, struct io_request *io_req) return -EIO; } else { /* Handle this MMIO operation */ - status = mmio_handler->read_write(vcpu, io_req); + status = mmio_handler->read_write(io_req, mmio_handler->handler_private_data); break; } } diff --git a/hypervisor/dm/vioapic.c b/hypervisor/dm/vioapic.c index 225a56ced..ea44429be 100644 --- a/hypervisor/dm/vioapic.c +++ b/hypervisor/dm/vioapic.c @@ -511,7 +511,7 @@ vioapic_init(struct vm *vm) vioapic_mmio_access_handler, (uint64_t)VIOAPIC_BASE, (uint64_t)VIOAPIC_BASE + VIOAPIC_SIZE, - NULL); + vm); } void @@ -532,9 +532,9 @@ vioapic_pincount(const struct vm *vm) } } -int vioapic_mmio_access_handler(struct vcpu *vcpu, struct io_request *io_req) +int vioapic_mmio_access_handler(struct io_request *io_req, void *handler_private_data) { - struct vm *vm = vcpu->vm; + struct vm *vm = (struct vm *)handler_private_data; struct acrn_vioapic *vioapic; struct mmio_request *mmio = &io_req->reqs.mmio; uint64_t gpa = mmio->address; diff --git a/hypervisor/include/arch/x86/guest/vioapic.h b/hypervisor/include/arch/x86/guest/vioapic.h index 4738dce59..36f60722c 100644 --- a/hypervisor/include/arch/x86/guest/vioapic.h +++ b/hypervisor/include/arch/x86/guest/vioapic.h @@ -60,8 +60,7 @@ void vioapic_update_tmr(struct vcpu *vcpu); uint32_t vioapic_pincount(const struct vm *vm); void vioapic_process_eoi(struct vm *vm, uint32_t vector); void vioapic_get_rte(struct vm *vm, uint32_t pin, union ioapic_rte *rte); -int vioapic_mmio_access_handler(struct vcpu *vcpu, - struct io_request *io_req); +int vioapic_mmio_access_handler(struct io_request *io_req, void *handler_private_data); #ifdef HV_DEBUG void get_vioapic_info(char *str_arg, size_t str_max, uint16_t vmid); diff --git a/hypervisor/include/arch/x86/ioreq.h b/hypervisor/include/arch/x86/ioreq.h index 31df89580..04d592119 100644 --- a/hypervisor/include/arch/x86/ioreq.h +++ b/hypervisor/include/arch/x86/ioreq.h @@ -94,8 +94,7 @@ struct vm_io_handler { /* Typedef for MMIO handler and range check routine */ struct mmio_request; -typedef int (*hv_mem_io_handler_t)(struct vcpu *vcpu, - struct io_request *io_req); +typedef int (*hv_mem_io_handler_t)(struct io_request *io_req, void *handler_private_data); /* Structure for MMIO handler node */ struct mem_io_node {