ia64/xen-unstable

changeset 4289:0bfb769b2d64

bitkeeper revision 1.1236.1.123 (424284cbdc1iFeJb-iVYG6KJOhmSuw)

Merge arcadians.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xeno.bk
into arcadians.cl.cam.ac.uk:/auto/anfs/nos1/akw27/xeno-clone/xeno.bk
author akw27@arcadians.cl.cam.ac.uk
date Thu Mar 24 09:13:47 2005 +0000 (2005-03-24)
parents 3f85b523b318 6dd611b31171
children 0c7d16e71835
files .rootkeys linux-2.6.11-xen-sparse/drivers/xen/console/console.c xen/arch/x86/setup.c xen/common/dom0_ops.c xen/common/physdev.c xen/drivers/char/serial.c xen/include/xen/physdev.h xen/include/xen/serial.h
line diff
     1.1 --- a/.rootkeys	Wed Mar 23 23:16:54 2005 +0000
     1.2 +++ b/.rootkeys	Thu Mar 24 09:13:47 2005 +0000
     1.3 @@ -1317,6 +1317,7 @@ 3ddb79c2Fg44_PBPVxHSC0gTOMq4Ow xen/inclu
     1.4  3ddb79c0MOVXq8qZDQRGb6z64_xAwg xen/include/xen/pci_ids.h
     1.5  3e54c38dlSCVdyVM4PKcrSfzLLxWUQ xen/include/xen/perfc.h
     1.6  3e54c38de9SUSYSAwxDf_DwkpAnQFA xen/include/xen/perfc_defn.h
     1.7 +42422fb0FVX-TJkSvAXnbfwMf19XFA xen/include/xen/physdev.h
     1.8  3ddb79c04nQVR3EYM5L4zxDV_MCo1g xen/include/xen/prefetch.h
     1.9  3e4540ccU1sgCx8seIMGlahmMfv7yQ xen/include/xen/reboot.h
    1.10  40589969nPq3DMzv24RDb5LXE9brHw xen/include/xen/sched-if.h
     2.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c	Wed Mar 23 23:16:54 2005 +0000
     2.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c	Thu Mar 24 09:13:47 2005 +0000
     2.3 @@ -63,15 +63,32 @@
     2.4   * warnings from standard distro startup scripts.
     2.5   */
     2.6  static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode = XC_DEFAULT;
     2.7 +static int xc_num = -1;
     2.8  
     2.9  static int __init xencons_setup(char *str)
    2.10  {
    2.11 -    if ( !strcmp(str, "tty") )
    2.12 +    char *q;
    2.13 +    int n;
    2.14 +
    2.15 +    if ( !strncmp(str, "ttyS", 4) )
    2.16 +        xc_mode = XC_SERIAL;
    2.17 +    else if ( !strncmp(str, "tty", 3) )
    2.18          xc_mode = XC_TTY;
    2.19 -    else if ( !strcmp(str, "ttyS") )
    2.20 -        xc_mode = XC_SERIAL;
    2.21 -    else if ( !strcmp(str, "off") )
    2.22 +    else if ( !strncmp(str, "off", 3) )
    2.23          xc_mode = XC_OFF;
    2.24 +
    2.25 +    switch ( xc_mode )
    2.26 +    {
    2.27 +    case XC_SERIAL:
    2.28 +        n = simple_strtol( str+4, &q, 10 );
    2.29 +        if ( q > (str + 4) ) xc_num = n;
    2.30 +        break;
    2.31 +    case XC_TTY:
    2.32 +        n = simple_strtol( str+3, &q, 10 );
    2.33 +        if ( q > (str + 3) ) xc_num = n;
    2.34 +        break;
    2.35 +    }
    2.36 +
    2.37      return 1;
    2.38  }
    2.39  __setup("xencons=", xencons_setup);
    2.40 @@ -130,16 +147,12 @@ static void kcons_write_dom0(
    2.41  {
    2.42      int rc;
    2.43  
    2.44 -    while ( count > 0 )
    2.45 +    while ( (count > 0) &&
    2.46 +            ((rc = HYPERVISOR_console_io(
    2.47 +                CONSOLEIO_write, count, (char *)s)) > 0) )
    2.48      {
    2.49 -        if ( (rc = HYPERVISOR_console_io(CONSOLEIO_write,
    2.50 -                                         count, (char *)s)) > 0 )
    2.51 -        {
    2.52 -            count -= rc;
    2.53 -            s += rc;
    2.54 -        }
    2.55 -	else
    2.56 -	    break;
    2.57 +        count -= rc;
    2.58 +        s += rc;
    2.59      }
    2.60  }
    2.61  
    2.62 @@ -176,8 +189,8 @@ void xen_console_init(void)
    2.63              xc_mode = XC_SERIAL;
    2.64          kcons_info.write = kcons_write_dom0;
    2.65  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    2.66 -	if ( xc_mode == XC_SERIAL )
    2.67 -	    kcons_info.flags |= CON_ENABLED;
    2.68 +        if ( xc_mode == XC_SERIAL )
    2.69 +            kcons_info.flags |= CON_ENABLED;
    2.70  #endif
    2.71      }
    2.72      else
    2.73 @@ -187,15 +200,24 @@ void xen_console_init(void)
    2.74          kcons_info.write = kcons_write;
    2.75      }
    2.76  
    2.77 -    if ( xc_mode == XC_OFF )
    2.78 -        return __RETCODE;
    2.79 +    switch ( xc_mode )
    2.80 +    {
    2.81 +    case XC_SERIAL:
    2.82 +        strcpy(kcons_info.name, "ttyS");
    2.83 +        if ( xc_num == -1 ) xc_num = 0;
    2.84 +        break;
    2.85  
    2.86 -    if ( xc_mode == XC_SERIAL )
    2.87 -        strcpy(kcons_info.name, "ttyS");
    2.88 -    else
    2.89 +    case XC_TTY:
    2.90          strcpy(kcons_info.name, "tty");
    2.91 +        if ( xc_num == -1 ) xc_num = 1;
    2.92 +        break;
    2.93 +
    2.94 +    default:
    2.95 +        return __RETCODE;
    2.96 +    }
    2.97  
    2.98      register_console(&kcons_info);
    2.99 +
   2.100      return __RETCODE;
   2.101  }
   2.102  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   2.103 @@ -234,7 +256,7 @@ void xencons_force_flush(void)
   2.104       * We use dangerous control-interface functions that require a quiescent
   2.105       * system and no interrupts. Try to ensure this with a global cli().
   2.106       */
   2.107 -    local_irq_disable();	/* XXXsmp */
   2.108 +    local_irq_disable(); /* XXXsmp */
   2.109  
   2.110      /* Spin until console data is flushed through to the domain controller. */
   2.111      while ( (wc != wp) && !ctrl_if_transmitter_empty() )
   2.112 @@ -475,8 +497,10 @@ static inline int __xencons_put_char(int
   2.113  }
   2.114  
   2.115  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   2.116 -static int xencons_write(struct tty_struct *tty, const unsigned char *buf,
   2.117 -			 int count)
   2.118 +static int xencons_write(
   2.119 +    struct tty_struct *tty,
   2.120 +    const unsigned char *buf,
   2.121 +    int count)
   2.122  {
   2.123      int i;
   2.124      unsigned long flags;
   2.125 @@ -498,8 +522,11 @@ static int xencons_write(struct tty_stru
   2.126      return i;
   2.127  }
   2.128  #else
   2.129 -static int xencons_write(struct tty_struct *tty, int from_user,
   2.130 -			 const u_char *buf, int count)
   2.131 +static int xencons_write(
   2.132 +    struct tty_struct *tty, 
   2.133 +    int from_user,
   2.134 +    const u_char *buf, 
   2.135 +    int count)
   2.136  {
   2.137      int i;
   2.138      unsigned long flags;
   2.139 @@ -642,7 +669,7 @@ static int xennullcon_dummy(void)
   2.140      return 0;
   2.141  }
   2.142  
   2.143 -#define DUMMY	(void *)xennullcon_dummy
   2.144 +#define DUMMY (void *)xennullcon_dummy
   2.145  
   2.146  /*
   2.147   *  The console `switch' structure for the dummy console
   2.148 @@ -705,14 +732,14 @@ static int __init xencons_init(void)
   2.149      if ( xc_mode == XC_SERIAL )
   2.150      {
   2.151          DRV(xencons_driver)->name        = "ttyS";
   2.152 -        DRV(xencons_driver)->minor_start = 64;
   2.153 -	DRV(xencons_driver)->name_base   = 0;
   2.154 +        DRV(xencons_driver)->minor_start = 64 + xc_num;
   2.155 +        DRV(xencons_driver)->name_base   = 0 + xc_num;
   2.156      }
   2.157      else
   2.158      {
   2.159          DRV(xencons_driver)->name        = "tty";
   2.160 -        DRV(xencons_driver)->minor_start = 1;
   2.161 -	DRV(xencons_driver)->name_base   = 1;
   2.162 +        DRV(xencons_driver)->minor_start = xc_num;
   2.163 +        DRV(xencons_driver)->name_base   = xc_num;
   2.164      }
   2.165  
   2.166  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   2.167 @@ -759,8 +786,9 @@ static int __init xencons_init(void)
   2.168          (void)ctrl_if_register_receiver(CMSG_CONSOLE, xencons_rx, 0);
   2.169      }
   2.170  
   2.171 -    printk("Xen virtual console successfully installed as %s\n",
   2.172 -           DRV(xencons_driver)->name);
   2.173 +    printk("Xen virtual console successfully installed as %s%d\n",
   2.174 +           DRV(xencons_driver)->name,
   2.175 +           DRV(xencons_driver)->name_base );
   2.176      
   2.177      return 0;
   2.178  }
     3.1 --- a/xen/arch/x86/setup.c	Wed Mar 23 23:16:54 2005 +0000
     3.2 +++ b/xen/arch/x86/setup.c	Thu Mar 24 09:13:47 2005 +0000
     3.3 @@ -8,6 +8,7 @@
     3.4  #include <xen/softirq.h>
     3.5  #include <xen/acpi.h>
     3.6  #include <xen/console.h>
     3.7 +#include <xen/serial.h>
     3.8  #include <xen/trace.h>
     3.9  #include <xen/multiboot.h>
    3.10  #include <asm/bitops.h>
    3.11 @@ -617,6 +618,9 @@ void __init __start_xen(multiboot_info_t
    3.12      /* Give up the VGA console if DOM0 is configured to grab it. */
    3.13      console_endboot(cmdline && strstr(cmdline, "tty0"));
    3.14  
    3.15 +    /* Hide UART from DOM0 if we're using it */
    3.16 +    serial_endboot();
    3.17 +
    3.18      domain_unpause_by_systemcontroller(current->domain);
    3.19      domain_unpause_by_systemcontroller(dom0);
    3.20      startup_cpu_idle_loop();
     4.1 --- a/xen/common/dom0_ops.c	Wed Mar 23 23:16:54 2005 +0000
     4.2 +++ b/xen/common/dom0_ops.c	Thu Mar 24 09:13:47 2005 +0000
     4.3 @@ -16,6 +16,7 @@
     4.4  #include <asm/domain_page.h>
     4.5  #include <xen/trace.h>
     4.6  #include <xen/console.h>
     4.7 +#include <xen/physdev.h>
     4.8  #include <asm/shadow.h>
     4.9  #include <public/sched_ctl.h>
    4.10  
    4.11 @@ -402,7 +403,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    4.12  
    4.13      case DOM0_PCIDEV_ACCESS:
    4.14      {
    4.15 -        extern int physdev_pci_access_modify(domid_t, int, int, int, int);
    4.16          ret = physdev_pci_access_modify(op->u.pcidev_access.domain, 
    4.17                                          op->u.pcidev_access.bus,
    4.18                                          op->u.pcidev_access.dev,
     5.1 --- a/xen/common/physdev.c	Wed Mar 23 23:16:54 2005 +0000
     5.2 +++ b/xen/common/physdev.c	Thu Mar 24 09:13:47 2005 +0000
     5.3 @@ -105,6 +105,14 @@ static int setup_ioport_memory_access(st
     5.4      return 0;
     5.5  }
     5.6  
     5.7 +void physdev_modify_ioport_access_range(
     5.8 +    struct domain *d, int enable, int port, int num)
     5.9 +{
    5.10 +    int i;
    5.11 +    for ( i = port; i < (port + num); i++ )
    5.12 +        (enable ? clear_bit : set_bit)(i, d->arch.iobmp_mask);
    5.13 +}
    5.14 +
    5.15  /* Add a device to a per-domain device-access list. */
    5.16  static int add_dev_to_task(struct domain *d, struct pci_dev *dev, int acc)
    5.17  {
     6.1 --- a/xen/drivers/char/serial.c	Wed Mar 23 23:16:54 2005 +0000
     6.2 +++ b/xen/drivers/char/serial.c	Thu Mar 24 09:13:47 2005 +0000
     6.3 @@ -15,6 +15,7 @@
     6.4  #include <xen/reboot.h>
     6.5  #include <xen/sched.h>
     6.6  #include <xen/serial.h>
     6.7 +#include <xen/physdev.h>
     6.8  #include <asm/io.h>
     6.9  
    6.10  /* Config serial port with a string <baud>,DPS,<io-base>,<irq>. */
    6.11 @@ -479,6 +480,14 @@ void serial_force_unlock(int handle)
    6.12          uart->lock = SPIN_LOCK_UNLOCKED;
    6.13  }
    6.14  
    6.15 +void serial_endboot(void)
    6.16 +{
    6.17 +    int i;
    6.18 +    for ( i = 0; i < ARRAY_SIZE(com); i++ )
    6.19 +        if ( UART_ENABLED(&com[i]) )
    6.20 +            physdev_modify_ioport_access_range(dom0, 0, com[i].io_base, 8);
    6.21 +}
    6.22 +
    6.23  /*
    6.24   * Local variables:
    6.25   * mode: C
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/xen/include/xen/physdev.h	Thu Mar 24 09:13:47 2005 +0000
     7.3 @@ -0,0 +1,19 @@
     7.4 +/******************************************************************************
     7.5 + * physdev.h
     7.6 + */
     7.7 +
     7.8 +#ifndef __XEN_PHYSDEV_H__
     7.9 +#define __XEN_PHYSDEV_H__
    7.10 +
    7.11 +#include <public/physdev.h>
    7.12 +
    7.13 +void physdev_modify_ioport_access_range(
    7.14 +    struct domain *d, int enable, int port, int num );
    7.15 +void physdev_destroy_state(struct domain *d);
    7.16 +int physdev_pci_access_modify(
    7.17 +    domid_t dom, int bus, int dev, int func, int enable);
    7.18 +int domain_iomem_in_pfn(struct domain *p, unsigned long pfn);
    7.19 +long do_physdev_op(physdev_op_t *uop);
    7.20 +void physdev_init_dom0(struct domain *d);
    7.21 +
    7.22 +#endif /* __XEN_PHYSDEV_H__ */
     8.1 --- a/xen/include/xen/serial.h	Wed Mar 23 23:16:54 2005 +0000
     8.2 +++ b/xen/include/xen/serial.h	Thu Mar 24 09:13:47 2005 +0000
     8.3 @@ -50,6 +50,8 @@ unsigned char irq_serial_getc(int handle
     8.4  
     8.5  void serial_force_unlock(int handle);
     8.6  
     8.7 +void serial_endboot(void);
     8.8 +
     8.9  #endif /* __XEN_SERIAL_H__ */
    8.10  
    8.11  /*