xref: /openbmc/linux/arch/x86/xen/xen-head.S (revision 206204a1)
1/* Xen-specific pieces of head.S, intended to be included in the right
2	place in head.S */
3
4#ifdef CONFIG_XEN
5
6#include <linux/elfnote.h>
7#include <linux/init.h>
8
9#include <asm/boot.h>
10#include <asm/asm.h>
11#include <asm/page_types.h>
12
13#include <xen/interface/elfnote.h>
14#include <xen/interface/features.h>
15#include <asm/xen/interface.h>
16
17#ifdef CONFIG_XEN_PVH
18#define PVH_FEATURES_STR  "|writable_descriptor_tables|auto_translated_physmap|supervisor_mode_kernel"
19/* Note the lack of 'hvm_callback_vector'. Older hypervisor will
20 * balk at this being part of XEN_ELFNOTE_FEATURES, so we put it in
21 * XEN_ELFNOTE_SUPPORTED_FEATURES which older hypervisors will ignore.
22 */
23#define PVH_FEATURES ((1 << XENFEAT_writable_page_tables) | \
24		      (1 << XENFEAT_auto_translated_physmap) | \
25		      (1 << XENFEAT_supervisor_mode_kernel) | \
26		      (1 << XENFEAT_hvm_callback_vector))
27/* The XENFEAT_writable_page_tables is not stricly neccessary as we set that
28 * up regardless whether this CONFIG option is enabled or not, but it
29 * clarifies what the right flags need to be.
30 */
31#else
32#define PVH_FEATURES_STR  ""
33#define PVH_FEATURES (0)
34#endif
35
36	__INIT
37ENTRY(startup_xen)
38	cld
39#ifdef CONFIG_X86_32
40	mov %esi,xen_start_info
41	mov $init_thread_union+THREAD_SIZE,%esp
42#else
43	mov %rsi,xen_start_info
44	mov $init_thread_union+THREAD_SIZE,%rsp
45#endif
46	jmp xen_start_kernel
47
48	__FINIT
49
50.pushsection .text
51	.balign PAGE_SIZE
52ENTRY(hypercall_page)
53#define NEXT_HYPERCALL(x) \
54	ENTRY(xen_hypercall_##x) \
55	.skip 32
56
57NEXT_HYPERCALL(set_trap_table)
58NEXT_HYPERCALL(mmu_update)
59NEXT_HYPERCALL(set_gdt)
60NEXT_HYPERCALL(stack_switch)
61NEXT_HYPERCALL(set_callbacks)
62NEXT_HYPERCALL(fpu_taskswitch)
63NEXT_HYPERCALL(sched_op_compat)
64NEXT_HYPERCALL(platform_op)
65NEXT_HYPERCALL(set_debugreg)
66NEXT_HYPERCALL(get_debugreg)
67NEXT_HYPERCALL(update_descriptor)
68NEXT_HYPERCALL(ni)
69NEXT_HYPERCALL(memory_op)
70NEXT_HYPERCALL(multicall)
71NEXT_HYPERCALL(update_va_mapping)
72NEXT_HYPERCALL(set_timer_op)
73NEXT_HYPERCALL(event_channel_op_compat)
74NEXT_HYPERCALL(xen_version)
75NEXT_HYPERCALL(console_io)
76NEXT_HYPERCALL(physdev_op_compat)
77NEXT_HYPERCALL(grant_table_op)
78NEXT_HYPERCALL(vm_assist)
79NEXT_HYPERCALL(update_va_mapping_otherdomain)
80NEXT_HYPERCALL(iret)
81NEXT_HYPERCALL(vcpu_op)
82NEXT_HYPERCALL(set_segment_base)
83NEXT_HYPERCALL(mmuext_op)
84NEXT_HYPERCALL(xsm_op)
85NEXT_HYPERCALL(nmi_op)
86NEXT_HYPERCALL(sched_op)
87NEXT_HYPERCALL(callback_op)
88NEXT_HYPERCALL(xenoprof_op)
89NEXT_HYPERCALL(event_channel_op)
90NEXT_HYPERCALL(physdev_op)
91NEXT_HYPERCALL(hvm_op)
92NEXT_HYPERCALL(sysctl)
93NEXT_HYPERCALL(domctl)
94NEXT_HYPERCALL(kexec_op)
95NEXT_HYPERCALL(tmem_op) /* 38 */
96ENTRY(xen_hypercall_rsvr)
97	.skip 320
98NEXT_HYPERCALL(mca) /* 48 */
99NEXT_HYPERCALL(arch_1)
100NEXT_HYPERCALL(arch_2)
101NEXT_HYPERCALL(arch_3)
102NEXT_HYPERCALL(arch_4)
103NEXT_HYPERCALL(arch_5)
104NEXT_HYPERCALL(arch_6)
105	.balign PAGE_SIZE
106.popsection
107
108	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz "linux")
109	ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz "2.6")
110	ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz "xen-3.0")
111#ifdef CONFIG_X86_32
112	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      _ASM_PTR __PAGE_OFFSET)
113#else
114	ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      _ASM_PTR __START_KERNEL_map)
115#endif
116	ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          _ASM_PTR startup_xen)
117	ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page)
118	ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .ascii "!writable_page_tables|pae_pgdir_above_4gb"; .asciz PVH_FEATURES_STR)
119	ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, .long (PVH_FEATURES) |
120						(1 << XENFEAT_writable_page_tables) |
121						(1 << XENFEAT_dom0))
122	ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz "yes")
123	ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz "generic")
124	ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID,
125		.quad _PAGE_PRESENT; .quad _PAGE_PRESENT)
126	ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1)
127	ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW,   _ASM_PTR __HYPERVISOR_VIRT_START)
128	ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   _ASM_PTR 0)
129
130#endif /*CONFIG_XEN */
131