2023-12-01 09:34:45

by Luca Weiss

[permalink] [raw]
Subject: [PATCH v3 0/3] Enable venus on Fairphone 5 / non-ChromeOS sc7280 venus support

Devices with Qualcomm firmware (compared to ChromeOS firmware) need some
changes in the venus driver and dts layout so that venus can initialize.

Do these changes, similar to sc7180.

Signed-off-by: Luca Weiss <[email protected]>
---
Changes in v3:
- Move 0x2184 iommu from sc7280.dtsi to sc7280-chrome-common.dtsi since
it seems to cause crash on some boards (Vikash)
- Pick up tags
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Reword commit message 2/3 to be clearer (Konrad)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Luca Weiss (3):
media: venus: core: Set up secure memory ranges for SC7280
arm64: dts: qcom: sc7280: Move video-firmware to chrome-common
arm64: dts: qcom: qcm6490-fairphone-fp5: Enable venus node

arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 5 +++++
arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi | 11 +++++++++++
arch/arm64/boot/dts/qcom/sc7280.dtsi | 9 +++------
drivers/media/platform/qcom/venus/core.c | 4 ++++
4 files changed, 23 insertions(+), 6 deletions(-)
---
base-commit: b2a4d0696192f24f79ea71fea2d775da28fb9157
change-id: 20230929-sc7280-venus-pas-ea9630525753

Best regards,
--
Luca Weiss <[email protected]>


2023-12-01 09:34:49

by Luca Weiss

[permalink] [raw]
Subject: [PATCH v3 1/3] media: venus: core: Set up secure memory ranges for SC7280

Not all SC7280 devices ship with ChromeOS firmware. Other devices need
PAS for image authentication. That requires the predefined virtual
address ranges to be passed via scm calls. Define them to enable Venus
on non-CrOS SC7280 devices.

Reviewed-by: Konrad Dybcio <[email protected]>
Reviewed-by: Bryan O'Donoghue <[email protected]>
Reviewed-by: Vikash Garodia <[email protected]>
Signed-off-by: Luca Weiss <[email protected]>
---
drivers/media/platform/qcom/venus/core.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 9cffe975581b..a712dd4f02a5 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -881,6 +881,10 @@ static const struct venus_resources sc7280_res = {
.vmem_size = 0,
.vmem_addr = 0,
.dma_mask = 0xe0000000 - 1,
+ .cp_start = 0,
+ .cp_size = 0x25800000,
+ .cp_nonpixel_start = 0x1000000,
+ .cp_nonpixel_size = 0x24800000,
.fwname = "qcom/vpu-2.0/venus.mbn",
};


--
2.43.0

2023-12-01 09:34:50

by Luca Weiss

[permalink] [raw]
Subject: [PATCH v3 3/3] arm64: dts: qcom: qcm6490-fairphone-fp5: Enable venus node

Enable the venus node so that the video encoder/decoder will start
working.

Reviewed-by: Konrad Dybcio <[email protected]>
Reviewed-by: Bryan O'Donoghue <[email protected]>
Reviewed-by: Vikash Garodia <[email protected]>
Signed-off-by: Luca Weiss <[email protected]>
---
arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts
index 762c5db29520..cc092735ce17 100644
--- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts
+++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts
@@ -688,3 +688,8 @@ &usb_1_qmpphy {

status = "okay";
};
+
+&venus {
+ firmware-name = "qcom/qcm6490/fairphone5/venus.mbn";
+ status = "okay";
+};

--
2.43.0

2023-12-01 09:35:00

by Luca Weiss

[permalink] [raw]
Subject: [PATCH v3 2/3] arm64: dts: qcom: sc7280: Move video-firmware to chrome-common

If the video-firmware node is present, the venus driver assumes we're on
a system that doesn't use TZ for starting venus, like on ChromeOS
devices.

Move the video-firmware node to chrome-common.dtsi so we can use venus
on a non-ChromeOS devices. We also need to move the secure SID 0x2184
for iommu since (on some boards) we cannot touch that.

At the same time also disable the venus node by default in the dtsi,
like it's done on other SoCs.

Reviewed-by: Bryan O'Donoghue <[email protected]>
Signed-off-by: Luca Weiss <[email protected]>
---
arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi | 11 +++++++++++
arch/arm64/boot/dts/qcom/sc7280.dtsi | 9 +++------
2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi
index 5d462ae14ba1..459ff877df54 100644
--- a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi
@@ -104,6 +104,17 @@ &scm {
dma-coherent;
};

