[9610] soc: samsung: cal-if: add volatile keyword to prevent optimization by clang...
authorYoungmin Nam <youngmin.nam@samsung.com>
Thu, 24 May 2018 02:27:08 +0000 (11:27 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:12 +0000 (20:22 +0300)
In the CLANG compiler, "pr_info("  mif grp : %d\n", asv_tbl->mif_asv_group);" makes panic as below.

[    0.000000]  [0:      swapper/0:    0] Unable to handle kernel paging request at virtual address ffffff8008015006
[    0.000000]  [0:      swapper/0:    0] Mem abort info:
[    0.000000]  [0:      swapper/0:    0]   Exception class = DABT (current EL), IL = 32 bits
[    0.000000]  [0:      swapper/0:    0]   SET = 0, FnV = 0
[    0.000000]  [0:      swapper/0:    0]   EA = 0, S1PTW = 0
[    0.000000]  [0:      swapper/0:    0] Data abort info:
[    0.000000]  [0:      swapper/0:    0]   ISV = 0, ISS = 0x00000021
[    0.000000]  [0:      swapper/0:    0]   CM = 0, WnR = 0
[    0.000000]  [0:      swapper/0:    0] swapper pgtable: 4k pages, 39-bit VAs, pgd = ffffff8009af1000
[    0.000000]  [0:      swapper/0:    0] [ffffff8008015006] *pgd=00000008fd7fe003, *pud=00000008fd7fe003, *pmd=00000008fd7fd003, *pte=00e8000010009707
[    0.000000]  [0:      swapper/0:    0] Internal error: Oops: 96000021 [#1] PREEMPT SMP
[    0.000000]  [0:      swapper/0:    0] Modules linked in:
[    0.000000]  [0:      swapper/0:    0] debug-snapshot: item - log_kevents is disabled
[    0.000000]  [0:      swapper/0:    0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.32-34884-g2fc291f958c6 #1
[    0.000000]  [0:      swapper/0:    0] Hardware name: Samsung ERD9610 board based on EXYNOS9610 (DT)
[    0.000000]  [0:      swapper/0:    0] task: ffffff8008fd9380 task.stack: ffffff8008fb0000
[    0.000000]  [0:      swapper/0:    0] PC is at asv_table_init+0xcc/0x1b4
[    0.000000]  [0:      swapper/0:    0] LR is at asv_table_init+0xc0/0x1b4
[    0.000000]  [0:      swapper/0:    0] pc : [<ffffff8008447f30>] lr : [<ffffff8008447f24>] pstate: 604000c5
[    0.000000]  [0:      swapper/0:    0] sp : ffffff8008fb3e20
[    0.000000]  [0:      swapper/0:    0] x29: ffffff8008fb3e40 x28: 0000000080bd0018
[    0.000000]  [0:      swapper/0:    0] x27: 0000000000000000 x26: 0000000000000001
[    0.000000]  [0:      swapper/0:    0] x25: ffffff8008fb3f20 x24: dead000000000100
[    0.000000]  [0:      swapper/0:    0] x23: ffffff8008fb3f20 x22: 0000000000000000
[    0.000000]  [0:      swapper/0:    0] x21: ffffff8009a6d000 x20: ffffff8009125000
[    0.000000]  [0:      swapper/0:    0] x19: 00e8000000000707 x18: 000000000000186a
[    0.000000]  [0:      swapper/0:    0] x17: ffffff8100d020c8 x16: 0000000000000000
[    0.000000]  [0:      swapper/0:    0] x15: 00000000fffffff5 x14: ffffff8009a12000
[    0.000000]  [0:      swapper/0:    0] x13: ffffff8008fd9ca8 x12: 00000000ffffffbf
[    0.000000]  [0:      swapper/0:    0] x11: 0000000000000000 x10: 0000000000000000
[    0.000000]  [0:      swapper/0:    0] x9 : b6a063fd53402b00 x8 : ffffff8008015000
[    0.000000]  [0:      swapper/0:    0] x7 : 0000000000000000 x6 : ffffff80081222f8
[    0.000000]  [0:      swapper/0:    0] x5 : 0000000000000000 x4 : 0000000000000080
[    0.000000]  [0:      swapper/0:    0] x3 : ffffff8008fb3a34 x2 : 0000000000000001
[    0.000000]  [0:      swapper/0:    0] x1 : 0000000000000001 x0 : ffffff8008aeccc2

To resolve this issue, we should add volatile keyword to struct variables.

Change-Id: I6e97594253ef04f7b76365fd685aea09446bbd9f
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
drivers/soc/samsung/cal-if/exynos9610/asv_exynos9610.h

index 75b77b0f7d9a34b44be5575869ad77bc8b04f1f8..2ce52d8384173748a0770eae56757f0477a2d450 100644 (file)
@@ -79,8 +79,8 @@ struct id_tbl_info {
        unsigned reserved_5;
 };
 
-static struct asv_tbl_info *asv_tbl;
-static struct id_tbl_info *id_tbl;
+static volatile struct asv_tbl_info *asv_tbl;
+static volatile struct id_tbl_info *id_tbl;
 
 int asv_get_grp(unsigned int id)
 {