From 82ed8716b08ccf2f6239262ecc269c5cd60ef5dd Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 14 Oct 2013 09:51:40 +0200 Subject: x86/HVM: fix direct PCI port I/O emulation retry and error handling dpci_ioport_{read,write}() guest memory access failure handling should be modelled after process_portio_intercept()'s (and others): Upon encountering an error on other than the first iteration, the count successfully handled needs to be stored and X86EMUL_OKAY returned, in order for the generic instruction emulator to update register state correctly before reporting failure or retrying (both of which would only happen after re-invoking emulation). Further we leverage (and slightly extend, due to the above mentioned need to return X86EMUL_OKAY) the "large MMIO" retry model. Note that there is still a special case not explicitly taken care of here: While the first retry on the last iteration of a "rep ins" correctly recovers the already read data, an eventual subsequent retry is being handled by the pre-existing mmio-large logic (through hvmemul_do_io() storing the [recovered] data [again], also taking into consideration that the emulator converts a single iteration "ins" to ->read_io() plus ->write()). Also fix an off-by-one in the mmio-large-read logic, and slightly simplify the copying of the data. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Acked-by: Keir Fraser --- xen/include/asm-x86/hvm/vcpu.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'xen/include/asm-x86/hvm/vcpu.h') diff --git a/xen/include/asm-x86/hvm/vcpu.h b/xen/include/asm-x86/hvm/vcpu.h index e8b8cd76ba..1abb364b07 100644 --- a/xen/include/asm-x86/hvm/vcpu.h +++ b/xen/include/asm-x86/hvm/vcpu.h @@ -66,6 +66,11 @@ struct hvm_vcpu_io { /* We may write up to m256 as a number of device-model transactions. */ unsigned int mmio_large_write_bytes; paddr_t mmio_large_write_pa; + /* + * For string instruction emulation we need to be able to signal a + * necessary retry through other than function return codes. + */ + bool_t mmio_retry, mmio_retrying; }; #define VMCX_EADDR (~0ULL) -- cgit v1.2.3