All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86emul: MSR indexes are only 32 bits wide
@ 2016-02-15 11:57 Jan Beulich
  2016-02-15 12:51 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2016-02-15 11:57 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Keir Fraser

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

... and hence the respective {read,write}_msr() hook parameter doesn't
need to be "unsigned long".

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

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -966,7 +966,7 @@ static int hvmemul_write_io_discard(
 }
 
 static int hvmemul_write_msr_discard(
-    unsigned long reg,
+    unsigned int reg,
     uint64_t val,
     struct x86_emulate_ctxt *ctxt)
 {
@@ -1439,7 +1439,7 @@ static int hvmemul_write_cr(
 }
 
 static int hvmemul_read_msr(
-    unsigned long reg,
+    unsigned int reg,
     uint64_t *val,
     struct x86_emulate_ctxt *ctxt)
 {
@@ -1447,7 +1447,7 @@ static int hvmemul_read_msr(
 }
 
 static int hvmemul_write_msr(
-    unsigned long reg,
+    unsigned int reg,
     uint64_t val,
     struct x86_emulate_ctxt *ctxt)
 {
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -334,7 +334,7 @@ struct x86_emulate_ops
      *  @reg:   [IN ] Register to read.
      */
     int (*read_msr)(
-        unsigned long reg,
+        unsigned int reg,
         uint64_t *val,
         struct x86_emulate_ctxt *ctxt);
 
@@ -343,7 +343,7 @@ struct x86_emulate_ops
      *  @reg:   [IN ] Register to write.
      */
     int (*write_msr)(
-        unsigned long reg,
+        unsigned int reg,
         uint64_t val,
         struct x86_emulate_ctxt *ctxt);
 




[-- Attachment #2: x86emul-MSR-read-write.patch --]
[-- Type: text/plain, Size: 1469 bytes --]

x86emul: MSR indexes are only 32 bits wide

... and hence the respective {read,write}_msr() hook parameter doesn't
need to be "unsigned long".

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

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -966,7 +966,7 @@ static int hvmemul_write_io_discard(
 }
 
 static int hvmemul_write_msr_discard(
-    unsigned long reg,
+    unsigned int reg,
     uint64_t val,
     struct x86_emulate_ctxt *ctxt)
 {
@@ -1439,7 +1439,7 @@ static int hvmemul_write_cr(
 }
 
 static int hvmemul_read_msr(
-    unsigned long reg,
+    unsigned int reg,
     uint64_t *val,
     struct x86_emulate_ctxt *ctxt)
 {
@@ -1447,7 +1447,7 @@ static int hvmemul_read_msr(
 }
 
 static int hvmemul_write_msr(
-    unsigned long reg,
+    unsigned int reg,
     uint64_t val,
     struct x86_emulate_ctxt *ctxt)
 {
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -334,7 +334,7 @@ struct x86_emulate_ops
      *  @reg:   [IN ] Register to read.
      */
     int (*read_msr)(
-        unsigned long reg,
+        unsigned int reg,
         uint64_t *val,
         struct x86_emulate_ctxt *ctxt);
 
@@ -343,7 +343,7 @@ struct x86_emulate_ops
      *  @reg:   [IN ] Register to write.
      */
     int (*write_msr)(
-        unsigned long reg,
+        unsigned int reg,
         uint64_t val,
         struct x86_emulate_ctxt *ctxt);
 

[-- 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] 3+ messages in thread

* Re: [PATCH] x86emul: MSR indexes are only 32 bits wide
  2016-02-15 11:57 [PATCH] x86emul: MSR indexes are only 32 bits wide Jan Beulich
@ 2016-02-15 12:51 ` Andrew Cooper
  2016-02-15 12:59   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2016-02-15 12:51 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Keir Fraser

On 15/02/16 11:57, Jan Beulich wrote:
> ... and hence the respective {read,write}_msr() hook parameter doesn't
> need to be "unsigned long".
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

I would suggest uint32_t instead (being more architecturally
self-documenting), but either way, Reviewed-by: Andrew Cooper
<andrew.cooper3@citrix.com>

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

* Re: [PATCH] x86emul: MSR indexes are only 32 bits wide
  2016-02-15 12:51 ` Andrew Cooper
@ 2016-02-15 12:59   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2016-02-15 12:59 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel, Keir Fraser

>>> On 15.02.16 at 13:51, <andrew.cooper3@citrix.com> wrote:
> On 15/02/16 11:57, Jan Beulich wrote:
>> ... and hence the respective {read,write}_msr() hook parameter doesn't
>> need to be "unsigned long".
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> I would suggest uint32_t instead (being more architecturally
> self-documenting), but either way, Reviewed-by: Andrew Cooper
> <andrew.cooper3@citrix.com>

While it might be "more architecturally self-documenting", it would
also be less in line with types used elsewhere (at least for those
pieces which I had looked at). This consistency consideration made
me use unsigned int (which we imply to be at least 32 bits wide
anyway).

Jan

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

end of thread, other threads:[~2016-02-15 12:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-15 11:57 [PATCH] x86emul: MSR indexes are only 32 bits wide Jan Beulich
2016-02-15 12:51 ` Andrew Cooper
2016-02-15 12:59   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.