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

Re: [PATCH v3 1/4] xen/arm: its: initialize host LPI state before activating ITSes


  • To: Mykola Kvach <Mykola_Kvach@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Tue, 22 Sep 2026 23:56:22 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Adt5AFFvngQlvhyNHuOWpyMqXZ3eaYAQIevhb8B0XYg=; b=UMySzeOYXcwO4P+Y62DLWljqAxj5dtdHuRCAAdb837cnRLnWH7lnZCsPptSpUi53RCmuHZZFGf6qEXuLsyYaUoWO+MPoRHszKE3HRVRnDA0eQOjtN5/rF7gO8O4sOlvU2Ua42KI5EN2fkGWOKR5xLj4a8DmWCE7CfJucBGoLDL+ZjRxt2VAe/CIN/MSelmxB9D6rKGEveB2FpCaOnIRvxfPHWkrx0UjIb8zyUUmtfDIY9GcIJONKmMi9gQyEPE4wlqCCvzONM56AUiywC5a8HyQLN8+l4tI7bmQraEXqmpj5+kQzZZ7Bz2VOtqym4hxWoqUKeizDacwWyn8jQXBXeQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uyZO44RDIa8+W8Prmn2wOsuMeRmDuK6P1Q/krv/qhyTGG9VBtCUs33WA1vwTxyDY6BAovuVh/39F+zMnfVKkcqfh8Pp7Ou6ZN2y5yRV3LcUOOomeQfQKL3cioV8yq2tB2N3Oi0X9oNFMHc9tphbO448/mKJl9CT8ryk9+sZcfb06lA3wFwPSgAQsMhqQgnrJ2R6bb8E3309dmFxOdfIyUi58x/WLo22cJ0gtklhq76ochbyFSrn/VdoJDVrvZmda/F1KmviPZVBYLze+IW1lN67jgusqs8F5y24jHuRo9wscdDMrIwo37Xv06KVAposBE4TUyK5/9wEySlabFbBlqA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Tue, 22 Sep 2026 23:56:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdSqtHErIjikKEzUu28tenN1pYhA==
  • Thread-topic: [PATCH v3 1/4] xen/arm: its: initialize host LPI state before activating ITSes

Hi Mykola,

Mykola Kvach <mykola_kvach@xxxxxxxx> writes:

> The boot CPU pending table must use the memory attributes selected by
> ITS quirks. gicv3_lpi_init_host_lpis() is therefore called after
> gicv3_its_init(). However, gicv3_its_init() also programs and enables
> each ITS before host LPI state is allocated. No ITS commands are
> submitted at that point, but this ordering relies on that implementation
> detail.
>
> Split per-ITS initialization into preparation and activation phases.
> First map and disable every ITS and collect its quirks. Then initialize
> host LPI state. Only after that, allocate and program the ITS tables and
> command queue, and enable each ITS.
>
> The subsequent gicv3_cpu_init() sequence remains unchanged: it programs
> the Redistributor LPI tables, enables LPIs, and then submits the first
> MAPC and SYNC commands.
>
> Suggested-by: Julien Grall <julien@xxxxxxx>
> Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
> ---
> Changes in v3:
> - New patch implementing the post-4.22 initialization order discussed
>   during review of the ordering fix.
>
> Link: 
> https://patchew.org/Xen/341edd8de63dcd84ccc6e7b6c03e9e8fc7105184.1781847061.git.mykola._5Fkvach@xxxxxxxx/
> ---
>  xen/arch/arm/gic-v3-its.c             | 32 ++++++++++++++++++++++-----
>  xen/arch/arm/gic-v3.c                 | 15 ++-----------
>  xen/arch/arm/include/asm/gic_v3_its.h |  4 ++--
>  3 files changed, 31 insertions(+), 20 deletions(-)
>
> diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
> index 325835b0ad..972825bf06 100644
> --- a/xen/arch/arm/gic-v3-its.c
> +++ b/xen/arch/arm/gic-v3-its.c
> @@ -11,6 +11,7 @@
>  #include <xen/lib.h>
>  #include <xen/delay.h>
>  #include <xen/iocap.h>
> +#include <xen/init.h>
>  #include <xen/libfdt/libfdt.h>
>  #include <xen/mm.h>
>  #include <xen/rbtree.h>
> @@ -549,10 +550,9 @@ static int gicv3_disable_its(struct host_its *hw_its)
>      return -ETIMEDOUT;
>  }
>  
> -static int gicv3_its_init_single_its(struct host_its *hw_its)
> +static int __init gicv3_its_prepare_single_its(struct host_its *hw_its)
>  {
> -    uint64_t reg;
> -    int i, ret;
> +    int ret;
>  
>      hw_its->its_base = ioremap_nocache(hw_its->addr, hw_its->size);
>      if ( !hw_its->its_base )
> @@ -564,6 +564,14 @@ static int gicv3_its_init_single_its(struct host_its 
> *hw_its)
>  
>      gicv3_its_enable_quirks(hw_its);
>  
> +    return 0;
> +}
> +
> +static int __init gicv3_its_init_single_its(struct host_its *hw_its)
> +{
> +    uint64_t reg;
> +    int i, ret;
> +
>      reg = readq_relaxed(hw_its->its_base + GITS_TYPER);
>      hw_its->devid_bits = GITS_TYPER_DEVICE_ID_BITS(reg);
>      hw_its->evid_bits = GITS_TYPER_EVENT_ID_BITS(reg);
> @@ -1189,7 +1197,7 @@ static void gicv3_its_acpi_init(void)
>  
>  #endif
>  
> -int gicv3_its_init(void)
> +int __init gicv3_its_init(unsigned int host_lpi_bits)
>  {
>      struct host_its *hw_its;
>      int ret;
> @@ -1201,13 +1209,27 @@ int gicv3_its_init(void)
>  
>      list_for_each_entry(hw_its, &host_its_list, entry)
>      {
> -        ret = gicv3_its_init_single_its(hw_its);
> +        ret = gicv3_its_prepare_single_its(hw_its);
>          if ( ret )
>              return ret;
>      }
>  
>      gicv3_its_validate_quirks();
>  
> +    if ( list_empty(&host_its_list) )
> +        return 0;

What is the purpose of this check here? I'd expect to see it before the
first list_for_each_entry() loop.

> +
> +    ret = gicv3_lpi_init_host_lpis(host_lpi_bits);
> +    if ( ret )
> +        return ret;
> +
> +    list_for_each_entry(hw_its, &host_its_list, entry)
> +    {
> +        ret = gicv3_its_init_single_its(hw_its);
> +        if ( ret )
> +            return ret;
> +    }
> +
>      return 0;
>  }

[...]


-- 
WBR, Volodymyr


 


Rackspace

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