diff mbox

x86/vMSI-X: write snoops should ignore hvm_mmio_internal() requests

Message ID 571F99BB02000078000E5EC1@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich April 26, 2016, 2:39 p.m. UTC
Those aren't actual I/O requests (and hence are of no interest here
anyway). Since they don't get copied into struct vcpu, looking at that
copy reads whatever was left there. Use the state of the request to
determine its validity.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86/vMSI-X: write snoops should ignore hvm_mmio_internal() requests

Those aren't actual I/O requests (and hence are of no interest here
anyway). Since they don't get copied into struct vcpu, looking at that
copy reads whatever was left there. Use the state of the request to
determine its validity.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -349,6 +349,8 @@ static int msixtbl_range(struct vcpu *v,
     {
         const ioreq_t *r = &v->arch.hvm_vcpu.hvm_io.io_req;
 
+        if ( r->state != STATE_IOREQ_READY )
+            return 0;
         ASSERT(r->type == IOREQ_TYPE_COPY);
         if ( r->dir == IOREQ_WRITE && r->size == 4 && !r->data_is_ptr
              && !(r->data & PCI_MSIX_VECTOR_BITMASK) )

Comments

Paul Durrant April 26, 2016, 2:40 p.m. UTC | #1
> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 26 April 2016 15:39
> To: xen-devel
> Cc: Andrew Cooper; Paul Durrant; Wei Liu
> Subject: [PATCH] x86/vMSI-X: write snoops should ignore
> hvm_mmio_internal() requests
> 
> Those aren't actual I/O requests (and hence are of no interest here
> anyway). Since they don't get copied into struct vcpu, looking at that
> copy reads whatever was left there. Use the state of the request to
> determine its validity.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Paul Durrant <paul.durrant@citrix.com>

> 
> --- a/xen/arch/x86/hvm/vmsi.c
> +++ b/xen/arch/x86/hvm/vmsi.c
> @@ -349,6 +349,8 @@ static int msixtbl_range(struct vcpu *v,
>      {
>          const ioreq_t *r = &v->arch.hvm_vcpu.hvm_io.io_req;
> 
> +        if ( r->state != STATE_IOREQ_READY )
> +            return 0;
>          ASSERT(r->type == IOREQ_TYPE_COPY);
>          if ( r->dir == IOREQ_WRITE && r->size == 4 && !r->data_is_ptr
>               && !(r->data & PCI_MSIX_VECTOR_BITMASK) )
> 
>
Wei Liu April 26, 2016, 2:43 p.m. UTC | #2
On Tue, Apr 26, 2016 at 03:40:29PM +0100, Paul Durrant wrote:
> > -----Original Message-----
> > From: Jan Beulich [mailto:JBeulich@suse.com]
> > Sent: 26 April 2016 15:39
> > To: xen-devel
> > Cc: Andrew Cooper; Paul Durrant; Wei Liu
> > Subject: [PATCH] x86/vMSI-X: write snoops should ignore
> > hvm_mmio_internal() requests
> > 
> > Those aren't actual I/O requests (and hence are of no interest here
> > anyway). Since they don't get copied into struct vcpu, looking at that
> > copy reads whatever was left there. Use the state of the request to
> > determine its validity.
> > 
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> 

Release-acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox

Patch

--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -349,6 +349,8 @@  static int msixtbl_range(struct vcpu *v,
     {
         const ioreq_t *r = &v->arch.hvm_vcpu.hvm_io.io_req;
 
+        if ( r->state != STATE_IOREQ_READY )
+            return 0;
         ASSERT(r->type == IOREQ_TYPE_COPY);
         if ( r->dir == IOREQ_WRITE && r->size == 4 && !r->data_is_ptr
              && !(r->data & PCI_MSIX_VECTOR_BITMASK) )