diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-10-07 07:21:31 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-10-07 07:21:31 +0100 |
commit | bac0999325056a3b3a92f7622df7ffbc5388b1c3 (patch) | |
tree | e14141725b8fb81ecff74c3a5f963d0006dc43a0 | |
parent | 7cb99e3e8149259031edad6ac572389f4423b6cc (diff) | |
download | xen-bac0999325056a3b3a92f7622df7ffbc5388b1c3.tar.gz xen-bac0999325056a3b3a92f7622df7ffbc5388b1c3.tar.bz2 xen-bac0999325056a3b3a92f7622df7ffbc5388b1c3.zip |
x86 hvm: Do not incorrectly retire an instruction emulation when a
read/write cycle to qemu is dropped due to guest suspend.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
-rw-r--r-- | xen/arch/x86/hvm/emulate.c | 4 | ||||
-rw-r--r-- | xen/arch/x86/hvm/hvm.c | 8 | ||||
-rw-r--r-- | xen/arch/x86/hvm/io.c | 2 | ||||
-rw-r--r-- | xen/include/asm-x86/hvm/hvm.h | 2 |
4 files changed, 9 insertions, 7 deletions
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index a8c6d1a5e3..ac3f807c22 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -163,8 +163,8 @@ static int hvmemul_do_io( curr->arch.hvm_vcpu.io_state = HVMIO_none; break; case X86EMUL_UNHANDLEABLE: - hvm_send_assist_req(curr); - rc = (p_data != NULL) ? X86EMUL_RETRY : X86EMUL_OKAY; + rc = (!hvm_send_assist_req(curr) || (p_data != NULL) + ? X86EMUL_RETRY : X86EMUL_OKAY); break; default: BUG(); diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 8d96b30cee..a89b616c48 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -858,12 +858,12 @@ void hvm_vcpu_down(struct vcpu *v) } } -void hvm_send_assist_req(struct vcpu *v) +bool_t hvm_send_assist_req(struct vcpu *v) { ioreq_t *p; if ( unlikely(!vcpu_start_shutdown_deferral(v)) ) - return; /* implicitly bins the i/o operation */ + return 0; /* implicitly bins the i/o operation */ p = &get_ioreq(v)->vp_ioreq; if ( unlikely(p->state != STATE_IOREQ_NONE) ) @@ -871,7 +871,7 @@ void hvm_send_assist_req(struct vcpu *v) /* This indicates a bug in the device model. Crash the domain. */ gdprintk(XENLOG_ERR, "Device model set bad IO state %d.\n", p->state); domain_crash(v->domain); - return; + return 0; } prepare_wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port); @@ -882,6 +882,8 @@ void hvm_send_assist_req(struct vcpu *v) */ p->state = STATE_IOREQ_READY; notify_via_xen_event_channel(v->arch.hvm_vcpu.xen_port); + + return 1; } void hvm_hlt(unsigned long rflags) diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index 42a7b63b98..f49626ea5f 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -168,7 +168,7 @@ void send_invalidate_req(void) p->data = ~0UL; /* flush all */ p->io_count++; - hvm_send_assist_req(v); + (void)hvm_send_assist_req(v); } int handle_mmio(void) diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 563e211929..2ee9b81a06 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -148,7 +148,7 @@ int hvm_vcpu_cacheattr_init(struct vcpu *v); void hvm_vcpu_cacheattr_destroy(struct vcpu *v); void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip); -void hvm_send_assist_req(struct vcpu *v); +bool_t hvm_send_assist_req(struct vcpu *v); void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc); u64 hvm_get_guest_tsc(struct vcpu *v); |