Skip to content

Commit

Permalink
Linux Kernel 3.10.2 compiles and runs (mods done; .rej cleaned up)
Browse files Browse the repository at this point in the history
Applied:
/LineageOS/android/kernel/sony/msm8994$ patch -p1 -R <
/home/dj/Downloads/linuxkernelpatches/patch-3.10.2-3

1) arch/arm64/mm/fault.c - #defines adapted because those from patch
missing:
ESR_WRITE -> ESR_EL1_WRITE
ESR_CM -> ESR_EL1_CM

2) not reverted since functions nowhere defined:
@@ -183,8 +183,10 @@ void gov_queue_work(struct dbs_data *dbs_data,
struct cpufreq_policy *policy,
 		 */
 		__gov_queue_work(raw_smp_processor_id(), dbs_data,
delay);
 	} else {
+		get_online_cpus();
 		for_each_cpu(i, policy->cpus)
 			__gov_queue_work(i, dbs_data, delay);
+		put_online_cpus();
 	}
 }
 EXPORT_SYMBOL_GPL(gov_queue_work);

Change-Id: Idbc72cbf82fdae16a65ee595a3c4739b58634d2e
  • Loading branch information
djStolen committed Jan 15, 2024
1 parent 353e614 commit 2471dc6
Show file tree
Hide file tree
Showing 98 changed files with 406 additions and 1,110 deletions.
2 changes: 1 addition & 1 deletion Documentation/i2c/busses/i2c-piix4
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Supported adapters:
* AMD SP5100 (SB700 derivative found on some server mainboards)
Datasheet: Publicly available at the AMD website
http://support.amd.com/us/Embedded_TechDocs/44413.pdf
* AMD Hudson-2, CZ
* AMD Hudson-2
Datasheet: Not publicly available
* Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge
Datasheet: Publicly available at the SMSC website http://www.smsc.com
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION = 3
PATCHLEVEL = 10
SUBLEVEL = 3
SUBLEVEL = 2
EXTRAVERSION =
NAME = Unicycling Gorilla

Expand Down
48 changes: 27 additions & 21 deletions arch/arm64/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,25 @@ static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *re

#define ESR_LNX_EXEC (1 << 24)

/*
* Check that the permissions on the VMA allow for the fault which occurred.
* If we encountered a write fault, we must have write permission, otherwise
* we allow any permission.
*/
static inline bool access_error(unsigned int esr, struct vm_area_struct *vma)
{
unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;

if (esr & ESR_EL1_WRITE)
mask = VM_WRITE;
if (esr & ESR_LNX_EXEC)
mask = VM_EXEC;

return vma->vm_flags & mask ? false : true;
}

static int __do_page_fault(struct mm_struct *mm, unsigned long addr,
unsigned int mm_flags, unsigned long vm_flags,
unsigned int esr, unsigned int flags,
struct task_struct *tsk)
{
struct vm_area_struct *vma;
Expand All @@ -176,17 +193,12 @@ static int __do_page_fault(struct mm_struct *mm, unsigned long addr,
* it.
*/
good_area:
/*
* Check that the permissions on the VMA allow for the fault which
* occurred. If we encountered a write or exec fault, we must have
* appropriate permissions, otherwise we allow any permission.
*/
if (!(vma->vm_flags & vm_flags)) {
if (access_error(esr, vma)) {
fault = VM_FAULT_BADACCESS;
goto out;
}

return handle_mm_fault(mm, vma, addr & PAGE_MASK, mm_flags);
return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);

check_stack:
if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
Expand All @@ -201,16 +213,10 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
struct task_struct *tsk;
struct mm_struct *mm;
int fault, sig, code;
unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC;
unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;

if (esr & ESR_LNX_EXEC) {
vm_flags = VM_EXEC;
} else if (((esr & ESR_EL1_WRITE) && !(esr & ESR_EL1_CM)) ||
((esr & ESR_EL1_CM))) {
vm_flags = VM_WRITE;
mm_flags |= FAULT_FLAG_WRITE;
}

bool write = (esr & ESR_EL1_WRITE) && !(esr & ESR_EL1_CM);
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
(write ? FAULT_FLAG_WRITE : 0);

tsk = current;
mm = tsk->mm;
Expand Down Expand Up @@ -248,7 +254,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
#endif
}

fault = __do_page_fault(mm, addr, mm_flags, vm_flags, tsk);
fault = __do_page_fault(mm, addr, esr, flags, tsk);

/*
* If we need to retry but a fatal signal is pending, handle the
Expand All @@ -265,7 +271,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
*/

perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
if (mm_flags & FAULT_FLAG_ALLOW_RETRY) {
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_MAJOR) {
tsk->maj_flt++;
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs,
Expand All @@ -280,7 +286,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk of
* starvation.
*/
mm_flags &= ~FAULT_FLAG_ALLOW_RETRY;
flags &= ~FAULT_FLAG_ALLOW_RETRY;
goto retry;
}
}
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/cavium-octeon/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ void __init plat_mem_setup(void)
cvmx_bootmem_unlock();
/* Add the memory region for the kernel. */
kernel_start = (unsigned long) _text;
kernel_size = _end - _text;
kernel_size = ALIGN(_end - _text, 0x100000);

