Skip to contentSkip to conversation

xen: allow 8bit input in Xen serial console

PATCH In review Manfred Haertel 2 participants 2 messages Jul 28, 2015 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: allow 8bit input in Xen serial console

The Xen serial console cuts off the most significant bit from input characters, so you can't use e.g. German umlauts when logging in to the DOM0 Linux system from the serial console.

The following patch fixes that problem.

drivers/char/serial.c renamed from drivers/char/serial.c.orig +1 -1
@@ -66,7 +66,7 @@
     spin_unlock_irqrestore(&port->rx_lock, flags);
 
     if ( fn != NULL )
-        (*fn)(c & 0x7f, regs);
+        (*fn)(c, regs);
 }
 
 void serial_tx_interrupt(struct serial_port *port, struct 

cpu_user_regs *regs)
@@ -297,7 +297,11 @@

     } while ( ((handle & SERHND_LO) &&  (c & 0x80)) ||
               ((handle & SERHND_HI) && !(c & 0x80)) );
-    return c & 0x7f;
+    if (handle & SERHND_HI)
+    {

+ c &= 0x7f;
+ }
+ return c;
}

int __init serial_parse_handle(char *conf)

#1 lore raw
Quoted 5 lines · Manfred Haertel

The Xen serial console cuts off the most significant bit from input characters, so you can't use e.g. German umlauts when logging in to the DOM0 Linux system from the serial console.

The following patch fixes that problem.

Thanks for the submission. However, please sign your patch off, per

http://wiki.xen.org/wiki/Submitting_Xen_Project_Patches#Signing_off_a_patch

Quoted 14 lines
drivers/char/serial.c 2015-07-28 18:47:10.593728590 +0200 renamed from drivers/char/serial.c.orig 2015-07-28 18:44:49.443889719 +0200 +1 -1
@@ -66,7 +66,7 @@
     spin_unlock_irqrestore(&port->rx_lock, flags);
 
     if ( fn != NULL )
-        (*fn)(c & 0x7f, regs);
+        (*fn)(c, regs);
 }
 
 void serial_tx_interrupt(struct serial_port *port, struct

cpu_user_regs *regs)

drivers/char/serial.c 2015-07-28 18:47:10.593728590 +0200 line 300

Quoted 5 lines
drivers/char/serial.c 2015-07-28 18:47:10.593728590 +0200 renamed from drivers/char/serial.c.orig 2015-07-28 18:44:49.443889719 +0200 +1 -1
@@ -297,7 +297,11 @@
     } while ( ((handle & SERHND_LO) &&  (c & 0x80)) ||
               ((handle & SERHND_HI) && !(c & 0x80)) );
 
-    return c & 0x7f;
+    if (handle & SERHND_HI)

Please read CODING_STYLE in the root of the tree, but to summarise here, spaces inside the first level of brackes, so "if ( handle & SERHND_HI )", and no braces for single statements.

drivers/char/serial.c 2015-07-28 18:47:10.593728590 +0200 line 304

Quoted 4 lines
drivers/char/serial.c 2015-07-28 18:47:10.593728590 +0200 renamed from drivers/char/serial.c.orig 2015-07-28 18:44:49.443889719 +0200 +4 -0
+    {
+        c &= 0x7f;
+    }
+    return c;

I think in both cases you need to mask out the top bit if either SERHND_HI or SERHND_LO is set, and leave all 8 bits alone if neither are set.

Both of these are opt-in with command line options, so the default configuration in most cases pass 8-bit characters unmodified. You probably also want to patch docs/misc/xen-command-line.markdown to indicate that choosing the 'H' or 'L' option will prevent the use of 8-bit characters.

~Andrew