Hi Kevin
+ifdef CONFIG_ARM64 +KBUILD_CFLAGS += -mstrict-align
There are many other drivers that do not use readl/writel for register access, yet none has this workaround... Even those that they are exclusively ARM64.
Have you tried that it's not a buggy version of GCC? At the very least, I'd encourage you to add a brief comment about the problem + setup.
... In general I think one should follow the suggestions from Rob Herring.
Yocto v2.5 aarch64-linaro-linux-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011
Crash Stack: /sprd/drv/dispc/dpu_r2p0.c:729 1796256 ffffff8008486650: f803c043 stur x3, [x2,#60] =>Unhandled fault: alignment fault (0x96000061) at 0xffffff80098b883c
729 reg->mmu_min_ppn1 = 0; 730 reg->mmu_ppn_range1 = 0xffff; 731 reg->mmu_min_ppn2 = 0; 732 reg->mmu_ppn_range2 = 0xffff;
The above C code operation are continuous. The compiler may think that the access can be completed by directly using two 64-bit assignment operations, so it is optimized to 64-bit operation.
What you see is a side-effect of using a sturct for register access. When you ave your code change to use readl()/writel() and friends this is no logner a problem, and you can drop the cc flag.
Sam