Commit dcda487c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull xen fixes from Juergen Gross:

 - A series to fix a regression when running as a fully virtualized
   guest on an old Xen hypervisor not supporting PV interrupt callbacks
   for HVM guests.

 - A patch to add support to query Xen resource sizes (setting was
   possible already) from user mode.

* tag 'for-linus-5.11-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  x86/xen: Fix xen_hvm_smp_init() when vector callback not available
  x86/xen: Don't register Xen IPIs when they aren't going to be used
  x86/xen: Add xen_no_vector_callback option to test PCI INTX delivery
  xen: Set platform PCI device INTX affinity to CPU0
  xen: Fix event channel callback via INTX/GSI
  xen/privcmd: allow fetching resource sizes
parents 7aec71cd 3d7746be
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -5972,6 +5972,10 @@
			This option is obsoleted by the "nopv" option, which
			This option is obsoleted by the "nopv" option, which
			has equivalent effect for XEN platform.
			has equivalent effect for XEN platform.


	xen_no_vector_callback
			[KNL,X86,XEN] Disable the vector callback for Xen
			event channel interrupts.

	xen_scrub_pages=	[XEN]
	xen_scrub_pages=	[XEN]
			Boolean option to control scrubbing pages before giving them back
			Boolean option to control scrubbing pages before giving them back
			to Xen, for use by other domains. Can be also changed at runtime
			to Xen, for use by other domains. Can be also changed at runtime
+1 −1
Original line number Original line Diff line number Diff line
@@ -371,7 +371,7 @@ static int __init xen_guest_init(void)
	}
	}
	gnttab_init();
	gnttab_init();
	if (!xen_initial_domain())
	if (!xen_initial_domain())
		xenbus_probe(NULL);
		xenbus_probe();


	/*
	/*
	 * Making sure board specific code will not set up ops for
	 * Making sure board specific code will not set up ops for
+12 −3
Original line number Original line Diff line number Diff line
@@ -164,10 +164,10 @@ static int xen_cpu_up_prepare_hvm(unsigned int cpu)
	else
	else
		per_cpu(xen_vcpu_id, cpu) = cpu;
		per_cpu(xen_vcpu_id, cpu) = cpu;
	rc = xen_vcpu_setup(cpu);
	rc = xen_vcpu_setup(cpu);
	if (rc)
	if (rc || !xen_have_vector_callback)
		return rc;
		return rc;


	if (xen_have_vector_callback && xen_feature(XENFEAT_hvm_safe_pvclock))
	if (xen_feature(XENFEAT_hvm_safe_pvclock))
		xen_setup_timer(cpu);
		xen_setup_timer(cpu);


	rc = xen_smp_intr_init(cpu);
	rc = xen_smp_intr_init(cpu);
@@ -188,6 +188,8 @@ static int xen_cpu_dead_hvm(unsigned int cpu)
       return 0;
       return 0;
}
}


static bool no_vector_callback __initdata;

static void __init xen_hvm_guest_init(void)
static void __init xen_hvm_guest_init(void)
{
{
	if (xen_pv_domain())
	if (xen_pv_domain())
@@ -207,7 +209,7 @@ static void __init xen_hvm_guest_init(void)


	xen_panic_handler_init();
	xen_panic_handler_init();


	if (xen_feature(XENFEAT_hvm_callback_vector))
	if (!no_vector_callback && xen_feature(XENFEAT_hvm_callback_vector))
		xen_have_vector_callback = 1;
		xen_have_vector_callback = 1;


	xen_hvm_smp_init();
	xen_hvm_smp_init();
@@ -233,6 +235,13 @@ static __init int xen_parse_nopv(char *arg)
}
}
early_param("xen_nopv", xen_parse_nopv);
early_param("xen_nopv", xen_parse_nopv);


static __init int xen_parse_no_vector_callback(char *arg)
{
	no_vector_callback = true;
	return 0;
}
early_param("xen_no_vector_callback", xen_parse_no_vector_callback);

bool __init xen_hvm_need_lapic(void)
bool __init xen_hvm_need_lapic(void)
{
{
	if (xen_pv_domain())
	if (xen_pv_domain())
+17 −10
Original line number Original line Diff line number Diff line
@@ -33,9 +33,11 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
	int cpu;
	int cpu;


	native_smp_prepare_cpus(max_cpus);
	native_smp_prepare_cpus(max_cpus);
	WARN_ON(xen_smp_intr_init(0));


	if (xen_have_vector_callback) {
		WARN_ON(xen_smp_intr_init(0));
		xen_init_lock_cpu(0);
		xen_init_lock_cpu(0);
	}


	for_each_possible_cpu(cpu) {
	for_each_possible_cpu(cpu) {
		if (cpu == 0)
		if (cpu == 0)
@@ -50,11 +52,13 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
static void xen_hvm_cpu_die(unsigned int cpu)
static void xen_hvm_cpu_die(unsigned int cpu)
{
{
	if (common_cpu_die(cpu) == 0) {
	if (common_cpu_die(cpu) == 0) {
		if (xen_have_vector_callback) {
			xen_smp_intr_free(cpu);
			xen_smp_intr_free(cpu);
			xen_uninit_lock_cpu(cpu);
			xen_uninit_lock_cpu(cpu);
			xen_teardown_timer(cpu);
			xen_teardown_timer(cpu);
		}
		}
	}
	}
}
#else
#else
static void xen_hvm_cpu_die(unsigned int cpu)
static void xen_hvm_cpu_die(unsigned int cpu)
{
{
@@ -64,14 +68,17 @@ static void xen_hvm_cpu_die(unsigned int cpu)


void __init xen_hvm_smp_init(void)
void __init xen_hvm_smp_init(void)
{
{
	if (!xen_have_vector_callback)
	smp_ops.smp_prepare_boot_cpu = xen_hvm_smp_prepare_boot_cpu;
	smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
	smp_ops.smp_cpus_done = xen_smp_cpus_done;
	smp_ops.cpu_die = xen_hvm_cpu_die;

	if (!xen_have_vector_callback) {
		nopvspin = true;
		return;
		return;
	}


	smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
	smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
	smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
	smp_ops.cpu_die = xen_hvm_cpu_die;
	smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
	smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi;
	smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi;
	smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi;
	smp_ops.smp_prepare_boot_cpu = xen_hvm_smp_prepare_boot_cpu;
	smp_ops.smp_cpus_done = xen_smp_cpus_done;
}
}
+0 −10
Original line number Original line Diff line number Diff line
@@ -2060,16 +2060,6 @@ static struct irq_chip xen_percpu_chip __read_mostly = {
	.irq_ack		= ack_dynirq,
	.irq_ack		= ack_dynirq,
};
};


int xen_set_callback_via(uint64_t via)
{
	struct xen_hvm_param a;
	a.domid = DOMID_SELF;
	a.index = HVM_PARAM_CALLBACK_IRQ;
	a.value = via;
	return HYPERVISOR_hvm_op(HVMOP_set_param, &a);
}
EXPORT_SYMBOL_GPL(xen_set_callback_via);

#ifdef CONFIG_XEN_PVHVM
#ifdef CONFIG_XEN_PVHVM
/* Vector callbacks are better than PCI interrupts to receive event
/* Vector callbacks are better than PCI interrupts to receive event
 * channel notifications because we can receive vector callbacks on any
 * channel notifications because we can receive vector callbacks on any
Loading