diff mbox series

[1/2] dt-bindings: reserved-memory: document Qualcomm MPSS DSM memory

Message ID 20221114-narmstrong-sm8550-upstream-mpss_dsm-v1-1-158dc2bb6e96@linaro.org
State Superseded
Headers show
Series soc: qcom: Add support for Qualcomm Modem Processing SubSystem DSM memory | expand

Commit Message

Neil Armstrong Nov. 16, 2022, 10:16 a.m. UTC
This documents the Qualcomm Modem Processing SubSystem DSM shared memory.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 .../reserved-memory/qcom,mpss-dsm-mem.yaml         | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Neil Armstrong Nov. 17, 2022, 9:47 a.m. UTC | #1
On 16/11/2022 13:17, Krzysztof Kozlowski wrote:
> On 16/11/2022 11:16, Neil Armstrong wrote:
>> This documents the Qualcomm Modem Processing SubSystem DSM shared memory.
> 
> Do not use "This commit/patch".
> https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95
> 
>>
>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>> ---
>>   .../reserved-memory/qcom,mpss-dsm-mem.yaml         | 37 ++++++++++++++++++++++
>>   1 file changed, 37 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/reserved-memory/qcom,mpss-dsm-mem.yaml b/Documentation/devicetree/bindings/reserved-memory/qcom,mpss-dsm-mem.yaml
>> new file mode 100644
>> index 000000000000..65f37e1356d4
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/reserved-memory/qcom,mpss-dsm-mem.yaml
>> @@ -0,0 +1,37 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: "http://devicetree.org/schemas/reserved-memory/qcom,mpss-dsm-mem.yaml#"
>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> 
> Drop quotes from above.
> 
> I know that this and few further pieces came from existing files...

Yep sorry, I'll clean it up.

> 
>> +
>> +title: Qualcomm Modem Processing SubSystem DSM Memory
>> +
>> +description: |
>> +  This binding describes the Qualcomm Modem Processing SubSystem DSM, which serves the
> 
> Drop "This binding describes"
> 
>> +  purpose of describing the shared memory region used for MPSS remote processors.
> 
> Entire description seems like not wrapped at 80.
> 
>> +
>> +maintainers:
>> +  - Bjorn Andersson <bjorn.andersson@linaro.org>
> 
> Need to update the address.

Argh

> 
>> +
>> +allOf:
>> +  - $ref: "reserved-memory.yaml"
> 
> Drop quotes.
> 
>> +
>> +properties:
>> +  compatible:
>> +    const: qcom,mpss-dsm-mem
> 
> Why do we need dedicated binding and compatible for it instead of using
> memory-region phandle in the device?

So like rmtfs, this memory zone is shared between APPS and the MPSS subsystem.

Like rmtfs it makes no sense to link it to the MPSS PAS, since it's only a launcher,
it doesn't represent the MPSS subsystem.

In the PAS startup process, the resources are released from APPS once the MPSS subsystem
is running, which is not the case with the MPSS DSM where it must be shared during the whole
lifetime of the system.

Neil

> 
>> +
>> +unevaluatedProperties: false
> 
> 
> Best regards,
> Krzysztof
>
Krzysztof Kozlowski Nov. 18, 2022, 2:03 p.m. UTC | #2
On 18/11/2022 14:30, neil.armstrong@linaro.org wrote:
> On 18/11/2022 11:45, Krzysztof Kozlowski wrote:
>> On 17/11/2022 10:47, Neil Armstrong wrote:
>>>>
>>>>> +
>>>>> +properties:
>>>>> +  compatible:
>>>>> +    const: qcom,mpss-dsm-mem
>>>>
>>>> Why do we need dedicated binding and compatible for it instead of using
>>>> memory-region phandle in the device?
>>>
>>> So like rmtfs, this memory zone is shared between APPS and the MPSS subsystem.
>>>
>>> Like rmtfs it makes no sense to link it to the MPSS PAS, since it's only a launcher,
>>> it doesn't represent the MPSS subsystem.
>>
>> This also does not represent a device. Memory region is not a device, so
>> this is as well not correct representation of hardware.
> 
> I never used the term device so far, but a shared memory region with a platform
> specific process to share the region between subsystems.

