Message ID | 20190930133238.49868-6-roger.pau@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ioreq: add support for internal servers | expand |
On 30.09.2019 15:32, Roger Pau Monne wrote: > --- a/xen/arch/x86/hvm/ioreq.c > +++ b/xen/arch/x86/hvm/ioreq.c > @@ -1482,7 +1482,16 @@ int hvm_send_ioreq(ioservid_t id, ioreq_t *proto_p, bool buffered) > ASSERT(s); > > if ( buffered ) > - return hvm_send_buffered_ioreq(s, proto_p); > + { > + if ( likely(!hvm_ioreq_is_internal(id)) ) > + return hvm_send_buffered_ioreq(s, proto_p); > + > + ASSERT_UNREACHABLE(); > + return X86EMUL_UNHANDLEABLE; > + } > + > + if ( hvm_ioreq_is_internal(id) ) > + return s->handler(proto_p, s->data); > > if ( unlikely(!vcpu_start_shutdown_deferral(curr)) ) > return X86EMUL_RETRY; Wouldn't it be better to handle internal ones first, before even looking at the "buffered" input? The difference between buffered and non-buffered for external ones is whether to wait for a reply iirc; such a difference simply doesn't exist for internal ones. Jan
diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c index cdbd4244a4..0649b7e02d 100644 --- a/xen/arch/x86/hvm/ioreq.c +++ b/xen/arch/x86/hvm/ioreq.c @@ -1482,7 +1482,16 @@ int hvm_send_ioreq(ioservid_t id, ioreq_t *proto_p, bool buffered) ASSERT(s); if ( buffered ) - return hvm_send_buffered_ioreq(s, proto_p); + { + if ( likely(!hvm_ioreq_is_internal(id)) ) + return hvm_send_buffered_ioreq(s, proto_p); + + ASSERT_UNREACHABLE(); + return X86EMUL_UNHANDLEABLE; + } + + if ( hvm_ioreq_is_internal(id) ) + return s->handler(proto_p, s->data); if ( unlikely(!vcpu_start_shutdown_deferral(curr)) ) return X86EMUL_RETRY;