From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: "Yan, Xiangyang" Date: Wed, 11 Jan 2017 01:26:27 +0000 Subject: [PATCH] trusty: Add VMM PANIC dump data. 1. Increase the alloced size of dump data field to 4 page; 2. Kick off '\r' character in dump data which is outputted from mon_vsprintf_s() in evmm code; Change-Id: I255d97c2a7e898c8d4e1f15777ddd7f7c11af2b0 Tracked-On: OAM-34720 Signed-off-by: Yan, Xiangyang Reviewed-by: Gross, Mark --- drivers/trusty/trusty-log.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/trusty/trusty-log.c b/drivers/trusty/trusty-log.c index a066481..8091a59 100644 --- a/drivers/trusty/trusty-log.c +++ b/drivers/trusty/trusty-log.c @@ -154,15 +154,28 @@ static void trusty_vmm_dump_header(struct deadloop_dump *dump) static void trusty_vmm_dump_data(struct deadloop_dump *dump) { struct dump_data *dump_data; - int i; + char *p, *pstr; if (!dump) return; dump_data = &(dump->data); - for (i = 0; i < dump_data->length; i++) - pr_info("%c", dump_data->data[i]); + pstr = (char *)dump_data->data; + for (p = pstr; p < ((char *)dump_data->data + dump_data->length); p++) { + if (*p == '\r') { + *p = 0x00; + } else if (*p == '\n') { + *p = 0x00; + pr_info("%s\n", pstr); + pstr = (char *)(p + 1); + } + } + /* dump the characters in the last line */ + if ((pstr - (char *)(dump_data->data)) < dump_data->length) { + *p = 0x00; + pr_info("%s\n", pstr); + } } static int trusty_vmm_panic_notify(struct notifier_block *nb, @@ -287,7 +300,7 @@ static int trusty_log_probe(struct platform_device *pdev) } /* allocate debug buffer for vmm panic dump */ - g_vmm_debug_buf = get_zeroed_page(GFP_KERNEL); + g_vmm_debug_buf = __get_free_pages(GFP_KERNEL | __GFP_ZERO, 2); if (!g_vmm_debug_buf) { result = -ENOMEM; goto error_alloc_vmm; -- 2.21.0