xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nested vmx: fix I/O port bitmap indexing arithmetic
@ 2013-11-29 22:38 Matthew Daley
  2013-12-02  5:24 ` Zhang, Yang Z
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matthew Daley @ 2013-11-29 22:38 UTC (permalink / raw)
  To: xen-devel
  Cc: Keir Fraser, Matthew Daley, Eddie Dong, Jan Beulich, Jun Nakajima

The I/O port bitmap holds 8 ports per element, and hence the port number
used when indexing into it should be shifted right by 3 bits, not 4.

Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
---
Jan: I'm not sure if this also needs a fixup similar to what you did in
SVM code with commit b1e87805bf.

 xen/arch/x86/hvm/vmx/vvmx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 248e975..7fa110e 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -2225,7 +2225,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
             __vmread(EXIT_QUALIFICATION, &qual);
             port = qual >> 16;
             bitmap = nvmx->iobitmap[port >> 15];
-            if ( bitmap[(port & 0x7fff) >> 4] & (1 << (port & 0x7)) )
+            if ( bitmap[(port & 0x7fff) >> 3] & (1 << (port & 0x7)) )
                 nvcpu->nv_vmexit_pending = 1;
             if ( !nvcpu->nv_vmexit_pending )
                gdprintk(XENLOG_WARNING, "L0 PIO %x.\n", port);
-- 
1.7.10.4

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

* Re: [PATCH] nested vmx: fix I/O port bitmap indexing arithmetic
  2013-11-29 22:38 [PATCH] nested vmx: fix I/O port bitmap indexing arithmetic Matthew Daley
@ 2013-12-02  5:24 ` Zhang, Yang Z
  2013-12-02  7:08 ` Dong, Eddie
  2013-12-02  9:05 ` Jan Beulich
  2 siblings, 0 replies; 4+ messages in thread
From: Zhang, Yang Z @ 2013-12-02  5:24 UTC (permalink / raw)
  To: Matthew Daley, xen-devel@lists.xen.org
  Cc: Dong, Eddie, Keir Fraser, Nakajima, Jun, Jan Beulich

Matthew Daley wrote on 2013-11-30:
> The I/O port bitmap holds 8 ports per element, and hence the port
> number used when indexing into it should be shifted right by 3 bits, not 4.
> 
> Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
> ---
> Jan: I'm not sure if this also needs a fixup similar to what you did
> in SVM code with commit b1e87805bf.
> 
>  xen/arch/x86/hvm/vmx/vvmx.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
> index 248e975..7fa110e 100644
> --- a/xen/arch/x86/hvm/vmx/vvmx.c
> +++ b/xen/arch/x86/hvm/vmx/vvmx.c
> @@ -2225,7 +2225,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs
> *regs,
>              __vmread(EXIT_QUALIFICATION, &qual);
>              port = qual >> 16;
>              bitmap = nvmx->iobitmap[port >> 15];
> -            if ( bitmap[(port & 0x7fff) >> 4] & (1 << (port & 0x7)) )
> +            if ( bitmap[(port & 0x7fff) >> 3] & (1 << (port & 0x7)) )
>                  nvcpu->nv_vmexit_pending = 1;
>              if ( !nvcpu->nv_vmexit_pending )
>                 gdprintk(XENLOG_WARNING, "L0 PIO %x.\n", port);

Reviewed-by: Yang Zhang <yang.z.zhang@intel.com>

Best regards,
Yang

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

* Re: [PATCH] nested vmx: fix I/O port bitmap indexing arithmetic
  2013-11-29 22:38 [PATCH] nested vmx: fix I/O port bitmap indexing arithmetic Matthew Daley
  2013-12-02  5:24 ` Zhang, Yang Z
@ 2013-12-02  7:08 ` Dong, Eddie
  2013-12-02  9:05 ` Jan Beulich
  2 siblings, 0 replies; 4+ messages in thread
From: Dong, Eddie @ 2013-12-02  7:08 UTC (permalink / raw)
  To: Matthew Daley, xen-devel@lists.xen.org
  Cc: Dong, Eddie, Keir Fraser, Jan Beulich, Nakajima, Jun

Acked-by Eddie Dong <eddie.dong@intel.com>

-----Original Message-----
From: Matthew Daley [mailto:mattd@bugfuzz.com] 
Sent: Saturday, November 30, 2013 6:39 AM
To: xen-devel@lists.xen.org
Cc: Matthew Daley; Nakajima, Jun; Dong, Eddie; Keir Fraser; Jan Beulich
Subject: [PATCH] nested vmx: fix I/O port bitmap indexing arithmetic

The I/O port bitmap holds 8 ports per element, and hence the port number used when indexing into it should be shifted right by 3 bits, not 4.

Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
---
Jan: I'm not sure if this also needs a fixup similar to what you did in SVM code with commit b1e87805bf.

 xen/arch/x86/hvm/vmx/vvmx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 248e975..7fa110e 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -2225,7 +2225,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
             __vmread(EXIT_QUALIFICATION, &qual);
             port = qual >> 16;
             bitmap = nvmx->iobitmap[port >> 15];
-            if ( bitmap[(port & 0x7fff) >> 4] & (1 << (port & 0x7)) )
+            if ( bitmap[(port & 0x7fff) >> 3] & (1 << (port & 0x7)) )
                 nvcpu->nv_vmexit_pending = 1;
             if ( !nvcpu->nv_vmexit_pending )
                gdprintk(XENLOG_WARNING, "L0 PIO %x.\n", port);
--
1.7.10.4

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

* Re: [PATCH] nested vmx: fix I/O port bitmap indexing arithmetic
  2013-11-29 22:38 [PATCH] nested vmx: fix I/O port bitmap indexing arithmetic Matthew Daley
  2013-12-02  5:24 ` Zhang, Yang Z
  2013-12-02  7:08 ` Dong, Eddie
@ 2013-12-02  9:05 ` Jan Beulich
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2013-12-02  9:05 UTC (permalink / raw)
  To: Matthew Daley; +Cc: xen-devel, Keir Fraser, Eddie Dong, Jun Nakajima

>>> On 29.11.13 at 23:38, Matthew Daley <mattd@bugfuzz.com> wrote:
> The I/O port bitmap holds 8 ports per element, and hence the port number
> used when indexing into it should be shifted right by 3 bits, not 4.
> 
> Signed-off-by: Matthew Daley <mattd@bugfuzz.com>
> ---
> Jan: I'm not sure if this also needs a fixup similar to what you did in
> SVM code with commit b1e87805bf.

Yes, definitely. The wrapping behavior is different for VMX though.
In fact, I'd prefer the whole fix to be done in one go (unless you
tell me that you're not going to find time to do so any time soon).

Jan

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

end of thread, other threads:[~2013-12-02  9:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-29 22:38 [PATCH] nested vmx: fix I/O port bitmap indexing arithmetic Matthew Daley
2013-12-02  5:24 ` Zhang, Yang Z
2013-12-02  7:08 ` Dong, Eddie
2013-12-02  9:05 ` Jan Beulich

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).