From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Justin T. Gibbs" Subject: Re: [PATCH] iommu-remote: Fix lost serial TX interrupts. Report receive overruns. Date: Fri, 29 Jan 2010 08:30:00 -0700 Message-ID: <4B62FEF8.4050705@scsiguy.com> References: <4B621D41.5030805@scsiguy.com> <19298.62797.474730.747439@mariner.uk.xensource.com> Reply-To: gibbs@scsiguy.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010302020508060308040105" Return-path: In-Reply-To: <19298.62797.474730.747439@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------010302020508060308040105 Content-Type: multipart/alternative; boundary="------------050503030001030700010106" --------------050503030001030700010106 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 1/29/2010 7:48 AM, Ian Jackson wrote: > Justin T. Gibbs writes ("[Xen-devel] [PATCH] iommu-remote: Fix lost serial TX interrupts. Report receive overruns."): > > This patch corrects emulation errors in QEMU's 16550 uart emulation, > > which cause compatibility issues with FreeBSD's uart(9) driver. > > Thanks for the contribution. However, I wasn't able to apply it to > qemu-xen-unstable. 3 out of 4 hunks failed to apply. > > Was this patch made against qemu-xen-unstable or is this just a copy > of the patch in qemu upstream ? > > If you haven't adjusted it to fit qemu-xen then I'm happy to do that - > just say the word. If you did adjust it then something is wrong. The patch was against OpenSuSE's Xen 4.0.0 package's version of qemu, but it seems to apply for me on a fresh clone of: http://xenbits.xensource.com/git-http/qemu-xen-unstable.git/ Am I pulling down the wrong repo? I've included the patch again as an attachment just to rule out any mangling caused by inlining it before. -- Justin --------------050503030001030700010106 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 1/29/2010 7:48 AM, Ian Jackson wrote:
> Justin T. Gibbs writes ("[Xen-devel] [PATCH] iommu-remote: Fix lost serial TX interrupts. Report receive overruns."):
>> This patch corrects emulation errors in QEMU's 16550 uart emulation,
>> which cause compatibility issues with FreeBSD's uart(9) driver.
>
> Thanks for the contribution.  However, I wasn't able to apply it to
> qemu-xen-unstable.  3 out of 4 hunks failed to apply.
>
> Was this patch made against qemu-xen-unstable or is this just a copy
> of the patch in qemu upstream ?
>
> If you haven't adjusted it to fit qemu-xen then I'm happy to do that -
> just say the word.  If you did adjust it then something is wrong.


The patch was against OpenSuSE's Xen 4.0.0 package's version of qemu,
but it seems to apply for me on a fresh clone of:

    http://xenbits.xensource.com/git-http/qemu-xen-unstable.git/

Am I pulling down the wrong repo?  I've included the patch again as an
attachment just to rule out any mangling caused by inlining it before.

--
Justin

--------------050503030001030700010106-- --------------010302020508060308040105 Content-Type: text/plain; name="qemu-lost-serial-interrupts.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="qemu-lost-serial-interrupts.patch" Index: xen-4.0.0-testing/tools/ioemu-remote/hw/serial.c =================================================================== --- xen-4.0.0-testing.orig/tools/ioemu-remote/hw/serial.c +++ xen-4.0.0-testing/tools/ioemu-remote/hw/serial.c @@ -159,11 +159,19 @@ { SerialFIFO *f = (fifo) ? &s->recv_fifo : &s->xmit_fifo; - f->data[f->head++] = chr; + /* Receive overruns do not overwrite FIFO contents. */ + if (fifo == XMIT_FIFO || f->count < UART_FIFO_LENGTH) { - if (f->head == UART_FIFO_LENGTH) - f->head = 0; - f->count++; + f->data[f->head++] = chr; + + if (f->head == UART_FIFO_LENGTH) + f->head = 0; + } + + if (f->count < UART_FIFO_LENGTH) + f->count++; + else if (fifo == RECV_FIFO) + s->lsr |= UART_LSR_OE; return 1; } @@ -195,12 +203,10 @@ * this is not in the specification but is observed on existing * hardware. */ tmp_iir = UART_IIR_CTI; - } else if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR)) { - if (!(s->fcr & UART_FCR_FE)) { - tmp_iir = UART_IIR_RDI; - } else if (s->recv_fifo.count >= s->recv_fifo.itl) { - tmp_iir = UART_IIR_RDI; - } + } else if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR) && + (!(s->fcr & UART_FCR_FE) || + s->recv_fifo.count >= s->recv_fifo.itl)) { + tmp_iir = UART_IIR_RDI; } else if ((s->ier & UART_IER_THRI) && s->thr_ipending) { tmp_iir = UART_IIR_THRI; } else if ((s->ier & UART_IER_MSI) && (s->msr & UART_MSR_ANY_DELTA)) { @@ -523,8 +529,10 @@ break; case 2: ret = s->iir; - s->thr_ipending = 0; - serial_update_irq(s); + if (ret & UART_IIR_THRI) { + s->thr_ipending = 0; + serial_update_irq(s); + } break; case 3: ret = s->lcr; @@ -534,9 +542,9 @@ break; case 5: ret = s->lsr; - /* Clear break interrupt */ - if (s->lsr & UART_LSR_BI) { - s->lsr &= ~UART_LSR_BI; + /* Clear break and overrun interrupts */ + if (s->lsr & (UART_LSR_BI|UART_LSR_OE)) { + s->lsr &= ~(UART_LSR_BI|UART_LSR_OE); serial_update_irq(s); } break; --------------010302020508060308040105 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------010302020508060308040105--