Re: [PATCHv4] powerpc/timer - large decrementer support
flat view
From: oliver <oohall@gmail.com>
Date: 2016-06-23 08:21:27
On Thu, Jun 23, 2016 at 6:02 PM, Denis Kirjanov [off-list ref] wrote:
On 6/23/16, Oliver O'Halloran [off-list ref] wrote:quoted
+static void __init set_decrementer_max(void) +{ + struct device_node *cpu; + const __be32 *fp; + u64 bits = 32; + + /* Prior to ISAv3 the decrementer is always 32 bit */ + if (!cpu_has_feature(CPU_FTR_ARCH_300)) + return; + + cpu = of_find_node_by_type(NULL, "cpu"); + if (cpu) + fp = of_get_property(cpu, "ibm,dec-bits", NULL); + + if (cpu && fp) { + bits = of_read_number(fp, 1); + + if (bits > 64 || bits < 32) { + pr_warn("time_init: firmware supplied invalid ibm,dec-bits"); + bits = 32; + } + + + /* calculate the signed maximum given this many bits */ + decrementer_max = (1ul << (bits - 1)) - 1; + } + + pr_info("time_init: %llu bit decrementer (max: %llx)\n", + bits, decrementer_max); +}the call to of_node_put(cpu) is missing in the function.
Well spotted, thanks.