1/* SPDX-License-Identifier: GPL-2.0 */ 2/* Xen-specific pieces of head.S, intended to be included in the right 3 place in head.S */ 4 5#ifdef CONFIG_XEN 6 7#include <linux/elfnote.h> 8#include <linux/init.h> 9 10#include <asm/boot.h> 11#include <asm/asm.h> 12#include <asm/page_types.h> 13 14#include <xen/interface/elfnote.h> 15#include <xen/interface/features.h> 16#include <xen/interface/xen.h> 17#include <xen/interface/xen-mca.h> 18#include <asm/xen/interface.h> 19 20#ifdef CONFIG_XEN_PV 21 __INIT 22ENTRY(startup_xen) 23 cld 24 25 /* Clear .bss */ 26 xor %eax,%eax 27 mov $__bss_start, %_ASM_DI 28 mov $__bss_stop, %_ASM_CX 29 sub %_ASM_DI, %_ASM_CX 30 shr $__ASM_SEL(2, 3), %_ASM_CX 31 rep __ASM_SIZE(stos) 32 33 mov %_ASM_SI, xen_start_info 34 mov $init_thread_union+THREAD_SIZE, %_ASM_SP 35 36 jmp xen_start_kernel 37 38 __FINIT 39#endif 40 41.pushsection .text 42 .balign PAGE_SIZE 43ENTRY(hypercall_page) 44 .skip PAGE_SIZE 45 46#define HYPERCALL(n) \ 47 .equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \ 48 .type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32 49#include <asm/xen-hypercalls.h> 50#undef HYPERCALL 51 52.popsection 53 54 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") 55 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6") 56 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") 57#ifdef CONFIG_X86_32 58 ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, _ASM_PTR __PAGE_OFFSET) 59#else 60 ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, _ASM_PTR __START_KERNEL_map) 61 /* Map the p2m table to a 512GB-aligned user address. */ 62 ELFNOTE(Xen, XEN_ELFNOTE_INIT_P2M, .quad (PUD_SIZE * PTRS_PER_PUD)) 63#endif 64#ifdef CONFIG_XEN_PV 65 ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, _ASM_PTR startup_xen) 66#endif 67 ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, _ASM_PTR hypercall_page) 68 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, 69 .ascii "!writable_page_tables|pae_pgdir_above_4gb") 70 ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, 71 .long (1 << XENFEAT_writable_page_tables) | (1 << XENFEAT_dom0)) 72 ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "yes") 73 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic") 74 ELFNOTE(Xen, XEN_ELFNOTE_L1_MFN_VALID, 75 .quad _PAGE_PRESENT; .quad _PAGE_PRESENT) 76 ELFNOTE(Xen, XEN_ELFNOTE_SUSPEND_CANCEL, .long 1) 77 ELFNOTE(Xen, XEN_ELFNOTE_MOD_START_PFN, .long 1) 78 ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, _ASM_PTR __HYPERVISOR_VIRT_START) 79 ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, _ASM_PTR 0) 80 81#endif /*CONFIG_XEN */ 82