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

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


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 31 Jul 2023 15:24:31 +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=WjaJPRAsG8ZVfoOjQO1GFUeIsGVylpeuNhe5+y0nvhw=; b=lQXad6/i/S+veN8bgss4O5Wrxv9uysPI/A22Ts9sbenV1QhUvu0qpsFtTcFKQvMm3kGh5hUUzMVEO0+ra59i7b8QdpW7glvVSvrCocyg6lti0ERKvsgBBPFt61gPmPi/z96zBKNgZ+gB+13ROYntRknEtFBsuMtGQ5f5vVkaby/lbrvWbgdcegHe4a2hpW4OQ5J1h8XKOUYQXatEc2a2Gc1fhH2hi36LGu9FgrpUx9gtlyfz663rQWbssSe4BU07W+U2+WcCwVTNl5c+4ncgq8S//YHABTBe28QT+7QO6UMqD70nxt6K+Ab/FHBJopoYvhDOcDN0nBPt9GXNU2UWfw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CEUP7LRDcmsbTHJF+3C6ah+dTJi5hdN+uURkQWvjJUt4ryTvmpkUP8x9je8nn4SzepY6LPH0t7URySpE6ECV7I4ihR4FxmGmfBJqVh/BGsGcb483AQlC2mfK5iurqEVCnadTUmSIs2sShq5SJAccEBwOI67Awhq30fmBzGDetf7WyyESt/FsSTWpq3voL07neIghH4koMXbiml0cyeqoxEVgEplv95OCRDQMDZ/titvBAPL5Gw4srnQVaNc5rDSwING90SnCr1ouYG42q937uPJOQ75m7LHGvW3Z7NAhzyr/KiJT4v/7fbqv0EFFc4IGpULao1mpWnxIKypf48gnTQ==
  • 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, 31 Jul 2023 13:24:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.07.2023 18:45, Oleksii Kurochko wrote:
> @@ -654,6 +674,9 @@ static void ns16550_init_common(struct ns16550 *uart)
>  
>      /* Default lsr_mask = UART_LSR_THRE */
>      uart->lsr_mask  = UART_LSR_THRE;
> +
> +    if ( strstr(opt_com1, "poll") || strstr(opt_com2, "poll") )
> +        uart->intr_works = polling;
>  }

A non-__init function may not reference __initdata objects. But strstr()
is too lax anyway, and you also shouldn't check the wrong port's options.
You want to recognize "poll" _only_ where all other command line options
are processed.

Also may I remind you that extending command line options requires their
doc to also be updated?

> @@ -1333,9 +1356,13 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, 
> unsigned int idx)
>                      uart->irq = 0;
>  #endif
>                  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));
> +                }

I'm okay to leave it at this for now, since this way at least nothing
regresses that was working before. I'm not convinced this is all
correct, but that's a largely separate (and pre-existing) issue then.

> @@ -1791,8 +1808,11 @@ static int __init ns16550_uart_dt_init(struct 
> dt_device_node *dev,
>      }
>  
>      res = platform_get_irq(dev, 0);
> -    if ( ! res )
> -        return -EINVAL;
> +    if ( res < 0 )
> +    {
> +        printk("there is no interrupt property, polling will be used\n");
> +        uart->intr_works = polling;
> +    }
>      uart->irq = res;

Shouldn't you avoid writing uart->irq when res is negative?

Jan



 


Rackspace

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