diff options
| author | Hardik Tushar Shah <hardikts@nvidia.com> | 2019-06-24 04:14:40 -0400 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2019-09-04 15:00:49 -0400 |
| commit | c153101975345676ff8f1da5290185d618ef99ad (patch) | |
| tree | 6c1645566524a1a91dc28eeaf6492c605e4cf52e /include/uapi/linux | |
| parent | 9ab53319a54a9d8ee14e20e405148fbf8b996e11 (diff) | |
drivers:wdt: Add driver to handle guest WDT expiry
This driver handles notification from watchdog server monitor for
any of the guest WDT expiry. It propagates notification to the
user through character driver user interface. Application can
take appropriate action on the notification and update the driver
on the action. Since this driver is running on privilege guest,
it doesn't handle WDT expiry of the privilege guest. WDT expiry
of the privilege guest needs to be handled outside Tegra.
Bug 2565917
Change-Id: Ie32fc8aeaf0e723b3616f5efbd6bdb272aed5c62
Signed-off-by: Hardik Tushar Shah <hardikts@nvidia.com>
(cherry picked from commit 3c6681b534068ce3d2d51c587927e68ba6678b48)
Reviewed-on: https://git-master.nvidia.com/r/2146288
Reviewed-on: https://git-master.nvidia.com/r/2142725
GVS: Gerrit_Virtual_Submit
Reviewed-by: Dmitry Pervushin <dpervushin@nvidia.com>
Reviewed-by: Phoenix Jung <pjung@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/nvhv_wdt_handler_ioctl.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/include/uapi/linux/nvhv_wdt_handler_ioctl.h b/include/uapi/linux/nvhv_wdt_handler_ioctl.h new file mode 100644 index 000000000..7b9af9681 --- /dev/null +++ b/include/uapi/linux/nvhv_wdt_handler_ioctl.h | |||
| @@ -0,0 +1,79 @@ | |||
| 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 __UAPI_LINUX_NVHV_WDT_HANDLER_IOCTL_H | ||
| 16 | #define __UAPI_LINUX_NVHV_WDT_HANDLER_IOCTL_H | ||
| 17 | |||
| 18 | #include <linux/ioctl.h> | ||
| 19 | #include <linux/types.h> | ||
| 20 | |||
| 21 | #if !defined(__KERNEL__) | ||
| 22 | #define __user | ||
| 23 | #endif | ||
| 24 | |||
| 25 | /* This matches what is defined in server, if server side | ||
| 26 | * changes, this has to be changed | ||
| 27 | */ | ||
| 28 | #define MAX_GUESTS_NUM 16 | ||
| 29 | #define HV_GUEST_IOCTL_MAGIC 'X' | ||
| 30 | |||
| 31 | |||
| 32 | /* Get the state of all the guest VMs */ | ||
| 33 | #define TEGRA_HV_WDT_H_GET_STATE _IOR(HV_GUEST_IOCTL_MAGIC, 0x00, \ | ||
| 34 | struct hv_wdt_h_state_array) | ||
| 35 | |||
| 36 | /* Send command to Monitor about Guest VM action taken */ | ||
| 37 | #define TEGRA_HV_WDT_H_CMD _IOW(HV_GUEST_IOCTL_MAGIC, 0x01, \ | ||
| 38 | struct tegra_hv_wdt_h_cmd_array) | ||
| 39 | |||
| 40 | |||
| 41 | enum tegra_hv_wdt_h_cmd_id { | ||
| 42 | /* Application has handled the guest vm expiry synchronously */ | ||
| 43 | MESSAGE_HANDLED_SYNC, | ||
| 44 | /* Application has handled the guest vm expiry asynchronously */ | ||
| 45 | MESSAGE_HANDLED_ASYNC, | ||
| 46 | }; | ||
| 47 | |||
| 48 | enum tegra_hv_wdt_h_state_id { | ||
| 49 | /* This is default state or monitor, This state is also reached once | ||
| 50 | * app updates driver about ASYNC or SYNC recovery triggered for Guest | ||
| 51 | */ | ||
| 52 | GUEST_STATE_INIT, | ||
| 53 | /* This is state, once monitor updates driver about GUEST WDT expiry */ | ||
| 54 | GUEST_STATE_TIMER_EXPIRED, | ||
| 55 | /* Waiting for action from Application */ | ||
| 56 | GUEST_STATE_WAIT_FOR_ACK, | ||
| 57 | }; | ||
| 58 | |||
| 59 | struct hv_wdt_h_state_array { | ||
| 60 | /* State of each guest, use enum tegra_hv_wdt_h_state_id */ | ||
| 61 | __u32 guest_state[MAX_GUESTS_NUM]; | ||
| 62 | }; | ||
| 63 | |||
| 64 | struct tegra_hv_wdt_h_cmd { | ||
| 65 | /* VMID for which command is expected */ | ||
| 66 | __u32 vmid; | ||
| 67 | /* Command for the VMID, use tegra_hv_wdt_h_cmd_id */ | ||
| 68 | __u32 command; | ||
| 69 | }; | ||
| 70 | |||
| 71 | struct tegra_hv_wdt_h_cmd_array { | ||
| 72 | /* Number of vmids for which commands is to be issued */ | ||
| 73 | __u32 num_vmids; | ||
| 74 | /* VMID and command to be issued, only first num_vmids will be used from | ||
| 75 | * below array | ||
| 76 | */ | ||
| 77 | struct tegra_hv_wdt_h_cmd commands[MAX_GUESTS_NUM]; | ||
| 78 | }; | ||
| 79 | #endif | ||
