Mona Hossain | 41789f3 | 2011-11-18 11:18:07 -0800 | [diff] [blame] | 1 | Introduction: |
| 2 | ============= |
| 3 | |
| 4 | The tz_log driver is a platform device driver that exposes a debugfs |
| 5 | interface for accessing and displaying diagnostic information related |
| 6 | to secure code (Trustzone). |
| 7 | |
| 8 | The Secure code (Trustzone) will store the diagnostic data in 4KB of |
| 9 | IMEM. The address of this IMEM region varies from platform. The |
| 10 | diagnostic data encodes information related to secure code boot-up, |
| 11 | reset, interrupt and other attributes in a specific format as shown |
| 12 | below: |
| 13 | |
| 14 | ---------------------------- |
| 15 | | | |
| 16 | | General info | |
| 17 | | (Magic #, CPU cnt etc) | |
| 18 | | | |
| 19 | ---------------------------- |
| 20 | | | |
| 21 | | VMID info | |
| 22 | | | |
| 23 | ---------------------------- |
| 24 | | | |
| 25 | | Boot info (per CPU) | |
| 26 | | | |
| 27 | ---------------------------- |
| 28 | | | |
| 29 | | Reset info (per CPU) | |
| 30 | | | |
| 31 | ---------------------------- |
| 32 | | | |
| 33 | | Interrupt info (per CPU) | |
| 34 | | | |
| 35 | ---------------------------- |
| 36 | | | |
| 37 | | Data logged by TZ | |
| 38 | | | |
| 39 | ---------------------------- |
| 40 | |
| 41 | During the initialization of the driver module, this 4KB of IMEM |
| 42 | is remapped for access by kernel. Further more, an additonal 4KB |
| 43 | memory is allocated for storing the formatted data that will be |
| 44 | displayed by the debugfs interface. |
| 45 | |
| 46 | Once the device is booted up and HLOS is up, the standard debugfs |
| 47 | interface is used to read out and display this information that |
| 48 | was logged in by secure code in a specific format as shown below. |
| 49 | |
| 50 | Debugfs is typically mounted with a command like: |
| 51 | mount -t debugfs none /sys/kernel/debug |
| 52 | (Or an equivalent /etc/fstab line). |
| 53 | |
| 54 | Note that the debugfs API is exported GPL-only to modules. |
| 55 | |
| 56 | Software description |
| 57 | ==================== |
| 58 | |
| 59 | The tz_log module is a Linux platform device driver with a debugfs |
| 60 | interface. The goal of this module is to provide a way to peek into |
| 61 | the Trustzone diagnostic information to help debug issues with |
| 62 | Trustzone. Although, this tz_log platform device driver will be |
| 63 | compiled into the kernel, the debugfs entries will not be exposed |
| 64 | unless Trustzone is supported by the platform. |
| 65 | |
| 66 | |
| 67 | On loading the tz_log driver, tzdbgfs_init() is invoked. tzdbgfs_init() |
| 68 | initializes the tz_log debugfs interface. The following is done in |
| 69 | this initialization call. |
| 70 | |
| 71 | (1) Create a directory "tzdbg", to hold a set of debugfs files |
| 72 | |
| 73 | (2) Create the following debugfs files in the "tzdbg" directory |
| 74 | - boot_info |
| 75 | Contains information on the warm boot jump address |
| 76 | - reset_info |
| 77 | Contains information on the cause of a CPU reset, number of |
| 78 | resets occurred on a specific CPU |
| 79 | - interrupt_info |
| 80 | Contains information on the number of IRQ and FIQ Interrupts |
| 81 | (with a brief description), interrupts fired and the number |
| 82 | of times it is fired on a specific CPU. |
| 83 | - general_info |
| 84 | Contains information on number of CPUs supported, magic number, |
| 85 | version number. |
| 86 | - vmid_info |
| 87 | Contains information on VMID supported, with a brief description |
| 88 | - log |
| 89 | Debug information (ASCII text) that is logged by Trustzone |
| 90 | |
| 91 | Following are the set of file operation defines and register |
| 92 | - read() |
| 93 | - open() |
| 94 | |
| 95 | (3) Remap the IMEM region where the secure code diagnostic information |
| 96 | is stored. |
| 97 | |
| 98 | (4) Allocate 4KB buffer for storing the formatted information |
| 99 | to be displayed |
| 100 | |
| 101 | When the tz_log driver is unloaded the tz_log debugfs entries are |
| 102 | explicitly removed. |
| 103 | |
| 104 | |
| 105 | Power Management |
| 106 | ================ |
| 107 | |
| 108 | n/a |
| 109 | |
| 110 | Security |
| 111 | ======== |
| 112 | |
| 113 | None |
| 114 | |
| 115 | Interface |
| 116 | ========= |
| 117 | |
| 118 | This module will create debugfs files under sys/kernel/debug which |
| 119 | contains information that can be displayed by using the "cat" command. |
| 120 | |
| 121 | |
| 122 | Dependencies |
| 123 | ============ |
| 124 | |
| 125 | This driver interacts with Trustzone operating environment, thus depends |
| 126 | on the TZBSP supported architecture. It also depends on debugfs. |
| 127 | |
| 128 | |
| 129 | To do |
| 130 | ===== |
| 131 | |
| 132 | TBD |