Skip to content

Commit 0afcf7b

Browse files
konradwilkgregkh
authored andcommitted
xen/bootup: allow {read|write}_cr8 pvops call.
commit 1a7bbda upstream. We actually do not do anything about it. Just return a default value of zero and if the kernel tries to write anything but 0 we BUG_ON. This fixes the case when an user tries to suspend the machine and it blows up in save_processor_state b/c 'read_cr8' is set to NULL and we get: kernel BUG at /home/konrad/ssd/linux/arch/x86/include/asm/paravirt.h:100! invalid opcode: 0000 [#1] SMP Pid: 2687, comm: init.late Tainted: G O 3.6.0upstream-00002-gac264ac-dirty #4 Bochs Bochs RIP: e030:[<ffffffff814d5f42>] [<ffffffff814d5f42>] save_processor_state+0x212/0x270 .. snip.. Call Trace: [<ffffffff810733bf>] do_suspend_lowlevel+0xf/0xac [<ffffffff8107330c>] ? x86_acpi_suspend_lowlevel+0x10c/0x150 [<ffffffff81342ee2>] acpi_suspend_enter+0x57/0xd5 Signed-off-by: Konrad Rzeszutek Wilk <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 95983a8 commit 0afcf7b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

arch/x86/xen/enlighten.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,16 @@ static void xen_write_cr4(unsigned long cr4)
984984

985985
native_write_cr4(cr4);
986986
}
987-
987+
#ifdef CONFIG_X86_64
988+
static inline unsigned long xen_read_cr8(void)
989+
{
990+
return 0;
991+
}
992+
static inline void xen_write_cr8(unsigned long val)
993+
{
994+
BUG_ON(val);
995+
}
996+
#endif
988997
static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
989998
{
990999
int ret;
@@ -1153,6 +1162,11 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
11531162
.read_cr4_safe = native_read_cr4_safe,
11541163
.write_cr4 = xen_write_cr4,
11551164

1165+
#ifdef CONFIG_X86_64
1166+
.read_cr8 = xen_read_cr8,
1167+
.write_cr8 = xen_write_cr8,
1168+
#endif
1169+
11561170
.wbinvd = native_wbinvd,
11571171

11581172
.read_msr = native_read_msr_safe,

0 commit comments

Comments
 (0)