xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] x86/HVM: hvmemul_do_io() fixes
@ 2016-04-28  9:21 Jan Beulich
  2016-04-28  9:32 ` [PATCH 1/2] x86/HVM: fix emulation re-issue check Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jan Beulich @ 2016-04-28  9:21 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant, Wei Liu

These were found as "secondary" issues while trying to get REP MOVS
to guest MSI-X tables to properly work (the changes needed for that
one will constitute a second series about to be submitted).

1: fix emulation re-issue check
2: fix forwarding of internally cached requests (part 2)

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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] x86/HVM: fix emulation re-issue check
  2016-04-28  9:21 [PATCH 0/2] x86/HVM: hvmemul_do_io() fixes Jan Beulich
@ 2016-04-28  9:32 ` Jan Beulich
  2016-04-28  9:44   ` Andrew Cooper
  2016-04-28  9:33 ` [PATCH 2/2] x86/HVM: fix forwarding of internally cached requests (part 2) Jan Beulich
  2016-04-28 10:28 ` [PATCH 0/2] x86/HVM: hvmemul_do_io() fixes Wei Liu
  2 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2016-04-28  9:32 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant, Wei Liu

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

?: has lower precedence than !=, hence parentheses are required here.

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

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -134,7 +134,7 @@ static int hvmemul_do_io(
         p = vio->io_req;
 
         /* Verify the emulation request has been correctly re-issued */
-        if ( (p.type != is_mmio ? IOREQ_TYPE_COPY : IOREQ_TYPE_PIO) ||
+        if ( (p.type != (is_mmio ? IOREQ_TYPE_COPY : IOREQ_TYPE_PIO)) ||
              (p.addr != addr) ||
              (p.size != size) ||
              (p.count != *reps) ||




[-- Attachment #2: x86-HVM-emul-reissue-check.patch --]
[-- Type: text/plain, Size: 638 bytes --]

x86/HVM: fix emulation re-issue check

?: has lower precedence than !=, hence parentheses are required here.

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

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -134,7 +134,7 @@ static int hvmemul_do_io(
         p = vio->io_req;
 
         /* Verify the emulation request has been correctly re-issued */
-        if ( (p.type != is_mmio ? IOREQ_TYPE_COPY : IOREQ_TYPE_PIO) ||
+        if ( (p.type != (is_mmio ? IOREQ_TYPE_COPY : IOREQ_TYPE_PIO)) ||
              (p.addr != addr) ||
              (p.size != size) ||
              (p.count != *reps) ||

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] x86/HVM: fix forwarding of internally cached requests (part 2)
  2016-04-28  9:21 [PATCH 0/2] x86/HVM: hvmemul_do_io() fixes Jan Beulich
  2016-04-28  9:32 ` [PATCH 1/2] x86/HVM: fix emulation re-issue check Jan Beulich
@ 2016-04-28  9:33 ` Jan Beulich
  2016-04-28  9:49   ` Paul Durrant
  2016-04-28  9:52   ` Andrew Cooper
  2016-04-28 10:28 ` [PATCH 0/2] x86/HVM: hvmemul_do_io() fixes Wei Liu
  2 siblings, 2 replies; 7+ messages in thread
From: Jan Beulich @ 2016-04-28  9:33 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant, Wei Liu

[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]

