]>
Commit | Line | Data |
---|---|---|
01460e65 GKH |
1 | From 8894891446c9380709451b99ab45c5c53adfd2fc Mon Sep 17 00:00:00 2001 |
2 | From: Guenter Roeck <linux@roeck-us.net> | |
3 | Date: Tue, 25 Sep 2018 21:06:24 -0700 | |
4 | Subject: of: unittest: Disable interrupt node tests for old world MAC systems | |
5 | ||
6 | From: Guenter Roeck <linux@roeck-us.net> | |
7 | ||
8 | commit 8894891446c9380709451b99ab45c5c53adfd2fc upstream. | |
9 | ||
10 | On systems with OF_IMAP_OLDWORLD_MAC set in of_irq_workarounds, the | |
11 | devicetree interrupt parsing code is different, causing unit tests of | |
12 | devicetree interrupt nodes to fail. Due to a bug in unittest code, which | |
13 | tries to dereference an uninitialized pointer, this results in a crash. | |
14 | ||
15 | OF: /testcase-data/phandle-tests/consumer-a: arguments longer than property | |
16 | Unable to handle kernel paging request for data at address 0x00bc616e | |
17 | Faulting instruction address: 0xc08e9468 | |
18 | Oops: Kernel access of bad area, sig: 11 [#1] | |
19 | BE PREEMPT PowerMac | |
20 | Modules linked in: | |
21 | CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.72-rc1-yocto-standard+ #1 | |
22 | task: cf8e0000 task.stack: cf8da000 | |
23 | NIP: c08e9468 LR: c08ea5bc CTR: c08ea5ac | |
24 | REGS: cf8dbb50 TRAP: 0300 Not tainted (4.14.72-rc1-yocto-standard+) | |
25 | MSR: 00001032 <ME,IR,DR,RI> CR: 82004044 XER: 00000000 | |
26 | DAR: 00bc616e DSISR: 40000000 | |
27 | GPR00: c08ea5bc cf8dbc00 cf8e0000 c13ca517 c13ca517 c13ca8a0 00000066 00000002 | |
28 | GPR08: 00000063 00bc614e c0b05865 000affff 82004048 00000000 c00047f0 00000000 | |
29 | GPR16: c0a80000 c0a9cc34 c13ca517 c0ad1134 05ffffff 000affff c0b05860 c0abeef8 | |
30 | GPR24: cecec278 cecec278 c0a8c4d0 c0a885e0 c13ca8a0 05ffffff c13ca8a0 c13ca517 | |
31 | ||
32 | NIP [c08e9468] device_node_gen_full_name+0x30/0x15c | |
33 | LR [c08ea5bc] device_node_string+0x190/0x3c8 | |
34 | Call Trace: | |
35 | [cf8dbc00] [c007f670] trace_hardirqs_on_caller+0x118/0x1fc (unreliable) | |
36 | [cf8dbc40] [c08ea5bc] device_node_string+0x190/0x3c8 | |
37 | [cf8dbcb0] [c08eb794] pointer+0x25c/0x4d0 | |
38 | [cf8dbd00] [c08ebcbc] vsnprintf+0x2b4/0x5ec | |
39 | [cf8dbd60] [c08ec00c] vscnprintf+0x18/0x48 | |
40 | [cf8dbd70] [c008e268] vprintk_store+0x4c/0x22c | |
41 | [cf8dbda0] [c008ecac] vprintk_emit+0x94/0x130 | |
42 | [cf8dbdd0] [c008ff54] printk+0x5c/0x6c | |
43 | [cf8dbe10] [c0b8ddd4] of_unittest+0x2220/0x26f8 | |
44 | [cf8dbea0] [c0004434] do_one_initcall+0x4c/0x184 | |
45 | [cf8dbf00] [c0b4534c] kernel_init_freeable+0x13c/0x1d8 | |
46 | [cf8dbf30] [c0004814] kernel_init+0x24/0x118 | |
47 | [cf8dbf40] [c0013398] ret_from_kernel_thread+0x5c/0x64 | |
48 | ||
49 | The problem was observed when running a qemu test for the g3beige machine | |
50 | with devicetree unittests enabled. | |
51 | ||
52 | Disable interrupt node tests on affected systems to avoid both false | |
53 | unittest failures and the crash. | |
54 | ||
55 | With this patch in place, unittest on the affected system passes with | |
56 | the following message. | |
57 | ||
58 | dt-test ### end of unittest - 144 passed, 0 failed | |
59 | ||
60 | Fixes: 53a42093d96ef ("of: Add device tree selftests") | |
61 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | |
62 | Reviewed-by: Frank Rowand <frank.rowand@sony.com> | |
63 | Signed-off-by: Rob Herring <robh@kernel.org> | |
64 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
65 | ||
66 | --- | |
67 | drivers/of/unittest.c | 28 +++++++++++++++++++--------- | |
68 | 1 file changed, 19 insertions(+), 9 deletions(-) | |
69 | ||
70 | --- a/drivers/of/unittest.c | |
71 | +++ b/drivers/of/unittest.c | |
72 | @@ -771,6 +771,9 @@ static void __init of_unittest_parse_int | |
73 | struct of_phandle_args args; | |
74 | int i, rc; | |
75 | ||
76 | + if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) | |
77 | + return; | |
78 | + | |
79 | np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); | |
80 | if (!np) { | |
81 | pr_err("missing testcase data\n"); | |
82 | @@ -845,6 +848,9 @@ static void __init of_unittest_parse_int | |
83 | struct of_phandle_args args; | |
84 | int i, rc; | |
85 | ||
86 | + if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) | |
87 | + return; | |
88 | + | |
89 | np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); | |
90 | if (!np) { | |
91 | pr_err("missing testcase data\n"); | |
92 | @@ -1001,15 +1007,19 @@ static void __init of_unittest_platform_ | |
93 | pdev = of_find_device_by_node(np); | |
94 | unittest(pdev, "device 1 creation failed\n"); | |
95 | ||
96 | - irq = platform_get_irq(pdev, 0); | |
97 | - unittest(irq == -EPROBE_DEFER, "device deferred probe failed - %d\n", irq); | |
98 | - | |
99 | - /* Test that a parsing failure does not return -EPROBE_DEFER */ | |
100 | - np = of_find_node_by_path("/testcase-data/testcase-device2"); | |
101 | - pdev = of_find_device_by_node(np); | |
102 | - unittest(pdev, "device 2 creation failed\n"); | |
103 | - irq = platform_get_irq(pdev, 0); | |
104 | - unittest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq); | |
105 | + if (!(of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)) { | |
106 | + irq = platform_get_irq(pdev, 0); | |
107 | + unittest(irq == -EPROBE_DEFER, | |
108 | + "device deferred probe failed - %d\n", irq); | |
109 | + | |
110 | + /* Test that a parsing failure does not return -EPROBE_DEFER */ | |
111 | + np = of_find_node_by_path("/testcase-data/testcase-device2"); | |
112 | + pdev = of_find_device_by_node(np); | |
113 | + unittest(pdev, "device 2 creation failed\n"); | |
114 | + irq = platform_get_irq(pdev, 0); | |
115 | + unittest(irq < 0 && irq != -EPROBE_DEFER, | |
116 | + "device parsing error failed - %d\n", irq); | |
117 | + } | |
118 | ||
119 | np = of_find_node_by_path("/testcase-data/platform-tests"); | |
120 | unittest(np, "No testcase data in device tree\n"); |