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

Commit 598c8231 authored by Anton Blanchard's avatar Anton Blanchard Committed by Benjamin Herrenschmidt
Browse files

powerpc/pseries: Simplify vpa deregistration functions



The VPA, SLB shadow and DTL degistration functions do not need an
address, so simplify things and remove it.

Also cleanup pseries_kexec_cpu_down a bit by storing the cpu IDs
in local variables.

Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 711ef84e
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -135,7 +135,7 @@ static void pseries_mach_cpu_die(void)
		get_lppaca()->idle = 0;
		get_lppaca()->idle = 0;


		if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
		if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
			unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
			unregister_slb_shadow(hwcpu);


			/*
			/*
			 * Call to start_secondary_resume() will not return.
			 * Call to start_secondary_resume() will not return.
@@ -150,7 +150,7 @@ static void pseries_mach_cpu_die(void)
	WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE);
	WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE);


	set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
	set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
	unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
	unregister_slb_shadow(hwcpu);
	rtas_stop_self();
	rtas_stop_self();


	/* Should never get here... */
	/* Should never get here... */
+8 −12
Original line number Original line Diff line number Diff line
@@ -25,34 +25,30 @@ static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
{
{
	/* Don't risk a hypervisor call if we're crashing */
	/* Don't risk a hypervisor call if we're crashing */
	if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
	if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
		unsigned long addr;
		int ret;
		int ret;
		int cpu = smp_processor_id();
		int hwcpu = hard_smp_processor_id();


		if (get_lppaca()->dtl_enable_mask) {
		if (get_lppaca()->dtl_enable_mask) {
			ret = unregister_dtl(hard_smp_processor_id());
			ret = unregister_dtl(hwcpu);
			if (ret) {
			if (ret) {
				pr_err("WARNING: DTL deregistration for cpu "
				pr_err("WARNING: DTL deregistration for cpu "
				       "%d (hw %d) failed with %d\n",
				       "%d (hw %d) failed with %d\n",
				       smp_processor_id(),
				       cpu, hwcpu, ret);
				       hard_smp_processor_id(), ret);
			}
			}
		}
		}


		addr = __pa(get_slb_shadow());
		ret = unregister_slb_shadow(hwcpu);
		ret = unregister_slb_shadow(hard_smp_processor_id(), addr);
		if (ret) {
		if (ret) {
			pr_err("WARNING: SLB shadow buffer deregistration "
			pr_err("WARNING: SLB shadow buffer deregistration "
			       "for cpu %d (hw %d) failed with %d\n",
			       "for cpu %d (hw %d) failed with %d\n",
			       smp_processor_id(),
			       cpu, hwcpu, ret);
			       hard_smp_processor_id(), ret);
		}
		}


		addr = __pa(get_lppaca());
		ret = unregister_vpa(hwcpu);
		ret = unregister_vpa(hard_smp_processor_id(), addr);
		if (ret) {
		if (ret) {
			pr_err("WARNING: VPA deregistration for cpu %d "
			pr_err("WARNING: VPA deregistration for cpu %d "
			       "(hw %d) failed with %d\n", smp_processor_id(),
			       "(hw %d) failed with %d\n", cpu, hwcpu, ret);
			       hard_smp_processor_id(), ret);
		}
		}
	}
	}
}
}
+4 −4
Original line number Original line Diff line number Diff line
@@ -53,9 +53,9 @@ static inline long vpa_call(unsigned long flags, unsigned long cpu,
	return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
	return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
}
}


static inline long unregister_vpa(unsigned long cpu, unsigned long vpa)
static inline long unregister_vpa(unsigned long cpu)
{
{
	return vpa_call(0x5, cpu, vpa);
	return vpa_call(0x5, cpu, 0);
}
}


static inline long register_vpa(unsigned long cpu, unsigned long vpa)
static inline long register_vpa(unsigned long cpu, unsigned long vpa)
@@ -63,9 +63,9 @@ static inline long register_vpa(unsigned long cpu, unsigned long vpa)
	return vpa_call(0x1, cpu, vpa);
	return vpa_call(0x1, cpu, vpa);
}
}


static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa)
static inline long unregister_slb_shadow(unsigned long cpu)
{
{
	return vpa_call(0x7, cpu, vpa);
	return vpa_call(0x7, cpu, 0);
}
}


static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)