summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorYashomati <ygodbole@nvidia.com>2019-10-30 16:02:08 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2019-12-24 14:59:10 -0500
commiteb4d442fb0bd424c6bc6e4ce593368363161ad80 (patch)
treec91ebe2f859772d84f33a5349486392fdaef3501 /include/linux
parent87dc30edda5936afa82b0afa821c8be2e44343c5 (diff)
inject-vm-err: misc. improvements
- Prevented bad mode entry for unassigned offender as no point in rebooting the Privileged guest in that case. - Made the driver to fire build bug if sizes of structures shared with HV code are out of sync. - Replaced enum variables with unsigned int in err_data structure members to avoid ambiguity in size used by HV and Linux compilers for enum. - Renamed variables from camelCase to small_case, added tegra-hv prefix, etc. - Removed sending of redundant parameter while sending ack for sync error. - Added #undef _X5,6,7_X17 for completeness that was missed earlier. JIRA ESV-312 Bug 2580803 Change-Id: Ibf49c80a2e781dd75faadd96813b9c19e31e68bf Signed-off-by: Yashomati <ygodbole@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2228786 (cherry picked from commit 7364fbd8661997c98a4d9fa036ad3a5659fe319e) Reviewed-on: https://git-master.nvidia.com/r/2254757 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Dmitry Pervushin <dpervushin@nvidia.com> Reviewed-by: Hardik T Shah <hardikts@nvidia.com> Reviewed-by: Rohit Upadhyay <rupadhyay@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/errinfo.h77
-rw-r--r--include/linux/vm_err.h22
2 files changed, 50 insertions, 49 deletions
diff --git a/include/linux/errinfo.h b/include/linux/errinfo.h
index eca3a9bcb..641b17fa7 100644
--- a/include/linux/errinfo.h
+++ b/include/linux/errinfo.h
@@ -8,10 +8,11 @@
8 * license agreement from NVIDIA CORPORATION is strictly prohibited. 8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */ 9 */
10 10
11#ifndef __INCLUDED_ERRINFO_H__ 11#ifndef __TEGRA_HV_ERRINFO_H__
12#define __INCLUDED_ERRINFO_H__ 12#define __TEGRA_HV_ERRINFO_H__
13 13
14enum errReason { 14/* Supported synchronous and asynchronous errors */
15enum err_reason {
15 REASON_UNDEFINED = 0UL, 16 REASON_UNDEFINED = 0UL,
16 REASON_ASYNC_SMMU_CB, 17 REASON_ASYNC_SMMU_CB,
17 REASON_ASYNC_SMMU_GLOBAL, 18 REASON_ASYNC_SMMU_GLOBAL,
@@ -23,19 +24,19 @@ enum errReason {
23 REASON_ENUM_SIZE 24 REASON_ENUM_SIZE
24}; 25};
25 26
26enum errType { 27enum err_type {
27 SYNC = 0UL, 28 SYNC = 0UL,
28 ASYNC 29 ASYNC
29}; 30};
30 31
31struct __attribute__((__packed__)) async_metaData { 32struct __attribute__((__packed__)) async_metadata_t {
32 uint64_t rdIdx; 33 uint64_t rd_idx;
33 uint64_t wrIdx; 34 uint64_t wr_idx;
34}; 35};
35 36
36#define NAME_SIZE 64 37#define NAME_SIZE 64
37 38
38struct __attribute__((__packed__)) async_bridgeErr { 39struct __attribute__((__packed__)) async_bridge_err_t {
39 char br_name[NAME_SIZE]; 40 char br_name[NAME_SIZE];
40 unsigned int err_addr; 41 unsigned int err_addr;
41 unsigned int err_status1; 42 unsigned int err_status1;
@@ -52,7 +53,7 @@ struct __attribute__((__packed__)) async_bridgeErr {
52 unsigned int cache; 53 unsigned int cache;
53}; 54};
54 55
55struct __attribute__((__packed__)) async_smmuErr { 56struct __attribute__((__packed__)) async_smmu_err_t {
56 unsigned int stream_id; 57 unsigned int stream_id;
57 unsigned int cb_id; 58 unsigned int cb_id;
58 unsigned int fsynr0; 59 unsigned int fsynr0;
@@ -61,39 +62,39 @@ struct __attribute__((__packed__)) async_smmuErr {
61 unsigned int fsr; 62 unsigned int fsr;
62}; 63};
63 64
64struct __attribute__((__packed__)) async_mcErr { 65struct __attribute__((__packed__)) async_mc_err_t {
65 uint64_t ch_base; 66 uint64_t ch_base;
66 unsigned int int_status; 67 unsigned int int_status;
67 unsigned int err_status; 68 unsigned int err_status;
68 uint64_t fault_addr; 69 uint64_t fault_addr;
69 unsigned int vcpuid; //0xffffU; /* IDLE_vCPU_ID */ 70 unsigned int vcpuid; /* 0xffffU IDLE_vCPU_ID */
70 unsigned int client_id; 71 unsigned int client_id;
71 int32_t peripheral_id; 72 int32_t peripheral_id;
72}; 73};
73 74
74struct __attribute__((__packed__)) sync_dataAbort { 75struct __attribute__((__packed__)) sync_data_abort_t {
75 bool isFilled; //metadata field per VCpu 76 bool is_filled; /* metadata field per vcpu */
76 bool isWrite; 77 bool is_write;
77 uint8_t accessSize; 78 uint8_t access_size;
78 unsigned int offendingVCpuId; 79 unsigned int offending_vcpu_id;
79 unsigned int esrEl2; 80 unsigned int esr_el2;
80 uint64_t faultAddr; 81 uint64_t fault_addr;
81 uint64_t spsrEl2; 82 uint64_t spsr_el2;
82 uint64_t elrEl1; 83 uint64_t elr_el1;
83 uint64_t gprArray[31]; 84 uint64_t gpr_array[31];
84}; 85};
85 86
86struct __attribute__((__packed__)) errData { 87struct __attribute__((__packed__)) err_data_t {
87 unsigned int offendingGuestId; 88 unsigned int offending_guest_id;
88 enum errType errType; 89 unsigned int err_type;
89 enum errReason errReason; 90 unsigned int err_reason;
90 union { 91 union {
91 // *A*synchronous 92 /* Asynchronous */
92 struct async_bridgeErr async_bridgeErr; 93 struct async_bridge_err_t async_bridge_err;
93 struct async_smmuErr async_smmuErr; 94 struct async_smmu_err_t async_smmu_err;
94 struct async_mcErr async_mcErr; 95 struct async_mc_err_t async_mc_err;
95 // Synchronous 96 /* Synchronous */
96 struct sync_dataAbort sync_dataAbort; 97 struct sync_data_abort_t sync_data_abort;
97 }; 98 };
98}; 99};
99 100
@@ -110,15 +111,15 @@ struct __attribute__((__packed__)) errData {
110 * 111 *
111 * So for a give VM, shared memory has: 112 * So for a give VM, shared memory has:
112 * 113 *
113 * |--------ASyncErrInfo----------------|-------SyncErrInfo-------------------| 114 * |--------ASyncErrInfo--------------|---------SyncErrInfo-------------------|
114 * |--------1bufferPerVM----------------|---VCpu0-buffer---|--VCpuN-buffer----| 115 * |--------1bufferPerVM--------------|---VCpu0-buffer----|---VCpuN-buffer----|
115 * |---metaData----|---errData----------|-metaData+errData-|-metaData+errData-| 116 * |---metadata---|---err_data--------|-metadata+err_data-|-metadata+err_data-|
116 * |-rdIdx-|-wrIdx-|-Err1-|-Err2-|-ErrN-|-isFilled-|-Err1--|-isFilled-|-Err1--| 117 * |rd_idx|wr_idx|-Err1-|-Err2-|-ErrN-|-is_filled-|-Err1--|-is_filled-|--Err1-|
117 */ 118 */
118 119
119struct __attribute__((__packed__)) errInfo { 120struct __attribute__((__packed__)) err_info_t {
120 struct async_metaData async_metaData; 121 struct async_metadata_t async_metadata;
121 struct errData errData[]; 122 struct err_data_t err_data[];
122}; 123};
123 124
124#endif 125#endif
diff --git a/include/linux/vm_err.h b/include/linux/vm_err.h
index e8fcae8b6..a891265ce 100644
--- a/include/linux/vm_err.h
+++ b/include/linux/vm_err.h
@@ -12,19 +12,19 @@
12 * 12 *
13 */ 13 */
14 14
15#ifndef __VM_ERR_H_ 15#ifndef __TEGRA_HV_VM_ERR_H_
16#define __VM_ERR_H_ 16#define __TEGRA_HV_VM_ERR_H_
17 17
18#if IS_ENABLED(CONFIG_TEGRA_VM_ERR_HANDLER) 18#if IS_ENABLED(CONFIG_TEGRA_VM_ERR_HANDLER)
19#include <linux/errinfo.h> 19#include <linux/errinfo.h>
20 20
21struct vm_err_handlers { 21struct tegra_hv_vm_err_handlers {
22 /* return true, if error needs kernel to enter bad mode and reboot. 22 /* return true, if error needs kernel to enter bad mode and reboot.
23 * return false, if error doesn't need reboot. 23 * return false, if error doesn't need reboot.
24 */ 24 */
25 bool (*fn_self_async)(const struct errData *const err_data); 25 bool (*fn_self_async)(const struct err_data_t *const err_data);
26 bool (*fn_self_sync)(const struct errData *const err_data); 26 bool (*fn_self_sync)(const struct err_data_t *const err_data);
27 bool (*fn_peer)(const struct errData *const err_data); 27 bool (*fn_peer)(const struct err_data_t *const err_data);
28}; 28};
29 29
30struct tegra_hv_config { 30struct tegra_hv_config {
@@ -32,9 +32,9 @@ struct tegra_hv_config {
32 unsigned int num_guests; 32 unsigned int num_guests;
33}; 33};
34 34
35static const char * const fault_reason_desc[] = { 35static const char * const tegra_hv_err_reason_desc[] = {
36 "Undefined", 36 "Undefined",
37 "SMMU CB", 37 "SMMU Context Bank",
38 "SMMU Global", 38 "SMMU Global",
39 "Bridge", 39 "Bridge",
40 "Memory Controller", 40 "Memory Controller",
@@ -43,16 +43,16 @@ static const char * const fault_reason_desc[] = {
43 "Other synchronous exception", 43 "Other synchronous exception",
44}; 44};
45 45
46int tegra_hv_register_vm_err_hooks(struct vm_err_handlers *custom_handlers); 46int tegra_hv_register_vm_err_hooks(struct tegra_hv_vm_err_handlers *handlers);
47void tegra_hv_get_config(struct tegra_hv_config *config); 47void tegra_hv_get_config(struct tegra_hv_config *config);
48 48
49#else 49#else
50static inline int tegra_hv_register_vm_err_hooks( 50static inline int tegra_hv_register_vm_err_hooks(
51 struct vm_err_handlers *custom_handlers) 51 struct tegra_hv_vm_err_handlers *custom_handlers)
52{ 52{
53 pr_err("Can you please enable CONFIG_TEGRA_VM_ERR_HANDLER?"); 53 pr_err("Can you please enable CONFIG_TEGRA_VM_ERR_HANDLER?");
54 return -EINVAL; 54 return -EINVAL;
55} 55}
56#endif 56#endif
57 57
58#endif /* __VM_ERR_H_ */ 58#endif /* __TEGRA_HV_VM_ERR_H_ */