Yes, but you create a device in patch #2 for this binding.

> 
>>
>>>
>>> In the PAS startup process, the resources are released from APPS once the MPSS subsystem
>>> is running, which is not the case with the MPSS DSM where it must be shared during the whole
>>> lifetime of the system.
>>
>> I don't think that PAS releases the region. I checked the
>> qcom_q6v5_pas.c and there is only ioremap. The device stays loaded thus
>> the memory stays mapped.
> Yes PAS does release the firmware region when the firmware is started,
> qcom_scm_pas_metadata_release() does that.

Indeed, I see it now.

> 
>>
>> We have already three of such "memory region devices" and we keep
>> growing it. It's not scalable.
> 
> If we want to properly describe this, we must then represent the MPSS subsystem
> and associate this memory region.

I don't see why. None of devices in your DTS reference this memory
region, so it is purely to keep it mapped for Modem, right? In such case
I still do not get why PAS/PIL, who starts and stops the remote
processor, could not prepare the memory and share it with modem.

The point is that this memory region is nothing special and does not
deserve its own compatible. We keep adding here compatibles to fulfill
some Linux implementation specifics, don't we?

Best regards,
Krzysztof
Neil Armstrong Nov. 23, 2022, 10:19 a.m. UTC | #3
On 18/11/2022 15:03, Krzysztof Kozlowski wrote:
> On 18/11/2022 14:30, neil.armstrong@linaro.org wrote:
>> On 18/11/2022 11:45, Krzysztof Kozlowski wrote:
>>> On 17/11/2022 10:47, Neil Armstrong wrote:
>>>>>
>>>>>> +
>>>>>> +properties:
>>>>>> +  compatible:
>>>>>> +    const: qcom,mpss-dsm-mem
>>>>>
>>>>> Why do we need dedicated binding and compatible for it instead of using
>>>>> memory-region phandle in the device?
>>>>
>>>> So like rmtfs, this memory zone is shared between APPS and the MPSS subsystem.
>>>>
>>>> Like rmtfs it makes no sense to link it to the MPSS PAS, since it's only a launcher,
>>>> it doesn't represent the MPSS subsystem.
>>>
>>> This also does not represent a device. Memory region is not a device, so
>>> this is as well not correct representation of hardware.
>>
>> I never used the term device so far, but a shared memory region with a platform
>> specific process to share the region between subsystems.
> 
> Yes, but you create a device in patch #2 for this binding.

Implementation details are out of scope here.

> 
>>
>>>
>>>>
>>>> In the PAS startup process, the resources are released from APPS once the MPSS subsystem
>>>> is running, which is not the case with the MPSS DSM where it must be shared during the whole
>>>> lifetime of the system.
>>>
>>> I don't think that PAS releases the region. I checked the
>>> qcom_q6v5_pas.c and there is only ioremap. The device stays loaded thus
>>> the memory stays mapped.
>> Yes PAS does release the firmware region when the firmware is started,
>> qcom_scm_pas_metadata_release() does that.
> 
> Indeed, I see it now.
> 
>>
>>>
>>> We have already three of such "memory region devices" and we keep
>>> growing it. It's not scalable.
>>
>> If we want to properly describe this, we must then represent the MPSS subsystem
>> and associate this memory region.
> 
> I don't see why. None of devices in your DTS reference this memory
> region, so it is purely to keep it mapped for Modem, right? In such case
> I still do not get why PAS/PIL, who starts and stops the remote
> processor, could not prepare the memory and share it with modem.

OK you've got a point, but this is still an implementation detail.

I got some more background about why this memory zone appeared, before it
was including in the modem reserved-memories, but for flexibility reasons
this is now in the hands of the APPS runtime (linux) to setup this memory
zone and share it to the MPSS subsystem.

So the only requirement for the PAS is to make sure this zone is shared
before starting the startup process, not to actually do the share setup.

The zone will need to be shared whatever the PAS state is (probe, startup, remove, ...).

> 
> The point is that this memory region is nothing special and does not
> deserve its own compatible. We keep adding here compatibles to fulfill
> some Linux implementation specifics, don't we?

Yes this memory region is now special since it has to be shared explicitly.

