1 /* hvtramp.S: Hypervisor start-cpu trampoline code.
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
6 <<<<<<< HEAD:arch/sparc64/kernel/hvtramp.S
8 #include <linux/init.h>
10 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc64/kernel/hvtramp.S
11 #include <asm/thread_info.h>
12 #include <asm/hypervisor.h>
13 #include <asm/scratchpad.h>
14 #include <asm/spitfire.h>
15 #include <asm/hvtramp.h>
16 #include <asm/pstate.h>
17 #include <asm/ptrace.h>
21 <<<<<<< HEAD:arch/sparc64/kernel/hvtramp.S
25 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/sparc64/kernel/hvtramp.S
27 .globl hv_cpu_startup, hv_cpu_startup_end
29 /* This code executes directly out of the hypervisor
30 * with physical addressing (va==pa). %o0 contains
31 * our client argument which for Linux points to
32 * a descriptor data structure which defines the
33 * MMU entries we need to load up.
35 * After we set things up we enable the MMU and call
38 * First setup basic privileged cpu state.
43 wrpr %g0, 0, %canrestore
44 wrpr %g0, 0, %otherwin
46 wrpr %g0, 6, %cleanwin
51 sethi %hi(sparc64_ttable_tl0), %g1
56 lduw [%l0 + HVTRAMP_DESCR_CPU], %g1
57 mov SCRATCHPAD_CPUID, %g2
58 stxa %g1, [%g2] ASI_SCRATCHPAD
60 ldx [%l0 + HVTRAMP_DESCR_FAULT_INFO_VA], %g2
61 stxa %g2, [%g0] ASI_SCRATCHPAD
64 lduw [%l0 + HVTRAMP_DESCR_NUM_MAPPINGS], %l2
65 add %l0, HVTRAMP_DESCR_MAPS, %l3
67 1: ldx [%l3 + HVTRAMP_MAPPING_VADDR], %o0
69 ldx [%l3 + HVTRAMP_MAPPING_TTE], %o2
70 mov HV_MMU_IMMU | HV_MMU_DMMU, %o3
71 mov HV_FAST_MMU_MAP_PERM_ADDR, %o5
80 add %l3, HVTRAMP_MAPPING_SIZE, %l3
82 ldx [%l0 + HVTRAMP_DESCR_FAULT_INFO_PA], %o0
83 mov HV_FAST_MMU_FAULT_AREA_CONF, %o5
89 wrpr %g0, (PSTATE_PRIV | PSTATE_PEF), %pstate
91 ldx [%l0 + HVTRAMP_DESCR_THREAD_REG], %l6
95 mov HV_FAST_MMU_ENABLE, %o5
105 mov PRIMARY_CONTEXT, %g7
106 stxa %g0, [%g7] ASI_MMU
109 mov SECONDARY_CONTEXT, %g7
110 stxa %g0, [%g7] ASI_MMU
114 ldx [%g6 + TI_TASK], %g4
117 sllx %g5, THREAD_SHIFT, %g5
118 sub %g5, (STACKFRAME_SZ + STACK_BIAS), %g5
122 call init_irqwork_curcpu
124 call hard_smp_processor_id
127 call sun4v_register_mondo_queues
130 call init_cur_cpu_trap
133 wrpr %g0, (PSTATE_PRIV | PSTATE_PEF | PSTATE_IE), %pstate