2007-02-08 15:33:55 +08:00
|
|
|
/*
|
|
|
|
* Copyright 2006 Michael Ellerman, IBM Corporation
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
2011-04-04 11:46:58 +08:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
|
2007-02-08 15:33:55 +08:00
|
|
|
#include <asm/machdep.h>
|
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/firmware.h>
|
|
|
|
#include <asm/kexec.h>
|
2011-04-04 11:46:58 +08:00
|
|
|
#include <asm/xics.h>
|
2007-05-10 20:17:18 +08:00
|
|
|
#include <asm/smp.h>
|
2013-08-22 17:53:52 +08:00
|
|
|
#include <asm/plpar_wrappers.h>
|
2007-02-08 15:33:55 +08:00
|
|
|
|
|
|
|
#include "pseries.h"
|
|
|
|
|
2016-05-30 14:18:13 +08:00
|
|
|
void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
|
2007-02-08 15:33:55 +08:00
|
|
|
{
|
|
|
|
/* Don't risk a hypervisor call if we're crashing */
|
|
|
|
if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
|
2011-07-25 09:46:32 +08:00
|
|
|
int ret;
|
2011-07-25 09:46:34 +08:00
|
|
|
int cpu = smp_processor_id();
|
|
|
|
int hwcpu = hard_smp_processor_id();
|
2011-07-25 09:46:32 +08:00
|
|
|
|
|
|
|
if (get_lppaca()->dtl_enable_mask) {
|
2011-07-25 09:46:34 +08:00
|
|
|
ret = unregister_dtl(hwcpu);
|
2011-07-25 09:46:32 +08:00
|
|
|
if (ret) {
|
|
|
|
pr_err("WARNING: DTL deregistration for cpu "
|
|
|
|
"%d (hw %d) failed with %d\n",
|
2011-07-25 09:46:34 +08:00
|
|
|
cpu, hwcpu, ret);
|
2011-07-25 09:46:32 +08:00
|
|
|
}
|
|
|
|
}
|
2007-02-08 15:33:55 +08:00
|
|
|
|
2011-07-25 09:46:34 +08:00
|
|
|
ret = unregister_slb_shadow(hwcpu);
|
2011-07-25 09:46:33 +08:00
|
|
|
if (ret) {
|
|
|
|
pr_err("WARNING: SLB shadow buffer deregistration "
|
|
|
|
"for cpu %d (hw %d) failed with %d\n",
|
2011-07-25 09:46:34 +08:00
|
|
|
cpu, hwcpu, ret);
|
2011-07-25 09:46:33 +08:00
|
|
|
}
|
2007-02-08 15:33:55 +08:00
|
|
|
|
2011-07-25 09:46:34 +08:00
|
|
|
ret = unregister_vpa(hwcpu);
|
2011-07-25 09:46:33 +08:00
|
|
|
if (ret) {
|
|
|
|
pr_err("WARNING: VPA deregistration for cpu %d "
|
2011-07-25 09:46:34 +08:00
|
|
|
"(hw %d) failed with %d\n", cpu, hwcpu, ret);
|
2007-02-08 15:33:55 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-07 04:37:31 +08:00
|
|
|
xics_kexec_teardown_cpu(secondary);
|
2007-02-08 15:33:55 +08:00
|
|
|
}
|