HV: make io_write_fn_t return true or false

This patch makes io_write_fn_t return true or false instead of void.
Returning true means that the handler in HV process the request completely.
Returning false means that we need to re-inject the request to DM after
processing it in HV.

Tracked-On: #2865
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Kaige Fu
2019-03-28 14:36:50 +00:00
committed by ACRN System Integration
parent ed286e3239
commit 3b2ad67788
7 changed files with 33 additions and 15 deletions

View File

@@ -217,7 +217,13 @@ hv_emulate_pio(const struct acrn_vcpu *vcpu, struct io_request *io_req)
if (pio_req->direction == REQUEST_WRITE) {
if (handler->io_write != NULL) {
handler->io_write(vm, port, size, pio_req->value);
if (!(handler->io_write(vm, port, size, pio_req->value))) {
/*
* If io_write return false, it indicates that we need continue
* to emulate in DM.
*/
status = -ENODEV;
}
}
pr_dbg("IO write on port %04x, data %08x", port, pio_req->value);
} else {

View File

@@ -142,7 +142,7 @@ static inline void enter_s3(struct acrn_vm *vm, uint32_t pm1a_cnt_val, uint32_t
resume_vm_from_s3(vm, guest_wakeup_vec32); /* jump back to vm */
}
static void pm1ab_io_write(struct acrn_vm *vm, uint16_t addr, size_t width, uint32_t v)
static bool pm1ab_io_write(struct acrn_vm *vm, uint16_t addr, size_t width, uint32_t v)
{
static uint32_t pm1a_cnt_ready = 0U;
bool to_write = true;
@@ -179,6 +179,8 @@ static void pm1ab_io_write(struct acrn_vm *vm, uint16_t addr, size_t width, uint
if (to_write) {
pio_write(v, addr, width);
}
return true;
}
static void register_gas_io_handler(struct acrn_vm *vm, uint32_t pio_idx, const struct acpi_generic_address *gas)