mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 21:19:35 +00:00
hv: rework the MMIO handler callback hv_mem_io_handler_t arguments
commit 026ae83bd5
("hv: include: fix 'Unused procedure parameter'")
removed the then unused parameter handler_private_data from
hv_mem_io_handler_t because MISRA-C requires that there should be no
unused parameters in functions.
This patch removes vcpu from the parameter list as well since this may
not be used by all users. Also it brings back handler_private_data which
is more flexible. For example, vioapic_mmio_access_handler() can use it
to pass vcpu pointer.
Tracked-On: #861
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
ec5b90f11e
commit
3e54c70d0f
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user