x86: constify microcode hypercall argument
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 29 Aug 2008 15:11:05 +0000 (16:11 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 29 Aug 2008 15:11:05 +0000 (16:11 +0100)
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@novell.com>
xen/arch/x86/microcode.c
xen/arch/x86/platform_hypercall.c
xen/include/asm-x86/processor.h
xen/include/public/platform.h
xen/include/xen/compat.h

index 89138c9a799a8f4ee4d75b5512261e5d6b183b32..d7882ea5b8ddc5e0d85f86d3a2341791d22c78f8 100644 (file)
@@ -124,7 +124,7 @@ static DEFINE_SPINLOCK(microcode_update_lock);
 /* 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 @@ out:
        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 b93dc71a239346a4d4520ff67f008df1b851be2d..571f412b0408e81666f8637b586106c9be5d5dfa 100644 (file)
@@ -147,8 +147,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
 
     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 d584d45b9e3e2a7784b1237a6b61dbc7157389c6..aa03bda970fbc7f3fdfd7d2814889ba394808343 100644 (file)
@@ -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 3f4fbfb661956877d98d7c164f069a84e5bb8d0d..742c0fc1c217e94e8c3a0dcad7bea2c4834a6e84 100644 (file)
@@ -97,7 +97,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_read_memtype_t);
 #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 a2a4d6c2dd95a714048775667f39bbd4d1e8da63..86395d134e8915fe7941c5afe38be99ae6fcd124 100644 (file)
@@ -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? */