[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] ns16550: add support for polling mode when device tree is used


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 18 Jul 2023 16:40:44 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yAAp/79gr9jTiL9SmfRndnx1mM9WxsdljfgrYyBExvA=; b=I5r09eyuGldvzNZcm9lgWBEpSgRy1PfBzGY1iSH66aaVC76i/zpytXVe+NbG+lGnkAYIMmDry0InrCUrQ1yb+Hdy+Qputj7yOgB3CxH4oudrXv84VZR2hYIzAUXr21iRjkomHe07AJiMIEeVL5H5mnZr5hnB1R5W5R4xbUOlqiqKBTz5pNHAHEKOMo8wn0g0pejqiYvF3ulnp9mvtyiGu3O3piu8wOqyrimtrSZ76TL2wORFNmhh4F6sgXVfyQo6GNCP4P1iPIgFl23NoHaJ1cIqxus0XaIGpxFWT/mZEn0scjefdqXfcWk8+3udn06N9w6xhkpK8XaPdpFElfXM1Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oUvC+ZsOyBluH/SPQQew68tVJXrdRowdMK6XQnX2XZoQqr11+tyJ4zpJuBu4ztmb6dMuQXgNuumXl2Bo0W0wQa/BQGpMBsYjhVKhU3Wgq6LUxOe6tAUPd7yYdNtQ1UKQYeX9BCfTMO9dOuK1pgW06n6QmD/HkP82dQAwQvGgc4xiG1XYhUWDxhJ1ypKEqiHMprshW4A712mTW3Pk0rucPuxLs3U5A5zRWhJsjDiD1evrHBylAA+HbfG6MPoVdDs4f15gCYAuM3FR/Jd9yIq920E33JfjCBKEmg2E8b7RkYh1DxZMKULD5NYT3E45hn0qRul2kcZBneuCh/q+fE5J0Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 18 Jul 2023 14:41:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18.07.2023 16:13, Oleksii Kurochko wrote:
> --- a/xen/drivers/char/ns16550.c
> +++ b/xen/drivers/char/ns16550.c
> @@ -40,6 +40,8 @@
>  #include <asm/fixmap.h>
>  #endif
>  
> +#define NO_IRQ_POLL 0

Do you really need this? I ask because ...

> @@ -595,7 +603,9 @@ static void __init cf_check ns16550_endboot(struct 
> serial_port *port)
>  static int __init cf_check ns16550_irq(struct serial_port *port)
>  {
>      struct ns16550 *uart = port->uart;
> -    return ((uart->irq > 0) ? uart->irq : -1);
> +
> +    return (((uart->intr_works != polling) && (uart->irq >= 0)) ?

... you now use >= here, which includes that special value. As long
as intr_works is always set to "polling", the particular value in
uart->irq shouldn't matter (and hence you wouldn't need to store
anywhere that or any other special value).

> @@ -1330,9 +1340,12 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, 
> unsigned int idx)
>                   * as special only for X86.
>                   */
>                  if ( uart->irq == 0xff )
> -                    uart->irq = 0;
> +                {
> +                    uart->irq = NO_IRQ_POLL;
> +                    uart->intr_works = polling;
> +                }
>  #endif
> -                if ( !uart->irq )
> +                if ( uart->intr_works == polling )

Careful here - we may also have read 0 from PCI_INTERRUPT_LINE, or
forced 0 because we read 0 from PCI_INTERRUPT_PIN. All these cases,
unless provably broken, need to continue to function as they were.

Further you alter parse_positional(), but you leave alone
parse_namevalue_pairs(). I think you're changing the admin (command
line) interface that way, because so far "irq=0" was the way to
request polling. While it may be unavoidable to change that interface
(which will then need noting in ./CHANGELOG.md), you still need to
offer a way to forcibly set polling mode.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.