Age | Commit message (Collapse) | Author |
|
Add purgatory framework code, no specific implementation, just consistent
with other architectures.
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Simon Horman <horms@kernel.org>
|
|
-mcmodel=large there
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Add option to allow purgatory printing on arm64 hardware
by passing the console name which should be used.
Based on a patch by Geoff Levand.
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Acked-by: Bhupesh Sharma <bhsharma@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Fixes warnings like these when building kexec for powerpc (32 bit):
console-ppc64.c: warning: ‘*((void *)&buff+8)’ may be used uninitialized
Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
As seen in GCC's gcc/config/aarch64/aarch64.c, -fPIC with large
code model is unsupported. This fixes the "sorry, unimplemented"
errors when building with compilers defaulting to -fPIC.
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: David Michael <david.michael@coreos.com>
|
|
Change the default purgatory sha256 code optimization from -O0 to -O2, and add a
new arch specific makefile variable $(ARCH)_PURGATORY_SHA256_CFLAGS which can
over ride this default. Set ia64_PURGATORY_SHA256_CFLAGS to -O0 to retain the
previous optimization level for ia64.
The purgatory sha256 code needs the be built with -O0 for the ia64
architecture. Currently this code is built with -O0 for all architectures,
which slows down the calculations for architectures which could otherwise
use -O2.
On arm64, it takes around 20 second to verify SHA in purgatory when
vmlinuz image is around 13MB and initramfs is around 30M with -O2
enabled. Otherwise, it takes more than 2 minutes.
Cc: Pratyush Anand <panand@redhat.com>
Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Add kexec reboot support for ARM64 platforms.
Signed-off-by: Geoff Levand <geoff@infradead.org>
Tested-By: Pratyush Anand <panand@redhat.com>
Tested-By: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Commit a304e2d82a8c3 ("ppc64: purgatory: Reset primary cpu endian to
big-endian) changed bctr to rfid. rfid is book3s-only and will cause a
fatal exception on book3e.
Purgatory is an isolated environment which makes importing information
about the subarch awkward, so instead rely on the fact that MSR_LE
should never be set on book3e, and the rfid is only needed if MSR_LE is
set (and thus needs to be cleared). In theory that MSR bit is reserved
on book3e, rather than zero, but in practice I have not seen it set.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Reviewed-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Tested-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Older big-endian ppc64 kernels don't include the FIXUP_ENDIAN check,
meaning if we kexec from a little-endian kernel the target kernel will
fail to boot.
Returning to big-endian before we enter the target kernel ensures that
the target kernel can boot whether or not it includes FIXUP_ENDIAN.
This mirrors commit 150b14e7 in kexec-lite.
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This reverts commit 5edcbfd1368e84fce913ceeeca7b712c524dc20d.
Yinghai Lu has reported on the kexec mailing list that this causes
the following problem when using kexec load with kexec built on
openSUSE 13.1 64bit.
overflow in relocation type R_X86_64_32 val 21dffc020
|
|
If the toolchain has these things turned on automatically, then the
purgatory code might be miscompiled leading to runtime errors like:
Unhandled rela relocation: R_X86_64_GOTPC64
It might look like the problem is with the kernel when in reality,
kexec is complaining about the purgatory module. Force off harden
features that don't make sense in kernel space.
Signed-off-by: Mike Frysinger <vapier@chromium.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Summary of changes,
configure.ac: Add test for detect x32 ABI.
purgatory/arch/x86_64/Makefile: Not use mcmodel large when
x32 ABI is set.
kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set
use ELFCLASS32 instead of ELFCLASS64.
kexec/kexec-syscall.h: Add correct syscall number for x32 ABI.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Some Linux distributions would like to turn on the GCC exception handling
by default. As this option introduces symbols in the built code that are
defined in a separate shared library, this is not a good idea to have such
an option activated when building the purgatory.
This patch forces the exception handling to be turned off when building the
purgatory on ppc64 BE and LE.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The purgatory code reads the device tree's version and stores if needed the
currently running CPU number. These 2 values are stored in Big Endian
format in the device tree and should be byte swapped when running in Little
Endian mode.
Without this fix, when running in SMP environment, kexec or kdump kernel may
fail booting with the following message :
Failed to identify boot CPU
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Some Linux distributions, like Suse, are turning on the GCC's stack
protection mechanism by default (-fstack-protector). When building the
purgatory with this option, this leads to link issues that are revealed at
runtime when the purgatory is loaded because symbols like __stack_chk_fail
are unresolved.
This patch forces this stack protection mechanism to be turned off when
building the purgatory on ppc64 BE and LE.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When the kernel is built with CONFIG_PPC_EARLY_DEBUG_OPAL set, it is
expecting to get r8 and r9 filled respectively with OPAL base address and
OPAL entry address (arc/power/head_64.S).
On the new powernv platform, having these 2 registers set allows the kernel
to perform OPAL calls before it parse the device tree.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Tested-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
When building in PPC64 little endian mode, the compiler is now using the
new ABI v2. Among other changes, this new ABI removes the function
descriptors and changes the way the TOC address is computed when entering a
C function.
The purgatory assembly part where the dot symbols are removed, and ELF
relocation code are impacted in this patch.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
RTAS is expecting parameters in Big Endian order so we have to byte swap
them in LE mode.
In the purgatory RTAS calls are only made for debug output.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This patch provides support for the new Power PC litte endian (LE) mode. The
LE mode only differs in the way the instructions and data are stored in memory
thus there is no real need to duplicate the ppc64 code.
However some compilation's options, especially for the purgatory, differ
between little and big endian mode's support. A new "SUBARCH" build variable
is introduced which is currently only used for PPC64 to specify the
endianness.
Another set of changes in this patch is fixing minor endianess issues in the
ppc64 code and fix an alignment issue raised on Power7 little endian mode.
Among these fixes, the check on the kernel binary endianess is removed,
since we can imagine kexecing a LE kernel from a BE environment, as far as
the specified root filesystem and initrd file are containing the right
binaries.
This patch depends on the patch "kexec/ppc64: use common architecture
fs2dt.c file" I sent earlier on the kexec mailing list.
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This file is nowhere referenced, let's get rid of it.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The clgfi instruction needs at least z9 machine level. To allow kexec-tools
compiled also with z900, this patch replaces clgfi with the older cghi
instruction.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Remove kexec/arch/i386/compat_x6_64.S
purgatory/arch/i386/linux-entry16.S and purgatory/arch/i386/entry16.S
Those were early attempts at entry32-16.S that should have been
deleted long ago.
Strip the purgatory code of debug symbols. There is no need to carry
debug symbols we will never use around in /sbin/kexec.
On x86_64 use -mcmodel=large so that the code is built without
any 32bit assumptions. -mcmodel=medium and -mcmodel=small
result int code that has 32bit relocations against variables
that can live anywhere in the address space
Modify the assembly in entry64.S and setup-x86_64.S to use %rip
relative addressing of variables so no relocates are emitted.
Modify entry64-32.S so that it does not have any relocations that can
not be processed when purgatory is loaded above 4G. entry64-32.S
jumps to a 32bit entry point and can not itself be used above 4G so
these changes merely prevent it from being a problem in the other case.
eip is modifed to be a 64bit value of which only the low 32bits are
exported outside of entry64-32.S
The long mode exit code is modified to run with a %cs value whose
base address is the address of the symbol entry32. From there
all of the 32bit code in entry64-32.S can read variables by reading
them through %cs. Until the final jump to the the target address
which is made a far jump reloading %cs and the intstruction pointer.
Modify entry32-16.S and entry32-16-debug.S to be position independent
32bit code. At their start make a short call to push the current value
of %eip on the stack and pop it off. Allowing the calculation of the
address of entry16 which the code has always kept in %ebx.
Update the pointer to the gdt in the gdt so that lgdt will work.
Modify the instructions in entry32-16.S and entry32-16-debug.S so
that the 32bit code uses offsets from %ebx which points at entry16.
Tested-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Recently we faced an issue on power7 machine where kernel hanged in purgatory.
Some investigation revealed that gcc is generating hardware FPU instructions.
I have been told we can't use it at this point of time and as kernel is
compiled with -msoft-float for ppc/ppc64, so should be purgatory (as it runs
inside kernel context).
Thanks to Jakub Jelinek and Lingzhu Xiang for debugging and coming up with
a fix for this issue.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Tested-by: Lingzhu Xiang <lxiang@redhat.com>
Tested-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
commit 46b2d0b8a719 (kexec/powerpc fix optimization for size (gcc -Os)
build) added out of line GPR save/restore handlers for 32bit -Os
builds. This patch adds the handlers for 64bit builds.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Disable backup regions for BookE in case of a CRASH Dump, as they can
be run from anywhere.
The patch introduces --with-booke option to support the BookE.
With the patch, we get :
## On a 256M machine:
# busybox cat /proc/cmdline
init=/bin/init console=ttyS0,16550 crashkernel=128M@100M
# kexec -p root/vmlinux
usable memory rgns size:1 base:6400000 size:8000000
CRASH MEMORY RANGES
0000000000000000-0000000006400000
000000000e400000-0000000010000000
Command line after adding elfcorehdr: elfcorehdr=112380K
Command line after adding elfcorehdr: elfcorehdr=112380K savemaxmem=256M
Signed-off-by: Suzuki K. Poulose<suzuki@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
For s390 we first want to check if kdump checksums are valid before we start
the kdump kernel. With this patch on s390 the purgatory entry point is
called with a parameter. If the parameter is "0", only the checksum test
is done and the result (0 = ok, 1 = invalid) is passed as return code back
to the caller (kernel). If the parameter is "1", the complete purgatory code
is executed and kdump is started.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This patch adds kdump support for s390 to the kexec tool and enables the
"--load-panic" option. When loading the kdump kernel and ramdisk we add the
address of the crashkernel memory to the normal load address.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
PPC32 ELF ABI expects r2 to be loaded with Thread Pointer, which is 0x7000
bytes past the end of TCB. Though the purgatory is single threaded, it uses
TCB scratch space in vsnprintf(). This patch allocates a 1024byte TCB
and populates the TP with the address accordingly.
Changes from V2: Avoid address overflow in TP allocation.
Changes from V1: Fixed the addr calculation for uImage support.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Cc: Ryan S. Arnold <rsa@us.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Currently we hard-coded the first 640K area as backup area,
however, this is not correct on some system which has reserved
memory area in the first 640K:
BIOS-e820: 0000000000010000 - 0000000000097000 (usable)
BIOS-e820: 0000000000097000 - 00000000000a0000 (reserved)
on such system we still mark all the first 640K as usable
in capture kernel, this will cause kernel panic.
The solution, pointed by Vivek, is that we can get the backup
area dynamically by reading /proc/iomem.
The reporter has tested this patch and it fixes the problem.
Signed-off-by: WANG Cong <amwang@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
crt.S patch had fixes for gcc -Os (optimaze for size), same as
kernel has. Without this fixes powerpc gcc 4.4 generates forever
loop functions for kexec.
This happends because crtsavres code was spit up to individual files
(http://gcc.gnu.org/ml/gcc-patches/2008-03/msg01294.html) and
kexec purgatory code has following options:
--no-undefined -nostartfiles -nostdlib -nodefaultlibs
So in that case crtasaveregs function are not defined and final object
file has been linked without them. This does not happen with applications
built without -nostdlib, because gcc will add it's standard functions.
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Acked-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This reverts commit 45e8f29639d9f97b74389e5bd28c7a5cccbf3e2a.
purgatory/arch/ppc/crt.S and purgatory/arch/ppc/misc.S are the same
files.
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Revert the revert patch specially made to remove
45e8f29639d9f97b74389e5bd28c7a5cccbf3e2a commit from git tree.
This reverts commit c42b92cd1f3c6c2e812bd1fcc4203672f3b6d461.
Revert "powerpc new toolchains fix (crt.S)"
This reverts commit 45e8f29639d9f97b74389e5bd28c7a5cccbf3e2a.
purgatory/arch/ppc/crt.S and purgatory/arch/ppc/misc.S are the same
files.
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This reverts commit 45e8f29639d9f97b74389e5bd28c7a5cccbf3e2a.
purgatory/arch/ppc/crt.S and purgatory/arch/ppc/misc.S are the same
files.
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Booting with uImage-ppc was broken by previous work, this
patch should restore it to working order
Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Linker does not provide some vital functions when building freestanding
applications with a new toolchain, so we have to provide our own CRT.
p.s.
Without the CRT we won't see any build errors (since the purgatory is
linked with --no-undefined), but the purgatory code won't work,
'kexec -e' will just hang the board.
I added option to configure to keep code buildable for old toolchais.
But there should be way to do this automatically.
Author: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Maxim Uvarov <muvarov@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Some code dtb scanning & filling has been borrowed from ppc64.
The old behavior is still available if compiled with GameCube,
other PowerPC platform use the can purgatory and specify a new
dtb.
Booting a self contained elf image (incl. dtb / without the need
for a bd sturct or the like) can be booted. The dtb support is currently
optional. That means if the elf image does not contain a dtb file then
the user has to supply a complete dtb (including mem size, command line,
bus freq., mac addr, ...)
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
x86_64 specific support, including crash memory range and purgatory setup.
Corresponding kernel support has been merged already.
Together with the kexec jump features in Linux kernel, kexec jump can
be used for following:
- A simple hibernation implementation without ACPI support. You can
kexec a hibernating kernel, save the memory image of original system
and shutdown the system. When resuming, you restore the memory image
of original system via ordinary kexec load then jump back.
- Kernel/system debug through making system snapshot. You can make
system snapshot with kexec/kdump, jump back, do some thing and make
another system snapshot.
- Cooperative multi-kernel/system. With kexec jump, you can switch
between several kernels/systems quickly without boot process except
the first time. This appears like swap a whole kernel/system out/in.
- A general method to call program in physical mode (paging turning
off). This can be used to invoke BIOS code under Linux.
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Current x86/x86-64 kexec-tools print the message "I'm in purgatory" to serial
console/VGA while executing the purgatory code. Implement this feature for
POWERPC pseries platform by using the H_PUT_TERM_CHAR hypervisor call by
printng to hvc console.
Includes the changes suggested by Michael Ellerman
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The kernel updated its ABI to tell the relocatable kernel to run
where it was loaded.
We now need to set a flag in the kernel image. Since we only have
the kernel image avialable as const data to kexec-tools c code, set
the flag in the copy we put in purgatory, and have it set the flag
in the kernel (after purgatory has run its checksum). To simplfy
the purgatory code we can always copy the flag word back to the
kernel as the c code made a copy of the original flag value.
Signed-off-by: Milton Miller <miltonm@bga.com>
Tested-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
gcc complains because x86_setup_jump_back_entry() has no arguments,
making the argument list void resolves this.
Also, make the function static as it isn't used in any other files.
And move the function above where it is used, to eliminate the
need for a forward-declaration.
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Fix a bug of kexec load on x86_64. Kexec fails to do load on x86_64, with
error message:
Symbol: cmdline_end not found cannot set
Because kexec/arch/i386/kexec-bzImage.c accesses cmdline_end symbol in
i386 purgatory, but there is no cmdline_end in x86_64 purgatory, and
kexec-bzImage.c is used by x86_64 too.
cmdline_end is added into x86_64 purgatory to solve the bug, because kexec
jump support for x86_64 is planned.
Reported-by: Bernhard Walle <bwalle@suse.de>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
To support memory backup/restore an option named
--load-preserve-context is added to kexec. When it is specified
toggether with --mem-max, most segments for crash dump support are
loaded, and the memory range between mem_min to mem_max which has no
segments loaded are loaded as backup segments. To support jump back
from kexeced, options named --load-jump-back-helper and --entry are
added to load a helper image with specified entry to jump back.
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
Relocatable kdump kernel support in kexec-tools
This patch adds relocatable kernel support for kdump in the kexec-tools
code. A signature (0xfeed1234) is passed in r6 from panic code to the
purgatory code through kexec_sequence function. The signature is used to
differentiate between relocatable kdump kernel and non-kdump kernels.
The purgatory code compares the signature and sets the __kdump_flag in
head_64.S by using the offset with respect to next kernel load address.
During the boot up, kernel code checks __kdump_flag and if it is set, the
kernel will behave as relocatable kdump kernel.
Signed-off-by: Mohan Kumar M <mohan@in.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
The EFI Runtime Services Table contains pointers to ia64 function
descriptors. On existing, pre-Tiano, firmware, SetVirtualAddressMap()
converts *all* these pointers from physical to virtual. On Tiano-based
firmware, the pointer to the SetVirtualAddressMap() function descriptor
is not converted, so it remains a physical pointer.
The ia64 kexec purgatory patches the SetVirtualAddressMap() function
descriptor so that when the new kernel calls SetVirtualAddressMap(), it
never reaches firmware. Instead, it calls a dummy function that just
returns success.
Purgatory runs in physical mode, so it must convert the pointer from the
RuntimeServicesTable to a physical address. This patch makes that
conversion work both for old firmware (where the pointer is an identity-
mapped virtual address) and new Tiano firmware (where the pointer is a
physical address).
Without this patch, kexec on Tiano firmware causes an MCA because
ia64_env_setup() subtracts PAGE_OFFSET from a physical address and ends
up with an invalid physical address. Referencing that address causes
the MCA.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
|
|
This patch fixes following compiler warning:
purgatory/arch/i386/console-x86.c:84: \
warning: implicit declaration of function `outb'
purgatory/arch/i386/console-x86.c:89: \
warning: implicit declaration of function `inb'
Found on x86_64. The problem did not happen with i386.
Fix tested on x86_64-suse-linux and i586-suse-linux.
I also added __always_inline__ to make sure that the function gets always
inlined, regardless of optimisation compiler flags.
Signed-off-by: Bernhard Walle <bwalle@suse.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
|