+&venus {
+ iommus = <&apps_smmu 0x2180 0x20>,
+ <&apps_smmu 0x2184 0x20>;
+
+ status = "okay";
+
+ video-firmware {
+ iommus = <&apps_smmu 0x21a2 0x0>;
+ };
+};
+
&watchdog {
status = "okay";
};
diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi
index 326897af117a..0ff9a2484096 100644
--- a/arch/arm64/boot/dts/qcom/sc7280.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi
@@ -3836,10 +3836,11 @@ venus: video-codec@aa00000 {
<&mmss_noc MASTER_VIDEO_P0 0 &mc_virt SLAVE_EBI1 0>;
interconnect-names = "cpu-cfg", "video-mem";

- iommus = <&apps_smmu 0x2180 0x20>,
- <&apps_smmu 0x2184 0x20>;
+ iommus = <&apps_smmu 0x2180 0x20>;
memory-region = <&video_mem>;

+ status = "disabled";
+
video-decoder {
compatible = "venus-decoder";
};
@@ -3848,10 +3849,6 @@ video-encoder {
compatible = "venus-encoder";
};

- video-firmware {
- iommus = <&apps_smmu 0x21a2 0x0>;
- };
-
venus_opp_table: opp-table {
compatible = "operating-points-v2";


--
2.43.0

2023-12-11 08:12:32

by Luca Weiss

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] media: venus: core: Set up secure memory ranges for SC7280

On Fri Dec 1, 2023 at 10:33 AM CET, Luca Weiss wrote:
> Not all SC7280 devices ship with ChromeOS firmware. Other devices need
> PAS for image authentication. That requires the predefined virtual
> address ranges to be passed via scm calls. Define them to enable Venus
> on non-CrOS SC7280 devices.
>
> Reviewed-by: Konrad Dybcio <[email protected]>
> Reviewed-by: Bryan O'Donoghue <[email protected]>
> Reviewed-by: Vikash Garodia <[email protected]>
> Signed-off-by: Luca Weiss <[email protected]>
> ---
> drivers/media/platform/qcom/venus/core.c | 4 ++++
> 1 file changed, 4 insertions(+)

Hi Hans,

Is there anything missing for this to be applied or could you pick this
up for v6.8?

Regards
Luca

>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 9cffe975581b..a712dd4f02a5 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -881,6 +881,10 @@ static const struct venus_resources sc7280_res = {
> .vmem_size = 0,
> .vmem_addr = 0,
> .dma_mask = 0xe0000000 - 1,
> + .cp_start = 0,
> + .cp_size = 0x25800000,
> + .cp_nonpixel_start = 0x1000000,
> + .cp_nonpixel_size = 0x24800000,
> .fwname = "qcom/vpu-2.0/venus.mbn",
> };
>

2023-12-12 07:59:45

by Vikash Garodia

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] arm64: dts: qcom: sc7280: Move video-firmware to chrome-common

On 12/1/2023 3:03 PM, Luca Weiss wrote:
> If the video-firmware node is present, the venus driver assumes we're on
> a system that doesn't use TZ for starting venus, like on ChromeOS
> devices.
>
> Move the video-firmware node to chrome-common.dtsi so we can use venus
> on a non-ChromeOS devices. We also need to move the secure SID 0x2184
> for iommu since (on some boards) we cannot touch that.
>
> At the same time also disable the venus node by default in the dtsi,
> like it's done on other SoCs.
>
> Reviewed-by: Bryan O'Donoghue <[email protected]>
> Signed-off-by: Luca Weiss <[email protected]>

Reviewed-by: Vikash Garodia <[email protected]>

Regards,
Vikash
> ---
> arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi | 11 +++++++++++
> arch/arm64/boot/dts/qcom/sc7280.dtsi | 9 +++------
> 2 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi
> index 5d462ae14ba1..459ff877df54 100644
> --- a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi
> @@ -104,6 +104,17 @@ &scm {
> dma-coherent;
> };
>
> +&venus {
> + iommus = <&apps_smmu 0x2180 0x20>,
> + <&apps_smmu 0x2184 0x20>;
> +
> + status = "okay";
> +
> + video-firmware {
> + iommus = <&apps_smmu 0x21a2 0x0>;
> + };
> +};
> +
> &watchdog {
> status = "okay";
> };
> diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi
> index 326897af117a..0ff9a2484096 100644
> --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi
> @@ -3836,10 +3836,11 @@ venus: video-codec@aa00000 {
> <&mmss_noc MASTER_VIDEO_P0 0 &mc_virt SLAVE_EBI1 0>;
> interconnect-names = "cpu-cfg", "video-mem";
>
> - iommus = <&apps_smmu 0x2180 0x20>,
> - <&apps_smmu 0x2184 0x20>;
> + iommus = <&apps_smmu 0x2180 0x20>;
> memory-region = <&video_mem>;
>
> + status = "disabled";
> +
> video-decoder {
> compatible = "venus-decoder";
> };
> @@ -3848,10 +3849,6 @@ video-encoder {
> compatible = "venus-encoder";
> };
>
> - video-firmware {
> - iommus = <&apps_smmu 0x21a2 0x0>;
> - };
> -
> venus_opp_table: opp-table {
> compatible = "operating-points-v2";
>
>

2023-12-17 17:46:34

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] media: venus: core: Set up secure memory ranges for SC7280

On Fri, Dec 01, 2023 at 10:33:18AM +0100, Luca Weiss wrote:
> Not all SC7280 devices ship with ChromeOS firmware. Other devices need
> PAS for image authentication. That requires the predefined virtual
> address ranges to be passed via scm calls. Define them to enable Venus
> on non-CrOS SC7280 devices.
>
> Reviewed-by: Konrad Dybcio <[email protected]>
> Reviewed-by: Bryan O'Donoghue <[email protected]>
> Reviewed-by: Vikash Garodia <[email protected]>
> Signed-off-by: Luca Weiss <[email protected]>

Mauro, this series looks ready to be picked up. Can you please merge
this driver patch, so I can pick the two dts changes?

Thanks,
Bjorn

> ---
> drivers/media/platform/qcom/venus/core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 9cffe975581b..a712dd4f02a5 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -881,6 +881,10 @@ static const struct venus_resources sc7280_res = {
> .vmem_size = 0,
> .vmem_addr = 0,
> .dma_mask = 0xe0000000 - 1,
> + .cp_start = 0,
> + .cp_size = 0x25800000,
> + .cp_nonpixel_start = 0x1000000,
> + .cp_nonpixel_size = 0x24800000,
> .fwname = "qcom/vpu-2.0/venus.mbn",
> };
>
>
> --
> 2.43.0
>

2024-01-27 22:31:04

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] arm64: dts: qcom: sc7280: Move video-firmware to chrome-common

