diff mbox series

[U-Boot] sandbox: fix cpu property in test.dts for pytest

Message ID 20190827081703.8082-1-takahiro.akashi@linaro.org
State Accepted
Commit 073e6d65d138edd015ece4d94dcfe2a3e00dccde
Delegated to: Simon Glass
Headers show
Series [U-Boot] sandbox: fix cpu property in test.dts for pytest | expand

Commit Message

AKASHI Takahiro Aug. 27, 2019, 8:17 a.m. UTC
When I tried to run some new efi tests with pytest, efi_smbios_register()
triggered a segmentation fault. Here is the location where it happened:
efi_init_obj_list()
  efi_smbios_register()
    write_smbios_table()
      smbios_write_type4()
        smbios_write_type4_dm()

where dev_get_parent_platdata() should return a pointer to struct
cpu_platdata, but it is actually NULL because any cpu device on
sandbox is attached to "root_driver."

With this patch, this issue will be fixed by moving all the definitions
of cpus under "cpus" node so that they have a "cpu_bus" parent.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 arch/sandbox/dts/test.dts | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

Comments

Bin Meng Aug. 27, 2019, 8:43 a.m. UTC | #1
On Tue, Aug 27, 2019 at 4:15 PM AKASHI Takahiro
<takahiro.akashi@linaro.org> wrote:
>
> When I tried to run some new efi tests with pytest, efi_smbios_register()
> triggered a segmentation fault. Here is the location where it happened:
> efi_init_obj_list()
>   efi_smbios_register()
>     write_smbios_table()
>       smbios_write_type4()
>         smbios_write_type4_dm()
>
> where dev_get_parent_platdata() should return a pointer to struct
> cpu_platdata, but it is actually NULL because any cpu device on
> sandbox is attached to "root_driver."
>
> With this patch, this issue will be fixed by moving all the definitions
> of cpus under "cpus" node so that they have a "cpu_bus" parent.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  arch/sandbox/dts/test.dts | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Simon Glass Sept. 17, 2019, 5:47 a.m. UTC | #2
On Tue, 27 Aug 2019 at 02:43, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Tue, Aug 27, 2019 at 4:15 PM AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> >
> > When I tried to run some new efi tests with pytest, efi_smbios_register()
> > triggered a segmentation fault. Here is the location where it happened:
> > efi_init_obj_list()
> >   efi_smbios_register()
> >     write_smbios_table()
> >       smbios_write_type4()
> >         smbios_write_type4_dm()
> >
> > where dev_get_parent_platdata() should return a pointer to struct
> > cpu_platdata, but it is actually NULL because any cpu device on
> > sandbox is attached to "root_driver."
> >
> > With this patch, this issue will be fixed by moving all the definitions
> > of cpus under "cpus" node so that they have a "cpu_bus" parent.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  arch/sandbox/dts/test.dts | 24 +++++++++++++-----------
> >  1 file changed, 13 insertions(+), 11 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Reviewed-by: Simon Glass <sjg@chromium.org>

I assume that all tests still pass?


- Simon
Simon Glass Sept. 27, 2019, 11:28 p.m. UTC | #3
On Tue, 27 Aug 2019 at 02:43, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Tue, Aug 27, 2019 at 4:15 PM AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> >
> > When I tried to run some new efi tests with pytest, efi_smbios_register()
> > triggered a segmentation fault. Here is the location where it happened:
> > efi_init_obj_list()
> >   efi_smbios_register()
> >     write_smbios_table()
> >       smbios_write_type4()
> >         smbios_write_type4_dm()
> >
> > where dev_get_parent_platdata() should return a pointer to struct
> > cpu_platdata, but it is actually NULL because any cpu device on
> > sandbox is attached to "root_driver."
> >
> > With this patch, this issue will be fixed by moving all the definitions
> > of cpus under "cpus" node so that they have a "cpu_bus" parent.
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  arch/sandbox/dts/test.dts | 24 +++++++++++++-----------
> >  1 file changed, 13 insertions(+), 11 deletions(-)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Reviewed-by: Simon Glass <sjg@chromium.org>

I assume that all tests still pass?


- Simon

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 27b0baab2781..c549d9e50fb8 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -389,19 +389,21 @@ 
 		mbox-names = "other", "test";
 	};
 
-	cpu-test1 {
-		compatible = "sandbox,cpu_sandbox";
-		u-boot,dm-pre-reloc;
-	};
+	cpus {
+		cpu-test1 {
+			compatible = "sandbox,cpu_sandbox";
+			u-boot,dm-pre-reloc;
+		};
 
-	cpu-test2 {
-		compatible = "sandbox,cpu_sandbox";
-		u-boot,dm-pre-reloc;
-	};
+		cpu-test2 {
+			compatible = "sandbox,cpu_sandbox";
+			u-boot,dm-pre-reloc;
+		};
 
-	cpu-test3 {
-		compatible = "sandbox,cpu_sandbox";
-		u-boot,dm-pre-reloc;
+		cpu-test3 {
+			compatible = "sandbox,cpu_sandbox";
+			u-boot,dm-pre-reloc;
+		};
 	};
 
 	i2s: i2s {