enlighten.c (b3e5ced63e051e8f911b795ac5b06229a5328f7b) enlighten.c (a71dbdaa8ca2933391b08e0ae5567083e3af0892)
1/*
2 * Core of Xen paravirt_ops implementation.
3 *
4 * This file contains the xen_paravirt_ops structure itself, and the
5 * implementations for:
6 * - privileged instructions
7 * - interrupt flags
8 * - segment operations

--- 1746 unchanged lines hidden (view full) ---

1755}
1756
1757static struct notifier_block xen_hvm_cpu_notifier = {
1758 .notifier_call = xen_hvm_cpu_notify,
1759};
1760
1761static void __init xen_hvm_guest_init(void)
1762{
1/*
2 * Core of Xen paravirt_ops implementation.
3 *
4 * This file contains the xen_paravirt_ops structure itself, and the
5 * implementations for:
6 * - privileged instructions
7 * - interrupt flags
8 * - segment operations

--- 1746 unchanged lines hidden (view full) ---

1755}
1756
1757static struct notifier_block xen_hvm_cpu_notifier = {
1758 .notifier_call = xen_hvm_cpu_notify,
1759};
1760
1761static void __init xen_hvm_guest_init(void)
1762{
1763 if (xen_pv_domain())
1764 return;
1765
1763 init_hvm_pv_info();
1764
1765 xen_hvm_init_shared_info();
1766
1767 xen_panic_handler_init();
1768
1769 if (xen_feature(XENFEAT_hvm_callback_vector))
1770 xen_have_vector_callback = 1;
1771 xen_hvm_smp_init();
1772 register_cpu_notifier(&xen_hvm_cpu_notifier);
1773 xen_unplug_emulated_devices();
1774 x86_init.irqs.intr_init = xen_init_IRQ;
1775 xen_hvm_init_time_ops();
1776 xen_hvm_init_mmu_ops();
1777}
1766 init_hvm_pv_info();
1767
1768 xen_hvm_init_shared_info();
1769
1770 xen_panic_handler_init();
1771
1772 if (xen_feature(XENFEAT_hvm_callback_vector))
1773 xen_have_vector_callback = 1;
1774 xen_hvm_smp_init();
1775 register_cpu_notifier(&xen_hvm_cpu_notifier);
1776 xen_unplug_emulated_devices();
1777 x86_init.irqs.intr_init = xen_init_IRQ;
1778 xen_hvm_init_time_ops();
1779 xen_hvm_init_mmu_ops();
1780}
1781#endif
1778
1779static bool xen_nopv = false;
1780static __init int xen_parse_nopv(char *arg)
1781{
1782 xen_nopv = true;
1783 return 0;
1784}
1785early_param("xen_nopv", xen_parse_nopv);
1786
1782
1783static bool xen_nopv = false;
1784static __init int xen_parse_nopv(char *arg)
1785{
1786 xen_nopv = true;
1787 return 0;
1788}
1789early_param("xen_nopv", xen_parse_nopv);
1790
1787static uint32_t __init xen_hvm_platform(void)
1791static uint32_t __init xen_platform(void)
1788{
1789 if (xen_nopv)
1790 return 0;
1791
1792{
1793 if (xen_nopv)
1794 return 0;
1795
1792 if (xen_pv_domain())
1793 return 0;
1794
1795 return xen_cpuid_base();
1796}
1797
1798bool xen_hvm_need_lapic(void)
1799{
1800 if (xen_nopv)
1801 return false;
1802 if (xen_pv_domain())
1803 return false;
1804 if (!xen_hvm_domain())
1805 return false;
1806 if (xen_feature(XENFEAT_hvm_pirqs) && xen_have_vector_callback)
1807 return false;
1808 return true;
1809}
1810EXPORT_SYMBOL_GPL(xen_hvm_need_lapic);
1811
1796 return xen_cpuid_base();
1797}
1798
1799bool xen_hvm_need_lapic(void)
1800{
1801 if (xen_nopv)
1802 return false;
1803 if (xen_pv_domain())
1804 return false;
1805 if (!xen_hvm_domain())
1806 return false;
1807 if (xen_feature(XENFEAT_hvm_pirqs) && xen_have_vector_callback)
1808 return false;
1809 return true;
1810}
1811EXPORT_SYMBOL_GPL(xen_hvm_need_lapic);
1812
1812const struct hypervisor_x86 x86_hyper_xen_hvm __refconst = {
1813 .name = "Xen HVM",
1814 .detect = xen_hvm_platform,
1813static void xen_set_cpu_features(struct cpuinfo_x86 *c)
1814{
1815 if (xen_pv_domain())
1816 clear_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS);
1817}
1818
1819const struct hypervisor_x86 x86_hyper_xen = {
1820 .name = "Xen",
1821 .detect = xen_platform,
1822#ifdef CONFIG_XEN_PVHVM
1815 .init_platform = xen_hvm_guest_init,
1823 .init_platform = xen_hvm_guest_init,
1824#endif
1816 .x2apic_available = xen_x2apic_para_available,
1825 .x2apic_available = xen_x2apic_para_available,
1826 .set_cpu_features = xen_set_cpu_features,
1817};
1827};
1818EXPORT_SYMBOL(x86_hyper_xen_hvm);
1819#endif
1828EXPORT_SYMBOL(x86_hyper_xen);