aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/io.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-12-17 06:27:56 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-12-17 06:27:56 +0000
commit3e3ccc354377859506ad948df84572813204c99c (patch)
treeafd84dd673b7dd062f83a15cdab332a84b6555a6 /xen/arch/x86/hvm/io.c
parentaf909e7e16dd67452bde91bb71c8111c95c43983 (diff)
downloadxen-3e3ccc354377859506ad948df84572813204c99c.tar.gz
xen-3e3ccc354377859506ad948df84572813204c99c.tar.bz2
xen-3e3ccc354377859506ad948df84572813204c99c.zip
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 <Grzegorz.Milos@citrix.com>
Diffstat (limited to 'xen/arch/x86/hvm/io.c')
-rw-r--r--xen/arch/x86/hvm/io.c16
1 files changed, 12 insertions, 4 deletions
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;
}