Commit 239451e9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-linus-6.3-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen updates from Juergen Gross:

 - help deprecate the /proc/xen files by making the related information
   available via sysfs

 - mark the Xen variants of play_dead "noreturn"

 - support a shared Xen platform interrupt

 - several small cleanups and fixes

* tag 'for-linus-6.3-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen: sysfs: make kobj_type structure constant
  x86/Xen: drop leftover VM-assist uses
  xen: Replace one-element array with flexible-array member
  xen/grant-dma-iommu: Implement a dummy probe_device() callback
  xen/pvcalls-back: fix permanently masked event channel
  xen: Allow platform PCI interrupt to be shared
  x86/xen/time: prefer tsc as clocksource when it is invariant
  x86/xen: mark xen_pv_play_dead() as __noreturn
  x86/xen: don't let xen_pv_play_dead() return
  drivers/xen/hypervisor: Expose Xen SIF flags to userspace
parents b8878e5a 4ecc96cb
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -120,3 +120,16 @@ Contact: xen-devel@lists.xenproject.org
Description:	If running under Xen:
		The Xen version is in the format <major>.<minor><extra>
		This is the <minor> part of it.

What:		/sys/hypervisor/start_flags/*
Date:		March 2023
KernelVersion:	6.3.0
Contact:	xen-devel@lists.xenproject.org
Description:	If running under Xen:
		All bits in Xen's start-flags are represented as
		boolean files, returning '1' if set, '0' otherwise.
		This takes the place of the defunct /proc/xen/capabilities,
		which would contain "control_d" on dom0, and be empty
		otherwise.  This flag is now exposed as "initdomain" in
		addition to the "privileged" flag; all other possible flags
		are accessible as "unknownXX".
+0 −4
Original line number Diff line number Diff line
@@ -934,12 +934,8 @@ void xen_enable_syscall(void)

static void __init xen_pvmmu_arch_setup(void)
{
	HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
	HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);

	HYPERVISOR_vm_assist(VMASST_CMD_enable,
			     VMASST_TYPE_pae_extended_cr3);

	if (register_callback(CALLBACKTYPE_event,
			      xen_asm_exc_xen_hypervisor_callback) ||
	    register_callback(CALLBACKTYPE_failsafe, xen_failsafe_callback))
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ void xen_smp_send_reschedule(int cpu);
void xen_smp_send_call_function_ipi(const struct cpumask *mask);
void xen_smp_send_call_function_single_ipi(int cpu);

void __noreturn xen_cpu_bringup_again(unsigned long stack);

struct xen_common_irq {
	int irq;
	char *name;
+4 −13
Original line number Diff line number Diff line
@@ -381,21 +381,12 @@ static void xen_pv_cpu_die(unsigned int cpu)
	}
}

static void xen_pv_play_dead(void) /* used only with HOTPLUG_CPU */
static void __noreturn xen_pv_play_dead(void) /* used only with HOTPLUG_CPU */
{
	play_dead_common();
	HYPERVISOR_vcpu_op(VCPUOP_down, xen_vcpu_nr(smp_processor_id()), NULL);
	cpu_bringup();
	/*
	 * commit 4b0c0f294 (tick: Cleanup NOHZ per cpu data on cpu down)
	 * clears certain data that the cpu_idle loop (which called us
	 * and that we return from) expects. The only way to get that
	 * data back is to call:
	 */
	tick_nohz_idle_enter();
	tick_nohz_idle_stop_tick_protected();

	cpuhp_online_idle(CPUHP_AP_ONLINE_IDLE);
	xen_cpu_bringup_again((unsigned long)task_pt_regs(current));
	BUG();
}

#else /* !CONFIG_HOTPLUG_CPU */
@@ -409,7 +400,7 @@ static void xen_pv_cpu_die(unsigned int cpu)
	BUG();
}

static void xen_pv_play_dead(void)
static void __noreturn xen_pv_play_dead(void)
{
	BUG();
}
+37 −1
Original line number Diff line number Diff line
@@ -482,15 +482,51 @@ static void xen_setup_vsyscall_time_info(void)
	xen_clocksource.vdso_clock_mode = VDSO_CLOCKMODE_PVCLOCK;
}

/*
 * Check if it is possible to safely use the tsc as a clocksource.  This is
 * only true if the hypervisor notifies the guest that its tsc is invariant,
 * the tsc is stable, and the tsc instruction will never be emulated.
 */
static int __init xen_tsc_safe_clocksource(void)
{
	u32 eax, ebx, ecx, edx;

	if (!(boot_cpu_has(X86_FEATURE_CONSTANT_TSC)))
		return 0;

	if (!(boot_cpu_has(X86_FEATURE_NONSTOP_TSC)))
		return 0;

	if (check_tsc_unstable())
		return 0;

	/* Leaf 4, sub-leaf 0 (0x40000x03) */
	cpuid_count(xen_cpuid_base() + 3, 0, &eax, &ebx, &ecx, &edx);

	/* tsc_mode = no_emulate (2) */
	if (ebx != 2)
		return 0;

	return 1;
}

static void __init xen_time_init(void)
{
	struct pvclock_vcpu_time_info *pvti;
	int cpu = smp_processor_id();
	struct timespec64 tp;

	/* As Dom0 is never moved, no penalty on using TSC there */
	/*
	 * As Dom0 is never moved, no penalty on using TSC there.
	 *
	 * If it is possible for the guest to determine that the tsc is a safe
	 * clocksource, then set xen_clocksource rating below that of the tsc
	 * so that the system prefers tsc instead.
	 */
	if (xen_initial_domain())
		xen_clocksource.rating = 275;
	else if (xen_tsc_safe_clocksource())
		xen_clocksource.rating = 299;

	clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);

Loading