diff mbox series

[1/2] dt-bindings: crypto: qcom,prng: document SM8550

Message ID 20230822-topic-sm8550-rng-v1-1-8e10055165d1@linaro.org (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show
Series arm64: qcom: sm8550: enable RNG | expand

Commit Message

Neil Armstrong Aug. 22, 2023, 2:11 p.m. UTC
Document SM8550 compatible for Pseudo Random Generator,
like SM8450 doesn't require clocks setup done by the secure
firmware.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 Documentation/devicetree/bindings/crypto/qcom,prng.yaml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Krzysztof Kozlowski Aug. 22, 2023, 2:14 p.m. UTC | #1
On 22/08/2023 16:11, Neil Armstrong wrote:
> Document SM8550 compatible for Pseudo Random Generator,
> like SM8450 doesn't require clocks setup done by the secure
> firmware.
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Konrad Dybcio Aug. 22, 2023, 2:28 p.m. UTC | #2
On 22.08.2023 16:11, Neil Armstrong wrote:
> Document SM8550 compatible for Pseudo Random Generator,
> like SM8450 doesn't require clocks setup done by the secure
> firmware.
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
+ CC Om

As mentioned in [1], perhaps we should rethink the compatible as
it may be a TRNG and not a PRNG?

Konrad

[1] https://lore.kernel.org/linux-arm-msm/d93902ee-c305-42cb-9d0d-1f0971ab3a70@quicinc.com/
Om Prakash Singh Aug. 22, 2023, 2:54 p.m. UTC | #3
PRNG Block on most of newer target from Qualcomm have some configuration 
where clock is configured by security firmware.

Adding separate compatible string for each platform is overhead.

We need to introduce common compatible string that can be used for all 
platforms with same configuration.

I would suggest to use "qcom,rng-ee" for newer platform, dropping "p" 
also signifies it is not a Pseudo Random Number Generator.

On 8/22/2023 7:58 PM, Konrad Dybcio wrote:
> On 22.08.2023 16:11, Neil Armstrong wrote:
>> Document SM8550 compatible for Pseudo Random Generator,
>> like SM8450 doesn't require clocks setup done by the secure
>> firmware.
>>
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> ---
> + CC Om
> 
> As mentioned in [1], perhaps we should rethink the compatible as
> it may be a TRNG and not a PRNG?
> 
> Konrad
> 
> [1] https://lore.kernel.org/linux-arm-msm/d93902ee-c305-42cb-9d0d-1f0971ab3a70@quicinc.com/
Krzysztof Kozlowski Aug. 22, 2023, 3:28 p.m. UTC | #4
On 22/08/2023 16:54, Om Prakash Singh wrote:
> PRNG Block on most of newer target from Qualcomm have some configuration 
> where clock is configured by security firmware.
> 
> Adding separate compatible string for each platform is overhead.

I don't think PRNG is here different than others and for all others we
expect it. I understand that this is an overhead, like every work is
overhead.

> 
> We need to introduce common compatible string that can be used for all 
> platforms with same configuration.

It is already introduced, isn't it?

> 
> I would suggest to use "qcom,rng-ee" for newer platform, dropping "p" 
> also signifies it is not a Pseudo Random Number Generator.
> 

Best regards,
Krzysztof
Konrad Dybcio Aug. 22, 2023, 4:04 p.m. UTC | #5
On 22.08.2023 16:54, Om Prakash Singh wrote:
> PRNG Block on most of newer target from Qualcomm have some configuration where clock is configured by security firmware.
> 
> Adding separate compatible string for each platform is overhead.
> 
> We need to introduce common compatible string that can be used for all platforms with same configuration.
> 
> I would suggest to use "qcom,rng-ee" for newer platform, dropping "p" also signifies it is not a Pseudo Random Number Generator.
Please reply inline and don't top-post.


Is this what you're trying to say?

1. sort out the clock requirements for designs where Linux manages it
   vs where the FW does so

2. introduce a new compatible for SoCs implementing a TRNG

3. for SoCs in 2., register the TRNG as a hwrng device


?

Konrad
Om Prakash Singh Aug. 23, 2023, 12:10 a.m. UTC | #6
On 8/22/2023 9:34 PM, Konrad Dybcio wrote:
> On 22.08.2023 16:54, Om Prakash Singh wrote:
>> PRNG Block on most of newer target from Qualcomm have some configuration where clock is configured by security firmware.
>>
>> Adding separate compatible string for each platform is overhead.
>>
>> We need to introduce common compatible string that can be used for all platforms with same configuration.
>>
>> I would suggest to use "qcom,rng-ee" for newer platform, dropping "p" also signifies it is not a Pseudo Random Number Generator.
> Please reply inline and don't top-post.
> 
> 
> Is this what you're trying to say?
> 
> 1. sort out the clock requirements for designs where Linux manages it
>     vs where the FW does so >
> 2. introduce a new compatible for SoCs implementing a TRNG
> 
> 3. for SoCs in 2., register the TRNG as a hwrng device

Yes to all

> 
> 
> ?
> 
> Konrad

Thanks,
Om
Neil Armstrong Aug. 23, 2023, 7:55 a.m. UTC | #7
Hi,

On 23/08/2023 02:10, Om Prakash Singh wrote:
> 
> 
> On 8/22/2023 9:34 PM, Konrad Dybcio wrote:
>> On 22.08.2023 16:54, Om Prakash Singh wrote:
>>> PRNG Block on most of newer target from Qualcomm have some configuration where clock is configured by security firmware.
>>>
>>> Adding separate compatible string for each platform is overhead.
>>>
>>> We need to introduce common compatible string that can be used for all platforms with same configuration.
>>>
>>> I would suggest to use "qcom,rng-ee" for newer platform, dropping "p" also signifies it is not a Pseudo Random Number Generator.
>> Please reply inline and don't top-post.
>>
>>
>> Is this what you're trying to say?
>>
>> 1. sort out the clock requirements for designs where Linux manages it
>>     vs where the FW does so >
>> 2. introduce a new compatible for SoCs implementing a TRNG
>>
>> 3. for SoCs in 2., register the TRNG as a hwrng device
> 
> Yes to all

I can send a proposal, but that means writing a new driver for this compatible in drivers/char/hw_random/ right ?

Neil

> 
>>
>>
>> ?
>>
>> Konrad
> 
> Thanks,
> Om
Om Prakash Singh Aug. 23, 2023, 11:32 p.m. UTC | #8
On 8/23/2023 1:25 PM, Neil Armstrong wrote:
> Hi,
> 
> On 23/08/2023 02:10, Om Prakash Singh wrote:
>>
>>
>> On 8/22/2023 9:34 PM, Konrad Dybcio wrote:
>>> On 22.08.2023 16:54, Om Prakash Singh wrote:
>>>> PRNG Block on most of newer target from Qualcomm have some 
>>>> configuration where clock is configured by security firmware.
>>>>
>>>> Adding separate compatible string for each platform is overhead.
>>>>
>>>> We need to introduce common compatible string that can be used for 
>>>> all platforms with same configuration.
>>>>
>>>> I would suggest to use "qcom,rng-ee" for newer platform, dropping 
>>>> "p" also signifies it is not a Pseudo Random Number Generator.
>>> Please reply inline and don't top-post.
>>>
>>>
>>> Is this what you're trying to say?
>>>
>>> 1. sort out the clock requirements for designs where Linux manages it
>>>     vs where the FW does so >
>>> 2. introduce a new compatible for SoCs implementing a TRNG
>>>
>>> 3. for SoCs in 2., register the TRNG as a hwrng device
>>
>> Yes to all
> 
> I can send a proposal, but that means writing a new driver for this 
> compatible in drivers/char/hw_random/ right ?

We can add hwrng support in same driver like 
drivers/crypto/hisilicon/trng/trng.c

As Krzysztof is suggesting we need to have platform specific compatible 
string, we can go with your change. for hwrng support I will send 
separate patches.

> 
> Neil
> 
>>
>>>
>>>
>>> ?
>>>
>>> Konrad
>>
>> Thanks,
>> Om
>
Om Prakash Singh Aug. 23, 2023, 11:43 p.m. UTC | #9
On 8/22/2023 7:41 PM, Neil Armstrong wrote:
> Document SM8550 compatible for Pseudo Random Generator,
> like SM8450 doesn't require clocks setup done by the secure
> firmware.
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
Acked-by: Om Prakash Singh <quic_omprsing@quicinc.com>
>   Documentation/devicetree/bindings/crypto/qcom,prng.yaml | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/crypto/qcom,prng.yaml b/Documentation/devicetree/bindings/crypto/qcom,prng.yaml
> index 36b0ebd9a44b..60fc9f261b83 100644
> --- a/Documentation/devicetree/bindings/crypto/qcom,prng.yaml
> +++ b/Documentation/devicetree/bindings/crypto/qcom,prng.yaml
> @@ -16,7 +16,9 @@ properties:
>             - qcom,prng  # 8916 etc.
>             - qcom,prng-ee  # 8996 and later using EE
>         - items:
> -          - const: qcom,sm8450-prng-ee
> +          - enum:
> +              - qcom,sm8450-prng-ee
> +              - qcom,sm8550-prng-ee
>             - const: qcom,prng-ee
>   
>     reg:
> @@ -39,7 +41,9 @@ allOf:
>           properties:
>             compatible:
>               contains:
> -              const: qcom,sm8450-prng-ee
> +              enum:
> +                - qcom,sm8450-prng-ee
> +                - qcom,sm8550-prng-ee
>       then:
>         required:
>           - clocks
>
Krzysztof Kozlowski Aug. 24, 2023, 6:37 a.m. UTC | #10
On 24/08/2023 01:32, Om Prakash Singh wrote:
> 
> 
> On 8/23/2023 1:25 PM, Neil Armstrong wrote:
>> Hi,
>>
>> On 23/08/2023 02:10, Om Prakash Singh wrote:
>>>
>>>
>>> On 8/22/2023 9:34 PM, Konrad Dybcio wrote:
>>>> On 22.08.2023 16:54, Om Prakash Singh wrote:
>>>>> PRNG Block on most of newer target from Qualcomm have some 
>>>>> configuration where clock is configured by security firmware.
>>>>>
>>>>> Adding separate compatible string for each platform is overhead.
>>>>>
>>>>> We need to introduce common compatible string that can be used for 
>>>>> all platforms with same configuration.
>>>>>
>>>>> I would suggest to use "qcom,rng-ee" for newer platform, dropping 
>>>>> "p" also signifies it is not a Pseudo Random Number Generator.
>>>> Please reply inline and don't top-post.
>>>>
>>>>
>>>> Is this what you're trying to say?
>>>>
>>>> 1. sort out the clock requirements for designs where Linux manages it
>>>>     vs where the FW does so >
>>>> 2. introduce a new compatible for SoCs implementing a TRNG
>>>>
>>>> 3. for SoCs in 2., register the TRNG as a hwrng device
>>>
>>> Yes to all
>>
>> I can send a proposal, but that means writing a new driver for this 
>> compatible in drivers/char/hw_random/ right ?
> 
> We can add hwrng support in same driver like 
> drivers/crypto/hisilicon/trng/trng.c
> 
> As Krzysztof is suggesting we need to have platform specific compatible 

That's independent question

> string, we can go with your change. for hwrng support I will send 
> separate patches.

Any bindings decision should be made now. We don't produce knowingly
incomplete bindings just to change them later. Therefore now you need to
decide whether you call it prng-ee or something else.


Best regards,
Krzysztof
Konrad Dybcio Aug. 24, 2023, 8:40 a.m. UTC | #11
On 24.08.2023 08:37, Krzysztof Kozlowski wrote:
> On 24/08/2023 01:32, Om Prakash Singh wrote:
>>
>>
>> On 8/23/2023 1:25 PM, Neil Armstrong wrote:
>>> Hi,
>>>
>>> On 23/08/2023 02:10, Om Prakash Singh wrote:
>>>>
>>>>
>>>> On 8/22/2023 9:34 PM, Konrad Dybcio wrote:
>>>>> On 22.08.2023 16:54, Om Prakash Singh wrote:
>>>>>> PRNG Block on most of newer target from Qualcomm have some 
>>>>>> configuration where clock is configured by security firmware.
>>>>>>
>>>>>> Adding separate compatible string for each platform is overhead.
>>>>>>
>>>>>> We need to introduce common compatible string that can be used for 
>>>>>> all platforms with same configuration.
>>>>>>
>>>>>> I would suggest to use "qcom,rng-ee" for newer platform, dropping 
>>>>>> "p" also signifies it is not a Pseudo Random Number Generator.
>>>>> Please reply inline and don't top-post.
>>>>>
>>>>>
>>>>> Is this what you're trying to say?
>>>>>
>>>>> 1. sort out the clock requirements for designs where Linux manages it
>>>>>     vs where the FW does so >
>>>>> 2. introduce a new compatible for SoCs implementing a TRNG
>>>>>
>>>>> 3. for SoCs in 2., register the TRNG as a hwrng device
>>>>
>>>> Yes to all
>>>
>>> I can send a proposal, but that means writing a new driver for this 
>>> compatible in drivers/char/hw_random/ right ?
>>
>> We can add hwrng support in same driver like 
>> drivers/crypto/hisilicon/trng/trng.c
>>
>> As Krzysztof is suggesting we need to have platform specific compatible 
> 
> That's independent question
> 
>> string, we can go with your change. for hwrng support I will send 
>> separate patches.
> 
> Any bindings decision should be made now. We don't produce knowingly
> incomplete bindings just to change them later. Therefore now you need to
> decide whether you call it prng-ee or something else.
Herbert already picked up the 8450 compatible last week or so.
If we decide quickly, perhaps it can be reverted and substituted
with the non-*P*RNG one. It would theoretically be an ABI break,
but:

a) it would be very very prompt
b) the dts patch hasn't been merged so there are no users

