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

Re: [PATCH] ns1650: refactor interrupt handling in ns16550_uart_dt_init()


  • To: Oleksii <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 13 Jul 2023 15:27:12 +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=rVowdBeioNqE7rx3G1jPNX1b58+2dJY50H1U2ncgZbE=; b=gLM2huKPwnYZHeDn0MyhYoeY3/O5pSkfL0EodSVKVBRDRLgKHZL48bt4UhCRsEWvpJOT8FCeIpxilMqG+lt0HnYjFmM1/2F+C5tFr6X+cqQpoXsgCIjZMY/Y4ggFnJgxGfyXkfk16ZmT1hxLeEhnEgB3xpnPnz035t2YdNeQELGt+yOjw2TiG4TOgSUDUaNOFZSEdurQ65ekyQftQHs+L5zhNA+2FI55TjD8micKs7Sasjp9UR3naKmsWbHezaK9zMZvNmx5wTWbfUvkL2id4krVYhC0QKw2RWerTFEUxwNNoAR274OZLtAXIAbfv9kpewDYwmNKZ12HDcea9zTbpQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fXLG172FLbs7dy8oeWrpxU16aAIYTwtVMHfSBr+mv97WSbbeCcgvNXkCU0a+XylE5Z+iBNJQEo1zdSrPA9XipH3B4SII3UNRNBWOT1USaLK07ZL7LzKIvoGa+VJOZVJ+drc0qWAXEC+uwGa3ucwqbHJ0z/pJqh0oOe3yZdhgnWJDYPXxi4s3Ul10IoLHbuRt43PXqs8uFn/rsbu5M60p08iENMLPyDcj6gToMjzGlkS9YgEYiCBK6Lw65Igyb8c2zzGqk2iD5PDLHHKut6pUWat9BjT+Mij5UI40T1E0jq0Ty5/2pdM3Q2sxy0b+5QichUFtfaXLpQlVgN0odGFb0A==
  • 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>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Thu, 13 Jul 2023 13:27:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.07.2023 15:19, Oleksii wrote:
> On Thu, 2023-07-13 at 12:08 +0200, Jan Beulich wrote:
>> On 13.07.2023 11:30, Oleksii Kurochko wrote:
>>> --- a/xen/drivers/char/ns16550.c
>>> +++ b/xen/drivers/char/ns16550.c
>>> @@ -1791,8 +1791,16 @@ static int __init
>>> ns16550_uart_dt_init(struct dt_device_node *dev,
>>>      }
>>>  
>>>      res = platform_get_irq(dev, 0);
>>> -    if ( ! res )
>>> -        return -EINVAL;
>>> +    if ( res == -1 )
>>> +    {
>>> +        printk("ns1650: polling will be used\n");
>>
>> Nit: Please don't omit one of the two 5-s here.
>>
>>> +        /*
>>> +         * There is the check 'if ( uart->irq > 0 )' in
>>> ns16550_init_postirq().
>>> +         * If the check is true then interrupt mode will be used
>>> otherwise
>>> +         * ( when irq = 0 )polling.
>>> +         */
>>
>> I wonder in how far that's actually correct outside of x86. On x86
>> IRQ0 is
>> always the timer interrupt, but I'm not convinced something similar
>> can be
>> used as kind of a heuristic on Arm, RISC-V, or basically any other
>> architecture.
> uart->irq is used as an interrupt number for ns16550 and according to
> the code in ns16550_init_postirq() uart->irq should be > 0.
> So there is safe to use 0 as a detector of polling as it won't be used
> as an interrupt number for ns16550 itself.

I don't understand. My earlier comment was affecting all checks of
uart->irq alike, as I'm unconvinced IRQ0 may not possibly be usable
on some architecture / platform. IOW I don't see why the check in
ns16550_init_postirq() would allow us any leeway.

Jan



 


Rackspace

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