Skip to content

Commit 934ef33

Browse files
jbeulichjgross1
authored andcommitted
x86/PVH: obtain VGA console info in Dom0
A new platform-op was added to Xen to allow obtaining the same VGA console information PV Dom0 is handed. Invoke the new function and have the output data processed by xen_init_vga(). 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 99a7bca commit 934ef33

File tree

6 files changed

+25
-8
lines changed

6 files changed

+25
-8
lines changed

arch/x86/xen/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
4545

4646
obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o
4747

48-
obj-$(CONFIG_XEN_PV_DOM0) += vga.o
48+
obj-$(CONFIG_XEN_DOM0) += vga.o
4949

5050
obj-$(CONFIG_XEN_EFI) += efi.o

arch/x86/xen/enlighten_pv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,8 @@ asmlinkage __visible void __init xen_start_kernel(struct start_info *si)
13891389

13901390
x86_platform.set_legacy_features =
13911391
xen_dom0_set_legacy_features;
1392-
xen_init_vga(info, xen_start_info->console.dom0.info_size);
1392+
xen_init_vga(info, xen_start_info->console.dom0.info_size,
1393+
&boot_params.screen_info);
13931394
xen_start_info->console.domU.mfn = 0;
13941395
xen_start_info->console.domU.evtchn = 0;
13951396

arch/x86/xen/enlighten_pvh.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ void __init xen_pvh_init(struct boot_params *boot_params)
4343
x86_init.oem.banner = xen_banner;
4444

4545
xen_efi_init(boot_params);
46+
47+
if (xen_initial_domain()) {
48+
struct xen_platform_op op = {
49+
.cmd = XENPF_get_dom0_console,
50+
};
51+
long ret = HYPERVISOR_platform_op(&op);
52+
53+
if (ret > 0)
54+
xen_init_vga(&op.u.dom0_console,
55+
min(ret * sizeof(char),
56+
sizeof(op.u.dom0_console)),
57+
&boot_params->screen_info);
58+
}
4659
}
4760

4861
void __init mem_map_via_hcall(struct boot_params *boot_params_p)

arch/x86/xen/vga.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
#include "xen-ops.h"
1111

12-
void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size)
12+
void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size,
13+
struct screen_info *screen_info)
1314
{
14-
struct screen_info *screen_info = &boot_params.screen_info;
15-
1615
/* This is drawn from a dump from vgacon:startup in
1716
* standard Linux. */
1817
screen_info->orig_video_mode = 3;

arch/x86/xen/xen-ops.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ static inline void xen_uninit_lock_cpu(int cpu)
108108

109109
struct dom0_vga_console_info;
110110

111-
#ifdef CONFIG_XEN_PV_DOM0
112-
void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size);
111+
#ifdef CONFIG_XEN_DOM0
112+
void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size,
113+
struct screen_info *);
113114
#else
114115
static inline void __init xen_init_vga(const struct dom0_vga_console_info *info,
115-
size_t size)
116+
size_t size, struct screen_info *si)
116117
{
117118
}
118119
#endif

include/xen/interface/platform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,8 @@ struct xenpf_symdata {
483483
};
484484
DEFINE_GUEST_HANDLE_STRUCT(xenpf_symdata);
485485

486+
#define XENPF_get_dom0_console 64
487+
486488
struct xen_platform_op {
487489
uint32_t cmd;
488490
uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -506,6 +508,7 @@ struct xen_platform_op {
506508
struct xenpf_mem_hotadd mem_add;
507509
struct xenpf_core_parking core_parking;
508510
struct xenpf_symdata symdata;
511+
struct dom0_vga_console_info dom0_console;
509512
uint8_t pad[128];
510513
} u;
511514
};

0 commit comments

Comments
 (0)