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

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


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 24 Jul 2023 16:43:02 +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=SNzGTM1o3xIa9kcRiIs6wQ13+/1OY8o/5kHg68wZ0Cs=; b=OrMqb93/ZlXgYGaR9fXEZHlRKHL/mHY2Cda4nU9413UgGIr9kJc2u4J8KAhWU/Es4uebY08K+ymWUeJpozvqssrj4qpkoAyA+hciaAdVhgbLDj+GuYtzpVA2KQnSG6IycNO5XHlBieplE/QokgpNtktUpD2XFFQMXbldVt2VwjlzTtxH1Z0u+6OPJHf2HEXX1CyIUwuyuZbwGd78aNgpi8FS20tbZDfcaWjmi13LTomiMBAR2K9xrsYIHXmYmfyGhEsLfOjh5fJyca0m494RtkFyOQalygRvwYOzSY0VxB/S4qEWBAgRWWlURXefqK8n8QRqkomPN1UQtRd08HKgjw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MFsLyc9T6msZGLf3kgGUUw6qfwJd+sBV/7GPYvzkOW7nlBumCUOqGYuKQyBB1UjycdkvFskzSBqeuYGh/SgBemK4SshPQ1KD4+Ey5dgyFlCThPIKvx5fntnnxkzE+T1bVf7rgiAC6efzarJTUM81aj1TJWRH/b2GqiVtxa3VjEjJvnLAv3DDLMy1kcp2XW2Wb5xMCsSnZKed1doWbR5mP5FiAOMOqLdqwjQRmnsxBGh1QBSZItDCZ8pV9XcOPcQEZbqdR5X0vJH+MJ6Gp8j4xlJ7qorkSaMjruhhoFnTSjne97Fn6ndzPxDYj1vZiqzyIgQG/JgvbtAAyyViOmxBnA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 24 Jul 2023 14:43:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24.07.2023 16:27, Oleksii Kurochko wrote:
> --- a/xen/drivers/char/console.c
> +++ b/xen/drivers/char/console.c
> @@ -993,6 +993,8 @@ void __init console_init_preirq(void)
>  #endif
>          else if ( !strncmp(p, "none", 4) )
>              continue;
> +        else if ( !strncmp(p, "polling", 7 )
> +            continue;
>          else if ( (sh = serial_parse_handle(p)) >= 0 )
>          {
>              sercon_handle = sh;

Looks like you mean the new option to go under "console=". Besides
this being guesswork because of you not updating the command line
doc, this also is wrong, as the property then applies to all
consoles. What you mean is a control for a specific instance of a
16550 console, which can only possibly go under "com<N>=". I would
suggest to simply extend [<irq>|msi] there to [<irq>|msi|poll].

> @@ -595,7 +601,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 : -1;
>  }

Please don't corrupt previously correct style. You can keep things
almost like they were (albeit there's no strict need for any of the
parentheses):

    return ((uart->intr_works != polling) ? uart->irq : -1);

> @@ -1330,9 +1341,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->intr_works = polling;
> +                }
>  #endif
> -                if ( !uart->irq )
> +                if ( !uart->irq || (uart->intr_works == polling) )
>                      printk(XENLOG_INFO
>                             "ns16550: %pp: no legacy IRQ, using poll mode\n",
>                             &PCI_SBDF(0, b, d, f));

Message and code (after your addition) continue to be out of sync.
As said before, any condition that leads to polling mode wants to
find itself expressed by uart->intr_works set to "polling".

> @@ -1552,6 +1566,7 @@ static bool __init parse_positional(struct ns16550 
> *uart, char **str)
>              conf += 3;
>              uart->msi = true;
>              uart->irq = 0;
> +            uart->intr_works = polling;

How that? "msi" is specifically asking for interrupt driven mode,
just that the IRQ number isn't known yet. (Seeing this I notice that
parse_namevalue_pairs() offers no way of selecting MSI mode. But
that's not something you need to sort out.)

Jan



 


Rackspace

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