All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes
@ 2016-12-14 14:39 Andrew Jones
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 1/5] arm/pci-test: skip on pci/pci-testdev probe failure Andrew Jones
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Andrew Jones @ 2016-12-14 14:39 UTC (permalink / raw)
  To: kvm; +Cc: andre.przywara

Fix1, patches   1: SKIP if pci-testdev isn't available rather than FAIL
Fix2, patches 4,5: 64-bit MPIDRs will have 2 32-bit regs in DT
Fix3, patches 2,3: While doing Fix2 I noticed a need for different/strict
                   setup order

Andrew Jones (5):
  arm/pci-test: skip on pci/pci-testdev probe failure
  lib/arm/setup: fix and comment init order
  lib/powerpc/setup: comment init dependencies
  devicetree: cpu nodes may have 64-bit regs
  arm/arm64: support 64-bit MPIDRs

 lib/arm/asm/processor.h   |  2 +-
 lib/arm/asm/setup.h       |  2 +-
 lib/arm64/asm/processor.h |  2 +-
 lib/devicetree.h          |  2 +-
 lib/arm/setup.c           | 13 +++++++++----
 lib/devicetree.c          |  9 +++++++--
 lib/powerpc/setup.c       |  6 +++++-
 lib/powerpc/smp.c         |  2 +-
 arm/pci-test.c            | 13 +++++++++----
 powerpc/tm.c              |  2 +-
 10 files changed, 36 insertions(+), 17 deletions(-)

-- 
2.9.3


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH kvm-unit-tests 1/5] arm/pci-test: skip on pci/pci-testdev probe failure
  2016-12-14 14:39 [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones
@ 2016-12-14 14:39 ` Andrew Jones
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 2/5] lib/arm/setup: fix and comment init order Andrew Jones
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Jones @ 2016-12-14 14:39 UTC (permalink / raw)
  To: kvm; +Cc: andre.przywara, Alexander Gordeev

Some configurations don't have pci or pci-testdev. This patch
avoids saying FAIL in those cases. Instead we get SKIP.

Cc: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 arm/pci-test.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arm/pci-test.c b/arm/pci-test.c
index 10a367de5357..cf128ac1b032 100644
--- a/arm/pci-test.c
+++ b/arm/pci-test.c
@@ -14,14 +14,19 @@ int main(void)
 {
 	int ret;
 
-	if (!pci_probe())
-		report_abort("PCI bus probing failed\n");
+	if (!pci_probe()) {
+		printf("PCI bus probing failed, skipping tests...\n");
+		return report_summary();
+	}
 
 	pci_print();
 
 	ret = pci_testdev();
-	report("PCI test device passed %d/%d tests",
-		ret >= NR_TESTS, ret > 0 ? ret : 0, NR_TESTS);
+	if (ret == -1)
+		report_skip("No PCI test device");
+	else
+		report("PCI test device passed %d/%d tests",
+			ret >= NR_TESTS, ret > 0 ? ret : 0, NR_TESTS);
 
 	return report_summary();
 }
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH kvm-unit-tests 2/5] lib/arm/setup: fix and comment init order
  2016-12-14 14:39 [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 1/5] arm/pci-test: skip on pci/pci-testdev probe failure Andrew Jones
@ 2016-12-14 14:39 ` Andrew Jones
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 3/5] lib/powerpc/setup: comment init dependencies Andrew Jones
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Jones @ 2016-12-14 14:39 UTC (permalink / raw)
  To: kvm; +Cc: andre.przywara

While reading code I noticed we need to call thread_info_init before
mem_init to be correct. In practice it hasn't mattered because cpu0
is calling mem_init, and it's cpu index is 0, which is what a fresh
first boot would have it be anyway. With reset tests (coming soon)
combined with mmu tests (hopefully coming someday) it could be
problematic though, so let's fix it. Additionally comment the order
to make sure we maintain it. The io_init dependency on mem_init is
because io_init calls init functions that make use of heap allocation.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/arm/setup.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/arm/setup.c b/lib/arm/setup.c
index e52a25abd722..1751c3997c53 100644
--- a/lib/arm/setup.c
+++ b/lib/arm/setup.c
@@ -126,12 +126,17 @@ void setup(const void *fdt)
 	ret = dt_init(&stacktop);
 	assert(ret == 0);
 
