Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f688a76
empty commit
Nov 17, 2011
b8c635e
CM11 patch
raden Jan 3, 2014
6f5c057
Faux 3.2 implementation
raden Jan 3, 2014
e38273f
kexec hard-boot patch
raden Jan 4, 2014
27ae6d7
USB Fast Charge
raden Jan 4, 2014
cbcd629
files needed for build
raden Jan 4, 2014
d2a626a
BLX - Battery Life eXtender
raden Jan 4, 2014
e706741
Add Lazy governor
raden Jan 4, 2014
b4702c6
Add Wheatley/Seladang governor
raden Jan 4, 2014
de6586e
Add elementalX governor
raden Jan 4, 2014
e285d23
Merge branch 'kk-4.4.1' of https://github.com/stratosk/kernel_msm int…
raden Jan 9, 2014
b213d82
Merge branch 'master' of https://github.com/stratosk/kernel_msm into …
raden Jan 20, 2014
592a1b4
Merge branch 'kk-4.4.1-dev' of https://github.com/stratosk/kernel_msm…
raden Jan 20, 2014
504bdcc
Merge branch 'kk-4.4.1' of https://github.com/stratosk/kernel_msm int…
Jan 23, 2014
bae6c23
2.0.2 CM11
Jan 23, 2014
83f4039
Merge branch 'semaphore-cm11' of https://github.com/raden/ampang-AOSP…
raden Jan 23, 2014
aeae1fc
Merge branch 'kk-4.4.1' of https://github.com/stratosk/kernel_msm int…
raden Jan 29, 2014
1b3bc26
v2.0.5 build update
raden Jan 29, 2014
e942a33
Merge branch 'kk-4.4.1' of https://github.com/stratosk/kernel_msm int…
raden Feb 12, 2014
3405e6f
Merge branch 'semaphore-cm11' of https://github.com/raden/kernel_msm …
raden Feb 12, 2014
f522828
Merge branch 'kk-4.4.1' of https://github.com/stratosk/kernel_msm int…
raden Apr 1, 2014
aa2285b
Merge branch 'kk-4.4.1' of https://github.com/stratosk/kernel_msm int…
raden Apr 9, 2014
ebae046
[PATCH] FS: import F2FS
raden Apr 9, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2191,6 +2191,32 @@ config ATAGS_PROC
Should the atags used to boot the kernel be exported in an "atags"
file in procfs. Useful with kexec.

config KEXEC_HARDBOOT
bool "Support hard booting to a kexec kernel"
depends on KEXEC
help
Allows hard booting (i.e., with a full hardware reboot) to a kernel
previously loaded in memory by kexec. This works around the problem of
soft-booted kernel hangs due to improper device shutdown and/or
reinitialization. Support is comprised of two components:

First, a "hardboot" flag is added to the kexec syscall to force a hard
reboot in relocate_new_kernel() (which requires machine-specific assembly
code). This also requires the kexec userspace tool to load the kexec'd
kernel in memory region left untouched by the bootloader (i.e., not
explicitly cleared and not overwritten by the boot kernel). Just prior
to reboot, the kexec kernel arguments are stashed in a machine-specific
memory page that must also be preserved. Note that this hardboot page
need not be reserved during regular kernel execution.

Second, the zImage decompresor of the boot (bootloader-loaded) kernel is
modified to check the hardboot page for fresh kexec arguments, and if
present, attempts to jump to the kexec'd kernel preserved in memory.

Note that hardboot support is only required in the boot kernel and any
kernel capable of performing a hardboot kexec. It is _not_ required by a
kexec'd kernel.

config CRASH_DUMP
bool "Build kdump crash kernel (EXPERIMENTAL)"
depends on EXPERIMENTAL
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/boot/compressed/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ restart: adr r0, LC0
dtb_check_done:
#endif

#ifdef CONFIG_KEXEC_HARDBOOT
#include <asm/kexec.h>
#include <asm/memory.h>
#endif

/*
* Check to see if we will overwrite ourselves.
* r4 = final kernel address
Expand Down
8 changes: 8 additions & 0 deletions arch/arm/include/asm/kexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#define KEXEC_ARM_ATAGS_OFFSET 0x1000
#define KEXEC_ARM_ZIMAGE_OFFSET 0x8000

#ifdef CONFIG_KEXEC_HARDBOOT
#define KEXEC_HB_PAGE_MAGIC 0x4a5db007
#endif

#ifndef __ASSEMBLY__

/**
Expand Down Expand Up @@ -53,6 +57,10 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
/* Function pointer to optional machine-specific reinitialization */
extern void (*kexec_reinit)(void);

