[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] constify microcode hypercall argument



Linux 2.6.27 marks the data pointer in its firmware struct 'const', and
hence, to avoid a compiler warning, Xen's microcode update interface
should be properly properly constified too.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2008-08-06/xen/arch/x86/microcode.c
===================================================================
--- 2008-08-06.orig/xen/arch/x86/microcode.c    2008-06-12 09:20:38.000000000 
+0200
+++ 2008-08-06/xen/arch/x86/microcode.c 2008-08-20 12:33:03.000000000 +0200
@@ -124,7 +124,7 @@ boolean_param("microcode.verbose", verbo
 /* no concurrent ->write()s are allowed on /dev/cpu/microcode */
 static DEFINE_MUTEX(microcode_mutex);
 
-static void __user *user_buffer;       /* user area microcode data buffer */
+static const void __user *user_buffer; /* user area microcode data buffer */
 static unsigned int user_buffer_size;  /* it's size */
 
 typedef enum mc_error_code {
@@ -455,7 +455,7 @@ static int do_microcode_update (void)
        return error;
 }
 
-int microcode_update(XEN_GUEST_HANDLE(void) buf, unsigned long len)
+int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len)
 {
        int ret;
 
Index: 2008-08-06/xen/arch/x86/platform_hypercall.c
===================================================================
--- 2008-08-06.orig/xen/arch/x86/platform_hypercall.c   2008-08-01 
08:48:42.000000000 +0200
+++ 2008-08-06/xen/arch/x86/platform_hypercall.c        2008-08-20 
12:34:23.000000000 +0200
@@ -147,8 +147,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
 
     case XENPF_microcode_update:
     {
-        extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len);
-        XEN_GUEST_HANDLE(void) data;
+        XEN_GUEST_HANDLE(const_void) data;
 
         ret = xsm_microcode();
         if ( ret )
Index: 2008-08-06/xen/include/asm-x86/processor.h
===================================================================
--- 2008-08-06.orig/xen/include/asm-x86/processor.h     2008-05-07 
12:21:37.000000000 +0200
+++ 2008-08-06/xen/include/asm-x86/processor.h  2008-08-20 12:34:43.000000000 
+0200
@@ -583,6 +583,8 @@ int rdmsr_hypervisor_regs(
 int wrmsr_hypervisor_regs(
     uint32_t idx, uint32_t eax, uint32_t edx);
 
+int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __ASM_X86_PROCESSOR_H */
Index: 2008-08-06/xen/include/public/platform.h
===================================================================
--- 2008-08-06.orig/xen/include/public/platform.h       2008-05-15 
14:51:17.000000000 +0200
+++ 2008-08-06/xen/include/public/platform.h    2008-08-20 12:30:50.000000000 
+0200
@@ -97,7 +97,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_read_memty
 #define XENPF_microcode_update    35
 struct xenpf_microcode_update {
     /* IN variables. */
-    XEN_GUEST_HANDLE(void) data;      /* Pointer to microcode data */
+    XEN_GUEST_HANDLE(const_void) data;/* Pointer to microcode data */
     uint32_t length;                  /* Length of microcode data. */
 };
 typedef struct xenpf_microcode_update xenpf_microcode_update_t;
Index: 2008-08-06/xen/include/xen/compat.h
===================================================================
--- 2008-08-06.orig/xen/include/xen/compat.h    2008-06-16 10:43:34.000000000 
+0200
+++ 2008-08-06/xen/include/xen/compat.h 2008-08-20 13:57:27.000000000 +0200
@@ -19,7 +19,9 @@
         type *_[0] __attribute__((__packed__)); \
     } __compat_handle_ ## name
 
-#define DEFINE_COMPAT_HANDLE(name)   __DEFINE_COMPAT_HANDLE(name, name)
+#define DEFINE_COMPAT_HANDLE(name) \
+    __DEFINE_COMPAT_HANDLE(name, name); \
+    __DEFINE_COMPAT_HANDLE(const_ ## name, const name)
 #define COMPAT_HANDLE(name)          __compat_handle_ ## name
 
 /* Is the compat handle a NULL reference? */




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.