Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KQN2m-0008BD-4Q for qemu-devel@nongnu.org; Tue, 05 Aug 2008 09:57:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KQN2l-00089E-14 for qemu-devel@nongnu.org; Tue, 05 Aug 2008 09:57:43 -0400 Received: from [199.232.76.173] (port=50156 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQN2k-000890-Pc for qemu-devel@nongnu.org; Tue, 05 Aug 2008 09:57:42 -0400 Received: from relay01.mx.bawue.net ([193.7.176.67]:49512) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KQN2k-00073s-AG for qemu-devel@nongnu.org; Tue, 05 Aug 2008 09:57:42 -0400 Date: Tue, 5 Aug 2008 15:57:38 +0200 From: Thiemo Seufer Subject: Re: [Qemu-devel] [PATCH] upgrading emulated UART to 16550A Message-ID: <20080805135738.GC4102@networkno.de> References: <48985284.9060001@eu.citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48985284.9060001@eu.citrix.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Stabellini Cc: Ian Jackson , qemu-devel@nongnu.org Stefano Stabellini wrote: > This patch upgrades the emulated UART to 16550A, the code comes from > xen-unstable. > The main improvement was introduced with the following patch and > subsequent email thread: > > http://lists.xensource.com/archives/html/xen-devel/2007-12/msg00129.html > > I only made few changes to use qemu_get_clock instead of > clock_gettime, as Anthony suggested a little while ago. > > Signed-off-by: Stefano Stabellini > > --- > > > diff --git a/hw/serial.c b/hw/serial.c > index ffd6ac9..f63e62a 100644 > --- a/hw/serial.c > +++ b/hw/serial.c > @@ -1,5 +1,5 @@ > /* > - * QEMU 16450 UART emulation > + * QEMU 16550A UART emulation > * > * Copyright (c) 2003-2004 Fabrice Bellard I think it needs also an updated copyright notice. [snip] > +/* Rate limit serial requests so that e.g. grub on a serial console > + doesn't kill dom0. Simple token bucket. If we get some actual > + data from the user, instantly refil the bucket. */ > + > +/* How long it takes to generate a token, in nanoseconds. */ > +#define TOKEN_PERIOD 1000000 > +/* Maximum and initial size of token bucket */ > +#define TOKENS_MAX 100000 This token business probably needs a bit more explanation, at a glance I didn't figure out what it is meant to do (and why the constants above are good). Thiemo