/* Adjust for physical offset. */
kernel_start &= ~0xffffffff80000000ULL;
Expand Down
8 changes: 4 additions & 4 deletions arch/powerpc/include/asm/exception-64s.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,12 @@ label##_relon_pSeries: \
/* No guest interrupts come through here */ \
SET_SCRATCH0(r13); /* save r13 */ \
EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
EXC_STD, NOTEST, vec)
EXC_STD, KVMTEST_PR, vec)

#define STD_RELON_EXCEPTION_PSERIES_OOL(vec, label) \
.globl label##_relon_pSeries; \
label##_relon_pSeries: \
EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, vec); \
EXCEPTION_PROLOG_1(PACA_EXGEN, KVMTEST_PR, vec); \
EXCEPTION_RELON_PROLOG_PSERIES_1(label##_common, EXC_STD)

#define STD_RELON_EXCEPTION_HV(loc, vec, label) \
Expand All @@ -374,12 +374,12 @@ label##_relon_hv: \
/* No guest interrupts come through here */ \
SET_SCRATCH0(r13); /* save r13 */ \
EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
EXC_HV, NOTEST, vec)
EXC_HV, KVMTEST, vec)

#define STD_RELON_EXCEPTION_HV_OOL(vec, label) \
.globl label##_relon_hv; \
label##_relon_hv: \
EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, vec); \
EXCEPTION_PROLOG_1(PACA_EXGEN, KVMTEST, vec); \
EXCEPTION_RELON_PROLOG_PSERIES_1(label##_common, EXC_HV)

/* This associate vector numbers with bits in paca->irq_happened */
Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/include/asm/reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@
#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */
#define MMCR0_PMAO 0x00000080UL /* performance monitor alert has occurred, set to 0 after handling exception */
#define MMCR0_SHRFC 0x00000040UL /* SHRre freeze conditions between threads */
#define MMCR0_FC56 0x00000010UL /* freeze counters 5 and 6 */
#define MMCR0_FCTI 0x00000008UL /* freeze counters in tags inactive mode */
#define MMCR0_FCTA 0x00000004UL /* freeze counters in tags active mode */
#define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */
Expand Down
56 changes: 31 additions & 25 deletions arch/powerpc/kernel/exceptions-64s.S
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,10 @@ vsx_unavailable_pSeries_1:
EXCEPTION_PROLOG_0(PACA_EXGEN)
b vsx_unavailable_pSeries

facility_unavailable_trampoline:
. = 0xf60
SET_SCRATCH0(r13)
EXCEPTION_PROLOG_0(PACA_EXGEN)
b facility_unavailable_pSeries

hv_facility_unavailable_trampoline:
. = 0xf80
SET_SCRATCH0(r13)
EXCEPTION_PROLOG_0(PACA_EXGEN)
b facility_unavailable_hv
b tm_unavailable_pSeries

#ifdef CONFIG_CBE_RAS
STD_EXCEPTION_HV(0x1200, 0x1202, cbe_system_error)
Expand Down Expand Up @@ -529,10 +522,8 @@ denorm_done:
KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf20)
STD_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf40)
STD_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
STD_EXCEPTION_PSERIES_OOL(0xf60, tm_unavailable)
KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf60)
STD_EXCEPTION_HV_OOL(0xf82, facility_unavailable)
KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xf82)

/*
* An interrupt came in while soft-disabled. We set paca->irq_happened, then:
Expand Down Expand Up @@ -802,18 +793,24 @@ system_call_relon_pSeries:
STD_RELON_EXCEPTION_PSERIES(0x4d00, 0xd00, single_step)

. = 0x4e00
b . /* Can't happen, see v2.07 Book III-S section 6.5 */
SET_SCRATCH0(r13)
EXCEPTION_PROLOG_0(PACA_EXGEN)
b h_data_storage_relon_hv

