All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication
@ 2011-07-19  9:14 Jan Beulich
  2011-07-21  9:32 ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2011-07-19  9:14 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 5167 bytes --]

This is the kernel side change accompanying the earlier sent Xen side
patch titled identically.

(This depends on the public headers to be synced over after the
respective hypervisor side change.)

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- a/arch/i386/kernel/head-xen.S
+++ b/arch/i386/kernel/head-xen.S
@@ -12,6 +12,7 @@
 #include <asm/dwarf2.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/elfnote.h>
+#include <xen/interface/features.h>
 
 /*
  * References to members of the new_cpu_data structure.
@@ -142,6 +143,19 @@ ENTRY(cpu_gdt_table)
 	.quad 0x0000000000000000	/* 0xf0 - unused */
 	.quad 0x0000000000000000	/* 0xf8 - GDT entry 31: double-fault TSS */
 
+#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
+# define XEN_PRIV_CAP		(1 << XENFEAT_unprivileged)
+# define XEN_PRIV_CAP_STR	"|!unprivileged"
+#else
+# define XEN_PRIV_CAP		((1 << XENFEAT_privileged) | \
+				(1 << XENFEAT_unprivileged))
+# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
+#endif
+#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
+# undef XEN_PRIV_CAP_STR
+# define XEN_PRIV_CAP_STR ""
+#endif
+
 #if CONFIG_XEN_COMPAT <= 0x030002
 /*
  * __xen_guest information
@@ -168,7 +182,8 @@ ENTRY(cpu_gdt_table)
 		utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
 	.ascii	",HYPERCALL_PAGE=0x"
 		utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
-	.ascii  ",FEATURES=writable_page_tables"
+	.ascii  ",FEATURES=" XEN_PRIV_CAP
+	.ascii	         "|writable_page_tables"
 	.ascii	         "|writable_descriptor_tables"
 	.ascii	         "|auto_translated_physmap"
 	.ascii	         "|pae_pgdir_above_4gb"
@@ -195,7 +210,18 @@ ENTRY(cpu_gdt_table)
 	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long,  startup_32)
 	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long,  hypercall_page)
 	ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   .long,  HYPERVISOR_VIRT_START)
-	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
+	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
+						 .ascii  "|writable_descriptor_tables";
+						 .ascii  "|auto_translated_physmap";
+						 .ascii  "|pae_pgdir_above_4gb";
+						 .ascii  "|supervisor_mode_kernel";
+						 .asciz  XEN_PRIV_CAP_STR)
+	ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
+					   (1 << XENFEAT_writable_page_tables) |
+					   (1 << XENFEAT_writable_descriptor_tables) |
+					   (1 << XENFEAT_auto_translated_physmap) |
+					   (1 << XENFEAT_pae_pgdir_above_4gb) |
+					   (1 << XENFEAT_supervisor_mode_kernel))
 #ifdef CONFIG_X86_PAE
 	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "yes")
 	ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  _PAGE_PRESENT,_PAGE_PRESENT)
--- a/arch/x86_64/kernel/head-xen.S
+++ b/arch/x86_64/kernel/head-xen.S
@@ -24,6 +24,7 @@
 #include <asm/cache.h>
 #include <asm/dwarf2.h>
 #include <xen/interface/elfnote.h>
+#include <xen/interface/features.h>
 
 	.section .bootstrap.text, "ax", @progbits
 	.code64
@@ -160,6 +161,19 @@ gdt_end:
 ENTRY(empty_zero_page)
 	.skip PAGE_SIZE
 
+#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
+# define XEN_PRIV_CAP		(1 << XENFEAT_unprivileged)
+# define XEN_PRIV_CAP_STR	"|!unprivileged"
+#else
+# define XEN_PRIV_CAP		((1 << XENFEAT_privileged) | \
+				(1 << XENFEAT_unprivileged))
+# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
+#endif
+#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
+# undef XEN_PRIV_CAP_STR
+# define XEN_PRIV_CAP_STR ""
+#endif
+
 #if CONFIG_XEN_COMPAT <= 0x030002
 /*
  * __xen_guest information
@@ -186,7 +200,8 @@ ENTRY(empty_zero_page)
 		utoh (__START_KERNEL_map + __PHYSICAL_START)
 	.ascii	",HYPERCALL_PAGE=0x"
 		utoh (phys_hypercall_page >> PAGE_SHIFT)
-	.ascii  ",FEATURES=writable_page_tables"
+	.ascii  ",FEATURES=" XEN_PRIV_CAP
+	.ascii		 "|writable_page_tables"
 	.ascii		 "|writable_descriptor_tables"
 	.ascii		 "|auto_translated_physmap"
 	.ascii	         "|supervisor_mode_kernel"
@@ -206,6 +221,15 @@ ENTRY(empty_zero_page)
 	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .quad,  startup_64)
 	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad,  hypercall_page)
 	ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  _PAGE_PRESENT,_PAGE_PRESENT)
-	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|supervisor_mode_kernel")
+	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
+						 .ascii  "|writable_descriptor_tables";
+						 .ascii  "|auto_translated_physmap";
+						 .ascii  "|supervisor_mode_kernel";
+						 .asciz  XEN_PRIV_CAP_STR)
+	ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
+					   (1 << XENFEAT_writable_page_tables) |
+					   (1 << XENFEAT_writable_descriptor_tables) |
+					   (1 << XENFEAT_auto_translated_physmap) |
+					   (1 << XENFEAT_supervisor_mode_kernel))
 	ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
 	ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long,  1)



[-- Attachment #2: xen-kernel-cap.patch --]
[-- Type: text/plain, Size: 5163 bytes --]

This is the kernel side change accompanying the earlier sent Xen side
patch titled identically.

(This depends on the public headers to be synced over after the
respective hypervisor side change.)

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- a/arch/i386/kernel/head-xen.S
+++ b/arch/i386/kernel/head-xen.S
@@ -12,6 +12,7 @@
 #include <asm/dwarf2.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/elfnote.h>
+#include <xen/interface/features.h>
 
 /*
  * References to members of the new_cpu_data structure.
@@ -142,6 +143,19 @@ ENTRY(cpu_gdt_table)
 	.quad 0x0000000000000000	/* 0xf0 - unused */
 	.quad 0x0000000000000000	/* 0xf8 - GDT entry 31: double-fault TSS */
 