#ifdef CONFIG_KEXEC_HARDBOOT
extern void (*kexec_hardboot_hook)(void);
#endif

#endif /* __ASSEMBLY__ */

#endif /* CONFIG_KEXEC */
Expand Down
51 changes: 34 additions & 17 deletions arch/arm/kernel/atags.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,45 @@
#include <asm/types.h>
#include <asm/page.h>

/*
* [PATCH] Backport arch/arm/kernel/atags.c from 3.10
*
* There is a bug in older kernels, causing kexec-tools binary to
* only read first 1024 bytes from /proc/atags. I guess the bug is
* somewhere in /fs/proc/, since I don't think the callback in atags.c
* does something wrong. It might affect all procfs files using that
* old read callback instead of fops. Doesn't matter though, since it
* was accidentally fixed when 3.10 removed it.
*
* This might have no particular effect on real devices, because the
* atags _might_ be organized "just right", but it might be very hard
* to track down on a device where it causes problems.
*
*/

struct buffer {
size_t size;
char data[];
};

static int
read_buffer(char* page, char** start, off_t off, int count,
int* eof, void* data)
{
struct buffer *buffer = (struct buffer *)data;

if (off >= buffer->size) {
*eof = 1;
return 0;
}

count = min((int) (buffer->size - off), count);
static struct buffer* atags_buffer = NULL;

memcpy(page, &buffer->data[off], count);

return count;
static ssize_t atags_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
// These are introduced in kernel 3.10. I don't want to backport
// the whole chunk, and other things (ram_console) use static
// variable to keep data too, so I guess it's okay.
//struct buffer *b = PDE_DATA(file_inode(file));
struct buffer *b = atags_buffer;
return simple_read_from_buffer(buf, count, ppos, b->data, b->size);
}

static const struct file_operations atags_fops = {
.read = atags_read,
.llseek = default_llseek,
};

#define BOOT_PARAMS_SIZE 1536
static char __initdata atags_copy[BOOT_PARAMS_SIZE];

Expand Down Expand Up @@ -66,12 +82,13 @@ static int __init init_atags_procfs(void)
b->size = size;
memcpy(b->data, atags_copy, size);

tags_entry = create_proc_read_entry("atags", 0400,
NULL, read_buffer, b);
tags_entry = proc_create_data("atags", 0400, NULL, &atags_fops, b);

if (!tags_entry)
goto nomem;

atags_buffer = b;

return 0;

nomem:
Expand Down
22 changes: 18 additions & 4 deletions arch/arm/kernel/machine_kexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <asm/cacheflush.h>
#include <asm/mach-types.h>
#include <asm/system_misc.h>
#include <asm/mmu_writeable.h>

extern const unsigned char relocate_new_kernel[];
extern const unsigned int relocate_new_kernel_size;
Expand All @@ -22,6 +23,10 @@ extern unsigned long kexec_start_address;
extern unsigned long kexec_indirection_page;
extern unsigned long kexec_mach_type;
extern unsigned long kexec_boot_atags;
#ifdef CONFIG_KEXEC_HARDBOOT
extern unsigned long kexec_hardboot;
void (*kexec_hardboot_hook)(void);
#endif

static atomic_t waiting_for_crash_ipi;

Expand Down Expand Up @@ -120,10 +125,13 @@ void machine_kexec(struct kimage *image)
reboot_code_buffer = page_address(image->control_code_page);

/* Prepare parameters for reboot_code_buffer*/
kexec_start_address = image->start;
kexec_indirection_page = page_list;
kexec_mach_type = machine_arch_type;
kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
mem_text_write_kernel_word(&kexec_start_address, image->start);
mem_text_write_kernel_word(&kexec_indirection_page, page_list);
mem_text_write_kernel_word(&kexec_mach_type, machine_arch_type);
mem_text_write_kernel_word(&kexec_boot_atags, image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET);
#ifdef CONFIG_KEXEC_HARDBOOT
mem_text_write_kernel_word(&kexec_hardboot, image->hardboot);
#endif

/* copy our kernel relocation code to the control code page */
memcpy(reboot_code_buffer,
Expand All @@ -137,5 +145,11 @@ void machine_kexec(struct kimage *image)
if (kexec_reinit)
kexec_reinit();

#ifdef CONFIG_KEXEC_HARDBOOT
/* Run any final machine-specific shutdown code. */
if (image->hardboot && kexec_hardboot_hook)
kexec_hardboot_hook();
#endif

soft_restart(reboot_code_buffer_phys);
}
55 changes: 55 additions & 0 deletions arch/arm/kernel/relocate_kernel.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

