From d42911d9744faa95ff23e96b479468cf006d8f49 Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 27 Nov 2023 11:02:22 +0200 Subject: [PATCH] sof: coherent: Don't mark "struct coherent" as packed On 64-bit systems (i.e: i.MX93), marking "struct coherent" as packed leads to compilation warnings such as: "warning: taking address of packed member of 'struct coherent' may result in an unaligned pointer value" This is because the "list" attribute is found at offset 36, which is not 8B-aligned. In contrast, 32-bit systems don't have this problem as the "list" attribute is found at offset 24 which is 4B-aligned. Since marking "struct coherent" as packed doesn't seem to be necessary, remove this to fix the compilation warnings. On 32-bit systems, 'pahole' shows no difference between the 'packed' and the non-'packed' cases as the fields are already naturally aligned at the moment. A more detailed discussion regarding this issue can be found here: https://github.com/thesofproject/sof/pull/8521. Signed-off-by: Laurentiu Mihalcea --- src/include/sof/coherent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/sof/coherent.h b/src/include/sof/coherent.h index 8e06fb466a66..6c11b6723e98 100644 --- a/src/include/sof/coherent.h +++ b/src/include/sof/coherent.h @@ -17,7 +17,7 @@ #include #include -#define __coherent __attribute__((packed, aligned(DCACHE_LINE_SIZE))) +#define __coherent __aligned(DCACHE_LINE_SIZE) /* * The coherent API allows optimized access to memory by multiple cores, using