Skip to content

Commit 97076ea

Browse files
committed
Merge tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
Pull hyperv fix from Wei Liu: "One patch from Vitaly to fix reenlightenment notifications" * tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux: x86/hyperv: Properly suspend/resume reenlightenment notifications
2 parents c2b00cb + 38dce41 commit 97076ea

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

arch/x86/hyperv/hv_init.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,18 @@ static int hv_cpu_die(unsigned int cpu)
226226

227227
rdmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl));
228228
if (re_ctrl.target_vp == hv_vp_index[cpu]) {
229-
/* Reassign to some other online CPU */
229+
/*
230+
* Reassign reenlightenment notifications to some other online
231+
* CPU or just disable the feature if there are no online CPUs
232+
* left (happens on hibernation).
233+
*/
230234
new_cpu = cpumask_any_but(cpu_online_mask, cpu);
231235

232-
re_ctrl.target_vp = hv_vp_index[new_cpu];
236+
if (new_cpu < nr_cpu_ids)
237+
re_ctrl.target_vp = hv_vp_index[new_cpu];
238+
else
239+
re_ctrl.enabled = 0;
240+
233241
wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl));
234242
}
235243

@@ -293,6 +301,13 @@ static void hv_resume(void)
293301

294302
hv_hypercall_pg = hv_hypercall_pg_saved;
295303
hv_hypercall_pg_saved = NULL;
304+
305+
/*
306+
* Reenlightenment notifications are disabled by hv_cpu_die(0),
307+
* reenable them here if hv_reenlightenment_cb was previously set.
308+
*/
309+
if (hv_reenlightenment_cb)
310+
set_hv_tscchange_cb(hv_reenlightenment_cb);
296311
}
297312

298313
/* Note: when the ops are called, only CPU0 is online and IRQs are disabled. */

0 commit comments

Comments
 (0)