2021-08-10 17:20:59

by Dikshita Agarwal

[permalink] [raw]
Subject: [PATCH v4 0/7] media: venus: Enable venus support on sc7280

This series enables support for 6xx venus encode/decode on sc7280.

The driver changes are dependent on [1]yaml and [2]dts patches.

[1] https://patchwork.kernel.org/project/linux-arm-msm/list/?series=484019
[2] https://patchwork.kernel.org/project/linux-arm-msm/list/?series=484727

Changes since v3:
- addressed comments on v3 (stanimir).
- rebased the changes on latest media tree.

Dikshita Agarwal (7):
venus: firmware: enable no tz fw loading for sc7280
media: venus: core: Add sc7280 DT compatible and resource data
media: venus: Add num_vpp_pipes to resource structure
media: venus: hfi: Skip AON register programming for V6 1pipe
venus: vdec: set work route to fw
media: venus: helpers: update NUM_MBS macro calculation
media: venus: Set buffer to FW based on FW min count requirement.

drivers/media/platform/qcom/venus/core.c | 54 ++++++++++++++++++++++
drivers/media/platform/qcom/venus/core.h | 2 +
drivers/media/platform/qcom/venus/firmware.c | 42 ++++++++++++-----
drivers/media/platform/qcom/venus/helpers.c | 23 +++++----
drivers/media/platform/qcom/venus/hfi_cmds.c | 7 +++
drivers/media/platform/qcom/venus/hfi_helper.h | 14 ++++++
drivers/media/platform/qcom/venus/hfi_msgs.c | 7 +++
.../media/platform/qcom/venus/hfi_plat_bufs_v6.c | 6 ++-
drivers/media/platform/qcom/venus/hfi_platform.c | 13 ------
drivers/media/platform/qcom/venus/hfi_platform.h | 2 -
.../media/platform/qcom/venus/hfi_platform_v6.c | 6 ---
drivers/media/platform/qcom/venus/hfi_venus.c | 4 ++
drivers/media/platform/qcom/venus/hfi_venus_io.h | 2 +
drivers/media/platform/qcom/venus/vdec.c | 42 ++++++++++++++---
14 files changed, 175 insertions(+), 49 deletions(-)

--
2.7.4


2021-08-10 17:21:19

by Dikshita Agarwal

[permalink] [raw]
Subject: [PATCH v4 2/7] media: venus: core: Add sc7280 DT compatible and resource data

Adds a sm7280 compatible binding to the venus core.

Co-developed-by: Mansur Alisha Shaik <[email protected]>
Signed-off-by: Dikshita Agarwal <[email protected]>
---
drivers/media/platform/qcom/venus/core.c | 52 ++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 91b1584..68acfc0 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -736,6 +736,57 @@ static const struct venus_resources sm8250_res = {
.fwname = "qcom/vpu-1.0/venus.mdt",
};

