Loading drivers/staging/android/ion/heaps/Kconfig +8 −0 Original line number Diff line number Diff line Loading @@ -77,3 +77,11 @@ config ION_POOL_FILL_MARK help Set the fillmark of the pool in terms of mega bytes and the lowmark is ION_POOL_LOW_MARK_PERCENT of fillmark value. config PANIC_ON_MSM_ION_HEAPS_FAILURE bool "Trigger kernel panic when msm ion heap probe fails" help This is a debug feature where a kernel panic is triggered when msm ion heap probe fails. This can happen when any invalid heap id, heap types are added in device tree. Panic ensures early detection of such changes. drivers/staging/android/ion/heaps/msm_ion.c +22 −6 Original line number Diff line number Diff line Loading @@ -24,6 +24,12 @@ #define ION_INIT_FAILURE 1 #define ION_READY 2 #ifdef CONFIG_PANIC_ON_MSM_ION_HEAPS_FAILURE #define MSM_ION_WARN(fmt...) panic(fmt) #else /* CONFIG_PANIC_ON_MSM_ION_HEAPS_FAILURE */ #define MSM_ION_WARN(fmt...) WARN(1, fmt) #endif /* CONFIG_PANIC_ON_MSM_ION_HEAPS_FAILURE */ static int num_heaps; static int status = ION_NOT_READY; static struct ion_heap **heaps; Loading Loading @@ -328,8 +334,12 @@ static int msm_ion_get_heap_type_from_dt_node(struct device_node *node, int i, ret = -EINVAL; ret = of_property_read_string(node, "qcom,ion-heap-type", &name); if (ret) if (ret) { pr_err("Reading %s property in node %s failed with err %d.\n", "qcom,ion-heap-type", of_node_full_name(node), ret); goto out; } for (i = 0; i < ARRAY_SIZE(heap_types_info); ++i) { if (!strcmp(heap_types_info[i].name, name)) { *heap_type = heap_types_info[i].heap_type; Loading @@ -337,7 +347,8 @@ static int msm_ion_get_heap_type_from_dt_node(struct device_node *node, goto out; } } WARN(1, "Unknown heap type: %s. You might need to update heap_types_info in %s", pr_err("Unknown heap type: %s. Check and update %s:heap_types_info\n", name, __FILE__); out: return ret; Loading @@ -361,9 +372,10 @@ static int msm_ion_populate_heap(struct device_node *node, break; } } if (ret) pr_err("%s: Unable to populate heap, error: %d\n", __func__, ret); MSM_ION_WARN("%s: Unable to populate heap id 0x%x, error: %d\n", __func__, heap->id, ret); return ret; } Loading Loading @@ -469,7 +481,11 @@ static int msm_ion_get_heap_dt_data(struct device_node *node, ret = init_reserved_memory(heap, pnode); of_node_put(pnode); WARN(ret, "Failed to parse DT node for heap %s\n", heap->name); if (ret) MSM_ION_WARN("Failed to parse DT node for heap %s\n", heap->name); return ret; } Loading Loading
drivers/staging/android/ion/heaps/Kconfig +8 −0 Original line number Diff line number Diff line Loading @@ -77,3 +77,11 @@ config ION_POOL_FILL_MARK help Set the fillmark of the pool in terms of mega bytes and the lowmark is ION_POOL_LOW_MARK_PERCENT of fillmark value. config PANIC_ON_MSM_ION_HEAPS_FAILURE bool "Trigger kernel panic when msm ion heap probe fails" help This is a debug feature where a kernel panic is triggered when msm ion heap probe fails. This can happen when any invalid heap id, heap types are added in device tree. Panic ensures early detection of such changes.
drivers/staging/android/ion/heaps/msm_ion.c +22 −6 Original line number Diff line number Diff line Loading @@ -24,6 +24,12 @@ #define ION_INIT_FAILURE 1 #define ION_READY 2 #ifdef CONFIG_PANIC_ON_MSM_ION_HEAPS_FAILURE #define MSM_ION_WARN(fmt...) panic(fmt) #else /* CONFIG_PANIC_ON_MSM_ION_HEAPS_FAILURE */ #define MSM_ION_WARN(fmt...) WARN(1, fmt) #endif /* CONFIG_PANIC_ON_MSM_ION_HEAPS_FAILURE */ static int num_heaps; static int status = ION_NOT_READY; static struct ion_heap **heaps; Loading Loading @@ -328,8 +334,12 @@ static int msm_ion_get_heap_type_from_dt_node(struct device_node *node, int i, ret = -EINVAL; ret = of_property_read_string(node, "qcom,ion-heap-type", &name); if (ret) if (ret) { pr_err("Reading %s property in node %s failed with err %d.\n", "qcom,ion-heap-type", of_node_full_name(node), ret); goto out; } for (i = 0; i < ARRAY_SIZE(heap_types_info); ++i) { if (!strcmp(heap_types_info[i].name, name)) { *heap_type = heap_types_info[i].heap_type; Loading @@ -337,7 +347,8 @@ static int msm_ion_get_heap_type_from_dt_node(struct device_node *node, goto out; } } WARN(1, "Unknown heap type: %s. You might need to update heap_types_info in %s", pr_err("Unknown heap type: %s. Check and update %s:heap_types_info\n", name, __FILE__); out: return ret; Loading @@ -361,9 +372,10 @@ static int msm_ion_populate_heap(struct device_node *node, break; } } if (ret) pr_err("%s: Unable to populate heap, error: %d\n", __func__, ret); MSM_ION_WARN("%s: Unable to populate heap id 0x%x, error: %d\n", __func__, heap->id, ret); return ret; } Loading Loading @@ -469,7 +481,11 @@ static int msm_ion_get_heap_dt_data(struct device_node *node, ret = init_reserved_memory(heap, pnode); of_node_put(pnode); WARN(ret, "Failed to parse DT node for heap %s\n", heap->name); if (ret) MSM_ION_WARN("Failed to parse DT node for heap %s\n", heap->name); return ret; } Loading