Message ID | 20171018114034.36587-2-roger.pau@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> -----Original Message----- > From: Roger Pau Monne [mailto:roger.pau@citrix.com] > Sent: 18 October 2017 12:40 > To: xen-devel@lists.xenproject.org > Cc: konrad.wilk@oracle.com; boris.ostrovsky@oracle.com; Roger Pau Monne > <roger.pau@citrix.com>; Paul Durrant <Paul.Durrant@citrix.com>; Jan > Beulich <jbeulich@suse.com>; Andrew Cooper > <Andrew.Cooper3@citrix.com> > Subject: [PATCH v7 for-next 01/12] x86/pio: allow internal PIO handlers to > return RETRY > > Fix handle_pio so internal PIO handlers can return X86EMUL_RETRY and > it is properly handled by not advancing the IP. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> I *think* this is safe. Reviewed-by: Paul Durrant <paul.durrant@citrix.com> > --- > Cc: Paul Durrant <paul.durrant@citrix.com> > Cc: Jan Beulich <jbeulich@suse.com> > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > --- > Note this is not an issue currently because no internal handlers > return RETRY. > --- > xen/arch/x86/hvm/io.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c > index e449b4196e..10e1e2db45 100644 > --- a/xen/arch/x86/hvm/io.c > +++ b/xen/arch/x86/hvm/io.c > @@ -157,8 +157,11 @@ bool handle_pio(uint16_t port, unsigned int size, int > dir) > break; > > case X86EMUL_RETRY: > - /* We should not advance RIP/EIP if the domain is shutting down */ > - if ( curr->domain->is_shutting_down ) > + /* > + * We should not advance RIP/EIP if the domain is shutting down or > + * if X86EMUL_RETRY has been returned by an internal handler. > + */ > + if ( curr->domain->is_shutting_down || !hvm_io_pending(curr) ) > return false; > break; > > -- > 2.13.5 (Apple Git-94)
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index e449b4196e..10e1e2db45 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -157,8 +157,11 @@ bool handle_pio(uint16_t port, unsigned int size, int dir) break; case X86EMUL_RETRY: - /* We should not advance RIP/EIP if the domain is shutting down */ - if ( curr->domain->is_shutting_down ) + /* + * We should not advance RIP/EIP if the domain is shutting down or + * if X86EMUL_RETRY has been returned by an internal handler. + */ + if ( curr->domain->is_shutting_down || !hvm_io_pending(curr) ) return false; break;
Fix handle_pio so internal PIO handlers can return X86EMUL_RETRY and it is properly handled by not advancing the IP. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Paul Durrant <paul.durrant@citrix.com> Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> --- Note this is not an issue currently because no internal handlers return RETRY. --- xen/arch/x86/hvm/io.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)