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

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

Merge "defconfig: Enable minidump support for SM8150 target"

parents a455935c b6e4755d
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1266,6 +1266,11 @@
			reg = <0x65c 4>;
			reg = <0x65c 4>;
		};
		};


		dload_type@1c {
			compatible = "qcom,msm-imem-dload-type";
			reg = <0x1c 0x4>;
		};

		boot_stats@6b0 {
		boot_stats@6b0 {
			compatible = "qcom,msm-imem-boot_stats";
			compatible = "qcom,msm-imem-boot_stats";
			reg = <0x6b0 32>;
			reg = <0x6b0 32>;
+1 −0
Original line number Original line Diff line number Diff line
@@ -517,6 +517,7 @@ CONFIG_QCOM_SECURE_BUFFER=y
CONFIG_ICNSS=y
CONFIG_ICNSS=y
CONFIG_ICNSS_QMI=y
CONFIG_ICNSS_QMI=y
CONFIG_QCOM_EUD=y
CONFIG_QCOM_EUD=y
CONFIG_QCOM_MINIDUMP=y
CONFIG_QCOM_BUS_SCALING=y
CONFIG_QCOM_BUS_SCALING=y
CONFIG_QCOM_BUS_CONFIG_RPMH=y
CONFIG_QCOM_BUS_CONFIG_RPMH=y
CONFIG_QCOM_COMMAND_DB=y
CONFIG_QCOM_COMMAND_DB=y
+1 −0
Original line number Original line Diff line number Diff line
@@ -541,6 +541,7 @@ CONFIG_ICNSS=y
CONFIG_ICNSS_DEBUG=y
CONFIG_ICNSS_DEBUG=y
CONFIG_ICNSS_QMI=y
CONFIG_ICNSS_QMI=y
CONFIG_QCOM_EUD=y
CONFIG_QCOM_EUD=y
CONFIG_QCOM_MINIDUMP=y
CONFIG_QCOM_BUS_SCALING=y
CONFIG_QCOM_BUS_SCALING=y
CONFIG_QCOM_BUS_CONFIG_RPMH=y
CONFIG_QCOM_BUS_CONFIG_RPMH=y
CONFIG_QCOM_COMMAND_DB=y
CONFIG_QCOM_COMMAND_DB=y
+36 −11
Original line number Original line Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -46,7 +46,7 @@ static void __init register_log_buf(void)
static void register_stack_entry(struct md_region *ksp_entry, u64 sp, u64 size,
static void register_stack_entry(struct md_region *ksp_entry, u64 sp, u64 size,
				 u32 cpu)
				 u32 cpu)
{
{
	struct page *sp_page = vmalloc_to_page((const void *) sp);
	struct page *sp_page;
	struct vm_struct *stack_vm_area = task_stack_vm_area(current);
	struct vm_struct *stack_vm_area = task_stack_vm_area(current);


	ksp_entry->virt_addr = sp;
	ksp_entry->virt_addr = sp;
@@ -92,17 +92,44 @@ static void __init register_kernel_sections(void)
	}
	}
}
}


static inline bool in_stack_range(u64 sp, u64 base_addr, unsigned int
				  stack_size)
{
	u64 min_addr = base_addr;
	u64 max_addr = base_addr + stack_size;

	return (min_addr <= sp && sp < max_addr);
}

static unsigned int calculate_copy_pages(u64 sp, struct vm_struct *stack_area)
{
	u64 tsk_stack_base = (u64) stack_area->addr;
	u64 offset;
	unsigned int stack_pages, copy_pages;

	if (in_stack_range(sp, tsk_stack_base, get_vm_area_size(stack_area))) {
		offset = sp - tsk_stack_base;
		stack_pages = get_vm_area_size(stack_area) / PAGE_SIZE;
		copy_pages = stack_pages - (offset / PAGE_SIZE);
	} else {
		copy_pages = 0;
	}
	return copy_pages;
}

void dump_stack_minidump(u64 sp)
void dump_stack_minidump(u64 sp)
{
{
	struct md_region ksp_entry, ktsk_entry;
	struct md_region ksp_entry, ktsk_entry;
	u32 cpu = smp_processor_id();
	u32 cpu = smp_processor_id();
	struct vm_struct *stack_vm_area;
	struct vm_struct *stack_vm_area;
	unsigned int stack_pages, i, copy_pages;
	unsigned int i, copy_pages;
	u64 base_addr;


	if (is_idle_task(current))
	if (is_idle_task(current))
		return;
		return;


	if (sp < KIMAGE_VADDR || sp > -256UL)
		sp = current_stack_pointer;

	/*
	/*
	 * Since stacks are now allocated with vmalloc, the translation to
	 * Since stacks are now allocated with vmalloc, the translation to
	 * physical address is not a simple linear transformation like it is
	 * physical address is not a simple linear transformation like it is
@@ -113,18 +140,16 @@ void dump_stack_minidump(u64 sp)
	 */
	 */
	stack_vm_area = task_stack_vm_area(current);
	stack_vm_area = task_stack_vm_area(current);
	if (stack_vm_area) {
	if (stack_vm_area) {
		sp = PAGE_ALIGN(sp);
		sp &= ~(PAGE_SIZE - 1);
		scnprintf(ksp_entry.name, sizeof(ksp_entry.name), "KSTACK%d",
		copy_pages = calculate_copy_pages(sp, stack_vm_area);
			  cpu);
		base_addr = (u64) stack_vm_area->addr;
		stack_pages = get_vm_area_size(stack_vm_area) >> PAGE_SHIFT;
		copy_pages = stack_pages - ((sp - base_addr) / PAGE_SIZE);
		for (i = 0; i < copy_pages; i++) {
		for (i = 0; i < copy_pages; i++) {
			scnprintf(ksp_entry.name, sizeof(ksp_entry.name),
				  "KSTACK%d_%d", cpu, i);
			register_stack_entry(&ksp_entry, sp, PAGE_SIZE, cpu);
			register_stack_entry(&ksp_entry, sp, PAGE_SIZE, cpu);
			sp += PAGE_SIZE;
			sp += PAGE_SIZE;
		}
		}
	} else {
	} else {
		sp &= (THREAD_SIZE - 1);
		sp &= ~(THREAD_SIZE - 1);
		scnprintf(ksp_entry.name, sizeof(ksp_entry.name), "KSTACK%d",
		scnprintf(ksp_entry.name, sizeof(ksp_entry.name), "KSTACK%d",
			  cpu);
			  cpu);
		register_stack_entry(&ksp_entry, sp, THREAD_SIZE, cpu);
		register_stack_entry(&ksp_entry, sp, THREAD_SIZE, cpu);