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

Commit ebecac6f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "firmware: qcom: tz_log: fix reading log issue on secure boot enabled device"

parents 17b43488 e9654a29
Loading
Loading
Loading
Loading
+35 −2
Original line number Diff line number Diff line
@@ -57,6 +57,11 @@
 * TZ 3.X version info
 */
#define QSEE_VERSION_TZ_3_X 0x800000

#define TZBSP_AES_256_ENCRYPTED_KEY_SIZE 256
#define TZBSP_NONCE_LEN 12
#define TZBSP_TAG_LEN 16

/*
 * VMID Table
 */
@@ -125,6 +130,14 @@ struct tzdbg_int_t {
	uint64_t int_count[TZBSP_MAX_CPU_COUNT]; /* # of times seen per CPU */
};

/* warm boot reason for cores */
struct tzbsp_diag_wakeup_info_t {
	/* Wake source info : APCS_GICC_HPPIR */
	uint32_t HPPIR;
	/* Wake source info : APCS_GICC_AHPPIR */
	uint32_t AHPPIR;
};

/*
 * Log ring buffer position
 */
@@ -179,6 +192,10 @@ struct tzdbg_t {
	 * Ring Buffer Length
	 */
	uint32_t ring_len;

	/* Offset for Wakeup info */
	uint32_t wakeup_info_off;

	/*
	 * VMID to EE Mapping
	 */
@@ -193,6 +210,16 @@ struct tzdbg_t {
	struct tzdbg_reset_info_t reset_info[TZBSP_MAX_CPU_COUNT];
	uint32_t num_interrupts;
	struct tzdbg_int_t  int_info[TZBSP_DIAG_INT_NUM];

	/* Wake up info */
	struct tzbsp_diag_wakeup_info_t  wakeup_info[TZBSP_MAX_CPU_COUNT];

	uint8_t key[TZBSP_AES_256_ENCRYPTED_KEY_SIZE];

	uint8_t nonce[TZBSP_NONCE_LEN];

	uint8_t tag[TZBSP_TAG_LEN];

	/*
	 * We need at least 2K for the ring buffer
	 */
@@ -731,10 +758,16 @@ static ssize_t tzdbgfs_read(struct file *file, char __user *buf,
	int len = 0;
	int *tz_id =  file->private_data;

	if (*tz_id == TZDBG_BOOT || *tz_id == TZDBG_RESET ||
		*tz_id == TZDBG_INTERRUPT || *tz_id == TZDBG_GENERAL ||
		*tz_id == TZDBG_VMID || *tz_id == TZDBG_LOG)
		memcpy_fromio((void *)tzdbg.diag_buf, tzdbg.virt_iobase,
						debug_rw_buf_size);

	if (*tz_id == TZDBG_HYP_GENERAL || *tz_id == TZDBG_HYP_LOG)
		memcpy_fromio((void *)tzdbg.hyp_diag_buf, tzdbg.hyp_virt_iobase,
					tzdbg.hyp_debug_rw_buf_size);

	switch (*tz_id) {
	case TZDBG_BOOT:
		len = _disp_tz_boot_stats();