-	mem_init(PAGE_ALIGN((unsigned long)&stacktop + fdt_size));
-	io_init();
 	cpu_init();
 
+	/* cpu_init must be called before thread_info_init */
 	thread_info_init(current_thread_info(), 0);
 
+	/* thread_info_init must be called before mem_init */
+	mem_init(PAGE_ALIGN((unsigned long)&stacktop + fdt_size));
+
+	/* mem_init must be called before io_init */
+	io_init();
+
 	ret = dt_get_bootargs(&bootargs);
 	assert(ret == 0);
 	setup_args_progname(bootargs);
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH kvm-unit-tests 3/5] lib/powerpc/setup: comment init dependencies
  2016-12-14 14:39 [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 1/5] arm/pci-test: skip on pci/pci-testdev probe failure Andrew Jones
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 2/5] lib/arm/setup: fix and comment init order Andrew Jones
@ 2016-12-14 14:39 ` Andrew Jones
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 4/5] devicetree: cpu nodes may have 64-bit regs Andrew Jones
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Jones @ 2016-12-14 14:39 UTC (permalink / raw)
  To: kvm; +Cc: andre.przywara, Laurent Vivier, Thomas Huth

cpu_init must be called before mem_init because cpu_init determines
the cache-line sizes. Currently io_init has no dependency on
mem_init, but io_init should be allowed to use heap allocation,
and someday it may, so we proactively comment it.

Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/powerpc/setup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c
index 9153f7bebc6a..0e776235e22d 100644
--- a/lib/powerpc/setup.c
+++ b/lib/powerpc/setup.c
@@ -168,7 +168,11 @@ void setup(const void *fdt)
 	assert(ret == 0);
 
 	cpu_init();
+
+	/* cpu_init must be called before mem_init */
 	mem_init(PAGE_ALIGN((unsigned long)&stacktop + fdt_size));
+
+	/* mem_init must be called before io_init */
 	io_init();
 
 	ret = dt_get_bootargs(&bootargs);
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH kvm-unit-tests 4/5] devicetree: cpu nodes may have 64-bit regs
  2016-12-14 14:39 [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones
                   ` (2 preceding siblings ...)
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 3/5] lib/powerpc/setup: comment init dependencies Andrew Jones
@ 2016-12-14 14:39 ` Andrew Jones
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 5/5] arm/arm64: support 64-bit MPIDRs Andrew Jones
  2016-12-19 14:39 ` [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Jones @ 2016-12-14 14:39 UTC (permalink / raw)
  To: kvm; +Cc: andre.przywara, Laurent Vivier, Thomas Huth

Reported-by: Andre Przywara <andre.przywara@arm.com>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH kvm-unit-tests 5/5] arm/arm64: support 64-bit MPIDRs
  2016-12-14 14:39 [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones
                   ` (3 preceding siblings ...)
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 4/5] devicetree: cpu nodes may have 64-bit regs Andrew Jones
@ 2016-12-14 14:39 ` Andrew Jones
  2016-12-19 14:39 ` [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Jones @ 2016-12-14 14:39 UTC (permalink / raw)
  To: kvm; +Cc: andre.przywara

Reported-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/arm/asm/processor.h   | 2 +-
 lib/arm/asm/setup.h       | 2 +-
 lib/arm64/asm/processor.h | 2 +-
 lib/arm/setup.c           | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/arm/asm/processor.h b/lib/arm/asm/processor.h
index 6dc1472468dd..a8c4628da818 100644
--- a/lib/arm/asm/processor.h
+++ b/lib/arm/asm/processor.h
@@ -46,7 +46,7 @@ static inline void local_irq_disable(void)
 }
 
 #define MPIDR __ACCESS_CP15(c0, 0, c0, 5)
-static inline unsigned int get_mpidr(void)
+static inline uint64_t get_mpidr(void)
 {
 	return read_sysreg(MPIDR);
 }
diff --git a/lib/arm/asm/setup.h b/lib/arm/asm/setup.h
index 1de99dd184d1..b0d51f5f0721 100644
--- a/lib/arm/asm/setup.h
+++ b/lib/arm/asm/setup.h
@@ -11,7 +11,7 @@
 #include <asm/pgtable-hwdef.h>
 
 #define NR_CPUS			255
-extern u32 cpus[NR_CPUS];	/* per-cpu IDs (MPIDRs) */
+extern u64 cpus[NR_CPUS];	/* per-cpu IDs (MPIDRs) */
 extern int nr_cpus;
 
 #define NR_MEM_REGIONS		8
diff --git a/lib/arm64/asm/processor.h b/lib/arm64/asm/processor.h
index f42f15c79d43..1d9223f728a5 100644
--- a/lib/arm64/asm/processor.h
+++ b/lib/arm64/asm/processor.h
@@ -78,7 +78,7 @@ static inline void local_irq_disable(void)
 	asm volatile("msr daifset, #2" : : : "memory");
 }
 
-static inline unsigned int get_mpidr(void)
+static inline uint64_t get_mpidr(void)
 {
 	return read_sysreg(mpidr_el1);
 }
diff --git a/lib/arm/setup.c b/lib/arm/setup.c
index ac3fadb07828..68eae91286d6 100644
--- a/lib/arm/setup.c
+++ b/lib/arm/setup.c
@@ -24,7 +24,7 @@ extern unsigned long stacktop;
 extern void io_init(void);
 extern void setup_args_progname(const char *args);
 
-u32 cpus[NR_CPUS] = { [0 ... NR_CPUS-1] = (~0U) };
+u64 cpus[NR_CPUS] = { [0 ... NR_CPUS-1] = (u64)~0 };
 int nr_cpus;
 
 struct mem_region mem_regions[NR_MEM_REGIONS];
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes
  2016-12-14 14:39 [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones
                   ` (4 preceding siblings ...)
  2016-12-14 14:39 ` [PATCH kvm-unit-tests 5/5] arm/arm64: support 64-bit MPIDRs Andrew Jones
@ 2016-12-19 14:39 ` Andrew Jones
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Jones @ 2016-12-19 14:39 UTC (permalink / raw)
  To: kvm; +Cc: andre.przywara

On Wed, Dec 14, 2016 at 03:39:49PM +0100, Andrew Jones wrote:
> Fix1, patches   1: SKIP if pci-testdev isn't available rather than FAIL
> Fix2, patches 4,5: 64-bit MPIDRs will have 2 32-bit regs in DT
> Fix3, patches 2,3: While doing Fix2 I noticed a need for different/strict
>                    setup order
> 
> Andrew Jones (5):
>   arm/pci-test: skip on pci/pci-testdev probe failure
>   lib/arm/setup: fix and comment init order
>   lib/powerpc/setup: comment init dependencies
>   devicetree: cpu nodes may have 64-bit regs
>   arm/arm64: support 64-bit MPIDRs
> 
>  lib/arm/asm/processor.h   |  2 +-
>  lib/arm/asm/setup.h       |  2 +-
>  lib/arm64/asm/processor.h |  2 +-
>  lib/devicetree.h          |  2 +-
>  lib/arm/setup.c           | 13 +++++++++----
>  lib/devicetree.c          |  9 +++++++--
>  lib/powerpc/setup.c       |  6 +++++-
>  lib/powerpc/smp.c         |  2 +-
>  arm/pci-test.c            | 13 +++++++++----
>  powerpc/tm.c              |  2 +-
>  10 files changed, 36 insertions(+), 17 deletions(-)
> 
> -- 
> 2.9.3
>

Applied to arm/next

Thanks,
drew

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-12-19 14:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-14 14:39 [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones
2016-12-14 14:39 ` [PATCH kvm-unit-tests 1/5] arm/pci-test: skip on pci/pci-testdev probe failure Andrew Jones
2016-12-14 14:39 ` [PATCH kvm-unit-tests 2/5] lib/arm/setup: fix and comment init order Andrew Jones
2016-12-14 14:39 ` [PATCH kvm-unit-tests 3/5] lib/powerpc/setup: comment init dependencies Andrew Jones
2016-12-14 14:39 ` [PATCH kvm-unit-tests 4/5] devicetree: cpu nodes may have 64-bit regs Andrew Jones
2016-12-14 14:39 ` [PATCH kvm-unit-tests 5/5] arm/arm64: support 64-bit MPIDRs Andrew Jones
2016-12-19 14:39 ` [PATCH kvm-unit-tests 0/5] arm/arm64: few fixes Andrew Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.