Initial commit, long overdue

This commit is contained in:
Tad 2016-12-21 19:30:02 -05:00
commit c0083c1519
292 changed files with 951990 additions and 0 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,60 @@
From bfc6684c6065c7c3ce5d8ef2e33d8d9f4a0e9f78 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Tue, 26 May 2015 14:26:28 -0400
Subject: [PATCH] Fix build failure
---
kernel/time/alarmtimer.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index d01409f..beddafa 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -727,9 +727,6 @@ static int alarm_timer_create(struct k_itimer *new_timer)
if (!alarmtimer_get_rtcdev())
return -ENOTSUPP;
- if (flags & ~TIMER_ABSTIME)
- return -EINVAL;
-
if (!capable(CAP_WAKE_ALARM))
return -EPERM;
@@ -744,22 +741,18 @@ static int alarm_timer_create(struct k_itimer *new_timer)
* @new_timer: k_itimer pointer
* @cur_setting: itimerspec data to fill
*
- * Copies out the current itimerspec data
+ * Copies the itimerspec data out from the k_itimer
*/
static void alarm_timer_get(struct k_itimer *timr,
struct itimerspec *cur_setting)
{
- ktime_t relative_expiry_time =
- alarm_expires_remaining(&(timr->it.alarm.alarmtimer));
+ memset(cur_setting, 0, sizeof(struct itimerspec));
- if (ktime_to_ns(relative_expiry_time) > 0) {
- cur_setting->it_value = ktime_to_timespec(relative_expiry_time);
- } else {
- cur_setting->it_value.tv_sec = 0;
- cur_setting->it_value.tv_nsec = 0;
- }
-
- cur_setting->it_interval = ktime_to_timespec(timr->it.alarm.interval);
+ cur_setting->it_interval =
+ ktime_to_timespec(timr->it.alarm.interval);
+ cur_setting->it_value =
+ ktime_to_timespec(timr->it.alarm.alarmtimer.node.expires);
+ return;
}
/**
@@ -1066,4 +1059,4 @@ static int __init alarmtimer_init(void)
alarmtimer_rtc_interface_remove();
return error;
}
-device_initcall(alarmtimer_init);
+device_initcall(alarmtimer_init);
\ No newline at end of file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,35 @@
From b332cc3cd48e38b8beb9c6b5a1002ff4c44caa10 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Tue, 26 May 2015 20:56:40 -0400
Subject: [PATCH] F2FS Support
---
include/linux/fs.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d2cfc25..a5fb99d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -332,6 +332,7 @@ struct inodes_stat_t {
#define FIFREEZE _IOWR('X', 119, int) /* Freeze */
#define FITHAW _IOWR('X', 120, int) /* Thaw */
#define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */
+#define FS_IOC_SHUTDOWN _IOR('X', 125, __u32) /* Shutdown */
#define FIDTRIM _IOWR('f', 128, struct fstrim_range) /* Deep discard trim */
@@ -382,6 +383,13 @@ struct inodes_stat_t {
#define SYNC_FILE_RANGE_WRITE 2
#define SYNC_FILE_RANGE_WAIT_AFTER 4
+/*
+ * Flags for going down operation used by FS_IOC_GOINGDOWN
+ */
+#define FS_GOING_DOWN_FULLSYNC 0x0 /* going down with full sync */
+#define FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */
+#define FS_GOING_DOWN_NOSYNC 0x2 /* going down */
+
#ifdef __KERNEL__
#include <linux/linkage.h>

View file

@ -0,0 +1,27 @@
From b7e34e5b5ef15124c80e0e5a374b44222e43c6d1 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Tue, 26 May 2015 20:58:59 -0400
Subject: [PATCH] defconfig: enable f2fs
---
arch/arm/configs/cyanogenmod_bacon_defconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/configs/cyanogenmod_bacon_defconfig b/arch/arm/configs/cyanogenmod_bacon_defconfig
index fdf8db0..1fb7df9 100644
--- a/arch/arm/configs/cyanogenmod_bacon_defconfig
+++ b/arch/arm/configs/cyanogenmod_bacon_defconfig
@@ -3252,11 +3252,12 @@ CONFIG_ECRYPT_FS=y
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
CONFIG_F2FS_FS=y
-CONFIG_F2FS_STAT_FS=y
+# CONFIG_F2FS_STAT_FS is not set
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y
# CONFIG_F2FS_CHECK_FS is not set
+CONFIG_F2FS_IO_TRACE=y
CONFIG_NETWORK_FILESYSTEMS=y
# CONFIG_NFS_FS is not set
# CONFIG_NFSD is not set

View file

@ -0,0 +1,618 @@
From af5ef3d76f863f02c51cf860702b01536620ebf5 Mon Sep 17 00:00:00 2001
From: KINGbabasula <kingbabasula@gmail.com>
Date: Fri, 6 Mar 2015 11:23:25 +0100
Subject: [PATCH] [PATCH] Implement kexec-hardboot
"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."
More info in /arch/arm/Kconfig.
Original author: Mike Kasick <mike@kasick.org>
Vojtech Bocek <vbocek@gmail.com>:
I've ported it to hammerhead, it is based of my mako/grouper port, which is
based of Asus TF201 patch ported by Jens Andersen <jens.andersen@gmail.com>
Hammerhead is the first device I've ported this patch to which uses
device tree binary instead of atags. It is also rather picky - its
bootloader erases first 128MB of RAM on reboot, so following hacks had
to be applied:
* Copy dtb to location passed in r2 before jumping to kexecd' kernel,
the kernel would just freeze when I left dtb above 128MB of RAM.
* Copy kexecd' kernel to location in the first 128MB before jumping to it,
the decompressor operates very slowly if the kernel is above the cached
area, copying it lower and decompressing it afterwards is much faster.
Same as my mako/flo patches, the guest kernel does not require any
modifications, kexec-hardboot is equivalent to standard kexec.
To support dtb, following commit was backported from the mainline:
commit 4cabd1d9625c7d88acd143f4021fbef75394f154
Author: Matthew Leach <matthew.leach@arm.com>
Date: Fri Sep 21 18:56:02 2012 +0100
ARM: 7539/1: kexec: scan for dtb magic in segments
This patch allows a dtb to be passed to a new kernel using the kexec
mechinism.
When loading segments from userspace, scan each segment's first four
bytes for the dtb magic. If this is found set the kexec_boot_atags
parameter to the relocate_kernel code to the phyical address of this
segment.
Davide Pianca <kingbabasula@gmail.com>:
Ported from https://gist.github.com/Tasssadar/7833796
Adapted for bacon
---
arch/arm/Kconfig | 26 ++++++++++
arch/arm/boot/compressed/head.S | 63 +++++++++++++++++++++++
arch/arm/configs/cyanogenmod_bacon_defconfig | 6 ++-
arch/arm/include/asm/kexec.h | 8 +++
arch/arm/kernel/machine_kexec.c | 58 +++++++++++++++++++--
arch/arm/kernel/relocate_kernel.S | 75 ++++++++++++++++++++++++++++
arch/arm/mach-msm/include/mach/memory.h | 16 ++++++
arch/arm/mach-msm/oppo/board-8974-oppo.c | 27 ++++++++++
arch/arm/mach-msm/restart.c | 28 +++++++++++
include/linux/kexec.h | 19 +++++--
kernel/kexec.c | 4 ++
11 files changed, 321 insertions(+), 9 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index eb5c3fe..057b9eb 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2283,6 +2283,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
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 64a6d6f..29e8a3a 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -10,6 +10,11 @@
*/
#include <linux/linkage.h>
+#ifdef CONFIG_KEXEC_HARDBOOT
+ #include <asm/kexec.h>
+ #include <asm/memory.h>
+#endif
+
/*
* Debugging stuff
*
@@ -135,6 +140,64 @@ start:
1: mov r7, r1 @ save architecture ID
mov r8, r2 @ save atags pointer
+#ifdef CONFIG_KEXEC_HARDBOOT
+ /* Check hardboot page for a kexec kernel. */
+ ldr r3, =KEXEC_HB_PAGE_ADDR
+ ldr r0, [r3]
+ ldr r1, =KEXEC_HB_PAGE_MAGIC
+ teq r0, r1
+ bne not_booting_other
+
+ /* Clear hardboot page magic to avoid boot loop. */
+ mov r0, #0
+ str r0, [r3]
+
+ /*
+ * Copy dtb from location up high in memory to default location.
+ * Kernel freezes if this is not done.
+ */
+ ldr r1, [r3, #12] @ kexec_boot_atags
+ ldr r2, [r3, #16] @ kexec_boot_atags_len
+ mov r5, #0 @ iterator
+catags_cpy:
+ ldr r0, [r1, r5] @ from kexec_boot_atags
+ str r0, [r8, r5] @ to atags_pointer
+ add r5, r5, #4
+ cmp r5, r2
+ blo catags_cpy
+
+#ifdef KEXEC_HB_KERNEL_LOC
+ /*
+ * Copy kernel from location up high in memory to location in first 128MB.
+ * Bootloader on hammerhead erases first 128MB of ram on reboot, so it can't
+ * be in there before reboot, but decompressing in location above 128MB takes
+ * a long time. This memcpy is much quicker, for some reason.
+ */
+ ldr r2, [r3, #4] @ kexec_start_address
+ ldr r4, [r3, #20] @ kexec_kernel_len
+ ldr r6, =KEXEC_HB_KERNEL_LOC @ target
+ mov r5, #0 @ iterator
+kernel_cpy:
+ ldr r0, [r2, r5] @ from kexec_start_address
+ str r0, [r6, r5] @ to KEXEC_HB_KERNEL_LOC
+ add r5, r5, #4
+ cmp r5, r4
+ blo kernel_cpy
+#else
+ ldr r6, [r3, #4] @ kexec_start_address
+#endif
+
+ /* set registers and boot kexecd' kernel */
+ mov r0, #0
+ ldr r1, [r3, #8] @ kexec_mach_type
+ mov r2, r8 @ atags pointer
+ mov pc, r6
+
+ .ltorg
+
+not_booting_other:
+#endif
+
#ifndef __ARM_ARCH_2__
/*
* Booting from Angel - need to enter SVC mode and disable
diff --git a/arch/arm/configs/cyanogenmod_bacon_defconfig b/arch/arm/configs/cyanogenmod_bacon_defconfig
index 625a29c..929e914 100644
--- a/arch/arm/configs/cyanogenmod_bacon_defconfig
+++ b/arch/arm/configs/cyanogenmod_bacon_defconfig
@@ -676,7 +676,9 @@ CONFIG_ZBOOT_ROM_BSS=0
# CONFIG_ARM_APPENDED_DTB is not set
CONFIG_CMDLINE=""
# CONFIG_XIP_KERNEL is not set
-# CONFIG_KEXEC is not set
+CONFIG_KEXEC=y
+CONFIG_KEXEC_HARDBOOT=y
+CONFIG_ATAGS_PROC=n
# CONFIG_CRASH_DUMP is not set
# CONFIG_AUTO_ZRELADDR is not set
@@ -1262,7 +1264,7 @@ CONFIG_OF=y
#
# Device Tree and Open Firmware support
#
-# CONFIG_PROC_DEVICETREE is not set
+CONFIG_PROC_DEVICETREE=y
# CONFIG_OF_SELFTEST is not set
CONFIG_OF_FLATTREE=y
CONFIG_OF_EARLY_FLATTREE=y
diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h
index c2b9b4b..564c55b 100644
--- a/arch/arm/include/asm/kexec.h
+++ b/arch/arm/include/asm/kexec.h
@@ -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__
/**
@@ -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 */
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index fa27058..eca7588 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -14,6 +14,9 @@
#include <asm/cacheflush.h>
#include <asm/mach-types.h>
#include <asm/system_misc.h>
+#include <linux/memblock.h>
+#include <linux/of_fdt.h>
+#include <asm/mmu_writeable.h>
extern const unsigned char relocate_new_kernel[];
extern const unsigned int relocate_new_kernel_size;
@@ -22,6 +25,12 @@ 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;
+extern unsigned long kexec_boot_atags_len;
+extern unsigned long kexec_kernel_len;
+void (*kexec_hardboot_hook)(void);
+#endif
static atomic_t waiting_for_crash_ipi;
@@ -32,6 +41,37 @@ static atomic_t waiting_for_crash_ipi;
int machine_kexec_prepare(struct kimage *image)
{
+ struct kexec_segment *current_segment;
+ __be32 header;
+ int i, err;
+
+ /* No segment at default ATAGs address. try to locate
+ * a dtb using magic */
+ for (i = 0; i < image->nr_segments; i++) {
+ current_segment = &image->segment[i];
+
+ err = memblock_is_region_memory(current_segment->mem,
+ current_segment->memsz);
+ if (!err)
+ return - EINVAL;
+
+#ifdef CONFIG_KEXEC_HARDBOOT
+ if(current_segment->mem == image->start)
+ mem_text_write_kernel_word(&kexec_kernel_len, current_segment->memsz);
+#endif
+
+ err = get_user(header, (__be32*)current_segment->buf);
+ if (err)
+ return err;
+
+ if (be32_to_cpu(header) == OF_DT_HEADER)
+ {
+ mem_text_write_kernel_word(&kexec_boot_atags, current_segment->mem);
+#ifdef CONFIG_KEXEC_HARDBOOT
+ mem_text_write_kernel_word(&kexec_boot_atags_len, current_segment->memsz);
+#endif
+ }
+ }
return 0;
}
@@ -123,10 +163,14 @@ 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);
+ if (!kexec_boot_atags)
+ 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,
@@ -140,5 +184,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);
}
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index d0cdedf..0e45ffc 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -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) || defined(CONFIG_ARCH_MSM8974)
+ #include <mach/msm_iomap.h>
+#endif
+#endif
+
.globl relocate_new_kernel
relocate_new_kernel:
@@ -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
@@ -60,6 +75,52 @@ 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
+ * 16: kexec_boot_atags_len
+ * 20: kexec_kernel_len */
+ 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_boot_atags_len
+ str r1, [r0, #16]
+ ldr r1, kexec_kernel_len
+ str r1, [r0, #20]
+ 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
+#elif defined(CONFIG_ARCH_MSM8974)
+ /* Restart using the PMIC chip, see mach-msm/restart.c */
+ ldr r0, =MSM8974_MPM2_PSHOLD_PHYS
+ mov r1, #0
+ str r1, [r0, #0]
+loop: b loop
+#else
+#error "No reboot method defined for hardboot."
+#endif
+
+ .ltorg
+#endif
.align
.globl kexec_start_address
@@ -79,6 +140,20 @@ kexec_mach_type:
kexec_boot_atags:
.long 0x0
+#ifdef CONFIG_KEXEC_HARDBOOT
+ .globl kexec_boot_atags_len
+kexec_boot_atags_len:
+ .long 0x0
+
+ .globl kexec_kernel_len
+kexec_kernel_len:
+ .long 0x0
+
+ .globl kexec_hardboot
+kexec_hardboot:
+ .long 0x0
+#endif
+
relocate_new_kernel_end:
.globl relocate_new_kernel_size
diff --git a/arch/arm/mach-msm/include/mach/memory.h b/arch/arm/mach-msm/include/mach/memory.h
index 9225230..1c87b96 100644
--- a/arch/arm/mach-msm/include/mach/memory.h
+++ b/arch/arm/mach-msm/include/mach/memory.h
@@ -20,6 +20,22 @@
/* physical offset of RAM */
#define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
+#if defined(CONFIG_KEXEC_HARDBOOT)
+#if defined(CONFIG_MACH_APQ8064_FLO)
+#define KEXEC_HB_PAGE_ADDR UL(0x88C00000)
+#elif defined(CONFIG_MACH_APQ8064_MAKO)
+#define KEXEC_HB_PAGE_ADDR UL(0x88600000)
+#elif defined(CONFIG_MACH_MSM8974_HAMMERHEAD)
+#define KEXEC_HB_PAGE_ADDR UL(0x10100000)
+#define KEXEC_HB_KERNEL_LOC UL(0x3208000)
+#elif defined(CONFIG_MACH_OPPO_MSM8974)
+#define KEXEC_HB_PAGE_ADDR UL(0x2F600000)
+#define KEXEC_HB_KERNEL_LOC UL(0x3208000)
+#else
+#error "Adress for kexec hardboot page not defined"
+#endif
+#endif
+
#ifndef __ASSEMBLY__
void clean_and_invalidate_caches(unsigned long, unsigned long, unsigned long);
void clean_caches(unsigned long, unsigned long, unsigned long);
diff --git a/arch/arm/mach-msm/oppo/board-8974-oppo.c b/arch/arm/mach-msm/oppo/board-8974-oppo.c
index 7ee5d2e..9256576 100644
--- a/arch/arm/mach-msm/oppo/board-8974-oppo.c
+++ b/arch/arm/mach-msm/oppo/board-8974-oppo.c
@@ -54,6 +54,13 @@
#include <linux/pcb_version.h>
+#ifdef CONFIG_KEXEC_HARDBOOT
+#include <asm/setup.h>
+#include <asm/memory.h>
+#include <linux/memblock.h>
+#define OPPO_PERSISTENT_RAM_SIZE (SZ_1M)
+#endif
+
static struct platform_device *ram_console_dev;
static struct persistent_ram_descriptor msm_prd[] __initdata = {
@@ -72,6 +79,26 @@ static struct persistent_ram msm_pr __initdata = {
void __init msm_8974_reserve(void)
{
+#ifdef CONFIG_KEXEC_HARDBOOT
+ // Reserve space for hardboot page - just after ram_console,
+ // at the start of second memory bank
+ int ret;
+ phys_addr_t start;
+ struct membank* bank;
+
+ if (meminfo.nr_banks < 2) {
+ pr_err("%s: not enough membank\n", __func__);
+ return;
+ }
+
+ bank = &meminfo.bank[1];
+ start = bank->start + SZ_1M + OPPO_PERSISTENT_RAM_SIZE;
+ ret = memblock_remove(start, SZ_1M);
+ if(!ret)
+ pr_info("Hardboot page reserved at 0x%X\n", start);
+ else
+ pr_err("Failed to reserve space for hardboot page at 0x%X!\n", start);
+#endif
persistent_ram_early_init(&msm_pr);
of_scan_flat_dt(dt_scan_for_memory_reserve, NULL);
}
diff --git a/arch/arm/mach-msm/restart.c b/arch/arm/mach-msm/restart.c
index a04ab8d..fe89976 100644
--- a/arch/arm/mach-msm/restart.c
+++ b/arch/arm/mach-msm/restart.c
@@ -38,6 +38,10 @@
#include "timer.h"
#include "wdog_debug.h"
+#ifdef CONFIG_KEXEC_HARDBOOT
+#include <asm/kexec.h>
+#endif
+
#define WDT0_RST 0x38
#define WDT0_EN 0x40
#define WDT0_BARK_TIME 0x4C
@@ -373,6 +377,26 @@ static int __init msm_pmic_restart_init(void)
late_initcall(msm_pmic_restart_init);
+#ifdef CONFIG_KEXEC_HARDBOOT
+static void msm_kexec_hardboot_hook(void)
+{
+ set_dload_mode(0);
+
+ // Set PMIC to restart-on-poweroff
+ pm8xxx_reset_pwr_off(1);
+
+ // These are executed on normal reboot, but with kexec-hardboot,
+ // they reboot/panic the system immediately.
+#if 0
+ qpnp_pon_system_pwr_off(PON_POWER_OFF_WARM_RESET);
+
+ /* Needed to bypass debug image on some chips */
+ msm_disable_wdog_debug();
+ halt_spmi_pmic_arbiter();
+#endif
+}
+#endif
+
static int __init msm_restart_init(void)
{
#ifdef CONFIG_MSM_DLOAD_MODE
@@ -392,6 +416,10 @@ static int __init msm_restart_init(void)
if (scm_is_call_available(SCM_SVC_PWR, SCM_IO_DISABLE_PMIC_ARBITER) > 0)
scm_pmic_arbiter_disable_supported = true;
+#ifdef CONFIG_KEXEC_HARDBOOT
+ kexec_hardboot_hook = msm_kexec_hardboot_hook;
+#endif
+
return 0;
}
early_initcall(msm_restart_init);
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index af84a25..a4509ad 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -111,6 +111,10 @@ struct kimage {
#define KEXEC_TYPE_CRASH 1
unsigned int preserve_context : 1;
+#ifdef CONFIG_KEXEC_HARDBOOT
+ unsigned int hardboot : 1;
+#endif
+
#ifdef ARCH_HAS_KIMAGE_ARCH
struct kimage_arch arch;
#endif
@@ -178,6 +182,11 @@ extern struct kimage *kexec_crash_image;
#define KEXEC_ON_CRASH 0x00000001
#define KEXEC_PRESERVE_CONTEXT 0x00000002
+
+#ifdef CONFIG_KEXEC_HARDBOOT
+#define KEXEC_HARDBOOT 0x00000004
+#endif
+
#define KEXEC_ARCH_MASK 0xffff0000
/* These values match the ELF architecture values.
@@ -196,10 +205,14 @@ extern struct kimage *kexec_crash_image;
#define KEXEC_ARCH_MIPS ( 8 << 16)
/* List of defined/legal kexec flags */
-#ifndef CONFIG_KEXEC_JUMP
-#define KEXEC_FLAGS KEXEC_ON_CRASH
-#else
+#if defined(CONFIG_KEXEC_JUMP) && defined(CONFIG_KEXEC_HARDBOOT)
+#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT | KEXEC_HARDBOOT)
+#elif defined(CONFIG_KEXEC_JUMP)
#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
+#elif defined(CONFIG_KEXEC_HARDBOOT)
+#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_HARDBOOT)
+#else
+#define KEXEC_FLAGS (KEXEC_ON_CRASH)
#endif
#define VMCOREINFO_BYTES (4096)
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 4e2e472..aef7893 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1004,6 +1004,10 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
if (flags & KEXEC_PRESERVE_CONTEXT)
image->preserve_context = 1;
+#ifdef CONFIG_KEXEC_HARDBOOT
+ if (flags & KEXEC_HARDBOOT)
+ image->hardboot = 1;
+#endif
result = machine_kexec_prepare(image);
if (result)
goto out;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,38 @@
From a8ab4ef7ef255f907104ff45a7cbbb2299a5aba5 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Mon, 19 Jan 2015 11:06:13 -0600
Subject: [PATCH] fs: f2fs: introduce a generic shutdown ioctl
This patch introduces a generic ioctl for fs shutdown.
Change-Id: I452ee16b0078a2704b8026962e5bd07b67710c06
---
include/linux/fs.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 5fc613c..c26de24 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -332,6 +332,7 @@ struct inodes_stat_t {
#define FIFREEZE _IOWR('X', 119, int) /* Freeze */
#define FITHAW _IOWR('X', 120, int) /* Thaw */
#define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */
+#define FS_IOC_SHUTDOWN _IOR('X', 125, __u32) /* Shutdown */
#define FIDTRIM _IOWR('f', 128, struct fstrim_range) /* Deep discard trim */
@@ -382,6 +383,13 @@ struct inodes_stat_t {
#define SYNC_FILE_RANGE_WRITE 2
#define SYNC_FILE_RANGE_WAIT_AFTER 4
+/*
+ * Flags for going down operation used by FS_IOC_GOINGDOWN
+ */
+#define FS_GOING_DOWN_FULLSYNC 0x0 /* going down with full sync */
+#define FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */
+#define FS_GOING_DOWN_NOSYNC 0x2 /* going down */
+
#ifdef __KERNEL__
#include <linux/linkage.h>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,720 @@
From 241ec33a5c4e70fac3986642e76c06f09b8d7c9d Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Mon, 23 Mar 2015 09:57:26 -0400
Subject: [PATCH] Implement Overclocking
Pulled from the
following
https://github.com/AK-Kernel/AK-OnePone/commit/afbde496eff9e83f75491f219e0cf13c84f5b751
https://github.com/AK-Kernel/AK-OnePone/commit/4a9c51aaf4e955c07d546d50e016d0d2f3b5647e
https://github.com/AK-Kernel/AK-OnePone/commit/17fcd1d38033baa029c2f6eefd463749294a7260
https://github.com/AK-Kernel/AK-OnePone/commit/94dc4d75d82acfcee47b4dc5b678910e30756788
https://github.com/AK-Kernel/AK-OnePone/commit/36c1a0dc912874a3acb2a6debdd98608ead5b0f0
https://github.com/AK-Kernel/AK-OnePone/commit/be6204a37daf307b56aa7f02342ca4623d42f504
---
arch/arm/boot/dts/msm8974-v2.dtsi | 2 +-
arch/arm/boot/dts/msm8974pro-pm8941.dtsi | 8 +-
.../arm/boot/dts/msm8974pro-pma8084-regulator.dtsi | 16 +-
arch/arm/boot/dts/msm8974pro.dtsi | 190 ++++++++++++++++++---
4 files changed, 179 insertions(+), 37 deletions(-)
diff --git a/arch/arm/boot/dts/msm8974-v2.dtsi b/arch/arm/boot/dts/msm8974-v2.dtsi
index 04769bd..8739175 100644
--- a/arch/arm/boot/dts/msm8974-v2.dtsi
+++ b/arch/arm/boot/dts/msm8974-v2.dtsi
@@ -135,7 +135,7 @@
<1880000 2068000>,
<3008000 3309000>,
<3760000 4136000>,
- <4468000 2457000>;
+ <4468000 2457600>;
qcom,dec-ocmem-ab-ib = <0 0>,
<176000 519000>,
<456000 519000>,
diff --git a/arch/arm/boot/dts/msm8974pro-pm8941.dtsi b/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
index 89939e6..d76e4bd 100644
--- a/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
+++ b/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
@@ -39,22 +39,22 @@
};
&krait0_vreg {
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,ldo-delta-voltage = <12500>;
};
&krait1_vreg {
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,ldo-delta-voltage = <12500>;
};
&krait2_vreg {
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,ldo-delta-voltage = <12500>;
};
&krait3_vreg {
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,ldo-delta-voltage = <12500>;
};
diff --git a/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi b/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi
index 433d466..428a520 100644
--- a/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi
+++ b/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi
@@ -492,9 +492,9 @@
<0xf908a800 0x1000>; /* APCS_ALIAS0_KPSS_MDD */
reg-names = "acs", "mdd";
regulator-min-microvolt = <500000>;
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,headroom-voltage = <150000>;
- qcom,retention-voltage = <675000>;
+ qcom,retention-voltage = <600000>;
qcom,ldo-default-voltage = <750000>;
qcom,ldo-threshold-voltage = <850000>;
qcom,ldo-delta-voltage = <12500>;
@@ -508,9 +508,9 @@
<0xf909a800 0x1000>; /* APCS_ALIAS1_KPSS_MDD */
reg-names = "acs", "mdd";
regulator-min-microvolt = <500000>;
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,headroom-voltage = <150000>;
- qcom,retention-voltage = <675000>;
+ qcom,retention-voltage = <600000>;
qcom,ldo-default-voltage = <750000>;
qcom,ldo-threshold-voltage = <850000>;
qcom,ldo-delta-voltage = <12500>;
@@ -524,9 +524,9 @@
<0xf90aa800 0x1000>; /* APCS_ALIAS2_KPSS_MDD */
reg-names = "acs", "mdd";
regulator-min-microvolt = <500000>;
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,headroom-voltage = <150000>;
- qcom,retention-voltage = <675000>;
+ qcom,retention-voltage = <600000>;
qcom,ldo-default-voltage = <750000>;
qcom,ldo-threshold-voltage = <850000>;
qcom,ldo-delta-voltage = <12500>;
@@ -540,9 +540,9 @@
<0xf90ba800 0x1000>; /* APCS_ALIAS3_KPSS_MDD */
reg-names = "acs", "mdd";
regulator-min-microvolt = <500000>;
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,headroom-voltage = <150000>;
- qcom,retention-voltage = <675000>;
+ qcom,retention-voltage = <600000>;
qcom,ldo-default-voltage = <750000>;
qcom,ldo-threshold-voltage = <850000>;
qcom,ldo-delta-voltage = <12500>;
diff --git a/arch/arm/boot/dts/msm8974pro.dtsi b/arch/arm/boot/dts/msm8974pro.dtsi
index c50b379..ebb5112 100644
--- a/arch/arm/boot/dts/msm8974pro.dtsi
+++ b/arch/arm/boot/dts/msm8974pro.dtsi
@@ -90,6 +90,7 @@
qcom,clock-krait@f9016000 {
qcom,speed1-pvs0-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 74 >,
< 345600000 775000 85 >,
< 422400000 775000 104 >,
@@ -121,6 +122,7 @@
qcom,speed1-pvs1-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 74 >,
< 345600000 775000 85 >,
< 422400000 775000 104 >,
@@ -152,6 +154,7 @@
qcom,speed1-pvs2-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 74 >,
< 345600000 750000 85 >,
< 422400000 750000 104 >,
@@ -183,6 +186,7 @@
qcom,speed1-pvs3-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 74 >,
< 345600000 750000 85 >,
< 422400000 750000 104 >,
@@ -214,6 +218,7 @@
qcom,speed1-pvs4-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 74 >,
< 345600000 750000 85 >,
< 422400000 750000 104 >,
@@ -245,6 +250,7 @@
qcom,speed1-pvs5-bin-v0 =
< 0 0 0 >,
+ < 268800000 720000 68 >,
< 300000000 725000 74 >,
< 345600000 725000 85 >,
< 422400000 725000 104 >,
@@ -276,6 +282,7 @@
qcom,speed1-pvs6-bin-v0 =
< 0 0 0 >,
+ < 268800000 720000 68 >,
< 300000000 725000 74 >,
< 345600000 725000 85 >,
< 422400000 725000 104 >,
@@ -307,6 +314,7 @@
qcom,speed3-pvs0-bin-v0 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -337,10 +345,14 @@
< 2265600000 1065000 700 >,
< 2342400000 1080000 734 >,
< 2419200000 1095000 769 >,
- < 2457600000 1100000 785 >;
+ < 2457600000 1100000 785 >,
+ < 2572800000 1145000 827 >,
+ < 2726400000 1205000 900 >,
+ < 2880000000 1235000 937 >;
qcom,speed3-pvs1-bin-v0 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -371,10 +383,14 @@
< 2265600000 1040000 700 >,
< 2342400000 1055000 734 >,
< 2419200000 1070000 769 >,
- < 2457600000 1075000 785 >;
+ < 2457600000 1075000 785 >,
+ < 2572800000 1145000 827 >,
+ < 2726400000 1205000 900 >,
+ < 2880000000 1235000 937 >;
qcom,speed3-pvs2-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -405,10 +421,14 @@
< 2265600000 1015000 700 >,
< 2342400000 1030000 734 >,
< 2419200000 1045000 769 >,
- < 2457600000 1050000 785 >;
+ < 2457600000 1050000 785 >,
+ < 2572800000 1125000 827 >,
+ < 2726400000 1195000 900 >,
+ < 2880000000 1225000 937 >;
qcom,speed3-pvs3-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -439,10 +459,14 @@
< 2265600000 990000 700 >,
< 2342400000 1005000 734 >,
< 2419200000 1020000 769 >,
- < 2457600000 1025000 785 >;
+ < 2457600000 1025000 785 >,
+ < 2572800000 1115000 827 >,
+ < 2726400000 1185000 900 >,
+ < 2880000000 1215000 937 >;
qcom,speed3-pvs4-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -473,10 +497,14 @@
< 2265600000 965000 700 >,
< 2342400000 980000 734 >,
< 2419200000 995000 769 >,
- < 2457600000 1000000 785 >;
+ < 2457600000 1000000 785 >,
+ < 2572800000 1075000 827 >,
+ < 2726400000 1175000 900 >,
+ < 2880000000 1205000 937 >;
qcom,speed3-pvs5-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 106 >,
@@ -507,10 +535,14 @@
< 2265600000 940000 700 >,
< 2342400000 955000 734 >,
< 2419200000 970000 769 >,
- < 2457600000 975000 785 >;
+ < 2457600000 975000 785 >,
+ < 2572800000 1025000 827 >,
+ < 2726400000 1175000 900 >,
+ < 2880000000 1195000 937 >;
qcom,speed3-pvs6-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 106 >,
@@ -541,10 +573,14 @@
< 2265600000 915000 700 >,
< 2342400000 930000 734 >,
< 2419200000 945000 769 >,
- < 2457600000 950000 785 >;
+ < 2457600000 950000 785 >,
+ < 2572800000 1010000 827 >,
+ < 2726400000 1155000 900 >,
+ < 2880000000 1175000 937 >;
qcom,speed1-pvs0-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 810000 87 >,
< 422400000 820000 108 >,
@@ -576,6 +612,7 @@
qcom,speed1-pvs1-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 810000 108 >,
@@ -607,6 +644,7 @@
qcom,speed1-pvs2-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 108 >,
@@ -638,6 +676,7 @@
qcom,speed1-pvs3-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 108 >,
@@ -669,6 +708,7 @@
qcom,speed1-pvs4-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 108 >,
@@ -700,6 +740,7 @@
qcom,speed1-pvs5-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 108 >,
@@ -731,6 +772,7 @@
qcom,speed1-pvs6-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -762,6 +804,7 @@
qcom,speed1-pvs7-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -793,6 +836,7 @@
qcom,speed1-pvs8-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -824,6 +868,7 @@
qcom,speed1-pvs9-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -855,6 +900,7 @@
qcom,speed1-pvs10-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -886,6 +932,7 @@
qcom,speed1-pvs11-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -917,6 +964,7 @@
qcom,speed1-pvs12-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -948,6 +996,7 @@
qcom,speed1-pvs13-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -979,6 +1028,7 @@
qcom,speed1-pvs14-bin-v1 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 108 >,
@@ -1010,6 +1060,7 @@
qcom,speed1-pvs15-bin-v1 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 108 >,
@@ -1041,6 +1092,7 @@
qcom,speed3-pvs0-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1071,10 +1123,14 @@
< 2265600000 1085000 716 >,
< 2342400000 1100000 751 >,
< 2419200000 1115000 786 >,
- < 2457600000 1120000 802 >;
+ < 2457600000 1120000 802 >,
+ < 2572800000 1175000 827 >,
+ < 2726400000 1225000 900 >,
+ < 2880000000 1265000 937 >;
qcom,speed3-pvs1-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1105,10 +1161,14 @@
< 2265600000 1075000 716 >,
< 2342400000 1090000 751 >,
< 2419200000 1105000 786 >,
- < 2457600000 1110000 802 >;
+ < 2457600000 1110000 802 >,
+ < 2572800000 1165000 827 >,
+ < 2726400000 1215000 900 >,
+ < 2880000000 1245000 937 >;
qcom,speed3-pvs2-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1139,10 +1199,14 @@
< 2265600000 1065000 716 >,
< 2342400000 1080000 751 >,
< 2419200000 1095000 786 >,
- < 2457600000 1100000 802 >;
+ < 2457600000 1100000 802 >,
+ < 2572800000 1145000 827 >,
+ < 2726400000 1185000 900 >,
+ < 2880000000 1215000 937 >;
qcom,speed3-pvs3-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1173,10 +1237,14 @@
< 2265600000 1055000 716 >,
< 2342400000 1070000 751 >,
< 2419200000 1085000 786 >,
- < 2457600000 1090000 802 >;
+ < 2457600000 1090000 802 >,
+ < 2572800000 1145000 827 >,
+ < 2726400000 1175000 900 >,
+ < 2880000000 1205000 937 >;
qcom,speed3-pvs4-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1207,10 +1275,14 @@
< 2265600000 1045000 716 >,
< 2342400000 1060000 751 >,
< 2419200000 1075000 786 >,
- < 2457600000 1080000 802 >;
+ < 2457600000 1080000 802 >,
+ < 2572800000 1135000 827 >,
+ < 2726400000 1165000 900 >,
+ < 2880000000 1195000 937 >;
qcom,speed3-pvs5-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1241,10 +1313,14 @@
< 2265600000 1035000 716 >,
< 2342400000 1050000 751 >,
< 2419200000 1065000 786 >,
- < 2457600000 1070000 802 >;
+ < 2457600000 1070000 802 >,
+ < 2572800000 1125000 827 >,
+ < 2726400000 1155000 900 >,
+ < 2880000000 1185000 937 >;
qcom,speed3-pvs6-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1275,10 +1351,14 @@
< 2265600000 1025000 716 >,
< 2342400000 1040000 751 >,
< 2419200000 1055000 786 >,
- < 2457600000 1060000 802 >;
+ < 2457600000 1060000 802 >,
+ < 2572800000 1115000 827 >,
+ < 2726400000 1145000 900 >,
+ < 2880000000 1175000 937 >;
qcom,speed3-pvs7-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1309,10 +1389,14 @@
< 2265600000 1015000 716 >,
< 2342400000 1030000 751 >,
< 2419200000 1045000 786 >,
- < 2457600000 1050000 802 >;
+ < 2457600000 1050000 802 >,
+ < 2572800000 1105000 827 >,
+ < 2726400000 1135000 900 >,
+ < 2880000000 1165000 937 >;
qcom,speed3-pvs8-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1343,10 +1427,14 @@
< 2265600000 1005000 716 >,
< 2342400000 1020000 751 >,
< 2419200000 1035000 786 >,
- < 2457600000 1040000 802 >;
+ < 2457600000 1040000 802 >,
+ < 2572800000 1095000 827 >,
+ < 2726400000 1125000 900 >,
+ < 2880000000 1155000 937 >;
qcom,speed3-pvs9-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1377,10 +1465,14 @@
< 2265600000 995000 716 >,
< 2342400000 1010000 751 >,
< 2419200000 1025000 786 >,
- < 2457600000 1030000 802 >;
+ < 2457600000 1030000 802 >,
+ < 2572800000 1085000 827 >,
+ < 2726400000 1115000 900 >,
+ < 2880000000 1145000 937 >;
qcom,speed3-pvs10-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1411,10 +1503,14 @@
< 2265600000 985000 716 >,
< 2342400000 1000000 751 >,
< 2419200000 1015000 786 >,
- < 2457600000 1020000 802 >;
+ < 2457600000 1020000 802 >,
+ < 2572800000 1075000 827 >,
+ < 2726400000 1105000 900 >,
+ < 2880000000 1135000 937 >;
qcom,speed3-pvs11-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1445,10 +1541,14 @@
< 2265600000 975000 716 >,
< 2342400000 990000 751 >,
< 2419200000 1005000 786 >,
- < 2457600000 1010000 802 >;
+ < 2457600000 1010000 802 >,
+ < 2572800000 1065000 827 >,
+ < 2726400000 1095000 900 >,
+ < 2880000000 1125000 937 >;
qcom,speed3-pvs12-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1479,10 +1579,14 @@
< 2265600000 965000 716 >,
< 2342400000 980000 751 >,
< 2419200000 995000 786 >,
- < 2457600000 1000000 802 >;
+ < 2457600000 1000000 802 >,
+ < 2572800000 1065000 827 >,
+ < 2726400000 1085000 900 >,
+ < 2880000000 1115000 937 >;
qcom,speed3-pvs13-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1513,10 +1617,14 @@
< 2265600000 955000 716 >,
< 2342400000 970000 751 >,
< 2419200000 985000 786 >,
- < 2457600000 990000 802 >;
+ < 2457600000 990000 802 >,
+ < 2572800000 1045000 827 >,
+ < 2726400000 1065000 900 >,
+ < 2880000000 1095000 937 >;
qcom,speed3-pvs14-bin-v1 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 106 >,
@@ -1547,10 +1655,14 @@
< 2265600000 945000 716 >,
< 2342400000 960000 751 >,
< 2419200000 975000 786 >,
- < 2457600000 980000 802 >;
+ < 2457600000 980000 802 >,
+ < 2572800000 1035000 827 >,
+ < 2726400000 1055000 900 >,
+ < 2880000000 1085000 937 >;
qcom,speed3-pvs15-bin-v1 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 106 >,
@@ -1581,9 +1693,39 @@
< 2265600000 935000 716 >,
< 2342400000 950000 751 >,
< 2419200000 965000 786 >,
- < 2457600000 970000 802 >;
+ < 2457600000 970000 802 >,
+ < 2572800000 1025000 827 >,
+ < 2726400000 1045000 900 >,
+ < 2880000000 1075000 937 >;
};
+ qcom,msm-cpufreq@0 {
+ reg = <0 4>;
+ compatible = "qcom,msm-cpufreq";
+ qcom,cpufreq-table =
+ < 268800 /* 75 MHz */ >,
+ < 300000 /* 75 MHz */ >,
+ < 422400 /* 150 MHz */ >,
+ < 652800 /* 200 MHz */ >,
+ < 729600 /* 307 MHz */ >,
+ < 883200 /* 307 MHz */ >,
+ < 960000 /* 460 MHz */ >,
+ < 1036800 /* 460 MHz */ >,
+ < 1190400 /* 460 MHz */ >,
+ < 1267200 /* 614 MHz */ >,
+ < 1497600 /* 614 MHz */ >,
+ < 1574400 /* 800 MHz */ >,
+ < 1728000 /* 800 MHz */ >,
+ < 1958400 /* 931 MHz */ >,
+ < 2265600 /* 931 MHz */ >,
+ < 2342400 /* 931 MHz */ >,
+ < 2419200 /* 931 MHz */ >,
+ < 2457600 /* 931 MHz */ >,
+ < 2572800 /* 931 MHz */ >,
+ < 2726400 /* 931 MHz */ >,
+ < 2880000 /* 931 MHz */ >;
+ };
+
i2c@f9928000 { /* BLSP-1 QUP-6 */
cell-index = <3>;
compatible = "qcom,i2c-qup";
@@ -1751,7 +1893,7 @@
<1880000 2068000>,
<3008000 3309000>,
<3760000 4136000>,
- <4468000 2457000>;
+ <4468000 2457600>;
qcom,dec-ocmem-ab-ib = <0 0>,
<176000 519000>,
<456000 519000>,

View file

@ -0,0 +1,577 @@
From c4b09239112301e4b2588c27ab147ff8ac5a3e60 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Tue, 26 May 2015 13:14:01 -0400
Subject: [PATCH] KEXEC
---
arch/arm/Kconfig | 26 ++++++++++
arch/arm/boot/compressed/head.S | 64 ++++++++++++++++++++++++
arch/arm/configs/cyanogenmod_bacon_defconfig | 6 ++-
arch/arm/include/asm/kexec.h | 8 +++
arch/arm/kernel/machine_kexec.c | 58 +++++++++++++++++++--
arch/arm/kernel/relocate_kernel.S | 75 ++++++++++++++++++++++++++++
arch/arm/mach-msm/include/mach/memory.h | 16 ++++++
arch/arm/mach-msm/oppo/board-8974-oppo.c | 27 ++++++++++
arch/arm/mach-msm/restart.c | 28 +++++++++++
include/linux/kexec.h | 19 +++++--
kernel/kexec.c | 4 ++
11 files changed, 322 insertions(+), 9 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 37d3c6d..f801a19 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2299,6 +2299,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
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index d3892ef..be05aa1 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -11,6 +11,12 @@
#include <linux/linkage.h>
.arch armv7-a
+
+#ifdef CONFIG_KEXEC_HARDBOOT
+ #include <asm/kexec.h>
+ #include <asm/memory.h>
+#endif
+
/*
* Debugging stuff
*
@@ -136,6 +142,64 @@ start:
1: mov r7, r1 @ save architecture ID
mov r8, r2 @ save atags pointer
+#ifdef CONFIG_KEXEC_HARDBOOT
+ /* Check hardboot page for a kexec kernel. */
+ ldr r3, =KEXEC_HB_PAGE_ADDR
+ ldr r0, [r3]
+ ldr r1, =KEXEC_HB_PAGE_MAGIC
+ teq r0, r1
+ bne not_booting_other
+
+ /* Clear hardboot page magic to avoid boot loop. */
+ mov r0, #0
+ str r0, [r3]
+
+ /*
+ * Copy dtb from location up high in memory to default location.
+ * Kernel freezes if this is not done.
+ */
+ ldr r1, [r3, #12] @ kexec_boot_atags
+ ldr r2, [r3, #16] @ kexec_boot_atags_len
+ mov r5, #0 @ iterator
+catags_cpy:
+ ldr r0, [r1, r5] @ from kexec_boot_atags
+ str r0, [r8, r5] @ to atags_pointer
+ add r5, r5, #4
+ cmp r5, r2
+ blo catags_cpy
+
+#ifdef KEXEC_HB_KERNEL_LOC
+ /*
+ * Copy kernel from location up high in memory to location in first 128MB.
+ * Bootloader on hammerhead erases first 128MB of ram on reboot, so it can't
+ * be in there before reboot, but decompressing in location above 128MB takes
+ * a long time. This memcpy is much quicker, for some reason.
+ */
+ ldr r2, [r3, #4] @ kexec_start_address
+ ldr r4, [r3, #20] @ kexec_kernel_len
+ ldr r6, =KEXEC_HB_KERNEL_LOC @ target
+ mov r5, #0 @ iterator
+kernel_cpy:
+ ldr r0, [r2, r5] @ from kexec_start_address
+ str r0, [r6, r5] @ to KEXEC_HB_KERNEL_LOC
+ add r5, r5, #4
+ cmp r5, r4
+ blo kernel_cpy
+#else
+ ldr r6, [r3, #4] @ kexec_start_address
+#endif
+
+ /* set registers and boot kexecd' kernel */
+ mov r0, #0
+ ldr r1, [r3, #8] @ kexec_mach_type
+ mov r2, r8 @ atags pointer
+ mov pc, r6
+
+ .ltorg
+
+not_booting_other:
+#endif
+
#ifndef __ARM_ARCH_2__
/*
* Booting from Angel - need to enter SVC mode and disable
diff --git a/arch/arm/configs/cyanogenmod_bacon_defconfig b/arch/arm/configs/cyanogenmod_bacon_defconfig
index ca55978..87ef3ef 100644
--- a/arch/arm/configs/cyanogenmod_bacon_defconfig
+++ b/arch/arm/configs/cyanogenmod_bacon_defconfig
@@ -683,7 +683,9 @@ CONFIG_ZBOOT_ROM_BSS=0
# CONFIG_ARM_APPENDED_DTB is not set
CONFIG_CMDLINE=""
# CONFIG_XIP_KERNEL is not set
-# CONFIG_KEXEC is not set
+CONFIG_KEXEC=y
+CONFIG_KEXEC_HARDBOOT=y
+CONFIG_ATAGS_PROC=n
# CONFIG_CRASH_DUMP is not set
# CONFIG_AUTO_ZRELADDR is not set
@@ -1272,7 +1274,7 @@ CONFIG_OF=y
#
# Device Tree and Open Firmware support
#
-# CONFIG_PROC_DEVICETREE is not set
+CONFIG_PROC_DEVICETREE=y
# CONFIG_OF_SELFTEST is not set
CONFIG_OF_FLATTREE=y
CONFIG_OF_EARLY_FLATTREE=y
diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h
index c2b9b4b..564c55b 100644
--- a/arch/arm/include/asm/kexec.h
+++ b/arch/arm/include/asm/kexec.h
@@ -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__
/**
@@ -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 */
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 357b651..29cdd2f 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -14,6 +14,9 @@
#include <asm/cacheflush.h>
#include <asm/mach-types.h>
#include <asm/system_misc.h>
+#include <linux/memblock.h>
+#include <linux/of_fdt.h>
+#include <asm/mmu_writeable.h>
extern const unsigned char relocate_new_kernel[];
extern const unsigned int relocate_new_kernel_size;
@@ -22,6 +25,12 @@ 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;
+extern unsigned long kexec_boot_atags_len;
+extern unsigned long kexec_kernel_len;
+void (*kexec_hardboot_hook)(void);
+#endif
static atomic_t waiting_for_crash_ipi;
@@ -32,6 +41,37 @@ static atomic_t waiting_for_crash_ipi;
int machine_kexec_prepare(struct kimage *image)
{
+ struct kexec_segment *current_segment;
+ __be32 header;
+ int i, err;
+
+ /* No segment at default ATAGs address. try to locate
+ * a dtb using magic */
+ for (i = 0; i < image->nr_segments; i++) {
+ current_segment = &image->segment[i];
+
+ err = memblock_is_region_memory(current_segment->mem,
+ current_segment->memsz);
+ if (!err)
+ return - EINVAL;
+
+#ifdef CONFIG_KEXEC_HARDBOOT
+ if(current_segment->mem == image->start)
+ mem_text_write_kernel_word(&kexec_kernel_len, current_segment->memsz);
+#endif
+
+ err = get_user(header, (__be32*)current_segment->buf);
+ if (err)
+ return err;
+
+ if (be32_to_cpu(header) == OF_DT_HEADER)
+ {
+ mem_text_write_kernel_word(&kexec_boot_atags, current_segment->mem);
+#ifdef CONFIG_KEXEC_HARDBOOT
+ mem_text_write_kernel_word(&kexec_boot_atags_len, current_segment->memsz);
+#endif
+ }
+ }
return 0;
}
@@ -123,10 +163,14 @@ 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);
+ if (!kexec_boot_atags)
+ 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,
@@ -140,6 +184,12 @@ 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);
}
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index d0cdedf..0e45ffc 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -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) || defined(CONFIG_ARCH_MSM8974)
+ #include <mach/msm_iomap.h>
+#endif
+#endif
+
.globl relocate_new_kernel
relocate_new_kernel:
@@ -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
@@ -60,6 +75,52 @@ 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
+ * 16: kexec_boot_atags_len
+ * 20: kexec_kernel_len */
+ 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_boot_atags_len
+ str r1, [r0, #16]
+ ldr r1, kexec_kernel_len
+ str r1, [r0, #20]
+ 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
+#elif defined(CONFIG_ARCH_MSM8974)
+ /* Restart using the PMIC chip, see mach-msm/restart.c */
+ ldr r0, =MSM8974_MPM2_PSHOLD_PHYS
+ mov r1, #0
+ str r1, [r0, #0]
+loop: b loop
+#else
+#error "No reboot method defined for hardboot."
+#endif
+
+ .ltorg
+#endif
.align
.globl kexec_start_address
@@ -79,6 +140,20 @@ kexec_mach_type:
kexec_boot_atags:
.long 0x0
+#ifdef CONFIG_KEXEC_HARDBOOT
+ .globl kexec_boot_atags_len
+kexec_boot_atags_len:
+ .long 0x0
+
+ .globl kexec_kernel_len
+kexec_kernel_len:
+ .long 0x0
+
+ .globl kexec_hardboot
+kexec_hardboot:
+ .long 0x0
+#endif
+
relocate_new_kernel_end:
.globl relocate_new_kernel_size
diff --git a/arch/arm/mach-msm/include/mach/memory.h b/arch/arm/mach-msm/include/mach/memory.h
index 9225230..1c87b96 100644
--- a/arch/arm/mach-msm/include/mach/memory.h
+++ b/arch/arm/mach-msm/include/mach/memory.h
@@ -20,6 +20,22 @@
/* physical offset of RAM */
#define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
+#if defined(CONFIG_KEXEC_HARDBOOT)
+#if defined(CONFIG_MACH_APQ8064_FLO)
+#define KEXEC_HB_PAGE_ADDR UL(0x88C00000)
+#elif defined(CONFIG_MACH_APQ8064_MAKO)
+#define KEXEC_HB_PAGE_ADDR UL(0x88600000)
+#elif defined(CONFIG_MACH_MSM8974_HAMMERHEAD)
+#define KEXEC_HB_PAGE_ADDR UL(0x10100000)
+#define KEXEC_HB_KERNEL_LOC UL(0x3208000)
+#elif defined(CONFIG_MACH_OPPO_MSM8974)
+#define KEXEC_HB_PAGE_ADDR UL(0x2F600000)
+#define KEXEC_HB_KERNEL_LOC UL(0x3208000)
+#else
+#error "Adress for kexec hardboot page not defined"
+#endif
+#endif
+
#ifndef __ASSEMBLY__
void clean_and_invalidate_caches(unsigned long, unsigned long, unsigned long);
void clean_caches(unsigned long, unsigned long, unsigned long);
diff --git a/arch/arm/mach-msm/oppo/board-8974-oppo.c b/arch/arm/mach-msm/oppo/board-8974-oppo.c
index eb24545..10bbbda 100644
--- a/arch/arm/mach-msm/oppo/board-8974-oppo.c
+++ b/arch/arm/mach-msm/oppo/board-8974-oppo.c
@@ -54,6 +54,13 @@
#include <linux/pcb_version.h>
+#ifdef CONFIG_KEXEC_HARDBOOT
+#include <asm/setup.h>
+#include <asm/memory.h>
+#include <linux/memblock.h>
+#define OPPO_PERSISTENT_RAM_SIZE (SZ_1M)
+#endif
+
static struct platform_device *ram_console_dev;
static struct persistent_ram_descriptor msm_prd[] __initdata = {
@@ -72,6 +79,26 @@ static struct persistent_ram msm_pr __initdata = {
void __init msm_8974_reserve(void)
{
+#ifdef CONFIG_KEXEC_HARDBOOT
+ // Reserve space for hardboot page - just after ram_console,
+ // at the start of second memory bank
+ int ret;
+ phys_addr_t start;
+ struct membank* bank;
+
+ if (meminfo.nr_banks < 2) {
+ pr_err("%s: not enough membank\n", __func__);
+ return;
+ }
+
+ bank = &meminfo.bank[1];
+ start = bank->start + SZ_1M + OPPO_PERSISTENT_RAM_SIZE;
+ ret = memblock_remove(start, SZ_1M);
+ if(!ret)
+ pr_info("Hardboot page reserved at 0x%X\n", start);
+ else
+ pr_err("Failed to reserve space for hardboot page at 0x%X!\n", start);
+#endif
persistent_ram_early_init(&msm_pr);
of_scan_flat_dt(dt_scan_for_memory_reserve, NULL);
}
diff --git a/arch/arm/mach-msm/restart.c b/arch/arm/mach-msm/restart.c
index a04ab8d..fe89976 100644
--- a/arch/arm/mach-msm/restart.c
+++ b/arch/arm/mach-msm/restart.c
@@ -38,6 +38,10 @@
#include "timer.h"
#include "wdog_debug.h"
+#ifdef CONFIG_KEXEC_HARDBOOT
+#include <asm/kexec.h>
+#endif
+
#define WDT0_RST 0x38
#define WDT0_EN 0x40
#define WDT0_BARK_TIME 0x4C
@@ -373,6 +377,26 @@ static int __init msm_pmic_restart_init(void)
late_initcall(msm_pmic_restart_init);
+#ifdef CONFIG_KEXEC_HARDBOOT
+static void msm_kexec_hardboot_hook(void)
+{
+ set_dload_mode(0);
+
+ // Set PMIC to restart-on-poweroff
+ pm8xxx_reset_pwr_off(1);
+
+ // These are executed on normal reboot, but with kexec-hardboot,
+ // they reboot/panic the system immediately.
+#if 0
+ qpnp_pon_system_pwr_off(PON_POWER_OFF_WARM_RESET);
+
+ /* Needed to bypass debug image on some chips */
+ msm_disable_wdog_debug();
+ halt_spmi_pmic_arbiter();
+#endif
+}
+#endif
+
static int __init msm_restart_init(void)
{
#ifdef CONFIG_MSM_DLOAD_MODE
@@ -392,6 +416,10 @@ static int __init msm_restart_init(void)
if (scm_is_call_available(SCM_SVC_PWR, SCM_IO_DISABLE_PMIC_ARBITER) > 0)
scm_pmic_arbiter_disable_supported = true;
+#ifdef CONFIG_KEXEC_HARDBOOT
+ kexec_hardboot_hook = msm_kexec_hardboot_hook;
+#endif
+
return 0;
}
early_initcall(msm_restart_init);
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index af84a25..a4509ad 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -111,6 +111,10 @@ struct kimage {
#define KEXEC_TYPE_CRASH 1
unsigned int preserve_context : 1;
+#ifdef CONFIG_KEXEC_HARDBOOT
+ unsigned int hardboot : 1;
+#endif
+
#ifdef ARCH_HAS_KIMAGE_ARCH
struct kimage_arch arch;
#endif
@@ -178,6 +182,11 @@ extern struct kimage *kexec_crash_image;
#define KEXEC_ON_CRASH 0x00000001
#define KEXEC_PRESERVE_CONTEXT 0x00000002
+
+#ifdef CONFIG_KEXEC_HARDBOOT
+#define KEXEC_HARDBOOT 0x00000004
+#endif
+
#define KEXEC_ARCH_MASK 0xffff0000
/* These values match the ELF architecture values.
@@ -196,10 +205,14 @@ extern struct kimage *kexec_crash_image;
#define KEXEC_ARCH_MIPS ( 8 << 16)
/* List of defined/legal kexec flags */
-#ifndef CONFIG_KEXEC_JUMP
-#define KEXEC_FLAGS KEXEC_ON_CRASH
-#else
+#if defined(CONFIG_KEXEC_JUMP) && defined(CONFIG_KEXEC_HARDBOOT)
+#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT | KEXEC_HARDBOOT)
+#elif defined(CONFIG_KEXEC_JUMP)
#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
+#elif defined(CONFIG_KEXEC_HARDBOOT)
+#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_HARDBOOT)
+#else
+#define KEXEC_FLAGS (KEXEC_ON_CRASH)
#endif
#define VMCOREINFO_BYTES (4096)
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 4e2e472..aef7893 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1004,6 +1004,10 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
if (flags & KEXEC_PRESERVE_CONTEXT)
image->preserve_context = 1;
+#ifdef CONFIG_KEXEC_HARDBOOT
+ if (flags & KEXEC_HARDBOOT)
+ image->hardboot = 1;
+#endif
result = machine_kexec_prepare(image);
if (result)
goto out;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,706 @@
From ee2ebd166905f6eb2ba94d42e5c9fe6c54792975 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Tue, 26 May 2015 13:15:04 -0400
Subject: [PATCH] Overclocking
---
arch/arm/boot/dts/msm8974-v2.dtsi | 2 +-
arch/arm/boot/dts/msm8974pro-pm8941.dtsi | 8 +-
.../arm/boot/dts/msm8974pro-pma8084-regulator.dtsi | 16 +-
arch/arm/boot/dts/msm8974pro.dtsi | 190 ++++++++++++++++++---
4 files changed, 179 insertions(+), 37 deletions(-)
diff --git a/arch/arm/boot/dts/msm8974-v2.dtsi b/arch/arm/boot/dts/msm8974-v2.dtsi
index 04769bd..8739175 100644
--- a/arch/arm/boot/dts/msm8974-v2.dtsi
+++ b/arch/arm/boot/dts/msm8974-v2.dtsi
@@ -135,7 +135,7 @@
<1880000 2068000>,
<3008000 3309000>,
<3760000 4136000>,
- <4468000 2457000>;
+ <4468000 2457600>;
qcom,dec-ocmem-ab-ib = <0 0>,
<176000 519000>,
<456000 519000>,
diff --git a/arch/arm/boot/dts/msm8974pro-pm8941.dtsi b/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
index 89939e6..d76e4bd 100644
--- a/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
+++ b/arch/arm/boot/dts/msm8974pro-pm8941.dtsi
@@ -39,22 +39,22 @@
};
&krait0_vreg {
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,ldo-delta-voltage = <12500>;
};
&krait1_vreg {
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,ldo-delta-voltage = <12500>;
};
&krait2_vreg {
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,ldo-delta-voltage = <12500>;
};
&krait3_vreg {
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,ldo-delta-voltage = <12500>;
};
diff --git a/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi b/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi
index 433d466..428a520 100644
--- a/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi
+++ b/arch/arm/boot/dts/msm8974pro-pma8084-regulator.dtsi
@@ -492,9 +492,9 @@
<0xf908a800 0x1000>; /* APCS_ALIAS0_KPSS_MDD */
reg-names = "acs", "mdd";
regulator-min-microvolt = <500000>;
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,headroom-voltage = <150000>;
- qcom,retention-voltage = <675000>;
+ qcom,retention-voltage = <600000>;
qcom,ldo-default-voltage = <750000>;
qcom,ldo-threshold-voltage = <850000>;
qcom,ldo-delta-voltage = <12500>;
@@ -508,9 +508,9 @@
<0xf909a800 0x1000>; /* APCS_ALIAS1_KPSS_MDD */
reg-names = "acs", "mdd";
regulator-min-microvolt = <500000>;
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,headroom-voltage = <150000>;
- qcom,retention-voltage = <675000>;
+ qcom,retention-voltage = <600000>;
qcom,ldo-default-voltage = <750000>;
qcom,ldo-threshold-voltage = <850000>;
qcom,ldo-delta-voltage = <12500>;
@@ -524,9 +524,9 @@
<0xf90aa800 0x1000>; /* APCS_ALIAS2_KPSS_MDD */
reg-names = "acs", "mdd";
regulator-min-microvolt = <500000>;
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,headroom-voltage = <150000>;
- qcom,retention-voltage = <675000>;
+ qcom,retention-voltage = <600000>;
qcom,ldo-default-voltage = <750000>;
qcom,ldo-threshold-voltage = <850000>;
qcom,ldo-delta-voltage = <12500>;
@@ -540,9 +540,9 @@
<0xf90ba800 0x1000>; /* APCS_ALIAS3_KPSS_MDD */
reg-names = "acs", "mdd";
regulator-min-microvolt = <500000>;
- regulator-max-microvolt = <1120000>;
+ regulator-max-microvolt = <1250000>;
qcom,headroom-voltage = <150000>;
- qcom,retention-voltage = <675000>;
+ qcom,retention-voltage = <600000>;
qcom,ldo-default-voltage = <750000>;
qcom,ldo-threshold-voltage = <850000>;
qcom,ldo-delta-voltage = <12500>;
diff --git a/arch/arm/boot/dts/msm8974pro.dtsi b/arch/arm/boot/dts/msm8974pro.dtsi
index c50b379..ebb5112 100644
--- a/arch/arm/boot/dts/msm8974pro.dtsi
+++ b/arch/arm/boot/dts/msm8974pro.dtsi
@@ -90,6 +90,7 @@
qcom,clock-krait@f9016000 {
qcom,speed1-pvs0-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 74 >,
< 345600000 775000 85 >,
< 422400000 775000 104 >,
@@ -121,6 +122,7 @@
qcom,speed1-pvs1-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 74 >,
< 345600000 775000 85 >,
< 422400000 775000 104 >,
@@ -152,6 +154,7 @@
qcom,speed1-pvs2-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 74 >,
< 345600000 750000 85 >,
< 422400000 750000 104 >,
@@ -183,6 +186,7 @@
qcom,speed1-pvs3-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 74 >,
< 345600000 750000 85 >,
< 422400000 750000 104 >,
@@ -214,6 +218,7 @@
qcom,speed1-pvs4-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 74 >,
< 345600000 750000 85 >,
< 422400000 750000 104 >,
@@ -245,6 +250,7 @@
qcom,speed1-pvs5-bin-v0 =
< 0 0 0 >,
+ < 268800000 720000 68 >,
< 300000000 725000 74 >,
< 345600000 725000 85 >,
< 422400000 725000 104 >,
@@ -276,6 +282,7 @@
qcom,speed1-pvs6-bin-v0 =
< 0 0 0 >,
+ < 268800000 720000 68 >,
< 300000000 725000 74 >,
< 345600000 725000 85 >,
< 422400000 725000 104 >,
@@ -307,6 +314,7 @@
qcom,speed3-pvs0-bin-v0 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -337,10 +345,14 @@
< 2265600000 1065000 700 >,
< 2342400000 1080000 734 >,
< 2419200000 1095000 769 >,
- < 2457600000 1100000 785 >;
+ < 2457600000 1100000 785 >,
+ < 2572800000 1145000 827 >,
+ < 2726400000 1205000 900 >,
+ < 2880000000 1235000 937 >;
qcom,speed3-pvs1-bin-v0 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -371,10 +383,14 @@
< 2265600000 1040000 700 >,
< 2342400000 1055000 734 >,
< 2419200000 1070000 769 >,
- < 2457600000 1075000 785 >;
+ < 2457600000 1075000 785 >,
+ < 2572800000 1145000 827 >,
+ < 2726400000 1205000 900 >,
+ < 2880000000 1235000 937 >;
qcom,speed3-pvs2-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -405,10 +421,14 @@
< 2265600000 1015000 700 >,
< 2342400000 1030000 734 >,
< 2419200000 1045000 769 >,
- < 2457600000 1050000 785 >;
+ < 2457600000 1050000 785 >,
+ < 2572800000 1125000 827 >,
+ < 2726400000 1195000 900 >,
+ < 2880000000 1225000 937 >;
qcom,speed3-pvs3-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -439,10 +459,14 @@
< 2265600000 990000 700 >,
< 2342400000 1005000 734 >,
< 2419200000 1020000 769 >,
- < 2457600000 1025000 785 >;
+ < 2457600000 1025000 785 >,
+ < 2572800000 1115000 827 >,
+ < 2726400000 1185000 900 >,
+ < 2880000000 1215000 937 >;
qcom,speed3-pvs4-bin-v0 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -473,10 +497,14 @@
< 2265600000 965000 700 >,
< 2342400000 980000 734 >,
< 2419200000 995000 769 >,
- < 2457600000 1000000 785 >;
+ < 2457600000 1000000 785 >,
+ < 2572800000 1075000 827 >,
+ < 2726400000 1175000 900 >,
+ < 2880000000 1205000 937 >;
qcom,speed3-pvs5-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 106 >,
@@ -507,10 +535,14 @@
< 2265600000 940000 700 >,
< 2342400000 955000 734 >,
< 2419200000 970000 769 >,
- < 2457600000 975000 785 >;
+ < 2457600000 975000 785 >,
+ < 2572800000 1025000 827 >,
+ < 2726400000 1175000 900 >,
+ < 2880000000 1195000 937 >;
qcom,speed3-pvs6-bin-v0 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 106 >,
@@ -541,10 +573,14 @@
< 2265600000 915000 700 >,
< 2342400000 930000 734 >,
< 2419200000 945000 769 >,
- < 2457600000 950000 785 >;
+ < 2457600000 950000 785 >,
+ < 2572800000 1010000 827 >,
+ < 2726400000 1155000 900 >,
+ < 2880000000 1175000 937 >;
qcom,speed1-pvs0-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 810000 87 >,
< 422400000 820000 108 >,
@@ -576,6 +612,7 @@
qcom,speed1-pvs1-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 810000 108 >,
@@ -607,6 +644,7 @@
qcom,speed1-pvs2-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 108 >,
@@ -638,6 +676,7 @@
qcom,speed1-pvs3-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 108 >,
@@ -669,6 +708,7 @@
qcom,speed1-pvs4-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 108 >,
@@ -700,6 +740,7 @@
qcom,speed1-pvs5-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 108 >,
@@ -731,6 +772,7 @@
qcom,speed1-pvs6-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -762,6 +804,7 @@
qcom,speed1-pvs7-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -793,6 +836,7 @@
qcom,speed1-pvs8-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -824,6 +868,7 @@
qcom,speed1-pvs9-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -855,6 +900,7 @@
qcom,speed1-pvs10-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -886,6 +932,7 @@
qcom,speed1-pvs11-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -917,6 +964,7 @@
qcom,speed1-pvs12-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -948,6 +996,7 @@
qcom,speed1-pvs13-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 108 >,
@@ -979,6 +1028,7 @@
qcom,speed1-pvs14-bin-v1 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 108 >,
@@ -1010,6 +1060,7 @@
qcom,speed1-pvs15-bin-v1 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 108 >,
@@ -1041,6 +1092,7 @@
qcom,speed3-pvs0-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1071,10 +1123,14 @@
< 2265600000 1085000 716 >,
< 2342400000 1100000 751 >,
< 2419200000 1115000 786 >,
- < 2457600000 1120000 802 >;
+ < 2457600000 1120000 802 >,
+ < 2572800000 1175000 827 >,
+ < 2726400000 1225000 900 >,
+ < 2880000000 1265000 937 >;
qcom,speed3-pvs1-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1105,10 +1161,14 @@
< 2265600000 1075000 716 >,
< 2342400000 1090000 751 >,
< 2419200000 1105000 786 >,
- < 2457600000 1110000 802 >;
+ < 2457600000 1110000 802 >,
+ < 2572800000 1165000 827 >,
+ < 2726400000 1215000 900 >,
+ < 2880000000 1245000 937 >;
qcom,speed3-pvs2-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1139,10 +1199,14 @@
< 2265600000 1065000 716 >,
< 2342400000 1080000 751 >,
< 2419200000 1095000 786 >,
- < 2457600000 1100000 802 >;
+ < 2457600000 1100000 802 >,
+ < 2572800000 1145000 827 >,
+ < 2726400000 1185000 900 >,
+ < 2880000000 1215000 937 >;
qcom,speed3-pvs3-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1173,10 +1237,14 @@
< 2265600000 1055000 716 >,
< 2342400000 1070000 751 >,
< 2419200000 1085000 786 >,
- < 2457600000 1090000 802 >;
+ < 2457600000 1090000 802 >,
+ < 2572800000 1145000 827 >,
+ < 2726400000 1175000 900 >,
+ < 2880000000 1205000 937 >;
qcom,speed3-pvs4-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1207,10 +1275,14 @@
< 2265600000 1045000 716 >,
< 2342400000 1060000 751 >,
< 2419200000 1075000 786 >,
- < 2457600000 1080000 802 >;
+ < 2457600000 1080000 802 >,
+ < 2572800000 1135000 827 >,
+ < 2726400000 1165000 900 >,
+ < 2880000000 1195000 937 >;
qcom,speed3-pvs5-bin-v1 =
< 0 0 0 >,
+ < 268800000 795000 68 >,
< 300000000 800000 76 >,
< 345600000 800000 87 >,
< 422400000 800000 106 >,
@@ -1241,10 +1313,14 @@
< 2265600000 1035000 716 >,
< 2342400000 1050000 751 >,
< 2419200000 1065000 786 >,
- < 2457600000 1070000 802 >;
+ < 2457600000 1070000 802 >,
+ < 2572800000 1125000 827 >,
+ < 2726400000 1155000 900 >,
+ < 2880000000 1185000 937 >;
qcom,speed3-pvs6-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1275,10 +1351,14 @@
< 2265600000 1025000 716 >,
< 2342400000 1040000 751 >,
< 2419200000 1055000 786 >,
- < 2457600000 1060000 802 >;
+ < 2457600000 1060000 802 >,
+ < 2572800000 1115000 827 >,
+ < 2726400000 1145000 900 >,
+ < 2880000000 1175000 937 >;
qcom,speed3-pvs7-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1309,10 +1389,14 @@
< 2265600000 1015000 716 >,
< 2342400000 1030000 751 >,
< 2419200000 1045000 786 >,
- < 2457600000 1050000 802 >;
+ < 2457600000 1050000 802 >,
+ < 2572800000 1105000 827 >,
+ < 2726400000 1135000 900 >,
+ < 2880000000 1165000 937 >;
qcom,speed3-pvs8-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1343,10 +1427,14 @@
< 2265600000 1005000 716 >,
< 2342400000 1020000 751 >,
< 2419200000 1035000 786 >,
- < 2457600000 1040000 802 >;
+ < 2457600000 1040000 802 >,
+ < 2572800000 1095000 827 >,
+ < 2726400000 1125000 900 >,
+ < 2880000000 1155000 937 >;
qcom,speed3-pvs9-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1377,10 +1465,14 @@
< 2265600000 995000 716 >,
< 2342400000 1010000 751 >,
< 2419200000 1025000 786 >,
- < 2457600000 1030000 802 >;
+ < 2457600000 1030000 802 >,
+ < 2572800000 1085000 827 >,
+ < 2726400000 1115000 900 >,
+ < 2880000000 1145000 937 >;
qcom,speed3-pvs10-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1411,10 +1503,14 @@
< 2265600000 985000 716 >,
< 2342400000 1000000 751 >,
< 2419200000 1015000 786 >,
- < 2457600000 1020000 802 >;
+ < 2457600000 1020000 802 >,
+ < 2572800000 1075000 827 >,
+ < 2726400000 1105000 900 >,
+ < 2880000000 1135000 937 >;
qcom,speed3-pvs11-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1445,10 +1541,14 @@
< 2265600000 975000 716 >,
< 2342400000 990000 751 >,
< 2419200000 1005000 786 >,
- < 2457600000 1010000 802 >;
+ < 2457600000 1010000 802 >,
+ < 2572800000 1065000 827 >,
+ < 2726400000 1095000 900 >,
+ < 2880000000 1125000 937 >;
qcom,speed3-pvs12-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1479,10 +1579,14 @@
< 2265600000 965000 716 >,
< 2342400000 980000 751 >,
< 2419200000 995000 786 >,
- < 2457600000 1000000 802 >;
+ < 2457600000 1000000 802 >,
+ < 2572800000 1065000 827 >,
+ < 2726400000 1085000 900 >,
+ < 2880000000 1115000 937 >;
qcom,speed3-pvs13-bin-v1 =
< 0 0 0 >,
+ < 268800000 770000 68 >,
< 300000000 775000 76 >,
< 345600000 775000 87 >,
< 422400000 775000 106 >,
@@ -1513,10 +1617,14 @@
< 2265600000 955000 716 >,
< 2342400000 970000 751 >,
< 2419200000 985000 786 >,
- < 2457600000 990000 802 >;
+ < 2457600000 990000 802 >,
+ < 2572800000 1045000 827 >,
+ < 2726400000 1065000 900 >,
+ < 2880000000 1095000 937 >;
qcom,speed3-pvs14-bin-v1 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 106 >,
@@ -1547,10 +1655,14 @@
< 2265600000 945000 716 >,
< 2342400000 960000 751 >,
< 2419200000 975000 786 >,
- < 2457600000 980000 802 >;
+ < 2457600000 980000 802 >,
+ < 2572800000 1035000 827 >,
+ < 2726400000 1055000 900 >,
+ < 2880000000 1085000 937 >;
qcom,speed3-pvs15-bin-v1 =
< 0 0 0 >,
+ < 268800000 745000 68 >,
< 300000000 750000 76 >,
< 345600000 750000 87 >,
< 422400000 750000 106 >,
@@ -1581,9 +1693,39 @@
< 2265600000 935000 716 >,
< 2342400000 950000 751 >,
< 2419200000 965000 786 >,
- < 2457600000 970000 802 >;
+ < 2457600000 970000 802 >,
+ < 2572800000 1025000 827 >,
+ < 2726400000 1045000 900 >,
+ < 2880000000 1075000 937 >;
};
+ qcom,msm-cpufreq@0 {
+ reg = <0 4>;
+ compatible = "qcom,msm-cpufreq";
+ qcom,cpufreq-table =
+ < 268800 /* 75 MHz */ >,
+ < 300000 /* 75 MHz */ >,
+ < 422400 /* 150 MHz */ >,
+ < 652800 /* 200 MHz */ >,
+ < 729600 /* 307 MHz */ >,
+ < 883200 /* 307 MHz */ >,
+ < 960000 /* 460 MHz */ >,
+ < 1036800 /* 460 MHz */ >,
+ < 1190400 /* 460 MHz */ >,
+ < 1267200 /* 614 MHz */ >,
+ < 1497600 /* 614 MHz */ >,
+ < 1574400 /* 800 MHz */ >,
+ < 1728000 /* 800 MHz */ >,
+ < 1958400 /* 931 MHz */ >,
+ < 2265600 /* 931 MHz */ >,
+ < 2342400 /* 931 MHz */ >,
+ < 2419200 /* 931 MHz */ >,
+ < 2457600 /* 931 MHz */ >,
+ < 2572800 /* 931 MHz */ >,
+ < 2726400 /* 931 MHz */ >,
+ < 2880000 /* 931 MHz */ >;
+ };
+
i2c@f9928000 { /* BLSP-1 QUP-6 */
cell-index = <3>;
compatible = "qcom,i2c-qup";
@@ -1751,7 +1893,7 @@
<1880000 2068000>,
<3008000 3309000>,
<3760000 4136000>,
- <4468000 2457000>;
+ <4468000 2457600>;
qcom,dec-ocmem-ab-ib = <0 0>,
<176000 519000>,
<456000 519000>,

View file

@ -0,0 +1,22 @@
From f495e7a9a44a02e2f0f80242d5eb8ce40a015ee6 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Sun, 29 Mar 2015 23:24:16 -0400
Subject: [PATCH] Enable modules
---
arch/arm/configs/cyanogenmod_bacon_defconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/configs/cyanogenmod_bacon_defconfig b/arch/arm/configs/cyanogenmod_bacon_defconfig
index 9c3ca28..66bed02 100644
--- a/arch/arm/configs/cyanogenmod_bacon_defconfig
+++ b/arch/arm/configs/cyanogenmod_bacon_defconfig
@@ -185,7 +185,7 @@ CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
-# CONFIG_MODULES is not set
+CONFIG_MODULES=y
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_LBDAF=y

View file

@ -0,0 +1,217 @@
From cf6a272bc79c0dae4cd3f6e9771c3ed2b8b18260 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Tue, 26 May 2015 13:15:24 -0400
Subject: [PATCH] More I/O Schedulers
---
arch/arm/configs/cyanogenmod_bacon_defconfig | 14 ++--
block/Kconfig.iosched | 98 ++++++++++++++++++++++++++++
block/Makefile | 7 ++
include/linux/cgroup_subsys.h | 6 ++
include/linux/elevator.h | 2 +
5 files changed, 122 insertions(+), 5 deletions(-)
diff --git a/arch/arm/configs/cyanogenmod_bacon_defconfig b/arch/arm/configs/cyanogenmod_bacon_defconfig
index 87ef3ef..f8a4df2 100644
--- a/arch/arm/configs/cyanogenmod_bacon_defconfig
+++ b/arch/arm/configs/cyanogenmod_bacon_defconfig
@@ -223,11 +223,15 @@ CONFIG_IOSCHED_TEST=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_ROW=y
CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_ROW is not set
-# CONFIG_DEFAULT_CFQ is not set
-CONFIG_DEFAULT_NOOP=y
-CONFIG_DEFAULT_IOSCHED="noop"
+CONFIG_IOSCHED_FIOPS=y
+CONFIG_IOSCHED_SIO=y
+CONFIG_IOSCHED_SIOPLUS=y
+CONFIG_IOSCHED_BFQ=y
+CONFIG_IOSCHED_ZEN=y
+CONFIG_IOSCHED_VR=y
+CONFIG_IOSCHED_TRIPNDROID=y
+CONFIG_DEFAULT_SIOPLUS=y
+CONFIG_DEFAULT_IOSCHED="SIOPLUS"
# CONFIG_INLINE_SPIN_TRYLOCK is not set
# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
# CONFIG_INLINE_SPIN_LOCK is not set
diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched
index 5fd98ea..20ab48f 100644
--- a/block/Kconfig.iosched
+++ b/block/Kconfig.iosched
@@ -65,6 +65,76 @@ config CFQ_GROUP_IOSCHED
---help---
Enable group IO scheduling in CFQ.
+config IOSCHED_BFQ
+ tristate "BFQ I/O scheduler"
+ depends on EXPERIMENTAL
+ default n
+ ---help---
+ The BFQ I/O scheduler tries to distribute bandwidth among
+ all processes according to their weights.
+ It aims at distributing the bandwidth as desired, independently of
+ the disk parameters and with any workload. It also tries to
+ guarantee low latency to interactive and soft real-time
+ applications. If compiled built-in (saying Y here), BFQ can
+ be configured to support hierarchical scheduling.
+
+config CGROUP_BFQIO
+ bool "BFQ hierarchical scheduling support"
+ depends on CGROUPS && IOSCHED_BFQ=y
+ default n
+ ---help---
+ Enable hierarchical scheduling in BFQ, using the cgroups
+ filesystem interface. The name of the subsystem will be
+ bfqio.
+
+config IOSCHED_FIOPS
+ tristate "IOPS based I/O scheduler"
+ default y
+ ---help---
+ This is an IOPS based I/O scheduler. It will try to distribute
+ IOPS equally among all processes in the system. It's mainly for
+ Flash based storage.
+
+config IOSCHED_SIO
+ tristate "Simple I/O scheduler"
+ default y
+ ---help---
+ The Simple I/O scheduler is an extremely simple scheduler,
+ based on noop and deadline, that relies on deadlines to
+ ensure fairness. The algorithm does not do any sorting but
+ basic merging, trying to keep a minimum overhead. It is aimed
+ mainly for aleatory access devices (eg: flash devices).
+
+config IOSCHED_SIOPLUS
+ tristate "Simple I/O scheduler plus"
+ default y
+ ---help---
+ The Simple I/O scheduler is an extremely simple scheduler,
+ based on noop and deadline, that relies on deadlines to
+ ensure fairness. The algorithm does not do any sorting but
+ basic merging, trying to keep a minimum overhead. It is aimed
+ mainly for aleatory access devices (eg: flash devices).
+
+config IOSCHED_ZEN
+ tristate "Zen I/O scheduler"
+ default y
+ ---help---
+ FCFS, dispatches are back-inserted, deadlines ensure fairness.
+ Should work best with devices where there is no travel delay.
+
+config IOSCHED_VR
+ tristate "V(R) I/O scheduler"
+ default y
+ ---help---
+ Requests are chosen according to SSTF with a penalty of rev_penalty
+ for switching head direction.
+
+config IOSCHED_TRIPNDROID
+ tristate "Tripndroid"
+ default y
+ ---help---
+ The Trip N Droid scheduler
+
choice
prompt "Default I/O scheduler"
default DEFAULT_CFQ
@@ -88,9 +158,30 @@ choice
config DEFAULT_CFQ
bool "CFQ" if IOSCHED_CFQ=y
+ config DEFAULT_BFQ
+ bool "BFQ" if IOSCHED_BFQ=y
+
+ config DEFAULT_FIOPS
+ bool "FIOPS" if IOSCHED_FIOPS=y
+
+ config DEFAULT_SIO
+ bool "SIO" if IOSCHED_SIO=y
+
+ config DEFAULT_SIOPLUS
+ bool "SIOPLUS" if IOSCHED_SIOPLUS=y
+
config DEFAULT_NOOP
bool "No-op"
+ config DEFAULT_ZEN
+ bool "ZEN" if IOSCHED_ZEN=y
+
+ config DEFAULT_VR
+ bool "VR" if IOSCHED_VR=y
+
+ config DEFAULT_TRIPNDROID
+ bool "TRIPNDROID" if IOSCHED_TRIPNDROID=y
+
endchoice
config DEFAULT_IOSCHED
@@ -98,7 +189,14 @@ config DEFAULT_IOSCHED
default "deadline" if DEFAULT_DEADLINE
default "row" if DEFAULT_ROW
default "cfq" if DEFAULT_CFQ
+ default "fiops" if DEFAULT_FIOPS
+ default "sio" if DEFAULT_SIO
+ default "sioplus" if DEFAULT_SIOPLUS
default "noop" if DEFAULT_NOOP
+ default "bfq" if DEFAULT_BFQ
+ default "zen" if DEFAULT_ZEN
+ default "vr" if DEFAULT_VR
+ default "tripndroid" if DEFAULT_TRIPNDROID
endmenu
diff --git a/block/Makefile b/block/Makefile
index b5e6637..9e525b2 100644
--- a/block/Makefile
+++ b/block/Makefile
@@ -17,6 +17,13 @@ obj-$(CONFIG_IOSCHED_DEADLINE) += deadline-iosched.o
obj-$(CONFIG_IOSCHED_ROW) += row-iosched.o
obj-$(CONFIG_IOSCHED_CFQ) += cfq-iosched.o
obj-$(CONFIG_IOSCHED_TEST) += test-iosched.o
+obj-$(CONFIG_IOSCHED_FIOPS) += fiops-iosched.o
+obj-$(CONFIG_IOSCHED_SIO) += sio-iosched.o
+obj-$(CONFIG_IOSCHED_SIOPLUS) += sioplus-iosched.o
+obj-$(CONFIG_IOSCHED_BFQ) += bfq-iosched.o
+obj-$(CONFIG_IOSCHED_ZEN) += zen-iosched.o
+obj-$(CONFIG_IOSCHED_VR) += vr-iosched.o
+obj-$(CONFIG_IOSCHED_TRIPNDROID) += tripndroid-iosched.o
obj-$(CONFIG_BLOCK_COMPAT) += compat_ioctl.o
obj-$(CONFIG_BLK_DEV_INTEGRITY) += blk-integrity.o
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 0bd390c..cbf22b1 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -72,3 +72,9 @@ SUBSYS(net_prio)
#endif
/* */
+
+#ifdef CONFIG_CGROUP_BFQIO
+SUBSYS(bfqio)
+#endif
+
+/* */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index b36b28f..3e71452 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -22,6 +22,7 @@ typedef void (elevator_bio_merged_fn) (struct request_queue *,
typedef int (elevator_dispatch_fn) (struct request_queue *, int);
typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
+typedef int (elevator_queue_empty_fn) (struct request_queue *);
typedef int (elevator_reinsert_req_fn) (struct request_queue *,
struct request *);
typedef bool (elevator_is_urgent_fn) (struct request_queue *);
@@ -55,6 +56,7 @@ struct elevator_ops
elevator_activate_req_fn *elevator_activate_req_fn;
elevator_deactivate_req_fn *elevator_deactivate_req_fn;
+ elevator_queue_empty_fn *elevator_queue_empty_fn;
elevator_completed_req_fn *elevator_completed_req_fn;
elevator_request_list_fn *elevator_former_req_fn;

View file

@ -0,0 +1,22 @@
From 785191a149e2375f0e0056755da2cdaad6327692 Mon Sep 17 00:00:00 2001
From: YoshiShaPow <yoshipga@gmail.com>
Date: Sat, 20 Dec 2014 12:05:19 -0800
Subject: [PATCH] gcc5: arm: enable cortex_a15 optimization
---
arch/arm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 064c832..3b900ba 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -57,7 +57,7 @@ comma = ,
# Note that GCC does not numerically define an architecture version
# macro, but instead defines a whole series of macros which makes
# testing for a specific architecture or later rather impossible.
-arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
+arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a -mtune=cortex-a15 -Wa$(comma)-march=armv7-a)
arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
# Only override the compiler option if ARMv6. The ARMv6K extensions are
# always available in ARMv7

View file

@ -0,0 +1,48 @@
From 19247694b61fbeeecb7f84c464c2f84ddd220871 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Tue, 26 May 2015 13:17:47 -0400
Subject: [PATCH] Defconfig changes
---
arch/arm/configs/cyanogenmod_bacon_defconfig | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/arm/configs/cyanogenmod_bacon_defconfig b/arch/arm/configs/cyanogenmod_bacon_defconfig
index f8a4df2..4f90b0f 100644
--- a/arch/arm/configs/cyanogenmod_bacon_defconfig
+++ b/arch/arm/configs/cyanogenmod_bacon_defconfig
@@ -121,8 +121,9 @@ CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
# CONFIG_RD_XZ is not set
# CONFIG_RD_LZO is not set
-# CONFIG_RD_LZ4 is not set
+CONFIG_RD_LZ4=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_CC_OPTIMIZE_MORE=y
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
CONFIG_PANIC_TIMEOUT=5
@@ -185,7 +186,7 @@ CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
-# CONFIG_MODULES is not set
+CONFIG_MODULES=y
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_LBDAF=y
@@ -1768,12 +1769,12 @@ CONFIG_SERIAL_MSM_HS=y
#
# Diag Support
#
-# CONFIG_DIAG_CHAR is not set
+CONFIG_DIAG_CHAR=y
#
# DIAG traffic over USB
#
-# CONFIG_DIAG_OVER_USB is not set
+CONFIG_DIAG_OVER_USB=y
#
# SDIO support for DIAG

View file

@ -0,0 +1,22 @@
From a585b7bacb83a6dfbafd48ebc9e664d671661bfc Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Tue, 26 May 2015 13:18:34 -0400
Subject: [PATCH] Optimizations
---
arch/arm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index e620786..0dd6592 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -57,7 +57,7 @@ comma = ,
# Note that GCC does not numerically define an architecture version
# macro, but instead defines a whole series of macros which makes
# testing for a specific architecture or later rather impossible.
-arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
+arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a -mtune=cortex-a15 -Wa$(comma)-march=armv7-a)
arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
# Only override the compiler option if ARMv6. The ARMv6K extensions are
# always available in ARMv7

View file

@ -0,0 +1,432 @@
From 7183beccd41e4d5d664ae98a30b5df193e415afb Mon Sep 17 00:00:00 2001
From: anarkia1976 <stefano.villa1976@gmail.com>
Date: Mon, 29 Jun 2015 11:52:37 +0200
Subject: [PATCH] drivers: usb: keyboard/mouse: Use Android device as USB
keyboard/mouse
Adapt to 3.4.y 8974/bacon
Base project: https://github.com/pelya/android-keyboard-gadget
Required app: https://play.google.com/store/apps/details?id=remote.hid.keyboard.client
Steps:
* Start ADB Debugging
* Start app
* Connect device to system via USB cable
All credits to @pelya for this sweet hack.
---
drivers/usb/gadget/Makefile | 2 +-
drivers/usb/gadget/android.c | 45 +++++++++++++++
drivers/usb/gadget/f_hid.c | 87 +++++++++++++++++++++++++++--
drivers/usb/gadget/f_hid.h | 16 ++++++
drivers/usb/gadget/f_hid_android_keyboard.c | 44 +++++++++++++++
drivers/usb/gadget/f_hid_android_mouse.c | 40 +++++++++++++
6 files changed, 227 insertions(+), 7 deletions(-)
create mode 100644 drivers/usb/gadget/f_hid.h
create mode 100644 drivers/usb/gadget/f_hid_android_keyboard.c
create mode 100644 drivers/usb/gadget/f_hid_android_mouse.c
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index b8f5149..f9a58b3 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -55,7 +55,7 @@ g_webcam-y := webcam.o
g_ncm-y := ncm.o
g_acm_ms-y := acm_ms.o
g_tcm_usb_gadget-y := tcm_usb_gadget.o
-g_android-y := android.o
+g_android-y := android.o f_hid.o
obj-$(CONFIG_USB_ZERO) += g_zero.o
obj-$(CONFIG_USB_AUDIO) += g_audio.o
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index 71b35b3..0f5b143 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -75,6 +75,9 @@
#include "f_ccid.c"
#include "f_mtp.c"
#include "f_accessory.c"
+#include "f_hid.h"
+#include "f_hid_android_keyboard.c"
+#include "f_hid_android_mouse.c"
#define USB_ETH_RNDIS y
#include "f_rndis.c"
#include "rndis.c"
@@ -2193,6 +2196,41 @@ static struct android_usb_function uasp_function = {
.bind_config = uasp_function_bind_config,
};
+static int hid_function_init(struct android_usb_function *f, struct usb_composite_dev *cdev)
+{
+ return ghid_setup(cdev->gadget, 2);
+}
+
+static void hid_function_cleanup(struct android_usb_function *f)
+{
+ ghid_cleanup();
+}
+
+static int hid_function_bind_config(struct android_usb_function *f, struct usb_configuration *c)
+{
+ int ret;
+ printk(KERN_INFO "hid keyboard\n");
+ ret = hidg_bind_config(c, &ghid_device_android_keyboard, 0);
+ if (ret) {
+ pr_info("%s: hid_function_bind_config keyboard failed: %d\n", __func__, ret);
+ return ret;
+ }
+ printk(KERN_INFO "hid mouse\n");
+ ret = hidg_bind_config(c, &ghid_device_android_mouse, 1);
+ if (ret) {
+ pr_info("%s: hid_function_bind_config mouse failed: %d\n", __func__, ret);
+ return ret;
+ }
+ return 0;
+}
+
+static struct android_usb_function hid_function = {
+ .name = "hid",
+ .init = hid_function_init,
+ .cleanup = hid_function_cleanup,
+ .bind_config = hid_function_bind_config,
+};
+
static struct android_usb_function *supported_functions[] = {
&ffs_function,
&mbim_function,
@@ -2223,6 +2261,7 @@ static struct android_usb_function *supported_functions[] = {
&audio_source_function,
#endif
&uasp_function,
+ &hid_function,
&charger_function,
NULL
};
@@ -2506,6 +2545,7 @@ functions_store(struct device *pdev, struct device_attribute *attr,
int err;
int is_ffs;
int ffs_enabled = 0;
+ int hid_enabled;
mutex_lock(&dev->mutex);
@@ -2574,7 +2614,12 @@ functions_store(struct device *pdev, struct device_attribute *attr,
if (err)
pr_err("android_usb: Cannot enable '%s' (%d)",
name, err);
+ if (!strcmp(name, "hid"))
+ hid_enabled = 1;
}
+ /* HID driver always enabled, it's the whole point of this kernel patch */
+ if (hid_enabled)
+ android_enable_function(dev, conf, "hid");
}
/* Free uneeded configurations if exists */
diff --git a/drivers/usb/gadget/f_hid.c b/drivers/usb/gadget/f_hid.c
index a4330fa..fa52b72 100644
--- a/drivers/usb/gadget/f_hid.c
+++ b/drivers/usb/gadget/f_hid.c
@@ -18,7 +18,9 @@
#include <linux/poll.h>
#include <linux/uaccess.h>
#include <linux/wait.h>
+#include <linux/delay.h>
#include <linux/usb/g_hid.h>
+#include "f_hid.h"
static int major, minors;
static struct class *hidg_class;
@@ -52,6 +54,43 @@ struct f_hidg {
struct usb_ep *in_ep;
};
+/* Hacky device list to fix f_hidg_write being called after device destroyed.
+ It covers only most common race conditions, there will be rare crashes anyway. */
+enum { HACKY_DEVICE_LIST_SIZE = 4 };
+static struct f_hidg *hacky_device_list[HACKY_DEVICE_LIST_SIZE];
+static void hacky_device_list_add(struct f_hidg *hidg)
+{
+ int i;
+ for (i = 0; i < HACKY_DEVICE_LIST_SIZE; i++) {
+ if (!hacky_device_list[i]) {
+ hacky_device_list[i] = hidg;
+ return;
+ }
+ }
+ pr_err("%s: too many devices, not adding device %p\n", __func__, hidg);
+}
+static void hacky_device_list_remove(struct f_hidg *hidg)
+{
+ int i;
+ for (i = 0; i < HACKY_DEVICE_LIST_SIZE; i++) {
+ if (hacky_device_list[i] == hidg) {
+ hacky_device_list[i] = NULL;
+ return;
+ }
+ }
+ pr_err("%s: cannot find device %p\n", __func__, hidg);
+}
+static int hacky_device_list_check(struct f_hidg *hidg)
+{
+ int i;
+ for (i = 0; i < HACKY_DEVICE_LIST_SIZE; i++) {
+ if (hacky_device_list[i] == hidg) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
static inline struct f_hidg *func_to_hidg(struct usb_function *f)
{
return container_of(f, struct f_hidg, func);
@@ -140,6 +179,11 @@ static ssize_t f_hidg_read(struct file *file, char __user *buffer,
if (!access_ok(VERIFY_WRITE, buffer, count))
return -EFAULT;
+ if (hacky_device_list_check(hidg)) {
+ pr_err("%s: trying to read from device %p that was destroyed\n", __func__, hidg);
+ return -EIO;
+ }
+
spin_lock_irqsave(&hidg->spinlock, flags);
#define READ_COND (hidg->set_report_buff != NULL)
@@ -194,6 +238,11 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
if (!access_ok(VERIFY_READ, buffer, count))
return -EFAULT;
+ if (hacky_device_list_check(hidg)) {
+ pr_err("%s: trying to write to device %p that was destroyed\n", __func__, hidg);
+ return -EIO;
+ }
+
mutex_lock(&hidg->lock);
#define WRITE_COND (!hidg->write_pending)
@@ -208,6 +257,11 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
hidg->write_queue, WRITE_COND))
return -ERESTARTSYS;
+ if (hacky_device_list_check(hidg)) {
+ pr_err("%s: trying to write to device %p that was destroyed\n", __func__, hidg);
+ return -EIO;
+ }
+
mutex_lock(&hidg->lock);
}
@@ -248,7 +302,18 @@ static unsigned int f_hidg_poll(struct file *file, poll_table *wait)
struct f_hidg *hidg = file->private_data;
unsigned int ret = 0;
+ if (hacky_device_list_check(hidg)) {
+ pr_err("%s: trying to poll device %p that was destroyed\n", __func__, hidg);
+ return -EIO;
+ }
+
poll_wait(file, &hidg->read_queue, wait);
+
+ if (hacky_device_list_check(hidg)) {
+ pr_err("%s: trying to poll device %p that was destroyed\n", __func__, hidg);
+ return -EIO;
+ }
+
poll_wait(file, &hidg->write_queue, wait);
if (WRITE_COND)
@@ -448,13 +513,15 @@ const struct file_operations f_hidg_fops = {
.llseek = noop_llseek,
};
-static int __init hidg_bind(struct usb_configuration *c, struct usb_function *f)
+static int hidg_bind(struct usb_configuration *c, struct usb_function *f)
{
struct usb_ep *ep;
struct f_hidg *hidg = func_to_hidg(f);
int status;
dev_t dev;
+ pr_info("%s: creating device %p\n", __func__, hidg);
+
/* allocate instance-specific interface IDs, and patch descriptors */
status = usb_interface_id(c, f);
if (status < 0)
@@ -493,8 +560,6 @@ static int __init hidg_bind(struct usb_configuration *c, struct usb_function *f)
hidg_hs_in_ep_desc.bEndpointAddress =
hidg_fs_in_ep_desc.bEndpointAddress;
- hidg_hs_out_ep_desc.bEndpointAddress =
- hidg_fs_out_ep_desc.bEndpointAddress;
status = usb_assign_descriptors(f, hidg_fs_descriptors,
hidg_hs_descriptors, NULL);
@@ -514,6 +579,7 @@ static int __init hidg_bind(struct usb_configuration *c, struct usb_function *f)
goto fail;
device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor);
+ hacky_device_list_add(hidg);
return 0;
@@ -533,12 +599,21 @@ static void hidg_unbind(struct usb_configuration *c, struct usb_function *f)
{
struct f_hidg *hidg = func_to_hidg(f);
+ pr_info("%s: destroying device %p\n", __func__, hidg);
+ /* This does not cover all race conditions, only most common one */
+ mutex_lock(&hidg->lock);
+ hacky_device_list_remove(hidg);
+ mutex_unlock(&hidg->lock);
+
device_destroy(hidg_class, MKDEV(major, hidg->minor));
cdev_del(&hidg->cdev);
/* disable/free request and end point */
usb_ep_disable(hidg->in_ep);
- usb_ep_dequeue(hidg->in_ep, hidg->req);
+ /* TODO: calling this function crash kernel,
+ not calling this funct ion crash kernel inside f_hidg_write */
+ /* usb_ep_dequeue(hidg->in_ep, hidg->req); */
+
kfree(hidg->req->buf);
usb_ep_free_request(hidg->in_ep, hidg->req);
@@ -572,7 +647,7 @@ static struct usb_gadget_strings *ct_func_strings[] = {
/*-------------------------------------------------------------------------*/
/* usb_configuration */
-int __init hidg_bind_config(struct usb_configuration *c,
+int hidg_bind_config(struct usb_configuration *c,
struct hidg_func_descriptor *fdesc, int index)
{
struct f_hidg *hidg;
@@ -623,7 +698,7 @@ int __init hidg_bind_config(struct usb_configuration *c,
return status;
}
-int __init ghid_setup(struct usb_gadget *g, int count)
+int ghid_setup(struct usb_gadget *g, int count)
{
int status;
dev_t dev;
diff --git a/drivers/usb/gadget/f_hid.h b/drivers/usb/gadget/f_hid.h
new file mode 100644
index 0000000..ad3527a
--- /dev/null
+++ b/drivers/usb/gadget/f_hid.h
@@ -0,0 +1,16 @@
+#ifndef _GADGET_F_HID_H
+#define _GADGET_F_HID_H
+
+#include <linux/hid.h>
+#include <linux/usb/composite.h>
+#include <linux/usb/gadget.h>
+#include <linux/usb/g_hid.h>
+
+int hidg_bind_config(struct usb_configuration *c,
+ struct hidg_func_descriptor *fdesc, int index);
+
+int ghid_setup(struct usb_gadget *g, int count);
+
+void ghid_cleanup(void);
+
+#endif
diff --git a/drivers/usb/gadget/f_hid_android_keyboard.c b/drivers/usb/gadget/f_hid_android_keyboard.c
new file mode 100644
index 0000000..76180eb
--- /dev/null
+++ b/drivers/usb/gadget/f_hid_android_keyboard.c
@@ -0,0 +1,44 @@
+#include <linux/platform_device.h>
+#include <linux/usb/g_hid.h>
+
+/* hid descriptor for a keyboard */
+static struct hidg_func_descriptor ghid_device_android_keyboard = {
+ .subclass = 0, /* No subclass */
+ .protocol = 1, /* Keyboard */
+ .report_length = 8,
+ .report_desc_length = 63,
+ .report_desc = {
+ 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
+ 0x09, 0x06, /* USAGE (Keyboard) */
+ 0xa1, 0x01, /* COLLECTION (Application) */
+ 0x05, 0x07, /* USAGE_PAGE (Keyboard) */
+ 0x19, 0xe0, /* USAGE_MINIMUM (Keyboard LeftControl) */
+ 0x29, 0xe7, /* USAGE_MAXIMUM (Keyboard Right GUI) */
+ 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
+ 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
+ 0x75, 0x01, /* REPORT_SIZE (1) */
+ 0x95, 0x08, /* REPORT_COUNT (8) */
+ 0x81, 0x02, /* INPUT (Data,Var,Abs) */
+ 0x95, 0x01, /* REPORT_COUNT (1) */
+ 0x75, 0x08, /* REPORT_SIZE (8) */
+ 0x81, 0x03, /* INPUT (Cnst,Var,Abs) */
+ 0x95, 0x05, /* REPORT_COUNT (5) */
+ 0x75, 0x01, /* REPORT_SIZE (1) */
+ 0x05, 0x08, /* USAGE_PAGE (LEDs) */
+ 0x19, 0x01, /* USAGE_MINIMUM (Num Lock) */
+ 0x29, 0x05, /* USAGE_MAXIMUM (Kana) */
+ 0x91, 0x02, /* OUTPUT (Data,Var,Abs) */
+ 0x95, 0x01, /* REPORT_COUNT (1) */
+ 0x75, 0x03, /* REPORT_SIZE (3) */
+ 0x91, 0x03, /* OUTPUT (Cnst,Var,Abs) */
+ 0x95, 0x06, /* REPORT_COUNT (6) */
+ 0x75, 0x08, /* REPORT_SIZE (8) */
+ 0x15, 0x00, /* LOGICAL_MINIMUM (0) */
+ 0x25, 0x65, /* LOGICAL_MAXIMUM (101) */
+ 0x05, 0x07, /* USAGE_PAGE (Keyboard) */
+ 0x19, 0x00, /* USAGE_MINIMUM (Reserved) */
+ 0x29, 0x65, /* USAGE_MAXIMUM (Keyboard Application) */
+ 0x81, 0x00, /* INPUT (Data,Ary,Abs) */
+ 0xc0 /* END_COLLECTION */
+ }
+};
diff --git a/drivers/usb/gadget/f_hid_android_mouse.c b/drivers/usb/gadget/f_hid_android_mouse.c
new file mode 100644
index 0000000..8a6ab0a
--- /dev/null
+++ b/drivers/usb/gadget/f_hid_android_mouse.c
@@ -0,0 +1,40 @@
+#include <linux/platform_device.h>
+#include <linux/usb/g_hid.h>
+
+/* HID descriptor for a mouse */
+static struct hidg_func_descriptor ghid_device_android_mouse = {
+ .subclass = 0, /* No subclass */
+ .protocol = 2, /* Mouse */
+ .report_length = 4,
+ .report_desc_length = 52,
+ .report_desc = {
+ 0x05, 0x01, //Usage Page(Generic Desktop Controls)
+ 0x09, 0x02, //Usage (Mouse)
+ 0xa1, 0x01, //Collection (Application)
+ 0x09, 0x01, //Usage (pointer)
+ 0xa1, 0x00, //Collection (Physical)
+ 0x05, 0x09, //Usage Page (Button)
+ 0x19, 0x01, //Usage Minimum(1)
+ 0x29, 0x05, //Usage Maximum(5)
+ 0x15, 0x00, //Logical Minimum(1)
+ 0x25, 0x01, //Logical Maximum(1)
+ 0x95, 0x05, //Report Count(5)
+ 0x75, 0x01, //Report Size(1)
+ 0x81, 0x02, //Input(Data,Variable,Absolute,BitField)
+ 0x95, 0x01, //Report Count(1)
+ 0x75, 0x03, //Report Size(3)
+ 0x81, 0x01, //Input(Constant,Array,Absolute,BitField)
+ 0x05, 0x01, //Usage Page(Generic Desktop Controls)
+ 0x09, 0x30, //Usage(x)
+ 0x09, 0x31, //Usage(y)
+ 0x09, 0x38, //Usage(Wheel)
+ 0x15, 0x81, //Logical Minimum(-127)
+ 0x25, 0x7F, //Logical Maximum(127)
+ 0x75, 0x08, //Report Size(8)
+ 0x95, 0x03, //Report Count(3)
+ 0x81, 0x06, //Input(Data,Variable,Relative,BitField)
+ 0xc0, //End Collection
+ 0xc0 //End Collection
+ }
+};
+

View file

@ -0,0 +1,42 @@
From 7b1b44ea74c7d936bac1509cbe0a4637c7635f94 Mon Sep 17 00:00:00 2001
From: anarkia1976 <stefano.villa1976@gmail.com>
Date: Mon, 29 Jun 2015 16:41:07 +0200
Subject: [PATCH] drivers: usb: keyboard/mouse: Added Boot mode patch
---
drivers/usb/gadget/f_hid.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/f_hid.c b/drivers/usb/gadget/f_hid.c
index fa52b72..4b49e6e 100644
--- a/drivers/usb/gadget/f_hid.c
+++ b/drivers/usb/gadget/f_hid.c
@@ -403,7 +403,12 @@ static int hidg_setup(struct usb_function *f,
case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
| HID_REQ_GET_PROTOCOL):
VDBG(cdev, "get_protocol\n");
- goto stall;
+ length = min_t(unsigned, length, 1);
+ if (hidg->bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT)
+ ((u8 *) req->buf)[0] = 0; /* Boot protocol */
+ else
+ ((u8 *) req->buf)[0] = 1; /* Report protocol */
+ goto respond;
break;
case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
@@ -417,6 +422,14 @@ static int hidg_setup(struct usb_function *f,
case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8
| HID_REQ_SET_PROTOCOL):
VDBG(cdev, "set_protocol\n");
+ length = 0;
+ if (hidg->bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT) {
+ if (value == 0) /* Boot protocol */
+ goto respond;
+ } else {
+ if (value == 1) /* Report protocol */
+ goto respond;
+ }
goto stall;
break;

File diff suppressed because it is too large Load diff