ARCH_STRICT_ALIGN is used for hardware without UAL, now it only control the -mstrict-align flag. However, ACPI structures are packed by default so will cause unaligned accesses.
To avoid this, define ACPI_MISALIGNMENT_NOT_SUPPORTED in asm/acenv.h to align ACPI structures if ARCH_STRICT_ALIGN enabled.
Cc: stable@vger.kernel.org Reported-by: Binbin Zhou zhoubinbin@loongson.cn Suggested-by: Xi Ruoyao xry111@xry111.site Suggested-by: Jiaxun Yang jiaxun.yang@flygoat.com Signed-off-by: Huacai Chen chenhuacai@loongson.cn --- V2: Modify asm/acenv.h instead of Makefile.
arch/loongarch/include/asm/acenv.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/loongarch/include/asm/acenv.h b/arch/loongarch/include/asm/acenv.h index 52f298f7293b..483c955f2ae5 100644 --- a/arch/loongarch/include/asm/acenv.h +++ b/arch/loongarch/include/asm/acenv.h @@ -10,9 +10,8 @@ #ifndef _ASM_LOONGARCH_ACENV_H #define _ASM_LOONGARCH_ACENV_H
-/* - * This header is required by ACPI core, but we have nothing to fill in - * right now. Will be updated later when needed. - */ +#ifdef CONFIG_ARCH_STRICT_ALIGN +#define ACPI_MISALIGNMENT_NOT_SUPPORTED +#endif /* CONFIG_ARCH_STRICT_ALIGN */
#endif /* _ASM_LOONGARCH_ACENV_H */
Hi Huacai,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master] [also build test WARNING on v6.17-rc5 next-20250910] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Huacai-Chen/LoongArch-Align-A... base: linus/master patch link: https://lore.kernel.org/r/20250910091033.725716-1-chenhuacai%40loongson.cn patch subject: [PATCH V2] LoongArch: Align ACPI structures if ARCH_STRICT_ALIGN enabled config: loongarch-randconfig-001-20250911 (https://download.01.org/0day-ci/archive/20250911/202509110853.ASZKE1gv-lkp@i...) compiler: loongarch64-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250911/202509110853.ASZKE1gv-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202509110853.ASZKE1gv-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/acpi/acpi.h:24, from drivers/acpi/acpica/tbprint.c:10: drivers/acpi/acpica/tbprint.c: In function 'acpi_tb_print_table_header':
include/acpi/actypes.h:530:43: warning: 'strncmp' argument 1 declared attribute 'nonstring' is smaller than the specified bound 8 [-Wstringop-overread]
530 | #define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, (sizeof(a) < 8) ? ACPI_NAMESEG_SIZE : 8)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/acpi/acpica/tbprint.c:105:20: note: in expansion of macro 'ACPI_VALIDATE_RSDP_SIG' 105 | } else if (ACPI_VALIDATE_RSDP_SIG(ACPI_CAST_PTR(struct acpi_table_rsdp, | ^~~~~~~~~~~~~~~~~~~~~~ In file included from include/acpi/acpi.h:26: include/acpi/actbl.h:69:14: note: argument 'signature' declared here 69 | char signature[ACPI_NAMESEG_SIZE] ACPI_NONSTRING; /* ASCII table signature */ | ^~~~~~~~~
vim +530 include/acpi/actypes.h
cacba8657351f7 Lv Zheng 2013-09-23 529 64b9dfd0776e9c Ahmed Salem 2025-04-25 @530 #define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, (sizeof(a) < 8) ? ACPI_NAMESEG_SIZE : 8)) 4fa4616e279df8 Bob Moore 2015-07-01 531 #define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) cacba8657351f7 Lv Zheng 2013-09-23 532
On Thu, Sep 11, 2025 at 9:00 AM kernel test robot lkp@intel.com wrote:
Hi Huacai,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master] [also build test WARNING on v6.17-rc5 next-20250910] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Huacai-Chen/LoongArch-Align-A... base: linus/master patch link: https://lore.kernel.org/r/20250910091033.725716-1-chenhuacai%40loongson.cn patch subject: [PATCH V2] LoongArch: Align ACPI structures if ARCH_STRICT_ALIGN enabled config: loongarch-randconfig-001-20250911 (https://download.01.org/0day-ci/archive/20250911/202509110853.ASZKE1gv-lkp@i...) compiler: loongarch64-linux-gcc (GCC) 15.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250911/202509110853.ASZKE1gv-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202509110853.ASZKE1gv-lkp@intel.com/
This seems like a compiler issue... https://github.com/AOSC-Tracking/linux/commit/1e9ee413357ef58dd902f6ec55013d...
Huacai
All warnings (new ones prefixed by >>):
In file included from include/acpi/acpi.h:24, from drivers/acpi/acpica/tbprint.c:10: drivers/acpi/acpica/tbprint.c: In function 'acpi_tb_print_table_header':
include/acpi/actypes.h:530:43: warning: 'strncmp' argument 1 declared attribute 'nonstring' is smaller than the specified bound 8 [-Wstringop-overread]
530 | #define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, (sizeof(a) < 8) ? ACPI_NAMESEG_SIZE : 8)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/acpi/acpica/tbprint.c:105:20: note: in expansion of macro 'ACPI_VALIDATE_RSDP_SIG' 105 | } else if (ACPI_VALIDATE_RSDP_SIG(ACPI_CAST_PTR(struct acpi_table_rsdp, | ^~~~~~~~~~~~~~~~~~~~~~ In file included from include/acpi/acpi.h:26: include/acpi/actbl.h:69:14: note: argument 'signature' declared here 69 | char signature[ACPI_NAMESEG_SIZE] ACPI_NONSTRING; /* ASCII table signature */ | ^~~~~~~~~
vim +530 include/acpi/actypes.h
cacba8657351f7 Lv Zheng 2013-09-23 529 64b9dfd0776e9c Ahmed Salem 2025-04-25 @530 #define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, (sizeof(a) < 8) ? ACPI_NAMESEG_SIZE : 8)) 4fa4616e279df8 Bob Moore 2015-07-01 531 #define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8)) cacba8657351f7 Lv Zheng 2013-09-23 532
-- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
linux-stable-mirror@lists.linaro.org