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

Re: [PATCH v3 2/2] arch/arm: time: Add support for parsing interrupts by names


  • To: "Andrei Cherechesu (OSS)" <andrei.cherechesu@xxxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Mon, 13 Mar 2023 13:27:29 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=TBrl2vXbXXcZw9VB3uJMC6npfF3pNUGDO7BlABGsY1M=; b=nK6th71MdBIov6e1eARXkc1rsSWJb9XS11aBVdpedqxgD0BeZQ9v84Jv+pp3Yjcri0HXSIDkbi2mbDZtCtJC31f1THGNs8PBphM8COxkJRUE3i0XjG9zOC+b23dUOG3yBvpVVGZNqpYsPnH66l8NtimZK9Qss+1BNLg5D0AnaHIMiL3vB8SWztuA+YPxA6xURlMOns1nb4W+AZj9GLfdlAGhQ4vPq9rs5RsxLZiTwUyioOwoNxFSTNkIXMVFSy8/8JV7NfoAt0yZkXuBU/IX6SCJz80fZSyB7SAiZkoFqGon2PW2/hYvrBRYWORJFhwBZA+60+t/EkM/zb5WcDUfNQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kk0u1XbT3CnCdsuTNG8oGYBAFXV3rCOls3fqfAZWDYVfcjbPOakBZ2yCQut9LElW3rQuPx6cZMqXBvQErLpww0OnSjmwFWx/Ise5qV9CMePAZPGZs6OeMDkZvqVE9Mou3vlwMigyQl+p8ME21qjN97xC703BT7r9hxA2kSfv4sg8VIpE6lsW6LKo/sWpy5gHAOkqj/ozol0JrYQ84RDwA1iQ/wotfVSULpb/R6jg3CbIP+Uhq4bVoxpuvsmrJbZB1nU4vYpmTtdi4oWSIZR+mzrEje11xkINlf7mmxwPzYMu81f0K5vMqQBGovqzqr+pd7Lx20vRd44uRN7Yf6cHkw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>, Rahul Singh <Rahul.Singh@xxxxxxx>, Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
  • Delivery-date: Mon, 13 Mar 2023 13:39:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZVaz1hJUkfdlibkq6wV6LX+eESK74s7YA
  • Thread-topic: [PATCH v3 2/2] arch/arm: time: Add support for parsing interrupts by names

HI Andrei,

> On 13 Mar 2023, at 14:08, Andrei Cherechesu (OSS) 
> <andrei.cherechesu@xxxxxxxxxxx> wrote:
> 
> From: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
> 
> Added support for parsing the ARM generic timer interrupts DT
> node by the "interrupt-names" property, if it is available.
> 
> If not available, the usual parsing based on the expected
> IRQ order is performed.
> 
> Also treated returning 0 as an error case for the
> platform_get_irq() calls, since it is not a valid PPI ID and
> treating it as a valid case would only cause Xen to BUG() later,
> when trying to reserve vIRQ being SGI.
> 
> Added the "hyp-virt" PPI to the timer PPI list, even
> though it's currently not in use. If the "hyp-virt" PPI is
> not found, the hypervisor won't panic.
> 
> Signed-off-by: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> xen/arch/arm/include/asm/time.h |  3 ++-
> xen/arch/arm/time.c             | 26 ++++++++++++++++++++++----
> 2 files changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/time.h b/xen/arch/arm/include/asm/time.h
> index 4b401c1110..49ad8c1a6d 100644
> --- a/xen/arch/arm/include/asm/time.h
> +++ b/xen/arch/arm/include/asm/time.h
> @@ -82,7 +82,8 @@ enum timer_ppi
>     TIMER_PHYS_NONSECURE_PPI = 1,
>     TIMER_VIRT_PPI = 2,
>     TIMER_HYP_PPI = 3,
> -    MAX_TIMER_PPI = 4,
> +    TIMER_HYP_VIRT_PPI = 4,
> +    MAX_TIMER_PPI = 5,
> };
> 
> /*
> diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
> index 433d7be909..0b482d7db3 100644
> --- a/xen/arch/arm/time.c
> +++ b/xen/arch/arm/time.c
> @@ -149,15 +149,33 @@ static void __init init_dt_xen_time(void)
> {
>     int res;
>     unsigned int i;
> +    bool has_names;
> +    static const char * const timer_irq_names[MAX_TIMER_PPI] __initconst = {
> +        [TIMER_PHYS_SECURE_PPI] = "sec-phys",
> +        [TIMER_PHYS_NONSECURE_PPI] = "phys",
> +        [TIMER_VIRT_PPI] = "virt",
> +        [TIMER_HYP_PPI] = "hyp-phys",
> +        [TIMER_HYP_VIRT_PPI] = "hyp-virt",
> +    };
> +
> +    has_names = dt_property_read_bool(timer, "interrupt-names");
> 
>     /* Retrieve all IRQs for the timer */
>     for ( i = TIMER_PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++ )
>     {
> -        res = platform_get_irq(timer, i);
> -
> -        if ( res < 0 )
> +        if ( has_names )
> +            res = platform_get_irq_byname(timer, timer_irq_names[i]);
> +        else
> +            res = platform_get_irq(timer, i);
> +
> +        if ( res > 0 )
> +            timer_irq[i] = res;
> +        /*
> +         * Do not panic if "hyp-virt" PPI is not found, since it's not
> +         * currently used.
> +         */
> +        else if ( i != TIMER_HYP_VIRT_PPI )
>             panic("Timer: Unable to retrieve IRQ %u from the device tree\n", 
> i);
> -        timer_irq[i] = res;
>     }
> }
> 
> -- 
> 2.35.1
> 




 


Rackspace

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