Commit 96ae556569 ("x86/HVM: fix forwarding of internally cached
requests") wasn't quite complete: hvmemul_do_io() also needs to
propagate up the clipped count. (I really should have re-tested the
forward port resulting in the earlier change, instead of relying on the
testing done on the older version of Xen which the fix was first needed
for.)

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

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -137,7 +137,7 @@ static int hvmemul_do_io(
         if ( (p.type != (is_mmio ? IOREQ_TYPE_COPY : IOREQ_TYPE_PIO)) ||
              (p.addr != addr) ||
              (p.size != size) ||
-             (p.count != *reps) ||
+             (p.count > *reps) ||
              (p.dir != dir) ||
              (p.df != df) ||
              (p.data_is_ptr != data_is_addr) )
@@ -145,6 +145,8 @@ static int hvmemul_do_io(
 
         if ( data_is_addr )
             return X86EMUL_UNHANDLEABLE;
+
+        *reps = p.count;
         goto finish_access;
     default:
         return X86EMUL_UNHANDLEABLE;
@@ -162,6 +164,13 @@ static int hvmemul_do_io(
 
     rc = hvm_io_intercept(&p);
 
+    /*
+     * p.count may have got reduced (see hvm_process_io_intercept()) - inform
+     * our callers and mirror this into latched state.
+     */
+    ASSERT(p.count <= *reps);
+    *reps = vio->io_req.count = p.count;
+
     switch ( rc )
     {
     case X86EMUL_OKAY:




[-- Attachment #2: x86-HVM-internal-IO-with-REP-2.patch --]
[-- Type: text/plain, Size: 1528 bytes --]

x86/HVM: fix forwarding of internally cached requests (part 2)

Commit 96ae556569 ("x86/HVM: fix forwarding of internally cached
requests") wasn't quite complete: hvmemul_do_io() also needs to
propagate up the clipped count. (I really should have re-tested the
forward port resulting in the earlier change, instead of relying on the
testing done on the older version of Xen which the fix was first needed
for.)

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

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -137,7 +137,7 @@ static int hvmemul_do_io(
         if ( (p.type != (is_mmio ? IOREQ_TYPE_COPY : IOREQ_TYPE_PIO)) ||
              (p.addr != addr) ||
              (p.size != size) ||
-             (p.count != *reps) ||
+             (p.count > *reps) ||
              (p.dir != dir) ||
              (p.df != df) ||
              (p.data_is_ptr != data_is_addr) )
@@ -145,6 +145,8 @@ static int hvmemul_do_io(
 
         if ( data_is_addr )
             return X86EMUL_UNHANDLEABLE;
+
+        *reps = p.count;
         goto finish_access;
     default:
         return X86EMUL_UNHANDLEABLE;
@@ -162,6 +164,13 @@ static int hvmemul_do_io(
 
     rc = hvm_io_intercept(&p);
 
+    /*
+     * p.count may have got reduced (see hvm_process_io_intercept()) - inform
+     * our callers and mirror this into latched state.
+     */
+    ASSERT(p.count <= *reps);
+    *reps = vio->io_req.count = p.count;
+
     switch ( rc )
     {
     case X86EMUL_OKAY:

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] x86/HVM: fix emulation re-issue check
  2016-04-28  9:32 ` [PATCH 1/2] x86/HVM: fix emulation re-issue check Jan Beulich
@ 2016-04-28  9:44   ` Andrew Cooper
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Cooper @ 2016-04-28  9:44 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Paul Durrant, Wei Liu

On 28/04/16 10:32, Jan Beulich wrote:
> ?: has lower precedence than !=, hence parentheses are required here.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] x86/HVM: fix forwarding of internally cached requests (part 2)
  2016-04-28  9:33 ` [PATCH 2/2] x86/HVM: fix forwarding of internally cached requests (part 2) Jan Beulich
@ 2016-04-28  9:49   ` Paul Durrant
  2016-04-28  9:52   ` Andrew Cooper
  1 sibling, 0 replies; 7+ messages in thread
From: Paul Durrant @ 2016-04-28  9:49 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Wei Liu

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 28 April 2016 10:33
> To: xen-devel
> Cc: Paul Durrant; Wei Liu
> Subject: [PATCH 2/2] x86/HVM: fix forwarding of internally cached requests
> (part 2)
> 
> Commit 96ae556569 ("x86/HVM: fix forwarding of internally cached
> requests") wasn't quite complete: hvmemul_do_io() also needs to
> propagate up the clipped count. (I really should have re-tested the
> forward port resulting in the earlier change, instead of relying on the
> testing done on the older version of Xen which the fix was first needed
> for.)
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

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

> 
> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -137,7 +137,7 @@ static int hvmemul_do_io(
>          if ( (p.type != (is_mmio ? IOREQ_TYPE_COPY : IOREQ_TYPE_PIO)) ||
>               (p.addr != addr) ||
>               (p.size != size) ||
> -             (p.count != *reps) ||
> +             (p.count > *reps) ||
>               (p.dir != dir) ||
>               (p.df != df) ||
>               (p.data_is_ptr != data_is_addr) )
> @@ -145,6 +145,8 @@ static int hvmemul_do_io(
> 
>          if ( data_is_addr )
>              return X86EMUL_UNHANDLEABLE;
> +
> +        *reps = p.count;
>          goto finish_access;
>      default:
>          return X86EMUL_UNHANDLEABLE;
> @@ -162,6 +164,13 @@ static int hvmemul_do_io(
> 
>      rc = hvm_io_intercept(&p);
> 
> +    /*
> +     * p.count may have got reduced (see hvm_process_io_intercept()) -
> inform
> +     * our callers and mirror this into latched state.
> +     */
> +    ASSERT(p.count <= *reps);
> +    *reps = vio->io_req.count = p.count;
> +
>      switch ( rc )
>      {
>      case X86EMUL_OKAY:
> 
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] x86/HVM: fix forwarding of internally cached requests (part 2)
  2016-04-28  9:33 ` [PATCH 2/2] x86/HVM: fix forwarding of internally cached requests (part 2) Jan Beulich
  2016-04-28  9:49   ` Paul Durrant
@ 2016-04-28  9:52   ` Andrew Cooper
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew Cooper @ 2016-04-28  9:52 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Paul Durrant, Wei Liu

On 28/04/16 10:33, Jan Beulich wrote:
> Commit 96ae556569 ("x86/HVM: fix forwarding of internally cached
> requests") wasn't quite complete: hvmemul_do_io() also needs to
> propagate up the clipped count. (I really should have re-tested the
> forward port resulting in the earlier change, instead of relying on the
> testing done on the older version of Xen which the fix was first needed
> for.)
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] x86/HVM: hvmemul_do_io() fixes
  2016-04-28  9:21 [PATCH 0/2] x86/HVM: hvmemul_do_io() fixes Jan Beulich
  2016-04-28  9:32 ` [PATCH 1/2] x86/HVM: fix emulation re-issue check Jan Beulich
  2016-04-28  9:33 ` [PATCH 2/2] x86/HVM: fix forwarding of internally cached requests (part 2) Jan Beulich
@ 2016-04-28 10:28 ` Wei Liu
  2 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2016-04-28 10:28 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Paul Durrant, Wei Liu

On Thu, Apr 28, 2016 at 03:21:23AM -0600, Jan Beulich wrote:
> These were found as "secondary" issues while trying to get REP MOVS
> to guest MSI-X tables to properly work (the changes needed for that
> one will constitute a second series about to be submitted).
> 
> 1: fix emulation re-issue check
> 2: fix forwarding of internally cached requests (part 2)
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 

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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-28 10:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-28  9:21 [PATCH 0/2] x86/HVM: hvmemul_do_io() fixes Jan Beulich
2016-04-28  9:32 ` [PATCH 1/2] x86/HVM: fix emulation re-issue check Jan Beulich
2016-04-28  9:44   ` Andrew Cooper
2016-04-28  9:33 ` [PATCH 2/2] x86/HVM: fix forwarding of internally cached requests (part 2) Jan Beulich
2016-04-28  9:49   ` Paul Durrant
2016-04-28  9:52   ` Andrew Cooper
2016-04-28 10:28 ` [PATCH 0/2] x86/HVM: hvmemul_do_io() fixes Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).