All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <jbeulich@novell.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] constify microcode hypercall argument
Date: Fri, 29 Aug 2008 13:33:08 +0100	[thread overview]
Message-ID: <48B808A4.76E4.0078.0@novell.com> (raw)

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>

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? */

             reply	other threads:[~2008-08-29 12:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-29 12:33 Jan Beulich [this message]
2008-08-29 13:55 ` [PATCH] constify microcode hypercall argument Christoph Egger
2008-08-29 14:28   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48B808A4.76E4.0078.0@novell.com \
    --to=jbeulich@novell.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.