. = 0x4e20
b . /* Can't happen, see v2.07 Book III-S section 6.5 */
SET_SCRATCH0(r13)
EXCEPTION_PROLOG_0(PACA_EXGEN)
b h_instr_storage_relon_hv

. = 0x4e40
SET_SCRATCH0(r13)
EXCEPTION_PROLOG_0(PACA_EXGEN)
b emulation_assist_relon_hv

. = 0x4e60
b . /* Can't happen, see v2.07 Book III-S section 6.5 */
SET_SCRATCH0(r13)
EXCEPTION_PROLOG_0(PACA_EXGEN)
b hmi_exception_relon_hv

. = 0x4e80
SET_SCRATCH0(r13)
Expand All @@ -838,17 +835,11 @@ vsx_unavailable_relon_pSeries_1:
EXCEPTION_PROLOG_0(PACA_EXGEN)
b vsx_unavailable_relon_pSeries

facility_unavailable_relon_trampoline:
tm_unavailable_relon_pSeries_1:
. = 0x4f60
SET_SCRATCH0(r13)
EXCEPTION_PROLOG_0(PACA_EXGEN)
b facility_unavailable_relon_pSeries

hv_facility_unavailable_relon_trampoline:
. = 0x4f80
SET_SCRATCH0(r13)
EXCEPTION_PROLOG_0(PACA_EXGEN)
b facility_unavailable_relon_hv
b tm_unavailable_relon_pSeries

STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint)
#ifdef CONFIG_PPC_DENORMALISATION
Expand Down Expand Up @@ -1174,21 +1165,36 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
bl .vsx_unavailable_exception
b .ret_from_except

STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception)
.align 7
.globl tm_unavailable_common
tm_unavailable_common:
EXCEPTION_PROLOG_COMMON(0xf60, PACA_EXGEN)
bl .save_nvgprs
DISABLE_INTS
addi r3,r1,STACK_FRAME_OVERHEAD
bl .tm_unavailable_exception
b .ret_from_except

.align 7
.globl __end_handlers
__end_handlers:

/* Equivalents to the above handlers for relocation-on interrupt vectors */
STD_RELON_EXCEPTION_HV_OOL(0xe00, h_data_storage)
KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe00)
STD_RELON_EXCEPTION_HV_OOL(0xe20, h_instr_storage)
KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe20)
STD_RELON_EXCEPTION_HV_OOL(0xe40, emulation_assist)
KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe40)
STD_RELON_EXCEPTION_HV_OOL(0xe60, hmi_exception)
KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe60)
MASKABLE_RELON_EXCEPTION_HV_OOL(0xe80, h_doorbell)
KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe80)

STD_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor)
STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
STD_RELON_EXCEPTION_HV_OOL(0xf80, facility_unavailable)
STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, tm_unavailable)

#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
/*
Expand Down
3 changes: 1 addition & 2 deletions arch/powerpc/kernel/hw_breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
length_max = 512 ; /* 64 doublewords */
/* DAWR region can't cross 512 boundary */
if ((bp->attr.bp_addr >> 10) !=
((bp->attr.bp_addr + bp->attr.bp_len - 1) >> 10))
((bp->attr.bp_addr + bp->attr.bp_len) >> 10))
return -EINVAL;
}
if (info->len >
Expand Down Expand Up @@ -250,7 +250,6 @@ int __kprobes hw_breakpoint_handler(struct die_args *args)
* we still need to single-step the instruction, but we don't
* generate an event.
*/
info->type &= ~HW_BRK_TYPE_EXTRANEOUS_IRQ;
if (!((bp->attr.bp_addr <= dar) &&
(dar - bp->attr.bp_addr < bp->attr.bp_len)))
info->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ;
Expand Down
4 changes: 1 addition & 3 deletions arch/powerpc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,9 +1449,7 @@ static long ppc_set_hwdebug(struct task_struct *child,
*/
if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) {
len = bp_info->addr2 - bp_info->addr;
} else if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT)
len = 1;
else {
} else if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) {
ptrace_put_breakpoints(child);
return -EINVAL;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/setup_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#endif

int boot_cpuid = 0;
int spinning_secondaries;
int __initdata spinning_secondaries;
u64 ppc64_pft_size;

/* Pick defaults since we might want to patch instructions
Expand Down
Loading

0 comments on commit 2471dc6

Please sign in to comment.