diff options
| author | Potharaju Ravi Teja <pteja@nvidia.com> | 2019-10-24 01:37:52 -0400 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2020-01-24 02:41:56 -0500 |
| commit | 7544f678853edea145beff4fb0971fe343ce854e (patch) | |
| tree | bd4821964369b93e1e606e32e8aedde3cea33c35 | |
| parent | dcf5893a70a79e60c57f492fbc7fc8a8e4b08c3a (diff) | |
inject-vm-err: CBB error handler
Add support to handle control back bone errors.
- This change adds a sample handler for cbb error.
It is a minimal handler that just dumps error
information to the console. This can be used as
a reference to implement an elaborate error
handler.
Bug 2580803
Change-Id: I2fbbc994854611a54276068ee90f1d2cffeeb948
(cherry picked from commit ea898756f7b2e4aff8f89546f3b69fc4e97fd300)
Signed-off-by: Potharaju Ravi Teja <pteja@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2279874
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Dmitry Pervushin <dpervushin@nvidia.com>
Reviewed-by: Rohit Upadhyay <rupadhyay@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
| -rw-r--r-- | drivers/virt/tegra/vm_err.c | 7 | ||||
| -rw-r--r-- | drivers/virt/tegra/vm_err_sample_handler.c | 106 | ||||
| -rw-r--r-- | include/linux/errinfo.h | 36 | ||||
| -rw-r--r-- | include/linux/vm_err.h | 3 |
4 files changed, 147 insertions, 5 deletions
diff --git a/drivers/virt/tegra/vm_err.c b/drivers/virt/tegra/vm_err.c index b2f17501d..26443f136 100644 --- a/drivers/virt/tegra/vm_err.c +++ b/drivers/virt/tegra/vm_err.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. |
| 3 | * | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
| @@ -388,6 +388,8 @@ static void shared_structs_check(struct device *dev) | |||
| 388 | sizeof(struct async_metadata_t)); | 388 | sizeof(struct async_metadata_t)); |
| 389 | dev_info(dev, "async_bridge_err size 0x%lx\n", | 389 | dev_info(dev, "async_bridge_err size 0x%lx\n", |
| 390 | sizeof(struct async_bridge_err_t)); | 390 | sizeof(struct async_bridge_err_t)); |
| 391 | dev_info(dev, "async_cbb_err size 0x%lx\n", | ||
| 392 | sizeof(struct async_cbb_err_t)); | ||
| 391 | dev_info(dev, "async_smmu_err size 0x%lx\n", | 393 | dev_info(dev, "async_smmu_err size 0x%lx\n", |
| 392 | sizeof(struct async_smmu_err_t)); | 394 | sizeof(struct async_smmu_err_t)); |
| 393 | dev_info(dev, "async_mc_err size 0x%lx\n", | 395 | dev_info(dev, "async_mc_err size 0x%lx\n", |
| @@ -399,10 +401,11 @@ static void shared_structs_check(struct device *dev) | |||
| 399 | /* Ensure common structures shared by HV and Linux are in sync */ | 401 | /* Ensure common structures shared by HV and Linux are in sync */ |
| 400 | BUILD_BUG_ON(sizeof(struct async_metadata_t) != 0x10); | 402 | BUILD_BUG_ON(sizeof(struct async_metadata_t) != 0x10); |
| 401 | BUILD_BUG_ON(sizeof(struct async_bridge_err_t) != 0x74); | 403 | BUILD_BUG_ON(sizeof(struct async_bridge_err_t) != 0x74); |
| 404 | BUILD_BUG_ON(sizeof(struct async_cbb_err_t) != 0x259); | ||
| 402 | BUILD_BUG_ON(sizeof(struct async_smmu_err_t) != 0x1C); | 405 | BUILD_BUG_ON(sizeof(struct async_smmu_err_t) != 0x1C); |
| 403 | BUILD_BUG_ON(sizeof(struct async_mc_err_t) != 0x24); | 406 | BUILD_BUG_ON(sizeof(struct async_mc_err_t) != 0x24); |
| 404 | BUILD_BUG_ON(sizeof(struct sync_data_abort_t) != 0x11B); | 407 | BUILD_BUG_ON(sizeof(struct sync_data_abort_t) != 0x11B); |
| 405 | BUILD_BUG_ON(sizeof(struct err_data_t) != 0x127); | 408 | BUILD_BUG_ON(sizeof(struct err_data_t) != 0x265); |
| 406 | } | 409 | } |
| 407 | 410 | ||
| 408 | static int vm_err_handler_init(struct platform_device *pdev) | 411 | static int vm_err_handler_init(struct platform_device *pdev) |
diff --git a/drivers/virt/tegra/vm_err_sample_handler.c b/drivers/virt/tegra/vm_err_sample_handler.c index 5876474d3..69f7c7b67 100644 --- a/drivers/virt/tegra/vm_err_sample_handler.c +++ b/drivers/virt/tegra/vm_err_sample_handler.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. |
| 3 | * | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
| @@ -71,6 +71,99 @@ static void print_bridge_error(const struct err_data_t * const err_data) | |||
| 71 | pr_crit("--------------------------------------\n"); | 71 | pr_crit("--------------------------------------\n"); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static void print_cache(uint32_t cache) | ||
| 75 | { | ||
| 76 | if ((cache & 0x3) == 0x0) { | ||
| 77 | pr_crit("\t Cache\t\t\t: 0x%x--Non-cacheable/Non-Bufferable)\n", | ||
| 78 | cache); | ||
| 79 | return; | ||
| 80 | } | ||
| 81 | if ((cache & 0x3) == 0x1) { | ||
| 82 | pr_crit("\t Cache\t\t\t: 0x%x -- Device\n", | ||
| 83 | cache); | ||
| 84 | return; | ||
| 85 | } | ||
| 86 | |||
| 87 | switch (cache) { | ||
| 88 | case 0x2: | ||
| 89 | pr_crit("\t Cache\t\t\t: 0x%x -- Cacheable/Non-Bufferable\n", | ||
| 90 | cache); | ||
| 91 | break; | ||
| 92 | case 0x3: | ||
| 93 | pr_crit("\t Cache\t\t\t: 0x%x -- Cacheable/Bufferable\n", | ||
| 94 | cache); | ||
| 95 | break; | ||
| 96 | default: | ||
| 97 | pr_crit("\t Cache\t\t\t: 0x%x -- Cacheable\n", | ||
| 98 | cache); | ||
| 99 | } | ||
| 100 | } | ||
| 101 | |||
| 102 | static void print_prot(uint32_t prot) | ||
| 103 | { | ||
| 104 | char *data_str; | ||
| 105 | char *secure_str; | ||
| 106 | char *priv_str; | ||
| 107 | |||
| 108 | data_str = (prot & 0x4) ? "Instruction" : "Data"; | ||
| 109 | secure_str = (prot & 0x2) ? "Non-Secure" : "Secure"; | ||
| 110 | priv_str = (prot & 0x1) ? "Privileged" : "Unprivileged"; | ||
| 111 | |||
| 112 | pr_crit("\t Protection\t\t: 0x%x -- %s, %s, %s Access\n", | ||
| 113 | prot, priv_str, secure_str, data_str); | ||
| 114 | } | ||
| 115 | |||
| 116 | static void print_cbb_error(const struct err_data_t * const err_data) | ||
| 117 | { | ||
| 118 | const struct async_cbb_err_t * const cbb_err_data = | ||
| 119 | &err_data->async_cbb_err; | ||
| 120 | |||
| 121 | pr_crit("Control Back Bone(CBB) error details\n"); | ||
| 122 | pr_crit("--------------------------------------\n"); | ||
| 123 | pr_crit("Error:%s\n", cbb_err_data->cbb_name); | ||
| 124 | pr_crit("\tError Logger\t\t: %d\n", cbb_err_data->error_logger); | ||
| 125 | pr_crit("\tErrLog0\t\t\t: 0x%x\n", cbb_err_data->errlog0); | ||
| 126 | pr_crit("\t Transaction Type\t: %s\n", cbb_err_data->transaction_type); | ||
| 127 | pr_crit("\t Error Code\t\t: %s\n", cbb_err_data->error_code); | ||
| 128 | pr_crit("\t Error Source\t\t: %s\n", | ||
| 129 | cbb_err_data->error_source); | ||
| 130 | pr_crit("\t Error Description\t: %s\n", | ||
| 131 | cbb_err_data->error_description); | ||
| 132 | pr_crit("\t Packet header Lock\t: %d\n", | ||
| 133 | cbb_err_data->packet_header_lock); | ||
| 134 | pr_crit("\t Packet header Len1\t: %d\n", | ||
| 135 | cbb_err_data->packet_header_len1); | ||
| 136 | |||
| 137 | if (cbb_err_data->header_format) | ||
| 138 | pr_crit("\t NOC protocol version\t: %s\n", "version >= 2.7"); | ||
| 139 | else | ||
| 140 | pr_crit("\t NOC protocol version\t: %s\n", "version < 2.7"); | ||
| 141 | pr_crit("\tErrLog1\t\t\t: 0x%x\n", cbb_err_data->errlog1); | ||
| 142 | pr_crit("\tErrLog2\t\t\t: 0x%x\n", cbb_err_data->errlog2); | ||
| 143 | pr_crit("\t RouteId\t\t: 0x%llx\n", cbb_err_data->route_id); | ||
| 144 | pr_crit("\t InitFlow\t\t: %s\n", cbb_err_data->initflow); | ||
| 145 | pr_crit("\t Targflow\t\t: %s\n", cbb_err_data->targflow); | ||
| 146 | pr_crit("\t TargSubRange\t\t: %d\n", cbb_err_data->targ_subrange); | ||
| 147 | pr_crit("\t SeqId\t\t\t: %d\n", cbb_err_data->seqid); | ||
| 148 | pr_crit("\tErrLog3\t\t\t: 0x%x\n", cbb_err_data->errlog3); | ||
| 149 | pr_crit("\tErrLog4\t\t\t: 0x%x\n", cbb_err_data->errlog4); | ||
| 150 | pr_crit("\t Address\t\t: 0x%llx\n", cbb_err_data->address); | ||
| 151 | pr_crit("\tErrLog5\t\t\t: 0x%x\n", cbb_err_data->errlog5); | ||
| 152 | pr_crit("\t Master ID\t\t: %s\n", cbb_err_data->master_id); | ||
| 153 | pr_crit("\t Non-Modify\t\t: 0x%x\n", cbb_err_data->non_mod); | ||
| 154 | pr_crit("\t AXI ID\t\t: 0x%x\n", cbb_err_data->axi_id); | ||
| 155 | pr_crit("\t Security Group(GRPSEC): 0x%x\n", | ||
| 156 | cbb_err_data->security_group); | ||
| 157 | |||
| 158 | print_cache(cbb_err_data->cache); | ||
| 159 | print_prot(cbb_err_data->protection); | ||
| 160 | |||
| 161 | pr_crit("\t FALCONSEC\t\t: 0x%x\n", cbb_err_data->falconsec); | ||
| 162 | pr_crit("\t Virtual Queuing Channel(VQC): 0x%x\n", | ||
| 163 | cbb_err_data->virtual_q_channel); | ||
| 164 | pr_crit("--------------------------------------\n"); | ||
| 165 | } | ||
| 166 | |||
| 74 | static void print_smmu_error(const struct err_data_t * const err_data, | 167 | static void print_smmu_error(const struct err_data_t * const err_data, |
| 75 | const enum err_reason reason) | 168 | const enum err_reason reason) |
| 76 | { | 169 | { |
| @@ -152,6 +245,12 @@ static bool handle_async_err_details(const struct err_data_t * const err_data) | |||
| 152 | enter_bad_mode = false; | 245 | enter_bad_mode = false; |
| 153 | break; | 246 | break; |
| 154 | 247 | ||
| 248 | case REASON_ASYNC_CBB: | ||
| 249 | print_cbb_error(err_data); | ||
| 250 | /* CBB error may not be fatal */ | ||
| 251 | enter_bad_mode = false; | ||
| 252 | break; | ||
| 253 | |||
| 155 | case REASON_ASYNC_SMMU_CB: | 254 | case REASON_ASYNC_SMMU_CB: |
| 156 | print_smmu_error(err_data, err_data->err_reason); | 255 | print_smmu_error(err_data, err_data->err_reason); |
| 157 | /* SMMU context bank error may not be fatal */ | 256 | /* SMMU context bank error may not be fatal */ |
| @@ -231,6 +330,11 @@ static bool handle_peer_err_details(const struct err_data_t * const err_data) | |||
| 231 | enter_bad_mode = false; | 330 | enter_bad_mode = false; |
| 232 | break; | 331 | break; |
| 233 | 332 | ||
| 333 | case REASON_ASYNC_CBB: | ||
| 334 | print_cbb_error(err_data); | ||
| 335 | enter_bad_mode = false; | ||
| 336 | break; | ||
| 337 | |||
| 234 | case REASON_ASYNC_SMMU_CB: | 338 | case REASON_ASYNC_SMMU_CB: |
| 235 | case REASON_ASYNC_SMMU_GLOBAL: | 339 | case REASON_ASYNC_SMMU_GLOBAL: |
| 236 | print_smmu_error(err_data, err_data->err_reason); | 340 | print_smmu_error(err_data, err_data->err_reason); |
diff --git a/include/linux/errinfo.h b/include/linux/errinfo.h index 641b17fa7..e75c2b308 100644 --- a/include/linux/errinfo.h +++ b/include/linux/errinfo.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. |
| 3 | * | 3 | * |
| 4 | * NVIDIA CORPORATION and its licensors retain all intellectual property | 4 | * NVIDIA CORPORATION and its licensors retain all intellectual property |
| 5 | * and proprietary rights in and to this software, related documentation | 5 | * and proprietary rights in and to this software, related documentation |
| @@ -18,6 +18,7 @@ enum err_reason { | |||
| 18 | REASON_ASYNC_SMMU_GLOBAL, | 18 | REASON_ASYNC_SMMU_GLOBAL, |
| 19 | REASON_ASYNC_BRIDGE, | 19 | REASON_ASYNC_BRIDGE, |
| 20 | REASON_ASYNC_MC, | 20 | REASON_ASYNC_MC, |
| 21 | REASON_ASYNC_CBB, | ||
| 21 | REASON_SYNC_INSTR_ABORT, | 22 | REASON_SYNC_INSTR_ABORT, |
| 22 | REASON_SYNC_DATA_ABORT, | 23 | REASON_SYNC_DATA_ABORT, |
| 23 | REASON_SYNC_OTHER, | 24 | REASON_SYNC_OTHER, |
| @@ -53,6 +54,38 @@ struct __attribute__((__packed__)) async_bridge_err_t { | |||
| 53 | unsigned int cache; | 54 | unsigned int cache; |
| 54 | }; | 55 | }; |
| 55 | 56 | ||
| 57 | struct __attribute__((__packed__)) async_cbb_err_t { | ||
| 58 | char cbb_name[NAME_SIZE]; | ||
| 59 | unsigned int error_logger; | ||
| 60 | unsigned int errlog0; | ||
| 61 | char transaction_type[NAME_SIZE]; | ||
| 62 | char error_code[NAME_SIZE]; | ||
| 63 | char error_source[NAME_SIZE]; | ||
| 64 | char error_description[NAME_SIZE]; | ||
| 65 | bool header_format; | ||
| 66 | unsigned int packet_header_lock; | ||
| 67 | unsigned int packet_header_len1; | ||
| 68 | unsigned int errlog1; | ||
| 69 | unsigned int errlog2; | ||
| 70 | uint64_t route_id; | ||
| 71 | char initflow[NAME_SIZE]; | ||
| 72 | char targflow[NAME_SIZE]; | ||
| 73 | unsigned int targ_subrange; | ||
| 74 | unsigned int seqid; | ||
| 75 | unsigned int errlog3; | ||
| 76 | unsigned int errlog4; | ||
| 77 | uint64_t address; | ||
| 78 | unsigned int errlog5; | ||
| 79 | char master_id[NAME_SIZE]; | ||
| 80 | unsigned int non_mod; | ||
| 81 | unsigned int axi_id; | ||
| 82 | unsigned int security_group; | ||
| 83 | uint32_t cache; | ||
| 84 | uint32_t protection; | ||
| 85 | unsigned int falconsec; | ||
| 86 | unsigned int virtual_q_channel; | ||
| 87 | }; | ||
| 88 | |||
| 56 | struct __attribute__((__packed__)) async_smmu_err_t { | 89 | struct __attribute__((__packed__)) async_smmu_err_t { |
| 57 | unsigned int stream_id; | 90 | unsigned int stream_id; |
| 58 | unsigned int cb_id; | 91 | unsigned int cb_id; |
| @@ -93,6 +126,7 @@ struct __attribute__((__packed__)) err_data_t { | |||
| 93 | struct async_bridge_err_t async_bridge_err; | 126 | struct async_bridge_err_t async_bridge_err; |
| 94 | struct async_smmu_err_t async_smmu_err; | 127 | struct async_smmu_err_t async_smmu_err; |
| 95 | struct async_mc_err_t async_mc_err; | 128 | struct async_mc_err_t async_mc_err; |
| 129 | struct async_cbb_err_t async_cbb_err; | ||
| 96 | /* Synchronous */ | 130 | /* Synchronous */ |
| 97 | struct sync_data_abort_t sync_data_abort; | 131 | struct sync_data_abort_t sync_data_abort; |
| 98 | }; | 132 | }; |
diff --git a/include/linux/vm_err.h b/include/linux/vm_err.h index a891265ce..31e3fca79 100644 --- a/include/linux/vm_err.h +++ b/include/linux/vm_err.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved. |
| 3 | * | 3 | * |
| 4 | * This software is licensed under the terms of the GNU General Public | 4 | * This software is licensed under the terms of the GNU General Public |
| 5 | * License version 2, as published by the Free Software Foundation, and | 5 | * License version 2, as published by the Free Software Foundation, and |
| @@ -38,6 +38,7 @@ static const char * const tegra_hv_err_reason_desc[] = { | |||
| 38 | "SMMU Global", | 38 | "SMMU Global", |
| 39 | "Bridge", | 39 | "Bridge", |
| 40 | "Memory Controller", | 40 | "Memory Controller", |
| 41 | "Central Back Bone", | ||
| 41 | "Instruction Abort", | 42 | "Instruction Abort", |
| 42 | "Data Abort", | 43 | "Data Abort", |
| 43 | "Other synchronous exception", | 44 | "Other synchronous exception", |