On Fri, Dec 01, 2023 at 10:33:19AM +0100, Luca Weiss wrote:
> If the video-firmware node is present, the venus driver assumes we're on
> a system that doesn't use TZ for starting venus, like on ChromeOS
> devices.
>
> Move the video-firmware node to chrome-common.dtsi so we can use venus
> on a non-ChromeOS devices. We also need to move the secure SID 0x2184
> for iommu since (on some boards) we cannot touch that.
>
> At the same time also disable the venus node by default in the dtsi,
> like it's done on other SoCs.
>
> Reviewed-by: Bryan O'Donoghue <[email protected]>
> Signed-off-by: Luca Weiss <[email protected]>
> ---
> arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi | 11 +++++++++++
> arch/arm64/boot/dts/qcom/sc7280.dtsi | 9 +++------
> 2 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi
> index 5d462ae14ba1..459ff877df54 100644
> --- a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi
> @@ -104,6 +104,17 @@ &scm {
> dma-coherent;
> };
>
> +&venus {
> + iommus = <&apps_smmu 0x2180 0x20>,
> + <&apps_smmu 0x2184 0x20>;
> +
> + status = "okay";
> +
> + video-firmware {
> + iommus = <&apps_smmu 0x21a2 0x0>;
> + };
> +};
> +
> &watchdog {
> status = "okay";
> };
> diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi
> index 326897af117a..0ff9a2484096 100644
> --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi
> @@ -3836,10 +3836,11 @@ venus: video-codec@aa00000 {
> <&mmss_noc MASTER_VIDEO_P0 0 &mc_virt SLAVE_EBI1 0>;
> interconnect-names = "cpu-cfg", "video-mem";
>
> - iommus = <&apps_smmu 0x2180 0x20>,
> - <&apps_smmu 0x2184 0x20>;
> + iommus = <&apps_smmu 0x2180 0x20>;

qcom,sc7280-venus expects 2 items here. Please follow up with a patch to
the binding, if you haven't send one already.

Thanks,
Bjorn

> memory-region = <&video_mem>;
>
> + status = "disabled";
> +
> video-decoder {
> compatible = "venus-decoder";
> };
> @@ -3848,10 +3849,6 @@ video-encoder {
> compatible = "venus-encoder";
> };
>
> - video-firmware {
> - iommus = <&apps_smmu 0x21a2 0x0>;
> - };
> -
> venus_opp_table: opp-table {
> compatible = "operating-points-v2";
>
>
> --
> 2.43.0
>

2024-01-27 22:50:39

by Bjorn Andersson

[permalink] [raw]
Subject: Re: (subset) [PATCH v3 0/3] Enable venus on Fairphone 5 / non-ChromeOS sc7280 venus support


On Fri, 01 Dec 2023 10:33:17 +0100, Luca Weiss wrote:
> Devices with Qualcomm firmware (compared to ChromeOS firmware) need some
> changes in the venus driver and dts layout so that venus can initialize.
>
> Do these changes, similar to sc7180.
>
>

Applied, thanks!

[2/3] arm64: dts: qcom: sc7280: Move video-firmware to chrome-common
commit: 82066cdb17608abc95192632fd5c702be8e57ab5
[3/3] arm64: dts: qcom: qcm6490-fairphone-fp5: Enable venus node
commit: 2aa72de2fc9230c54048e3555d04e945ec4f8891

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