Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5c2aae83 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branch 'acpi-hotplug'

* acpi-hotplug:
  ACPI / memhotplug: Use defined marco METHOD_NAME__STA
  ACPI / hotplug: Use kobject_init_and_add() instead of _init() and _add()
  ACPI / hotplug: Don't set kobject parent pointer explicitly
  ACPI / hotplug: Set kobject name via kobject_add(), not kobject_set_name()
  hotplug, powerpc, x86: Remove cpu_hotplug_driver_lock()
  hotplug / x86: Disable ARCH_CPU_PROBE_RELEASE on x86
  hotplug / x86: Add hotplug lock to missing places
  hotplug / x86: Fix online state in cpu0 debug interface
parents 3fbc4d63 16ff816d
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -844,18 +844,6 @@ void __cpu_die(unsigned int cpu)
		smp_ops->cpu_die(cpu);
}

static DEFINE_MUTEX(powerpc_cpu_hotplug_driver_mutex);

void cpu_hotplug_driver_lock()
{
	mutex_lock(&powerpc_cpu_hotplug_driver_mutex);
}

void cpu_hotplug_driver_unlock()
{
	mutex_unlock(&powerpc_cpu_hotplug_driver_mutex);
}

void cpu_die(void)
{
	if (ppc_md.cpu_die)
+16 −27
Original line number Diff line number Diff line
@@ -404,46 +404,38 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
	unsigned long drc_index;
	int rc;

	cpu_hotplug_driver_lock();
	rc = strict_strtoul(buf, 0, &drc_index);
	if (rc) {
		rc = -EINVAL;
		goto out;
	}
	if (rc)
		return -EINVAL;

	parent = of_find_node_by_path("/cpus");
	if (!parent) {
		rc = -ENODEV;
		goto out;
	}
	if (!parent)
		return -ENODEV;

	dn = dlpar_configure_connector(drc_index, parent);
	if (!dn) {
		rc = -EINVAL;
		goto out;
	}
	if (!dn)
		return -EINVAL;

	of_node_put(parent);

	rc = dlpar_acquire_drc(drc_index);
	if (rc) {
		dlpar_free_cc_nodes(dn);
		rc = -EINVAL;
		goto out;
		return -EINVAL;
	}

	rc = dlpar_attach_node(dn);
	if (rc) {
		dlpar_release_drc(drc_index);
		dlpar_free_cc_nodes(dn);
		goto out;
		return rc;
	}

	rc = dlpar_online_cpu(dn);
out:
	cpu_hotplug_driver_unlock();
	if (rc)
		return rc;

	return rc ? rc : count;
	return count;
}

static int dlpar_offline_cpu(struct device_node *dn)
@@ -516,30 +508,27 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
		return -EINVAL;
	}

	cpu_hotplug_driver_lock();
	rc = dlpar_offline_cpu(dn);
	if (rc) {
		of_node_put(dn);
		rc = -EINVAL;
		goto out;
		return -EINVAL;
	}

	rc = dlpar_release_drc(*drc_index);
	if (rc) {
		of_node_put(dn);
		goto out;
		return rc;
	}

	rc = dlpar_detach_node(dn);
	if (rc) {
		dlpar_acquire_drc(*drc_index);
		goto out;
		return rc;
	}

	of_node_put(dn);
out:
	cpu_hotplug_driver_unlock();
	return rc ? rc : count;

	return count;
}

static int __init pseries_dlpar_init(void)
+0 −4
Original line number Diff line number Diff line
@@ -254,10 +254,6 @@ config ARCH_HWEIGHT_CFLAGS
	default "-fcall-saved-ecx -fcall-saved-edx" if X86_32
	default "-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" if X86_64

config ARCH_CPU_PROBE_RELEASE
	def_bool y
	depends on HOTPLUG_CPU

config ARCH_SUPPORTS_UPROBES
	def_bool y

+0 −21
Original line number Diff line number Diff line
@@ -82,27 +82,6 @@
/* State of each CPU */
DEFINE_PER_CPU(int, cpu_state) = { 0 };

#ifdef CONFIG_HOTPLUG_CPU
/*
 * We need this for trampoline_base protection from concurrent accesses when
 * off- and onlining cores wildly.
 */
static DEFINE_MUTEX(x86_cpu_hotplug_driver_mutex);

void cpu_hotplug_driver_lock(void)
{
	mutex_lock(&x86_cpu_hotplug_driver_mutex);
}

void cpu_hotplug_driver_unlock(void)
{
	mutex_unlock(&x86_cpu_hotplug_driver_mutex);
}

ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; }
ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; }
#endif

/* Number of siblings per CPU package */
int smp_num_siblings = 1;
EXPORT_SYMBOL(smp_num_siblings);
+7 −4
Original line number Diff line number Diff line
@@ -65,29 +65,32 @@ int __ref _debug_hotplug_cpu(int cpu, int action)
	if (!cpu_is_hotpluggable(cpu))
		return -EINVAL;

	cpu_hotplug_driver_lock();
	lock_device_hotplug();

	switch (action) {
	case 0:
		ret = cpu_down(cpu);
		if (!ret) {
			pr_info("CPU %u is now offline\n", cpu);
			dev->offline = true;
			kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
		} else
			pr_debug("Can't offline CPU%d.\n", cpu);
		break;
	case 1:
		ret = cpu_up(cpu);
		if (!ret)
		if (!ret) {
			dev->offline = false;
			kobject_uevent(&dev->kobj, KOBJ_ONLINE);
		else
		} else {
			pr_debug("Can't online CPU%d.\n", cpu);
		}
		break;
	default:
		ret = -EINVAL;
	}

	cpu_hotplug_driver_unlock();
	unlock_device_hotplug();

	return ret;
}
Loading