2023-01-09 13:36:23

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH v4 1/3] dt-bindings: reserved-memory: rmtfs: Make qcom,vmid an array

Some SoCs mandate that the RMTFS is also assigned to the NAV VM, while
others really don't want that. Since it has to be conditional, turn
qcom,vmid into an u32 array so that we can handle the NAV case, as
well as other similar ones if they pop up in the future.

Signed-off-by: Konrad Dybcio <[email protected]>
---
v3 -> v4:
- Constrain the vmid array

.../devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml b/Documentation/devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml
index 2998f1c8f0db..08eb10c25821 100644
--- a/Documentation/devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml
+++ b/Documentation/devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml
@@ -27,9 +27,11 @@ properties:
identifier of the client to use this region for buffers

qcom,vmid:
- $ref: /schemas/types.yaml#/definitions/uint32
+ $ref: /schemas/types.yaml#/definitions/uint32-array
description: >
- vmid of the remote processor, to set up memory protection
+ Array of vmids of the remote processors, to set up memory protection
+ minItems: 1
+ maxItems: 2

required:
- qcom,client-id
--
2.39.0


2023-01-09 13:50:39

by Konrad Dybcio

[permalink] [raw]
Subject: [PATCH v4 3/3] dt-bindings: firmware: qcom: scm: Separate VMIDs from header to bindings

The SCM VMIDs represent predefined mappings that come from the
irreplaceable and non-omittable firmware that comes with every
Qualcomm SoC (unless you steal engineering samples from the factory)
and help clarify otherwise totally magic numbers which we are
required to pass to the secure world for some parts of the SoC to
work at all (with modem being the prime example).

On top of that, with changes to the rmtfs binding, secure VMIDs will
become useful to have in device trees for readability. Separate them
out and add to include/dt-bindings.

Signed-off-by: Konrad Dybcio <[email protected]>
---
v3 -> v4:
- Improve the commit message
- Dual-license
include/dt-bindings/firmware/qcom,scm.h | 16 ++++++++++++++++
include/linux/qcom_scm.h | 7 ++-----
2 files changed, 18 insertions(+), 5 deletions(-)
create mode 100644 include/dt-bindings/firmware/qcom,scm.h

diff --git a/include/dt-bindings/firmware/qcom,scm.h b/include/dt-bindings/firmware/qcom,scm.h
new file mode 100644
index 000000000000..1a4e68fa0744
--- /dev/null
+++ b/include/dt-bindings/firmware/qcom,scm.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
+/*
+ * Copyright (c) 2010-2015, 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (C) 2015 Linaro Ltd.
+ */
+
+#ifndef _DT_BINDINGS_FIRMWARE_QCOM_SCM_H
+#define _DT_BINDINGS_FIRMWARE_QCOM_SCM_H
+
+#define QCOM_SCM_VMID_HLOS 0x3
+#define QCOM_SCM_VMID_MSS_MSA 0xF
+#define QCOM_SCM_VMID_WLAN 0x18
+#define QCOM_SCM_VMID_WLAN_CE 0x19
+#define QCOM_SCM_VMID_NAV 0x2B
+
+#endif
diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h
index 150b72edb879..1e449a5d7f5c 100644
--- a/include/linux/qcom_scm.h
+++ b/include/linux/qcom_scm.h
@@ -9,6 +9,8 @@
#include <linux/types.h>
#include <linux/cpumask.h>

+#include <dt-bindings/firmware/qcom,scm.h>
+
#define QCOM_SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
#define QCOM_SCM_CPU_PWR_DOWN_L2_ON 0x0
#define QCOM_SCM_CPU_PWR_DOWN_L2_OFF 0x1
@@ -51,11 +53,6 @@ enum qcom_scm_ice_cipher {
QCOM_SCM_ICE_CIPHER_AES_256_CBC = 4,
};

-#define QCOM_SCM_VMID_HLOS 0x3
-#define QCOM_SCM_VMID_MSS_MSA 0xF
-#define QCOM_SCM_VMID_WLAN 0x18
-#define QCOM_SCM_VMID_WLAN_CE 0x19
-#define QCOM_SCM_VMID_NAV 0x2B
#define QCOM_SCM_PERM_READ 0x4
#define QCOM_SCM_PERM_WRITE 0x2
#define QCOM_SCM_PERM_EXEC 0x1
--
2.39.0

2023-01-10 10:30:06

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] dt-bindings: reserved-memory: rmtfs: Make qcom,vmid an array

On 09/01/2023 14:05, Konrad Dybcio wrote:
> Some SoCs mandate that the RMTFS is also assigned to the NAV VM, while
> others really don't want that. Since it has to be conditional, turn
> qcom,vmid into an u32 array so that we can handle the NAV case, as
> well as other similar ones if they pop up in the future.
>
> Signed-off-by: Konrad Dybcio <[email protected]>

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2023-01-10 10:51:29

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v4 3/3] dt-bindings: firmware: qcom: scm: Separate VMIDs from header to bindings

On 09/01/2023 14:05, Konrad Dybcio wrote:
> The SCM VMIDs represent predefined mappings that come from the
> irreplaceable and non-omittable firmware that comes with every
> Qualcomm SoC (unless you steal engineering samples from the factory)
> and help clarify otherwise totally magic numbers which we are
> required to pass to the secure world for some parts of the SoC to
> work at all (with modem being the prime example).
>
> On top of that, with changes to the rmtfs binding, secure VMIDs will
> become useful to have in device trees for readability. Separate them
> out and add to include/dt-bindings.
>
> Signed-off-by: Konrad Dybcio <[email protected]>
> ---
> v3 -> v4:

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2023-01-11 05:40:53

by Bjorn Andersson

[permalink] [raw]
Subject: Re: (subset) [PATCH v4 1/3] dt-bindings: reserved-memory: rmtfs: Make qcom,vmid an array

On Mon, 9 Jan 2023 14:05:21 +0100, Konrad Dybcio wrote:
> Some SoCs mandate that the RMTFS is also assigned to the NAV VM, while
> others really don't want that. Since it has to be conditional, turn
> qcom,vmid into an u32 array so that we can handle the NAV case, as
> well as other similar ones if they pop up in the future.
>
>

Applied, thanks!

[1/3] dt-bindings: reserved-memory: rmtfs: Make qcom,vmid an array
commit: da0d37e42f93f7bd6351e7ef67a52ea9a272c761
[2/3] soc: qcom: rmtfs: Optionally map RMTFS to more VMs
commit: e656cd0bcf3d2ba2eceac82b44714bf355428ec4
[3/3] dt-bindings: firmware: qcom: scm: Separate VMIDs from header to bindings
commit: 45ca30eb9dfe622b00ce352cf28ee141d243254b

Best regards,
--
Bjorn Andersson <[email protected]>