+static const struct freq_tbl sc7280_freq_table[] = {
+ { 0, 460000000 },
+ { 0, 424000000 },
+ { 0, 335000000 },
+ { 0, 240000000 },
+ { 0, 133333333 },
+};
+
+static const struct bw_tbl sc7280_bw_table_enc[] = {
+ { 1944000, 1896000, 0, 3657000, 0 }, /* 3840x2160@60 */
+ { 972000, 968000, 0, 1848000, 0 }, /* 3840x2160@30 */
+ { 489600, 618000, 0, 941000, 0 }, /* 1920x1080@60 */
+ { 244800, 318000, 0, 480000, 0 }, /* 1920x1080@30 */
+};
+
+static const struct bw_tbl sc7280_bw_table_dec[] = {
+ { 2073600, 2128000, 0, 3831000, 0 }, /* 4096x2160@60 */
+ { 1036800, 1085000, 0, 1937000, 0 }, /* 4096x2160@30 */
+ { 489600, 779000, 0, 998000, 0 }, /* 1920x1080@60 */
+ { 244800, 400000, 0, 509000, 0 }, /* 1920x1080@30 */
+};
+
+static const struct reg_val sm7280_reg_preset[] = {
+ { 0xb0088, 0 },
+};
+
+static const struct venus_resources sc7280_res = {
+ .freq_tbl = sc7280_freq_table,
+ .freq_tbl_size = ARRAY_SIZE(sc7280_freq_table),
+ .reg_tbl = sm7280_reg_preset,
+ .reg_tbl_size = ARRAY_SIZE(sm7280_reg_preset),
+ .bw_tbl_enc = sc7280_bw_table_enc,
+ .bw_tbl_enc_size = ARRAY_SIZE(sc7280_bw_table_enc),
+ .bw_tbl_dec = sc7280_bw_table_dec,
+ .bw_tbl_dec_size = ARRAY_SIZE(sc7280_bw_table_dec),
+ .clks = {"core", "bus", "iface"},
+ .clks_num = 3,
+ .vcodec0_clks = {"vcodec_core", "vcodec_bus"},
+ .vcodec_clks_num = 2,
+ .vcodec_pmdomains = { "venus", "vcodec0" },
+ .vcodec_pmdomains_num = 2,
+ .opp_pmdomain = (const char *[]) { "cx", NULL },
+ .vcodec_num = 1,
+ .hfi_version = HFI_VERSION_6XX,
+ .vmem_id = VIDC_RESOURCE_NONE,
+ .vmem_size = 0,
+ .vmem_addr = 0,
+ .dma_mask = 0xe0000000 - 1,
+ .fwname = "qcom/vpu-2.0/venus.mdt",
+};
+
static const struct of_device_id venus_dt_match[] = {
{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
@@ -743,6 +794,7 @@ static const struct of_device_id venus_dt_match[] = {
{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
+ { .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },
{ }
};
MODULE_DEVICE_TABLE(of, venus_dt_match);
--
2.7.4

2021-08-10 17:21:40

by Dikshita Agarwal

[permalink] [raw]
Subject: [PATCH v4 1/7] venus: firmware: enable no tz fw loading for sc7280

- Enable no tz FW loading.
- add routine to reset XTSS.

Signed-off-by: Dikshita Agarwal <[email protected]>
---
drivers/media/platform/qcom/venus/firmware.c | 42 +++++++++++++++++-------
drivers/media/platform/qcom/venus/hfi_venus_io.h | 2 ++
2 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c
index 227bd3b..14b6f1d 100644
--- a/drivers/media/platform/qcom/venus/firmware.c
+++ b/drivers/media/platform/qcom/venus/firmware.c
@@ -27,7 +27,12 @@
static void venus_reset_cpu(struct venus_core *core)
{
u32 fw_size = core->fw.mapped_mem_size;
- void __iomem *wrapper_base = core->wrapper_base;
+ void __iomem *wrapper_base;
+
+ if (IS_V6(core))
+ wrapper_base = core->wrapper_tz_base;
+ else
+ wrapper_base = core->wrapper_base;

writel(0, wrapper_base + WRAPPER_FW_START_ADDR);
writel(fw_size, wrapper_base + WRAPPER_FW_END_ADDR);
@@ -35,11 +40,17 @@ static void venus_reset_cpu(struct venus_core *core)
writel(fw_size, wrapper_base + WRAPPER_CPA_END_ADDR);
writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR);
writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR);
- writel(0x0, wrapper_base + WRAPPER_CPU_CGC_DIS);
- writel(0x0, wrapper_base + WRAPPER_CPU_CLOCK_CONFIG);

- /* Bring ARM9 out of reset */
- writel(0, wrapper_base + WRAPPER_A9SS_SW_RESET);
+ if (IS_V6(core)) {
+ /* Bring XTSS out of reset */
+ writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET);
+ } else {
+ writel(0x0, wrapper_base + WRAPPER_CPU_CGC_DIS);
+ writel(0x0, wrapper_base + WRAPPER_CPU_CLOCK_CONFIG);
+
+ /* Bring ARM9 out of reset */
+ writel(0, wrapper_base + WRAPPER_A9SS_SW_RESET);
+ }
}

