Skip to content

Commit 42cabf6

Browse files
Sainath Grandhilijinxia
authored andcommitted
hv: Handling IO exits in ACRN for partition mode
There is no SOS and device model in strict partition mode. ACRN emulates IO for virtual devices. Any access to IO not backed by HV should return all FFs on read and writes should be discarded. Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
1 parent a8fcc0f commit 42cabf6

File tree

1 file changed

+22
-0
lines changed
  • hypervisor/arch/x86

1 file changed

+22
-0
lines changed

hypervisor/arch/x86/io.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ int32_t dm_emulate_mmio_post(struct vcpu *vcpu)
107107
return emulate_mmio_post(vcpu, io_req);
108108
}
109109

110+
#ifdef CONFIG_PARTITION_MODE
111+
static void io_instr_dest_handler(struct io_request *io_req)
112+
{
113+
struct pio_request *pio_req = &io_req->reqs.pio;
114+
115+
if (pio_req->direction == REQUEST_READ) {
116+
pio_req->value = 0xFFFFFFFFU;
117+
}
118+
io_req->processed = REQ_STATE_COMPLETE;
119+
}
120+
#endif
121+
110122
void emulate_io_post(struct vcpu *vcpu)
111123
{
112124
union vhm_request_buffer *req_buf;
@@ -296,6 +308,15 @@ emulate_io(struct vcpu *vcpu, struct io_request *io_req)
296308
}
297309

298310
if (status == -ENODEV) {
311+
#ifdef CONFIG_PARTITION_MODE
312+
/*
313+
* No handler from HV side, return all FFs on read
314+
* and discard writes.
315+
*/
316+
io_instr_dest_handler(io_req);
317+
status = 0;
318+
319+
#else
299320
/*
300321
* No handler from HV side, search from VHM in Dom0
301322
*
@@ -309,6 +330,7 @@ emulate_io(struct vcpu *vcpu, struct io_request *io_req)
309330
(pio_req->direction != REQUEST_READ) ? "read" : "write",
310331
pio_req->address, pio_req->size);
311332
}
333+
#endif
312334
}
313335

314336
return status;

0 commit comments

Comments
 (0)