x86/HVM: alter completion-needed checking

The function only looks at the ioreq_t, so pass it a pointer to just
that. Also use it in hvmemul_do_io().

Suggested-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
This commit is contained in:
Jan Beulich committed 2018-06-26 08:47:17 +02:00
1 parent 3310e3cd64
commit e017c882ef
5 files changed
+14 -19

No files matched your search

+2 -6
View File
@@ -282,11 +282,7 @@ static int hvmemul_do_io(
rc = hvm_send_ioreq(s, &p, 0);
if ( rc != X86EMUL_RETRY || currd->is_shutting_down )
vio->io_req.state = STATE_IOREQ_NONE;
/*
* This effectively is !hvm_vcpu_io_need_completion(vio), slightly
* optimized and using local variables we have available.
*/
else if ( data_is_addr || (!is_mmio && dir == IOREQ_WRITE) )
else if ( !hvm_ioreq_needs_completion(&vio->io_req) )
rc = X86EMUL_OKAY;
}
break;
@@ -2278,7 +2274,7 @@ static int _hvm_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt,
if ( rc == X86EMUL_OKAY && vio->mmio_retry )
rc = X86EMUL_RETRY;
if ( !hvm_vcpu_io_need_completion(vio) )
if ( !hvm_ioreq_needs_completion(&vio->io_req) )
{
vio->mmio_cache_count = 0;
vio->mmio_insn_bytes = 0;
+2 -2
View File
@@ -89,7 +89,7 @@ bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate, const char *descr)
rc = hvm_emulate_one(&ctxt);
if ( hvm_vcpu_io_need_completion(vio) )
if ( hvm_ioreq_needs_completion(&vio->io_req) )
vio->io_completion = HVMIO_mmio_completion;
else
vio->mmio_access = (struct npfec){};
@@ -142,7 +142,7 @@ bool handle_pio(uint16_t port, unsigned int size, int dir)
rc = hvmemul_do_pio_buffer(port, size, dir, &data);
if ( hvm_vcpu_io_need_completion(vio) )
if ( hvm_ioreq_needs_completion(&vio->io_req) )
vio->io_completion = HVMIO_pio_completion;
switch ( rc )
+5 -5
View File
@@ -110,15 +110,15 @@ bool hvm_io_pending(struct vcpu *v)
static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
{
struct vcpu *v = sv->vcpu;
struct hvm_vcpu_io *vio = &v->arch.hvm_vcpu.hvm_io;
ioreq_t *ioreq = &v->arch.hvm_vcpu.hvm_io.io_req;
if ( hvm_vcpu_io_need_completion(vio) )
if ( hvm_ioreq_needs_completion(ioreq) )
{
vio->io_req.state = STATE_IORESP_READY;
vio->io_req.data = data;
ioreq->state = STATE_IORESP_READY;
ioreq->data = data;
}
else
vio->io_req.state = STATE_IOREQ_NONE;
ioreq->state = STATE_IOREQ_NONE;
msix_write_completion(v);
vcpu_end_shutdown_deferral(v);
+1 -1
View File
@@ -103,7 +103,7 @@ void vmx_realmode_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt)
rc = hvm_emulate_one(hvmemul_ctxt);
if ( hvm_vcpu_io_need_completion(vio) )
if ( hvm_ioreq_needs_completion(&vio->io_req) )
vio->io_completion = HVMIO_realmode_completion;
if ( rc == X86EMUL_UNHANDLEABLE )
+4 -5
View File
@@ -91,12 +91,11 @@ struct hvm_vcpu_io {
const struct g2m_ioport *g2m_ioport;
};
static inline bool hvm_vcpu_io_need_completion(const struct hvm_vcpu_io *vio)
static inline bool hvm_ioreq_needs_completion(const ioreq_t *ioreq)
{
return (vio->io_req.state == STATE_IOREQ_READY) &&
!vio->io_req.data_is_ptr &&
(vio->io_req.type != IOREQ_TYPE_PIO ||
vio->io_req.dir != IOREQ_WRITE);
return ioreq->state == STATE_IOREQ_READY &&
!ioreq->data_is_ptr &&
(ioreq->type != IOREQ_TYPE_PIO || ioreq->dir != IOREQ_WRITE);
}
struct nestedvcpu {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.