diff mbox series

[U-Boot,v12,1/6] sandbox: Put CPUs under a cpu-bus node

Message ID 20181106225744.139945-2-sjg@chromium.org
State Accepted
Delegated to: Alexander Graf
Headers show
Series efi_loader: Code refactoring and improvement | expand

Commit Message

Simon Glass Nov. 6, 2018, 10:57 p.m. UTC
The CPU uclass expects that all CPUs have a parent device which is a
cpu-bus. Fix up the sandbox test DT to follow this convention. This allow
the code in smbios_write_type4_dm() to work, since it calls
dev_get_parent_platdata() on each CPU.

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

Changes in v12:
- Update CPU nodes to comply with the DT spec

Changes in v11:
- Add a new patch to put CPUs under a cpu-bus node

Changes in v9: None
Changes in v7: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 arch/sandbox/dts/test.dts | 38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)

Comments

Alexander Graf Nov. 13, 2018, 10:23 p.m. UTC | #1
> The CPU uclass expects that all CPUs have a parent device which is a
> cpu-bus. Fix up the sandbox test DT to follow this convention. This allow
> the code in smbios_write_type4_dm() to work, since it calls
> dev_get_parent_platdata() on each CPU.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Thanks, applied to efi-next

Alex
Alexander Graf Nov. 14, 2018, 8:34 a.m. UTC | #2
On 11/06/2018 11:57 PM, Simon Glass wrote:
> The CPU uclass expects that all CPUs have a parent device which is a
> cpu-bus. Fix up the sandbox test DT to follow this convention. This allow
> the code in smbios_write_type4_dm() to work, since it calls
> dev_get_parent_platdata() on each CPU.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

This patch breaks the built-in unit tests:

=> ut dm cpu
Test: dm_test_cpu: cpu.c
test/dm/cpu.c:28, dm_test_cpu(): 0 == 
uclass_get_device_by_name(UCLASS_CPU, "cpu-test1", &dev): Expected 0, 
got -19
Test: dm_test_cpu: cpu.c (flat tree)
test/dm/cpu.c:28, dm_test_cpu(): 0 == 
uclass_get_device_by_name(UCLASS_CPU, "cpu-test1", &dev): Expected 0, 
got -19
Failures: 2


I'll remove it from my queue again.

Alex
Simon Glass Nov. 15, 2018, 8:01 p.m. UTC | #3
Hi Alex,

On 14 November 2018 at 00:34, Alexander Graf <agraf@suse.de> wrote:
> On 11/06/2018 11:57 PM, Simon Glass wrote:
>>
>> The CPU uclass expects that all CPUs have a parent device which is a
>> cpu-bus. Fix up the sandbox test DT to follow this convention. This allow
>> the code in smbios_write_type4_dm() to work, since it calls
>> dev_get_parent_platdata() on each CPU.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
>
> This patch breaks the built-in unit tests:
>
> => ut dm cpu
> Test: dm_test_cpu: cpu.c
> test/dm/cpu.c:28, dm_test_cpu(): 0 == uclass_get_device_by_name(UCLASS_CPU,
> "cpu-test1", &dev): Expected 0, got -19
> Test: dm_test_cpu: cpu.c (flat tree)
> test/dm/cpu.c:28, dm_test_cpu(): 0 == uclass_get_device_by_name(UCLASS_CPU,
> "cpu-test1", &dev): Expected 0, got -19
> Failures: 2
>
>
> I'll remove it from my queue again.

Yes unfortunately there was a revert on master which affected this I think.

I can pick this one up once things land.

Regards,
Simon
Alexander Graf Nov. 15, 2018, 8:05 p.m. UTC | #4
On 15.11.18 21:01, Simon Glass wrote:
> Hi Alex,
> 
> On 14 November 2018 at 00:34, Alexander Graf <agraf@suse.de> wrote:
>> On 11/06/2018 11:57 PM, Simon Glass wrote:
>>>
>>> The CPU uclass expects that all CPUs have a parent device which is a
>>> cpu-bus. Fix up the sandbox test DT to follow this convention. This allow
>>> the code in smbios_write_type4_dm() to work, since it calls
>>> dev_get_parent_platdata() on each CPU.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>
>>
>> This patch breaks the built-in unit tests:
>>
>> => ut dm cpu
>> Test: dm_test_cpu: cpu.c
>> test/dm/cpu.c:28, dm_test_cpu(): 0 == uclass_get_device_by_name(UCLASS_CPU,
>> "cpu-test1", &dev): Expected 0, got -19
>> Test: dm_test_cpu: cpu.c (flat tree)
>> test/dm/cpu.c:28, dm_test_cpu(): 0 == uclass_get_device_by_name(UCLASS_CPU,
>> "cpu-test1", &dev): Expected 0, got -19
>> Failures: 2
>>
>>
>> I'll remove it from my queue again.
> 
> Yes unfortunately there was a revert on master which affected this I think.
> 
> I can pick this one up once things land.

I'd appreciate that, yes, thanks :).


Alex
diff mbox series

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index 57e0dd76631..bec912f917f 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -344,16 +344,38 @@ 
 		mbox-names = "other", "test";
 	};
 
-	cpu-test1 {
-		compatible = "sandbox,cpu_sandbox";
-	};
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
 
-	cpu-test2 {
-		compatible = "sandbox,cpu_sandbox";
-	};
+		cpu@0 {
+			reg = <0>;
+			compatible = "sandbox,cpu_sandbox";
+			device-type = "cpu";
 
-	cpu-test3 {
-		compatible = "sandbox,cpu_sandbox";
+			/*
+			 * These are not used by sandbox, but are required by
+			 * the latest DT spec (v0.2).
+			 */
+			clock-frequency = <0>;
+			timebase-frequency = <0>;
+		};
+
+		cpu@1 {
+			reg = <1>;
+			compatible = "sandbox,cpu_sandbox";
+			device-type = "cpu";
+			clock-frequency = <0>;
+			timebase-frequency = <0>;
+		};
+
+		cpu@2 {
+			reg = <2>;
+			compatible = "sandbox,cpu_sandbox";
+			device-type = "cpu";
+			clock-frequency = <0>;
+			timebase-frequency = <0>;
+		};
 	};
 
 	misc-test {