kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] devicetree: Fix the dt_for_each_cpu_node
@ 2019-12-27 11:03 Zeng Tao
  2019-12-27 11:35 ` Andrew Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Zeng Tao @ 2019-12-27 11:03 UTC (permalink / raw)
  To: pbonzini, drjones; +Cc: kvm, xuwei5, huangdaode, linuxarm, Zeng Tao

If the /cpus node contains nodes other than /cpus/cpu*, for example:
/cpus/cpu-map/. The test will issue an unexpected assert error as
follow:
[root@localhost]# ./arm-run arm/spinlock-test.flat
qemu-system-aarch64 -nodefaults -machine virt,gic-version=host,accel=kvm
 -cpu host -device virtio-serial-device -device virtconsole,chardev=ctd
-chardev testdev,id=ctd -device pci-testdev -display none -serial stdio
-kernel arm/spinlock-test.flat # -initrd /tmp/tmp.mwPLiF4EWm
lib/arm/setup.c:64: assert failed: ret == 0
        STACK:

In this patch, ignore the non-cpu subnodes instead of return an error.

Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
---
 lib/devicetree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/devicetree.c b/lib/devicetree.c
index 2b89178..1020324 100644
--- a/lib/devicetree.c
+++ b/lib/devicetree.c
@@ -225,7 +225,7 @@ int dt_for_each_cpu_node(void (*func)(int fdtnode, u64 regval, void *info),
 
 		prop = fdt_get_property(fdt, cpu, "device_type", &len);
 		if (prop == NULL)
-			return len;
+			continue;
 
 		if (len != 4 || strcmp((char *)prop->data, "cpu"))
 			continue;
-- 
1.8.3.1


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

* Re: [kvm-unit-tests PATCH] devicetree: Fix the dt_for_each_cpu_node
  2019-12-27 11:03 [kvm-unit-tests PATCH] devicetree: Fix the dt_for_each_cpu_node Zeng Tao
@ 2019-12-27 11:35 ` Andrew Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Jones @ 2019-12-27 11:35 UTC (permalink / raw)
  To: Zeng Tao; +Cc: pbonzini, kvm, xuwei5, huangdaode, linuxarm

On Fri, Dec 27, 2019 at 07:03:35PM +0800, Zeng Tao wrote:
> If the /cpus node contains nodes other than /cpus/cpu*, for example:
> /cpus/cpu-map/. The test will issue an unexpected assert error as
> follow:
> [root@localhost]# ./arm-run arm/spinlock-test.flat
> qemu-system-aarch64 -nodefaults -machine virt,gic-version=host,accel=kvm
>  -cpu host -device virtio-serial-device -device virtconsole,chardev=ctd
> -chardev testdev,id=ctd -device pci-testdev -display none -serial stdio
> -kernel arm/spinlock-test.flat # -initrd /tmp/tmp.mwPLiF4EWm
> lib/arm/setup.c:64: assert failed: ret == 0
>         STACK:
> 
> In this patch, ignore the non-cpu subnodes instead of return an error.
> 
> Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
> ---
>  lib/devicetree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/devicetree.c b/lib/devicetree.c
> index 2b89178..1020324 100644
> --- a/lib/devicetree.c
> +++ b/lib/devicetree.c
> @@ -225,7 +225,7 @@ int dt_for_each_cpu_node(void (*func)(int fdtnode, u64 regval, void *info),
>  
>  		prop = fdt_get_property(fdt, cpu, "device_type", &len);
>  		if (prop == NULL)
> -			return len;
> +			continue;
>  
>  		if (len != 4 || strcmp((char *)prop->data, "cpu"))
>  			continue;
> -- 
> 1.8.3.1
>

Queued to https://github.com/rhdrjones/kvm-unit-tests/commits/arm/queue

I'll send a pull request to Paolo soon.

Thanks,
drew


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

end of thread, other threads:[~2019-12-27 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-27 11:03 [kvm-unit-tests PATCH] devicetree: Fix the dt_for_each_cpu_node Zeng Tao
2019-12-27 11:35 ` Andrew Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).