arm64: cpu_ops: fix a leaked reference by adding missing of_node_put
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 7/60 arm64: cpu_ops: fix a leaked reference by adding missing of_node_put
From: Wen Yang <[email protected]>
The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./arch/arm64/kernel/cpu_ops.c:102:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 69, but without a corresponding object release within this function.
--- arch/arm64/kernel/cpu_ops.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/cpu_ops.c +1 -0
@@ -85,6 +85,7 @@ static const char *__init cpu_read_enable_method(int cpu)pr_err ("%pOF: missing enable-method property\n" , dn); } +of_node_put (dn); }else { enable_method =acpi_get_enable_method (cpu);if (!enable_method) {
Signature · 1 line
2.19.1
PATCH 46/60 arm64: Clear OSDLR_EL1 on CPU boot
In reply to a message not in the archiveFrom: Jean-Philippe Brucker <[email protected]>
Some firmwares may reboot CPUs with OS Double Lock set. Make sure that it is unlocked, in order to use debug exceptions.
--- arch/arm64/kernel/debug-monitors.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/debug-monitors.c +1 -0
@@ -135,6 +135,7 @@ NOKPROBE_SYMBOL(disable_debug_monitors);*/ static int clear_os_lock (unsigned int cpu) { +write_sysreg (0 , osdlr_el1);write_sysreg (0 , oslar_el1);isb ();return 0 ;
Signature · 1 line
2.19.1
PATCH 47/60 arm64: Save and restore OSDLR_EL1 across suspend/resume
In reply to a message not in the archiveFrom: Jean-Philippe Brucker <[email protected]>
When the CPU comes out of suspend, the firmware may have modified the OS Double Lock Register. Save it in an unused slot of cpu_suspend_ctx, and restore it on resume.
--- arch/arm64/mm/proc.S | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)
arch/arm64/mm/proc.S +18 -16
@@ -65,24 +65,25 @@ ENTRY(cpu_do_suspend) mrs x2, tpidr_el0 mrs x3, tpidrro_el0 mrs x4, contextidr_el1 - mrs x5, cpacr_el1 - mrs x6, tcr_el1 - mrs x7, vbar_el1 - mrs x8, mdscr_el1 - mrs x9, oslsr_el1 - mrs x10, sctlr_el1 + mrs x5, osdlr_el1 + mrs x6, cpacr_el1 + mrs x7, tcr_el1 + mrs x8, vbar_el1 + mrs x9, mdscr_el1 + mrs x10, oslsr_el1 + mrs x11, sctlr_el1 alternative_if_not ARM64_HAS_VIRT_HOST_EXTN - mrs x11, tpidr_el1 + mrs x12, tpidr_el1 alternative_else - mrs x11, tpidr_el2 + mrs x12, tpidr_el2 alternative_endif - mrs x12, sp_el0 + mrs x13, sp_el0 stp x2, x3, [x0] - stp x4, xzr, [x0, #16] - stp x5, x6, [x0, #32] - stp x7, x8, [x0, #48] - stp x9, x10, [x0, #64] - stp x11, x12, [x0, #80] + stp x4, x5, [x0, #16] + stp x6, x7, [x0, #32] + stp x8, x9, [x0, #48] + stp x10, x11, [x0, #64] + stp x12, x13, [x0, #80] ret ENDPROC(cpu_do_suspend)
@@ -105,8 +106,8 @@ ENTRY(cpu_do_resume) msr cpacr_el1, x6 /* Don't change t0sz here, mask those bits when restoring */ - mrs x5, tcr_el1 - bfi x8, x5, TCR_T0SZ_OFFSET, TCR_TxSZ_WIDTH + mrs x7, tcr_el1 + bfi x8, x7, TCR_T0SZ_OFFSET, TCR_TxSZ_WIDTH msr tcr_el1, x8 msr vbar_el1, x9
@@ -130,6 +131,7 @@ alternative_endif /* * Restore oslsr_el1 by writing oslar_el1 */ + msr osdlr_el1, x5 ubfx x11, x11, #1, #1 msr oslar_el1, x11 reset_pmuserenr_el0 x0 // Disable PMU access from EL0
Signature · 1 line
2.19.1