From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] ns16550: misc minor adjustments Date: Thu, 12 Nov 2015 12:20:40 +0000 Message-ID: <56448418.1070207@citrix.com> References: <564478AA02000078000B428C@prv-mh.provo.novell.com> <1447326476.18450.57.camel@citrix.com> <56448B8002000078000B4379@prv-mh.provo.novell.com> <1447330218.18450.65.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZwqsJ-0001k0-BZ for xen-devel@lists.xenproject.org; Thu, 12 Nov 2015 12:21:11 +0000 In-Reply-To: <1447330218.18450.65.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell , Jan Beulich Cc: xen-devel , Keir Fraser , Ian Jackson , TimDeegan List-Id: xen-devel@lists.xenproject.org On 12/11/15 12:10, Ian Campbell wrote: > On Thu, 2015-11-12 at 04:52 -0700, Jan Beulich wrote: > >>>> @@ -530,7 +531,8 @@ static void ns16550_setup_preirq(struct >>>> /* Baud rate already set: read it out from the divisor >>>> latch. */ >>>> divisor = ns_read_reg(uart, UART_DLL); >>>> divisor |= ns_read_reg(uart, UART_DLM) << 8; >>>> - uart->baud = uart->clock_hz / (divisor << 4); >>>> + if ( divisor ) >>>> + uart->baud = uart->clock_hz / (divisor << 4); >>> Will following code cope with uart->baud == BAUD_AUTO? Or should we >>> pick a >>> static fallback rate (115200?) and set the divisor appropriately? >> The device won't work with it left as BAUD_AUTO. Setting a guessed >> baud rate alone won't help, as we'd then also have to write it into the >> respective registers. And I don't think anyway we should do any >> guessing here - if the command line option was wrong (regardless of >> whether due to using auto or just a wrong baud rate), communication >> won't work. All I think we should really care about is to not crash, the >> more in a way not diagnosable over serial console. > BAUD_AUTO is the default in device-tree based situations, so it isn't > necessarily the case that the command line is wrong. For the non-DT case I > think it also ends up with an implicit BAUD_AUTO in some cases? > > That said I don't think it is worth going to the effort to distinguish > implicit from explicit-auto configuration, and your argument about not > writing to the registers certainly applies to the latter, so lets just > worry about not crashing as you say. > > Is a printk worthwhile, due to the fact there might be a second console > present? Yes. Even if there isn't a second serial console, the system might boot and `xl dmesg` should contain a record. ~Andrew