WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] If Xen is told to use a serial console via a com1= or co

To: xen-changelog@xxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] If Xen is told to use a serial console via a com1= or com2= directive
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 24 Mar 2005 03:10:42 +0000
Delivery-date: Thu, 24 Mar 2005 04:04:43 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-changelog>
List-help: <mailto:xen-changelog-request@lists.sourceforge.net?subject=help>
List-id: <xen-changelog.lists.sourceforge.net>
List-post: <mailto:xen-changelog@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.sourceforge.net?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-admin@xxxxxxxxxxxxxxxxxxxxx
ChangeSet 1.1358, 2005/03/24 03:10:42+00:00, iap10@xxxxxxxxxxxxxxxxxxxxx

        If Xen is told to use a serial console via a com1= or com2= directive
        on the Xen command line, it now hides that particular UART from dom0.
        
        This means that it's now safe to enable the 8250 driver in the Linux
        config. If Xen has been told to use com1, the dom0 linux kernel will
        not see /dev/ttyS0, but will see ttyS1,S2 etc if they are present,
        enabling them to be used for mice, modems, printers etc.
        
        Unfortunately, the 8250 driver will register itself for a ttyS even if
        that particular UART isn't present. This is really annoying, as it 
        prevents the 'xencons' driver registering itself as ttyS0 even though
        the 8250 won't see ttyS0 as present if Xen is using com1. This
        prevents us from enabling 8250 in the default kernel config, as it 
        will change current behaviour. 
        
        If you want to use 8250 and xencons, the trick is to tell xencons to
        grab a high numbered ttyS port that the 8250 driver will have left
        alone. For example, put "xencons=ttyS31" on the Linux command line.
        You'll then be able to edit /etc/inittab to add an entry for a 
        getty on ttyS31 if you want to be able to log in on the serial console
        that is being shared with Xen.
        
        If anyone knows a way of cleanly kicking the 8250 driver off a
        particular char minor then please let me know!
        
         
        
        
        
        
        
        
        



 linux-2.6.11-xen-sparse/drivers/xen/console/console.c |   58 +++++++++++++-----
 xen/arch/x86/setup.c                                  |    4 +
 xen/common/dom0_ops.c                                 |    2 
 xen/common/physdev.c                                  |   14 ++++
 xen/drivers/char/serial.c                             |   16 ++++
 xen/include/xen/physdev.h                             |   19 +++++
 xen/include/xen/serial.h                              |    2 
 7 files changed, 99 insertions(+), 16 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c 
b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c     2005-03-23 
23:02:55 -05:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c     2005-03-23 
23:02:55 -05:00
@@ -63,15 +63,33 @@
  * 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;
 
 static int __init xencons_setup(char *str)
 {
-    if ( !strcmp(str, "tty") )
-        xc_mode = XC_TTY;
-    else if ( !strcmp(str, "ttyS") )
+    char *q;
+    int n;
+
+    if ( !strncmp(str, "ttyS", 4) )
         xc_mode = XC_SERIAL;
-    else if ( !strcmp(str, "off") )
+    else if ( !strncmp(str, "tty", 3) )
+        xc_mode = XC_TTY;
+    else if ( !strncmp(str, "off", 3) )
         xc_mode = XC_OFF;
+
+    switch (xc_mode)
+    {
+    case XC_SERIAL:
+       n  = simple_strtol( str+4, &q, 10 );
+       if ( q>str+4 ) xc_num = n;
+       break;
+
+    case XC_TTY:
+       n  = simple_strtol( str+3, &q, 10 );
+       if ( q>str+3 ) xc_num = n;
+       break;
+    }
+printk("xc_num = %d\n",xc_num);
     return 1;
 }
 __setup("xencons=", xencons_setup);
@@ -187,15 +205,24 @@
         kcons_info.write = kcons_write;
     }
 
-    if ( xc_mode == XC_OFF )
-        return __RETCODE;
-
-    if ( xc_mode == XC_SERIAL )
+    switch ( xc_mode )
+    {
+    case XC_SERIAL:
         strcpy(kcons_info.name, "ttyS");
-    else
+       if ( xc_num == -1 ) xc_num = 0;
+       break;
+
+    case XC_TTY:
         strcpy(kcons_info.name, "tty");
+       if ( xc_num == -1 ) xc_num = 1;
+       break;
+       
+    default:
+        return __RETCODE;
+    }
 
     register_console(&kcons_info);
+
     return __RETCODE;
 }
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
@@ -705,14 +732,14 @@
     if ( xc_mode == XC_SERIAL )
     {
         DRV(xencons_driver)->name        = "ttyS";
-        DRV(xencons_driver)->minor_start = 64;
-       DRV(xencons_driver)->name_base   = 0;
+        DRV(xencons_driver)->minor_start = 64 + xc_num;
+        DRV(xencons_driver)->name_base   = 0 + xc_num;
     }
     else
     {
         DRV(xencons_driver)->name        = "tty";
-        DRV(xencons_driver)->minor_start = 1;
-       DRV(xencons_driver)->name_base   = 1;
+        DRV(xencons_driver)->minor_start = xc_num;
+        DRV(xencons_driver)->name_base   = xc_num;
     }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
@@ -759,8 +786,9 @@
         (void)ctrl_if_register_receiver(CMSG_CONSOLE, xencons_rx, 0);
     }
 
