|
|
|
|
|
|
|
|
|
|
xen-ppc-devel
Re: [XenPPC] [PATCH] Booting xen_maple_defconfig kernel on bare hardware
On Jul 31, 2006, at 9:41 PM, Amos Waterland wrote:
These patches allow a single Linux kernel binary, including one with
builtin console=X command line arguments, to run on bare hardware
and as
a dom0 under Xen.
The basic approach is to have the Xen virtual console driver react
gracefully in the case that a real serial driver has already
registered
ttyS0-ttyS3. It's current behavior is to fail if the 8250 driver was
initialized ahead of it, and console is lost. In the process I
found a
bug in Linux, and have included the patch for it since otherwise
the Xen
driver initialization will succeed but with negative side effects
in the
kobject subsystem.
good catch!
Note that the preferred console system is subverted by Xen's
driver, in
that it uses a value of -1 for index, which means that any ttySX in
the
command line arguments will get Xen's tty driver. See
register_console().
I'm not sure I understand this.. we set the preferred console in xen/
setup.c very early, _way_ before this console is registers so I'm not
sure where the -1 helps you.
I do see that the actual index you _do_ get is returned in kcons-
>index. I wonder if you can use that to make a better guess at the
first minor number.
diff -r 17aa29a18b08 drivers/xen/console/console.c
--- a/drivers/xen/console/console.c Thu Jul 27 18:57:20 2006 -0400
+++ b/drivers/xen/console/console.c Mon Jul 31 21:04:17 2006 -0400
@@ -70,6 +70,7 @@
*/
static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode =
XC_DEFAULT;
static int xc_num = -1;
+enum { XC_NUM_MAX = 8 };
Hmm, IMNSHO anonymous enum's have little or no value.
#ifdef CONFIG_MAGIC_SYSRQ
static unsigned long sysrq_requested;
@@ -576,6 +577,7 @@ static int __init xencons_init(void)
xencons_ring_init();
+retry:
xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ?
1 : MAX_NR_CONSOLES);
I guess the final patch will have a "proper" loop and won't be
continuously alloc/put the driver?
if (xencons_driver == NULL)
@@ -612,6 +614,15 @@ static int __init xencons_init(void)
DRV(xencons_driver)->name_base);
put_tty_driver(xencons_driver);
xencons_driver = NULL;
+
+ /* Somebody, almost certainly the real serial port
+ driver, registered ahead of us, so find the first
+ unused minor. */
+ if (xc_num <= XC_NUM_MAX) {
+ xc_num++;
+ goto retry;
+ }
+
do we really want to stop at 8? why not stop at (1<<MINOR_BITS) and
maybe increment by 4 or 8?
return rc;
}
diff -r 17aa29a18b08 fs/char_dev.c
--- a/fs/char_dev.c Thu Jul 27 18:57:20 2006 -0400
+++ b/fs/char_dev.c Mon Jul 31 21:04:17 2006 -0400
@@ -111,10 +111,13 @@ __register_chrdev_region(unsigned int ma
for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next)
if ((*cp)->major > major ||
- ((*cp)->major == major && (*cp)->baseminor >= baseminor))
+ ((*cp)->major == major &&
+ (((*cp)->baseminor >= baseminor) ||
+ ((*cp)->baseminor + (*cp)->minorct > baseminor))))
break;
if (*cp && (*cp)->major == major &&
- (*cp)->baseminor < baseminor + minorct) {
+ (((*cp)->baseminor < baseminor + minorct) ||
+ ((*cp)->baseminor + (*cp)->minorct > baseminor))) {
ret = -EBUSY;
goto out;
}
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|
|
|
|
|