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

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 28 Jan 2025 10:40:01 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org 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=NdAIrJ/MqjNZfh4vApir3Fhdo53NdRh7/2IUDn+1cts=; b=XwHdJq9PY+g5NsAyZP+zPxyB5gPf8hMMWIlaw/S5MSumuz8KJL2m+/W/xO3xOC33d0zQqBhKqyCL+kVE7N7cAIwhVhOcs+LAeM/oWgcqhLueUG5U5FrsmN3/Iq7REm5B26X7kgU5gBSPwi1sVqn11qZ1aZUM9nVOQLgO2stz0iP5AAtjcIuIwDzx/fwro0kuUkgWLV2Tk7lQjYu4LRAA6Jb1FNTvcaAqUES77hdub9m38Quyrk6GSEzwboApBYKDJSFrEUGgvhLnQ84kN/VURJRacOAGsmIE6LmiN10StScK0KZ7TC08I/VnHfub28s2HBJEnZerUZIdj+ZoCikoFQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MByVBeI9/F7YL/5QXHWhPWnbbDH8wAPEkEZo5qV2i7aHrIuuNBSUfXobA93I3AwqU46cryE3bX8gwoGqCfLeQ+yDo8H4ZAvfCx1+VDJN0ihgY0uARELTJgLYgkJgbTiqWkjrD9u0LsyQQ92dzZd3DlhPrHjO5Vhu4bVxZVWLiPyM2JAgE4A5XWBjauHb/K91XCTcn1j5oHwvHRQqUpPrA0jS2e4kQmOepBQATAV1NsskoIDD9SVZehUJ2902aWaMAxTRBLWvEZsnnCUk2kY4dvbvfBY/cs1uBKFjpKYEoD/OfjWBQ9d277EEEC8UZ3E2CUpxxx/TdPvkSL5pz9ZruQ==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Tue, 28 Jan 2025 09:40:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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));
 }
 
 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®.