diff mbox series

[v3,09/19] media: venus: core: Drop cache properties in resource struct

Message ID 20230911-topic-mars-v3-9-79f23b81c261@linaro.org (mailing list archive)
State Not Applicable
Headers show
Series Venus cleanups | expand

Commit Message

Konrad Dybcio March 27, 2024, 6:08 p.m. UTC
Currently VMEM/OCMEM/LLCC is disabled on all platforms.

Make it unconditional to save on space.

These caches will not be enabled until the Venus driver can reference
them as chunks of SRAM (they're modelled as separate devices) to avoid
hardcoding magic addresses and rougely accessing the hardware,
bypassing the normal accessors.

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 drivers/media/platform/qcom/venus/core.c      | 24 ------------------------
 drivers/media/platform/qcom/venus/core.h      |  3 ---
 drivers/media/platform/qcom/venus/hfi_venus.c | 10 ++++------
 3 files changed, 4 insertions(+), 33 deletions(-)

Comments

Dikshita Agarwal April 5, 2024, 7:57 a.m. UTC | #1
On 3/27/2024 11:38 PM, Konrad Dybcio wrote:
> Currently VMEM/OCMEM/LLCC is disabled on all platforms.
> 
> Make it unconditional to save on space.
> 
> These caches will not be enabled until the Venus driver can reference
> them as chunks of SRAM (they're modelled as separate devices) to avoid
> hardcoding magic addresses and rougely accessing the hardware,
> bypassing the normal accessors.
> 
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
>  drivers/media/platform/qcom/venus/core.c      | 24 ------------------------
>  drivers/media/platform/qcom/venus/core.h      |  3 ---
>  drivers/media/platform/qcom/venus/hfi_venus.c | 10 ++++------
>  3 files changed, 4 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 26a0c264685a..51ac9eff244c 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -562,9 +562,6 @@ static const struct venus_resources msm8916_res = {
>  	.clks_num = 3,
>  	.max_load = 352800, /* 720p@30 + 1080p@30 */
>  	.hfi_version = HFI_VERSION_1XX,
> -	.vmem_id = VIDC_RESOURCE_NONE,
> -	.vmem_size = 0,
> -	.vmem_addr = 0,
>  	.dma_mask = 0xddc00000 - 1,
>  	.fwname = "qcom/venus-1.8/venus.mbn",
>  };
> @@ -595,9 +592,6 @@ static const struct venus_resources msm8996_res = {
>  	.vcodec_clks_num = 1,
>  	.max_load = 2563200,
>  	.hfi_version = HFI_VERSION_3XX,
> -	.vmem_id = VIDC_RESOURCE_NONE,
> -	.vmem_size = 0,
> -	.vmem_addr = 0,
>  	.dma_mask = 0xddc00000 - 1,
>  	.fwname = "qcom/venus-4.2/venus.mbn",
>  };
> @@ -653,9 +647,6 @@ static const struct venus_resources sdm660_res = {
>  	.vcodec_clks_num = 1,
>  	.max_load = 1036800,
>  	.hfi_version = HFI_VERSION_3XX,
> -	.vmem_id = VIDC_RESOURCE_NONE,
> -	.vmem_size = 0,
> -	.vmem_addr = 0,
>  	.cp_start = 0,
>  	.cp_size = 0x79000000,
>  	.cp_nonpixel_start = 0x1000000,
> @@ -702,9 +693,6 @@ static const struct venus_resources sdm845_res = {
>  	.max_load = 3110400,	/* 4096x2160@90 */
>  	.hfi_version = HFI_VERSION_4XX,
>  	.vpu_version = VPU_VERSION_AR50,
> -	.vmem_id = VIDC_RESOURCE_NONE,
> -	.vmem_size = 0,
> -	.vmem_addr = 0,
>  	.dma_mask = 0xe0000000 - 1,
>  	.fwname = "qcom/venus-5.2/venus.mbn",
>  };
> @@ -727,9 +715,6 @@ static const struct venus_resources sdm845_res_v2 = {
>  	.max_load = 3110400,	/* 4096x2160@90 */
>  	.hfi_version = HFI_VERSION_4XX,
>  	.vpu_version = VPU_VERSION_AR50,
> -	.vmem_id = VIDC_RESOURCE_NONE,
> -	.vmem_size = 0,
> -	.vmem_addr = 0,
>  	.dma_mask = 0xe0000000 - 1,
>  	.cp_start = 0,
>  	.cp_size = 0x70800000,
> @@ -774,9 +759,6 @@ static const struct venus_resources sc7180_res = {
>  	.opp_pmdomain = pd_names_cx,
>  	.hfi_version = HFI_VERSION_4XX,
>  	.vpu_version = VPU_VERSION_AR50,
> -	.vmem_id = VIDC_RESOURCE_NONE,
> -	.vmem_size = 0,
> -	.vmem_addr = 0,
>  	.dma_mask = 0xe0000000 - 1,
>  	.cp_start = 0,
>  	.cp_size = 0x70800000,
> @@ -832,9 +814,6 @@ static const struct venus_resources sm8250_res = {
>  	.hfi_version = HFI_VERSION_6XX,
>  	.vpu_version = VPU_VERSION_IRIS2,
>  	.num_vpp_pipes = 4,
> -	.vmem_id = VIDC_RESOURCE_NONE,
> -	.vmem_size = 0,
> -	.vmem_addr = 0,
>  	.dma_mask = 0xe0000000 - 1,
>  	.fwname = "qcom/vpu-1.0/venus.mbn",
>  };
> @@ -889,9 +868,6 @@ static const struct venus_resources sc7280_res = {
>  	.hfi_version = HFI_VERSION_6XX,
>  	.vpu_version = VPU_VERSION_IRIS2_1,
>  	.num_vpp_pipes = 1,
> -	.vmem_id = VIDC_RESOURCE_NONE,
> -	.vmem_size = 0,
> -	.vmem_addr = 0,
>  	.dma_mask = 0xe0000000 - 1,
>  	.cp_start = 0,
>  	.cp_size = 0x25800000,
> diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
> index 376de1161114..e083ebb3ab4b 100644
> --- a/drivers/media/platform/qcom/venus/core.h
> +++ b/drivers/media/platform/qcom/venus/core.h
> @@ -80,9 +80,6 @@ struct venus_resources {
>  	enum vpu_version vpu_version;
>  	u8 num_vpp_pipes;
>  	u32 max_load;
> -	unsigned int vmem_id;
> -	u32 vmem_size;
> -	u32 vmem_addr;
>  	u32 cp_start;
>  	u32 cp_size;
>  	u32 cp_nonpixel_start;
> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
> index f9437b6412b9..42ff96f71235 100644
> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
> @@ -1067,17 +1067,14 @@ static void venus_process_msg_sys_error(struct venus_hfi_device *hdev,
>  static irqreturn_t venus_isr_thread(struct venus_core *core)
>  {
>  	struct venus_hfi_device *hdev = to_hfi_priv(core);
> -	const struct venus_resources *res;
>  	void *pkt;
>  	u32 msg_ret;
>  
>  	if (!hdev)
>  		return IRQ_NONE;
>  
> -	res = hdev->core->res;
>  	pkt = hdev->pkt_buf;
>  
> -
>  	while (!venus_iface_msgq_read(hdev, pkt)) {
>  		msg_ret = hfi_process_msg_packet(core, pkt);
>  		switch (msg_ret) {
> @@ -1085,9 +1082,10 @@ static irqreturn_t venus_isr_thread(struct venus_core *core)
>  			venus_process_msg_sys_error(hdev, pkt);
>  			break;
>  		case HFI_MSG_SYS_INIT:
> -			venus_hfi_core_set_resource(core, res->vmem_id,
> -						    res->vmem_size,
> -						    res->vmem_addr,
> +			/* Disable OCMEM/VMEM unconditionally until support is added */
> +			venus_hfi_core_set_resource(core, VIDC_RESOURCE_NONE,
> +						    0,
> +						    0,
>  						    hdev);
>  			break;
>  		case HFI_MSG_SYS_RELEASE_RESOURCE:
> 
If no issues reported by firmware on any SOC, then
Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 26a0c264685a..51ac9eff244c 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -562,9 +562,6 @@  static const struct venus_resources msm8916_res = {
 	.clks_num = 3,
 	.max_load = 352800, /* 720p@30 + 1080p@30 */
 	.hfi_version = HFI_VERSION_1XX,
-	.vmem_id = VIDC_RESOURCE_NONE,
-	.vmem_size = 0,
-	.vmem_addr = 0,
 	.dma_mask = 0xddc00000 - 1,
 	.fwname = "qcom/venus-1.8/venus.mbn",
 };
@@ -595,9 +592,6 @@  static const struct venus_resources msm8996_res = {
 	.vcodec_clks_num = 1,
 	.max_load = 2563200,
 	.hfi_version = HFI_VERSION_3XX,
-	.vmem_id = VIDC_RESOURCE_NONE,
-	.vmem_size = 0,
-	.vmem_addr = 0,
 	.dma_mask = 0xddc00000 - 1,
 	.fwname = "qcom/venus-4.2/venus.mbn",
 };
@@ -653,9 +647,6 @@  static const struct venus_resources sdm660_res = {
 	.vcodec_clks_num = 1,
 	.max_load = 1036800,
 	.hfi_version = HFI_VERSION_3XX,
-	.vmem_id = VIDC_RESOURCE_NONE,
-	.vmem_size = 0,
-	.vmem_addr = 0,
 	.cp_start = 0,
 	.cp_size = 0x79000000,
 	.cp_nonpixel_start = 0x1000000,
@@ -702,9 +693,6 @@  static const struct venus_resources sdm845_res = {
 	.max_load = 3110400,	/* 4096x2160@90 */
 	.hfi_version = HFI_VERSION_4XX,
 	.vpu_version = VPU_VERSION_AR50,
-	.vmem_id = VIDC_RESOURCE_NONE,
-	.vmem_size = 0,
-	.vmem_addr = 0,
 	.dma_mask = 0xe0000000 - 1,
 	.fwname = "qcom/venus-5.2/venus.mbn",
 };
@@ -727,9 +715,6 @@  static const struct venus_resources sdm845_res_v2 = {
 	.max_load = 3110400,	/* 4096x2160@90 */
 	.hfi_version = HFI_VERSION_4XX,
 	.vpu_version = VPU_VERSION_AR50,
-	.vmem_id = VIDC_RESOURCE_NONE,
-	.vmem_size = 0,
-	.vmem_addr = 0,
 	.dma_mask = 0xe0000000 - 1,
 	.cp_start = 0,
 	.cp_size = 0x70800000,
@@ -774,9 +759,6 @@  static const struct venus_resources sc7180_res = {
 	.opp_pmdomain = pd_names_cx,
 	.hfi_version = HFI_VERSION_4XX,
 	.vpu_version = VPU_VERSION_AR50,
-	.vmem_id = VIDC_RESOURCE_NONE,
-	.vmem_size = 0,
-	.vmem_addr = 0,
 	.dma_mask = 0xe0000000 - 1,
 	.cp_start = 0,
 	.cp_size = 0x70800000,
@@ -832,9 +814,6 @@  static const struct venus_resources sm8250_res = {
 	.hfi_version = HFI_VERSION_6XX,
 	.vpu_version = VPU_VERSION_IRIS2,
 	.num_vpp_pipes = 4,
-	.vmem_id = VIDC_RESOURCE_NONE,
-	.vmem_size = 0,
-	.vmem_addr = 0,
 	.dma_mask = 0xe0000000 - 1,
 	.fwname = "qcom/vpu-1.0/venus.mbn",
 };
@@ -889,9 +868,6 @@  static const struct venus_resources sc7280_res = {
 	.hfi_version = HFI_VERSION_6XX,
 	.vpu_version = VPU_VERSION_IRIS2_1,
 	.num_vpp_pipes = 1,
-	.vmem_id = VIDC_RESOURCE_NONE,
-	.vmem_size = 0,
-	.vmem_addr = 0,
 	.dma_mask = 0xe0000000 - 1,
 	.cp_start = 0,
 	.cp_size = 0x25800000,
diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
index 376de1161114..e083ebb3ab4b 100644
--- a/drivers/media/platform/qcom/venus/core.h
+++ b/drivers/media/platform/qcom/venus/core.h
@@ -80,9 +80,6 @@  struct venus_resources {
 	enum vpu_version vpu_version;
 	u8 num_vpp_pipes;
 	u32 max_load;
-	unsigned int vmem_id;
-	u32 vmem_size;
-	u32 vmem_addr;
 	u32 cp_start;
 	u32 cp_size;
 	u32 cp_nonpixel_start;
diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
index f9437b6412b9..42ff96f71235 100644
--- a/drivers/media/platform/qcom/venus/hfi_venus.c
+++ b/drivers/media/platform/qcom/venus/hfi_venus.c
@@ -1067,17 +1067,14 @@  static void venus_process_msg_sys_error(struct venus_hfi_device *hdev,
 static irqreturn_t venus_isr_thread(struct venus_core *core)
 {
 	struct venus_hfi_device *hdev = to_hfi_priv(core);
-	const struct venus_resources *res;
 	void *pkt;
 	u32 msg_ret;
 
 	if (!hdev)
 		return IRQ_NONE;
 
-	res = hdev->core->res;
 	pkt = hdev->pkt_buf;
 
-
 	while (!venus_iface_msgq_read(hdev, pkt)) {
 		msg_ret = hfi_process_msg_packet(core, pkt);
 		switch (msg_ret) {
@@ -1085,9 +1082,10 @@  static irqreturn_t venus_isr_thread(struct venus_core *core)
 			venus_process_msg_sys_error(hdev, pkt);
 			break;
 		case HFI_MSG_SYS_INIT:
-			venus_hfi_core_set_resource(core, res->vmem_id,
-						    res->vmem_size,
-						    res->vmem_addr,
+			/* Disable OCMEM/VMEM unconditionally until support is added */
+			venus_hfi_core_set_resource(core, VIDC_RESOURCE_NONE,
+						    0,
+						    0,
 						    hdev);
 			break;
 		case HFI_MSG_SYS_RELEASE_RESOURCE: