* Allocate and fill in the hypcall page. */
| 166 | * Allocate and fill in the hypcall page. |
| 167 | */ |
| 168 | int |
| 169 | xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type) |
| 170 | { |
| 171 | uint32_t regs[4]; |
| 172 | |
| 173 | /* Legacy PVH will get here without the cpuid leaf being set. */ |
| 174 | if (cpuid_base == 0) |
| 175 | cpuid_base = xen_hvm_cpuid_base(); |
| 176 | if (cpuid_base == 0) |
| 177 | return (ENXIO); |
| 178 | |
| 179 | if (xen_domain() && init_type == XEN_HVM_INIT_LATE) { |
| 180 | /* |
| 181 | * If the domain type is already set we can assume that the |
| 182 | * hypercall page has been populated too, so just print the |
| 183 | * version (and apply any quirks) and exit. |
| 184 | */ |
| 185 | hypervisor_version(); |
| 186 | return 0; |
| 187 | } |
| 188 | |
| 189 | if (init_type == XEN_HVM_INIT_LATE) |
| 190 | hypervisor_version(); |
| 191 | |
| 192 | /* |
| 193 | * Find the hypercall pages. |
| 194 | */ |
| 195 | do_cpuid(cpuid_base + 2, regs); |
| 196 | if (regs[0] != 1) |
| 197 | return (EINVAL); |
| 198 | |
| 199 | wrmsr(regs[1], (init_type == XEN_HVM_INIT_EARLY) |
| 200 | ? ((vm_paddr_t)&hypercall_page - KERNBASE) |
| 201 | : vtophys(&hypercall_page)); |
| 202 | |
| 203 | return (0); |
| 204 | } |
| 205 | |
| 206 | static void |
| 207 | xen_hvm_init_shared_info_page(void) |
no test coverage detected