WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH, v2] linux-2.6.18: add privileged/unprivileged ke

To: Jan Beulich <JBeulich@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication
From: Keir Fraser <keir@xxxxxxx>
Date: Thu, 21 Jul 2011 10:32:15 +0100
Cc:
Delivery-date: Thu, 21 Jul 2011 02:32:58 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=o6QPTGya3KKMLF6zhn6ZOq38mcirdw0/gxn1tFaO8hs=; b=U5bxGaEW9YY8qcv0Tws6b832kkTHYD14M0VHvBnCwma4AmjY5PyV625z7dfzt4QGG6 7QxwQsxx2nz9QtXQcbTc6ZoBBrXEYA02+0F7ZCbPX3hO+aanG7RjDS6zlizN4a4UMgtu AdQtEezUf3jvcuIlaCNVhJdLl53IAvm0R3q+A=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4E256702020000780004E2B8@xxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcxHiRN96oH7u6Nw90mflJnSgCyZgw==
Thread-topic: [Xen-devel] [PATCH, v2] linux-2.6.18: add privileged/unprivileged kernel feature indication
User-agent: Microsoft-Entourage/12.30.0.110427
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@xxxxxxxxxx> 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@xxxxxxxxxx>
> 
> --- 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@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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