int venus_set_hw_state(struct venus_core *core, bool resume)
@@ -56,7 +67,9 @@ int venus_set_hw_state(struct venus_core *core, bool resume)
if (resume) {
venus_reset_cpu(core);
} else {
- if (!IS_V6(core))
+ if (IS_V6(core))
+ writel(1, core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
+ else
writel(1, core->wrapper_base + WRAPPER_A9SS_SW_RESET);
}

@@ -162,12 +175,19 @@ static int venus_shutdown_no_tz(struct venus_core *core)
u32 reg;
struct device *dev = core->fw.dev;
void __iomem *wrapper_base = core->wrapper_base;
+ void __iomem *wrapper_tz_base = core->wrapper_tz_base;

- /* Assert the reset to ARM9 */
- reg = readl_relaxed(wrapper_base + WRAPPER_A9SS_SW_RESET);
- reg |= WRAPPER_A9SS_SW_RESET_BIT;
- writel_relaxed(reg, wrapper_base + WRAPPER_A9SS_SW_RESET);
-
+ if (IS_V6(core)) {
+ /* Assert the reset to XTSS */
+ reg = readl_relaxed(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
+ reg |= WRAPPER_XTSS_SW_RESET_BIT;
+ writel_relaxed(reg, wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET);
+ } else {
+ /* Assert the reset to ARM9 */
+ reg = readl_relaxed(wrapper_base + WRAPPER_A9SS_SW_RESET);
+ reg |= WRAPPER_A9SS_SW_RESET_BIT;
+ writel_relaxed(reg, wrapper_base + WRAPPER_A9SS_SW_RESET);
+ }
/* Make sure reset is asserted before the mapping is removed */
mb();

diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h
index 300c6e47..9735a24 100644
--- a/drivers/media/platform/qcom/venus/hfi_venus_io.h
+++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h
@@ -149,6 +149,8 @@
/* Wrapper TZ 6xx */
#define WRAPPER_TZ_BASE_V6 0x000c0000
#define WRAPPER_TZ_CPU_STATUS_V6 0x10
+#define WRAPPER_TZ_XTSS_SW_RESET 0x1000
+#define WRAPPER_XTSS_SW_RESET_BIT BIT(0)

/* Venus AON */
#define AON_BASE_V6 0x000e0000
--
2.7.4

2021-08-12 19:22:22

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH v4 2/7] media: venus: core: Add sc7280 DT compatible and resource data

Quoting Dikshita Agarwal (2021-08-10 02:47:50)
> Adds a sm7280 compatible binding to the venus core.
>
> Co-developed-by: Mansur Alisha Shaik <[email protected]>

This needs a signed-off-by tag from Mansur as well.

> Signed-off-by: Dikshita Agarwal <[email protected]>
> ---
> drivers/media/platform/qcom/venus/core.c | 52 ++++++++++++++++++++++++++++++++
> 1 file changed, 52 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 91b1584..68acfc0 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -743,6 +794,7 @@ static const struct of_device_id venus_dt_match[] = {
> { .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
> { .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
> { .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
> + { .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },

Please sort this alphabetically on compatible string, it helps avoid
merge conflicts.

> { }
> };
> MODULE_DEVICE_TABLE(of, venus_dt_match);

2021-08-30 07:30:28

by Dikshita Agarwal

[permalink] [raw]
Subject: Re: [PATCH v4 0/7] media: venus: Enable venus support on sc7280

Hi Stan,

Could you pls review and ack this series.

Thanks,
Dikshita

On 2021-08-10 15:17, Dikshita Agarwal wrote:
> This series enables support for 6xx venus encode/decode on sc7280.
>
> The driver changes are dependent on [1]yaml and [2]dts patches.
>
> [1]
> https://patchwork.kernel.org/project/linux-arm-msm/list/?series=484019
> [2]
> https://patchwork.kernel.org/project/linux-arm-msm/list/?series=484727
>
> Changes since v3:
> - addressed comments on v3 (stanimir).
> - rebased the changes on latest media tree.
>
> Dikshita Agarwal (7):
> venus: firmware: enable no tz fw loading for sc7280
> media: venus: core: Add sc7280 DT compatible and resource data
> media: venus: Add num_vpp_pipes to resource structure
> media: venus: hfi: Skip AON register programming for V6 1pipe
> venus: vdec: set work route to fw
> media: venus: helpers: update NUM_MBS macro calculation
> media: venus: Set buffer to FW based on FW min count requirement.
>
> drivers/media/platform/qcom/venus/core.c | 54
> ++++++++++++++++++++++
> drivers/media/platform/qcom/venus/core.h | 2 +
> drivers/media/platform/qcom/venus/firmware.c | 42
> ++++++++++++-----
> drivers/media/platform/qcom/venus/helpers.c | 23 +++++----
> drivers/media/platform/qcom/venus/hfi_cmds.c | 7 +++
> drivers/media/platform/qcom/venus/hfi_helper.h | 14 ++++++
> drivers/media/platform/qcom/venus/hfi_msgs.c | 7 +++
> .../media/platform/qcom/venus/hfi_plat_bufs_v6.c | 6 ++-
> drivers/media/platform/qcom/venus/hfi_platform.c | 13 ------
> drivers/media/platform/qcom/venus/hfi_platform.h | 2 -
> .../media/platform/qcom/venus/hfi_platform_v6.c | 6 ---
> drivers/media/platform/qcom/venus/hfi_venus.c | 4 ++
> drivers/media/platform/qcom/venus/hfi_venus_io.h | 2 +
> drivers/media/platform/qcom/venus/vdec.c | 42
> ++++++++++++++---
> 14 files changed, 175 insertions(+), 49 deletions(-)