[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 11/17] x86/hvm: remove hvm_io_state enumeration
Emulation request status is already covered by STATE_IOREQ_XXX values so just use those. The mapping is: HVMIO_none -> STATE_IOREQ_NONE HVMIO_awaiting_completion -> STATE_IOREQ_READY HVMIO_completed -> STATE_IORESP_READY Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> Cc: Keir Fraser <keir@xxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/hvm/emulate.c | 14 +++++++------- xen/arch/x86/hvm/hvm.c | 8 ++++---- xen/arch/x86/hvm/io.c | 2 +- xen/arch/x86/hvm/svm/nestedsvm.c | 2 +- xen/arch/x86/hvm/vmx/realmode.c | 6 +++--- xen/include/asm-x86/hvm/vcpu.h | 8 +------- 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index 0340653..1c34288 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -132,16 +132,16 @@ static int hvmemul_do_io( switch ( vio->io_state ) { - case HVMIO_none: + case STATE_IOREQ_NONE: break; - case HVMIO_completed: - vio->io_state = HVMIO_none; + case STATE_IORESP_READY: + vio->io_state = STATE_IOREQ_NONE; goto finish_access; default: return X86EMUL_UNHANDLEABLE; } - vio->io_state = HVMIO_awaiting_completion; + vio->io_state = STATE_IOREQ_READY; vio->io_size = size; vio->io_dir = dir; @@ -159,7 +159,7 @@ static int hvmemul_do_io( { case X86EMUL_OKAY: vio->io_data = p.data; - vio->io_state = HVMIO_none; + vio->io_state = STATE_IOREQ_NONE; break; case X86EMUL_UNHANDLEABLE: { @@ -172,13 +172,13 @@ static int hvmemul_do_io( rc = process_io_intercept(curr, &p, &null_handler); if ( rc == X86EMUL_OKAY ) vio->io_data = p.data; - vio->io_state = HVMIO_none; + vio->io_state = STATE_IOREQ_NONE; } else { rc = hvm_send_assist_req(s, &p); if ( rc != X86EMUL_RETRY ) - vio->io_state = HVMIO_none; + vio->io_state = STATE_IOREQ_NONE; } break; } diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 8f814ba..85944f6 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -423,10 +423,10 @@ static void hvm_io_assist(ioreq_t *p) * This function should never be called unless an I/O emulation * is awating completion. */ - if (vio->io_state != HVMIO_awaiting_completion) + if (vio->io_state != STATE_IOREQ_READY) domain_crash(curr->domain); - vio->io_state = HVMIO_completed; + vio->io_state = STATE_IORESP_READY; vio->io_data = p->data; vio->io_completion = HVMIO_no_completion; @@ -445,7 +445,7 @@ static void hvm_io_assist(ioreq_t *p) memcpy(&guest_cpu_user_regs()->rax, &p->data, vio->io_size); } - vio->io_state = HVMIO_none; + vio->io_state = STATE_IOREQ_NONE; break; default: break; @@ -455,7 +455,7 @@ static void hvm_io_assist(ioreq_t *p) * Re-emulation may have scheduled another I/O so io_state set * at the top of the function may have changed. */ - if ( vio->io_state == HVMIO_none ) + if ( vio->io_state == STATE_IOREQ_NONE ) { msix_write_completion(curr); vcpu_end_shutdown_deferral(curr); diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index 21516d5..b09b369 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -103,7 +103,7 @@ int handle_mmio(void) hvm_dump_emulation_state(XENLOG_G_WARNING "MMIO", &ctxt); return 0; case X86EMUL_EXCEPTION: - vio->io_state = HVMIO_none; + vio->io_state = STATE_IOREQ_NONE; vio->mmio_access = (struct npfec){}; if ( ctxt.exn_pending ) hvm_inject_trap(&ctxt.trap); diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c index be5797a..8b165c6 100644 --- a/xen/arch/x86/hvm/svm/nestedsvm.c +++ b/xen/arch/x86/hvm/svm/nestedsvm.c @@ -1231,7 +1231,7 @@ enum hvm_intblk nsvm_intr_blocked(struct vcpu *v) * Delay the injection because this would result in delivering * an interrupt *within* the execution of an instruction. */ - if ( v->arch.hvm_vcpu.hvm_io.io_state != HVMIO_none ) + if ( v->arch.hvm_vcpu.hvm_io.io_state != STATE_IOREQ_NONE ) return hvm_intblk_shadow; if ( !nv->nv_vmexit_pending && n2vmcb->exitintinfo.bytes != 0 ) { diff --git a/xen/arch/x86/hvm/vmx/realmode.c b/xen/arch/x86/hvm/vmx/realmode.c index fe8b4a0..8c2da9a 100644 --- a/xen/arch/x86/hvm/vmx/realmode.c +++ b/xen/arch/x86/hvm/vmx/realmode.c @@ -177,7 +177,7 @@ void vmx_realmode(struct cpu_user_regs *regs) hvm_emulate_prepare(&hvmemul_ctxt, regs); - if ( vio->io_state == HVMIO_completed ) + if ( vio->io_state == STATE_IORESP_READY ) realmode_emulate_one(&hvmemul_ctxt); /* Only deliver interrupts into emulated real mode. */ @@ -191,7 +191,7 @@ void vmx_realmode(struct cpu_user_regs *regs) curr->arch.hvm_vmx.vmx_emulate = 1; while ( curr->arch.hvm_vmx.vmx_emulate && !softirq_pending(smp_processor_id()) && - (vio->io_state == HVMIO_none) ) + (vio->io_state == STATE_IOREQ_NONE) ) { /* * Check for pending interrupts only every 16 instructions, because @@ -216,7 +216,7 @@ void vmx_realmode(struct cpu_user_regs *regs) } /* Need to emulate next time if we've started an IO operation */ - if ( vio->io_state != HVMIO_none ) + if ( vio->io_state != STATE_IOREQ_NONE ) curr->arch.hvm_vmx.vmx_emulate = 1; if ( !curr->arch.hvm_vmx.vmx_emulate && !curr->arch.hvm_vmx.vmx_realmode ) diff --git a/xen/include/asm-x86/hvm/vcpu.h b/xen/include/asm-x86/hvm/vcpu.h index f3c58a2..1c2ec27 100644 --- a/xen/include/asm-x86/hvm/vcpu.h +++ b/xen/include/asm-x86/hvm/vcpu.h @@ -30,12 +30,6 @@ #include <asm/hvm/svm/nestedsvm.h> #include <asm/mtrr.h> -enum hvm_io_state { - HVMIO_none = 0, - HVMIO_awaiting_completion, - HVMIO_completed -}; - enum hvm_io_completion { HVMIO_no_completion = 0, HVMIO_mmio_completion, @@ -49,7 +43,7 @@ struct hvm_vcpu_asid { struct hvm_vcpu_io { /* I/O request in flight to device model. */ - enum hvm_io_state io_state; + uint8_t io_state; unsigned long io_data; int io_size; int io_dir; -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |