aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2018-07-14 18:14:02 -0400
committerOlof Johansson <olof@lixom.net>2018-07-14 18:14:02 -0400
commit13e66ceea1600f1061181acc2d4e0fac1a7d0333 (patch)
treeb0372e59ae22ca653c7453f7742fe46bdac2fd57
parentd4f72a70fed01040e56be505a51443bd894b11d9 (diff)
parent923847413f7316b5ced3491769b3fefa6c56a79a (diff)
Merge tag 'omap-for-v4.18/fixes-rc4-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into fixes
Two omap fixes for v4.18-rc cycle Turns out the recent patches for ARM branch predictor hardening are not working on omap5 and dra7 as planned because the secondary CPU is parked to the bootrom code. We can't configure it in the bootloader. So we must enable invalidates of BTB for omap5 and dra7 secondary core in the kernel. And there's a fix for reserved register access for am3517. The usb otg module on am3517 is not the same as for other omap3. * tag 'omap-for-v4.18/fixes-rc4-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: dts: am3517.dtsi: Disable reference to OMAP3 OTG controller ARM: DRA7/OMAP5: Enable ACTLR[0] (Enable invalidates of BTB) for secondary cores Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--arch/arm/boot/dts/am3517.dtsi5
-rw-r--r--arch/arm/mach-omap2/omap-smp.c41
2 files changed, 46 insertions, 0 deletions
diff --git a/arch/arm/boot/dts/am3517.dtsi b/arch/arm/boot/dts/am3517.dtsi
index 4b6062b631b1..23ea381d363f 100644
--- a/arch/arm/boot/dts/am3517.dtsi
+++ b/arch/arm/boot/dts/am3517.dtsi
@@ -91,6 +91,11 @@
91 }; 91 };
92}; 92};
93 93
94/* Table Table 5-79 of the TRM shows 480ab000 is reserved */
95&usb_otg_hs {
96 status = "disabled";
97};
98
94&iva { 99&iva {
95 status = "disabled"; 100 status = "disabled";
96}; 101};
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 69df3620eca5..1c73694c871a 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -109,6 +109,45 @@ void omap5_erratum_workaround_801819(void)
109static inline void omap5_erratum_workaround_801819(void) { } 109static inline void omap5_erratum_workaround_801819(void) { }
110#endif 110#endif
111 111
112#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
113/*
114 * Configure ACR and enable ACTLR[0] (Enable invalidates of BTB with
115 * ICIALLU) to activate the workaround for secondary Core.
116 * NOTE: it is assumed that the primary core's configuration is done
117 * by the boot loader (kernel will detect a misconfiguration and complain
118 * if this is not done).
119 *
120 * In General Purpose(GP) devices, ACR bit settings can only be done
121 * by ROM code in "secure world" using the smc call and there is no
122 * option to update the "firmware" on such devices. This also works for
123 * High security(HS) devices, as a backup option in case the
124 * "update" is not done in the "security firmware".
125 */
126static void omap5_secondary_harden_predictor(void)
127{
128 u32 acr, acr_mask;
129
130 asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
131
132 /*
133 * ACTLR[0] (Enable invalidates of BTB with ICIALLU)
134 */
135 acr_mask = BIT(0);
136
137 /* Do we already have it done.. if yes, skip expensive smc */
138 if ((acr & acr_mask) == acr_mask)
139 return;
140
141 acr |= acr_mask;
142 omap_smc1(OMAP5_DRA7_MON_SET_ACR_INDEX, acr);
143
144 pr_debug("%s: ARM ACR setup for CVE_2017_5715 applied on CPU%d\n",
145 __func__, smp_processor_id());
146}
147#else
148static inline void omap5_secondary_harden_predictor(void) { }
149#endif
150
112static void omap4_secondary_init(unsigned int cpu) 151static void omap4_secondary_init(unsigned int cpu)
113{ 152{
114 /* 153 /*
@@ -131,6 +170,8 @@ static void omap4_secondary_init(unsigned int cpu)
131 set_cntfreq(); 170 set_cntfreq();
132 /* Configure ACR to disable streaming WA for 801819 */ 171 /* Configure ACR to disable streaming WA for 801819 */
133 omap5_erratum_workaround_801819(); 172 omap5_erratum_workaround_801819();
173 /* Enable ACR to allow for ICUALLU workaround */
174 omap5_secondary_harden_predictor();
134 } 175 }
135 176
136 /* 177 /*