acrn-hypervisor/hypervisor/include/arch/x86
Junjie Mao 6e96243b01 HV: io: drop REQ_STATE_FAILED
Now the DM has adopted the new VHM request state transitions and
REQ_STATE_FAILED is obsolete since neither VHM nor kernel mediators will set the
state to FAILED.

This patch drops the definition to REQ_STATE_FAILED in the hypervisor, makes
''processed'' unsigned to make the compiler happy about typing and simplifies
error handling in the following ways.

* (dm_)emulate_(pio|mmio)_post no longer returns an error code, by introducing a
  constraint that these functions must be called after an I/O request
  completes (which is the case in the current design) and assuming
  handlers/VHM/DM will always give a value for reads (typically all 1's if the
  requested address is invalid).

* emulate_io() now returns a positive value IOREQ_PENDING to indicate that the
  request is sent to VHM. This mitigates a potential race between
  dm_emulate_pio() and pio_instr_vmexit_handler() which can cause
  emulate_pio_post() being called twice for the same request.

* Remove the ''processed'' member in io_request. Previously this mirrors the
  state of the VHM request which terminates at either COMPLETE or FAILED. After
  the FAILED state is removed, the terminal state will always be constantly
  COMPLETE. Thus the mirrored ''processed'' member is no longer useful.

Note that emulate_instruction() will always succeed after a reshuffle, and this
patch takes that assumption in advance. This does not hurt as that returned
value is not currently handled.

This patch makes it explicit that I/O emulation is not expected to fail. One
issue remains, though, which occurs when a non-aligned cross-boundary access
happens. Currently the hypervisor, VHM and DM adopts different policy:

* Hypervisor: inject #GP if it detects that the access crossed boundary

* VHM: deliver to DM if the access does not complete falls in the range of a
  client

* DM: a handler covering part of the to-be-accessed region is picked and
  assertion failure can be triggered.

A high-level design covering all these components (in addition to instruction
emulation) is needed for this. Thus this patch does not yet cover the issue.

Tracked-On: #875
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-08-15 12:04:12 +08:00
..
guest hv: move boot_ctx offset definitions 2018-08-14 13:05:06 +08:00
apicreg.h hv: vioapic: remove EOI register support 2018-08-06 12:32:35 +08:00
assign.h hv: treewide: fix 'Function prototype/defn param type mismatch' 2018-08-01 15:53:29 +08:00
cpu.h hv: treewide: fix multiple MISRAC violations 2018-08-15 11:21:09 +08:00
cpufeatures.h HV:CPU: Add 'U/UL' for unsigned const value 2018-07-09 10:27:21 +08:00
cpuid.h HV: Rename functions beginning with "_" 2018-07-30 10:11:54 +08:00
gdt.h HV:treewide:fix value outside range of underlying type 2018-08-06 16:07:41 +08:00
hob_parse.h HV: handle integral issues as MISRA-C report 2018-07-20 10:39:46 +08:00
host_pm.h hv: trap vm0 write/read pm1a/pm1b registers 2018-06-29 00:50:01 +08:00
hv_arch.h hv: softirq: move softirq.c to common directory 2018-08-01 11:36:27 +08:00
idt.h HV:treewide:transfer the struct member types to non-basic types 2018-06-29 15:48:19 +08:00
io.h hv: treewide: fix 'Potential side effect problem in expression' 2018-08-08 10:50:06 +08:00
ioapic.h hv: treewide: fix 'Variable should be declared static' 2018-08-10 10:15:36 +08:00
ioreq.h HV: io: drop REQ_STATE_FAILED 2018-08-15 12:04:12 +08:00
irq.h hv: pirq: add static irq:vector mappings 2018-08-15 10:40:43 +08:00
lapic.h hv: treewide: fix 'Prototype and definition name mismatch' 2018-08-06 16:04:40 +08:00
mmu.h HV: VMX reshuffle: put EPT check before enabling 2018-08-13 11:12:46 +08:00
msr.h Revert "[REVERT-ME]: disable turbo mode" 2018-08-15 11:05:49 +08:00
mtrr.h HV: remove 'warm_reboot()'function and other minor cleanup 2018-08-14 09:54:48 +08:00
multiboot.h hv: Partition mode ACRN -kernel load and bootargs load address 2018-08-13 09:34:02 +08:00
per_cpu.h HV: Enclose debug specific code with #ifdef HV_DEBUG 2018-08-15 11:17:29 +08:00
pgtable_types.h hv: mmu: revisit mmu modify page table attributes 2018-07-19 11:11:32 +08:00
pgtable.h hv: mmu: reimplement mmu_add to add page table mapping 2018-07-26 12:46:34 +08:00
timer.h hv: treewide: fix 'Procedure parameter has a type but no identifier' 2018-08-03 13:29:24 +08:00
trusty.h hv:Refine destroy_secure_world API 2018-08-10 10:17:09 +08:00
vmexit.h HV:treewide:fix "Reference parameter to procedure is reassigned" 2018-07-27 12:17:12 +08:00
vmx.h vcpu: add get/set register APIs 2018-08-07 09:55:13 +08:00
vtd.h HV: logical and high level precedence expression needs brackets 2018-07-24 10:10:39 +08:00
zeropage.h license: Replace license text with SPDX tag 2018-06-01 10:43:06 +08:00