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

Re: [for-4.20][PATCH v2 1/2] device-tree: bootfdt: Fix build issue when CONFIG_PHYS_ADDR_T_32=y


  • To: Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Tue, 28 Jan 2025 10:34:38 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • 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=2; 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=1xiinY+D8vfdhgdrxMh3iziYTey/5cXJj2erHf0h0zY=; b=SnjW1e5tnpe8FAK8rZT40NXPghMxf8ti9vz44KIh+OPirTYlPH8ALUoCaVj11wQs9NDC0rD/mQLwpsPmRrLkAYjlPAizwIk0uM3rFVCQOipQgS+I19NTtWXahja7yurveg3SMc6gNdWxomIPNnFSW8v0czzh416mla0fmScr0OO9BcokPJmV841CmsFmym6nHqoQH9fBQGhQ2cT/g2yNH6mqo5FXl1GCEfD7YMb2VdQFJVqsgFo/jGq0/+yPAKcPRd2pxPzMx8wAfiC90Qvj+m8e2kdqtpo2i8LHeE37E16KCb5Z88cMZLadGpQvlZKM9dgGFecHED/dEQZJAOeEQw==
  • 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=1xiinY+D8vfdhgdrxMh3iziYTey/5cXJj2erHf0h0zY=; b=MuEMrTrGH8ZWpUcampHvdM/FgUvYlyig4NJGgZnfgClOa9ly0MUJ5wl35fnxLP6aGQcZE1OfPYhhUaPn5wqwDiE8BGCYzlAyupMeh1ftufToiTHG+Clw2fYl59y6u4cMklSb6FS6xeuohlMWWDoTujbPLeFikLo/V6LIUy9UiZA8CL/lFwdz0dxhu/scqZX1VQ9t6sSvrytWmRIJ9MvyCP3YpNMjkFwuviWRVW6b27cnfrYHyc2NqlB8VDOiIlUGC0KAFkkiZ3uGgIGvj99hGVQqz+NrZ/zNc9TyRiNR7QtP8fMYPoBaIw0gtwHXBW4uzc6XvVYH9YZhJ0xgX2DcPw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=k3Tjq6GOafm9Wzuav+BmSjzt70+/o77Qii4CsfNLstrXD00LW+43CCRct8zLAynBnjrKpHY1XZtlR6dIl6h6BURG1Uis9qMgver7iv/qo6DuDdyNNrFxumOpVLNQ4tlJd4rWvmZ0GFAVpJQUIEUPiO2XZieKXLp34olSSUQUlKlMmWlr0lHldBoUcAAWANJjban4A5sniQYbNYoV3+xoG0Lw0E8aaKalTuk6blHHR7S1B97YR9cUiIG4P3egXVktBMgpltDQ806eGaK4/TJTropwQds5BxF9rrxoUsV8HtMktb/3K+OX1dwS5SR7vPdMQYPw82AEegAC9rK/I6ambg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T0v9qF3+yS0D1bhhuNcBxf/qo6J+RXeEJruxMMPUBagNn3K62XWynD4aeMMd5ohAxSGtZUY2qDLCuCHy22EQ6jOCJ8MkGaLKRvWkBX/g4wwiFE9BZw/L0160LNiuBZJg3zPgBULRxjNp0pXkUFPucevDyaaha2FmLM7XY++eZcnlfAG91nUIz19liZTv37SdfOx/Zlip1kKGQ5MTgq071KiiZcHMFyArKhl5YLkUrZ/5+k8eiCCN7vpyaJ9y7Jb9S8WDRjJKALmFqfwXPaq3gt96moA76scWvXJ8lSa7H9P4uE7YtpTfaT3cAh4s1ENS+nF9vSyo5/p0u3bO2MmD8Q==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "oleksii.kurochko@xxxxxxxxx" <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Tue, 28 Jan 2025 10:35:05 +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: AQHbcWiul9cH2IOw7U+mIQTrfYS+Q7Mr/YSA
  • Thread-topic: [for-4.20][PATCH v2 1/2] device-tree: bootfdt: Fix build issue when CONFIG_PHYS_ADDR_T_32=y

Hi Michal, Julien,

> On 28 Jan 2025, at 09:40, Michal Orzel <michal.orzel@xxxxxxx> wrote:
> 
> On Arm32, when CONFIG_PHYS_ADDR_T_32 is set, a build failure is observed:
> common/device-tree/bootfdt.c: In function 'build_assertions':
> ./include/xen/macros.h:47:31: error: static assertion failed: 
> "!(alignof(struct membanks) != 8)"
>   47 | #define BUILD_BUG_ON(cond) ({ _Static_assert(!(cond), "!(" #cond ")"); 
> })
>      |                               ^~~~~~~~~~~~~~
> common/device-tree/bootfdt.c:31:5: note: in expansion of macro 'BUILD_BUG_ON'
>   31 |     BUILD_BUG_ON(alignof(struct membanks) != 8);
> 
> When CONFIG_PHYS_ADDR_T_32 is set, paddr_t is defined as unsigned long,
> therefore the struct membanks alignment is 4B and not 8B. The check is
> there to ensure the struct membanks and struct membank, which is a
> member of the former, are equally aligned. Therefore modify the check to
> compare alignments obtained via alignof not to rely on hardcoded
> values.
> 
> Fixes: 2209c1e35b47 ("xen/arm: Introduce a generic way to access memory bank 
> structures")
> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
> Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
> ---
> Changes in v2:
> - modify the check to test against alignment of struct membank
> ---
> xen/common/device-tree/bootfdt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/common/device-tree/bootfdt.c 
> b/xen/common/device-tree/bootfdt.c
> index 47386d4fffea..529c91e603ab 100644
> --- a/xen/common/device-tree/bootfdt.c
> +++ b/xen/common/device-tree/bootfdt.c
> @@ -27,8 +27,8 @@ static void __init __maybe_unused build_assertions(void)
>      */
>     BUILD_BUG_ON((offsetof(struct membanks, bank) !=
>                  offsetof(struct meminfo, bank)));
> -    /* Ensure "struct membanks" is 8-byte aligned */
> -    BUILD_BUG_ON(alignof(struct membanks) != 8);
> +    /* Ensure "struct membanks" and "struct membank" are equally aligned */
> +    BUILD_BUG_ON(alignof(struct membanks) != alignof(struct membank));

Apologies for not catching the issue for your v1, probably I didn't understand 
very well the test itself,
why are we checking that the structure have the same alignment? 
I see we check the offset of `(struct membanks).bank` against `(struct 
meminfo|struct shared_meminfo).bank`,
isn't that enough?
For sure I’m missing something...

Anyway I tested this:

Tested-by: Luca Fancellu <luca.fancellu@xxxxxxx>

> }
> 
> static bool __init device_tree_node_is_available(const void *fdt, int node)
> -- 
> 2.25.1
> 
> 


 


Rackspace

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