Skip to contentSkip to conversation

Booting xen_maple_defconfig kernel on bare hardware

RFC Jimi Xenidis 2 participants 2 messages Jul 27, 2006 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 2 lines · Amos Waterland

It would be nice to boot the exact same Linux kernel binary image on bare hardware and as a Xen dom0 on that same hardware.

the XenPPC team considers this a requirement.

Quoted 2 lines

At present we
cannot do this: you stop seeing output early in the boot process.

Glad to find out that functionally it seems to only be the serial stuff.
The Xen Console stuff is a little wierd since instead of creating a new console device like all the other virtual console drivers they decided they would override ttyS by default for Dom0. We thought this was odd but figured it would get resolved when the xen patches went into the kernel.

Anyways, the Xen solution is to activate serial and figure out/guess at that number in ttyS<n> would be since the native serial driver will be loaded _before_ the xen console (because it was linked first), usually some large <n> would be chosen, but for our <ppc> purposes, 8 will do for demonstration. With that "solution" in mind you need to add:
"xencons=ttyS8 console=ttyS8"

to your dom0/kernel parameters, and it should work.
xencons= will try to allocate unique "minor" number space and the console= will force the "preferred" console

As I see it there are a few good solutions:
1) xencons uses its own devname (like "ttyXC<n>" instead of
"ttyS<n>")
this would require a little distro and/or admin pain that may
be acceptable now.

2) We move drivers/xen/console into drivers/char so that it gets
linked/inited before drivers/serial
*** moving drivers/xen before drivers/serial will not work
because drivers/xen needs other drivers first.

For now at least the following is sufficient, tho a little hacky.. thoughts? -JX
**** WARNING **** my mailer will mangle this informal patch

hg diff arch/powerpc/platforms/xen/setup.c drivers/xen/console/console.c

arch/powerpc/platforms/xen/setup.c +0 -0
diff -r e30fba67c38d arch/powerpc/platforms/xen/setup.c
@@ -111,6 +111,9 @@ static void __init xen_init_early(void)
	is_dom0 = !!(xen_start_info->flags & SIF_INITDOMAIN);
	if (is_dom0) {
+		int ttySn = 0;
+		extern int xc_num;
+
		ppc_md.pcibios_fixup		= mach_maple_md.pcibios_fixup;
		ppc_md.pci_get_legacy_ide_irq	= mach_maple_md.pci_get_legacy_ide_irq;
		ppc_md.restart			= mach_maple_md.restart;
@@ -120,7 +123,11 @@ static void __init xen_init_early(void)
		ppc_md.set_rtc_time		= mach_maple_md.set_rtc_time;
		ppc_md.get_rtc_time		= mach_maple_md.get_rtc_time;

- add_preferred_console("ttyS", 0, NULL);
+#ifndef CONFIG_XEN_DISABLE_SERIAL
+ ttySn = 128;
+#endif
+ xc_num = ttySn;

+		add_preferred_console("ttyS", ttySn, NULL);
	}
	DBG("Hello World I'm Maple Xen-LPAR!\n");
drivers/xen/console/console.c +0 -0
diff -r e30fba67c38d drivers/xen/console/console.c
@@ -69,7 +69,7 @@
  * warnings from standard distro startup scripts.
  */

static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode = XC_DEFAULT; -static int xc_num = -1;
+int xc_num = -1;
#ifdef CONFIG_MAGIC_SYSRQ
static unsigned long sysrq_requested;

#2 lore raw
Quoted 6 lines · Jimi Xenidis
Quoted 2 lines · Amos Waterland

It would be nice to boot the exact same Linux kernel binary image on bare hardware and as a Xen dom0 on that same hardware.

the XenPPC team considers this a requirement.

Absolutely. However, if it means committing a hack like the below, I'm willing to postpone this goal.

Quoted 9 lines
Quoted 2 lines

At present we
cannot do this: you stop seeing output early in the boot process.

Glad to find out that functionally it seems to only be the serial stuff. The Xen Console stuff is a little wierd since instead of creating a new console device like all the other virtual console drivers they decided they would override ttyS by default for Dom0.
We thought this was odd but figured it would get resolved when the xen patches went into the kernel.

History has shown that Xen's current approach is not going to fly. The xen console will end up needing its own char device, just like all the other virtual consoles (and even the non-8250 serial consoles).

Quoted 5 lines

For now at least the following is sufficient, tho a little hacky.. thoughts?

hg diff arch/powerpc/platforms/xen/setup.c drivers/xen/console/console.c [snip]

Extremely distasteful.

People who *need* this functionality (i.e. single binary for hardware and Xen) *right* *now* could just create a xenppc-unstable.hg child tree, apply this patch only, and just update it when doing a build.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center