Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e833587 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Ingo Molnar
Browse files

xen: clean up domain mode predicates



There are four operating modes Xen code may find itself running in:
 - native
 - hvm domain
 - pv dom0
 - pv domU

Clean up predicates for testing for these states to make them more consistent.

Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Xen-devel <xen-devel@lists.xensource.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 170465ee
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@ EXPORT_SYMBOL_GPL(hypercall_page);
DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info);

enum xen_domain_type xen_domain_type = XEN_NATIVE;
EXPORT_SYMBOL_GPL(xen_domain_type);

/*
 * Identity map, in addition to plain kernel map.  This needs to be
 * large enough to allocate page table pages to allocate the rest.
@@ -1613,6 +1616,8 @@ asmlinkage void __init xen_start_kernel(void)
	if (!xen_start_info)
		return;

	xen_domain_type = XEN_PV_DOMAIN;

	BUG_ON(memcmp(xen_start_info->magic, "xen-3", 5) != 0);

	xen_setup_features();
@@ -1650,7 +1655,7 @@ asmlinkage void __init xen_start_kernel(void)

	/* Prevent unwanted bits from being set in PTEs. */
	__supported_pte_mask &= ~_PAGE_GLOBAL;
	if (!is_initial_xendomain())
	if (!xen_initial_domain())
		__supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);

	/* Don't do the full vcpu_info placement stuff until we have a
@@ -1685,7 +1690,7 @@ asmlinkage void __init xen_start_kernel(void)
	boot_params.hdr.ramdisk_size = xen_start_info->mod_len;
	boot_params.hdr.cmd_line_ptr = __pa(xen_start_info->cmd_line);

	if (!is_initial_xendomain()) {
	if (!xen_initial_domain()) {
		add_preferred_console("xenboot", 0, NULL);
		add_preferred_console("tty", 0, NULL);
		add_preferred_console("hvc", 0, NULL);
+1 −1
Original line number Diff line number Diff line
@@ -1032,7 +1032,7 @@ static struct xenbus_driver blkfront = {

static int __init xlblk_init(void)
{
	if (!is_running_on_xen())
	if (!xen_domain())
		return -ENODEV;

	if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) {
+3 −3
Original line number Diff line number Diff line
@@ -108,8 +108,8 @@ static int __init xen_init(void)
{
	struct hvc_struct *hp;

	if (!is_running_on_xen() ||
	    is_initial_xendomain() ||
	if (!xen_pv_domain() ||
	    xen_initial_domain() ||
	    !xen_start_info->console.domU.evtchn)
		return -ENODEV;

@@ -142,7 +142,7 @@ static void __exit xen_fini(void)

static int xen_cons_init(void)
{
	if (!is_running_on_xen())
	if (!xen_pv_domain())
		return 0;

	hvc_instantiate(HVC_COOKIE, 0, &hvc_ops);
+2 −2
Original line number Diff line number Diff line
@@ -335,11 +335,11 @@ static struct xenbus_driver xenkbd = {

static int __init xenkbd_init(void)
{
	if (!is_running_on_xen())
	if (!xen_domain())
		return -ENODEV;

	/* Nothing to do if running in dom0. */
	if (is_initial_xendomain())
	if (xen_initial_domain())
		return -ENODEV;

	return xenbus_register_frontend(&xenkbd);
+3 −3
Original line number Diff line number Diff line
@@ -1794,10 +1794,10 @@ static struct xenbus_driver netfront = {

static int __init netif_init(void)
{
	if (!is_running_on_xen())
	if (!xen_domain())
		return -ENODEV;

	if (is_initial_xendomain())
	if (xen_initial_domain())
		return 0;

	printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n");
@@ -1809,7 +1809,7 @@ module_init(netif_init);

static void __exit netif_exit(void)
{
	if (is_initial_xendomain())
	if (xen_initial_domain())
		return;

	xenbus_unregister_driver(&netfront);
Loading