+#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
+# define XEN_PRIV_CAP		(1 << XENFEAT_unprivileged)
+# define XEN_PRIV_CAP_STR	"|!unprivileged"
+#else
+# define XEN_PRIV_CAP		((1 << XENFEAT_privileged) | \
+				(1 << XENFEAT_unprivileged))
+# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
+#endif
+#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
+# undef XEN_PRIV_CAP_STR
+# define XEN_PRIV_CAP_STR ""
+#endif
+
 #if CONFIG_XEN_COMPAT <= 0x030002
 /*
  * __xen_guest information
@@ -168,7 +182,8 @@ ENTRY(cpu_gdt_table)
 		utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
 	.ascii	",HYPERCALL_PAGE=0x"
 		utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
-	.ascii  ",FEATURES=writable_page_tables"
+	.ascii  ",FEATURES=" XEN_PRIV_CAP
+	.ascii	         "|writable_page_tables"
 	.ascii	         "|writable_descriptor_tables"
 	.ascii	         "|auto_translated_physmap"
 	.ascii	         "|pae_pgdir_above_4gb"
@@ -195,7 +210,18 @@ ENTRY(cpu_gdt_table)
 	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long,  startup_32)
 	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long,  hypercall_page)
 	ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   .long,  HYPERVISOR_VIRT_START)
-	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
+	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
+						 .ascii  "|writable_descriptor_tables";
+						 .ascii  "|auto_translated_physmap";
+						 .ascii  "|pae_pgdir_above_4gb";
+						 .ascii  "|supervisor_mode_kernel";
+						 .asciz  XEN_PRIV_CAP_STR)
+	ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
+					   (1 << XENFEAT_writable_page_tables) |
+					   (1 << XENFEAT_writable_descriptor_tables) |
+					   (1 << XENFEAT_auto_translated_physmap) |
+					   (1 << XENFEAT_pae_pgdir_above_4gb) |
+					   (1 << XENFEAT_supervisor_mode_kernel))
 #ifdef CONFIG_X86_PAE
 	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "yes")
 	ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  _PAGE_PRESENT,_PAGE_PRESENT)
--- a/arch/x86_64/kernel/head-xen.S
+++ b/arch/x86_64/kernel/head-xen.S
@@ -24,6 +24,7 @@
 #include <asm/cache.h>
 #include <asm/dwarf2.h>
 #include <xen/interface/elfnote.h>
+#include <xen/interface/features.h>
 
 	.section .bootstrap.text, "ax", @progbits
 	.code64
@@ -160,6 +161,19 @@ gdt_end:
 ENTRY(empty_zero_page)
 	.skip PAGE_SIZE
 
+#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
+# define XEN_PRIV_CAP		(1 << XENFEAT_unprivileged)
+# define XEN_PRIV_CAP_STR	"|!unprivileged"
+#else
+# define XEN_PRIV_CAP		((1 << XENFEAT_privileged) | \
+				(1 << XENFEAT_unprivileged))
+# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
+#endif
+#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
+# undef XEN_PRIV_CAP_STR
+# define XEN_PRIV_CAP_STR ""
+#endif
+
 #if CONFIG_XEN_COMPAT <= 0x030002
 /*
  * __xen_guest information
@@ -186,7 +200,8 @@ ENTRY(empty_zero_page)
 		utoh (__START_KERNEL_map + __PHYSICAL_START)
 	.ascii	",HYPERCALL_PAGE=0x"
 		utoh (phys_hypercall_page >> PAGE_SHIFT)
-	.ascii  ",FEATURES=writable_page_tables"
+	.ascii  ",FEATURES=" XEN_PRIV_CAP
+	.ascii		 "|writable_page_tables"
 	.ascii		 "|writable_descriptor_tables"
 	.ascii		 "|auto_translated_physmap"
 	.ascii	         "|supervisor_mode_kernel"
@@ -206,6 +221,15 @@ ENTRY(empty_zero_page)
 	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .quad,  startup_64)
 	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad,  hypercall_page)
 	ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  _PAGE_PRESENT,_PAGE_PRESENT)
-	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|supervisor_mode_kernel")
+	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
+						 .ascii  "|writable_descriptor_tables";
+						 .ascii  "|auto_translated_physmap";
+						 .ascii  "|supervisor_mode_kernel";
+						 .asciz  XEN_PRIV_CAP_STR)
+	ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
+					   (1 << XENFEAT_writable_page_tables) |
+					   (1 << XENFEAT_writable_descriptor_tables) |
+					   (1 << XENFEAT_auto_translated_physmap) |
+					   (1 << XENFEAT_supervisor_mode_kernel))
 	ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
 	ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long,  1)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

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

* Re: [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication
  2011-07-19  9:14 [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication Jan Beulich
@ 2011-07-21  9:32 ` Keir Fraser
  2011-07-21  9:45   ` Ian Campbell
  2011-07-21  9:55   ` Jan Beulich
  0 siblings, 2 replies; 6+ messages in thread
From: Keir Fraser @ 2011-07-21  9:32 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

Aren't XEN_PRIV_CAP_STR parts pointless? Any hypervisor new enough to
understand those features will also understand
XEN_ELFNOTE_SUPPORTED_FEATURE?

 -- Keir

On 19/07/2011 10:14, "Jan Beulich" <JBeulich@novell.com> wrote:

> This is the kernel side change accompanying the earlier sent Xen side
> patch titled identically.
> 
> (This depends on the public headers to be synced over after the
> respective hypervisor side change.)
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> 
> --- a/arch/i386/kernel/head-xen.S
> +++ b/arch/i386/kernel/head-xen.S
> @@ -12,6 +12,7 @@
>  #include <asm/dwarf2.h>
>  #include <xen/interface/xen.h>
>  #include <xen/interface/elfnote.h>
> +#include <xen/interface/features.h>
>  
>  /*
>   * References to members of the new_cpu_data structure.
> @@ -142,6 +143,19 @@ ENTRY(cpu_gdt_table)
> .quad 0x0000000000000000 /* 0xf0 - unused */
> .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
>  
> +#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
> +# define XEN_PRIV_CAP  (1 << XENFEAT_unprivileged)
> +# define XEN_PRIV_CAP_STR "|!unprivileged"
> +#else
> +# define XEN_PRIV_CAP  ((1 << XENFEAT_privileged) | \
> +    (1 << XENFEAT_unprivileged))
> +# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
> +#endif
> +#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
> +# undef XEN_PRIV_CAP_STR
> +# define XEN_PRIV_CAP_STR ""
> +#endif
> +
>  #if CONFIG_XEN_COMPAT <= 0x030002
>  /*
>   * __xen_guest information
> @@ -168,7 +182,8 @@ ENTRY(cpu_gdt_table)
> utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
> .ascii ",HYPERCALL_PAGE=0x"
> utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
> - .ascii  ",FEATURES=writable_page_tables"
> + .ascii  ",FEATURES=" XEN_PRIV_CAP
> + .ascii          "|writable_page_tables"
> .ascii          "|writable_descriptor_tables"
> .ascii          "|auto_translated_physmap"
> .ascii          "|pae_pgdir_above_4gb"
> @@ -195,7 +210,18 @@ ENTRY(cpu_gdt_table)
> ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long,  startup_32)
> ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long,  hypercall_page)
> ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   .long,  HYPERVISOR_VIRT_START)
> - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz,
> "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_p
> gdir_above_4gb|supervisor_mode_kernel")
> + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
> +       .ascii  "|writable_descriptor_tables";
> +       .ascii  "|auto_translated_physmap";
> +       .ascii  "|pae_pgdir_above_4gb";
> +       .ascii  "|supervisor_mode_kernel";
> +       .asciz  XEN_PRIV_CAP_STR)
> + ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
> +        (1 << XENFEAT_writable_page_tables) |
> +        (1 << XENFEAT_writable_descriptor_tables) |
> +        (1 << XENFEAT_auto_translated_physmap) |
> +        (1 << XENFEAT_pae_pgdir_above_4gb) |
> +        (1 << XENFEAT_supervisor_mode_kernel))
>  #ifdef CONFIG_X86_PAE
> ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "yes")
> ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  _PAGE_PRESENT,_PAGE_PRESENT)
> --- a/arch/x86_64/kernel/head-xen.S
> +++ b/arch/x86_64/kernel/head-xen.S
> @@ -24,6 +24,7 @@
>  #include <asm/cache.h>
>  #include <asm/dwarf2.h>
>  #include <xen/interface/elfnote.h>
> +#include <xen/interface/features.h>
>  
> .section .bootstrap.text, "ax", @progbits
> .code64
> @@ -160,6 +161,19 @@ gdt_end:
>  ENTRY(empty_zero_page)
> .skip PAGE_SIZE
>  
> +#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
> +# define XEN_PRIV_CAP  (1 << XENFEAT_unprivileged)
> +# define XEN_PRIV_CAP_STR "|!unprivileged"
> +#else
> +# define XEN_PRIV_CAP  ((1 << XENFEAT_privileged) | \
> +    (1 << XENFEAT_unprivileged))
> +# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
> +#endif
> +#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
> +# undef XEN_PRIV_CAP_STR
> +# define XEN_PRIV_CAP_STR ""
> +#endif
> +
>  #if CONFIG_XEN_COMPAT <= 0x030002
>  /*
>   * __xen_guest information
> @@ -186,7 +200,8 @@ ENTRY(empty_zero_page)
> utoh (__START_KERNEL_map + __PHYSICAL_START)
> .ascii ",HYPERCALL_PAGE=0x"
> utoh (phys_hypercall_page >> PAGE_SHIFT)
> - .ascii  ",FEATURES=writable_page_tables"
> + .ascii  ",FEATURES=" XEN_PRIV_CAP
> + .ascii   "|writable_page_tables"
> .ascii   "|writable_descriptor_tables"
> .ascii   "|auto_translated_physmap"
> .ascii          "|supervisor_mode_kernel"
> @@ -206,6 +221,15 @@ ENTRY(empty_zero_page)
> ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .quad,  startup_64)
> ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad,  hypercall_page)
> ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  _PAGE_PRESENT,_PAGE_PRESENT)
> - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz,
> "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|super
> visor_mode_kernel")
> + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
> +       .ascii  "|writable_descriptor_tables";
> +       .ascii  "|auto_translated_physmap";
> +       .ascii  "|supervisor_mode_kernel";
> +       .asciz  XEN_PRIV_CAP_STR)
> + ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
> +        (1 << XENFEAT_writable_page_tables) |
> +        (1 << XENFEAT_writable_descriptor_tables) |
> +        (1 << XENFEAT_auto_translated_physmap) |
> +        (1 << XENFEAT_supervisor_mode_kernel))
> ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
> ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long,  1)
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

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

* Re: [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication
  2011-07-21  9:32 ` Keir Fraser
@ 2011-07-21  9:45   ` Ian Campbell
  2011-07-21  9:57     ` Jan Beulich
  2011-07-21  9:55   ` Jan Beulich
  1 sibling, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2011-07-21  9:45 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel, Jan Beulich

On Thu, 2011-07-21 at 10:32 +0100, Keir Fraser wrote:
> Aren't XEN_PRIV_CAP_STR parts pointless? Any hypervisor new enough to
> understand those features will also understand
> XEN_ELFNOTE_SUPPORTED_FEATURE?

And didn't adding new features to that string break on existing
hypervisors -- hence the new interface?

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

* Re: [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication
  2011-07-21  9:32 ` Keir Fraser
  2011-07-21  9:45   ` Ian Campbell
@ 2011-07-21  9:55   ` Jan Beulich
  2011-07-21 10:00     ` Ian Campbell
  1 sibling, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2011-07-21  9:55 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

>>> On 21.07.11 at 11:32, Keir Fraser <keir@xen.org> wrote:
> Aren't XEN_PRIV_CAP_STR parts pointless? Any hypervisor new enough to
> understand those features will also understand
> XEN_ELFNOTE_SUPPORTED_FEATURE?

It's more for completeness (so that when XEN_COMPAT set high enough
one can e.g. inspect the ELF notes without needing to understand binary
values).

Jan

>  -- Keir
> 
> On 19/07/2011 10:14, "Jan Beulich" <JBeulich@novell.com> wrote:
> 
>> This is the kernel side change accompanying the earlier sent Xen side
>> patch titled identically.
>> 
>> (This depends on the public headers to be synced over after the
>> respective hypervisor side change.)
>> 
>> Signed-off-by: Jan Beulich <jbeulich@novell.com>
>> 
>> --- a/arch/i386/kernel/head-xen.S
>> +++ b/arch/i386/kernel/head-xen.S
>> @@ -12,6 +12,7 @@
>>  #include <asm/dwarf2.h>
>>  #include <xen/interface/xen.h>
>>  #include <xen/interface/elfnote.h>
>> +#include <xen/interface/features.h>
>>  
>>  /*
>>   * References to members of the new_cpu_data structure.
>> @@ -142,6 +143,19 @@ ENTRY(cpu_gdt_table)
>> .quad 0x0000000000000000 /* 0xf0 - unused */
>> .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
>>  
>> +#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
>> +# define XEN_PRIV_CAP  (1 << XENFEAT_unprivileged)
>> +# define XEN_PRIV_CAP_STR "|!unprivileged"
>> +#else
>> +# define XEN_PRIV_CAP  ((1 << XENFEAT_privileged) | \
>> +    (1 << XENFEAT_unprivileged))
>> +# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
>> +#endif
>> +#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
>> +# undef XEN_PRIV_CAP_STR
>> +# define XEN_PRIV_CAP_STR ""
>> +#endif
>> +
>>  #if CONFIG_XEN_COMPAT <= 0x030002
>>  /*
>>   * __xen_guest information
>> @@ -168,7 +182,8 @@ ENTRY(cpu_gdt_table)
>> utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
>> .ascii ",HYPERCALL_PAGE=0x"
>> utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
>> - .ascii  ",FEATURES=writable_page_tables"
>> + .ascii  ",FEATURES=" XEN_PRIV_CAP
>> + .ascii          "|writable_page_tables"
>> .ascii          "|writable_descriptor_tables"
>> .ascii          "|auto_translated_physmap"
>> .ascii          "|pae_pgdir_above_4gb"
>> @@ -195,7 +210,18 @@ ENTRY(cpu_gdt_table)
>> ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long,  startup_32)
>> ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long,  hypercall_page)
>> ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   .long,  HYPERVISOR_VIRT_START)
>> - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz,
>> 
> "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_
> p
>> gdir_above_4gb|supervisor_mode_kernel")
>> + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
>> +       .ascii  "|writable_descriptor_tables";
>> +       .ascii  "|auto_translated_physmap";
>> +       .ascii  "|pae_pgdir_above_4gb";
>> +       .ascii  "|supervisor_mode_kernel";
>> +       .asciz  XEN_PRIV_CAP_STR)
>> + ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
>> +        (1 << XENFEAT_writable_page_tables) |
>> +        (1 << XENFEAT_writable_descriptor_tables) |
>> +        (1 << XENFEAT_auto_translated_physmap) |
>> +        (1 << XENFEAT_pae_pgdir_above_4gb) |
>> +        (1 << XENFEAT_supervisor_mode_kernel))
>>  #ifdef CONFIG_X86_PAE
>> ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "yes")
>> ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  
> _PAGE_PRESENT,_PAGE_PRESENT)
>> --- a/arch/x86_64/kernel/head-xen.S
>> +++ b/arch/x86_64/kernel/head-xen.S
>> @@ -24,6 +24,7 @@
>>  #include <asm/cache.h>
>>  #include <asm/dwarf2.h>
>>  #include <xen/interface/elfnote.h>
>> +#include <xen/interface/features.h>
>>  
>> .section .bootstrap.text, "ax", @progbits
>> .code64
>> @@ -160,6 +161,19 @@ gdt_end:
>>  ENTRY(empty_zero_page)
>> .skip PAGE_SIZE
>>  
>> +#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
>> +# define XEN_PRIV_CAP  (1 << XENFEAT_unprivileged)
>> +# define XEN_PRIV_CAP_STR "|!unprivileged"
>> +#else
>> +# define XEN_PRIV_CAP  ((1 << XENFEAT_privileged) | \
>> +    (1 << XENFEAT_unprivileged))
>> +# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
>> +#endif
>> +#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
>> +# undef XEN_PRIV_CAP_STR
>> +# define XEN_PRIV_CAP_STR ""
>> +#endif
>> +
>>  #if CONFIG_XEN_COMPAT <= 0x030002
>>  /*
>>   * __xen_guest information
>> @@ -186,7 +200,8 @@ ENTRY(empty_zero_page)
>> utoh (__START_KERNEL_map + __PHYSICAL_START)
>> .ascii ",HYPERCALL_PAGE=0x"
>> utoh (phys_hypercall_page >> PAGE_SHIFT)
>> - .ascii  ",FEATURES=writable_page_tables"
>> + .ascii  ",FEATURES=" XEN_PRIV_CAP
>> + .ascii   "|writable_page_tables"
>> .ascii   "|writable_descriptor_tables"
>> .ascii   "|auto_translated_physmap"
>> .ascii          "|supervisor_mode_kernel"
>> @@ -206,6 +221,15 @@ ENTRY(empty_zero_page)
>> ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .quad,  startup_64)
>> ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad,  hypercall_page)
>> ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  
> _PAGE_PRESENT,_PAGE_PRESENT)
>> - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz,
>> 
> "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|supe
> r
>> visor_mode_kernel")
>> + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
>> +       .ascii  "|writable_descriptor_tables";
>> +       .ascii  "|auto_translated_physmap";
>> +       .ascii  "|supervisor_mode_kernel";
>> +       .asciz  XEN_PRIV_CAP_STR)
>> + ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
>> +        (1 << XENFEAT_writable_page_tables) |
>> +        (1 << XENFEAT_writable_descriptor_tables) |
>> +        (1 << XENFEAT_auto_translated_physmap) |
>> +        (1 << XENFEAT_supervisor_mode_kernel))
>> ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
>> ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long,  1)
>> 
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com 
>> http://lists.xensource.com/xen-devel 

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

* Re: [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication
  2011-07-21  9:45   ` Ian Campbell
@ 2011-07-21  9:57     ` Jan Beulich
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2011-07-21  9:57 UTC (permalink / raw)
  To: Ian Campbell, Keir Fraser; +Cc: xen-devel

>>> On 21.07.11 at 11:45, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> On Thu, 2011-07-21 at 10:32 +0100, Keir Fraser wrote:
>> Aren't XEN_PRIV_CAP_STR parts pointless? Any hypervisor new enough to
>> understand those features will also understand
>> XEN_ELFNOTE_SUPPORTED_FEATURE?
> 
> And didn't adding new features to that string break on existing
> hypervisors -- hence the new interface?

That's why they (should - I realize I didn't clean up the patch
before sending, but now that I'll have to resend it anyway that
doesn't matter much) get added only for a high enough
CONFIG_XEN_COMPAT.

Jan

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

* Re: [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication
  2011-07-21  9:55   ` Jan Beulich
@ 2011-07-21 10:00     ` Ian Campbell
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2011-07-21 10:00 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Keir Fraser

On Thu, 2011-07-21 at 10:55 +0100, Jan Beulich wrote:
> >>> On 21.07.11 at 11:32, Keir Fraser <keir@xen.org> wrote:
> > Aren't XEN_PRIV_CAP_STR parts pointless? Any hypervisor new enough to
> > understand those features will also understand
> > XEN_ELFNOTE_SUPPORTED_FEATURE?
> 
> It's more for completeness (so that when XEN_COMPAT set high enough
> one can e.g. inspect the ELF notes without needing to understand binary
> values).

It'd be useful to update tools/xcutils/readnotes.c to decode them
perhaps?

Ian.

> 
> Jan
> 
> >  -- Keir
> > 
> > On 19/07/2011 10:14, "Jan Beulich" <JBeulich@novell.com> wrote:
> > 
> >> This is the kernel side change accompanying the earlier sent Xen side
> >> patch titled identically.
> >> 
> >> (This depends on the public headers to be synced over after the
> >> respective hypervisor side change.)
> >> 
> >> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> >> 
> >> --- a/arch/i386/kernel/head-xen.S
> >> +++ b/arch/i386/kernel/head-xen.S
> >> @@ -12,6 +12,7 @@
> >>  #include <asm/dwarf2.h>
> >>  #include <xen/interface/xen.h>
> >>  #include <xen/interface/elfnote.h>
> >> +#include <xen/interface/features.h>
> >>  
> >>  /*
> >>   * References to members of the new_cpu_data structure.
> >> @@ -142,6 +143,19 @@ ENTRY(cpu_gdt_table)
> >> .quad 0x0000000000000000 /* 0xf0 - unused */
> >> .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
> >>  
> >> +#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
> >> +# define XEN_PRIV_CAP  (1 << XENFEAT_unprivileged)
> >> +# define XEN_PRIV_CAP_STR "|!unprivileged"
> >> +#else
> >> +# define XEN_PRIV_CAP  ((1 << XENFEAT_privileged) | \
> >> +    (1 << XENFEAT_unprivileged))
> >> +# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
> >> +#endif
> >> +#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
> >> +# undef XEN_PRIV_CAP_STR
> >> +# define XEN_PRIV_CAP_STR ""
> >> +#endif
> >> +
> >>  #if CONFIG_XEN_COMPAT <= 0x030002
> >>  /*
> >>   * __xen_guest information
> >> @@ -168,7 +182,8 @@ ENTRY(cpu_gdt_table)
> >> utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
> >> .ascii ",HYPERCALL_PAGE=0x"
> >> utoa ((__PHYSICAL_START+HYPERCALL_PAGE_OFFSET)>>PAGE_SHIFT)
> >> - .ascii  ",FEATURES=writable_page_tables"
> >> + .ascii  ",FEATURES=" XEN_PRIV_CAP
> >> + .ascii          "|writable_page_tables"
> >> .ascii          "|writable_descriptor_tables"
> >> .ascii          "|auto_translated_physmap"
> >> .ascii          "|pae_pgdir_above_4gb"
> >> @@ -195,7 +210,18 @@ ENTRY(cpu_gdt_table)
> >> ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long,  startup_32)
> >> ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long,  hypercall_page)
> >> ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   .long,  HYPERVISOR_VIRT_START)
> >> - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz,
> >> 
> > "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_
> > p
> >> gdir_above_4gb|supervisor_mode_kernel")
> >> + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
> >> +       .ascii  "|writable_descriptor_tables";
> >> +       .ascii  "|auto_translated_physmap";
> >> +       .ascii  "|pae_pgdir_above_4gb";
> >> +       .ascii  "|supervisor_mode_kernel";
> >> +       .asciz  XEN_PRIV_CAP_STR)
> >> + ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
> >> +        (1 << XENFEAT_writable_page_tables) |
> >> +        (1 << XENFEAT_writable_descriptor_tables) |
> >> +        (1 << XENFEAT_auto_translated_physmap) |
> >> +        (1 << XENFEAT_pae_pgdir_above_4gb) |
> >> +        (1 << XENFEAT_supervisor_mode_kernel))
> >>  #ifdef CONFIG_X86_PAE
> >> ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "yes")
> >> ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  
> > _PAGE_PRESENT,_PAGE_PRESENT)
> >> --- a/arch/x86_64/kernel/head-xen.S
> >> +++ b/arch/x86_64/kernel/head-xen.S
> >> @@ -24,6 +24,7 @@
> >>  #include <asm/cache.h>
> >>  #include <asm/dwarf2.h>
> >>  #include <xen/interface/elfnote.h>
> >> +#include <xen/interface/features.h>
> >>  
> >> .section .bootstrap.text, "ax", @progbits
> >> .code64
> >> @@ -160,6 +161,19 @@ gdt_end:
> >>  ENTRY(empty_zero_page)
> >> .skip PAGE_SIZE
> >>  
> >> +#ifdef CONFIG_XEN_UNPRIVILEGED_GUEST
> >> +# define XEN_PRIV_CAP  (1 << XENFEAT_unprivileged)
> >> +# define XEN_PRIV_CAP_STR "|!unprivileged"
> >> +#else
> >> +# define XEN_PRIV_CAP  ((1 << XENFEAT_privileged) | \
> >> +    (1 << XENFEAT_unprivileged))
> >> +# define XEN_PRIV_CAP_STR "|privileged|unprivileged"
> >> +#endif
> >> +#if CONFIG_XEN_COMPAT < 0xffffffff//temp 0x040200
> >> +# undef XEN_PRIV_CAP_STR
> >> +# define XEN_PRIV_CAP_STR ""
> >> +#endif
> >> +
> >>  #if CONFIG_XEN_COMPAT <= 0x030002
> >>  /*
> >>   * __xen_guest information
> >> @@ -186,7 +200,8 @@ ENTRY(empty_zero_page)
> >> utoh (__START_KERNEL_map + __PHYSICAL_START)
> >> .ascii ",HYPERCALL_PAGE=0x"
> >> utoh (phys_hypercall_page >> PAGE_SHIFT)
> >> - .ascii  ",FEATURES=writable_page_tables"
> >> + .ascii  ",FEATURES=" XEN_PRIV_CAP
> >> + .ascii   "|writable_page_tables"
> >> .ascii   "|writable_descriptor_tables"
> >> .ascii   "|auto_translated_physmap"
> >> .ascii          "|supervisor_mode_kernel"
> >> @@ -206,6 +221,15 @@ ENTRY(empty_zero_page)
> >> ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .quad,  startup_64)
> >> ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad,  hypercall_page)
> >> ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,   .quad,  
> > _PAGE_PRESENT,_PAGE_PRESENT)
> >> - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz,
> >> 
> > "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|supe
> > r
> >> visor_mode_kernel")
> >> + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii, "writable_page_tables";
> >> +       .ascii  "|writable_descriptor_tables";
> >> +       .ascii  "|auto_translated_physmap";
> >> +       .ascii  "|supervisor_mode_kernel";
> >> +       .asciz  XEN_PRIV_CAP_STR)
> >> + ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long, XEN_PRIV_CAP |
> >> +        (1 << XENFEAT_writable_page_tables) |
> >> +        (1 << XENFEAT_writable_descriptor_tables) |
> >> +        (1 << XENFEAT_auto_translated_physmap) |
> >> +        (1 << XENFEAT_supervisor_mode_kernel))
> >> ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
> >> ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long,  1)
> >> 
> >> 
> >> _______________________________________________
> >> Xen-devel mailing list
> >> Xen-devel@lists.xensource.com 
> >> http://lists.xensource.com/xen-devel 
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

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

end of thread, other threads:[~2011-07-21 10:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-19  9:14 [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication Jan Beulich
2011-07-21  9:32 ` Keir Fraser
2011-07-21  9:45   ` Ian Campbell
2011-07-21  9:57     ` Jan Beulich
2011-07-21  9:55   ` Jan Beulich
2011-07-21 10:00     ` Ian Campbell

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.