-    printk("Xen virtual console successfully installed as %s\n",
-           DRV(xencons_driver)->name);
+    printk("Xen virtual console successfully installed as %s%d\n",
+           DRV(xencons_driver)->name,
+           DRV(xencons_driver)->name_base );
     
     return 0;
 }
diff -Nru a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      2005-03-23 23:02:55 -05:00
+++ b/xen/arch/x86/setup.c      2005-03-23 23:02:55 -05:00
@@ -8,6 +8,7 @@
 #include <xen/softirq.h>
 #include <xen/acpi.h>
 #include <xen/console.h>
+#include <xen/serial.h>
 #include <xen/trace.h>
 #include <xen/multiboot.h>
 #include <asm/bitops.h>
@@ -616,6 +617,9 @@
 
     /* Give up the VGA console if DOM0 is configured to grab it. */
     console_endboot(cmdline && strstr(cmdline, "tty0"));
+
+    /* Hide UART from DOM0 if we're using it */
+    serial_endboot();
 
     domain_unpause_by_systemcontroller(current->domain);
     domain_unpause_by_systemcontroller(dom0);
diff -Nru a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     2005-03-23 23:02:55 -05:00
+++ b/xen/common/dom0_ops.c     2005-03-23 23:02:55 -05:00
@@ -16,6 +16,7 @@
 #include <asm/domain_page.h>
 #include <xen/trace.h>
 #include <xen/console.h>
+#include <xen/physdev.h>
 #include <asm/shadow.h>
 #include <public/sched_ctl.h>
 
@@ -402,7 +403,6 @@
 
     case DOM0_PCIDEV_ACCESS:
     {
-        extern int physdev_pci_access_modify(domid_t, int, int, int, int);
         ret = physdev_pci_access_modify(op->u.pcidev_access.domain, 
                                         op->u.pcidev_access.bus,
                                         op->u.pcidev_access.dev,
diff -Nru a/xen/common/physdev.c b/xen/common/physdev.c
--- a/xen/common/physdev.c      2005-03-23 23:02:55 -05:00
+++ b/xen/common/physdev.c      2005-03-23 23:02:55 -05:00
@@ -105,6 +105,20 @@
     return 0;
 }
 
+void physdev_modify_ioport_access_range( struct domain *d, int enable, 
+                                 int port, int num )
+{
+    int i;
+    ASSERT( d->arch.iobmp_mask );
+    for ( i = port; i < port+num; i++ )
+    {
+        if(enable)
+            clear_bit(i, d->arch.iobmp_mask);
+        else
+            set_bit(i, d->arch.iobmp_mask);
+    }
+}
+
 /* Add a device to a per-domain device-access list. */
 static int add_dev_to_task(struct domain *d, struct pci_dev *dev, int acc)
 {
diff -Nru a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c
--- a/xen/drivers/char/serial.c 2005-03-23 23:02:55 -05:00
+++ b/xen/drivers/char/serial.c 2005-03-23 23:02:55 -05:00
@@ -15,6 +15,7 @@
 #include <xen/reboot.h>
 #include <xen/sched.h>
 #include <xen/serial.h>
+#include <xen/physdev.h>
 #include <asm/io.h>
 
 /* Config serial port with a string <baud>,DPS,<io-base>,<irq>. */
@@ -477,6 +478,21 @@
     struct uart *uart = &com[handle & SERHND_IDX];
     if ( handle != -1 )
         uart->lock = SPIN_LOCK_UNLOCKED;
+}
+
+void serial_endboot()
+{
+    int i;
+
+    for (i=0;i<sizeof(com)/sizeof(struct uart);i++)
+    {
+        if( UART_ENABLED(&com[i]) )
+        {
+            /* remove access */
+            physdev_modify_ioport_access_range( dom0, 0, com[i].io_base, 8 );
+        }
+    }
+    
 }
 
 /*
diff -Nru a/xen/include/xen/physdev.h b/xen/include/xen/physdev.h
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/xen/include/xen/physdev.h 2005-03-23 23:02:55 -05:00
@@ -0,0 +1,19 @@
+/******************************************************************************
+ * physdev.h
+ */
+
+#ifndef __XEN_PHYSDEV_H__
+#define __XEN_PHYSDEV_H__
+
+#include <public/physdev.h>
+
+void physdev_modify_ioport_access_range( struct domain *d, int enable, 
+                                 int port, int num );
+void physdev_destroy_state(struct domain *d);
+int physdev_pci_access_modify(domid_t dom, int bus, int dev, int func, 
+                              int enable);
+int domain_iomem_in_pfn(struct domain *p, unsigned long pfn);
+long do_physdev_op(physdev_op_t *uop);
+void physdev_init_dom0(struct domain *d);
+
+#endif /* __XEN_PHYSDEV_H__ */
diff -Nru a/xen/include/xen/serial.h b/xen/include/xen/serial.h
--- a/xen/include/xen/serial.h  2005-03-23 23:02:55 -05:00
+++ b/xen/include/xen/serial.h  2005-03-23 23:02:55 -05:00
@@ -50,6 +50,8 @@
 
 void serial_force_unlock(int handle);
 
+void serial_endboot(void);
+
 #endif /* __XEN_SERIAL_H__ */
 
 /*


-------------------------------------------------------
This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005
Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows
Embedded(r) & Windows Mobile(tm) platforms, applications & content.  Register
by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] If Xen is told to use a serial console via a com1= or com2= directive, BitKeeper Bot <=