# HG changeset patch # User Keir Fraser # Date 1220022665 -3600 # Node ID 481f0dc6beb0b19cb02354dbe9b4ce068a5f6a18 # Parent cd078a3d600e6a1bab65e6392a60a832253cff8b x86: 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 Index: xen-3.3.1-testing/xen/arch/x86/microcode.c =================================================================== --- xen-3.3.1-testing.orig/xen/arch/x86/microcode.c +++ xen-3.3.1-testing/xen/arch/x86/microcode.c @@ -124,7 +124,7 @@ static DEFINE_SPINLOCK(microcode_update_ /* 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: xen-3.3.1-testing/xen/arch/x86/platform_hypercall.c =================================================================== --- xen-3.3.1-testing.orig/xen/arch/x86/platform_hypercall.c +++ xen-3.3.1-testing/xen/arch/x86/platform_hypercall.c @@ -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: xen-3.3.1-testing/xen/include/asm-x86/processor.h =================================================================== --- xen-3.3.1-testing.orig/xen/include/asm-x86/processor.h +++ xen-3.3.1-testing/xen/include/asm-x86/processor.h @@ -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: xen-3.3.1-testing/xen/include/public/platform.h =================================================================== --- xen-3.3.1-testing.orig/xen/include/public/platform.h +++ xen-3.3.1-testing/xen/include/public/platform.h @@ -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: xen-3.3.1-testing/xen/include/xen/compat.h =================================================================== --- xen-3.3.1-testing.orig/xen/include/xen/compat.h +++ xen-3.3.1-testing/xen/include/xen/compat.h @@ -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? */