I'd be fine with that, not sure about the rest of you guys.

Konrad
Neil Armstrong Aug. 24, 2023, 8:46 a.m. UTC | #12
On 24/08/2023 10:40, Konrad Dybcio wrote:
> On 24.08.2023 08:37, Krzysztof Kozlowski wrote:
>> On 24/08/2023 01:32, Om Prakash Singh wrote:
>>>
>>>
>>> On 8/23/2023 1:25 PM, Neil Armstrong wrote:
>>>> Hi,
>>>>
>>>> On 23/08/2023 02:10, Om Prakash Singh wrote:
>>>>>
>>>>>
>>>>> On 8/22/2023 9:34 PM, Konrad Dybcio wrote:
>>>>>> On 22.08.2023 16:54, Om Prakash Singh wrote:
>>>>>>> PRNG Block on most of newer target from Qualcomm have some
>>>>>>> configuration where clock is configured by security firmware.
>>>>>>>
>>>>>>> Adding separate compatible string for each platform is overhead.
>>>>>>>
>>>>>>> We need to introduce common compatible string that can be used for
>>>>>>> all platforms with same configuration.
>>>>>>>
>>>>>>> I would suggest to use "qcom,rng-ee" for newer platform, dropping
>>>>>>> "p" also signifies it is not a Pseudo Random Number Generator.
>>>>>> Please reply inline and don't top-post.
>>>>>>
>>>>>>
>>>>>> Is this what you're trying to say?
>>>>>>
>>>>>> 1. sort out the clock requirements for designs where Linux manages it
>>>>>>      vs where the FW does so >
>>>>>> 2. introduce a new compatible for SoCs implementing a TRNG
>>>>>>
>>>>>> 3. for SoCs in 2., register the TRNG as a hwrng device
>>>>>
>>>>> Yes to all
>>>>
>>>> I can send a proposal, but that means writing a new driver for this
>>>> compatible in drivers/char/hw_random/ right ?
>>>
>>> We can add hwrng support in same driver like
>>> drivers/crypto/hisilicon/trng/trng.c
>>>
>>> As Krzysztof is suggesting we need to have platform specific compatible
>>
>> That's independent question
>>
>>> string, we can go with your change. for hwrng support I will send
>>> separate patches.
>>
>> Any bindings decision should be made now. We don't produce knowingly
>> incomplete bindings just to change them later. Therefore now you need to
>> decide whether you call it prng-ee or something else.
> Herbert already picked up the 8450 compatible last week or so.
> If we decide quickly, perhaps it can be reverted and substituted
> with the non-*P*RNG one. It would theoretically be an ABI break,
> but:
> 
> a) it would be very very prompt
> b) the dts patch hasn't been merged so there are no users
> 
> I'd be fine with that, not sure about the rest of you guys.

