Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1eac758b authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: access CVP NOC register only for supported HW"

parents a071e468 f3c5f974
Loading
Loading
Loading
Loading
+1 −63
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#include "msm_vidc_debug.h"
@@ -121,26 +121,6 @@
#define VIDC_UC_REGION_ADDR_AR50_LT		VIDC_CPU_CS_SCIBARG1_AR50_LT
#define VIDC_UC_REGION_SIZE_AR50_LT		VIDC_CPU_CS_SCIBARG2_AR50_LT

/*
 * --------------------------------------------------------------------------
 * MODULE: vcodec noc error log registers
 * --------------------------------------------------------------------------
 */
#define VCODEC_CORE0_VIDEO_NOC_BASE_OFFS		0x00004000
#define VCODEC_COREX_VIDEO_NOC_ERR_SWID_LOW_OFFS	0x0500
#define VCODEC_COREX_VIDEO_NOC_ERR_SWID_HIGH_OFFS	0x0504
#define VCODEC_COREX_VIDEO_NOC_ERR_MAINCTL_LOW_OFFS	0x0508
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRVLD_LOW_OFFS	0x0510
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRCLR_LOW_OFFS	0x0518
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG0_LOW_OFFS	0x0520
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG0_HIGH_OFFS	0x0524
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG1_LOW_OFFS	0x0528
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG1_HIGH_OFFS	0x052C
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG2_LOW_OFFS	0x0530
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG2_HIGH_OFFS	0x0534
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG3_LOW_OFFS	0x0538
#define VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG3_HIGH_OFFS	0x053C

