From nobody Fri Oct 3 00:01:46 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A0F72D2497 for ; Tue, 9 Sep 2025 09:53:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757411618; cv=none; b=bIzAG3MvocieWWJziXGTiR4aVXrtwCKhyM9XhndXGEAhNW5GWBWT6H3FDB/fSkBTsAsEG77RUFFRE/dw2t1LvotTqUql4sZrbl2rbK/6fDSNsjyWbsC2huUgkZWESVXKnt15mxWiv24N1h3NtLYmzqdR6rhWj9limoHhQ1AT74c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757411618; c=relaxed/simple; bh=ksQPdOeqO/0Gc3J/7druQzRD0/2egKekET/Bt/pJQwo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Kfrj0Ivl6509CIkN5fuemh28JK1MbR2KuIynGkeAVi2Yi+uMi/3+vNVeQ/JSmJRO3WtETmv1QuW9c4jXRoKjyW25AguQsKFY+7q4RoBIT6pmMq6Xe1j767YpQsy2jRcoT2RZi805vamsYsC4e6t+WpEpjoZCwm/Ff+nNIhH0CgU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [223.64.68.89]) by gateway (Coremail) with SMTP id _____8DxLvAe+b9ollIIAA--.17705S3; Tue, 09 Sep 2025 17:53:34 +0800 (CST) Received: from localhost.localdomain (unknown [223.64.68.89]) by front1 (Coremail) with SMTP id qMiowJAxleQZ+b9oHPGJAA--.50983S2; Tue, 09 Sep 2025 17:53:33 +0800 (CST) From: Huacai Chen To: Huacai Chen Cc: loongarch@lists.linux.dev, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, Huacai Chen , Binbin Zhou , Xi Ruoyao Subject: [PATCH] LoongArch: Align ACPI structures if ARCH_STRICT_ALIGN enabled Date: Tue, 9 Sep 2025 17:53:20 +0800 Message-ID: <20250909095320.4083749-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJAxleQZ+b9oHPGJAA--.50983S2 X-CM-SenderInfo: hfkh0x5xdftxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBj93XoW7Cr18CF1rJryxXry7Jr43Arc_yoW8Xr1fpa na9w4DG3yDGr1vkFs2y397XFs8tFZ8GrW3uF40ga45AF18Z347XrWxtr1DGasxWwn7uryx Wrn3tF9rAa45A3cCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j1YL9UUUUU= Content-Type: text/plain; charset="utf-8" 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 Makefile to align ACPI structures if ARCH_STRICT_ALIGN enabled. Reported-by: Binbin Zhou Suggested-by: Xi Ruoyao Signed-off-by: Huacai Chen --- arch/loongarch/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index a3a9759414f4..a86de4f26264 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -147,10 +147,10 @@ ifdef CONFIG_ARCH_STRICT_ALIGN # Don't emit unaligned accesses. # Not all LoongArch cores support unaligned access, and as kernel we can't # rely on others to provide emulation for these accesses. -KBUILD_CFLAGS +=3D $(call cc-option,-mstrict-align) +KBUILD_CFLAGS +=3D $(call cc-option,-mstrict-align) -DACPI_MISALIGNMENT_NO= T_SUPPORTED else # Optimise for performance on hardware supports unaligned access. -KBUILD_CFLAGS +=3D $(call cc-option,-mno-strict-align) +KBUILD_CFLAGS +=3D $(call cc-option,-mno-strict-align) -UACPI_MISALIGNMENT= _NOT_SUPPORTED endif =20 KBUILD_CFLAGS +=3D -isystem $(shell $(CC) -print-file-name=3Dinclude) --=20 2.47.3