> 
> Best regards,
> Krzysztof
> 

Thanks,
Neil
Krzysztof Kozlowski Nov. 24, 2022, 1:57 p.m. UTC | #4
On 23/11/2022 11:19, neil.armstrong@linaro.org wrote:
>>>> We have already three of such "memory region devices" and we keep
>>>> growing it. It's not scalable.
>>>
>>> If we want to properly describe this, we must then represent the MPSS subsystem
>>> and associate this memory region.
>>
>> I don't see why. None of devices in your DTS reference this memory
>> region, so it is purely to keep it mapped for Modem, right? In such case
>> I still do not get why PAS/PIL, who starts and stops the remote
>> processor, could not prepare the memory and share it with modem.
> 
> OK you've got a point, but this is still an implementation detail.
> 
> I got some more background about why this memory zone appeared, before it
> was including in the modem reserved-memories, but for flexibility reasons
> this is now in the hands of the APPS runtime (linux) to setup this memory
> zone and share it to the MPSS subsystem.
> 
> So the only requirement for the PAS is to make sure this zone is shared
> before starting the startup process, not to actually do the share setup.
> 
> The zone will need to be shared whatever the PAS state is (probe, startup, remove, ...).

I don't understand here. The memory region should be shared before
remote processor start or before the PAS probe? If the second, why? What
if your driver probes a bit later - after PAS probe? Then all is lost...

Best regards,
Krzysztof
Neil Armstrong Nov. 29, 2022, 8:27 a.m. UTC | #5
On 24/11/2022 14:57, Krzysztof Kozlowski wrote:
> On 23/11/2022 11:19, neil.armstrong@linaro.org wrote:
>>>>> We have already three of such "memory region devices" and we keep
>>>>> growing it. It's not scalable.
>>>>
>>>> If we want to properly describe this, we must then represent the MPSS subsystem
>>>> and associate this memory region.
>>>
>>> I don't see why. None of devices in your DTS reference this memory
>>> region, so it is purely to keep it mapped for Modem, right? In such case
>>> I still do not get why PAS/PIL, who starts and stops the remote
>>> processor, could not prepare the memory and share it with modem.
>>
>> OK you've got a point, but this is still an implementation detail.
>>
>> I got some more background about why this memory zone appeared, before it
>> was including in the modem reserved-memories, but for flexibility reasons
>> this is now in the hands of the APPS runtime (linux) to setup this memory
>> zone and share it to the MPSS subsystem.
>>
>> So the only requirement for the PAS is to make sure this zone is shared
>> before starting the startup process, not to actually do the share setup.
>>
>> The zone will need to be shared whatever the PAS state is (probe, startup, remove, ...).
> 
> I don't understand here. The memory region should be shared before
> remote processor start or before the PAS probe? If the second, why? What
> if your driver probes a bit later - after PAS probe? Then all is lost...

After offline discussions, I'll associate the DSM memory zone to the PAS MPSS
loader instead to make sure the zone is shared before startup.

Thanks,
Neil

> 
> Best regards,
> Krzysztof
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/reserved-memory/qcom,mpss-dsm-mem.yaml b/Documentation/devicetree/bindings/reserved-memory/qcom,mpss-dsm-mem.yaml
new file mode 100644
index 000000000000..65f37e1356d4
--- /dev/null
+++ b/Documentation/devicetree/bindings/reserved-memory/qcom,mpss-dsm-mem.yaml
@@ -0,0 +1,37 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/reserved-memory/qcom,mpss-dsm-mem.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Qualcomm Modem Processing SubSystem DSM Memory
+
+description: |
+  This binding describes the Qualcomm Modem Processing SubSystem DSM, which serves the
+  purpose of describing the shared memory region used for MPSS remote processors.
+
+maintainers:
+  - Bjorn Andersson <bjorn.andersson@linaro.org>
+
+allOf:
+  - $ref: "reserved-memory.yaml"
+
+properties:
+  compatible:
+    const: qcom,mpss-dsm-mem
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    reserved-memory {
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+
+        mpss-dsm@86700000 {
+            compatible = "qcom,mpss-dsm-mem";
+            reg = <0x86700000 0xe0000>;
+            no-map;
+        };
+    };