From 3e3ccc354377859506ad948df84572813204c99c Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 17 Dec 2009 06:27:56 +0000 Subject: The internal Xen x86 emulator is fixed to handle shared/sharable pages corretly. If pages cannot be unshared immediately (due to lack of free memory required to create private copies) the VCPU under emulation is paused, and the emulator returns X86EMUL_RETRY, which will get resolved after some memory is freed back to Xen (possibly through host paging). Signed-off-by: Grzegorz Milos --- xen/arch/x86/hvm/io.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'xen/arch/x86/hvm/io.c') diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index 29079f296d..3c31a6d2e4 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -263,8 +263,11 @@ static int dpci_ioport_read(uint32_t mport, ioreq_t *p) if ( p->data_is_ptr ) { - if ( hvm_copy_to_guest_phys(p->data + (sign * i * p->size), &data, - p->size) == HVMCOPY_gfn_paged_out ) + int ret; + ret = hvm_copy_to_guest_phys(p->data + (sign * i * p->size), &data, + p->size); + if ( (ret == HVMCOPY_gfn_paged_out) || + (ret == HVMCOPY_gfn_shared) ) return X86EMUL_RETRY; } else @@ -284,8 +287,13 @@ static int dpci_ioport_write(uint32_t mport, ioreq_t *p) data = p->data; if ( p->data_is_ptr ) { - if ( hvm_copy_from_guest_phys(&data, p->data + (sign * i * p->size), - p->size) == HVMCOPY_gfn_paged_out ) + int ret; + + ret = hvm_copy_from_guest_phys(&data, + p->data + (sign * i * p->size), + p->size); + if ( (ret == HVMCOPY_gfn_paged_out) && + (ret == HVMCOPY_gfn_shared) ) return X86EMUL_RETRY; } -- cgit v1.2.3