mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86/HVM: fold hvm_io_assist() into its only caller
While there are two call sites, the function they're in can be slightly re-arranged such that the code sequence can be added at its bottom. Note that the function's only caller has already checked sv->pending, and that the prior while() loop was just a slightly more fancy if() (allowing an early break out of the construct). Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Paul Durrant <paul@xen.org>
This commit is contained in:
1 parent
859447ab7b
commit
83bb55fa38
1 file changed
+10
-16
+10
-16
@@ -103,23 +103,12 @@ bool hvm_io_pending(struct vcpu *v)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void hvm_io_assist(struct hvm_ioreq_vcpu *sv, uint64_t data)
|
||||
{
|
||||
struct vcpu *v = sv->vcpu;
|
||||
ioreq_t *ioreq = &v->arch.hvm.hvm_io.io_req;
|
||||
|
||||
if ( hvm_ioreq_needs_completion(ioreq) )
|
||||
ioreq->data = data;
|
||||
|
||||
sv->pending = false;
|
||||
}
|
||||
|
||||
static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
|
||||
{
|
||||
unsigned int prev_state = STATE_IOREQ_NONE;
|
||||
uint64_t data = ~0;
|
||||
|
||||
while ( sv->pending )
|
||||
{
|
||||
do {
|
||||
unsigned int state = p->state;
|
||||
|
||||
smp_rmb();
|
||||
@@ -132,7 +121,6 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
|
||||
* emulator is dying and it races with an I/O being
|
||||
* requested.
|
||||
*/
|
||||
hvm_io_assist(sv, ~0ul);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -149,7 +137,7 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
|
||||
{
|
||||
case STATE_IORESP_READY: /* IORESP_READY -> NONE */
|
||||
p->state = STATE_IOREQ_NONE;
|
||||
hvm_io_assist(sv, p->data);
|
||||
data = p->data;
|
||||
break;
|
||||
case STATE_IOREQ_READY: /* IOREQ_{READY,INPROCESS} -> IORESP_READY */
|
||||
case STATE_IOREQ_INPROCESS:
|
||||
@@ -164,7 +152,13 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
|
||||
domain_crash(sv->vcpu->domain);
|
||||
return false; /* bail */
|
||||
}
|
||||
}
|
||||
} while ( false );
|
||||
|
||||
p = &sv->vcpu->arch.hvm.hvm_io.io_req;
|
||||
if ( hvm_ioreq_needs_completion(p) )
|
||||
p->data = data;
|
||||
|
||||
sv->pending = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||