Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c65698c authored by Razziell's avatar Razziell
Browse files

HACK: arm64: add CNTPCT_EL0 trap handler

The upstream kernel deliberately blocks EL0 access to CNTPCT.  However
Qualcomm's time_daemon attempts to read from CNTPCT_EL0, and Qualcomm
has forked the ARM architectured timer driver to allow this to succeed.

As a workaround, add a trap handler for CNTPCT similar to the existing
one for CNTVCT.

Bug: 68266545
Change-Id: Id49b60ebdeca84fab655079c8c22afd3171371b0 (reverted from commit 5495a952)
parent 96e24a28
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -419,19 +419,6 @@ static void cntfrq_read_handler(unsigned int esr, struct pt_regs *regs)
	regs->pc += 4;
}

static void cntpct_read_handler(unsigned int esr, struct pt_regs *regs)
{
	int rt = (esr & ESR_ELx_SYS64_ISS_RT_MASK) >> ESR_ELx_SYS64_ISS_RT_SHIFT;

	isb();
	if (rt != 31)
		regs->regs[rt] = arch_counter_get_cntpct();
	regs->pc += 4;
}

#define ESR_ELx_SYS64_ISS_SYS_CNTPCT    (ESR_ELx_SYS64_ISS_SYS_VAL(3, 3, 1, 14, 0) | \
                                         ESR_ELx_SYS64_ISS_DIR_READ)

asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs)
{
	if ((esr & ESR_ELx_SYS64_ISS_SYS_OP_MASK) == ESR_ELx_SYS64_ISS_SYS_CNTVCT) {
@@ -440,9 +427,6 @@ asmlinkage void __exception do_sysinstr(unsigned int esr, struct pt_regs *regs)
	} else if ((esr & ESR_ELx_SYS64_ISS_SYS_OP_MASK) == ESR_ELx_SYS64_ISS_SYS_CNTFRQ) {
		cntfrq_read_handler(esr, regs);
		return;
	} else if ((esr & ESR_ELx_SYS64_ISS_SYS_OP_MASK) == ESR_ELx_SYS64_ISS_SYS_CNTPCT) {
		cntpct_read_handler(esr, regs);
		return;
	}

	do_undefinstr(regs);