int rc;
/* Sanity! */
- BUG_ON(d->domain_id != 0);
+ BUG_ON(!pv_shim && d->domain_id != 0);
BUG_ON(d->vcpu[0] == NULL);
BUG_ON(d->vcpu[0]->is_initialised);
return reserved_pages;
}
+uint32_t hypervisor_cpuid_base(void)
+{
+ return xen_cpuid_base;
+}
+
/*
* Local variables:
* mode: C
*/
#include <xen/hypercall.h>
#include <xen/init.h>
+#include <xen/shutdown.h>
#include <xen/types.h>
#include <asm/apic.h>
#include <asm/guest.h>
#include <asm/pv/mm.h>
+#include <public/arch-x86/cpuid.h>
+
#ifndef CONFIG_PV_SHIM_EXCLUSIVE
bool pv_shim;
boolean_param("pv-shim", pv_shim);
#undef SET_AND_MAP_PARAM
}
+void pv_shim_shutdown(uint8_t reason)
+{
+ /* XXX: handle suspend */
+ xen_hypercall_shutdown(reason);
+}
+
+domid_t get_initial_domain_id(void)
+{
+ uint32_t eax, ebx, ecx, edx;
+
+ if ( !pv_shim )
+ return 0;
+
+ cpuid(hypervisor_cpuid_base() + 4, &eax, &ebx, &ecx, &edx);
+
+ return (eax & XEN_HVM_CPUID_DOMID_PRESENT) ? ecx : 1;
+}
+
/*
* Local variables:
* mode: C
#define SMEP_HVM_ONLY (-1)
static s8 __initdata opt_smep = 1;
+/*
+ * Initial domain place holder. Needs to be global so it can be created in
+ * __start_xen and unpaused in init_done.
+ */
+static struct domain *__initdata dom0;
+
static int __init parse_smep_param(const char *s)
{
if ( !*s )
system_state = SYS_STATE_active;
+ domain_unpause_by_systemcontroller(dom0);
+
/* MUST be done prior to removing .init data. */
unregister_init_virtual_region();
- domain_unpause_by_systemcontroller(hardware_domain);
-
/* Zero the .init code and data. */
for ( va = __init_begin; va < _p(__init_end); va += PAGE_SIZE )
clear_page(va);
unsigned long nr_pages, raw_max_page, modules_headroom, *module_map;
int i, j, e820_warn = 0, bytes = 0;
bool acpi_boot_table_init_done = false, relocated = false;
- struct domain *dom0;
struct ns16550_defaults ns16550 = {
.data_bits = 8,
.parity = 'n',
}
/* Create initial domain 0. */
- dom0 = domain_create(0, domcr_flags, 0, &config);
+ dom0 = domain_create(get_initial_domain_id(), domcr_flags, 0, &config);
if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
panic("Error creating domain 0");
- dom0->is_privileged = 1;
+ if ( !pv_shim )
+ dom0->is_privileged = 1;
dom0->target = NULL;
/* Grab the DOM0 command line. */
#include <xen/tmem.h>
#include <asm/setup.h>
+#ifdef CONFIG_X86
+#include <asm/guest.h>
+#endif
+
/* Linux config option: propageted to domain0 */
/* xen_processor_pmbits: xen control Cx, Px, ... */
unsigned int xen_processor_pmbits = XEN_PROCESSOR_PM_PX;
{
struct vcpu *v;
+#ifdef CONFIG_X86
+ if ( pv_shim )
+ {
+ pv_shim_shutdown(reason);
+ return;
+ }
+#endif
+
spin_lock(&d->shutdown_lock);
if ( d->shutdown_code == SHUTDOWN_CODE_INVALID )
int hypervisor_free_unused_page(mfn_t mfn);
void hypervisor_fixup_e820(struct e820map *e820);
const unsigned long *hypervisor_reserved_pages(unsigned int *size);
+uint32_t hypervisor_cpuid_base(void);
DECLARE_PER_CPU(unsigned int, vcpu_id);
DECLARE_PER_CPU(struct vcpu_info *, vcpu_info);
ASSERT_UNREACHABLE();
return NULL;
};
+static inline uint32_t hypervisor_cpuid_base(void)
+{
+ ASSERT_UNREACHABLE();
+ return 0;
+};
#endif /* CONFIG_XEN_GUEST */
#endif /* __X86_GUEST_XEN_H__ */
unsigned long va_start, unsigned long store_va,
unsigned long console_va, unsigned long vphysmap,
start_info_t *si);
+void pv_shim_shutdown(uint8_t reason);
+domid_t get_initial_domain_id(void);
#else
{
ASSERT_UNREACHABLE();
}
+static inline void pv_shim_shutdown(uint8_t reason)
+{
+ ASSERT_UNREACHABLE();
+}
+static inline domid_t get_initial_domain_id(void)
+{
+ return 0;
+}
#endif