/* * Search for a free page starting at 4kB physical address. * Low memory is preferred to avoid an EPT large page split up * by the mapping. * Starting below X86_RESERVE_LOW (usually 64kB) is fine as * the BIOS used for HVM guests is well behaved and won't * clobber memory other than the first 4kB.
*/ for (pa = PAGE_SIZE;
!e820__mapped_all(pa, pa + PAGE_SIZE, E820_TYPE_RAM) ||
memblock_is_reserved(pa);
pa += PAGE_SIZE)
;
/* * The virtual address of the shared_info page has changed, so * the vcpu_info pointer for VCPU 0 is now stale. * * The prepare_boot_cpu callback will re-initialize it via * xen_vcpu_setup, but we can't rely on that to be called for * old Xen versions (xen_have_vector_callback == 0). * * It is, in any case, bad to have a stale vcpu_info pointer * so reset it now.
*/
xen_vcpu_info_reset(0);
}
staticint xen_cpu_up_prepare_hvm(unsignedint cpu)
{ int rc = 0;
/* * If a CPU was offlined earlier and offlining timed out then the * lock mechanism is still initialized. Uninit it unconditionally * as it's safe to call even if already uninited. Interrupts and * timer have already been handled in xen_cpu_dead_hvm().
*/
xen_uninit_lock_cpu(cpu);
if (cpu_acpi_id(cpu) != CPU_ACPIID_INVALID)
per_cpu(xen_vcpu_id, cpu) = cpu_acpi_id(cpu); else
per_cpu(xen_vcpu_id, cpu) = cpu;
xen_vcpu_setup(cpu); if (!xen_have_vector_callback) return 0;
if (xen_percpu_upcall) {
rc = xen_set_upcall_vector(cpu); if (rc) {
WARN(1, "HVMOP_set_evtchn_upcall_vector" " for CPU %d failed: %d\n", cpu, rc); return rc;
}
}
if (xen_feature(XENFEAT_hvm_safe_pvclock))
xen_setup_timer(cpu);
rc = xen_smp_intr_init(cpu); if (rc) {
WARN(1, "xen_smp_intr_init() for CPU %d failed: %d\n",
cpu, rc);
} return rc;
}
/* * xen_vcpu is a pointer to the vcpu_info struct in the shared_info * page, we use it in the event channel upcall and in some pvclock * related functions.
*/
xen_vcpu_info_reset(0);
static __init void xen_hvm_guest_late_init(void)
{ #ifdef CONFIG_XEN_PVH /* Test for PVH domain (PVH boot path taken overrides ACPI flags). */ if (!xen_pvh &&
(x86_platform.legacy.rtc || !x86_platform.legacy.no_vga)) return;
/* PVH detected. */
xen_pvh = true;
if (nopv)
panic("\"nopv\" and \"xen_nopv\" parameters are unsupported in PVH guest.");
/* Make sure we don't fall back to (default) ACPI_IRQ_MODEL_PIC. */ if (!nr_ioapics && acpi_irq_model == ACPI_IRQ_MODEL_PIC)
acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
/* Set correct hypercall function. */ if (xen_domain)
xen_hypercall_setfunc();
if (xen_pvh_domain() && nopv) { /* Guest booting via the Xen-PVH boot entry goes here */
pr_info("\"nopv\" parameter is ignored in PVH guest\n");
nopv = false;
} elseif (nopv && xen_domain) { /* * Guest booting via normal boot entry (like via grub2) goes * here. * * Use interface functions for bare hardware if nopv, * xen_hvm_guest_late_init is an exception as we need to * detect PVH and panic there.
*/
h->init_platform = x86_init_noop;
h->x2apic_available = bool_x86_init_noop;
h->init_mem_mapping = x86_init_noop;
h->init_after_bootmem = x86_init_noop;
h->guest_late_init = xen_hvm_guest_late_init;
x86_hyper_xen_hvm.runtime.pin_vcpu = x86_op_int_noop;
} return xen_domain;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.