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

RE: [PATCH] xen/arm: vtimer: Don't read/use the secure physical timer interrupt for ACPI


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Driscoll, Dan" <dan.driscoll@xxxxxxxxxxx>
  • Date: Tue, 10 Oct 2023 17:11:42 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siemens.com; dmarc=pass action=none header.from=siemens.com; dkim=pass header.d=siemens.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=betaDKU9pBkJ0XSaEJyJ/TwLMP5zHhxaWcNcUTf3Fp8=; b=RJZhpK35h8xNfMlKW/scCbgbR3KJvXyuWOoHVkOHmtDi3O4JSZ0bibiYt3A5zWIsldnDqG0tVZbj1yRjspxWd4z1AgjqvvpwN+E03fKnOEMsGrr1PjxxW1xmBM54VPaa8vF3kk66SQkyIgh47tUWKwgz8c9ylh3iUWkJQYR3AbT5lZ8IdqQ0MxcDv6+LcdVDaaG3/nsCAIltaVbh5KPHtwuHlwo2MzOGztcqt7D337mibacC5UnhFQscqHO3p6SWdLjIFcS12lYzDxjoT2UNzFEwLNsb/AR3xEwqaeoSUUR2wn1+DK8dv01l2umpB7sL1A2C5CAEgF0/cO23FYyoQg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G7brKgOCfIsGdUxL/97/dqh/84FPbj0Lxx0r3C5EVLZ5hYE+WOyyVBcnII5iK8BmwZcvcbwB0eeWrfcmAoK+RlA1zNB7sqIsvUGy9xyq63ZiTi8gAOhAWEJjPkDeHJnqLle16pC2tdFln7LQA3VHKfSJ/T+LrCw7GFcfI476YO5bHfS+wb4SJ6r2uS34GWb70X7bRWCq8RRRX+t08L6UyciZOVX7qLr3OKBhJlbiGG3youSRDFzFwUd+fQR5hwIIdMO3hjguuK1tGqRNvPqbhFk31TX71D8DePHCVlerhZUe3Rbb7PWQAeJ7OZVv2YCghTSNPQ79KkySxwECkGE5tA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=siemens.com;
  • Cc: "Henry.Wang@xxxxxxx" <Henry.Wang@xxxxxxx>, "arvind.raghuraman@xxxxxxxxxxx" <arvind.raghuraman@xxxxxxxxxxx>, "michal.orzel@xxxxxxx" <michal.orzel@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 10 Oct 2023 17:11:56 +0000
  • Document_confidentiality: Restricted
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels: MSIP_Label_9d258917-277f-42cd-a3cd-14c4e9ee58bc_Enabled=true; MSIP_Label_9d258917-277f-42cd-a3cd-14c4e9ee58bc_SetDate=2023-10-10T17:11:40Z; MSIP_Label_9d258917-277f-42cd-a3cd-14c4e9ee58bc_Method=Standard; MSIP_Label_9d258917-277f-42cd-a3cd-14c4e9ee58bc_Name=restricted; MSIP_Label_9d258917-277f-42cd-a3cd-14c4e9ee58bc_SiteId=38ae3bcd-9579-4fd4-adda-b42e1495d55a; MSIP_Label_9d258917-277f-42cd-a3cd-14c4e9ee58bc_ActionId=17634b2b-a011-465e-bc34-852e0e76806b; MSIP_Label_9d258917-277f-42cd-a3cd-14c4e9ee58bc_ContentBits=0
  • Thread-index: AQHZ96yxZ+gVlhB35EKAv+vh3PAOIrBDSgIA
  • Thread-topic: [PATCH] xen/arm: vtimer: Don't read/use the secure physical timer interrupt for ACPI

Julien,

        Verified this patch works on Graviton 2... so looks good from this 
perspective.

Thanks,
Dan

> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> Sent: Thursday, October 5, 2023 11:55 AM
> To: xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Henry.Wang@xxxxxxx; Driscoll, Dan (DI SW CAS ES TO)
> <dan.driscoll@xxxxxxxxxxx>; Raghuraman, Arvind (DI SW CAS ES)
> <arvind.raghuraman@xxxxxxxxxxx>; michal.orzel@xxxxxxx; Julien Grall
> <jgrall@xxxxxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>; Julien Grall
> <julien@xxxxxxx>; Bertrand Marquis <bertrand.marquis@xxxxxxx>; Volodymyr
> Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> Subject: [PATCH] xen/arm: vtimer: Don't read/use the secure physical timer
> interrupt for ACPI
> 
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> Per ACPI 6.5 section 5.2.25 ("Generic Timer Description Table (GTDT)"), the 
> fields
> "Secure EL1 Timer GSIV/Flags" are optional and an OS running in non-secure
> world is meant to ignore the values.
> 
> However, Xen is trying to reserve the value. When booting on Graviton
> 2 metal instances, this would result to crash a boot because the value is 0 
> which is
> already reserved (I haven't checked for which device).
> While nothing prevent a PPI to be shared, the field should have been ignored 
> by
> Xen.
> 
> For the Device-Tree case, I couldn't find a statement suggesting that the 
> secure
> physical timer interrupt  is ignored. In fact, I have found some code in 
> Linux using it
> as a fallback. That said, it should never be used.
> 
> As I am not aware of any issue when booting using Device-Tree, the physical 
> timer
> interrupt is only ignored for ACPI.
> 
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
> 
> ----
> 
> This has not been tested on Graviton 2 because I can't seem to get the serial
> console working properly. @Dan would you be able to try it?
> 
> It would also be good to understand why 0 why already reserved. This may be a
> sign for other issues in the ACPI code.
> ---
>  xen/arch/arm/time.c   |  4 ----
>  xen/arch/arm/vtimer.c | 17 +++++++++++++++--
>  2 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c index
> 3535bd8ac7c7..8fc14cd3ff62 100644
> --- a/xen/arch/arm/time.c
> +++ b/xen/arch/arm/time.c
> @@ -78,10 +78,6 @@ static int __init arch_timer_acpi_init(struct
> acpi_table_header *header)
>      irq_set_type(gtdt->non_secure_el1_interrupt, irq_type);
>      timer_irq[TIMER_PHYS_NONSECURE_PPI] = gtdt->non_secure_el1_interrupt;
> 
> -    irq_type = acpi_get_timer_irq_type(gtdt->secure_el1_flags);
> -    irq_set_type(gtdt->secure_el1_interrupt, irq_type);
> -    timer_irq[TIMER_PHYS_SECURE_PPI] = gtdt->secure_el1_interrupt;
> -
>      irq_type = acpi_get_timer_irq_type(gtdt->virtual_timer_flags);
>      irq_set_type(gtdt->virtual_timer_interrupt, irq_type);
>      timer_irq[TIMER_VIRT_PPI] = gtdt->virtual_timer_interrupt; diff --git
> a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c index
> c54360e20266..e73ae33c1b58 100644
> --- a/xen/arch/arm/vtimer.c
> +++ b/xen/arch/arm/vtimer.c
> @@ -8,6 +8,7 @@
>   * Copyright (c) 2011 Citrix Systems.
>   */
> 
> +#include <xen/acpi.h>
>  #include <xen/lib.h>
>  #include <xen/perfc.h>
>  #include <xen/sched.h>
> @@ -61,10 +62,22 @@ int domain_vtimer_init(struct domain *d, struct
> xen_arch_domainconfig *config)
> 
>      config->clock_frequency = timer_dt_clock_frequency;
> 
> -    /* At this stage vgic_reserve_virq can't fail */
> +    /*
> +     * Per the ACPI specification, providing a secure EL1 timer
> +     * interrupt is optional and will be ignored by non-secure OS.
> +     * Therefore don't reserve the interrupt number for the HW domain
> +     * and ACPI.
> +     *
> +     * Note that we should still reserve it when using the Device-Tree
> +     * because the interrupt is not optional. That said, we are not
> +     * expecting any OS to use it when running on top of Xen.
> +     *
> +     * At this stage vgic_reserve_virq() is not meant to fail.
> +    */
>      if ( is_hardware_domain(d) )
>      {
> -        if ( !vgic_reserve_virq(d, timer_get_irq(TIMER_PHYS_SECURE_PPI)) )
> +        if ( acpi_disabled &&
> +             !vgic_reserve_virq(d,
> + timer_get_irq(TIMER_PHYS_SECURE_PPI)) )
>              BUG();
> 
>          if ( !vgic_reserve_virq(d, timer_get_irq(TIMER_PHYS_NONSECURE_PPI)) )
> --
> 2.40.1




 


Rackspace

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