Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/pseries: Fix endian issues in /proc/ppc64/lparcfg

Some obvious issues:

cat /proc/ppc64/lparcfg
...
partition_id=16777216
...
partition_potential_processors=268435456

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Anton Blanchard and committed by
Benjamin Herrenschmidt
ca5de4e6 f8a1883a

+6 -6
+6 -6
arch/powerpc/platforms/pseries/lparcfg.c
··· 157 157 { 158 158 struct hvcall_ppp_data ppp_data; 159 159 struct device_node *root; 160 - const int *perf_level; 160 + const __be32 *perf_level; 161 161 int rc; 162 162 163 163 rc = h_get_ppp(&ppp_data); ··· 201 201 perf_level = of_get_property(root, 202 202 "ibm,partition-performance-parameters-level", 203 203 NULL); 204 - if (perf_level && (*perf_level >= 1)) { 204 + if (perf_level && (be32_to_cpup(perf_level) >= 1)) { 205 205 seq_printf(m, 206 206 "physical_procs_allocated_to_virtualization=%d\n", 207 207 ppp_data.phys_platform_procs); ··· 435 435 int partition_potential_processors; 436 436 int partition_active_processors; 437 437 struct device_node *rtas_node; 438 - const int *lrdrp = NULL; 438 + const __be32 *lrdrp = NULL; 439 439 440 440 rtas_node = of_find_node_by_path("/rtas"); 441 441 if (rtas_node) ··· 444 444 if (lrdrp == NULL) { 445 445 partition_potential_processors = vdso_data->processorCount; 446 446 } else { 447 - partition_potential_processors = *(lrdrp + 4); 447 + partition_potential_processors = be32_to_cpup(lrdrp + 4); 448 448 } 449 449 of_node_put(rtas_node); 450 450 ··· 654 654 const char *model = ""; 655 655 const char *system_id = ""; 656 656 const char *tmp; 657 - const unsigned int *lp_index_ptr; 657 + const __be32 *lp_index_ptr; 658 658 unsigned int lp_index = 0; 659 659 660 660 seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS); ··· 670 670 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no", 671 671 NULL); 672 672 if (lp_index_ptr) 673 - lp_index = *lp_index_ptr; 673 + lp_index = be32_to_cpup(lp_index_ptr); 674 674 of_node_put(rootdn); 675 675 } 676 676 seq_printf(m, "serial_number=%s\n", system_id);