2023-11-17 21:29:37

by Elliot Berman

[permalink] [raw]
Subject: [PATCH 2/3] dt-bindings: arm: Document reboot mode magic

Add bindings to describe vendor-specific reboot modes. Values here
correspond to valid parameters to vendor-specific reset types in PSCI
SYSTEM_RESET2 call.

Signed-off-by: Elliot Berman <[email protected]>
---
Documentation/devicetree/bindings/arm/psci.yaml | 36 +++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml
index 0c5381e081bd..ac95c1610287 100644
--- a/Documentation/devicetree/bindings/arm/psci.yaml
+++ b/Documentation/devicetree/bindings/arm/psci.yaml
@@ -136,8 +136,29 @@ allOf:
required:
- cpu_off
- cpu_on
-
-additionalProperties: false
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: arm,psci-1.0
+ then:
+ $ref: /schemas/power/reset/reboot-mode.yaml#
+ properties:
+ # "mode-normal" is just SYSTEM_RESET
+ mode-normal: false
+ patternProperties:
+ "^mode-.*$":
+ maxItems: 2
+ description: |
+ Describes a vendor-specific reset type. The string after "mode-"
+ maps a reboot mode to the parameters in the PSCI SYSTEM_RESET2 call.
+
+ Parameters are named mode-xxx = <type[, cookie]>, where xxx
+ is the name of the magic reboot mode, type is the lower 31 bits
+ of the reset_type, and, optionally, the cookie value. If the cookie
+ is not provided, it is defaulted to zero.
+
+unevaluatedProperties: false

examples:
- |+
@@ -260,4 +281,15 @@ examples:
domain-idle-states = <&CLUSTER_RET>, <&CLUSTER_PWRDN>;
};
};
+
+ - |+
+
+ // Case 5: SYSTEM_RESET2 vendor resets
+ psci {
+ compatible = "arm,psci-1.0";
+ method = "smc";
+
+ mode-edl = <0>;
+ mode-bootloader = <1 2>;
+ };
...

--
2.41.0


2023-11-20 10:57:03

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 2/3] dt-bindings: arm: Document reboot mode magic

On 17/11/2023 22:18, Elliot Berman wrote:
> -
> -additionalProperties: false
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: arm,psci-1.0
> + then:
> + $ref: /schemas/power/reset/reboot-mode.yaml#
> + properties:
> + # "mode-normal" is just SYSTEM_RESET
> + mode-normal: false
> + patternProperties:
> + "^mode-.*$":
> + maxItems: 2

And if you tested the patch, it would tell you it can be max 1 item.

Best regards,
Krzysztof

2023-11-20 15:47:31

by Elliot Berman

[permalink] [raw]
Subject: Re: [PATCH 2/3] dt-bindings: arm: Document reboot mode magic



On 11/20/2023 2:56 AM, Krzysztof Kozlowski wrote:
> On 17/11/2023 22:18, Elliot Berman wrote:
>> -
>> -additionalProperties: false
>> + - if:
>> + properties:
>> + compatible:
>> + contains:
>> + const: arm,psci-1.0
>> + then:
>> + $ref: /schemas/power/reset/reboot-mode.yaml#
>> + properties:
>> + # "mode-normal" is just SYSTEM_RESET
>> + mode-normal: false
>> + patternProperties:
>> + "^mode-.*$":
>> + maxItems: 2
>
> And if you tested the patch, it would tell you it can be max 1 item.

make dt_binding_check DT_SCHEMA_FILES=arm/psci.yaml

passes for me. Rob explained why it's working (and why it shouldn't),
so I'll fix it according to his recommendation in v2.

Thanks,
Elliot

2023-11-20 16:43:50

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 2/3] dt-bindings: arm: Document reboot mode magic

On 20/11/2023 16:45, Elliot Berman wrote:
>
>
> On 11/20/2023 2:56 AM, Krzysztof Kozlowski wrote:
>> On 17/11/2023 22:18, Elliot Berman wrote:
>>> -
>>> -additionalProperties: false
>>> + - if:
>>> + properties:
>>> + compatible:
>>> + contains:
>>> + const: arm,psci-1.0
>>> + then:
>>> + $ref: /schemas/power/reset/reboot-mode.yaml#
>>> + properties:
>>> + # "mode-normal" is just SYSTEM_RESET
>>> + mode-normal: false
>>> + patternProperties:
>>> + "^mode-.*$":
>>> + maxItems: 2
>>
>> And if you tested the patch, it would tell you it can be max 1 item.
>
> make dt_binding_check DT_SCHEMA_FILES=arm/psci.yaml

psci.example.dtb: psci: mode-edl: [[0]] is too short
psci.example.dtb: psci: mode-bootloader: [[1, 2]] is too short

psci.example.dtb: psci: Unevaluated properties are not allowed
('mode-bootloader', 'mode-edl' were unexpected)

>
> passes for me. Rob explained why it's working (and why it shouldn't),
> so I'll fix it according to his recommendation in v2.

Then you wanted uint32-matrix.


Best regards,
Krzysztof

2023-11-20 17:11:07

by Elliot Berman

[permalink] [raw]
Subject: Re: [PATCH 2/3] dt-bindings: arm: Document reboot mode magic



On 11/20/2023 8:41 AM, Krzysztof Kozlowski wrote:
> On 20/11/2023 16:45, Elliot Berman wrote:
>>
>>
>> On 11/20/2023 2:56 AM, Krzysztof Kozlowski wrote:
>>> On 17/11/2023 22:18, Elliot Berman wrote:
>>>> -
>>>> -additionalProperties: false
>>>> + - if:
>>>> + properties:
>>>> + compatible:
>>>> + contains:
>>>> + const: arm,psci-1.0
>>>> + then:
>>>> + $ref: /schemas/power/reset/reboot-mode.yaml#
>>>> + properties:
>>>> + # "mode-normal" is just SYSTEM_RESET
>>>> + mode-normal: false
>>>> + patternProperties:
>>>> + "^mode-.*$":
>>>> + maxItems: 2
>>>
>>> And if you tested the patch, it would tell you it can be max 1 item.
>>
>> make dt_binding_check DT_SCHEMA_FILES=arm/psci.yaml
>
> psci.example.dtb: psci: mode-edl: [[0]] is too short
> psci.example.dtb: psci: mode-bootloader: [[1, 2]] is too short
>
> psci.example.dtb: psci: Unevaluated properties are not allowed
> ('mode-bootloader', 'mode-edl' were unexpected)
>

Ah, tip of tree for dt-schema doesn't seem to report the error.

Doesn't report the error:
dt-validate --version
2023.10.dev17+g58feadb

Reports the error:
dt-validate --version
2023.9

Looks likely related to generated the processed-schema.json rather
than dt-validate itself. The tip of tree dt-validate does report
the error if processed-schema.json is generated by 2023.9 tool,
but not if the schema was also generated by tip-of-tree mkschema.

I'll try bisecting the error and report back.

>>
>> passes for me. Rob explained why it's working (and why it shouldn't),
>> so I'll fix it according to his recommendation in v2.
>
> Then you wanted uint32-matrix.
>
>
> Best regards,
> Krzysztof
>