[PATCH kvm-unit-tests 4/5] devicetree: cpu nodes may have 64-bit regs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reported-by: Andre Przywara <andre.przywara@xxxxxxx>
Cc: Laurent Vivier <lvivier@xxxxxxxxxx>
Cc: Thomas Huth <thuth@xxxxxxxxxx>
Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 lib/devicetree.h    | 2 +-
 lib/arm/setup.c     | 2 +-
 lib/devicetree.c    | 9 +++++++--
 lib/powerpc/setup.c | 2 +-
 lib/powerpc/smp.c   | 2 +-
 powerpc/tm.c        | 2 +-
 6 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/lib/devicetree.h b/lib/devicetree.h
index 315ba948e7cc..0083587633d4 100644
--- a/lib/devicetree.h
+++ b/lib/devicetree.h
@@ -234,7 +234,7 @@ extern int dt_get_memory_params(struct dt_pbus_reg *regs, int nr_regs);
  *  - zero on success
  *  - a negative FDT_ERR_* value on failure
  */
-extern int dt_for_each_cpu_node(void (*func)(int fdtnode, u32 regval,
+extern int dt_for_each_cpu_node(void (*func)(int fdtnode, u64 regval,
 				void *info), void *info);
 
 #endif /* _DEVICETREE_H_ */
diff --git a/lib/arm/setup.c b/lib/arm/setup.c
index 1751c3997c53..ac3fadb07828 100644
--- a/lib/arm/setup.c
+++ b/lib/arm/setup.c
@@ -40,7 +40,7 @@ int mpidr_to_cpu(uint64_t mpidr)
 	return -1;
 }
 
-static void cpu_set(int fdtnode __unused, u32 regval, void *info __unused)
+static void cpu_set(int fdtnode __unused, u64 regval, void *info __unused)
 {
 	int cpu = nr_cpus++;
 
diff --git a/lib/devicetree.c b/lib/devicetree.c
index 26232a3e61ab..671c64a2ca51 100644
--- a/lib/devicetree.c
+++ b/lib/devicetree.c
@@ -202,13 +202,14 @@ int dt_get_memory_params(struct dt_pbus_reg *regs, int nr_regs)
 	return node != -FDT_ERR_NOTFOUND ? node : nr;
 }
 
-int dt_for_each_cpu_node(void (*func)(int fdtnode, u32 regval, void *info),
+int dt_for_each_cpu_node(void (*func)(int fdtnode, u64 regval, void *info),
 			 void *info)
 {
 	const struct fdt_property *prop;
 	int cpus, cpu, ret, len;
 	struct dt_reg raw_reg;
 	u32 nac, nsc;
+	u64 regval;
 
 	cpus = fdt_path_offset(fdt, "/cpus");
 	if (cpus < 0)
@@ -233,7 +234,11 @@ int dt_for_each_cpu_node(void (*func)(int fdtnode, u32 regval, void *info),
 		if (ret < 0)
 			return ret;
 
-		func(cpu, raw_reg.address_cells[0], info);
+		regval = raw_reg.address_cells[0];
+		if (nac == 2)
+			regval = (regval << 32) | raw_reg.address_cells[1];
+
+		func(cpu, regval, info);
 	}
 
 	return 0;
diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c
index 0e776235e22d..d56de36410c7 100644
--- a/lib/powerpc/setup.c
+++ b/lib/powerpc/setup.c
@@ -40,7 +40,7 @@ struct cpu_set_params {
 
 static char exception_stack[NR_CPUS][EXCEPTION_STACK_SIZE];
 
-static void cpu_set(int fdtnode, u32 regval, void *info)
+static void cpu_set(int fdtnode, u64 regval, void *info)
 {
 	static bool read_common_info = false;
 	struct cpu_set_params *params = info;
diff --git a/lib/powerpc/smp.c b/lib/powerpc/smp.c
index 946ad26b12ae..e18894bb17e8 100644
--- a/lib/powerpc/smp.c
+++ b/lib/powerpc/smp.c
@@ -75,7 +75,7 @@ struct start_threads start_cpu(int cpu_node, secondary_entry_fn entry,
 	return (struct start_threads) { nr_threads, nr_started };
 }
 
-static void start_each_secondary(int fdtnode, u32 regval __unused, void *info)
+static void start_each_secondary(int fdtnode, u64 regval __unused, void *info)
 {
 	struct secondary_entry_data *datap = info;
 	struct start_threads ret = start_cpu(fdtnode, datap->entry, datap->r3);
diff --git a/powerpc/tm.c b/powerpc/tm.c
index b611061209e8..ff7b2f957a37 100644
--- a/powerpc/tm.c
+++ b/powerpc/tm.c
@@ -14,7 +14,7 @@
 #include <devicetree.h>
 
 /* Check "ibm,pa-features" property of a CPU node for the TM flag */
-static void cpu_has_tm(int fdtnode, u32 regval __unused, void *ptr)
+static void cpu_has_tm(int fdtnode, u64 regval __unused, void *ptr)
 {
 	const struct fdt_property *prop;
 	int plen;
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux