Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[POWERPC] Make the hvc_console output buffer size settable

So the iSeries console will be faster since it can send up to 200 bytes at
a time to the Hypervisor. This only affects the tty part of the console,
the console writes are still in 16 byte lots.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>

+15 -9
+9 -5
drivers/char/hvc_console.c
··· 80 80 struct tty_struct *tty; 81 81 unsigned int count; 82 82 int do_wakeup; 83 - char outbuf[N_OUTBUF] __ALIGNED__; 83 + char *outbuf; 84 + int outbuf_size; 84 85 int n_outbuf; 85 86 uint32_t vtermno; 86 87 struct hv_ops *ops; ··· 506 505 if (hp->n_outbuf > 0) 507 506 hvc_push(hp); 508 507 509 - while (count > 0 && (rsize = N_OUTBUF - hp->n_outbuf) > 0) { 508 + while (count > 0 && (rsize = hp->outbuf_size - hp->n_outbuf) > 0) { 510 509 if (rsize > count) 511 510 rsize = count; 512 511 memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); ··· 539 538 if (!hp) 540 539 return -1; 541 540 542 - return N_OUTBUF - hp->n_outbuf; 541 + return hp->outbuf_size - hp->n_outbuf; 543 542 } 544 543 545 544 static int hvc_chars_in_buffer(struct tty_struct *tty) ··· 729 728 }; 730 729 731 730 struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, 732 - struct hv_ops *ops) 731 + struct hv_ops *ops, int outbuf_size) 733 732 { 734 733 struct hvc_struct *hp; 735 734 int i; 736 735 737 - hp = kmalloc(sizeof(*hp), GFP_KERNEL); 736 + hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, 737 + GFP_KERNEL); 738 738 if (!hp) 739 739 return ERR_PTR(-ENOMEM); 740 740 ··· 744 742 hp->vtermno = vtermno; 745 743 hp->irq = irq; 746 744 hp->ops = ops; 745 + hp->outbuf_size = outbuf_size; 746 + hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))]; 747 747 748 748 kobject_init(&hp->kobj); 749 749 hp->kobj.ktype = &hvc_kobj_type;
+1 -1
drivers/char/hvc_console.h
··· 56 56 57 57 /* register a vterm for hvc tty operation (module_init or hotplug add) */ 58 58 extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq, 59 - struct hv_ops *ops); 59 + struct hv_ops *ops, int outbuf_size); 60 60 /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ 61 61 extern int __devexit hvc_remove(struct hvc_struct *hp); 62 62
+2 -1
drivers/char/hvc_iseries.c
··· 221 221 222 222 pi = &port_info[vdev->unit_address]; 223 223 224 - hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops); 224 + hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops, 225 + VIOCHAR_MAX_DATA); 225 226 if (IS_ERR(hp)) 226 227 return PTR_ERR(hp); 227 228 pi->hp = hp;
+1 -1
drivers/char/hvc_rtas.c
··· 94 94 95 95 /* Allocate an hvc_struct for the console device we instantiated 96 96 * earlier. Save off hp so that we can return it on exit */ 97 - hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops); 97 + hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops, 16); 98 98 if (IS_ERR(hp)) 99 99 return PTR_ERR(hp); 100 100
+2 -1
drivers/char/hvc_vio.c
··· 90 90 if (!vdev || !id) 91 91 return -EPERM; 92 92 93 - hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops); 93 + hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops, 94 + MAX_VIO_PUT_CHARS); 94 95 if (IS_ERR(hp)) 95 96 return PTR_ERR(hp); 96 97 dev_set_drvdata(&vdev->dev, hp);