Skip to content

Commit 0eb392e

Browse files
committed
Merge tag 'for-linus-6.3-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross: - cleanup for xen time handling - enable the VGA console in a Xen PVH dom0 - cleanup in the xenfs driver * tag 'for-linus-6.3-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen: remove unnecessary (void*) conversions x86/PVH: obtain VGA console info in Dom0 x86/xen/time: cleanup xen_tsc_safe_clocksource xen: update arch/x86/include/asm/xen/cpuid.h
2 parents cb80b96 + 7ad2c39 commit 0eb392e

File tree

9 files changed

+50
-22
lines changed

9 files changed

+50
-22
lines changed

arch/x86/include/asm/xen/cpuid.h

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,21 @@
8989
* Sub-leaf 2: EAX: host tsc frequency in kHz
9090
*/
9191

92+
#define XEN_CPUID_TSC_EMULATED (1u << 0)
93+
#define XEN_CPUID_HOST_TSC_RELIABLE (1u << 1)
94+
#define XEN_CPUID_RDTSCP_INSTR_AVAIL (1u << 2)
95+
96+
#define XEN_CPUID_TSC_MODE_DEFAULT (0)
97+
#define XEN_CPUID_TSC_MODE_ALWAYS_EMULATE (1u)
98+
#define XEN_CPUID_TSC_MODE_NEVER_EMULATE (2u)
99+
#define XEN_CPUID_TSC_MODE_PVRDTSCP (3u)
100+
92101
/*
93102
* Leaf 5 (0x40000x04)
94103
* HVM-specific features
95104
* Sub-leaf 0: EAX: Features
96105
* Sub-leaf 0: EBX: vcpu id (iff EAX has XEN_HVM_CPUID_VCPU_ID_PRESENT flag)
106+
* Sub-leaf 0: ECX: domain id (iff EAX has XEN_HVM_CPUID_DOMID_PRESENT flag)
97107
*/
98108
#define XEN_HVM_CPUID_APIC_ACCESS_VIRT (1u << 0) /* Virtualized APIC registers */
99109
#define XEN_HVM_CPUID_X2APIC_VIRT (1u << 1) /* Virtualized x2APIC accesses */
@@ -102,12 +112,16 @@
102112
#define XEN_HVM_CPUID_VCPU_ID_PRESENT (1u << 3) /* vcpu id is present in EBX */
103113
#define XEN_HVM_CPUID_DOMID_PRESENT (1u << 4) /* domid is present in ECX */
104114
/*
105-
* Bits 55:49 from the IO-APIC RTE and bits 11:5 from the MSI address can be
106-
* used to store high bits for the Destination ID. This expands the Destination
107-
* ID field from 8 to 15 bits, allowing to target APIC IDs up 32768.
115+
* With interrupt format set to 0 (non-remappable) bits 55:49 from the
116+
* IO-APIC RTE and bits 11:5 from the MSI address can be used to store
117+
* high bits for the Destination ID. This expands the Destination ID
118+
* field from 8 to 15 bits, allowing to target APIC IDs up 32768.
108119
*/
109120
#define XEN_HVM_CPUID_EXT_DEST_ID (1u << 5)
110-
/* Per-vCPU event channel upcalls */
121+
/*
122+
* Per-vCPU event channel upcalls work correctly with physical IRQs
123+
* bound to event channels.
124+
*/
111125
#define XEN_HVM_CPUID_UPCALL_VECTOR (1u << 6)
112126

113127
/*

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
@@ -1390,7 +1390,8 @@ asmlinkage __visible void __init xen_start_kernel(struct start_info *si)
13901390

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

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/time.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <asm/pvclock.h>
2121
#include <asm/xen/hypervisor.h>
2222
#include <asm/xen/hypercall.h>
23+
#include <asm/xen/cpuid.h>
2324

2425
#include <xen/events.h>
2526
#include <xen/features.h>
@@ -503,11 +504,7 @@ static int __init xen_tsc_safe_clocksource(void)
503504
/* Leaf 4, sub-leaf 0 (0x40000x03) */
504505
cpuid_count(xen_cpuid_base() + 3, 0, &eax, &ebx, &ecx, &edx);
505506

506-
/* tsc_mode = no_emulate (2) */
507-
if (ebx != 2)
508-
return 0;
509-
510-
return 1;
507+
return ebx == XEN_CPUID_TSC_MODE_NEVER_EMULATE;
511508
}
512509

513510
static void __init xen_time_init(void)

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

drivers/xen/xenfs/xensyms.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static int xensyms_next_sym(struct xensyms *xs)
6464

6565
static void *xensyms_start(struct seq_file *m, loff_t *pos)
6666
{
67-
struct xensyms *xs = (struct xensyms *)m->private;
67+
struct xensyms *xs = m->private;
6868

6969
xs->op.u.symdata.symnum = *pos;
7070

@@ -76,7 +76,7 @@ static void *xensyms_start(struct seq_file *m, loff_t *pos)
7676

7777
static void *xensyms_next(struct seq_file *m, void *p, loff_t *pos)
7878
{
79-
struct xensyms *xs = (struct xensyms *)m->private;
79+
struct xensyms *xs = m->private;
8080

8181
xs->op.u.symdata.symnum = ++(*pos);
8282

@@ -88,7 +88,7 @@ static void *xensyms_next(struct seq_file *m, void *p, loff_t *pos)
8888

8989
static int xensyms_show(struct seq_file *m, void *p)
9090
{
91-
struct xensyms *xs = (struct xensyms *)m->private;
91+
struct xensyms *xs = m->private;
9292
struct xenpf_symdata *symdata = &xs->op.u.symdata;
9393

9494
seq_printf(m, "%016llx %c %s\n", symdata->address,
@@ -120,7 +120,7 @@ static int xensyms_open(struct inode *inode, struct file *file)
120120
return ret;
121121

122122
m = file->private_data;
123-
xs = (struct xensyms *)m->private;
123+
xs = m->private;
124124

125125
xs->namelen = XEN_KSYM_NAME_LEN + 1;
126126
xs->name = kzalloc(xs->namelen, GFP_KERNEL);
@@ -138,7 +138,7 @@ static int xensyms_open(struct inode *inode, struct file *file)
138138
static int xensyms_release(struct inode *inode, struct file *file)
139139
{
140140
struct seq_file *m = file->private_data;
141-
struct xensyms *xs = (struct xensyms *)m->private;
141+
struct xensyms *xs = m->private;
142142

143143
kfree(xs->name);
144144
return seq_release_private(inode, file);

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)