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

Re: [PATCH] ARM/vgic: Clean up vgic_v2_setup_hw()


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 18 Aug 2026 08:08:14 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=citrix.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=lGcbDcYXfhuE0JJ4fFBtDFcKBGtAJuzfkmjZyxbaVCg=; b=acprK7vIJaYynTOUTdOnWGAAzirEGeV6VBzNiptt7FqCYzYEQyx1c90l3isRAvtD5eSo9+hPDBpOnVTkyztnnmYvGebsjJblCxKfLb/YGvAzpAQxLSlcbxwrj1FpaSYP/m9AdrFIvDlJexuu/ZsFa5s5TmUb91h0rq0HwwODckLfn7jT0PPMAhKWXwA8nqP6WaIidsmZ/q9gRIz2wGAz/O6Utl009sC7a55XO6w3yeYoujjUuWQ10fgKOq24PGZBivY0JsrybHTuDVW1ThBnly9v2HX9qQsRaouICzzsmL7ljAPl5SGpdsnufUJxDxC7VoBh3dlxJk2N80IL+Yq6dw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JmLLfrqz4A1i6NWktH1nDD24T5jyXRX/0lz++52f1PHiM3h1/4eZK0AM8Qwp11mLYnLAOd6I1Nku/8aY8GDh75KWa4/Y4nSldnqSmno9F6Y6AgK5vMxjyOXbXBZU1SUPtI04yh1xgi4C6PPDYKGvpjWaeszpa7xqoYxOt1LLrc64r3YMRdpcHeUGXGRDldI0CYFmV2N3Id1T/3lkkpLma+/nnR6on5zHT/u93/HBMBKIOj1OiG9GSBdRxpaCeKSa3g0E0S+DC3hmBhTxIdh0f3dFJKhfa9t07YmeDuaFXaNaxbnJN/HXZZRFMrLls0yjPn+WJWQGYiAQE6riDFDudQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>
  • Delivery-date: Tue, 18 Aug 2026 06:09:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 17-Aug-26 22:33, Andrew Cooper wrote:
> vgic_v2_setup_hw()'s callers are __init, so it should be too.  vgic_v2_hw is
> written once during init and unmodified thereafter, so make it
> __ro_after_init.  Reposition 'bool enabled' to fit in the tail padding,
> removing 8 bytes from the structure.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
The patch is good but exactly the same cleanup should be done for new vGICv2's
`gic_v2_hw_data` + `vgic_v2_setup_hw()` and vGICv3's `vgic_v3_hw` +
`vgic_v3_setup_hw()`. I can do the follow-up in which case for this patch:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
or you can bundle everything in one patch. Let me know.

~Michal
> ---
> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> CC: Julien Grall <julien@xxxxxxx>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> CC: Bertrand Marquis <bertrand.marquis@xxxxxxx>
> CC: Michal Orzel <michal.orzel@xxxxxxx>
> 
> Found when looking at the code while reviewing something else.  Only compile
> tested.
> ---
>  xen/arch/arm/vgic-v2.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
> index 642407fd5b05..3446d521de2d 100644
> --- a/xen/arch/arm/vgic-v2.c
> +++ b/xen/arch/arm/vgic-v2.c
> @@ -25,7 +25,6 @@
>  #include <asm/vreg.h>
>  
>  static struct {
> -    bool enabled;
>      /* Distributor interface address */
>      paddr_t dbase;
>      /* CPU interface address & size */
> @@ -36,10 +35,12 @@ static struct {
>  
>      /* Offset to add to get an 8kB contiguous region if GIC is aliased */
>      uint32_t aliased_offset;
> -} vgic_v2_hw;
> +    bool enabled;
> +} vgic_v2_hw __ro_after_init;
>  
> -void vgic_v2_setup_hw(paddr_t dbase, paddr_t cbase, paddr_t csize,
> -                      paddr_t vbase, uint32_t aliased_offset)
> +void __init vgic_v2_setup_hw(
> +    paddr_t dbase, paddr_t cbase, paddr_t csize, paddr_t vbase,
> +    uint32_t aliased_offset)
>  {
>      vgic_v2_hw.enabled = true;
>      vgic_v2_hw.dbase = dbase;
> 
> base-commit: ebc00c30c65023bd1498ae20dc511c4e39f6c0f7




 


Rackspace

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