Skip to content

Commit 4d1ab43

Browse files
jbeulichjgross1
authored andcommitted
xen/x86: generalize preferred console model from PV to PVH Dom0
Without announcing hvc0 as preferred it won't get used as long as tty0 gets registered earlier. This is particularly problematic with there not being any screen output for PVH Dom0 when the screen is in graphics mode, as the necessary information doesn't get conveyed yet from the hypervisor. Follow PV's model, but be conservative and do this for Dom0 only for now. Signed-off-by: Jan Beulich <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Juergen Gross <[email protected]>
1 parent 42bc971 commit 4d1ab43

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

arch/x86/xen/enlighten.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
44
#include <linux/memblock.h>
55
#endif
6+
#include <linux/console.h>
67
#include <linux/cpu.h>
78
#include <linux/kexec.h>
89
#include <linux/slab.h>
@@ -18,6 +19,7 @@
1819
#include <asm/xen/hypervisor.h>
1920
#include <asm/cpu.h>
2021
#include <asm/e820/api.h>
22+
#include <asm/setup.h>
2123

2224
#include "xen-ops.h"
2325
#include "smp.h"
@@ -274,6 +276,16 @@ bool xen_running_on_version_or_later(unsigned int major, unsigned int minor)
274276
return false;
275277
}
276278

279+
void __init xen_add_preferred_consoles(void)
280+
{
281+
add_preferred_console("xenboot", 0, NULL);
282+
if (!boot_params.screen_info.orig_video_isVGA)
283+
add_preferred_console("tty", 0, NULL);
284+
add_preferred_console("hvc", 0, NULL);
285+
if (boot_params.screen_info.orig_video_isVGA)
286+
add_preferred_console("tty", 0, NULL);
287+
}
288+
277289
void xen_reboot(int reason)
278290
{
279291
struct sched_shutdown r = { .reason = reason };

arch/x86/xen/enlighten_pv.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <linux/mm.h>
2929
#include <linux/page-flags.h>
3030
#include <linux/highmem.h>
31-
#include <linux/console.h>
3231
#include <linux/pci.h>
3332
#include <linux/gfp.h>
3433
#include <linux/edd.h>
@@ -1392,12 +1391,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
13921391
#endif
13931392
}
13941393

1395-
add_preferred_console("xenboot", 0, NULL);
1396-
if (!boot_params.screen_info.orig_video_isVGA)
1397-
add_preferred_console("tty", 0, NULL);
1398-
add_preferred_console("hvc", 0, NULL);
1399-
if (boot_params.screen_info.orig_video_isVGA)
1400-
add_preferred_console("tty", 0, NULL);
1394+
xen_add_preferred_consoles();
14011395

14021396
#ifdef CONFIG_PCI
14031397
/* PCI BIOS service won't work from a PV guest. */

arch/x86/xen/enlighten_pvh.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ void __init xen_pvh_init(struct boot_params *boot_params)
3636
pfn = __pa(hypercall_page);
3737
wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
3838

39+
if (xen_initial_domain())
40+
x86_init.oem.arch_setup = xen_add_preferred_consoles;
41+
3942
xen_efi_init(boot_params);
4043
}
4144

arch/x86/xen/xen-ops.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ static inline void __init xen_init_vga(const struct dom0_vga_console_info *info,
118118
}
119119
#endif
120120

121+
void xen_add_preferred_consoles(void);
122+
121123
void __init xen_init_apic(void);
122124

123125
#ifdef CONFIG_XEN_EFI

0 commit comments

Comments
 (0)