diff options
Diffstat (limited to 'include/linux/vm_err.h')
| -rw-r--r-- | include/linux/vm_err.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/linux/vm_err.h b/include/linux/vm_err.h new file mode 100644 index 000000000..e8fcae8b6 --- /dev/null +++ b/include/linux/vm_err.h | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved. | ||
| 3 | * | ||
| 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 | ||
| 6 | * may be copied, distributed, and modified under those terms. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #ifndef __VM_ERR_H_ | ||
| 16 | #define __VM_ERR_H_ | ||
| 17 | |||
| 18 | #if IS_ENABLED(CONFIG_TEGRA_VM_ERR_HANDLER) | ||
| 19 | #include <linux/errinfo.h> | ||
| 20 | |||
| 21 | struct vm_err_handlers { | ||
| 22 | /* return true, if error needs kernel to enter bad mode and reboot. | ||
| 23 | * return false, if error doesn't need reboot. | ||
| 24 | */ | ||
| 25 | bool (*fn_self_async)(const struct errData *const err_data); | ||
| 26 | bool (*fn_self_sync)(const struct errData *const err_data); | ||
| 27 | bool (*fn_peer)(const struct errData *const err_data); | ||
| 28 | }; | ||
| 29 | |||
| 30 | struct tegra_hv_config { | ||
| 31 | unsigned int guest_id_self; | ||
| 32 | unsigned int num_guests; | ||
| 33 | }; | ||
| 34 | |||
| 35 | static const char * const fault_reason_desc[] = { | ||
| 36 | "Undefined", | ||
| 37 | "SMMU CB", | ||
| 38 | "SMMU Global", | ||
| 39 | "Bridge", | ||
| 40 | "Memory Controller", | ||
| 41 | "Instruction Abort", | ||
| 42 | "Data Abort", | ||
| 43 | "Other synchronous exception", | ||
| 44 | }; | ||
| 45 | |||
| 46 | int tegra_hv_register_vm_err_hooks(struct vm_err_handlers *custom_handlers); | ||
| 47 | void tegra_hv_get_config(struct tegra_hv_config *config); | ||
| 48 | |||
| 49 | #else | ||
| 50 | static inline int tegra_hv_register_vm_err_hooks( | ||
| 51 | struct vm_err_handlers *custom_handlers) | ||
| 52 | { | ||
| 53 | pr_err("Can you please enable CONFIG_TEGRA_VM_ERR_HANDLER?"); | ||
| 54 | return -EINVAL; | ||
| 55 | } | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #endif /* __VM_ERR_H_ */ | ||
