hv[v2]: remove registration of default port IO and MMIO handlers

- The default behaviors of PIO & MMIO handlers are same
   for all VMs, no need to expose dedicated APIs to register
   default hanlders for SOS and prelaunched VM.

Tracked-On: #3904
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Yonghua Huang 2019-10-18 15:40:51 +08:00 committed by wenlingz
parent 73b8c91e06
commit 2e62ad9574
4 changed files with 12 additions and 47 deletions

View File

@ -445,12 +445,6 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_
vm->arch_vm.nworld_eptp = vm->arch_vm.ept_mem_ops.get_pml4_page(vm->arch_vm.ept_mem_ops.info);
sanitize_pte((uint64_t *)vm->arch_vm.nworld_eptp, &vm->arch_vm.ept_mem_ops);
/* Register default handlers for PIO & MMIO if it is, SOS VM or Pre-launched VM */
if ((vm_config->load_order == SOS_VM) || (vm_config->load_order == PRE_LAUNCHED_VM)) {
register_pio_default_emulation_handler(vm);
register_mmio_default_emulation_handler(vm);
}
(void)memcpy_s(&vm->uuid[0], sizeof(vm->uuid),
&vm_config->uuid[0], sizeof(vm_config->uuid));

View File

@ -414,8 +414,13 @@ hv_emulate_pio(struct acrn_vcpu *vcpu, struct io_request *io_req)
struct acrn_vm *vm = vcpu->vm;
struct pio_request *pio_req = &io_req->reqs.pio;
struct vm_io_handler_desc *handler;
io_read_fn_t io_read = vm->default_io_read;
io_write_fn_t io_write = vm->default_io_write;
io_read_fn_t io_read = NULL;
io_write_fn_t io_write = NULL;
if (is_sos_vm(vcpu->vm) || is_prelaunched_vm(vcpu->vm)) {
io_read = pio_default_read;
io_write = pio_default_write;
}
port = (uint16_t)pio_req->address;
size = (uint16_t)pio_req->size;
@ -472,9 +477,13 @@ hv_emulate_mmio(struct acrn_vcpu *vcpu, struct io_request *io_req)
uint64_t address, size;
struct mmio_request *mmio_req = &io_req->reqs.mmio;
struct mem_io_node *mmio_handler = NULL;
hv_mem_io_handler_t read_write = vcpu->vm->default_read_write;
hv_mem_io_handler_t read_write = NULL;
void *handler_private_data = NULL;
if (is_sos_vm(vcpu->vm) || is_prelaunched_vm(vcpu->vm)) {
read_write = mmio_default_access_handler;
}
address = mmio_req->address;
size = mmio_req->size;
@ -654,24 +663,3 @@ void register_mmio_emulation_handler(struct acrn_vm *vm,
}
}
/**
* @brief Register port I/O default handler
*
* @param vm The VM to which the port I/O handlers are registered
*/
void register_pio_default_emulation_handler(struct acrn_vm *vm)
{
vm->default_io_read = pio_default_read;
vm->default_io_write = pio_default_write;
}
/**
* @brief Register MMIO default handler
*
* @param vm The VM to which the MMIO handler is registered
*/
void register_mmio_default_emulation_handler(struct acrn_vm *vm)
{
vm->default_read_write = mmio_default_access_handler;
}

View File

@ -127,11 +127,8 @@ struct acrn_vm {
uint16_t emul_mmio_regions; /* Number of emulated mmio regions */
struct mem_io_node emul_mmio[CONFIG_MAX_EMULATED_MMIO_REGIONS];
hv_mem_io_handler_t default_read_write;
struct vm_io_handler_desc emul_pio[EMUL_PIO_IDX_MAX];
io_read_fn_t default_io_read;
io_write_fn_t default_io_write;
uint8_t uuid[16];
struct secure_world_control sworld_control;

View File

@ -265,20 +265,6 @@ void register_mmio_emulation_handler(struct acrn_vm *vm,
hv_mem_io_handler_t read_write, uint64_t start,
uint64_t end, void *handler_private_data);
/**
* @brief Register port I/O default handler
*
* @param vm The VM to which the port I/O handlers are registered
*/
void register_pio_default_emulation_handler(struct acrn_vm *vm);
/**
* @brief Register MMIO default handler
*
* @param vm The VM to which the MMIO handler is registered
*/
void register_mmio_default_emulation_handler(struct acrn_vm *vm);
/**
* @}
*/