bugs.c (d93618da6b6d453c6a9684a3460ffd51b9b4ef2e) bugs.c (9f2febf3f04daebdaaa5a43cfa20e3844905c0f9)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 1994 Linus Torvalds
4 *
5 * Cyrix stuff, June 1998 by:
6 * - Rafael R. Reilova (moved everything from head.S),
7 * <rreilova@ececs.uc.edu>
8 * - Channing Corn (tests & fixes),

--- 182 unchanged lines hidden (view full) ---

191 * very little benefit for that case.
192 */
193 if (!direct_gbpages)
194 set_memory_4k((unsigned long)__va(0), 1);
195#endif
196}
197
198/*
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 1994 Linus Torvalds
4 *
5 * Cyrix stuff, June 1998 by:
6 * - Rafael R. Reilova (moved everything from head.S),
7 * <rreilova@ececs.uc.edu>
8 * - Channing Corn (tests & fixes),

--- 182 unchanged lines hidden (view full) ---

191 * very little benefit for that case.
192 */
193 if (!direct_gbpages)
194 set_memory_4k((unsigned long)__va(0), 1);
195#endif
196}
197
198/*
199 * NOTE: This function is *only* called for SVM. VMX spec_ctrl handling is
200 * done in vmenter.S.
199 * NOTE: This function is *only* called for SVM, since Intel uses
200 * MSR_IA32_SPEC_CTRL for SSBD.
201 */
202void
203x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest)
204{
201 */
202void
203x86_virt_spec_ctrl(u64 guest_spec_ctrl, u64 guest_virt_spec_ctrl, bool setguest)
204{
205 u64 msrval, guestval = guest_spec_ctrl, hostval = spec_ctrl_current();
205 u64 guestval, hostval;
206 struct thread_info *ti = current_thread_info();
207
206 struct thread_info *ti = current_thread_info();
207
208 if (static_cpu_has(X86_FEATURE_MSR_SPEC_CTRL)) {
209 if (hostval != guestval) {
210 msrval = setguest ? guestval : hostval;
211 wrmsrl(MSR_IA32_SPEC_CTRL, msrval);
212 }
213 }
214
215 /*
216 * If SSBD is not handled in MSR_SPEC_CTRL on AMD, update
217 * MSR_AMD64_L2_CFG or MSR_VIRT_SPEC_CTRL if supported.
218 */
219 if (!static_cpu_has(X86_FEATURE_LS_CFG_SSBD) &&
220 !static_cpu_has(X86_FEATURE_VIRT_SSBD))
221 return;
222

--- 2278 unchanged lines hidden ---
208 /*
209 * If SSBD is not handled in MSR_SPEC_CTRL on AMD, update
210 * MSR_AMD64_L2_CFG or MSR_VIRT_SPEC_CTRL if supported.
211 */
212 if (!static_cpu_has(X86_FEATURE_LS_CFG_SSBD) &&
213 !static_cpu_has(X86_FEATURE_VIRT_SSBD))
214 return;
215

--- 2278 unchanged lines hidden ---