cvp_dump.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __H_CVP_MINIDUMP_H__
  6. #define __H_CVP_MINIDUMP_H__
  7. #include <linux/notifier.h>
  8. #include <linux/kernel.h>
  9. #include "cvp_comm_def.h"
  10. enum cvp_dump_type {
  11. CVP_QUEUE_DUMP,
  12. CVP_DBG_DUMP,
  13. CVP_MAX_DUMP,
  14. };
  15. #define MAX_REGION_NAME_LEN 32
  16. #define EVAFW_IMAGE_SIZE 7*1024*1024
  17. #ifdef CVP_MINIDUMP_ENABLED
  18. #include <soc/qcom/minidump.h>
  19. /*
  20. * wrapper for static minidump
  21. * @name: Dump will be collected with this name
  22. * @virt: Virtual address of the buffer which needs to be dumped
  23. * @phys: Physical address of the buffer which needs to be dumped
  24. * @size: Size of the buffer which needs to be dumped
  25. */
  26. int md_eva_dump(const char* name, u64 virt, u64 phys, u64 size);
  27. /*
  28. * Fucntion to add dump region to queue
  29. * @type: Type of the list node which needs to be updated
  30. * @buff_va: Virtual address of the buffer which needs to be dumped
  31. * @buff_size: Size of the buffer which needs to be dumped
  32. * @region_name: Dump will be collected with this name
  33. * @copy: Flag to indicate if the buffer data needs to be copied
  34. * to the intermidiate buffer allocated by kzmalloc.
  35. */
  36. void add_va_node_to_list(enum cvp_dump_type type, void *buff_va,
  37. u32 buff_size, const char *region_name, bool copy);
  38. /*
  39. * Registers subsystem to minidump driver
  40. * @name: Subsytem name which will get registered
  41. * @notf_blk_ptr: notifier block pointer.
  42. * notifier_call mentioned in this block will be triggered by
  43. * minidump driver in case of crash
  44. */
  45. void cvp_va_md_register(char *name, void* notf_blk_ptr);
  46. /* One function where we will register all the regions */
  47. void cvp_register_va_md_region(void);
  48. /*
  49. * Free up the memory allocated for different va_md_list
  50. * Do not forget to add code for any new list in this function
  51. */
  52. void cvp_free_va_md_list(void);
  53. /* Adds the HFI queues(both for CPU and DSP) to the global hfi list head*/
  54. void add_hfi_queue_to_va_md_list(void *device);
  55. /*Add queue header structures(both for CPU and DSP)
  56. to the global struct list head*/
  57. void add_queue_header_to_va_md_list(void *device);
  58. /*
  59. * Node structure for VA_MD Linked List
  60. * @list: linux kernel list implementation
  61. * @va_md_buff: Virtual address of the buffer which needs to be dumped
  62. * @va_md_buff_size: Size of the buffer which needs to be dumped
  63. * @region_name: Dump will be collected with this name
  64. * @copy: Flag to indicate if the buffer data needs to be copied
  65. * to the intermidiate buffer allocated by kzmalloc.
  66. */
  67. struct eva_va_md_queue
  68. {
  69. struct list_head list;
  70. void *va_md_buff;
  71. u32 va_md_buff_size;
  72. char region_name[MAX_REGION_NAME_LEN];
  73. bool copy;
  74. };
  75. #else
  76. static inline int md_eva_dump(const char* name, u64 virt, u64 phys, u64 size)
  77. {
  78. return 0;
  79. }
  80. static inline void add_va_node_to_list(enum cvp_dump_type type, void *buff_va,
  81. u32 buff_size, const char *region_name, bool copy)
  82. {
  83. }
  84. static inline void cvp_va_md_register(char *name, void* notf_blk_ptr)
  85. {
  86. }
  87. static inline void cvp_register_va_md_region(void)
  88. {
  89. }
  90. static inline void cvp_free_va_md_list(void)
  91. {
  92. }
  93. static inline void add_hfi_queue_to_va_md_list(void *device)
  94. {
  95. }
  96. static inline void add_queue_header_to_va_md_list(void *device)
  97. {
  98. }
  99. #endif /* End of CVP_MINIDUMP_ENABLED */
  100. #endif