void __interrupt_init_ar50_lt(struct venus_hfi_device *device, u32 sid)
{
	__write_register(device, VIDC_WRAPPER_INTR_MASK_AR50_LT,
@@ -163,48 +143,6 @@ void __setup_ucregion_memory_map_ar50_lt(struct venus_hfi_device *device, u32 si
				(u32)device->qdss.align_device_addr, sid);
}

void __noc_error_info_ar50_lt(struct venus_hfi_device *device)
{
	u32 val;
	u32 vcodec_core_video_noc_base_offs =
			VCODEC_CORE0_VIDEO_NOC_BASE_OFFS;
	u32 sid = DEFAULT_SID;

	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_SWID_LOW_OFFS, sid);
	d_vpr_e("NOC_ERR_SWID_LOW:     %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_SWID_HIGH_OFFS, sid);
	d_vpr_e("NOC_ERR_SWID_HIGH:    %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_MAINCTL_LOW_OFFS, sid);
	d_vpr_e("NOC_ERR_MAINCTL_LOW:  %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG0_LOW_OFFS, sid);
	d_vpr_e("NOC_ERR_ERRLOG0_LOW:  %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG0_HIGH_OFFS, sid);
	d_vpr_e("NOC_ERR_ERRLOG0_HIGH: %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG1_LOW_OFFS, sid);
	d_vpr_e("NOC_ERR_ERRLOG1_LOW:  %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG1_HIGH_OFFS, sid);
	d_vpr_e("NOC_ERR_ERRLOG1_HIGH: %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG2_LOW_OFFS, sid);
	d_vpr_e("NOC_ERR_ERRLOG2_LOW:  %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG2_HIGH_OFFS, sid);
	d_vpr_e("NOC_ERR_ERRLOG2_HIGH: %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG3_LOW_OFFS, sid);
	d_vpr_e("NOC_ERR_ERRLOG3_LOW:  %#x\n", val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG3_HIGH_OFFS, sid);
	d_vpr_e("NOC_ERR_ERRLOG3_HIGH: %#x\n", val);
}

void __power_off_ar50_lt(struct venus_hfi_device *device)
{
	if (!device->power_enabled)
+39 −37
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ struct venus_hfi_vpu_ops ar50_lite_ops = {
	.prepare_pc = __prepare_pc_ar50_lt,
	.raise_interrupt = __raise_interrupt_ar50_lt,
	.watchdog = __watchdog_common,
	.noc_error_info = __noc_error_info_ar50_lt,
	.noc_error_info = __noc_error_info_common,
	.core_clear_interrupt = __core_clear_interrupt_ar50_lt,
	.boot_firmware = __boot_firmware_ar50_lt,
};
@@ -4645,74 +4645,76 @@ static int venus_hfi_get_core_capabilities(void *dev)
	return rc;
}

static void __noc_error_info(struct venus_hfi_device *device, u32 core_num)
static void __noc_error_info(struct venus_hfi_device *device, u32 core_type)
{
	u32 vcodec_core_video_noc_base_offs, val;
	u32 noc_base_offs, val;
	u32 sid = DEFAULT_SID;

	if (!device) {
		d_vpr_e("%s: null device\n", __func__);
		return;
	}
	if (!core_num) {
		vcodec_core_video_noc_base_offs =
	if (!core_type) {
		noc_base_offs =
			VCODEC_CORE0_VIDEO_NOC_BASE_OFFS;
	} else if (core_num == 1) {
		vcodec_core_video_noc_base_offs =
			VCODEC_CORE1_VIDEO_NOC_BASE_OFFS;
	} else if (core_type == 1) {
		noc_base_offs =
			CVP_NOC_BASE_OFFS;
	} else {
		d_vpr_e("%s: invalid core_num %u\n", __func__, core_num);
		d_vpr_e("%s: invalid core_type %u\n", __func__, core_type);
		return;
	}

	val = __read_register(device, vcodec_core_video_noc_base_offs +
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_SWID_LOW_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_SWID_LOW:     %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_SWID_LOW:     %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_SWID_HIGH_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_SWID_HIGH:    %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_SWID_HIGH:    %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_MAINCTL_LOW_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_MAINCTL_LOW:  %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_MAINCTL_LOW:  %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG0_LOW_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG0_LOW:  %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG0_LOW:  %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG0_HIGH_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG0_HIGH: %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG0_HIGH: %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG1_LOW_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG1_LOW:  %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG1_LOW:  %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG1_HIGH_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG1_HIGH: %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG1_HIGH: %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG2_LOW_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG2_LOW:  %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG2_LOW:  %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG2_HIGH_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG2_HIGH: %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG2_HIGH: %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG3_LOW_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG3_LOW:  %#x\n", core_num, val);
	val = __read_register(device, vcodec_core_video_noc_base_offs +
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG3_LOW:  %#x\n", core_type, val);
	val = __read_register(device, noc_base_offs +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRLOG3_HIGH_OFFS, sid);
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG3_HIGH: %#x\n", core_num, val);
	d_vpr_e("CORE%d_NOC_ERR_ERRLOG3_HIGH: %#x\n", core_type, val);
}

static void __noc_error_info_common(struct venus_hfi_device *device)
{
	const u32 core0 = 0, core1 = 1;
	const u32 vcodec = 0, cvp = 1;

	if (__read_register(device, VCODEC_CORE0_VIDEO_NOC_BASE_OFFS +
			VCODEC_COREX_VIDEO_NOC_ERR_ERRVLD_LOW_OFFS,
			DEFAULT_SID))
		__noc_error_info(device, core0);
		__noc_error_info(device, vcodec);

	if (__read_register(device, VCODEC_CORE1_VIDEO_NOC_BASE_OFFS +
	if (device->res->vpu_ver == VPU_VERSION_IRIS1) {
		if (__read_register(device, CVP_NOC_BASE_OFFS +
				VCODEC_COREX_VIDEO_NOC_ERR_ERRVLD_LOW_OFFS,
				DEFAULT_SID))
		__noc_error_info(device, core1);
			__noc_error_info(device, cvp);
	}
}

static int venus_hfi_noc_error_info(void *dev)
+1 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */

#ifndef __HFI_COMMON_H__
@@ -329,6 +329,5 @@ int __prepare_pc_ar50_lt(struct venus_hfi_device *device);
void __raise_interrupt_ar50_lt(struct venus_hfi_device *device, u32 sid);
void __core_clear_interrupt_ar50_lt(struct venus_hfi_device *device);
int __boot_firmware_ar50_lt(struct venus_hfi_device *device, u32 sid);
void __noc_error_info_ar50_lt(struct venus_hfi_device *device);

#endif
+2 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#ifndef __HFI_IO_COMMON_H__
@@ -122,7 +122,7 @@
 * --------------------------------------------------------------------------
 */
#define VCODEC_CORE0_VIDEO_NOC_BASE_OFFS		0x00004000
#define VCODEC_CORE1_VIDEO_NOC_BASE_OFFS		0x0000C000
#define CVP_NOC_BASE_OFFS				0x0000C000
#define VCODEC_COREX_VIDEO_NOC_ERR_SWID_LOW_OFFS	0x0500
#define VCODEC_COREX_VIDEO_NOC_ERR_SWID_HIGH_OFFS	0x0504
#define VCODEC_COREX_VIDEO_NOC_ERR_MAINCTL_LOW_OFFS	0x0508