All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] constify microcode hypercall argument
@ 2008-08-29 12:33 Jan Beulich
  2008-08-29 13:55 ` Christoph Egger
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2008-08-29 12:33 UTC (permalink / raw)
  To: xen-devel

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

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

* Re: [PATCH] constify microcode hypercall argument
  2008-08-29 12:33 [PATCH] constify microcode hypercall argument Jan Beulich
@ 2008-08-29 13:55 ` Christoph Egger
  2008-08-29 14:28   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Egger @ 2008-08-29 13:55 UTC (permalink / raw)
  To: xen-devel

On Friday 29 August 2008 14:33:08 Jan Beulich wrote:
> 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.

What makes you confident, that this reason applies to other operating systems
(Solaris, BSD) , too ?

Christoph


-- 
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy

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

* Re: [PATCH] constify microcode hypercall argument
  2008-08-29 13:55 ` Christoph Egger
@ 2008-08-29 14:28   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2008-08-29 14:28 UTC (permalink / raw)
  To: Christoph Egger; +Cc: xen-devel

>>> Christoph Egger <Christoph.Egger@amd.com> 29.08.08 15:55 >>>
>On Friday 29 August 2008 14:33:08 Jan Beulich wrote:
>> 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.
>
>What makes you confident, that this reason applies to other operating systems
>(Solaris, BSD) , too ?

Adding 'const' on the consumer side is always safe, as long as the consumer
guarantees it won't violate the promise. The consumer here is Xen, so
there are no worries about individual guest OSes.

Jan

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

end of thread, other threads:[~2008-08-29 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-29 12:33 [PATCH] constify microcode hypercall argument Jan Beulich
2008-08-29 13:55 ` Christoph Egger
2008-08-29 14:28   ` 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.