I'm fine for that aswell, this can be done quickly without the
hwrng part

I can quickly refresh this serie with :
1) introduce a new "qcom,trng" and move "qcom,sm8450-prng-ee" to "qcom,sm8450-trng"
2) add qcom,sm8550-prng-ee
3) add "qcom,trng"  to the driver compatible list

then afterwards, the hwrng part can be added in a separate serie.

Neil

> 
> Konrad
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/crypto/qcom,prng.yaml b/Documentation/devicetree/bindings/crypto/qcom,prng.yaml
index 36b0ebd9a44b..60fc9f261b83 100644
--- a/Documentation/devicetree/bindings/crypto/qcom,prng.yaml
+++ b/Documentation/devicetree/bindings/crypto/qcom,prng.yaml
@@ -16,7 +16,9 @@  properties:
           - qcom,prng  # 8916 etc.
           - qcom,prng-ee  # 8996 and later using EE
       - items:
-          - const: qcom,sm8450-prng-ee
+          - enum:
+              - qcom,sm8450-prng-ee
+              - qcom,sm8550-prng-ee
           - const: qcom,prng-ee
 
   reg:
@@ -39,7 +41,9 @@  allOf:
         properties:
           compatible:
             contains:
-              const: qcom,sm8450-prng-ee
+              enum:
+                - qcom,sm8450-prng-ee
+                - qcom,sm8550-prng-ee
     then:
       required:
         - clocks