#include <asm/kexec.h>

#ifdef CONFIG_KEXEC_HARDBOOT
#include <asm/memory.h>
#if defined(CONFIG_ARCH_TEGRA_2x_SOC) || defined(CONFIG_ARCH_TEGRA_3x_SOC)
#include <mach/iomap.h>
#elif defined(CONFIG_ARCH_APQ8064)
#include <mach/msm_iomap.h>
#endif
#endif

.globl relocate_new_kernel
relocate_new_kernel:

Expand Down Expand Up @@ -52,6 +61,12 @@ relocate_new_kernel:
b 0b

2:
#ifdef CONFIG_KEXEC_HARDBOOT
ldr r0, kexec_hardboot
teq r0, #0
bne hardboot
#endif

/* Jump to relocated kernel */
mov lr,r1
mov r0,#0
Expand All @@ -60,6 +75,40 @@ relocate_new_kernel:
ARM( mov pc, lr )
THUMB( bx lr )

#ifdef CONFIG_KEXEC_HARDBOOT
hardboot:
/* Stash boot arguments in hardboot page:
* 0: KEXEC_HB_PAGE_MAGIC
* 4: kexec_start_address
* 8: kexec_mach_type
* 12: kexec_boot_atags */
ldr r0, =KEXEC_HB_PAGE_ADDR
str r1, [r0, #4]
ldr r1, kexec_mach_type
str r1, [r0, #8]
ldr r1, kexec_boot_atags
str r1, [r0, #12]
ldr r1, =KEXEC_HB_PAGE_MAGIC
str r1, [r0]

#if defined(CONFIG_ARCH_TEGRA_2x_SOC) || defined(CONFIG_ARCH_TEGRA_3x_SOC)
ldr r0, =TEGRA_PMC_BASE
ldr r1, [r0]
orr r1, r1, #0x10
str r1, [r0]
loop: b loop
#elif defined(CONFIG_ARCH_APQ8064)
/* Restart using the PMIC chip, see mach-msm/restart.c */
ldr r0, =APQ8064_TLMM_PHYS
mov r1, #0
str r1, [r0, #0x820] @ PSHOLD_CTL_SU
loop: b loop
#else
#error "No reboot method defined for hardboot."
#endif

.ltorg
#endif
.align

.globl kexec_start_address
Expand All @@ -79,6 +128,12 @@ kexec_mach_type:
kexec_boot_atags:
.long 0x0

#ifdef CONFIG_KEXEC_HARDBOOT
.globl kexec_hardboot
kexec_hardboot:
.long 0x0
#endif

relocate_new_kernel_end:

.globl relocate_new_kernel_size
Expand Down
15 changes: 15 additions & 0 deletions arch/arm/mach-msm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2595,11 +2595,26 @@ config MSM_HSIC_SYSMON_TEST
can be read and written to send character data to the sysmon port of
the modem over USB.


config MSM_CPU_PWRCTL
bool "Ensures that krait droop detectors are always off"
help
Droop detector mechanism can adversely affect krait plls during
stand alone power collapse operation. Selecting this option
ensures that they are always off.

config FORCE_FAST_CHARGE
bool "Force AC charge mode at will"
default y
help
A simple sysfs interface to force adapters that
are detected as USB to charge as AC.

config FORCE_FAST_CHARGE
bool "Force AC charge mode at will"
default y
help
A simple sysfs interface to force adapters that
are detected as USB to charge as AC.

endif
2 changes: 2 additions & 0 deletions arch/arm/mach-msm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,10 @@ obj-$(CONFIG_MSM_HSIC_SYSMON_TEST) += hsic_sysmon_test.o
obj-$(CONFIG_MSM_RPM_SMD) += rpm-smd.o
obj-$(CONFIG_MSM_CPR) += msm_cpr.o
obj-$(CONFIG_MSM_VP_REGULATOR) += msm_vp.o
obj-$(CONFIG_FORCE_FAST_CHARGE) += fastchg.o

ifdef CONFIG_MSM_CPR
obj-$(CONFIG_DEBUG_FS) += msm_cpr-debug.o
endif
obj-$(CONFIG_MSM_CPU_PWRCTL) += msm_cpu_pwrctl.o
obj-$(CONFIG_FORCE_FAST_CHARGE) += fastchg.o
Loading