Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | #include <linux/firmware.h> |
Carter Cooper | 4a313ae | 2017-02-23 11:11:56 -0700 | [diff] [blame] | 14 | #include <soc/qcom/subsystem_restart.h> |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 15 | #include <linux/pm_opp.h> |
Tarun Karra | 1382e51 | 2017-10-30 19:41:25 -0700 | [diff] [blame] | 16 | #include <linux/jiffies.h> |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 17 | |
| 18 | #include "adreno.h" |
| 19 | #include "a6xx_reg.h" |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 20 | #include "adreno_a6xx.h" |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 21 | #include "adreno_cp_parser.h" |
| 22 | #include "adreno_trace.h" |
| 23 | #include "adreno_pm4types.h" |
| 24 | #include "adreno_perfcounter.h" |
| 25 | #include "adreno_ringbuffer.h" |
Sushmita Susheelendra | 7f66cf7 | 2016-09-12 11:04:43 -0600 | [diff] [blame] | 26 | #include "adreno_llc.h" |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 27 | #include "kgsl_sharedmem.h" |
| 28 | #include "kgsl_log.h" |
| 29 | #include "kgsl.h" |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 30 | #include "kgsl_gmu.h" |
| 31 | #include "kgsl_trace.h" |
| 32 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 33 | #define MIN_HBB 13 |
| 34 | |
Harshdeep Dhatt | 720394d | 2017-09-13 14:25:09 -0600 | [diff] [blame] | 35 | #define GPU_LIMIT_THRESHOLD_ENABLE BIT(31) |
| 36 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 37 | static int _load_gmu_firmware(struct kgsl_device *device); |
| 38 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 39 | static const struct adreno_vbif_data a630_vbif[] = { |
| 40 | {A6XX_VBIF_GATE_OFF_WRREQ_EN, 0x00000009}, |
| 41 | {A6XX_RBBM_VBIF_CLIENT_QOS_CNTL, 0x3}, |
| 42 | {0, 0}, |
| 43 | }; |
| 44 | |
Rajesh Kemisetti | 77b82ed | 2017-09-24 20:42:41 +0530 | [diff] [blame] | 45 | static const struct adreno_vbif_data a615_gbif[] = { |
| 46 | {A6XX_RBBM_VBIF_CLIENT_QOS_CNTL, 0x3}, |
| 47 | {0, 0}, |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 48 | }; |
| 49 | |
Rajesh Kemisetti | 77b82ed | 2017-09-24 20:42:41 +0530 | [diff] [blame] | 50 | static const struct adreno_vbif_platform a6xx_vbif_platforms[] = { |
| 51 | { adreno_is_a630, a630_vbif }, |
| 52 | { adreno_is_a615, a615_gbif }, |
Deepak Kumar | 5287eea | 2018-03-17 14:33:05 +0530 | [diff] [blame] | 53 | { adreno_is_a616, a615_gbif }, |
Rajesh Kemisetti | 77b82ed | 2017-09-24 20:42:41 +0530 | [diff] [blame] | 54 | }; |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 55 | |
George Shen | a458dd9 | 2018-01-03 14:20:34 -0800 | [diff] [blame] | 56 | |
| 57 | static unsigned long a6xx_oob_state_bitmask; |
| 58 | |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 59 | struct kgsl_hwcg_reg { |
| 60 | unsigned int off; |
| 61 | unsigned int val; |
| 62 | }; |
| 63 | static const struct kgsl_hwcg_reg a630_hwcg_regs[] = { |
Kyle Piefer | b16c607 | 2017-10-23 16:08:45 -0700 | [diff] [blame] | 64 | {A6XX_RBBM_CLOCK_CNTL_SP0, 0x02222222}, |
| 65 | {A6XX_RBBM_CLOCK_CNTL_SP1, 0x02222222}, |
| 66 | {A6XX_RBBM_CLOCK_CNTL_SP2, 0x02222222}, |
| 67 | {A6XX_RBBM_CLOCK_CNTL_SP3, 0x02222222}, |
George Shen | 60d2ba5 | 2017-06-29 10:45:07 -0700 | [diff] [blame] | 68 | {A6XX_RBBM_CLOCK_CNTL2_SP0, 0x02022220}, |
| 69 | {A6XX_RBBM_CLOCK_CNTL2_SP1, 0x02022220}, |
| 70 | {A6XX_RBBM_CLOCK_CNTL2_SP2, 0x02022220}, |
| 71 | {A6XX_RBBM_CLOCK_CNTL2_SP3, 0x02022220}, |
Kyle Piefer | cc4371f | 2017-10-12 15:43:55 -0700 | [diff] [blame] | 72 | {A6XX_RBBM_CLOCK_DELAY_SP0, 0x00000080}, |
| 73 | {A6XX_RBBM_CLOCK_DELAY_SP1, 0x00000080}, |
| 74 | {A6XX_RBBM_CLOCK_DELAY_SP2, 0x00000080}, |
| 75 | {A6XX_RBBM_CLOCK_DELAY_SP3, 0x00000080}, |
| 76 | {A6XX_RBBM_CLOCK_HYST_SP0, 0x0000F3CF}, |
| 77 | {A6XX_RBBM_CLOCK_HYST_SP1, 0x0000F3CF}, |
| 78 | {A6XX_RBBM_CLOCK_HYST_SP2, 0x0000F3CF}, |
| 79 | {A6XX_RBBM_CLOCK_HYST_SP3, 0x0000F3CF}, |
George Shen | c34b9e3 | 2017-06-20 11:42:19 -0700 | [diff] [blame] | 80 | {A6XX_RBBM_CLOCK_CNTL_TP0, 0x02222222}, |
| 81 | {A6XX_RBBM_CLOCK_CNTL_TP1, 0x02222222}, |
| 82 | {A6XX_RBBM_CLOCK_CNTL_TP2, 0x02222222}, |
| 83 | {A6XX_RBBM_CLOCK_CNTL_TP3, 0x02222222}, |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 84 | {A6XX_RBBM_CLOCK_CNTL2_TP0, 0x22222222}, |
| 85 | {A6XX_RBBM_CLOCK_CNTL2_TP1, 0x22222222}, |
| 86 | {A6XX_RBBM_CLOCK_CNTL2_TP2, 0x22222222}, |
| 87 | {A6XX_RBBM_CLOCK_CNTL2_TP3, 0x22222222}, |
| 88 | {A6XX_RBBM_CLOCK_CNTL3_TP0, 0x22222222}, |
| 89 | {A6XX_RBBM_CLOCK_CNTL3_TP1, 0x22222222}, |
| 90 | {A6XX_RBBM_CLOCK_CNTL3_TP2, 0x22222222}, |
| 91 | {A6XX_RBBM_CLOCK_CNTL3_TP3, 0x22222222}, |
| 92 | {A6XX_RBBM_CLOCK_CNTL4_TP0, 0x00022222}, |
| 93 | {A6XX_RBBM_CLOCK_CNTL4_TP1, 0x00022222}, |
| 94 | {A6XX_RBBM_CLOCK_CNTL4_TP2, 0x00022222}, |
| 95 | {A6XX_RBBM_CLOCK_CNTL4_TP3, 0x00022222}, |
| 96 | {A6XX_RBBM_CLOCK_HYST_TP0, 0x77777777}, |
| 97 | {A6XX_RBBM_CLOCK_HYST_TP1, 0x77777777}, |
| 98 | {A6XX_RBBM_CLOCK_HYST_TP2, 0x77777777}, |
| 99 | {A6XX_RBBM_CLOCK_HYST_TP3, 0x77777777}, |
| 100 | {A6XX_RBBM_CLOCK_HYST2_TP0, 0x77777777}, |
| 101 | {A6XX_RBBM_CLOCK_HYST2_TP1, 0x77777777}, |
| 102 | {A6XX_RBBM_CLOCK_HYST2_TP2, 0x77777777}, |
| 103 | {A6XX_RBBM_CLOCK_HYST2_TP3, 0x77777777}, |
Kyle Piefer | cc4371f | 2017-10-12 15:43:55 -0700 | [diff] [blame] | 104 | {A6XX_RBBM_CLOCK_HYST3_TP0, 0x77777777}, |
| 105 | {A6XX_RBBM_CLOCK_HYST3_TP1, 0x77777777}, |
| 106 | {A6XX_RBBM_CLOCK_HYST3_TP2, 0x77777777}, |
| 107 | {A6XX_RBBM_CLOCK_HYST3_TP3, 0x77777777}, |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 108 | {A6XX_RBBM_CLOCK_HYST4_TP0, 0x00077777}, |
| 109 | {A6XX_RBBM_CLOCK_HYST4_TP1, 0x00077777}, |
| 110 | {A6XX_RBBM_CLOCK_HYST4_TP2, 0x00077777}, |
| 111 | {A6XX_RBBM_CLOCK_HYST4_TP3, 0x00077777}, |
| 112 | {A6XX_RBBM_CLOCK_DELAY_TP0, 0x11111111}, |
| 113 | {A6XX_RBBM_CLOCK_DELAY_TP1, 0x11111111}, |
| 114 | {A6XX_RBBM_CLOCK_DELAY_TP2, 0x11111111}, |
| 115 | {A6XX_RBBM_CLOCK_DELAY_TP3, 0x11111111}, |
| 116 | {A6XX_RBBM_CLOCK_DELAY2_TP0, 0x11111111}, |
| 117 | {A6XX_RBBM_CLOCK_DELAY2_TP1, 0x11111111}, |
| 118 | {A6XX_RBBM_CLOCK_DELAY2_TP2, 0x11111111}, |
| 119 | {A6XX_RBBM_CLOCK_DELAY2_TP3, 0x11111111}, |
| 120 | {A6XX_RBBM_CLOCK_DELAY3_TP0, 0x11111111}, |
| 121 | {A6XX_RBBM_CLOCK_DELAY3_TP1, 0x11111111}, |
| 122 | {A6XX_RBBM_CLOCK_DELAY3_TP2, 0x11111111}, |
| 123 | {A6XX_RBBM_CLOCK_DELAY3_TP3, 0x11111111}, |
| 124 | {A6XX_RBBM_CLOCK_DELAY4_TP0, 0x00011111}, |
| 125 | {A6XX_RBBM_CLOCK_DELAY4_TP1, 0x00011111}, |
| 126 | {A6XX_RBBM_CLOCK_DELAY4_TP2, 0x00011111}, |
| 127 | {A6XX_RBBM_CLOCK_DELAY4_TP3, 0x00011111}, |
| 128 | {A6XX_RBBM_CLOCK_CNTL_UCHE, 0x22222222}, |
| 129 | {A6XX_RBBM_CLOCK_CNTL2_UCHE, 0x22222222}, |
| 130 | {A6XX_RBBM_CLOCK_CNTL3_UCHE, 0x22222222}, |
| 131 | {A6XX_RBBM_CLOCK_CNTL4_UCHE, 0x00222222}, |
| 132 | {A6XX_RBBM_CLOCK_HYST_UCHE, 0x00000004}, |
| 133 | {A6XX_RBBM_CLOCK_DELAY_UCHE, 0x00000002}, |
| 134 | {A6XX_RBBM_CLOCK_CNTL_RB0, 0x22222222}, |
| 135 | {A6XX_RBBM_CLOCK_CNTL_RB1, 0x22222222}, |
| 136 | {A6XX_RBBM_CLOCK_CNTL_RB2, 0x22222222}, |
| 137 | {A6XX_RBBM_CLOCK_CNTL_RB3, 0x22222222}, |
| 138 | {A6XX_RBBM_CLOCK_CNTL2_RB0, 0x00002222}, |
| 139 | {A6XX_RBBM_CLOCK_CNTL2_RB1, 0x00002222}, |
| 140 | {A6XX_RBBM_CLOCK_CNTL2_RB2, 0x00002222}, |
| 141 | {A6XX_RBBM_CLOCK_CNTL2_RB3, 0x00002222}, |
Kyle Piefer | 0c3e752 | 2017-10-23 15:49:49 -0700 | [diff] [blame] | 142 | {A6XX_RBBM_CLOCK_CNTL_CCU0, 0x00002220}, |
| 143 | {A6XX_RBBM_CLOCK_CNTL_CCU1, 0x00002220}, |
| 144 | {A6XX_RBBM_CLOCK_CNTL_CCU2, 0x00002220}, |
| 145 | {A6XX_RBBM_CLOCK_CNTL_CCU3, 0x00002220}, |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 146 | {A6XX_RBBM_CLOCK_HYST_RB_CCU0, 0x00040F00}, |
| 147 | {A6XX_RBBM_CLOCK_HYST_RB_CCU1, 0x00040F00}, |
| 148 | {A6XX_RBBM_CLOCK_HYST_RB_CCU2, 0x00040F00}, |
| 149 | {A6XX_RBBM_CLOCK_HYST_RB_CCU3, 0x00040F00}, |
Kyle Piefer | 0c3e752 | 2017-10-23 15:49:49 -0700 | [diff] [blame] | 150 | {A6XX_RBBM_CLOCK_CNTL_RAC, 0x05022022}, |
| 151 | {A6XX_RBBM_CLOCK_CNTL2_RAC, 0x00005555}, |
Kyle Piefer | cc4371f | 2017-10-12 15:43:55 -0700 | [diff] [blame] | 152 | {A6XX_RBBM_CLOCK_DELAY_RAC, 0x00000011}, |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 153 | {A6XX_RBBM_CLOCK_HYST_RAC, 0x00445044}, |
Kyle Piefer | 0c3e752 | 2017-10-23 15:49:49 -0700 | [diff] [blame] | 154 | {A6XX_RBBM_CLOCK_CNTL_TSE_RAS_RBBM, 0x04222222}, |
Kyle Piefer | 42d20bf | 2017-10-19 15:35:41 -0700 | [diff] [blame] | 155 | {A6XX_RBBM_CLOCK_MODE_GPC, 0x00222222}, |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 156 | {A6XX_RBBM_CLOCK_MODE_VFD, 0x00002222}, |
| 157 | {A6XX_RBBM_CLOCK_HYST_TSE_RAS_RBBM, 0x00000000}, |
| 158 | {A6XX_RBBM_CLOCK_HYST_GPC, 0x04104004}, |
| 159 | {A6XX_RBBM_CLOCK_HYST_VFD, 0x00000000}, |
| 160 | {A6XX_RBBM_CLOCK_DELAY_HLSQ, 0x00000000}, |
| 161 | {A6XX_RBBM_CLOCK_DELAY_TSE_RAS_RBBM, 0x00004000}, |
| 162 | {A6XX_RBBM_CLOCK_DELAY_GPC, 0x00000200}, |
| 163 | {A6XX_RBBM_CLOCK_DELAY_VFD, 0x00002222}, |
| 164 | {A6XX_RBBM_CLOCK_DELAY_HLSQ_2, 0x00000002}, |
| 165 | {A6XX_RBBM_CLOCK_MODE_HLSQ, 0x00002222}, |
| 166 | {A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222}, |
| 167 | {A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111}, |
| 168 | {A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555} |
| 169 | }; |
| 170 | |
Rajesh Kemisetti | 0420208 | 2017-10-17 14:14:27 +0530 | [diff] [blame] | 171 | static const struct kgsl_hwcg_reg a615_hwcg_regs[] = { |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 172 | {A6XX_RBBM_CLOCK_CNTL_SP0, 0x02222222}, |
Rajesh Kemisetti | 0420208 | 2017-10-17 14:14:27 +0530 | [diff] [blame] | 173 | {A6XX_RBBM_CLOCK_CNTL2_SP0, 0x02222220}, |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 174 | {A6XX_RBBM_CLOCK_DELAY_SP0, 0x00000080}, |
Rajesh Kemisetti | 0420208 | 2017-10-17 14:14:27 +0530 | [diff] [blame] | 175 | {A6XX_RBBM_CLOCK_HYST_SP0, 0x0000F3CF}, |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 176 | {A6XX_RBBM_CLOCK_CNTL_TP0, 0x02222222}, |
| 177 | {A6XX_RBBM_CLOCK_CNTL_TP1, 0x02222222}, |
Rajesh Kemisetti | 0420208 | 2017-10-17 14:14:27 +0530 | [diff] [blame] | 178 | {A6XX_RBBM_CLOCK_CNTL2_TP0, 0x22222222}, |
| 179 | {A6XX_RBBM_CLOCK_CNTL2_TP1, 0x22222222}, |
| 180 | {A6XX_RBBM_CLOCK_CNTL3_TP0, 0x22222222}, |
| 181 | {A6XX_RBBM_CLOCK_CNTL3_TP1, 0x22222222}, |
| 182 | {A6XX_RBBM_CLOCK_CNTL4_TP0, 0x00022222}, |
| 183 | {A6XX_RBBM_CLOCK_CNTL4_TP1, 0x00022222}, |
| 184 | {A6XX_RBBM_CLOCK_HYST_TP0, 0x77777777}, |
| 185 | {A6XX_RBBM_CLOCK_HYST_TP1, 0x77777777}, |
| 186 | {A6XX_RBBM_CLOCK_HYST2_TP0, 0x77777777}, |
| 187 | {A6XX_RBBM_CLOCK_HYST2_TP1, 0x77777777}, |
| 188 | {A6XX_RBBM_CLOCK_HYST3_TP0, 0x77777777}, |
| 189 | {A6XX_RBBM_CLOCK_HYST3_TP1, 0x77777777}, |
| 190 | {A6XX_RBBM_CLOCK_HYST4_TP0, 0x00077777}, |
| 191 | {A6XX_RBBM_CLOCK_HYST4_TP1, 0x00077777}, |
| 192 | {A6XX_RBBM_CLOCK_DELAY_TP0, 0x11111111}, |
| 193 | {A6XX_RBBM_CLOCK_DELAY_TP1, 0x11111111}, |
| 194 | {A6XX_RBBM_CLOCK_DELAY2_TP0, 0x11111111}, |
| 195 | {A6XX_RBBM_CLOCK_DELAY2_TP1, 0x11111111}, |
| 196 | {A6XX_RBBM_CLOCK_DELAY3_TP0, 0x11111111}, |
| 197 | {A6XX_RBBM_CLOCK_DELAY3_TP1, 0x11111111}, |
| 198 | {A6XX_RBBM_CLOCK_DELAY4_TP0, 0x00011111}, |
| 199 | {A6XX_RBBM_CLOCK_DELAY4_TP1, 0x00011111}, |
| 200 | {A6XX_RBBM_CLOCK_CNTL_UCHE, 0x22222222}, |
| 201 | {A6XX_RBBM_CLOCK_CNTL2_UCHE, 0x22222222}, |
| 202 | {A6XX_RBBM_CLOCK_CNTL3_UCHE, 0x22222222}, |
| 203 | {A6XX_RBBM_CLOCK_CNTL4_UCHE, 0x00222222}, |
| 204 | {A6XX_RBBM_CLOCK_HYST_UCHE, 0x00000004}, |
| 205 | {A6XX_RBBM_CLOCK_DELAY_UCHE, 0x00000002}, |
| 206 | {A6XX_RBBM_CLOCK_CNTL_RB0, 0x22222222}, |
| 207 | {A6XX_RBBM_CLOCK_CNTL2_RB0, 0x00002222}, |
| 208 | {A6XX_RBBM_CLOCK_CNTL_CCU0, 0x00002220}, |
| 209 | {A6XX_RBBM_CLOCK_CNTL_CCU1, 0x00002220}, |
| 210 | {A6XX_RBBM_CLOCK_CNTL_CCU2, 0x00002220}, |
| 211 | {A6XX_RBBM_CLOCK_CNTL_CCU3, 0x00002220}, |
| 212 | {A6XX_RBBM_CLOCK_HYST_RB_CCU0, 0x00040F00}, |
| 213 | {A6XX_RBBM_CLOCK_HYST_RB_CCU1, 0x00040F00}, |
| 214 | {A6XX_RBBM_CLOCK_HYST_RB_CCU2, 0x00040F00}, |
| 215 | {A6XX_RBBM_CLOCK_HYST_RB_CCU3, 0x00040F00}, |
| 216 | {A6XX_RBBM_CLOCK_CNTL_RAC, 0x05022022}, |
| 217 | {A6XX_RBBM_CLOCK_CNTL2_RAC, 0x00005555}, |
| 218 | {A6XX_RBBM_CLOCK_DELAY_RAC, 0x00000011}, |
| 219 | {A6XX_RBBM_CLOCK_HYST_RAC, 0x00445044}, |
| 220 | {A6XX_RBBM_CLOCK_CNTL_TSE_RAS_RBBM, 0x04222222}, |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 221 | {A6XX_RBBM_CLOCK_MODE_GPC, 0x00222222}, |
Rajesh Kemisetti | 0420208 | 2017-10-17 14:14:27 +0530 | [diff] [blame] | 222 | {A6XX_RBBM_CLOCK_MODE_VFD, 0x00002222}, |
| 223 | {A6XX_RBBM_CLOCK_HYST_TSE_RAS_RBBM, 0x00000000}, |
| 224 | {A6XX_RBBM_CLOCK_HYST_GPC, 0x04104004}, |
| 225 | {A6XX_RBBM_CLOCK_HYST_VFD, 0x00000000}, |
| 226 | {A6XX_RBBM_CLOCK_DELAY_HLSQ, 0x00000000}, |
| 227 | {A6XX_RBBM_CLOCK_DELAY_TSE_RAS_RBBM, 0x00004000}, |
| 228 | {A6XX_RBBM_CLOCK_DELAY_GPC, 0x00000200}, |
| 229 | {A6XX_RBBM_CLOCK_DELAY_VFD, 0x00002222}, |
| 230 | {A6XX_RBBM_CLOCK_DELAY_HLSQ_2, 0x00000002}, |
| 231 | {A6XX_RBBM_CLOCK_MODE_HLSQ, 0x00002222}, |
| 232 | {A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222}, |
| 233 | {A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111}, |
| 234 | {A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555} |
| 235 | }; |
| 236 | |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 237 | static const struct { |
| 238 | int (*devfunc)(struct adreno_device *adreno_dev); |
| 239 | const struct kgsl_hwcg_reg *regs; |
| 240 | unsigned int count; |
| 241 | } a6xx_hwcg_registers[] = { |
Rajesh Kemisetti | 8d5cc6e | 2017-06-06 16:44:17 +0530 | [diff] [blame] | 242 | {adreno_is_a630, a630_hwcg_regs, ARRAY_SIZE(a630_hwcg_regs)}, |
Rajesh Kemisetti | 0420208 | 2017-10-17 14:14:27 +0530 | [diff] [blame] | 243 | {adreno_is_a615, a615_hwcg_regs, ARRAY_SIZE(a615_hwcg_regs)}, |
Deepak Kumar | 5287eea | 2018-03-17 14:33:05 +0530 | [diff] [blame] | 244 | {adreno_is_a616, a615_hwcg_regs, ARRAY_SIZE(a615_hwcg_regs)}, |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 245 | }; |
| 246 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 247 | static struct a6xx_protected_regs { |
| 248 | unsigned int base; |
| 249 | unsigned int count; |
| 250 | int read_protect; |
| 251 | } a6xx_protected_regs_group[] = { |
| 252 | { 0x600, 0x51, 0 }, |
| 253 | { 0xAE50, 0x2, 1 }, |
| 254 | { 0x9624, 0x13, 1 }, |
| 255 | { 0x8630, 0x8, 1 }, |
| 256 | { 0x9E70, 0x1, 1 }, |
| 257 | { 0x9E78, 0x187, 1 }, |
| 258 | { 0xF000, 0x810, 1 }, |
| 259 | { 0xFC00, 0x3, 0 }, |
| 260 | { 0x50E, 0x0, 1 }, |
| 261 | { 0x50F, 0x0, 0 }, |
| 262 | { 0x510, 0x0, 1 }, |
| 263 | { 0x0, 0x4F9, 0 }, |
| 264 | { 0x501, 0xA, 0 }, |
| 265 | { 0x511, 0x44, 0 }, |
Shrenuj Bansal | 932c8ef | 2017-08-07 15:16:15 -0700 | [diff] [blame] | 266 | { 0xE00, 0x1, 1 }, |
| 267 | { 0xE03, 0xB, 1 }, |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 268 | { 0x8E00, 0x0, 1 }, |
| 269 | { 0x8E50, 0xF, 1 }, |
| 270 | { 0xBE02, 0x0, 1 }, |
| 271 | { 0xBE20, 0x11F3, 1 }, |
| 272 | { 0x800, 0x82, 1 }, |
| 273 | { 0x8A0, 0x8, 1 }, |
| 274 | { 0x8AB, 0x19, 1 }, |
| 275 | { 0x900, 0x4D, 1 }, |
| 276 | { 0x98D, 0x76, 1 }, |
| 277 | { 0x8D0, 0x23, 0 }, |
| 278 | { 0x980, 0x4, 0 }, |
| 279 | { 0xA630, 0x0, 1 }, |
| 280 | }; |
| 281 | |
Tarun Karra | 4ea6812 | 2017-11-02 18:10:31 -0700 | [diff] [blame] | 282 | /* IFPC & Preemption static powerup restore list */ |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 283 | static struct reg_list_pair { |
| 284 | uint32_t offset; |
| 285 | uint32_t val; |
| 286 | } a6xx_pwrup_reglist[] = { |
| 287 | { A6XX_VSC_ADDR_MODE_CNTL, 0x0 }, |
| 288 | { A6XX_GRAS_ADDR_MODE_CNTL, 0x0 }, |
| 289 | { A6XX_RB_ADDR_MODE_CNTL, 0x0 }, |
| 290 | { A6XX_PC_ADDR_MODE_CNTL, 0x0 }, |
| 291 | { A6XX_HLSQ_ADDR_MODE_CNTL, 0x0 }, |
| 292 | { A6XX_VFD_ADDR_MODE_CNTL, 0x0 }, |
| 293 | { A6XX_VPC_ADDR_MODE_CNTL, 0x0 }, |
| 294 | { A6XX_UCHE_ADDR_MODE_CNTL, 0x0 }, |
| 295 | { A6XX_SP_ADDR_MODE_CNTL, 0x0 }, |
| 296 | { A6XX_TPL1_ADDR_MODE_CNTL, 0x0 }, |
| 297 | { A6XX_UCHE_WRITE_RANGE_MAX_LO, 0x0 }, |
| 298 | { A6XX_UCHE_WRITE_RANGE_MAX_HI, 0x0 }, |
| 299 | { A6XX_UCHE_TRAP_BASE_LO, 0x0 }, |
| 300 | { A6XX_UCHE_TRAP_BASE_HI, 0x0 }, |
| 301 | { A6XX_UCHE_WRITE_THRU_BASE_LO, 0x0 }, |
| 302 | { A6XX_UCHE_WRITE_THRU_BASE_HI, 0x0 }, |
| 303 | { A6XX_UCHE_GMEM_RANGE_MIN_LO, 0x0 }, |
| 304 | { A6XX_UCHE_GMEM_RANGE_MIN_HI, 0x0 }, |
| 305 | { A6XX_UCHE_GMEM_RANGE_MAX_LO, 0x0 }, |
| 306 | { A6XX_UCHE_GMEM_RANGE_MAX_HI, 0x0 }, |
| 307 | { A6XX_UCHE_FILTER_CNTL, 0x0 }, |
| 308 | { A6XX_UCHE_CACHE_WAYS, 0x0 }, |
| 309 | { A6XX_UCHE_MODE_CNTL, 0x0 }, |
| 310 | { A6XX_RB_NC_MODE_CNTL, 0x0 }, |
| 311 | { A6XX_TPL1_NC_MODE_CNTL, 0x0 }, |
| 312 | { A6XX_SP_NC_MODE_CNTL, 0x0 }, |
| 313 | { A6XX_PC_DBG_ECO_CNTL, 0x0 }, |
| 314 | { A6XX_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE, 0x0 }, |
| 315 | }; |
| 316 | |
Tarun Karra | 4ea6812 | 2017-11-02 18:10:31 -0700 | [diff] [blame] | 317 | /* IFPC only static powerup restore list */ |
| 318 | static struct reg_list_pair a6xx_ifpc_pwrup_reglist[] = { |
| 319 | { A6XX_RBBM_VBIF_CLIENT_QOS_CNTL, 0x0 }, |
| 320 | { A6XX_CP_CHICKEN_DBG, 0x0 }, |
Tarun Karra | 4ea6812 | 2017-11-02 18:10:31 -0700 | [diff] [blame] | 321 | { A6XX_CP_DBG_ECO_CNTL, 0x0 }, |
| 322 | { A6XX_CP_PROTECT_CNTL, 0x0 }, |
| 323 | { A6XX_CP_PROTECT_REG, 0x0 }, |
| 324 | { A6XX_CP_PROTECT_REG+1, 0x0 }, |
| 325 | { A6XX_CP_PROTECT_REG+2, 0x0 }, |
| 326 | { A6XX_CP_PROTECT_REG+3, 0x0 }, |
| 327 | { A6XX_CP_PROTECT_REG+4, 0x0 }, |
| 328 | { A6XX_CP_PROTECT_REG+5, 0x0 }, |
| 329 | { A6XX_CP_PROTECT_REG+6, 0x0 }, |
| 330 | { A6XX_CP_PROTECT_REG+7, 0x0 }, |
| 331 | { A6XX_CP_PROTECT_REG+8, 0x0 }, |
| 332 | { A6XX_CP_PROTECT_REG+9, 0x0 }, |
| 333 | { A6XX_CP_PROTECT_REG+10, 0x0 }, |
| 334 | { A6XX_CP_PROTECT_REG+11, 0x0 }, |
| 335 | { A6XX_CP_PROTECT_REG+12, 0x0 }, |
| 336 | { A6XX_CP_PROTECT_REG+13, 0x0 }, |
| 337 | { A6XX_CP_PROTECT_REG+14, 0x0 }, |
| 338 | { A6XX_CP_PROTECT_REG+15, 0x0 }, |
| 339 | { A6XX_CP_PROTECT_REG+16, 0x0 }, |
| 340 | { A6XX_CP_PROTECT_REG+17, 0x0 }, |
| 341 | { A6XX_CP_PROTECT_REG+18, 0x0 }, |
| 342 | { A6XX_CP_PROTECT_REG+19, 0x0 }, |
| 343 | { A6XX_CP_PROTECT_REG+20, 0x0 }, |
| 344 | { A6XX_CP_PROTECT_REG+21, 0x0 }, |
| 345 | { A6XX_CP_PROTECT_REG+22, 0x0 }, |
| 346 | { A6XX_CP_PROTECT_REG+23, 0x0 }, |
| 347 | { A6XX_CP_PROTECT_REG+24, 0x0 }, |
| 348 | { A6XX_CP_PROTECT_REG+25, 0x0 }, |
| 349 | { A6XX_CP_PROTECT_REG+26, 0x0 }, |
| 350 | { A6XX_CP_PROTECT_REG+27, 0x0 }, |
| 351 | { A6XX_CP_PROTECT_REG+28, 0x0 }, |
| 352 | { A6XX_CP_PROTECT_REG+29, 0x0 }, |
| 353 | { A6XX_CP_PROTECT_REG+30, 0x0 }, |
| 354 | { A6XX_CP_PROTECT_REG+31, 0x0 }, |
| 355 | { A6XX_CP_AHB_CNTL, 0x0 }, |
| 356 | }; |
| 357 | |
Akhil P Oommen | 35dde69 | 2018-01-16 18:01:09 +0530 | [diff] [blame] | 358 | static struct reg_list_pair a615_pwrup_reglist[] = { |
Deepak Kumar | ab6b895 | 2017-12-18 11:18:37 +0530 | [diff] [blame] | 359 | { A6XX_UCHE_GBIF_GX_CONFIG, 0x0 }, |
| 360 | }; |
| 361 | |
Carter Cooper | 6ce0042 | 2017-03-20 11:25:09 -0600 | [diff] [blame] | 362 | static void _update_always_on_regs(struct adreno_device *adreno_dev) |
| 363 | { |
| 364 | struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); |
| 365 | unsigned int *const regs = gpudev->reg_offsets->offsets; |
| 366 | |
| 367 | regs[ADRENO_REG_RBBM_ALWAYSON_COUNTER_LO] = |
| 368 | A6XX_CP_ALWAYS_ON_COUNTER_LO; |
| 369 | regs[ADRENO_REG_RBBM_ALWAYSON_COUNTER_HI] = |
| 370 | A6XX_CP_ALWAYS_ON_COUNTER_HI; |
| 371 | } |
| 372 | |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 373 | static uint64_t read_AO_counter(struct kgsl_device *device) |
| 374 | { |
| 375 | unsigned int l, h, h1; |
| 376 | |
| 377 | kgsl_gmu_regread(device, A6XX_GMU_CX_GMU_ALWAYS_ON_COUNTER_H, &h); |
| 378 | kgsl_gmu_regread(device, A6XX_GMU_CX_GMU_ALWAYS_ON_COUNTER_L, &l); |
| 379 | kgsl_gmu_regread(device, A6XX_GMU_CX_GMU_ALWAYS_ON_COUNTER_H, &h1); |
| 380 | |
| 381 | if (h == h1) |
| 382 | return (uint64_t) l | ((uint64_t) h << 32); |
| 383 | |
| 384 | kgsl_gmu_regread(device, A6XX_GMU_CX_GMU_ALWAYS_ON_COUNTER_L, &l); |
| 385 | return (uint64_t) l | ((uint64_t) h1 << 32); |
| 386 | } |
| 387 | |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 388 | static void a6xx_pwrup_reglist_init(struct adreno_device *adreno_dev) |
| 389 | { |
| 390 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 391 | |
| 392 | if (kgsl_allocate_global(device, &adreno_dev->pwrup_reglist, |
Tarun Karra | a667436 | 2017-10-23 12:57:48 -0700 | [diff] [blame] | 393 | PAGE_SIZE, 0, KGSL_MEMDESC_CONTIG | KGSL_MEMDESC_PRIVILEGED, |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 394 | "powerup_register_list")) { |
| 395 | adreno_dev->pwrup_reglist.gpuaddr = 0; |
| 396 | return; |
| 397 | } |
| 398 | |
| 399 | kgsl_sharedmem_set(device, &adreno_dev->pwrup_reglist, 0, 0, |
| 400 | PAGE_SIZE); |
| 401 | } |
| 402 | |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 403 | static void a6xx_init(struct adreno_device *adreno_dev) |
| 404 | { |
| 405 | a6xx_crashdump_init(adreno_dev); |
Carter Cooper | 6ce0042 | 2017-03-20 11:25:09 -0600 | [diff] [blame] | 406 | |
| 407 | /* |
| 408 | * If the GMU is not enabled, rewrite the offset for the always on |
| 409 | * counters to point to the CP always on instead of GMU always on |
| 410 | */ |
| 411 | if (!kgsl_gmu_isenabled(KGSL_DEVICE(adreno_dev))) |
| 412 | _update_always_on_regs(adreno_dev); |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 413 | |
| 414 | a6xx_pwrup_reglist_init(adreno_dev); |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 415 | } |
| 416 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 417 | /** |
| 418 | * a6xx_protect_init() - Initializes register protection on a6xx |
| 419 | * @device: Pointer to the device structure |
| 420 | * Performs register writes to enable protected access to sensitive |
| 421 | * registers |
| 422 | */ |
| 423 | static void a6xx_protect_init(struct adreno_device *adreno_dev) |
| 424 | { |
| 425 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
Tarun Karra | 9f94550 | 2017-03-23 12:28:03 -0700 | [diff] [blame] | 426 | struct kgsl_protected_registers *mmu_prot = |
| 427 | kgsl_mmu_get_prot_regs(&device->mmu); |
| 428 | int i, num_sets; |
| 429 | int req_sets = ARRAY_SIZE(a6xx_protected_regs_group); |
| 430 | int max_sets = adreno_dev->gpucore->num_protected_regs; |
| 431 | unsigned int mmu_base = 0, mmu_range = 0, cur_range; |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 432 | |
| 433 | /* enable access protection to privileged registers */ |
Harshdeep Dhatt | 9fc043e | 2017-04-21 12:06:22 -0600 | [diff] [blame] | 434 | kgsl_regwrite(device, A6XX_CP_PROTECT_CNTL, 0x00000003); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 435 | |
Lynus Vaz | 0955c6c | 2017-02-20 18:59:44 +0530 | [diff] [blame] | 436 | if (mmu_prot) { |
| 437 | mmu_base = mmu_prot->base; |
Lynus Vaz | 607a42d | 2018-05-23 20:26:51 +0530 | [diff] [blame] | 438 | mmu_range = mmu_prot->range; |
Tarun Karra | 9f94550 | 2017-03-23 12:28:03 -0700 | [diff] [blame] | 439 | req_sets += DIV_ROUND_UP(mmu_range, 0x2000); |
Lynus Vaz | 0955c6c | 2017-02-20 18:59:44 +0530 | [diff] [blame] | 440 | } |
| 441 | |
Tarun Karra | 9f94550 | 2017-03-23 12:28:03 -0700 | [diff] [blame] | 442 | if (req_sets > max_sets) |
Lynus Vaz | 0955c6c | 2017-02-20 18:59:44 +0530 | [diff] [blame] | 443 | WARN(1, "Size exceeds the num of protection regs available\n"); |
Lynus Vaz | 0955c6c | 2017-02-20 18:59:44 +0530 | [diff] [blame] | 444 | |
Tarun Karra | 9f94550 | 2017-03-23 12:28:03 -0700 | [diff] [blame] | 445 | /* Protect GPU registers */ |
| 446 | num_sets = min_t(unsigned int, |
| 447 | ARRAY_SIZE(a6xx_protected_regs_group), max_sets); |
| 448 | for (i = 0; i < num_sets; i++) { |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 449 | struct a6xx_protected_regs *regs = |
| 450 | &a6xx_protected_regs_group[i]; |
| 451 | |
| 452 | kgsl_regwrite(device, A6XX_CP_PROTECT_REG + i, |
| 453 | regs->base | (regs->count << 18) | |
| 454 | (regs->read_protect << 31)); |
| 455 | } |
| 456 | |
Tarun Karra | 9f94550 | 2017-03-23 12:28:03 -0700 | [diff] [blame] | 457 | /* Protect MMU registers */ |
| 458 | if (mmu_prot) { |
| 459 | while ((i < max_sets) && (mmu_range > 0)) { |
| 460 | cur_range = min_t(unsigned int, mmu_range, |
Lynus Vaz | 0955c6c | 2017-02-20 18:59:44 +0530 | [diff] [blame] | 461 | 0x2000); |
Tarun Karra | 9f94550 | 2017-03-23 12:28:03 -0700 | [diff] [blame] | 462 | kgsl_regwrite(device, A6XX_CP_PROTECT_REG + i, |
| 463 | mmu_base | ((cur_range - 1) << 18) | (1 << 31)); |
Lynus Vaz | 0955c6c | 2017-02-20 18:59:44 +0530 | [diff] [blame] | 464 | |
Tarun Karra | 9f94550 | 2017-03-23 12:28:03 -0700 | [diff] [blame] | 465 | mmu_base += cur_range; |
| 466 | mmu_range -= cur_range; |
| 467 | i++; |
| 468 | } |
Lynus Vaz | 0955c6c | 2017-02-20 18:59:44 +0530 | [diff] [blame] | 469 | } |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | static void a6xx_enable_64bit(struct adreno_device *adreno_dev) |
| 473 | { |
| 474 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 475 | |
| 476 | kgsl_regwrite(device, A6XX_CP_ADDR_MODE_CNTL, 0x1); |
| 477 | kgsl_regwrite(device, A6XX_VSC_ADDR_MODE_CNTL, 0x1); |
| 478 | kgsl_regwrite(device, A6XX_GRAS_ADDR_MODE_CNTL, 0x1); |
| 479 | kgsl_regwrite(device, A6XX_RB_ADDR_MODE_CNTL, 0x1); |
| 480 | kgsl_regwrite(device, A6XX_PC_ADDR_MODE_CNTL, 0x1); |
| 481 | kgsl_regwrite(device, A6XX_HLSQ_ADDR_MODE_CNTL, 0x1); |
| 482 | kgsl_regwrite(device, A6XX_VFD_ADDR_MODE_CNTL, 0x1); |
| 483 | kgsl_regwrite(device, A6XX_VPC_ADDR_MODE_CNTL, 0x1); |
| 484 | kgsl_regwrite(device, A6XX_UCHE_ADDR_MODE_CNTL, 0x1); |
| 485 | kgsl_regwrite(device, A6XX_SP_ADDR_MODE_CNTL, 0x1); |
| 486 | kgsl_regwrite(device, A6XX_TPL1_ADDR_MODE_CNTL, 0x1); |
| 487 | kgsl_regwrite(device, A6XX_RBBM_SECVID_TSB_ADDR_MODE_CNTL, 0x1); |
| 488 | } |
| 489 | |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 490 | static inline unsigned int |
| 491 | __get_rbbm_clock_cntl_on(struct adreno_device *adreno_dev) |
| 492 | { |
Deepak Kumar | 5287eea | 2018-03-17 14:33:05 +0530 | [diff] [blame] | 493 | if (adreno_is_a615(adreno_dev) || adreno_is_a616(adreno_dev)) |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 494 | return 0x8AA8AA82; |
| 495 | else |
| 496 | return 0x8AA8AA02; |
| 497 | } |
| 498 | |
| 499 | static inline unsigned int |
| 500 | __get_gmu_ao_cgc_mode_cntl(struct adreno_device *adreno_dev) |
| 501 | { |
Deepak Kumar | 5287eea | 2018-03-17 14:33:05 +0530 | [diff] [blame] | 502 | if (adreno_is_a615(adreno_dev) || adreno_is_a616(adreno_dev)) |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 503 | return 0x00000222; |
| 504 | else |
Oleg Perelet | 5d2d28f | 2018-03-06 17:03:20 -0800 | [diff] [blame] | 505 | return 0x00020202; |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | static inline unsigned int |
| 509 | __get_gmu_ao_cgc_delay_cntl(struct adreno_device *adreno_dev) |
| 510 | { |
Deepak Kumar | 5287eea | 2018-03-17 14:33:05 +0530 | [diff] [blame] | 511 | if (adreno_is_a615(adreno_dev) || adreno_is_a616(adreno_dev)) |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 512 | return 0x00000111; |
| 513 | else |
| 514 | return 0x00010111; |
| 515 | } |
| 516 | |
| 517 | static inline unsigned int |
| 518 | __get_gmu_ao_cgc_hyst_cntl(struct adreno_device *adreno_dev) |
| 519 | { |
Deepak Kumar | 5287eea | 2018-03-17 14:33:05 +0530 | [diff] [blame] | 520 | if (adreno_is_a615(adreno_dev) || adreno_is_a616(adreno_dev)) |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 521 | return 0x00000555; |
| 522 | else |
| 523 | return 0x00005555; |
| 524 | } |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 525 | |
| 526 | static void a6xx_hwcg_set(struct adreno_device *adreno_dev, bool on) |
| 527 | { |
| 528 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 529 | const struct kgsl_hwcg_reg *regs; |
Oleg Perelet | 88e5449 | 2017-09-22 11:10:31 -0700 | [diff] [blame] | 530 | unsigned int value; |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 531 | int i, j; |
| 532 | |
| 533 | if (!test_bit(ADRENO_HWCG_CTRL, &adreno_dev->pwrctrl_flag)) |
Oleg Perelet | 88e5449 | 2017-09-22 11:10:31 -0700 | [diff] [blame] | 534 | on = false; |
| 535 | |
| 536 | if (kgsl_gmu_isenabled(device)) { |
| 537 | kgsl_gmu_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_MODE_CNTL, |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 538 | on ? __get_gmu_ao_cgc_mode_cntl(adreno_dev) : 0); |
Oleg Perelet | 88e5449 | 2017-09-22 11:10:31 -0700 | [diff] [blame] | 539 | kgsl_gmu_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_DELAY_CNTL, |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 540 | on ? __get_gmu_ao_cgc_delay_cntl(adreno_dev) : 0); |
Oleg Perelet | 88e5449 | 2017-09-22 11:10:31 -0700 | [diff] [blame] | 541 | kgsl_gmu_regwrite(device, A6XX_GPU_GMU_AO_GMU_CGC_HYST_CNTL, |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 542 | on ? __get_gmu_ao_cgc_hyst_cntl(adreno_dev) : 0); |
Oleg Perelet | 88e5449 | 2017-09-22 11:10:31 -0700 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | kgsl_regread(device, A6XX_RBBM_CLOCK_CNTL, &value); |
| 546 | |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 547 | if (value == __get_rbbm_clock_cntl_on(adreno_dev) && on) |
Oleg Perelet | 88e5449 | 2017-09-22 11:10:31 -0700 | [diff] [blame] | 548 | return; |
| 549 | |
| 550 | if (value == 0 && !on) |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 551 | return; |
| 552 | |
| 553 | for (i = 0; i < ARRAY_SIZE(a6xx_hwcg_registers); i++) { |
| 554 | if (a6xx_hwcg_registers[i].devfunc(adreno_dev)) |
| 555 | break; |
| 556 | } |
| 557 | |
| 558 | if (i == ARRAY_SIZE(a6xx_hwcg_registers)) |
| 559 | return; |
| 560 | |
| 561 | regs = a6xx_hwcg_registers[i].regs; |
| 562 | |
| 563 | /* Disable SP clock before programming HWCG registers */ |
Deepak Kumar | 9892ba1 | 2017-07-07 14:51:11 +0530 | [diff] [blame] | 564 | kgsl_gmu_regrmw(device, A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 1, 0); |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 565 | |
| 566 | for (j = 0; j < a6xx_hwcg_registers[i].count; j++) |
| 567 | kgsl_regwrite(device, regs[j].off, on ? regs[j].val : 0); |
| 568 | |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 569 | /* Enable SP clock */ |
| 570 | kgsl_gmu_regrmw(device, A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 0, 1); |
| 571 | |
| 572 | /* enable top level HWCG */ |
Oleg Perelet | 88e5449 | 2017-09-22 11:10:31 -0700 | [diff] [blame] | 573 | kgsl_regwrite(device, A6XX_RBBM_CLOCK_CNTL, |
Deepak Kumar | 4a393ff | 2017-11-16 13:35:40 +0530 | [diff] [blame] | 574 | on ? __get_rbbm_clock_cntl_on(adreno_dev) : 0); |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 575 | } |
| 576 | |
Oleg Perelet | c2ab7f7 | 2017-06-22 16:45:57 -0700 | [diff] [blame] | 577 | #define LM_DEFAULT_LIMIT 6000 |
| 578 | |
| 579 | static uint32_t lm_limit(struct adreno_device *adreno_dev) |
| 580 | { |
| 581 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 582 | |
| 583 | if (adreno_dev->lm_limit) |
| 584 | return adreno_dev->lm_limit; |
| 585 | |
| 586 | if (of_property_read_u32(device->pdev->dev.of_node, "qcom,lm-limit", |
| 587 | &adreno_dev->lm_limit)) |
| 588 | adreno_dev->lm_limit = LM_DEFAULT_LIMIT; |
| 589 | |
| 590 | return adreno_dev->lm_limit; |
| 591 | } |
| 592 | |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 593 | static void a6xx_patch_pwrup_reglist(struct adreno_device *adreno_dev) |
| 594 | { |
| 595 | uint32_t i; |
Harshdeep Dhatt | d373aa5 | 2017-08-09 14:13:41 -0600 | [diff] [blame] | 596 | struct cpu_gpu_lock *lock; |
Tarun Karra | 4ea6812 | 2017-11-02 18:10:31 -0700 | [diff] [blame] | 597 | struct reg_list_pair *r; |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 598 | |
| 599 | /* Set up the register values */ |
Tarun Karra | 4ea6812 | 2017-11-02 18:10:31 -0700 | [diff] [blame] | 600 | for (i = 0; i < ARRAY_SIZE(a6xx_ifpc_pwrup_reglist); i++) { |
| 601 | r = &a6xx_ifpc_pwrup_reglist[i]; |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 602 | kgsl_regread(KGSL_DEVICE(adreno_dev), r->offset, &r->val); |
| 603 | } |
| 604 | |
Tarun Karra | 4ea6812 | 2017-11-02 18:10:31 -0700 | [diff] [blame] | 605 | for (i = 0; i < ARRAY_SIZE(a6xx_pwrup_reglist); i++) { |
| 606 | r = &a6xx_pwrup_reglist[i]; |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 607 | kgsl_regread(KGSL_DEVICE(adreno_dev), r->offset, &r->val); |
| 608 | } |
| 609 | |
Harshdeep Dhatt | d373aa5 | 2017-08-09 14:13:41 -0600 | [diff] [blame] | 610 | lock = (struct cpu_gpu_lock *) adreno_dev->pwrup_reglist.hostptr; |
| 611 | lock->flag_ucode = 0; |
| 612 | lock->flag_kmd = 0; |
| 613 | lock->turn = 0; |
| 614 | |
| 615 | /* |
| 616 | * The overall register list is composed of |
| 617 | * 1. Static IFPC-only registers |
| 618 | * 2. Static IFPC + preemption registers |
| 619 | * 2. Dynamic IFPC + preemption registers (ex: perfcounter selects) |
| 620 | * |
| 621 | * The CP views the second and third entries as one dynamic list |
| 622 | * starting from list_offset. Thus, list_length should be the sum |
| 623 | * of all three lists above (of which the third list will start off |
| 624 | * empty). And list_offset should be specified as the size in dwords |
| 625 | * of the static IFPC-only register list. |
| 626 | */ |
Tarun Karra | 4ea6812 | 2017-11-02 18:10:31 -0700 | [diff] [blame] | 627 | lock->list_length = (sizeof(a6xx_ifpc_pwrup_reglist) + |
Akhil P Oommen | 35dde69 | 2018-01-16 18:01:09 +0530 | [diff] [blame] | 628 | sizeof(a6xx_pwrup_reglist)) >> 2; |
| 629 | lock->list_offset = sizeof(a6xx_ifpc_pwrup_reglist) >> 2; |
Harshdeep Dhatt | d373aa5 | 2017-08-09 14:13:41 -0600 | [diff] [blame] | 630 | |
Akhil P Oommen | 35dde69 | 2018-01-16 18:01:09 +0530 | [diff] [blame] | 631 | memcpy(adreno_dev->pwrup_reglist.hostptr + sizeof(*lock), |
Tarun Karra | 4ea6812 | 2017-11-02 18:10:31 -0700 | [diff] [blame] | 632 | a6xx_ifpc_pwrup_reglist, sizeof(a6xx_ifpc_pwrup_reglist)); |
| 633 | memcpy(adreno_dev->pwrup_reglist.hostptr + sizeof(*lock) |
Akhil P Oommen | 35dde69 | 2018-01-16 18:01:09 +0530 | [diff] [blame] | 634 | + sizeof(a6xx_ifpc_pwrup_reglist), a6xx_pwrup_reglist, |
| 635 | sizeof(a6xx_pwrup_reglist)); |
| 636 | |
Deepak Kumar | 5287eea | 2018-03-17 14:33:05 +0530 | [diff] [blame] | 637 | if (adreno_is_a615(adreno_dev) || adreno_is_a616(adreno_dev)) { |
Akhil P Oommen | 35dde69 | 2018-01-16 18:01:09 +0530 | [diff] [blame] | 638 | for (i = 0; i < ARRAY_SIZE(a615_pwrup_reglist); i++) { |
| 639 | r = &a615_pwrup_reglist[i]; |
| 640 | kgsl_regread(KGSL_DEVICE(adreno_dev), |
| 641 | r->offset, &r->val); |
| 642 | } |
| 643 | |
| 644 | memcpy(adreno_dev->pwrup_reglist.hostptr + sizeof(*lock) |
| 645 | + sizeof(a6xx_ifpc_pwrup_reglist) |
| 646 | + sizeof(a6xx_pwrup_reglist), a615_pwrup_reglist, |
| 647 | sizeof(a615_pwrup_reglist)); |
| 648 | |
| 649 | lock->list_length += sizeof(a615_pwrup_reglist); |
| 650 | } |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 651 | } |
| 652 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 653 | /* |
| 654 | * a6xx_start() - Device start |
| 655 | * @adreno_dev: Pointer to adreno device |
| 656 | * |
| 657 | * a6xx device start |
| 658 | */ |
| 659 | static void a6xx_start(struct adreno_device *adreno_dev) |
| 660 | { |
| 661 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
Shrenuj Bansal | 397e589 | 2017-03-13 13:38:47 -0700 | [diff] [blame] | 662 | unsigned int bit, mal, mode, glbl_inv; |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 663 | unsigned int amsbc = 0; |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 664 | static bool patch_reglist; |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 665 | |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 666 | /* runtime adjust callbacks based on feature sets */ |
| 667 | if (!kgsl_gmu_isenabled(device)) |
| 668 | /* Legacy idle management if gmu is disabled */ |
| 669 | ADRENO_GPU_DEVICE(adreno_dev)->hw_isidle = NULL; |
Oleg Perelet | cb9b621 | 2017-03-16 15:38:43 -0700 | [diff] [blame] | 670 | /* enable hardware clockgating */ |
| 671 | a6xx_hwcg_set(adreno_dev, true); |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 672 | |
Oleg Perelet | c2ab7f7 | 2017-06-22 16:45:57 -0700 | [diff] [blame] | 673 | if (ADRENO_FEATURE(adreno_dev, ADRENO_LM)) |
| 674 | adreno_dev->lm_threshold_count = A6XX_GMU_GENERAL_1; |
| 675 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 676 | adreno_vbif_start(adreno_dev, a6xx_vbif_platforms, |
| 677 | ARRAY_SIZE(a6xx_vbif_platforms)); |
Harshdeep Dhatt | 75dbd41 | 2017-05-16 17:12:27 -0600 | [diff] [blame] | 678 | |
Deepak Kumar | 9cd4003 | 2017-12-27 13:02:10 +0530 | [diff] [blame] | 679 | if (ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_LIMIT_UCHE_GBIF_RW)) |
| 680 | kgsl_regwrite(device, A6XX_UCHE_GBIF_GX_CONFIG, 0x10200F9); |
| 681 | |
Harshdeep Dhatt | 75dbd41 | 2017-05-16 17:12:27 -0600 | [diff] [blame] | 682 | /* Make all blocks contribute to the GPU BUSY perf counter */ |
| 683 | kgsl_regwrite(device, A6XX_RBBM_PERFCTR_GPU_BUSY_MASKED, 0xFFFFFFFF); |
| 684 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 685 | /* |
| 686 | * Set UCHE_WRITE_THRU_BASE to the UCHE_TRAP_BASE effectively |
| 687 | * disabling L2 bypass |
| 688 | */ |
| 689 | kgsl_regwrite(device, A6XX_UCHE_WRITE_RANGE_MAX_LO, 0xffffffc0); |
| 690 | kgsl_regwrite(device, A6XX_UCHE_WRITE_RANGE_MAX_HI, 0x0001ffff); |
| 691 | kgsl_regwrite(device, A6XX_UCHE_TRAP_BASE_LO, 0xfffff000); |
| 692 | kgsl_regwrite(device, A6XX_UCHE_TRAP_BASE_HI, 0x0001ffff); |
| 693 | kgsl_regwrite(device, A6XX_UCHE_WRITE_THRU_BASE_LO, 0xfffff000); |
| 694 | kgsl_regwrite(device, A6XX_UCHE_WRITE_THRU_BASE_HI, 0x0001ffff); |
| 695 | |
| 696 | /* Program the GMEM VA range for the UCHE path */ |
| 697 | kgsl_regwrite(device, A6XX_UCHE_GMEM_RANGE_MIN_LO, |
| 698 | ADRENO_UCHE_GMEM_BASE); |
| 699 | kgsl_regwrite(device, A6XX_UCHE_GMEM_RANGE_MIN_HI, 0x0); |
| 700 | kgsl_regwrite(device, A6XX_UCHE_GMEM_RANGE_MAX_LO, |
| 701 | ADRENO_UCHE_GMEM_BASE + |
| 702 | adreno_dev->gmem_size - 1); |
| 703 | kgsl_regwrite(device, A6XX_UCHE_GMEM_RANGE_MAX_HI, 0x0); |
| 704 | |
| 705 | kgsl_regwrite(device, A6XX_UCHE_FILTER_CNTL, 0x804); |
| 706 | kgsl_regwrite(device, A6XX_UCHE_CACHE_WAYS, 0x4); |
| 707 | |
| 708 | kgsl_regwrite(device, A6XX_CP_ROQ_THRESHOLDS_2, 0x010000C0); |
| 709 | kgsl_regwrite(device, A6XX_CP_ROQ_THRESHOLDS_1, 0x8040362C); |
| 710 | |
| 711 | /* Setting the mem pool size */ |
| 712 | kgsl_regwrite(device, A6XX_CP_MEM_POOL_SIZE, 128); |
| 713 | |
| 714 | /* Setting the primFifo thresholds default values */ |
| 715 | kgsl_regwrite(device, A6XX_PC_DBG_ECO_CNTL, (0x300 << 11)); |
| 716 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 717 | /* Set the AHB default slave response to "ERROR" */ |
| 718 | kgsl_regwrite(device, A6XX_CP_AHB_CNTL, 0x1); |
| 719 | |
Harshdeep Dhatt | 859f3d6 | 2017-04-28 17:54:33 -0600 | [diff] [blame] | 720 | /* Turn on performance counters */ |
| 721 | kgsl_regwrite(device, A6XX_RBBM_PERFCTR_CNTL, 0x1); |
| 722 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 723 | if (of_property_read_u32(device->pdev->dev.of_node, |
| 724 | "qcom,highest-bank-bit", &bit)) |
| 725 | bit = MIN_HBB; |
| 726 | |
| 727 | if (of_property_read_u32(device->pdev->dev.of_node, |
| 728 | "qcom,min-access-length", &mal)) |
| 729 | mal = 32; |
| 730 | |
| 731 | if (of_property_read_u32(device->pdev->dev.of_node, |
| 732 | "qcom,ubwc-mode", &mode)) |
| 733 | mode = 0; |
| 734 | |
| 735 | switch (mode) { |
| 736 | case KGSL_UBWC_1_0: |
| 737 | mode = 1; |
| 738 | break; |
| 739 | case KGSL_UBWC_2_0: |
| 740 | mode = 0; |
| 741 | break; |
| 742 | case KGSL_UBWC_3_0: |
| 743 | mode = 0; |
| 744 | amsbc = 1; /* Only valid for A640 and A680 */ |
| 745 | break; |
| 746 | default: |
| 747 | break; |
| 748 | } |
| 749 | |
| 750 | if (bit >= 13 && bit <= 16) |
| 751 | bit = (bit - 13) & 0x03; |
| 752 | else |
| 753 | bit = 0; |
| 754 | |
| 755 | mal = (mal == 64) ? 1 : 0; |
| 756 | |
Shrenuj Bansal | 397e589 | 2017-03-13 13:38:47 -0700 | [diff] [blame] | 757 | /* (1 << 29)globalInvFlushFilterDis bit needs to be set for A630 V1 */ |
| 758 | glbl_inv = (adreno_is_a630v1(adreno_dev)) ? 1 : 0; |
| 759 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 760 | kgsl_regwrite(device, A6XX_RB_NC_MODE_CNTL, (amsbc << 4) | (mal << 3) | |
| 761 | (bit << 1) | mode); |
| 762 | kgsl_regwrite(device, A6XX_TPL1_NC_MODE_CNTL, (mal << 3) | |
| 763 | (bit << 1) | mode); |
| 764 | kgsl_regwrite(device, A6XX_SP_NC_MODE_CNTL, (mal << 3) | (bit << 1) | |
| 765 | mode); |
| 766 | |
Shrenuj Bansal | 397e589 | 2017-03-13 13:38:47 -0700 | [diff] [blame] | 767 | kgsl_regwrite(device, A6XX_UCHE_MODE_CNTL, (glbl_inv << 29) | |
| 768 | (mal << 23) | (bit << 21)); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 769 | |
Carter Cooper | f43f258 | 2017-08-17 17:07:42 -0600 | [diff] [blame] | 770 | /* Set hang detection threshold to 0x1FFFFF * 16 cycles */ |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 771 | kgsl_regwrite(device, A6XX_RBBM_INTERFACE_HANG_INT_CNTL, |
Carter Cooper | f43f258 | 2017-08-17 17:07:42 -0600 | [diff] [blame] | 772 | (1 << 30) | 0x1fffff); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 773 | |
Lynus Vaz | 1fde74d | 2017-03-20 18:02:47 +0530 | [diff] [blame] | 774 | kgsl_regwrite(device, A6XX_UCHE_CLIENT_PF, 1); |
| 775 | |
Lynus Vaz | 85c8cee | 2017-03-07 11:31:02 +0530 | [diff] [blame] | 776 | /* Set TWOPASSUSEWFI in A6XX_PC_DBG_ECO_CNTL if requested */ |
| 777 | if (ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_TWO_PASS_USE_WFI)) |
| 778 | kgsl_regrmw(device, A6XX_PC_DBG_ECO_CNTL, 0, (1 << 8)); |
| 779 | |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 780 | /* Enable the GMEM save/restore feature for preemption */ |
Harshdeep Dhatt | 7ee8a86 | 2017-11-20 17:51:54 -0700 | [diff] [blame] | 781 | if (adreno_is_preemption_enabled(adreno_dev)) |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 782 | kgsl_regwrite(device, A6XX_RB_CONTEXT_SWITCH_GMEM_SAVE_RESTORE, |
| 783 | 0x1); |
| 784 | |
Harshdeep Dhatt | 04d238d | 2018-02-15 10:58:47 -0700 | [diff] [blame] | 785 | a6xx_protect_init(adreno_dev); |
| 786 | |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 787 | if (!patch_reglist && (adreno_dev->pwrup_reglist.gpuaddr != 0)) { |
| 788 | a6xx_patch_pwrup_reglist(adreno_dev); |
| 789 | patch_reglist = true; |
| 790 | } |
| 791 | |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 792 | a6xx_preemption_start(adreno_dev); |
Harshdeep Dhatt | 720394d | 2017-09-13 14:25:09 -0600 | [diff] [blame] | 793 | |
| 794 | /* |
| 795 | * We start LM here because we want all the following to be up |
| 796 | * 1. GX HS |
| 797 | * 2. SPTPRAC |
| 798 | * 3. HFI |
| 799 | * At this point, we are guaranteed all. |
| 800 | */ |
| 801 | if (ADRENO_FEATURE(adreno_dev, ADRENO_LM) && |
| 802 | test_bit(ADRENO_LM_CTRL, &adreno_dev->pwrctrl_flag)) { |
Harshdeep Dhatt | c116c0f | 2017-09-13 14:45:10 -0600 | [diff] [blame] | 803 | int result; |
| 804 | struct gmu_device *gmu = &device->gmu; |
| 805 | struct device *dev = &gmu->pdev->dev; |
| 806 | |
Harshdeep Dhatt | 720394d | 2017-09-13 14:25:09 -0600 | [diff] [blame] | 807 | kgsl_gmu_regwrite(device, A6XX_GPU_GMU_CX_GMU_PWR_THRESHOLD, |
| 808 | GPU_LIMIT_THRESHOLD_ENABLE | lm_limit(adreno_dev)); |
| 809 | kgsl_gmu_regwrite(device, A6XX_GMU_AO_SPARE_CNTL, 1); |
| 810 | kgsl_gmu_regwrite(device, A6XX_GPU_GMU_CX_GMU_ISENSE_CTRL, 0x1); |
Harshdeep Dhatt | c116c0f | 2017-09-13 14:45:10 -0600 | [diff] [blame] | 811 | |
| 812 | gmu->lm_config.lm_type = 1; |
| 813 | gmu->lm_config.lm_sensor_type = 1; |
| 814 | gmu->lm_config.throttle_config = 1; |
| 815 | gmu->lm_config.idle_throttle_en = 0; |
| 816 | gmu->lm_config.acd_en = 0; |
| 817 | gmu->bcl_config = 0; |
| 818 | gmu->lm_dcvs_level = 0; |
| 819 | |
| 820 | result = hfi_send_lmconfig(gmu); |
| 821 | if (result) |
| 822 | dev_err(dev, "Failure enabling limits management (%d)\n", |
| 823 | result); |
Harshdeep Dhatt | 720394d | 2017-09-13 14:25:09 -0600 | [diff] [blame] | 824 | } |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 825 | } |
| 826 | |
| 827 | /* |
| 828 | * a6xx_microcode_load() - Load microcode |
| 829 | * @adreno_dev: Pointer to adreno device |
| 830 | */ |
| 831 | static int a6xx_microcode_load(struct adreno_device *adreno_dev) |
| 832 | { |
| 833 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 834 | struct adreno_firmware *fw = ADRENO_FW(adreno_dev, ADRENO_FW_SQE); |
| 835 | uint64_t gpuaddr; |
Harshdeep Dhatt | a9e0d76 | 2017-05-10 14:16:42 -0600 | [diff] [blame] | 836 | void *zap; |
Rajesh Kemisetti | 564ede4 | 2018-05-02 15:32:38 +0530 | [diff] [blame] | 837 | int ret = 0, zap_retry = 0; |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 838 | |
| 839 | gpuaddr = fw->memdesc.gpuaddr; |
| 840 | kgsl_regwrite(device, A6XX_CP_SQE_INSTR_BASE_LO, |
| 841 | lower_32_bits(gpuaddr)); |
| 842 | kgsl_regwrite(device, A6XX_CP_SQE_INSTR_BASE_HI, |
| 843 | upper_32_bits(gpuaddr)); |
| 844 | |
Sunil Khatri | 3e0fd3e | 2018-04-12 18:00:07 +0530 | [diff] [blame] | 845 | /* |
| 846 | * Do not invoke to load zap shader if MMU does |
| 847 | * not support secure mode. |
| 848 | */ |
| 849 | if (!device->mmu.secured) |
| 850 | return 0; |
| 851 | |
Carter Cooper | 4a313ae | 2017-02-23 11:11:56 -0700 | [diff] [blame] | 852 | /* Load the zap shader firmware through PIL if its available */ |
Harshdeep Dhatt | a9e0d76 | 2017-05-10 14:16:42 -0600 | [diff] [blame] | 853 | if (adreno_dev->gpucore->zap_name && !adreno_dev->zap_loaded) { |
Rajesh Kemisetti | 564ede4 | 2018-05-02 15:32:38 +0530 | [diff] [blame] | 854 | /* |
| 855 | * subsystem_get() may return -EAGAIN in case system is busy |
| 856 | * and unable to load the firmware. So keep trying since this |
| 857 | * is not a fatal error. |
| 858 | */ |
| 859 | do { |
| 860 | ret = 0; |
| 861 | zap = subsystem_get(adreno_dev->gpucore->zap_name); |
Carter Cooper | 4a313ae | 2017-02-23 11:11:56 -0700 | [diff] [blame] | 862 | |
Rajesh Kemisetti | 564ede4 | 2018-05-02 15:32:38 +0530 | [diff] [blame] | 863 | /* Return error if the zap shader cannot be loaded */ |
| 864 | if (IS_ERR_OR_NULL(zap)) { |
| 865 | ret = (zap == NULL) ? -ENODEV : PTR_ERR(zap); |
| 866 | zap = NULL; |
| 867 | } else |
| 868 | adreno_dev->zap_loaded = 1; |
| 869 | } while ((ret == -EAGAIN) && (zap_retry++ < ZAP_RETRY_MAX)); |
Carter Cooper | 4a313ae | 2017-02-23 11:11:56 -0700 | [diff] [blame] | 870 | } |
| 871 | |
| 872 | return ret; |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 873 | } |
| 874 | |
| 875 | |
| 876 | /* |
| 877 | * CP_INIT_MAX_CONTEXT bit tells if the multiple hardware contexts can |
| 878 | * be used at once of if they should be serialized |
| 879 | */ |
| 880 | #define CP_INIT_MAX_CONTEXT BIT(0) |
| 881 | |
| 882 | /* Enables register protection mode */ |
| 883 | #define CP_INIT_ERROR_DETECTION_CONTROL BIT(1) |
| 884 | |
| 885 | /* Header dump information */ |
| 886 | #define CP_INIT_HEADER_DUMP BIT(2) /* Reserved */ |
| 887 | |
| 888 | /* Default Reset states enabled for PFP and ME */ |
| 889 | #define CP_INIT_DEFAULT_RESET_STATE BIT(3) |
| 890 | |
| 891 | /* Drawcall filter range */ |
| 892 | #define CP_INIT_DRAWCALL_FILTER_RANGE BIT(4) |
| 893 | |
| 894 | /* Ucode workaround masks */ |
| 895 | #define CP_INIT_UCODE_WORKAROUND_MASK BIT(5) |
| 896 | |
Jonathan Wicks | 20b1df9 | 2017-07-31 11:38:32 -0600 | [diff] [blame] | 897 | /* |
| 898 | * Operation mode mask |
| 899 | * |
| 900 | * This ordinal provides the option to disable the |
| 901 | * save/restore of performance counters across preemption. |
| 902 | */ |
| 903 | #define CP_INIT_OPERATION_MODE_MASK BIT(6) |
| 904 | |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 905 | /* Register initialization list */ |
| 906 | #define CP_INIT_REGISTER_INIT_LIST BIT(7) |
| 907 | |
Harshdeep Dhatt | d373aa5 | 2017-08-09 14:13:41 -0600 | [diff] [blame] | 908 | /* Register initialization list with spinlock */ |
| 909 | #define CP_INIT_REGISTER_INIT_LIST_WITH_SPINLOCK BIT(8) |
| 910 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 911 | #define CP_INIT_MASK (CP_INIT_MAX_CONTEXT | \ |
| 912 | CP_INIT_ERROR_DETECTION_CONTROL | \ |
| 913 | CP_INIT_HEADER_DUMP | \ |
| 914 | CP_INIT_DEFAULT_RESET_STATE | \ |
Jonathan Wicks | 20b1df9 | 2017-07-31 11:38:32 -0600 | [diff] [blame] | 915 | CP_INIT_UCODE_WORKAROUND_MASK | \ |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 916 | CP_INIT_OPERATION_MODE_MASK | \ |
Harshdeep Dhatt | d373aa5 | 2017-08-09 14:13:41 -0600 | [diff] [blame] | 917 | CP_INIT_REGISTER_INIT_LIST_WITH_SPINLOCK) |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 918 | |
| 919 | static void _set_ordinals(struct adreno_device *adreno_dev, |
| 920 | unsigned int *cmds, unsigned int count) |
| 921 | { |
| 922 | unsigned int *start = cmds; |
| 923 | |
| 924 | /* Enabled ordinal mask */ |
| 925 | *cmds++ = CP_INIT_MASK; |
| 926 | |
| 927 | if (CP_INIT_MASK & CP_INIT_MAX_CONTEXT) |
| 928 | *cmds++ = 0x00000003; |
| 929 | |
| 930 | if (CP_INIT_MASK & CP_INIT_ERROR_DETECTION_CONTROL) |
| 931 | *cmds++ = 0x20000000; |
| 932 | |
| 933 | if (CP_INIT_MASK & CP_INIT_HEADER_DUMP) { |
| 934 | /* Header dump address */ |
| 935 | *cmds++ = 0x00000000; |
| 936 | /* Header dump enable and dump size */ |
| 937 | *cmds++ = 0x00000000; |
| 938 | } |
| 939 | |
| 940 | if (CP_INIT_MASK & CP_INIT_DRAWCALL_FILTER_RANGE) { |
| 941 | /* Start range */ |
| 942 | *cmds++ = 0x00000000; |
| 943 | /* End range (inclusive) */ |
| 944 | *cmds++ = 0x00000000; |
| 945 | } |
| 946 | |
| 947 | if (CP_INIT_MASK & CP_INIT_UCODE_WORKAROUND_MASK) |
| 948 | *cmds++ = 0x00000000; |
| 949 | |
Jonathan Wicks | 20b1df9 | 2017-07-31 11:38:32 -0600 | [diff] [blame] | 950 | if (CP_INIT_MASK & CP_INIT_OPERATION_MODE_MASK) |
| 951 | *cmds++ = 0x00000002; |
| 952 | |
Harshdeep Dhatt | d373aa5 | 2017-08-09 14:13:41 -0600 | [diff] [blame] | 953 | if (CP_INIT_MASK & CP_INIT_REGISTER_INIT_LIST_WITH_SPINLOCK) { |
| 954 | uint64_t gpuaddr = adreno_dev->pwrup_reglist.gpuaddr; |
| 955 | |
| 956 | *cmds++ = lower_32_bits(gpuaddr); |
| 957 | *cmds++ = upper_32_bits(gpuaddr); |
| 958 | *cmds++ = 0; |
| 959 | |
| 960 | } else if (CP_INIT_MASK & CP_INIT_REGISTER_INIT_LIST) { |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 961 | uint64_t gpuaddr = adreno_dev->pwrup_reglist.gpuaddr; |
| 962 | |
| 963 | *cmds++ = lower_32_bits(gpuaddr); |
| 964 | *cmds++ = upper_32_bits(gpuaddr); |
| 965 | /* Size is in dwords */ |
Tarun Karra | 4ea6812 | 2017-11-02 18:10:31 -0700 | [diff] [blame] | 966 | *cmds++ = (sizeof(a6xx_ifpc_pwrup_reglist) + |
| 967 | sizeof(a6xx_pwrup_reglist)) >> 2; |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 968 | } |
| 969 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 970 | /* Pad rest of the cmds with 0's */ |
| 971 | while ((unsigned int)(cmds - start) < count) |
| 972 | *cmds++ = 0x0; |
| 973 | } |
| 974 | |
| 975 | /* |
| 976 | * a6xx_send_cp_init() - Initialize ringbuffer |
| 977 | * @adreno_dev: Pointer to adreno device |
| 978 | * @rb: Pointer to the ringbuffer of device |
| 979 | * |
| 980 | * Submit commands for ME initialization, |
| 981 | */ |
| 982 | static int a6xx_send_cp_init(struct adreno_device *adreno_dev, |
| 983 | struct adreno_ringbuffer *rb) |
| 984 | { |
| 985 | unsigned int *cmds; |
| 986 | int ret; |
| 987 | |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 988 | cmds = adreno_ringbuffer_allocspace(rb, 12); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 989 | if (IS_ERR(cmds)) |
| 990 | return PTR_ERR(cmds); |
| 991 | |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 992 | *cmds++ = cp_type7_packet(CP_ME_INIT, 11); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 993 | |
Harshdeep Dhatt | d0f38f6 | 2017-06-01 12:45:26 -0600 | [diff] [blame] | 994 | _set_ordinals(adreno_dev, cmds, 11); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 995 | |
| 996 | ret = adreno_ringbuffer_submit_spin(rb, NULL, 2000); |
| 997 | if (ret) |
Carter Cooper | 8567af0 | 2017-03-15 14:22:03 -0600 | [diff] [blame] | 998 | adreno_spin_idle_debug(adreno_dev, |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 999 | "CP initialization failed to idle\n"); |
| 1000 | |
| 1001 | return ret; |
| 1002 | } |
| 1003 | |
| 1004 | /* |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 1005 | * Follow the ME_INIT sequence with a preemption yield to allow the GPU to move |
| 1006 | * to a different ringbuffer, if desired |
| 1007 | */ |
| 1008 | static int _preemption_init(struct adreno_device *adreno_dev, |
| 1009 | struct adreno_ringbuffer *rb, unsigned int *cmds, |
| 1010 | struct kgsl_context *context) |
| 1011 | { |
| 1012 | unsigned int *cmds_orig = cmds; |
| 1013 | |
| 1014 | /* Turn CP protection OFF */ |
| 1015 | *cmds++ = cp_type7_packet(CP_SET_PROTECTED_MODE, 1); |
| 1016 | *cmds++ = 0; |
| 1017 | |
| 1018 | *cmds++ = cp_type7_packet(CP_SET_PSEUDO_REGISTER, 6); |
| 1019 | *cmds++ = 1; |
| 1020 | cmds += cp_gpuaddr(adreno_dev, cmds, |
| 1021 | rb->preemption_desc.gpuaddr); |
| 1022 | |
| 1023 | *cmds++ = 2; |
Harshdeep Dhatt | 58b70eb | 2017-03-28 09:21:40 -0600 | [diff] [blame] | 1024 | cmds += cp_gpuaddr(adreno_dev, cmds, |
| 1025 | rb->secure_preemption_desc.gpuaddr); |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 1026 | |
| 1027 | /* Turn CP protection ON */ |
| 1028 | *cmds++ = cp_type7_packet(CP_SET_PROTECTED_MODE, 1); |
| 1029 | *cmds++ = 1; |
| 1030 | |
| 1031 | *cmds++ = cp_type7_packet(CP_CONTEXT_SWITCH_YIELD, 4); |
| 1032 | cmds += cp_gpuaddr(adreno_dev, cmds, 0x0); |
| 1033 | *cmds++ = 0; |
| 1034 | /* generate interrupt on preemption completion */ |
| 1035 | *cmds++ = 0; |
| 1036 | |
| 1037 | return cmds - cmds_orig; |
| 1038 | } |
| 1039 | |
| 1040 | static int a6xx_post_start(struct adreno_device *adreno_dev) |
| 1041 | { |
| 1042 | int ret; |
| 1043 | unsigned int *cmds, *start; |
| 1044 | struct adreno_ringbuffer *rb = adreno_dev->cur_rb; |
| 1045 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 1046 | |
Harshdeep Dhatt | 7ee8a86 | 2017-11-20 17:51:54 -0700 | [diff] [blame] | 1047 | if (!adreno_is_preemption_enabled(adreno_dev)) |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 1048 | return 0; |
| 1049 | |
| 1050 | cmds = adreno_ringbuffer_allocspace(rb, 42); |
| 1051 | if (IS_ERR(cmds)) { |
| 1052 | KGSL_DRV_ERR(device, "error allocating preemption init cmds"); |
| 1053 | return PTR_ERR(cmds); |
| 1054 | } |
| 1055 | start = cmds; |
| 1056 | |
| 1057 | cmds += _preemption_init(adreno_dev, rb, cmds, NULL); |
| 1058 | |
| 1059 | rb->_wptr = rb->_wptr - (42 - (cmds - start)); |
| 1060 | |
| 1061 | ret = adreno_ringbuffer_submit_spin(rb, NULL, 2000); |
| 1062 | if (ret) |
| 1063 | adreno_spin_idle_debug(adreno_dev, |
| 1064 | "hw preemption initialization failed to idle\n"); |
| 1065 | |
| 1066 | return ret; |
| 1067 | } |
| 1068 | |
| 1069 | /* |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1070 | * a6xx_rb_start() - Start the ringbuffer |
| 1071 | * @adreno_dev: Pointer to adreno device |
| 1072 | * @start_type: Warm or cold start |
| 1073 | */ |
| 1074 | static int a6xx_rb_start(struct adreno_device *adreno_dev, |
| 1075 | unsigned int start_type) |
| 1076 | { |
| 1077 | struct adreno_ringbuffer *rb = ADRENO_CURRENT_RINGBUFFER(adreno_dev); |
| 1078 | struct kgsl_device *device = &adreno_dev->dev; |
| 1079 | uint64_t addr; |
| 1080 | int ret; |
| 1081 | |
| 1082 | addr = SCRATCH_RPTR_GPU_ADDR(device, rb->id); |
| 1083 | |
| 1084 | adreno_writereg64(adreno_dev, ADRENO_REG_CP_RB_RPTR_ADDR_LO, |
| 1085 | ADRENO_REG_CP_RB_RPTR_ADDR_HI, addr); |
| 1086 | |
| 1087 | /* |
| 1088 | * The size of the ringbuffer in the hardware is the log2 |
| 1089 | * representation of the size in quadwords (sizedwords / 2). |
| 1090 | */ |
| 1091 | adreno_writereg(adreno_dev, ADRENO_REG_CP_RB_CNTL, |
| 1092 | A6XX_CP_RB_CNTL_DEFAULT); |
| 1093 | |
Deepak Kumar | 756d6a9 | 2017-11-28 16:58:29 +0530 | [diff] [blame] | 1094 | adreno_writereg64(adreno_dev, ADRENO_REG_CP_RB_BASE, |
| 1095 | ADRENO_REG_CP_RB_BASE_HI, rb->buffer_desc.gpuaddr); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1096 | |
| 1097 | ret = a6xx_microcode_load(adreno_dev); |
| 1098 | if (ret) |
| 1099 | return ret; |
| 1100 | |
| 1101 | /* Clear the SQE_HALT to start the CP engine */ |
| 1102 | kgsl_regwrite(device, A6XX_CP_SQE_CNTL, 1); |
| 1103 | |
Carter Cooper | 4a313ae | 2017-02-23 11:11:56 -0700 | [diff] [blame] | 1104 | ret = a6xx_send_cp_init(adreno_dev, rb); |
| 1105 | if (ret) |
| 1106 | return ret; |
| 1107 | |
| 1108 | /* GPU comes up in secured mode, make it unsecured by default */ |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 1109 | ret = adreno_set_unsecured_mode(adreno_dev, rb); |
| 1110 | if (ret) |
| 1111 | return ret; |
| 1112 | |
| 1113 | return a6xx_post_start(adreno_dev); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1114 | } |
| 1115 | |
Kyle Piefer | edc6c8a | 2017-11-10 14:51:58 -0800 | [diff] [blame] | 1116 | unsigned int a6xx_set_marker( |
| 1117 | unsigned int *cmds, enum adreno_cp_marker_type type) |
| 1118 | { |
| 1119 | unsigned int cmd = 0; |
| 1120 | |
| 1121 | *cmds++ = cp_type7_packet(CP_SET_MARKER, 1); |
| 1122 | |
| 1123 | /* |
| 1124 | * Indicate the beginning and end of the IB1 list with a SET_MARKER. |
| 1125 | * Among other things, this will implicitly enable and disable |
| 1126 | * preemption respectively. IFPC can also be disabled and enabled |
| 1127 | * with a SET_MARKER. Bit 8 tells the CP the marker is for IFPC. |
| 1128 | */ |
| 1129 | switch (type) { |
| 1130 | case IFPC_DISABLE: |
| 1131 | cmd = 0x101; |
| 1132 | break; |
| 1133 | case IFPC_ENABLE: |
| 1134 | cmd = 0x100; |
| 1135 | break; |
| 1136 | case IB1LIST_START: |
| 1137 | cmd = 0xD; |
| 1138 | break; |
| 1139 | case IB1LIST_END: |
| 1140 | cmd = 0xE; |
| 1141 | break; |
| 1142 | } |
| 1143 | |
| 1144 | *cmds++ = cmd; |
| 1145 | return 2; |
| 1146 | } |
| 1147 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1148 | static int _load_firmware(struct kgsl_device *device, const char *fwfile, |
| 1149 | struct adreno_firmware *firmware) |
| 1150 | { |
| 1151 | const struct firmware *fw = NULL; |
| 1152 | int ret; |
| 1153 | |
| 1154 | ret = request_firmware(&fw, fwfile, device->dev); |
| 1155 | |
| 1156 | if (ret) { |
| 1157 | KGSL_DRV_ERR(device, "request_firmware(%s) failed: %d\n", |
| 1158 | fwfile, ret); |
| 1159 | return ret; |
| 1160 | } |
| 1161 | |
| 1162 | ret = kgsl_allocate_global(device, &firmware->memdesc, fw->size - 4, |
| 1163 | KGSL_MEMFLAGS_GPUREADONLY, 0, "ucode"); |
| 1164 | |
| 1165 | if (!ret) { |
| 1166 | memcpy(firmware->memdesc.hostptr, &fw->data[4], fw->size - 4); |
| 1167 | firmware->size = (fw->size - 4) / sizeof(uint32_t); |
| 1168 | firmware->version = *(unsigned int *)&fw->data[4]; |
| 1169 | } |
| 1170 | |
| 1171 | release_firmware(fw); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1172 | return ret; |
| 1173 | } |
| 1174 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1175 | #define RSC_CMD_OFFSET 2 |
| 1176 | #define PDC_CMD_OFFSET 4 |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1177 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1178 | static void _regwrite(void __iomem *regbase, |
| 1179 | unsigned int offsetwords, unsigned int value) |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1180 | { |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1181 | void __iomem *reg; |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1182 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1183 | reg = regbase + (offsetwords << 2); |
| 1184 | __raw_writel(value, reg); |
| 1185 | } |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1186 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1187 | /* |
| 1188 | * _load_gmu_rpmh_ucode() - Load the ucode into the GPU PDC/RSC blocks |
| 1189 | * PDC and RSC execute GPU power on/off RPMh sequence |
| 1190 | * @device: Pointer to KGSL device |
| 1191 | */ |
| 1192 | static void _load_gmu_rpmh_ucode(struct kgsl_device *device) |
| 1193 | { |
Kyle Piefer | 8e37717 | 2017-08-10 13:24:09 -0700 | [diff] [blame] | 1194 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1195 | struct gmu_device *gmu = &device->gmu; |
| 1196 | |
Kyle Piefer | 8e37717 | 2017-08-10 13:24:09 -0700 | [diff] [blame] | 1197 | /* Disable SDE clock gating */ |
| 1198 | kgsl_gmu_regwrite(device, A6XX_GPU_RSCC_RSC_STATUS0_DRV0, BIT(24)); |
| 1199 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1200 | /* Setup RSC PDC handshake for sleep and wakeup */ |
| 1201 | kgsl_gmu_regwrite(device, A6XX_RSCC_PDC_SLAVE_ID_DRV0, 1); |
| 1202 | kgsl_gmu_regwrite(device, A6XX_RSCC_HIDDEN_TCS_CMD0_DATA, 0); |
| 1203 | kgsl_gmu_regwrite(device, A6XX_RSCC_HIDDEN_TCS_CMD0_ADDR, 0); |
| 1204 | kgsl_gmu_regwrite(device, |
| 1205 | A6XX_RSCC_HIDDEN_TCS_CMD0_DATA + RSC_CMD_OFFSET, 0); |
| 1206 | kgsl_gmu_regwrite(device, |
| 1207 | A6XX_RSCC_HIDDEN_TCS_CMD0_ADDR + RSC_CMD_OFFSET, 0); |
| 1208 | kgsl_gmu_regwrite(device, |
| 1209 | A6XX_RSCC_HIDDEN_TCS_CMD0_DATA + RSC_CMD_OFFSET * 2, |
| 1210 | 0x80000000); |
| 1211 | kgsl_gmu_regwrite(device, |
| 1212 | A6XX_RSCC_HIDDEN_TCS_CMD0_ADDR + RSC_CMD_OFFSET * 2, |
| 1213 | 0); |
| 1214 | kgsl_gmu_regwrite(device, A6XX_RSCC_OVERRIDE_START_ADDR, 0); |
| 1215 | kgsl_gmu_regwrite(device, A6XX_RSCC_PDC_SEQ_START_ADDR, 0x4520); |
| 1216 | kgsl_gmu_regwrite(device, A6XX_RSCC_PDC_MATCH_VALUE_LO, 0x4510); |
| 1217 | kgsl_gmu_regwrite(device, A6XX_RSCC_PDC_MATCH_VALUE_HI, 0x4514); |
| 1218 | |
Kyle Piefer | 8e37717 | 2017-08-10 13:24:09 -0700 | [diff] [blame] | 1219 | /* Enable timestamp event for v1 only */ |
| 1220 | if (adreno_is_a630v1(adreno_dev)) |
| 1221 | kgsl_gmu_regwrite(device, A6XX_RSCC_TIMESTAMP_UNIT1_EN_DRV0, 1); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1222 | |
| 1223 | /* Load RSC sequencer uCode for sleep and wakeup */ |
| 1224 | kgsl_gmu_regwrite(device, A6XX_RSCC_SEQ_MEM_0_DRV0, 0xA7A506A0); |
| 1225 | kgsl_gmu_regwrite(device, A6XX_RSCC_SEQ_MEM_0_DRV0 + 1, 0xA1E6A6E7); |
| 1226 | kgsl_gmu_regwrite(device, A6XX_RSCC_SEQ_MEM_0_DRV0 + 2, 0xA2E081E1); |
| 1227 | kgsl_gmu_regwrite(device, A6XX_RSCC_SEQ_MEM_0_DRV0 + 3, 0xE9A982E2); |
| 1228 | kgsl_gmu_regwrite(device, A6XX_RSCC_SEQ_MEM_0_DRV0 + 4, 0x0020E8A8); |
| 1229 | |
| 1230 | /* Load PDC sequencer uCode for power up and power down sequence */ |
Kyle Piefer | 8e37717 | 2017-08-10 13:24:09 -0700 | [diff] [blame] | 1231 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_SEQ_MEM_0, 0xFEBEA1E1); |
| 1232 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_SEQ_MEM_0 + 1, 0xA5A4A3A2); |
| 1233 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_SEQ_MEM_0 + 2, 0x8382A6E0); |
| 1234 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_SEQ_MEM_0 + 3, 0xBCE3E284); |
| 1235 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_SEQ_MEM_0 + 4, 0x002081FC); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1236 | |
| 1237 | /* Set TCS commands used by PDC sequence for low power modes */ |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1238 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS1_CMD_ENABLE_BANK, 7); |
| 1239 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS1_CMD_WAIT_FOR_CMPL_BANK, 0); |
| 1240 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS1_CONTROL, 0); |
| 1241 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS1_CMD0_MSGID, 0x10108); |
| 1242 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS1_CMD0_ADDR, 0x30010); |
Kyle Piefer | 8714918 | 2017-10-05 15:01:33 -0700 | [diff] [blame] | 1243 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS1_CMD0_DATA, 1); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1244 | _regwrite(gmu->pdc_reg_virt, |
| 1245 | PDC_GPU_TCS1_CMD0_MSGID + PDC_CMD_OFFSET, 0x10108); |
| 1246 | _regwrite(gmu->pdc_reg_virt, |
| 1247 | PDC_GPU_TCS1_CMD0_ADDR + PDC_CMD_OFFSET, 0x30000); |
| 1248 | _regwrite(gmu->pdc_reg_virt, |
Kyle Piefer | 8714918 | 2017-10-05 15:01:33 -0700 | [diff] [blame] | 1249 | PDC_GPU_TCS1_CMD0_DATA + PDC_CMD_OFFSET, 0x0); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1250 | _regwrite(gmu->pdc_reg_virt, |
| 1251 | PDC_GPU_TCS1_CMD0_MSGID + PDC_CMD_OFFSET * 2, 0x10108); |
| 1252 | _regwrite(gmu->pdc_reg_virt, |
| 1253 | PDC_GPU_TCS1_CMD0_ADDR + PDC_CMD_OFFSET * 2, 0x30080); |
| 1254 | _regwrite(gmu->pdc_reg_virt, |
Kyle Piefer | 8714918 | 2017-10-05 15:01:33 -0700 | [diff] [blame] | 1255 | PDC_GPU_TCS1_CMD0_DATA + PDC_CMD_OFFSET * 2, 0x0); |
| 1256 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS3_CMD_ENABLE_BANK, 7); |
| 1257 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS3_CMD_WAIT_FOR_CMPL_BANK, 0); |
| 1258 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS3_CONTROL, 0); |
| 1259 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS3_CMD0_MSGID, 0x10108); |
| 1260 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS3_CMD0_ADDR, 0x30010); |
| 1261 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_TCS3_CMD0_DATA, 2); |
| 1262 | _regwrite(gmu->pdc_reg_virt, |
| 1263 | PDC_GPU_TCS3_CMD0_MSGID + PDC_CMD_OFFSET, 0x10108); |
| 1264 | _regwrite(gmu->pdc_reg_virt, |
| 1265 | PDC_GPU_TCS3_CMD0_ADDR + PDC_CMD_OFFSET, 0x30000); |
| 1266 | _regwrite(gmu->pdc_reg_virt, |
George Shen | fec34f3 | 2018-03-05 11:57:19 -0800 | [diff] [blame] | 1267 | PDC_GPU_TCS3_CMD0_DATA + PDC_CMD_OFFSET, 0x3); |
Kyle Piefer | 8714918 | 2017-10-05 15:01:33 -0700 | [diff] [blame] | 1268 | _regwrite(gmu->pdc_reg_virt, |
| 1269 | PDC_GPU_TCS3_CMD0_MSGID + PDC_CMD_OFFSET * 2, 0x10108); |
| 1270 | _regwrite(gmu->pdc_reg_virt, |
| 1271 | PDC_GPU_TCS3_CMD0_ADDR + PDC_CMD_OFFSET * 2, 0x30080); |
| 1272 | _regwrite(gmu->pdc_reg_virt, |
| 1273 | PDC_GPU_TCS3_CMD0_DATA + PDC_CMD_OFFSET * 2, 0x3); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1274 | |
| 1275 | /* Setup GPU PDC */ |
| 1276 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_SEQ_START_ADDR, 0); |
| 1277 | _regwrite(gmu->pdc_reg_virt, PDC_GPU_ENABLE_PDC, 0x80000001); |
| 1278 | |
| 1279 | /* ensure no writes happen before the uCode is fully written */ |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1280 | wmb(); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1281 | } |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1282 | |
Oleg Perelet | 3bbc63a | 2018-01-26 10:05:25 -0800 | [diff] [blame] | 1283 | #define GMU_START_TIMEOUT 100 /* ms */ |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 1284 | #define GPU_START_TIMEOUT 100 /* ms */ |
| 1285 | #define GPU_RESET_TIMEOUT 1 /* ms */ |
| 1286 | #define GPU_RESET_TIMEOUT_US 10 /* us */ |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1287 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1288 | /* |
| 1289 | * timed_poll_check() - polling *gmu* register at given offset until |
| 1290 | * its value changed to match expected value. The function times |
| 1291 | * out and returns after given duration if register is not updated |
| 1292 | * as expected. |
| 1293 | * |
| 1294 | * @device: Pointer to KGSL device |
| 1295 | * @offset: Register offset |
| 1296 | * @expected_ret: expected register value that stops polling |
| 1297 | * @timout: number of jiffies to abort the polling |
| 1298 | * @mask: bitmask to filter register value to match expected_ret |
| 1299 | */ |
| 1300 | static int timed_poll_check(struct kgsl_device *device, |
| 1301 | unsigned int offset, unsigned int expected_ret, |
| 1302 | unsigned int timeout, unsigned int mask) |
| 1303 | { |
| 1304 | unsigned long t; |
| 1305 | unsigned int value; |
| 1306 | |
| 1307 | t = jiffies + msecs_to_jiffies(timeout); |
| 1308 | |
Kyle Piefer | d9e09dc | 2017-05-19 16:34:43 -0700 | [diff] [blame] | 1309 | do { |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1310 | kgsl_gmu_regread(device, offset, &value); |
| 1311 | if ((value & mask) == expected_ret) |
| 1312 | return 0; |
George Shen | 56c9cdb | 2017-08-25 10:43:32 -0700 | [diff] [blame] | 1313 | /* Wait 100us to reduce unnecessary AHB bus traffic */ |
Oleg Perelet | 7f7f9f5 | 2017-10-31 10:02:45 -0700 | [diff] [blame] | 1314 | usleep_range(10, 100); |
Kyle Piefer | d9e09dc | 2017-05-19 16:34:43 -0700 | [diff] [blame] | 1315 | } while (!time_after(jiffies, t)); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1316 | |
Carter Cooper | 1ee715a | 2017-09-07 16:08:38 -0600 | [diff] [blame] | 1317 | /* Double check one last time */ |
| 1318 | kgsl_gmu_regread(device, offset, &value); |
| 1319 | if ((value & mask) == expected_ret) |
| 1320 | return 0; |
| 1321 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1322 | return -EINVAL; |
| 1323 | } |
| 1324 | |
| 1325 | /* |
Kyle Piefer | 4edfb6b | 2017-08-03 16:42:09 -0700 | [diff] [blame] | 1326 | * The lowest 16 bits of this value are the number of XO clock cycles |
| 1327 | * for main hysteresis. This is the first hysteresis. Here we set it |
Kyle Piefer | bfed916 | 2017-10-13 13:29:00 -0700 | [diff] [blame] | 1328 | * to 0x1680 cycles, or 300 us. The highest 16 bits of this value are |
Kyle Piefer | 4edfb6b | 2017-08-03 16:42:09 -0700 | [diff] [blame] | 1329 | * the number of XO clock cycles for short hysteresis. This happens |
| 1330 | * after main hysteresis. Here we set it to 0xA cycles, or 0.5 us. |
| 1331 | */ |
Kyle Piefer | bfed916 | 2017-10-13 13:29:00 -0700 | [diff] [blame] | 1332 | #define GMU_PWR_COL_HYST 0x000A1680 |
Kyle Piefer | 4edfb6b | 2017-08-03 16:42:09 -0700 | [diff] [blame] | 1333 | |
| 1334 | /* |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1335 | * a6xx_gmu_power_config() - Configure and enable GMU's low power mode |
| 1336 | * setting based on ADRENO feature flags. |
| 1337 | * @device: Pointer to KGSL device |
| 1338 | */ |
| 1339 | static void a6xx_gmu_power_config(struct kgsl_device *device) |
| 1340 | { |
| 1341 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 1342 | struct gmu_device *gmu = &device->gmu; |
| 1343 | |
Kyle Piefer | d396416 | 2017-04-06 15:44:03 -0700 | [diff] [blame] | 1344 | /* Configure registers for idle setting. The setting is cumulative */ |
George Shen | c4c7426 | 2017-05-11 15:37:34 -0700 | [diff] [blame] | 1345 | |
George Shen | 1f312ab | 2017-08-01 10:53:50 -0700 | [diff] [blame] | 1346 | /* Disable GMU WB/RB buffer */ |
| 1347 | kgsl_gmu_regwrite(device, A6XX_GMU_SYS_BUS_CONFIG, 0x1); |
| 1348 | |
George Shen | c4c7426 | 2017-05-11 15:37:34 -0700 | [diff] [blame] | 1349 | kgsl_gmu_regwrite(device, |
| 1350 | A6XX_GMU_PWR_COL_INTER_FRAME_CTRL, 0x9C40400); |
| 1351 | |
Kyle Piefer | d396416 | 2017-04-06 15:44:03 -0700 | [diff] [blame] | 1352 | switch (gmu->idle_level) { |
| 1353 | case GPU_HW_MIN_VOLT: |
Kyle Piefer | dc0706c | 2017-04-13 13:17:50 -0700 | [diff] [blame] | 1354 | kgsl_gmu_regrmw(device, A6XX_GMU_RPMH_CTRL, 0, |
| 1355 | MIN_BW_ENABLE_MASK); |
| 1356 | kgsl_gmu_regrmw(device, A6XX_GMU_RPMH_HYST_CTRL, 0, |
| 1357 | MIN_BW_HYST); |
Kyle Piefer | d396416 | 2017-04-06 15:44:03 -0700 | [diff] [blame] | 1358 | /* fall through */ |
| 1359 | case GPU_HW_NAP: |
Kyle Piefer | dc0706c | 2017-04-13 13:17:50 -0700 | [diff] [blame] | 1360 | kgsl_gmu_regrmw(device, A6XX_GMU_GPU_NAP_CTRL, 0, |
| 1361 | HW_NAP_ENABLE_MASK); |
Kyle Piefer | d396416 | 2017-04-06 15:44:03 -0700 | [diff] [blame] | 1362 | /* fall through */ |
| 1363 | case GPU_HW_IFPC: |
| 1364 | kgsl_gmu_regwrite(device, A6XX_GMU_PWR_COL_INTER_FRAME_HYST, |
Kyle Piefer | 4edfb6b | 2017-08-03 16:42:09 -0700 | [diff] [blame] | 1365 | GMU_PWR_COL_HYST); |
Kyle Piefer | dc0706c | 2017-04-13 13:17:50 -0700 | [diff] [blame] | 1366 | kgsl_gmu_regrmw(device, A6XX_GMU_PWR_COL_INTER_FRAME_CTRL, 0, |
Kyle Piefer | d396416 | 2017-04-06 15:44:03 -0700 | [diff] [blame] | 1367 | IFPC_ENABLE_MASK); |
| 1368 | /* fall through */ |
| 1369 | case GPU_HW_SPTP_PC: |
| 1370 | kgsl_gmu_regwrite(device, A6XX_GMU_PWR_COL_SPTPRAC_HYST, |
Kyle Piefer | 4edfb6b | 2017-08-03 16:42:09 -0700 | [diff] [blame] | 1371 | GMU_PWR_COL_HYST); |
Kyle Piefer | dc0706c | 2017-04-13 13:17:50 -0700 | [diff] [blame] | 1372 | kgsl_gmu_regrmw(device, A6XX_GMU_PWR_COL_INTER_FRAME_CTRL, 0, |
Kyle Piefer | d396416 | 2017-04-06 15:44:03 -0700 | [diff] [blame] | 1373 | SPTP_ENABLE_MASK); |
| 1374 | /* fall through */ |
| 1375 | default: |
| 1376 | break; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1377 | } |
| 1378 | |
Kyle Piefer | 3a5ac09 | 2017-04-06 16:05:30 -0700 | [diff] [blame] | 1379 | /* ACD feature enablement */ |
Oleg Perelet | c2ab7f7 | 2017-06-22 16:45:57 -0700 | [diff] [blame] | 1380 | if (ADRENO_FEATURE(adreno_dev, ADRENO_LM) && |
| 1381 | test_bit(ADRENO_LM_CTRL, &adreno_dev->pwrctrl_flag)) |
Kyle Piefer | dc0706c | 2017-04-13 13:17:50 -0700 | [diff] [blame] | 1382 | kgsl_gmu_regrmw(device, A6XX_GMU_BOOT_KMD_LM_HANDSHAKE, 0, |
| 1383 | BIT(10)); |
Kyle Piefer | 3a5ac09 | 2017-04-06 16:05:30 -0700 | [diff] [blame] | 1384 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1385 | /* Enable RPMh GPU client */ |
| 1386 | if (ADRENO_FEATURE(adreno_dev, ADRENO_RPMH)) |
Kyle Piefer | dc0706c | 2017-04-13 13:17:50 -0700 | [diff] [blame] | 1387 | kgsl_gmu_regrmw(device, A6XX_GMU_RPMH_CTRL, 0, |
| 1388 | RPMH_ENABLE_MASK); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1389 | } |
| 1390 | |
| 1391 | /* |
| 1392 | * a6xx_gmu_start() - Start GMU and wait until FW boot up. |
| 1393 | * @device: Pointer to KGSL device |
| 1394 | */ |
| 1395 | static int a6xx_gmu_start(struct kgsl_device *device) |
| 1396 | { |
| 1397 | struct gmu_device *gmu = &device->gmu; |
| 1398 | |
Oleg Perelet | 5d2d28f | 2018-03-06 17:03:20 -0800 | [diff] [blame] | 1399 | kgsl_regwrite(device, A6XX_GMU_CX_GMU_WFI_CONFIG, 0x0); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1400 | /* Write 1 first to make sure the GMU is reset */ |
| 1401 | kgsl_gmu_regwrite(device, A6XX_GMU_CM3_SYSRESET, 1); |
| 1402 | |
| 1403 | /* Make sure putting in reset doesn't happen after clearing */ |
| 1404 | wmb(); |
| 1405 | |
| 1406 | /* Bring GMU out of reset */ |
| 1407 | kgsl_gmu_regwrite(device, A6XX_GMU_CM3_SYSRESET, 0); |
| 1408 | if (timed_poll_check(device, |
| 1409 | A6XX_GMU_CM3_FW_INIT_RESULT, |
| 1410 | 0xBABEFACE, |
| 1411 | GMU_START_TIMEOUT, |
| 1412 | 0xFFFFFFFF)) { |
| 1413 | dev_err(&gmu->pdev->dev, "GMU doesn't boot\n"); |
| 1414 | return -ETIMEDOUT; |
| 1415 | } |
| 1416 | |
| 1417 | return 0; |
| 1418 | } |
| 1419 | |
| 1420 | /* |
| 1421 | * a6xx_gmu_hfi_start() - Write registers and start HFI. |
| 1422 | * @device: Pointer to KGSL device |
| 1423 | */ |
| 1424 | static int a6xx_gmu_hfi_start(struct kgsl_device *device) |
| 1425 | { |
| 1426 | struct gmu_device *gmu = &device->gmu; |
| 1427 | |
Kyle Piefer | e7b06b4 | 2017-04-06 13:53:01 -0700 | [diff] [blame] | 1428 | kgsl_gmu_regrmw(device, A6XX_GMU_GMU2HOST_INTR_MASK, |
| 1429 | HFI_IRQ_MSGQ_MASK, 0); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1430 | kgsl_gmu_regwrite(device, A6XX_GMU_HFI_CTRL_INIT, 1); |
| 1431 | |
| 1432 | if (timed_poll_check(device, |
| 1433 | A6XX_GMU_HFI_CTRL_STATUS, |
| 1434 | BIT(0), |
| 1435 | GMU_START_TIMEOUT, |
| 1436 | BIT(0))) { |
| 1437 | dev_err(&gmu->pdev->dev, "GMU HFI init failed\n"); |
| 1438 | return -ETIMEDOUT; |
| 1439 | } |
| 1440 | |
| 1441 | return 0; |
| 1442 | } |
| 1443 | |
| 1444 | /* |
| 1445 | * a6xx_oob_set() - Set OOB interrupt to GMU. |
| 1446 | * @adreno_dev: Pointer to adreno device |
| 1447 | * @set_mask: set_mask is a bitmask that defines a set of OOB |
| 1448 | * interrupts to trigger. |
| 1449 | * @check_mask: check_mask is a bitmask that provides a set of |
| 1450 | * OOB ACK bits. check_mask usually matches set_mask to |
| 1451 | * ensure OOBs are handled. |
| 1452 | * @clear_mask: After GMU handles a OOB interrupt, GMU driver |
| 1453 | * clears the interrupt. clear_mask is a bitmask defines |
| 1454 | * a set of OOB interrupts to clear. |
| 1455 | */ |
| 1456 | static int a6xx_oob_set(struct adreno_device *adreno_dev, |
| 1457 | unsigned int set_mask, unsigned int check_mask, |
| 1458 | unsigned int clear_mask) |
| 1459 | { |
| 1460 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1461 | int ret = 0; |
| 1462 | |
George Shen | a458dd9 | 2018-01-03 14:20:34 -0800 | [diff] [blame] | 1463 | if (!kgsl_gmu_isenabled(device) || !clear_mask) |
Kyle Piefer | c75922e | 2017-05-18 15:05:07 -0700 | [diff] [blame] | 1464 | return 0; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1465 | |
| 1466 | kgsl_gmu_regwrite(device, A6XX_GMU_HOST2GMU_INTR_SET, set_mask); |
| 1467 | |
| 1468 | if (timed_poll_check(device, |
| 1469 | A6XX_GMU_GMU2HOST_INTR_INFO, |
| 1470 | check_mask, |
| 1471 | GPU_START_TIMEOUT, |
| 1472 | check_mask)) { |
| 1473 | ret = -ETIMEDOUT; |
George Shen | 7201a6d | 2017-11-03 10:39:36 -0700 | [diff] [blame] | 1474 | WARN(1, "OOB set timed out, mask %x\n", set_mask); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1475 | } |
| 1476 | |
| 1477 | kgsl_gmu_regwrite(device, A6XX_GMU_GMU2HOST_INTR_CLR, clear_mask); |
| 1478 | |
George Shen | a458dd9 | 2018-01-03 14:20:34 -0800 | [diff] [blame] | 1479 | set_bit((fls(clear_mask) - 1), &a6xx_oob_state_bitmask); |
| 1480 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1481 | trace_kgsl_gmu_oob_set(set_mask); |
| 1482 | return ret; |
| 1483 | } |
| 1484 | |
| 1485 | /* |
| 1486 | * a6xx_oob_clear() - Clear a previously set OOB request. |
| 1487 | * @adreno_dev: Pointer to the adreno device that has the GMU |
| 1488 | * @clear_mask: Bitmask that provides the OOB bits to clear |
| 1489 | */ |
| 1490 | static inline void a6xx_oob_clear(struct adreno_device *adreno_dev, |
| 1491 | unsigned int clear_mask) |
| 1492 | { |
| 1493 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 1494 | |
George Shen | a458dd9 | 2018-01-03 14:20:34 -0800 | [diff] [blame] | 1495 | if (!kgsl_gmu_isenabled(device) || !clear_mask) |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1496 | return; |
| 1497 | |
George Shen | a458dd9 | 2018-01-03 14:20:34 -0800 | [diff] [blame] | 1498 | if (test_and_clear_bit(fls(clear_mask) - 1, |
| 1499 | &a6xx_oob_state_bitmask)) |
| 1500 | kgsl_gmu_regwrite(device, |
| 1501 | A6XX_GMU_HOST2GMU_INTR_SET, |
| 1502 | clear_mask); |
| 1503 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1504 | trace_kgsl_gmu_oob_clear(clear_mask); |
| 1505 | } |
| 1506 | |
Carter Cooper | df7ba70 | 2017-03-20 11:28:04 -0600 | [diff] [blame] | 1507 | /* |
| 1508 | * a6xx_gpu_keepalive() - GMU reg write to request GPU stays on |
| 1509 | * @adreno_dev: Pointer to the adreno device that has the GMU |
| 1510 | * @state: State to set: true is ON, false is OFF |
| 1511 | */ |
| 1512 | static inline void a6xx_gpu_keepalive(struct adreno_device *adreno_dev, |
| 1513 | bool state) |
| 1514 | { |
| 1515 | adreno_write_gmureg(adreno_dev, |
| 1516 | ADRENO_REG_GMU_PWR_COL_KEEPALIVE, state); |
| 1517 | } |
| 1518 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1519 | #define SPTPRAC_POWERON_CTRL_MASK 0x00778000 |
| 1520 | #define SPTPRAC_POWEROFF_CTRL_MASK 0x00778001 |
| 1521 | #define SPTPRAC_POWEROFF_STATUS_MASK BIT(2) |
| 1522 | #define SPTPRAC_POWERON_STATUS_MASK BIT(3) |
| 1523 | #define SPTPRAC_CTRL_TIMEOUT 10 /* ms */ |
Kyle Piefer | fa50d3e | 2017-05-24 12:35:24 -0700 | [diff] [blame] | 1524 | #define A6XX_RETAIN_FF_ENABLE_ENABLE_MASK BIT(11) |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1525 | |
| 1526 | /* |
| 1527 | * a6xx_sptprac_enable() - Power on SPTPRAC |
| 1528 | * @adreno_dev: Pointer to Adreno device |
| 1529 | */ |
| 1530 | static int a6xx_sptprac_enable(struct adreno_device *adreno_dev) |
| 1531 | { |
| 1532 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 1533 | struct gmu_device *gmu = &device->gmu; |
| 1534 | |
Kyle Piefer | 51dc014 | 2017-04-14 12:32:49 -0700 | [diff] [blame] | 1535 | if (!gmu->pdev) |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1536 | return -EINVAL; |
| 1537 | |
| 1538 | kgsl_gmu_regwrite(device, A6XX_GMU_GX_SPTPRAC_POWER_CONTROL, |
| 1539 | SPTPRAC_POWERON_CTRL_MASK); |
| 1540 | |
| 1541 | if (timed_poll_check(device, |
| 1542 | A6XX_GMU_SPTPRAC_PWR_CLK_STATUS, |
| 1543 | SPTPRAC_POWERON_STATUS_MASK, |
| 1544 | SPTPRAC_CTRL_TIMEOUT, |
| 1545 | SPTPRAC_POWERON_STATUS_MASK)) { |
| 1546 | dev_err(&gmu->pdev->dev, "power on SPTPRAC fail\n"); |
| 1547 | return -EINVAL; |
| 1548 | } |
| 1549 | |
| 1550 | return 0; |
| 1551 | } |
| 1552 | |
| 1553 | /* |
| 1554 | * a6xx_sptprac_disable() - Power of SPTPRAC |
| 1555 | * @adreno_dev: Pointer to Adreno device |
| 1556 | */ |
| 1557 | static void a6xx_sptprac_disable(struct adreno_device *adreno_dev) |
| 1558 | { |
| 1559 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 1560 | struct gmu_device *gmu = &device->gmu; |
| 1561 | |
Kyle Piefer | 51dc014 | 2017-04-14 12:32:49 -0700 | [diff] [blame] | 1562 | if (!gmu->pdev) |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1563 | return; |
| 1564 | |
Kyle Piefer | fa50d3e | 2017-05-24 12:35:24 -0700 | [diff] [blame] | 1565 | /* Ensure that retention is on */ |
| 1566 | kgsl_gmu_regrmw(device, A6XX_GPU_CC_GX_GDSCR, 0, |
| 1567 | A6XX_RETAIN_FF_ENABLE_ENABLE_MASK); |
| 1568 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1569 | kgsl_gmu_regwrite(device, A6XX_GMU_GX_SPTPRAC_POWER_CONTROL, |
| 1570 | SPTPRAC_POWEROFF_CTRL_MASK); |
| 1571 | |
| 1572 | if (timed_poll_check(device, |
| 1573 | A6XX_GMU_SPTPRAC_PWR_CLK_STATUS, |
| 1574 | SPTPRAC_POWEROFF_STATUS_MASK, |
| 1575 | SPTPRAC_CTRL_TIMEOUT, |
| 1576 | SPTPRAC_POWEROFF_STATUS_MASK)) |
| 1577 | dev_err(&gmu->pdev->dev, "power off SPTPRAC fail\n"); |
| 1578 | } |
| 1579 | |
Shrenuj Bansal | d197bf6 | 2017-04-07 11:00:09 -0700 | [diff] [blame] | 1580 | #define SPTPRAC_POWER_OFF BIT(2) |
| 1581 | #define SP_CLK_OFF BIT(4) |
| 1582 | #define GX_GDSC_POWER_OFF BIT(6) |
| 1583 | #define GX_CLK_OFF BIT(7) |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 1584 | #define is_on(val) (!(val & (GX_GDSC_POWER_OFF | GX_CLK_OFF))) |
Shrenuj Bansal | d197bf6 | 2017-04-07 11:00:09 -0700 | [diff] [blame] | 1585 | /* |
| 1586 | * a6xx_gx_is_on() - Check if GX is on using pwr status register |
| 1587 | * @adreno_dev - Pointer to adreno_device |
| 1588 | * This check should only be performed if the keepalive bit is set or it |
| 1589 | * can be guaranteed that the power state of the GPU will remain unchanged |
| 1590 | */ |
| 1591 | static bool a6xx_gx_is_on(struct adreno_device *adreno_dev) |
| 1592 | { |
| 1593 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 1594 | unsigned int val; |
Shrenuj Bansal | d197bf6 | 2017-04-07 11:00:09 -0700 | [diff] [blame] | 1595 | |
| 1596 | if (!kgsl_gmu_isenabled(device)) |
| 1597 | return true; |
| 1598 | |
| 1599 | kgsl_gmu_regread(device, A6XX_GMU_SPTPRAC_PWR_CLK_STATUS, &val); |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 1600 | return is_on(val); |
Shrenuj Bansal | d197bf6 | 2017-04-07 11:00:09 -0700 | [diff] [blame] | 1601 | } |
| 1602 | |
| 1603 | /* |
| 1604 | * a6xx_sptprac_is_on() - Check if SPTP is on using pwr status register |
| 1605 | * @adreno_dev - Pointer to adreno_device |
| 1606 | * This check should only be performed if the keepalive bit is set or it |
| 1607 | * can be guaranteed that the power state of the GPU will remain unchanged |
| 1608 | */ |
| 1609 | static bool a6xx_sptprac_is_on(struct adreno_device *adreno_dev) |
| 1610 | { |
| 1611 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 1612 | unsigned int val; |
| 1613 | |
| 1614 | if (!kgsl_gmu_isenabled(device)) |
| 1615 | return true; |
| 1616 | |
| 1617 | kgsl_gmu_regread(device, A6XX_GMU_SPTPRAC_PWR_CLK_STATUS, &val); |
| 1618 | return !(val & (SPTPRAC_POWER_OFF | SP_CLK_OFF)); |
| 1619 | } |
| 1620 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1621 | /* |
| 1622 | * a6xx_gfx_rail_on() - request GMU to power GPU at given OPP. |
| 1623 | * @device: Pointer to KGSL device |
| 1624 | * |
| 1625 | */ |
| 1626 | static int a6xx_gfx_rail_on(struct kgsl_device *device) |
| 1627 | { |
| 1628 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 1629 | struct kgsl_pwrctrl *pwr = &device->pwrctrl; |
| 1630 | struct gmu_device *gmu = &device->gmu; |
| 1631 | struct arc_vote_desc *default_opp; |
| 1632 | unsigned int perf_idx; |
| 1633 | int ret; |
| 1634 | |
| 1635 | perf_idx = pwr->num_pwrlevels - pwr->default_pwrlevel - 1; |
| 1636 | default_opp = &gmu->rpmh_votes.gx_votes[perf_idx]; |
| 1637 | |
| 1638 | kgsl_gmu_regwrite(device, A6XX_GMU_BOOT_SLUMBER_OPTION, |
| 1639 | OOB_BOOT_OPTION); |
| 1640 | kgsl_gmu_regwrite(device, A6XX_GMU_GX_VOTE_IDX, default_opp->pri_idx); |
| 1641 | kgsl_gmu_regwrite(device, A6XX_GMU_MX_VOTE_IDX, default_opp->sec_idx); |
| 1642 | |
| 1643 | ret = a6xx_oob_set(adreno_dev, OOB_BOOT_SLUMBER_SET_MASK, |
| 1644 | OOB_BOOT_SLUMBER_CHECK_MASK, |
| 1645 | OOB_BOOT_SLUMBER_CLEAR_MASK); |
| 1646 | |
| 1647 | if (ret) |
Kyle Piefer | 247e35c | 2017-06-08 11:13:11 -0700 | [diff] [blame] | 1648 | dev_err(&gmu->pdev->dev, "Boot OOB timed out\n"); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1649 | |
| 1650 | return ret; |
| 1651 | } |
| 1652 | |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 1653 | #define GMU_POWER_STATE_SLUMBER 15 |
| 1654 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1655 | /* |
| 1656 | * a6xx_notify_slumber() - initiate request to GMU to prepare to slumber |
| 1657 | * @device: Pointer to KGSL device |
| 1658 | */ |
| 1659 | static int a6xx_notify_slumber(struct kgsl_device *device) |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1660 | { |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1661 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 1662 | struct kgsl_pwrctrl *pwr = &device->pwrctrl; |
| 1663 | struct gmu_device *gmu = &device->gmu; |
| 1664 | int bus_level = pwr->pwrlevels[pwr->default_pwrlevel].bus_freq; |
| 1665 | int perf_idx = gmu->num_gpupwrlevels - pwr->default_pwrlevel - 1; |
| 1666 | int ret, state; |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1667 | |
Kyle Piefer | 247e35c | 2017-06-08 11:13:11 -0700 | [diff] [blame] | 1668 | /* Disable the power counter so that the GMU is not busy */ |
| 1669 | kgsl_gmu_regwrite(device, A6XX_GMU_CX_GMU_POWER_COUNTER_ENABLE, 0); |
| 1670 | |
Kyle Piefer | f53c187 | 2017-09-11 14:16:43 -0700 | [diff] [blame] | 1671 | /* Turn off SPTPRAC if we own it */ |
| 1672 | if (gmu->idle_level < GPU_HW_SPTP_PC) |
| 1673 | a6xx_sptprac_disable(adreno_dev); |
Kyle Piefer | 68178ef | 2017-06-19 16:46:13 -0700 | [diff] [blame] | 1674 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1675 | if (!ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_HFI_USE_REG)) { |
| 1676 | ret = hfi_notify_slumber(gmu, perf_idx, bus_level); |
Kyle Piefer | da0fa54 | 2017-08-04 13:39:40 -0700 | [diff] [blame] | 1677 | goto out; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1678 | } |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1679 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1680 | kgsl_gmu_regwrite(device, A6XX_GMU_BOOT_SLUMBER_OPTION, |
| 1681 | OOB_SLUMBER_OPTION); |
Sharat Masetty | 928bc1d | 2017-11-13 15:46:55 +0530 | [diff] [blame] | 1682 | kgsl_gmu_regwrite(device, A6XX_GMU_GX_VOTE_IDX, perf_idx); |
| 1683 | kgsl_gmu_regwrite(device, A6XX_GMU_MX_VOTE_IDX, bus_level); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1684 | |
| 1685 | ret = a6xx_oob_set(adreno_dev, OOB_BOOT_SLUMBER_SET_MASK, |
| 1686 | OOB_BOOT_SLUMBER_CHECK_MASK, |
| 1687 | OOB_BOOT_SLUMBER_CLEAR_MASK); |
| 1688 | a6xx_oob_clear(adreno_dev, OOB_BOOT_SLUMBER_CLEAR_MASK); |
| 1689 | |
| 1690 | if (ret) |
Kyle Piefer | 247e35c | 2017-06-08 11:13:11 -0700 | [diff] [blame] | 1691 | dev_err(&gmu->pdev->dev, "Notify slumber OOB timed out\n"); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1692 | else { |
George Shen | f2d4e05 | 2017-05-11 16:28:23 -0700 | [diff] [blame] | 1693 | kgsl_gmu_regread(device, |
| 1694 | A6XX_GPU_GMU_CX_GMU_RPMH_POWER_STATE, &state); |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 1695 | if (state != GPU_HW_SLUMBER) { |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1696 | dev_err(&gmu->pdev->dev, |
Kyle Piefer | c96ad95 | 2017-05-02 13:35:45 -0700 | [diff] [blame] | 1697 | "Failed to prepare for slumber: 0x%x\n", |
| 1698 | state); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1699 | ret = -EINVAL; |
| 1700 | } |
| 1701 | } |
| 1702 | |
Kyle Piefer | da0fa54 | 2017-08-04 13:39:40 -0700 | [diff] [blame] | 1703 | out: |
| 1704 | /* Make sure the fence is in ALLOW mode */ |
| 1705 | kgsl_gmu_regwrite(device, A6XX_GMU_AO_AHB_FENCE_CTRL, 0); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1706 | return ret; |
| 1707 | } |
| 1708 | |
| 1709 | static int a6xx_rpmh_power_on_gpu(struct kgsl_device *device) |
| 1710 | { |
| 1711 | struct gmu_device *gmu = &device->gmu; |
| 1712 | struct device *dev = &gmu->pdev->dev; |
George Shen | 6927d8f | 2017-07-19 11:38:10 -0700 | [diff] [blame] | 1713 | int val; |
| 1714 | |
Deepak Kumar | 0eb0a0c | 2018-04-24 14:11:53 +0530 | [diff] [blame] | 1715 | /* Only trigger wakeup sequence if sleep sequence was done earlier */ |
| 1716 | if (!test_bit(GMU_RSCC_SLEEP_SEQ_DONE, &gmu->flags)) |
| 1717 | return 0; |
| 1718 | |
George Shen | 6927d8f | 2017-07-19 11:38:10 -0700 | [diff] [blame] | 1719 | kgsl_gmu_regread(device, A6XX_GPU_CC_GX_DOMAIN_MISC, &val); |
George Shen | 683841f | 2017-10-03 18:12:02 -0700 | [diff] [blame] | 1720 | if (!(val & 0x1)) |
| 1721 | dev_err_ratelimited(&gmu->pdev->dev, |
| 1722 | "GMEM CLAMP IO not set while GFX rail off\n"); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1723 | |
George Shen | cbb18e2 | 2017-05-11 16:04:13 -0700 | [diff] [blame] | 1724 | /* RSC wake sequence */ |
| 1725 | kgsl_gmu_regwrite(device, A6XX_GMU_RSCC_CONTROL_REQ, BIT(1)); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1726 | |
George Shen | cbb18e2 | 2017-05-11 16:04:13 -0700 | [diff] [blame] | 1727 | /* Write request before polling */ |
| 1728 | wmb(); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1729 | |
George Shen | cbb18e2 | 2017-05-11 16:04:13 -0700 | [diff] [blame] | 1730 | if (timed_poll_check(device, |
| 1731 | A6XX_GMU_RSCC_CONTROL_ACK, |
| 1732 | BIT(1), |
| 1733 | GPU_START_TIMEOUT, |
| 1734 | BIT(1))) { |
| 1735 | dev_err(dev, "Failed to do GPU RSC power on\n"); |
| 1736 | return -EINVAL; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1737 | } |
| 1738 | |
George Shen | cbb18e2 | 2017-05-11 16:04:13 -0700 | [diff] [blame] | 1739 | if (timed_poll_check(device, |
| 1740 | A6XX_RSCC_SEQ_BUSY_DRV0, |
| 1741 | 0, |
| 1742 | GPU_START_TIMEOUT, |
| 1743 | 0xFFFFFFFF)) |
| 1744 | goto error_rsc; |
| 1745 | |
| 1746 | kgsl_gmu_regwrite(device, A6XX_GMU_RSCC_CONTROL_REQ, 0); |
| 1747 | |
Deepak Kumar | 0eb0a0c | 2018-04-24 14:11:53 +0530 | [diff] [blame] | 1748 | /* Clear sleep sequence flag as wakeup sequence is successful */ |
| 1749 | clear_bit(GMU_RSCC_SLEEP_SEQ_DONE, &gmu->flags); |
| 1750 | |
Kyle Piefer | 247e35c | 2017-06-08 11:13:11 -0700 | [diff] [blame] | 1751 | /* Enable the power counter because it was disabled before slumber */ |
| 1752 | kgsl_gmu_regwrite(device, A6XX_GMU_CX_GMU_POWER_COUNTER_ENABLE, 1); |
| 1753 | |
Kyle Piefer | 68178ef | 2017-06-19 16:46:13 -0700 | [diff] [blame] | 1754 | return 0; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1755 | error_rsc: |
| 1756 | dev_err(dev, "GPU RSC sequence stuck in waking up GPU\n"); |
Kyle Piefer | 68178ef | 2017-06-19 16:46:13 -0700 | [diff] [blame] | 1757 | return -EINVAL; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1758 | } |
| 1759 | |
| 1760 | static int a6xx_rpmh_power_off_gpu(struct kgsl_device *device) |
| 1761 | { |
| 1762 | struct gmu_device *gmu = &device->gmu; |
Kyle Piefer | 3e1f6bc | 2017-08-10 11:16:19 -0700 | [diff] [blame] | 1763 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 1764 | int ret; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1765 | |
Deepak Kumar | 0eb0a0c | 2018-04-24 14:11:53 +0530 | [diff] [blame] | 1766 | if (test_bit(GMU_RSCC_SLEEP_SEQ_DONE, &gmu->flags)) |
| 1767 | return 0; |
| 1768 | |
Kyle Piefer | 3e1f6bc | 2017-08-10 11:16:19 -0700 | [diff] [blame] | 1769 | /* RSC sleep sequence is different on v1 */ |
| 1770 | if (adreno_is_a630v1(adreno_dev)) |
| 1771 | kgsl_gmu_regwrite(device, A6XX_RSCC_TIMESTAMP_UNIT1_EN_DRV0, 1); |
| 1772 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1773 | kgsl_gmu_regwrite(device, A6XX_GMU_RSCC_CONTROL_REQ, 1); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 1774 | wmb(); |
| 1775 | |
Kyle Piefer | 3e1f6bc | 2017-08-10 11:16:19 -0700 | [diff] [blame] | 1776 | if (adreno_is_a630v1(adreno_dev)) |
| 1777 | ret = timed_poll_check(device, |
| 1778 | A6XX_RSCC_TIMESTAMP_UNIT1_OUTPUT_DRV0, |
| 1779 | BIT(0), |
| 1780 | GPU_START_TIMEOUT, |
| 1781 | BIT(0)); |
| 1782 | else |
| 1783 | ret = timed_poll_check(device, |
| 1784 | A6XX_GPU_RSCC_RSC_STATUS0_DRV0, |
| 1785 | BIT(16), |
| 1786 | GPU_START_TIMEOUT, |
| 1787 | BIT(16)); |
| 1788 | |
| 1789 | if (ret) { |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1790 | dev_err(&gmu->pdev->dev, "GPU RSC power off fail\n"); |
Kyle Piefer | 3e1f6bc | 2017-08-10 11:16:19 -0700 | [diff] [blame] | 1791 | return -ETIMEDOUT; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1792 | } |
| 1793 | |
Kyle Piefer | 3e1f6bc | 2017-08-10 11:16:19 -0700 | [diff] [blame] | 1794 | /* Read to clear the timestamp valid signal. Don't care what we read. */ |
| 1795 | if (adreno_is_a630v1(adreno_dev)) { |
| 1796 | kgsl_gmu_regread(device, |
| 1797 | A6XX_RSCC_TIMESTAMP_UNIT0_TIMESTAMP_L_DRV0, |
| 1798 | &ret); |
| 1799 | kgsl_gmu_regread(device, |
| 1800 | A6XX_RSCC_TIMESTAMP_UNIT0_TIMESTAMP_H_DRV0, |
| 1801 | &ret); |
| 1802 | } |
| 1803 | |
Kyle Piefer | 9e0ac3c | 2017-05-01 16:34:14 -0700 | [diff] [blame] | 1804 | kgsl_gmu_regwrite(device, A6XX_GMU_RSCC_CONTROL_REQ, 0); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1805 | |
Oleg Perelet | c2ab7f7 | 2017-06-22 16:45:57 -0700 | [diff] [blame] | 1806 | if (ADRENO_FEATURE(adreno_dev, ADRENO_LM) && |
Kyle Piefer | 3e1f6bc | 2017-08-10 11:16:19 -0700 | [diff] [blame] | 1807 | test_bit(ADRENO_LM_CTRL, &adreno_dev->pwrctrl_flag)) |
Oleg Perelet | c2ab7f7 | 2017-06-22 16:45:57 -0700 | [diff] [blame] | 1808 | kgsl_gmu_regwrite(device, A6XX_GMU_AO_SPARE_CNTL, 0); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1809 | |
Deepak Kumar | 0eb0a0c | 2018-04-24 14:11:53 +0530 | [diff] [blame] | 1810 | set_bit(GMU_RSCC_SLEEP_SEQ_DONE, &gmu->flags); |
Kyle Piefer | 68178ef | 2017-06-19 16:46:13 -0700 | [diff] [blame] | 1811 | return 0; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1812 | } |
| 1813 | |
| 1814 | /* |
| 1815 | * a6xx_gmu_fw_start() - set up GMU and start FW |
| 1816 | * @device: Pointer to KGSL device |
| 1817 | * @boot_state: State of the GMU being started |
| 1818 | */ |
| 1819 | static int a6xx_gmu_fw_start(struct kgsl_device *device, |
| 1820 | unsigned int boot_state) |
| 1821 | { |
| 1822 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 1823 | struct gmu_device *gmu = &device->gmu; |
| 1824 | struct gmu_memdesc *mem_addr = gmu->hfi_mem; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1825 | int ret, i; |
George Shen | f453d42 | 2017-08-19 21:12:11 -0700 | [diff] [blame] | 1826 | unsigned int chipid = 0; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1827 | |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 1828 | switch (boot_state) { |
| 1829 | case GMU_COLD_BOOT: |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1830 | /* Turn on TCM retention */ |
| 1831 | kgsl_gmu_regwrite(device, A6XX_GMU_GENERAL_7, 1); |
| 1832 | |
Kyle Piefer | 68178ef | 2017-06-19 16:46:13 -0700 | [diff] [blame] | 1833 | if (!test_and_set_bit(GMU_BOOT_INIT_DONE, &gmu->flags)) |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1834 | _load_gmu_rpmh_ucode(device); |
Deepak Kumar | 0eb0a0c | 2018-04-24 14:11:53 +0530 | [diff] [blame] | 1835 | else { |
George Shen | cbb18e2 | 2017-05-11 16:04:13 -0700 | [diff] [blame] | 1836 | ret = a6xx_rpmh_power_on_gpu(device); |
| 1837 | if (ret) |
| 1838 | return ret; |
| 1839 | } |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1840 | |
| 1841 | if (gmu->load_mode == TCM_BOOT) { |
| 1842 | /* Load GMU image via AHB bus */ |
| 1843 | for (i = 0; i < MAX_GMUFW_SIZE; i++) |
| 1844 | kgsl_gmu_regwrite(device, |
| 1845 | A6XX_GMU_CM3_ITCM_START + i, |
| 1846 | *((uint32_t *) gmu->fw_image. |
| 1847 | hostptr + i)); |
| 1848 | |
| 1849 | /* Prevent leaving reset before the FW is written */ |
| 1850 | wmb(); |
| 1851 | } else { |
| 1852 | dev_err(&gmu->pdev->dev, "Incorrect GMU load mode %d\n", |
| 1853 | gmu->load_mode); |
| 1854 | return -EINVAL; |
| 1855 | } |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 1856 | break; |
| 1857 | case GMU_WARM_BOOT: |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1858 | ret = a6xx_rpmh_power_on_gpu(device); |
| 1859 | if (ret) |
| 1860 | return ret; |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 1861 | break; |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 1862 | default: |
| 1863 | break; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1864 | } |
| 1865 | |
| 1866 | /* Clear init result to make sure we are getting fresh value */ |
| 1867 | kgsl_gmu_regwrite(device, A6XX_GMU_CM3_FW_INIT_RESULT, 0); |
| 1868 | kgsl_gmu_regwrite(device, A6XX_GMU_CM3_BOOT_CONFIG, gmu->load_mode); |
| 1869 | |
| 1870 | kgsl_gmu_regwrite(device, A6XX_GMU_HFI_QTBL_ADDR, |
| 1871 | mem_addr->gmuaddr); |
| 1872 | kgsl_gmu_regwrite(device, A6XX_GMU_HFI_QTBL_INFO, 1); |
| 1873 | |
| 1874 | kgsl_gmu_regwrite(device, A6XX_GMU_AHB_FENCE_RANGE_0, |
| 1875 | FENCE_RANGE_MASK); |
| 1876 | |
George Shen | f453d42 | 2017-08-19 21:12:11 -0700 | [diff] [blame] | 1877 | /* Pass chipid to GMU FW, must happen before starting GMU */ |
| 1878 | |
| 1879 | /* Keep Core and Major bitfields unchanged */ |
| 1880 | chipid = adreno_dev->chipid & 0xFFFF0000; |
| 1881 | |
| 1882 | /* |
| 1883 | * Compress minor and patch version into 8 bits |
| 1884 | * Bit 15-12: minor version |
| 1885 | * Bit 11-8: patch version |
| 1886 | */ |
| 1887 | chipid = chipid | (ADRENO_CHIPID_MINOR(adreno_dev->chipid) << 12) |
| 1888 | | (ADRENO_CHIPID_PATCH(adreno_dev->chipid) << 8); |
| 1889 | |
| 1890 | kgsl_gmu_regwrite(device, A6XX_GMU_HFI_SFR_ADDR, chipid); |
| 1891 | |
Kyle Piefer | d396416 | 2017-04-06 15:44:03 -0700 | [diff] [blame] | 1892 | /* Configure power control and bring the GMU out of reset */ |
| 1893 | a6xx_gmu_power_config(device); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1894 | ret = a6xx_gmu_start(device); |
| 1895 | if (ret) |
| 1896 | return ret; |
| 1897 | |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 1898 | if (ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_HFI_USE_REG)) { |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1899 | ret = a6xx_gfx_rail_on(device); |
| 1900 | if (ret) { |
| 1901 | a6xx_oob_clear(adreno_dev, |
| 1902 | OOB_BOOT_SLUMBER_CLEAR_MASK); |
| 1903 | return ret; |
| 1904 | } |
| 1905 | } |
| 1906 | |
Kyle Piefer | 68178ef | 2017-06-19 16:46:13 -0700 | [diff] [blame] | 1907 | if (gmu->idle_level < GPU_HW_SPTP_PC) { |
| 1908 | ret = a6xx_sptprac_enable(adreno_dev); |
| 1909 | if (ret) |
| 1910 | return ret; |
| 1911 | } |
| 1912 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1913 | ret = a6xx_gmu_hfi_start(device); |
| 1914 | if (ret) |
| 1915 | return ret; |
| 1916 | |
| 1917 | /* Make sure the write to start HFI happens before sending a message */ |
| 1918 | wmb(); |
| 1919 | return ret; |
| 1920 | } |
| 1921 | |
| 1922 | /* |
| 1923 | * a6xx_gmu_dcvs_nohfi() - request GMU to do DCVS without using HFI |
| 1924 | * @device: Pointer to KGSL device |
| 1925 | * @perf_idx: Index into GPU performance level table defined in |
| 1926 | * HFI DCVS table message |
| 1927 | * @bw_idx: Index into GPU b/w table defined in HFI b/w table message |
| 1928 | * |
| 1929 | */ |
| 1930 | static int a6xx_gmu_dcvs_nohfi(struct kgsl_device *device, |
| 1931 | unsigned int perf_idx, unsigned int bw_idx) |
| 1932 | { |
| 1933 | struct hfi_dcvs_cmd dcvs_cmd = { |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 1934 | .ack_type = ACK_NONBLOCK, |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1935 | .freq = { |
| 1936 | .perf_idx = perf_idx, |
| 1937 | .clkset_opt = OPTION_AT_LEAST, |
| 1938 | }, |
| 1939 | .bw = { |
| 1940 | .bw_idx = bw_idx, |
| 1941 | }, |
| 1942 | }; |
| 1943 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 1944 | struct gmu_device *gmu = &device->gmu; |
| 1945 | union gpu_perf_vote vote; |
| 1946 | int ret; |
| 1947 | |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1948 | kgsl_gmu_regwrite(device, A6XX_GMU_DCVS_ACK_OPTION, dcvs_cmd.ack_type); |
| 1949 | |
| 1950 | vote.fvote = dcvs_cmd.freq; |
| 1951 | kgsl_gmu_regwrite(device, A6XX_GMU_DCVS_PERF_SETTING, vote.raw); |
| 1952 | |
| 1953 | vote.bvote = dcvs_cmd.bw; |
| 1954 | kgsl_gmu_regwrite(device, A6XX_GMU_DCVS_BW_SETTING, vote.raw); |
| 1955 | |
| 1956 | ret = a6xx_oob_set(adreno_dev, OOB_DCVS_SET_MASK, OOB_DCVS_CHECK_MASK, |
| 1957 | OOB_DCVS_CLEAR_MASK); |
| 1958 | |
| 1959 | if (ret) { |
Kyle Piefer | 247e35c | 2017-06-08 11:13:11 -0700 | [diff] [blame] | 1960 | dev_err(&gmu->pdev->dev, "DCVS OOB timed out\n"); |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 1961 | goto done; |
| 1962 | } |
| 1963 | |
| 1964 | kgsl_gmu_regread(device, A6XX_GMU_DCVS_RETURN, &ret); |
| 1965 | if (ret) |
| 1966 | dev_err(&gmu->pdev->dev, "OOB DCVS error %d\n", ret); |
| 1967 | |
| 1968 | done: |
| 1969 | a6xx_oob_clear(adreno_dev, OOB_DCVS_CLEAR_MASK); |
| 1970 | |
| 1971 | return ret; |
| 1972 | } |
| 1973 | |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 1974 | static bool a6xx_hw_isidle(struct adreno_device *adreno_dev) |
| 1975 | { |
| 1976 | unsigned int reg; |
| 1977 | |
| 1978 | kgsl_gmu_regread(KGSL_DEVICE(adreno_dev), |
| 1979 | A6XX_GPU_GMU_AO_GPU_CX_BUSY_STATUS, ®); |
George Shen | cbb18e2 | 2017-05-11 16:04:13 -0700 | [diff] [blame] | 1980 | if (reg & GPUBUSYIGNAHB) |
| 1981 | return false; |
| 1982 | return true; |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 1983 | } |
| 1984 | |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 1985 | static bool idle_trandition_complete(unsigned int idle_level, |
| 1986 | unsigned int gmu_power_reg, |
| 1987 | unsigned int sptprac_clk_reg) |
| 1988 | { |
| 1989 | if (idle_level != gmu_power_reg) |
| 1990 | return false; |
| 1991 | |
| 1992 | switch (idle_level) { |
| 1993 | case GPU_HW_IFPC: |
| 1994 | if (is_on(sptprac_clk_reg)) |
| 1995 | return false; |
| 1996 | break; |
| 1997 | /* other GMU idle levels can be added here */ |
| 1998 | case GPU_HW_ACTIVE: |
| 1999 | default: |
| 2000 | break; |
| 2001 | } |
| 2002 | return true; |
| 2003 | } |
| 2004 | |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2005 | static int a6xx_wait_for_lowest_idle(struct adreno_device *adreno_dev) |
| 2006 | { |
| 2007 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2008 | struct gmu_device *gmu = &device->gmu; |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 2009 | unsigned int reg, reg1; |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2010 | unsigned long t; |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 2011 | uint64_t ts1, ts2, ts3; |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2012 | |
| 2013 | if (!kgsl_gmu_isenabled(device)) |
| 2014 | return 0; |
| 2015 | |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 2016 | ts1 = read_AO_counter(device); |
| 2017 | |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2018 | t = jiffies + msecs_to_jiffies(GMU_IDLE_TIMEOUT); |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 2019 | do { |
| 2020 | kgsl_gmu_regread(device, |
| 2021 | A6XX_GPU_GMU_CX_GMU_RPMH_POWER_STATE, ®); |
| 2022 | kgsl_gmu_regread(device, |
| 2023 | A6XX_GMU_SPTPRAC_PWR_CLK_STATUS, ®1); |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2024 | |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 2025 | if (idle_trandition_complete(gmu->idle_level, reg, reg1)) |
| 2026 | return 0; |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2027 | /* Wait 100us to reduce unnecessary AHB bus traffic */ |
Oleg Perelet | 7f7f9f5 | 2017-10-31 10:02:45 -0700 | [diff] [blame] | 2028 | usleep_range(10, 100); |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 2029 | } while (!time_after(jiffies, t)); |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2030 | |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 2031 | ts2 = read_AO_counter(device); |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2032 | /* Check one last time */ |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2033 | |
Oleg Perelet | 39fead2 | 2018-01-08 14:46:17 -0800 | [diff] [blame] | 2034 | kgsl_gmu_regread(device, A6XX_GPU_GMU_CX_GMU_RPMH_POWER_STATE, ®); |
| 2035 | kgsl_gmu_regread(device, A6XX_GMU_SPTPRAC_PWR_CLK_STATUS, ®1); |
| 2036 | |
| 2037 | if (idle_trandition_complete(gmu->idle_level, reg, reg1)) |
| 2038 | return 0; |
| 2039 | |
| 2040 | ts3 = read_AO_counter(device); |
| 2041 | WARN(1, "Timeout waiting for lowest idle: %08x %llx %llx %llx %x\n", |
| 2042 | reg, ts1, ts2, ts3, reg1); |
| 2043 | |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 2044 | return -ETIMEDOUT; |
| 2045 | } |
| 2046 | |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 2047 | static int a6xx_wait_for_gmu_idle(struct adreno_device *adreno_dev) |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 2048 | { |
| 2049 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2050 | struct gmu_device *gmu = &device->gmu; |
Oleg Perelet | 5df700d | 2018-01-26 09:21:47 -0800 | [diff] [blame] | 2051 | unsigned int status2; |
| 2052 | uint64_t ts1; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 2053 | |
Oleg Perelet | 5df700d | 2018-01-26 09:21:47 -0800 | [diff] [blame] | 2054 | ts1 = read_AO_counter(device); |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 2055 | if (timed_poll_check(device, A6XX_GPU_GMU_AO_GPU_CX_BUSY_STATUS, |
Kyle Piefer | 5c9478c | 2017-04-20 15:12:05 -0700 | [diff] [blame] | 2056 | 0, GMU_START_TIMEOUT, CXGXCPUBUSYIGNAHB)) { |
Kyle Piefer | 247e35c | 2017-06-08 11:13:11 -0700 | [diff] [blame] | 2057 | kgsl_gmu_regread(device, |
Kyle Piefer | 247e35c | 2017-06-08 11:13:11 -0700 | [diff] [blame] | 2058 | A6XX_GPU_GMU_AO_GPU_CX_BUSY_STATUS2, &status2); |
| 2059 | dev_err(&gmu->pdev->dev, |
Oleg Perelet | 5df700d | 2018-01-26 09:21:47 -0800 | [diff] [blame] | 2060 | "GMU not idling: status2=0x%x %llx %llx\n", |
| 2061 | status2, ts1, read_AO_counter(device)); |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 2062 | return -ETIMEDOUT; |
| 2063 | } |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 2064 | |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 2065 | return 0; |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 2066 | } |
| 2067 | |
| 2068 | /* |
| 2069 | * _load_gmu_firmware() - Load the ucode into the GPMU RAM & PDC/RSC |
| 2070 | * @device: Pointer to KGSL device |
| 2071 | */ |
| 2072 | static int _load_gmu_firmware(struct kgsl_device *device) |
| 2073 | { |
| 2074 | const struct firmware *fw = NULL; |
| 2075 | const struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 2076 | struct gmu_device *gmu = &device->gmu; |
| 2077 | const struct adreno_gpu_core *gpucore = adreno_dev->gpucore; |
| 2078 | int image_size, ret = -EINVAL; |
| 2079 | |
| 2080 | /* there is no GMU */ |
| 2081 | if (!kgsl_gmu_isenabled(device)) |
| 2082 | return 0; |
| 2083 | |
| 2084 | /* GMU fw already saved and verified so do nothing new */ |
| 2085 | if (gmu->fw_image.hostptr != 0) |
| 2086 | return 0; |
| 2087 | |
| 2088 | if (gpucore->gpmufw_name == NULL) |
| 2089 | return -EINVAL; |
| 2090 | |
| 2091 | ret = request_firmware(&fw, gpucore->gpmufw_name, device->dev); |
| 2092 | if (ret || fw == NULL) { |
| 2093 | KGSL_CORE_ERR("request_firmware (%s) failed: %d\n", |
| 2094 | gpucore->gpmufw_name, ret); |
| 2095 | return ret; |
| 2096 | } |
| 2097 | |
| 2098 | image_size = PAGE_ALIGN(fw->size); |
| 2099 | |
| 2100 | ret = allocate_gmu_image(gmu, image_size); |
| 2101 | |
| 2102 | /* load into shared memory with GMU */ |
| 2103 | if (!ret) |
| 2104 | memcpy(gmu->fw_image.hostptr, fw->data, fw->size); |
| 2105 | |
| 2106 | release_firmware(fw); |
| 2107 | |
| 2108 | return ret; |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2109 | } |
| 2110 | |
| 2111 | /* |
| 2112 | * a6xx_microcode_read() - Read microcode |
| 2113 | * @adreno_dev: Pointer to adreno device |
| 2114 | */ |
| 2115 | static int a6xx_microcode_read(struct adreno_device *adreno_dev) |
| 2116 | { |
Lynus Vaz | 573e501 | 2017-06-20 20:37:50 +0530 | [diff] [blame] | 2117 | int ret; |
| 2118 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2119 | struct adreno_firmware *sqe_fw = ADRENO_FW(adreno_dev, ADRENO_FW_SQE); |
| 2120 | |
| 2121 | if (sqe_fw->memdesc.hostptr == NULL) { |
| 2122 | ret = _load_firmware(device, adreno_dev->gpucore->sqefw_name, |
| 2123 | sqe_fw); |
| 2124 | if (ret) |
| 2125 | return ret; |
| 2126 | } |
| 2127 | |
| 2128 | return _load_gmu_firmware(device); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2129 | } |
| 2130 | |
Rajesh Kemisetti | d1ca954 | 2017-10-18 15:35:41 +0530 | [diff] [blame] | 2131 | #define GBIF_CX_HALT_MASK BIT(1) |
Shrenuj Bansal | 49d0e9f | 2017-05-08 16:10:24 -0700 | [diff] [blame] | 2132 | |
| 2133 | static int a6xx_soft_reset(struct adreno_device *adreno_dev) |
| 2134 | { |
| 2135 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2136 | unsigned int reg; |
Shrenuj Bansal | 13cae37 | 2017-06-07 13:34:35 -0700 | [diff] [blame] | 2137 | unsigned long time; |
| 2138 | bool vbif_acked = false; |
Shrenuj Bansal | 49d0e9f | 2017-05-08 16:10:24 -0700 | [diff] [blame] | 2139 | |
| 2140 | /* |
| 2141 | * For the soft reset case with GMU enabled this part is done |
| 2142 | * by the GMU firmware |
| 2143 | */ |
Shrenuj Bansal | d0fe746 | 2017-05-08 16:11:19 -0700 | [diff] [blame] | 2144 | if (kgsl_gmu_isenabled(device) && |
| 2145 | !test_bit(ADRENO_DEVICE_HARD_RESET, &adreno_dev->priv)) |
Shrenuj Bansal | 49d0e9f | 2017-05-08 16:10:24 -0700 | [diff] [blame] | 2146 | return 0; |
| 2147 | |
| 2148 | |
| 2149 | adreno_writereg(adreno_dev, ADRENO_REG_RBBM_SW_RESET_CMD, 1); |
| 2150 | /* |
| 2151 | * Do a dummy read to get a brief read cycle delay for the |
| 2152 | * reset to take effect |
| 2153 | */ |
| 2154 | adreno_readreg(adreno_dev, ADRENO_REG_RBBM_SW_RESET_CMD, ®); |
| 2155 | adreno_writereg(adreno_dev, ADRENO_REG_RBBM_SW_RESET_CMD, 0); |
| 2156 | |
Shrenuj Bansal | 13cae37 | 2017-06-07 13:34:35 -0700 | [diff] [blame] | 2157 | /* Wait for the VBIF reset ack to complete */ |
| 2158 | time = jiffies + msecs_to_jiffies(VBIF_RESET_ACK_TIMEOUT); |
| 2159 | |
| 2160 | do { |
| 2161 | kgsl_regread(device, A6XX_RBBM_VBIF_GX_RESET_STATUS, ®); |
| 2162 | if ((reg & VBIF_RESET_ACK_MASK) == VBIF_RESET_ACK_MASK) { |
| 2163 | vbif_acked = true; |
| 2164 | break; |
| 2165 | } |
| 2166 | cpu_relax(); |
| 2167 | } while (!time_after(jiffies, time)); |
| 2168 | |
| 2169 | if (!vbif_acked) |
Shrenuj Bansal | 49d0e9f | 2017-05-08 16:10:24 -0700 | [diff] [blame] | 2170 | return -ETIMEDOUT; |
| 2171 | |
Rajesh Kemisetti | d1ca954 | 2017-10-18 15:35:41 +0530 | [diff] [blame] | 2172 | /* |
| 2173 | * GBIF GX halt will be released automatically by sw_reset. |
| 2174 | * Release GBIF CX halt after sw_reset |
| 2175 | */ |
| 2176 | if (adreno_has_gbif(adreno_dev)) |
| 2177 | kgsl_regrmw(device, A6XX_GBIF_HALT, GBIF_CX_HALT_MASK, 0); |
| 2178 | |
Shrenuj Bansal | 49d0e9f | 2017-05-08 16:10:24 -0700 | [diff] [blame] | 2179 | a6xx_sptprac_enable(adreno_dev); |
| 2180 | |
| 2181 | return 0; |
| 2182 | } |
| 2183 | |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 2184 | #define A6XX_STATE_OF_CHILD (BIT(4) | BIT(5)) |
| 2185 | #define A6XX_IDLE_FULL_LLM BIT(0) |
| 2186 | #define A6XX_WAKEUP_ACK BIT(1) |
| 2187 | #define A6XX_IDLE_FULL_ACK BIT(0) |
| 2188 | #define A6XX_VBIF_XIN_HALT_CTRL1_ACKS (BIT(0) | BIT(1) | BIT(2) | BIT(3)) |
| 2189 | |
| 2190 | static void a6xx_isense_disable(struct kgsl_device *device) |
| 2191 | { |
| 2192 | unsigned int val; |
| 2193 | const struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 2194 | |
Oleg Perelet | c2ab7f7 | 2017-06-22 16:45:57 -0700 | [diff] [blame] | 2195 | if (!ADRENO_FEATURE(adreno_dev, ADRENO_LM) || |
| 2196 | !test_bit(ADRENO_LM_CTRL, &adreno_dev->pwrctrl_flag)) |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 2197 | return; |
| 2198 | |
| 2199 | kgsl_gmu_regread(device, A6XX_GPU_CS_ENABLE_REG, &val); |
| 2200 | if (val) { |
| 2201 | kgsl_gmu_regwrite(device, A6XX_GPU_CS_ENABLE_REG, 0); |
| 2202 | kgsl_gmu_regwrite(device, A6XX_GMU_ISENSE_CTRL, 0); |
| 2203 | } |
| 2204 | } |
| 2205 | |
| 2206 | static int a6xx_llm_glm_handshake(struct kgsl_device *device) |
| 2207 | { |
| 2208 | unsigned int val; |
| 2209 | const struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 2210 | struct gmu_device *gmu = &device->gmu; |
| 2211 | |
Oleg Perelet | c2ab7f7 | 2017-06-22 16:45:57 -0700 | [diff] [blame] | 2212 | if (!ADRENO_FEATURE(adreno_dev, ADRENO_LM) || |
| 2213 | !test_bit(ADRENO_LM_CTRL, &adreno_dev->pwrctrl_flag)) |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 2214 | return 0; |
| 2215 | |
| 2216 | kgsl_gmu_regread(device, A6XX_GMU_LLM_GLM_SLEEP_CTRL, &val); |
| 2217 | if (!(val & A6XX_STATE_OF_CHILD)) { |
| 2218 | kgsl_gmu_regrmw(device, A6XX_GMU_LLM_GLM_SLEEP_CTRL, 0, BIT(4)); |
| 2219 | kgsl_gmu_regrmw(device, A6XX_GMU_LLM_GLM_SLEEP_CTRL, 0, |
| 2220 | A6XX_IDLE_FULL_LLM); |
| 2221 | if (timed_poll_check(device, A6XX_GMU_LLM_GLM_SLEEP_STATUS, |
| 2222 | A6XX_IDLE_FULL_ACK, GPU_RESET_TIMEOUT, |
| 2223 | A6XX_IDLE_FULL_ACK)) { |
| 2224 | dev_err(&gmu->pdev->dev, "LLM-GLM handshake failed\n"); |
| 2225 | return -EINVAL; |
| 2226 | } |
| 2227 | } |
| 2228 | |
| 2229 | return 0; |
| 2230 | } |
| 2231 | |
Oleg Perelet | c2ab7f7 | 2017-06-22 16:45:57 -0700 | [diff] [blame] | 2232 | |
| 2233 | static void a6xx_count_throttles(struct adreno_device *adreno_dev, |
| 2234 | uint64_t adj) |
| 2235 | { |
| 2236 | if (!ADRENO_FEATURE(adreno_dev, ADRENO_LM) || |
| 2237 | !test_bit(ADRENO_LM_CTRL, &adreno_dev->pwrctrl_flag)) |
| 2238 | return; |
| 2239 | |
| 2240 | kgsl_gmu_regread(KGSL_DEVICE(adreno_dev), |
| 2241 | adreno_dev->lm_threshold_count, |
| 2242 | &adreno_dev->lm_threshold_cross); |
| 2243 | } |
| 2244 | |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 2245 | static int a6xx_complete_rpmh_votes(struct kgsl_device *device) |
| 2246 | { |
| 2247 | int ret = 0; |
| 2248 | |
| 2249 | if (!kgsl_gmu_isenabled(device)) |
| 2250 | return ret; |
| 2251 | |
| 2252 | ret |= timed_poll_check(device, A6XX_RSCC_TCS0_DRV0_STATUS, BIT(0), |
| 2253 | GPU_RESET_TIMEOUT, BIT(0)); |
| 2254 | ret |= timed_poll_check(device, A6XX_RSCC_TCS1_DRV0_STATUS, BIT(0), |
| 2255 | GPU_RESET_TIMEOUT, BIT(0)); |
| 2256 | ret |= timed_poll_check(device, A6XX_RSCC_TCS2_DRV0_STATUS, BIT(0), |
| 2257 | GPU_RESET_TIMEOUT, BIT(0)); |
| 2258 | ret |= timed_poll_check(device, A6XX_RSCC_TCS3_DRV0_STATUS, BIT(0), |
| 2259 | GPU_RESET_TIMEOUT, BIT(0)); |
| 2260 | |
| 2261 | return ret; |
| 2262 | } |
| 2263 | |
| 2264 | static int a6xx_gmu_suspend(struct kgsl_device *device) |
| 2265 | { |
| 2266 | /* Max GX clients on A6xx is 2: GMU and KMD */ |
| 2267 | int ret = 0, max_client_num = 2; |
| 2268 | struct gmu_device *gmu = &device->gmu; |
| 2269 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 2270 | |
| 2271 | /* do it only if LM feature is enabled */ |
| 2272 | /* Disable ISENSE if it's on */ |
| 2273 | a6xx_isense_disable(device); |
| 2274 | |
| 2275 | /* LLM-GLM handshake sequence */ |
| 2276 | a6xx_llm_glm_handshake(device); |
| 2277 | |
| 2278 | /* If SPTP_RAC is on, turn off SPTP_RAC HS */ |
| 2279 | a6xx_sptprac_disable(adreno_dev); |
| 2280 | |
George Shen | f135a97 | 2017-08-24 16:59:42 -0700 | [diff] [blame] | 2281 | /* Disconnect GPU from BUS is not needed if CX GDSC goes off later */ |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 2282 | |
| 2283 | /* Check no outstanding RPMh voting */ |
| 2284 | a6xx_complete_rpmh_votes(device); |
| 2285 | |
Kyle Piefer | 68178ef | 2017-06-19 16:46:13 -0700 | [diff] [blame] | 2286 | if (gmu->gx_gdsc) { |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 2287 | if (regulator_is_enabled(gmu->gx_gdsc)) { |
| 2288 | /* Switch gx gdsc control from GMU to CPU |
| 2289 | * force non-zero reference count in clk driver |
| 2290 | * so next disable call will turn |
| 2291 | * off the GDSC |
| 2292 | */ |
| 2293 | ret = regulator_enable(gmu->gx_gdsc); |
| 2294 | if (ret) |
| 2295 | dev_err(&gmu->pdev->dev, |
| 2296 | "suspend fail: gx enable\n"); |
| 2297 | |
| 2298 | while ((max_client_num)) { |
| 2299 | ret = regulator_disable(gmu->gx_gdsc); |
| 2300 | if (!regulator_is_enabled(gmu->gx_gdsc)) |
| 2301 | break; |
| 2302 | max_client_num -= 1; |
| 2303 | } |
| 2304 | |
| 2305 | if (!max_client_num) |
| 2306 | dev_err(&gmu->pdev->dev, |
| 2307 | "suspend fail: cannot disable gx\n"); |
| 2308 | } |
| 2309 | } |
| 2310 | |
| 2311 | return ret; |
| 2312 | } |
| 2313 | |
| 2314 | /* |
| 2315 | * a6xx_rpmh_gpu_pwrctrl() - GPU power control via RPMh/GMU interface |
| 2316 | * @adreno_dev: Pointer to adreno device |
| 2317 | * @mode: requested power mode |
| 2318 | * @arg1: first argument for mode control |
| 2319 | * @arg2: second argument for mode control |
| 2320 | */ |
| 2321 | static int a6xx_rpmh_gpu_pwrctrl(struct adreno_device *adreno_dev, |
| 2322 | unsigned int mode, unsigned int arg1, unsigned int arg2) |
| 2323 | { |
| 2324 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2325 | struct gmu_device *gmu = &device->gmu; |
| 2326 | int ret; |
| 2327 | |
| 2328 | switch (mode) { |
| 2329 | case GMU_FW_START: |
| 2330 | ret = a6xx_gmu_fw_start(device, arg1); |
| 2331 | break; |
| 2332 | case GMU_SUSPEND: |
| 2333 | ret = a6xx_gmu_suspend(device); |
| 2334 | break; |
| 2335 | case GMU_FW_STOP: |
George Shen | a458dd9 | 2018-01-03 14:20:34 -0800 | [diff] [blame] | 2336 | if (ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_HFI_USE_REG)) |
| 2337 | a6xx_oob_clear(adreno_dev, |
| 2338 | OOB_BOOT_SLUMBER_CLEAR_MASK); |
Kyle Piefer | e923b7a | 2017-03-28 17:31:48 -0700 | [diff] [blame] | 2339 | ret = a6xx_rpmh_power_off_gpu(device); |
| 2340 | break; |
| 2341 | case GMU_DCVS_NOHFI: |
| 2342 | ret = a6xx_gmu_dcvs_nohfi(device, arg1, arg2); |
| 2343 | break; |
| 2344 | case GMU_NOTIFY_SLUMBER: |
| 2345 | ret = a6xx_notify_slumber(device); |
| 2346 | break; |
| 2347 | default: |
| 2348 | dev_err(&gmu->pdev->dev, |
| 2349 | "unsupported GMU power ctrl mode:%d\n", mode); |
| 2350 | ret = -EINVAL; |
| 2351 | break; |
| 2352 | } |
| 2353 | |
| 2354 | return ret; |
| 2355 | } |
| 2356 | |
Shrenuj Bansal | d0fe746 | 2017-05-08 16:11:19 -0700 | [diff] [blame] | 2357 | /** |
| 2358 | * a6xx_reset() - Helper function to reset the GPU |
| 2359 | * @device: Pointer to the KGSL device structure for the GPU |
| 2360 | * @fault: Type of fault. Needed to skip soft reset for MMU fault |
| 2361 | * |
| 2362 | * Try to reset the GPU to recover from a fault. First, try to do a low latency |
| 2363 | * soft reset. If the soft reset fails for some reason, then bring out the big |
| 2364 | * guns and toggle the footswitch. |
| 2365 | */ |
| 2366 | static int a6xx_reset(struct kgsl_device *device, int fault) |
| 2367 | { |
| 2368 | struct adreno_device *adreno_dev = ADRENO_DEVICE(device); |
| 2369 | int ret = -EINVAL; |
| 2370 | int i = 0; |
| 2371 | |
| 2372 | /* Use the regular reset sequence for No GMU */ |
| 2373 | if (!kgsl_gmu_isenabled(device)) |
| 2374 | return adreno_reset(device, fault); |
| 2375 | |
| 2376 | /* Transition from ACTIVE to RESET state */ |
| 2377 | kgsl_pwrctrl_change_state(device, KGSL_STATE_RESET); |
| 2378 | |
| 2379 | /* Try soft reset first */ |
| 2380 | if (!(fault & ADRENO_IOMMU_PAGE_FAULT)) { |
| 2381 | int acked; |
| 2382 | |
| 2383 | /* NMI */ |
| 2384 | kgsl_gmu_regwrite(device, A6XX_GMU_NMI_CONTROL_STATUS, 0); |
| 2385 | kgsl_gmu_regwrite(device, A6XX_GMU_CM3_CFG, (1 << 9)); |
| 2386 | |
| 2387 | for (i = 0; i < 10; i++) { |
| 2388 | kgsl_gmu_regread(device, |
| 2389 | A6XX_GMU_NMI_CONTROL_STATUS, &acked); |
| 2390 | |
| 2391 | /* NMI FW ACK recevied */ |
| 2392 | if (acked == 0x1) |
| 2393 | break; |
| 2394 | |
| 2395 | udelay(100); |
| 2396 | } |
| 2397 | |
Rajesh Kemisetti | d1ca954 | 2017-10-18 15:35:41 +0530 | [diff] [blame] | 2398 | if (acked) { |
| 2399 | /* Make sure VBIF/GBIF is cleared before resetting */ |
| 2400 | ret = adreno_vbif_clear_pending_transactions(device); |
| 2401 | |
| 2402 | if (ret == 0) |
| 2403 | ret = adreno_soft_reset(device); |
| 2404 | } |
| 2405 | |
Shrenuj Bansal | d0fe746 | 2017-05-08 16:11:19 -0700 | [diff] [blame] | 2406 | if (ret) |
| 2407 | KGSL_DEV_ERR_ONCE(device, "Device soft reset failed\n"); |
| 2408 | } |
| 2409 | if (ret) { |
| 2410 | /* If soft reset failed/skipped, then pull the power */ |
| 2411 | set_bit(ADRENO_DEVICE_HARD_RESET, &adreno_dev->priv); |
| 2412 | /* since device is officially off now clear start bit */ |
| 2413 | clear_bit(ADRENO_DEVICE_STARTED, &adreno_dev->priv); |
| 2414 | |
| 2415 | /* Keep trying to start the device until it works */ |
| 2416 | for (i = 0; i < NUM_TIMES_RESET_RETRY; i++) { |
| 2417 | ret = adreno_start(device, 0); |
| 2418 | if (!ret) |
| 2419 | break; |
| 2420 | |
| 2421 | msleep(20); |
| 2422 | } |
| 2423 | } |
| 2424 | |
| 2425 | clear_bit(ADRENO_DEVICE_HARD_RESET, &adreno_dev->priv); |
| 2426 | |
| 2427 | if (ret) |
| 2428 | return ret; |
| 2429 | |
| 2430 | if (i != 0) |
| 2431 | KGSL_DRV_WARN(device, "Device hard reset tried %d tries\n", i); |
| 2432 | |
| 2433 | /* |
| 2434 | * If active_cnt is non-zero then the system was active before |
| 2435 | * going into a reset - put it back in that state |
| 2436 | */ |
| 2437 | |
| 2438 | if (atomic_read(&device->active_cnt)) |
| 2439 | kgsl_pwrctrl_change_state(device, KGSL_STATE_ACTIVE); |
| 2440 | else |
| 2441 | kgsl_pwrctrl_change_state(device, KGSL_STATE_NAP); |
| 2442 | |
| 2443 | return ret; |
| 2444 | } |
| 2445 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2446 | static void a6xx_cp_hw_err_callback(struct adreno_device *adreno_dev, int bit) |
| 2447 | { |
| 2448 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2449 | unsigned int status1, status2; |
| 2450 | |
| 2451 | kgsl_regread(device, A6XX_CP_INTERRUPT_STATUS, &status1); |
| 2452 | |
Shrenuj Bansal | a602c02 | 2017-03-08 10:40:34 -0800 | [diff] [blame] | 2453 | if (status1 & BIT(A6XX_CP_OPCODE_ERROR)) { |
| 2454 | unsigned int opcode; |
| 2455 | |
| 2456 | kgsl_regwrite(device, A6XX_CP_SQE_STAT_ADDR, 1); |
| 2457 | kgsl_regread(device, A6XX_CP_SQE_STAT_DATA, &opcode); |
| 2458 | KGSL_DRV_CRIT_RATELIMIT(device, |
Kyle Piefer | 2ce0616 | 2017-03-15 11:29:08 -0700 | [diff] [blame] | 2459 | "CP opcode error interrupt | opcode=0x%8.8x\n", |
| 2460 | opcode); |
Shrenuj Bansal | a602c02 | 2017-03-08 10:40:34 -0800 | [diff] [blame] | 2461 | } |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2462 | if (status1 & BIT(A6XX_CP_UCODE_ERROR)) |
| 2463 | KGSL_DRV_CRIT_RATELIMIT(device, "CP ucode error interrupt\n"); |
| 2464 | if (status1 & BIT(A6XX_CP_HW_FAULT_ERROR)) { |
| 2465 | kgsl_regread(device, A6XX_CP_HW_FAULT, &status2); |
| 2466 | KGSL_DRV_CRIT_RATELIMIT(device, |
| 2467 | "CP | Ringbuffer HW fault | status=%x\n", |
| 2468 | status2); |
| 2469 | } |
| 2470 | if (status1 & BIT(A6XX_CP_REGISTER_PROTECTION_ERROR)) { |
| 2471 | kgsl_regread(device, A6XX_CP_PROTECT_STATUS, &status2); |
| 2472 | KGSL_DRV_CRIT_RATELIMIT(device, |
| 2473 | "CP | Protected mode error | %s | addr=%x | status=%x\n", |
| 2474 | status2 & (1 << 20) ? "READ" : "WRITE", |
Lynus Vaz | dc80734 | 2017-02-20 18:23:25 +0530 | [diff] [blame] | 2475 | status2 & 0x3FFFF, status2); |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2476 | } |
| 2477 | if (status1 & BIT(A6XX_CP_AHB_ERROR)) |
| 2478 | KGSL_DRV_CRIT_RATELIMIT(device, |
| 2479 | "CP AHB error interrupt\n"); |
| 2480 | if (status1 & BIT(A6XX_CP_VSD_PARITY_ERROR)) |
| 2481 | KGSL_DRV_CRIT_RATELIMIT(device, |
| 2482 | "CP VSD decoder parity error\n"); |
| 2483 | if (status1 & BIT(A6XX_CP_ILLEGAL_INSTR_ERROR)) |
| 2484 | KGSL_DRV_CRIT_RATELIMIT(device, |
| 2485 | "CP Illegal instruction error\n"); |
| 2486 | |
| 2487 | } |
| 2488 | |
| 2489 | static void a6xx_err_callback(struct adreno_device *adreno_dev, int bit) |
| 2490 | { |
| 2491 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2492 | |
| 2493 | switch (bit) { |
| 2494 | case A6XX_INT_CP_AHB_ERROR: |
| 2495 | KGSL_DRV_CRIT_RATELIMIT(device, "CP: AHB bus error\n"); |
| 2496 | break; |
| 2497 | case A6XX_INT_ATB_ASYNCFIFO_OVERFLOW: |
| 2498 | KGSL_DRV_CRIT_RATELIMIT(device, "RBBM: ATB ASYNC overflow\n"); |
| 2499 | break; |
| 2500 | case A6XX_INT_RBBM_ATB_BUS_OVERFLOW: |
| 2501 | KGSL_DRV_CRIT_RATELIMIT(device, "RBBM: ATB bus overflow\n"); |
| 2502 | break; |
| 2503 | case A6XX_INT_UCHE_OOB_ACCESS: |
| 2504 | KGSL_DRV_CRIT_RATELIMIT(device, "UCHE: Out of bounds access\n"); |
| 2505 | break; |
| 2506 | case A6XX_INT_UCHE_TRAP_INTR: |
| 2507 | KGSL_DRV_CRIT_RATELIMIT(device, "UCHE: Trap interrupt\n"); |
| 2508 | break; |
| 2509 | default: |
| 2510 | KGSL_DRV_CRIT_RATELIMIT(device, "Unknown interrupt %d\n", bit); |
| 2511 | } |
| 2512 | } |
| 2513 | |
Sushmita Susheelendra | 7f66cf7 | 2016-09-12 11:04:43 -0600 | [diff] [blame] | 2514 | /* |
| 2515 | * a6xx_llc_configure_gpu_scid() - Program the sub-cache ID for all GPU blocks |
| 2516 | * @adreno_dev: The adreno device pointer |
| 2517 | */ |
| 2518 | static void a6xx_llc_configure_gpu_scid(struct adreno_device *adreno_dev) |
| 2519 | { |
| 2520 | uint32_t gpu_scid; |
| 2521 | uint32_t gpu_cntl1_val = 0; |
| 2522 | int i; |
Sushmita Susheelendra | 7f66cf7 | 2016-09-12 11:04:43 -0600 | [diff] [blame] | 2523 | |
| 2524 | gpu_scid = adreno_llc_get_scid(adreno_dev->gpu_llc_slice); |
| 2525 | for (i = 0; i < A6XX_LLC_NUM_GPU_SCIDS; i++) |
| 2526 | gpu_cntl1_val = (gpu_cntl1_val << A6XX_GPU_LLC_SCID_NUM_BITS) |
| 2527 | | gpu_scid; |
| 2528 | |
Lynus Vaz | 0925b4a | 2018-10-03 12:55:21 +0530 | [diff] [blame] | 2529 | adreno_cx_misc_regrmw(adreno_dev, |
| 2530 | A6XX_GPU_CX_MISC_SYSTEM_CACHE_CNTL_1, |
Sushmita Susheelendra | 7f66cf7 | 2016-09-12 11:04:43 -0600 | [diff] [blame] | 2531 | A6XX_GPU_LLC_SCID_MASK, gpu_cntl1_val); |
Sushmita Susheelendra | 7f66cf7 | 2016-09-12 11:04:43 -0600 | [diff] [blame] | 2532 | } |
| 2533 | |
| 2534 | /* |
Sushmita Susheelendra | 906564d | 2017-01-10 15:53:55 -0700 | [diff] [blame] | 2535 | * a6xx_llc_configure_gpuhtw_scid() - Program the SCID for GPU pagetables |
| 2536 | * @adreno_dev: The adreno device pointer |
| 2537 | */ |
| 2538 | static void a6xx_llc_configure_gpuhtw_scid(struct adreno_device *adreno_dev) |
| 2539 | { |
| 2540 | uint32_t gpuhtw_scid; |
Sushmita Susheelendra | 906564d | 2017-01-10 15:53:55 -0700 | [diff] [blame] | 2541 | |
| 2542 | gpuhtw_scid = adreno_llc_get_scid(adreno_dev->gpuhtw_llc_slice); |
| 2543 | |
Lynus Vaz | 0925b4a | 2018-10-03 12:55:21 +0530 | [diff] [blame] | 2544 | adreno_cx_misc_regrmw(adreno_dev, |
| 2545 | A6XX_GPU_CX_MISC_SYSTEM_CACHE_CNTL_1, |
Sushmita Susheelendra | 906564d | 2017-01-10 15:53:55 -0700 | [diff] [blame] | 2546 | A6XX_GPUHTW_LLC_SCID_MASK, |
| 2547 | gpuhtw_scid << A6XX_GPUHTW_LLC_SCID_SHIFT); |
Sushmita Susheelendra | 906564d | 2017-01-10 15:53:55 -0700 | [diff] [blame] | 2548 | } |
| 2549 | |
| 2550 | /* |
Sushmita Susheelendra | 7f66cf7 | 2016-09-12 11:04:43 -0600 | [diff] [blame] | 2551 | * a6xx_llc_enable_overrides() - Override the page attributes |
| 2552 | * @adreno_dev: The adreno device pointer |
| 2553 | */ |
| 2554 | static void a6xx_llc_enable_overrides(struct adreno_device *adreno_dev) |
| 2555 | { |
Sushmita Susheelendra | 7f66cf7 | 2016-09-12 11:04:43 -0600 | [diff] [blame] | 2556 | /* |
| 2557 | * 0x3: readnoallocoverrideen=0 |
| 2558 | * read-no-alloc=0 - Allocate lines on read miss |
| 2559 | * writenoallocoverrideen=1 |
| 2560 | * write-no-alloc=1 - Do not allocates lines on write miss |
| 2561 | */ |
Lynus Vaz | 0925b4a | 2018-10-03 12:55:21 +0530 | [diff] [blame] | 2562 | adreno_cx_misc_regwrite(adreno_dev, |
| 2563 | A6XX_GPU_CX_MISC_SYSTEM_CACHE_CNTL_0, 0x3); |
Sushmita Susheelendra | 7f66cf7 | 2016-09-12 11:04:43 -0600 | [diff] [blame] | 2564 | } |
| 2565 | |
Lynus Vaz | 1fde74d | 2017-03-20 18:02:47 +0530 | [diff] [blame] | 2566 | static const char *fault_block[8] = { |
| 2567 | [0] = "CP", |
| 2568 | [1] = "UCHE", |
| 2569 | [2] = "VFD", |
| 2570 | [3] = "UCHE", |
| 2571 | [4] = "CCU", |
| 2572 | [5] = "unknown", |
| 2573 | [6] = "CDP Prefetch", |
| 2574 | [7] = "GPMU", |
| 2575 | }; |
| 2576 | |
| 2577 | static const char *uche_client[8] = { |
| 2578 | [0] = "VFD", |
| 2579 | [1] = "SP", |
| 2580 | [2] = "VSC", |
| 2581 | [3] = "VPC", |
| 2582 | [4] = "HLSQ", |
| 2583 | [5] = "PC", |
| 2584 | [6] = "LRZ", |
| 2585 | [7] = "unknown", |
| 2586 | }; |
| 2587 | |
| 2588 | static const char *a6xx_iommu_fault_block(struct adreno_device *adreno_dev, |
| 2589 | unsigned int fsynr1) |
| 2590 | { |
| 2591 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2592 | unsigned int client_id; |
| 2593 | unsigned int uche_client_id; |
| 2594 | |
| 2595 | client_id = fsynr1 & 0xff; |
| 2596 | |
| 2597 | if (client_id >= ARRAY_SIZE(fault_block)) |
| 2598 | return "unknown"; |
| 2599 | else if (client_id != 3) |
| 2600 | return fault_block[client_id]; |
| 2601 | |
Harshdeep Dhatt | 3f074a9 | 2017-05-01 12:59:01 -0600 | [diff] [blame] | 2602 | mutex_lock(&device->mutex); |
Lynus Vaz | 1fde74d | 2017-03-20 18:02:47 +0530 | [diff] [blame] | 2603 | kgsl_regread(device, A6XX_UCHE_CLIENT_PF, &uche_client_id); |
Harshdeep Dhatt | 3f074a9 | 2017-05-01 12:59:01 -0600 | [diff] [blame] | 2604 | mutex_unlock(&device->mutex); |
| 2605 | |
Lynus Vaz | 1fde74d | 2017-03-20 18:02:47 +0530 | [diff] [blame] | 2606 | return uche_client[uche_client_id & A6XX_UCHE_CLIENT_PF_CLIENT_ID_MASK]; |
| 2607 | } |
| 2608 | |
Harshdeep Dhatt | d388e52 | 2017-07-06 14:30:06 -0600 | [diff] [blame] | 2609 | static void a6xx_cp_callback(struct adreno_device *adreno_dev, int bit) |
| 2610 | { |
| 2611 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2612 | |
Harshdeep Dhatt | 7ee8a86 | 2017-11-20 17:51:54 -0700 | [diff] [blame] | 2613 | if (adreno_is_preemption_enabled(adreno_dev)) |
Harshdeep Dhatt | 12a642c | 2017-08-17 12:19:26 -0600 | [diff] [blame] | 2614 | a6xx_preemption_trigger(adreno_dev); |
| 2615 | |
Harshdeep Dhatt | d388e52 | 2017-07-06 14:30:06 -0600 | [diff] [blame] | 2616 | adreno_dispatcher_schedule(device); |
| 2617 | } |
| 2618 | |
Carter Cooper | c8d4864 | 2017-08-18 10:39:57 -0600 | [diff] [blame] | 2619 | /* |
| 2620 | * a6xx_gpc_err_int_callback() - Isr for GPC error interrupts |
| 2621 | * @adreno_dev: Pointer to device |
| 2622 | * @bit: Interrupt bit |
| 2623 | */ |
| 2624 | static void a6xx_gpc_err_int_callback(struct adreno_device *adreno_dev, int bit) |
| 2625 | { |
| 2626 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 2627 | |
| 2628 | /* |
| 2629 | * GPC error is typically the result of mistake SW programming. |
| 2630 | * Force GPU fault for this interrupt so that we can debug it |
| 2631 | * with help of register dump. |
| 2632 | */ |
| 2633 | |
| 2634 | KGSL_DRV_CRIT_RATELIMIT(device, "RBBM: GPC error\n"); |
| 2635 | adreno_irqctrl(adreno_dev, 0); |
| 2636 | |
| 2637 | /* Trigger a fault in the dispatcher - this will effect a restart */ |
| 2638 | adreno_set_gpu_fault(adreno_dev, ADRENO_SOFT_FAULT); |
| 2639 | adreno_dispatcher_schedule(device); |
| 2640 | } |
| 2641 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2642 | #define A6XX_INT_MASK \ |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 2643 | ((1 << A6XX_INT_CP_AHB_ERROR) | \ |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2644 | (1 << A6XX_INT_ATB_ASYNCFIFO_OVERFLOW) | \ |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 2645 | (1 << A6XX_INT_RBBM_GPC_ERROR) | \ |
| 2646 | (1 << A6XX_INT_CP_SW) | \ |
| 2647 | (1 << A6XX_INT_CP_HW_ERROR) | \ |
| 2648 | (1 << A6XX_INT_CP_IB2) | \ |
| 2649 | (1 << A6XX_INT_CP_IB1) | \ |
| 2650 | (1 << A6XX_INT_CP_RB) | \ |
| 2651 | (1 << A6XX_INT_CP_CACHE_FLUSH_TS) | \ |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2652 | (1 << A6XX_INT_RBBM_ATB_BUS_OVERFLOW) | \ |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 2653 | (1 << A6XX_INT_RBBM_HANG_DETECT) | \ |
| 2654 | (1 << A6XX_INT_UCHE_OOB_ACCESS) | \ |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2655 | (1 << A6XX_INT_UCHE_TRAP_INTR)) |
| 2656 | |
| 2657 | static struct adreno_irq_funcs a6xx_irq_funcs[32] = { |
| 2658 | ADRENO_IRQ_CALLBACK(NULL), /* 0 - RBBM_GPU_IDLE */ |
| 2659 | ADRENO_IRQ_CALLBACK(a6xx_err_callback), /* 1 - RBBM_AHB_ERROR */ |
| 2660 | ADRENO_IRQ_CALLBACK(NULL), /* 2 - UNUSED */ |
| 2661 | ADRENO_IRQ_CALLBACK(NULL), /* 3 - UNUSED */ |
| 2662 | ADRENO_IRQ_CALLBACK(NULL), /* 4 - UNUSED */ |
| 2663 | ADRENO_IRQ_CALLBACK(NULL), /* 5 - UNUSED */ |
| 2664 | /* 6 - RBBM_ATB_ASYNC_OVERFLOW */ |
| 2665 | ADRENO_IRQ_CALLBACK(a6xx_err_callback), |
Carter Cooper | c8d4864 | 2017-08-18 10:39:57 -0600 | [diff] [blame] | 2666 | ADRENO_IRQ_CALLBACK(a6xx_gpc_err_int_callback), /* 7 - GPC_ERR */ |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 2667 | ADRENO_IRQ_CALLBACK(a6xx_preemption_callback),/* 8 - CP_SW */ |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2668 | ADRENO_IRQ_CALLBACK(a6xx_cp_hw_err_callback), /* 9 - CP_HW_ERROR */ |
| 2669 | ADRENO_IRQ_CALLBACK(NULL), /* 10 - CP_CCU_FLUSH_DEPTH_TS */ |
| 2670 | ADRENO_IRQ_CALLBACK(NULL), /* 11 - CP_CCU_FLUSH_COLOR_TS */ |
| 2671 | ADRENO_IRQ_CALLBACK(NULL), /* 12 - CP_CCU_RESOLVE_TS */ |
| 2672 | ADRENO_IRQ_CALLBACK(adreno_cp_callback), /* 13 - CP_IB2_INT */ |
| 2673 | ADRENO_IRQ_CALLBACK(adreno_cp_callback), /* 14 - CP_IB1_INT */ |
| 2674 | ADRENO_IRQ_CALLBACK(adreno_cp_callback), /* 15 - CP_RB_INT */ |
| 2675 | ADRENO_IRQ_CALLBACK(NULL), /* 16 - UNUSED */ |
| 2676 | ADRENO_IRQ_CALLBACK(NULL), /* 17 - CP_RB_DONE_TS */ |
| 2677 | ADRENO_IRQ_CALLBACK(NULL), /* 18 - CP_WT_DONE_TS */ |
| 2678 | ADRENO_IRQ_CALLBACK(NULL), /* 19 - UNUSED */ |
Harshdeep Dhatt | d388e52 | 2017-07-06 14:30:06 -0600 | [diff] [blame] | 2679 | ADRENO_IRQ_CALLBACK(a6xx_cp_callback), /* 20 - CP_CACHE_FLUSH_TS */ |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 2680 | ADRENO_IRQ_CALLBACK(NULL), /* 21 - UNUSED */ |
| 2681 | ADRENO_IRQ_CALLBACK(a6xx_err_callback), /* 22 - RBBM_ATB_BUS_OVERFLOW */ |
| 2682 | /* 23 - MISC_HANG_DETECT */ |
| 2683 | ADRENO_IRQ_CALLBACK(adreno_hang_int_callback), |
| 2684 | ADRENO_IRQ_CALLBACK(a6xx_err_callback), /* 24 - UCHE_OOB_ACCESS */ |
| 2685 | ADRENO_IRQ_CALLBACK(a6xx_err_callback), /* 25 - UCHE_TRAP_INTR */ |
| 2686 | ADRENO_IRQ_CALLBACK(NULL), /* 26 - DEBBUS_INTR_0 */ |
| 2687 | ADRENO_IRQ_CALLBACK(NULL), /* 27 - DEBBUS_INTR_1 */ |
| 2688 | ADRENO_IRQ_CALLBACK(NULL), /* 28 - UNUSED */ |
| 2689 | ADRENO_IRQ_CALLBACK(NULL), /* 29 - UNUSED */ |
| 2690 | ADRENO_IRQ_CALLBACK(NULL), /* 30 - ISDB_CPU_IRQ */ |
| 2691 | ADRENO_IRQ_CALLBACK(NULL), /* 31 - ISDB_UNDER_DEBUG */ |
| 2692 | }; |
| 2693 | |
| 2694 | static struct adreno_irq a6xx_irq = { |
| 2695 | .funcs = a6xx_irq_funcs, |
| 2696 | .mask = A6XX_INT_MASK, |
| 2697 | }; |
| 2698 | |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 2699 | static struct adreno_snapshot_sizes a6xx_snap_sizes = { |
| 2700 | .cp_pfp = 0x33, |
| 2701 | .roq = 0x400, |
| 2702 | }; |
| 2703 | |
| 2704 | static struct adreno_snapshot_data a6xx_snapshot_data = { |
| 2705 | .sect_sizes = &a6xx_snap_sizes, |
| 2706 | }; |
| 2707 | |
Lokesh Batra | a8300e0 | 2017-05-25 11:17:40 -0700 | [diff] [blame] | 2708 | static struct adreno_coresight_register a6xx_coresight_regs[] = { |
| 2709 | { A6XX_DBGC_CFG_DBGBUS_SEL_A }, |
| 2710 | { A6XX_DBGC_CFG_DBGBUS_SEL_B }, |
| 2711 | { A6XX_DBGC_CFG_DBGBUS_SEL_C }, |
| 2712 | { A6XX_DBGC_CFG_DBGBUS_SEL_D }, |
| 2713 | { A6XX_DBGC_CFG_DBGBUS_CNTLT }, |
| 2714 | { A6XX_DBGC_CFG_DBGBUS_CNTLM }, |
| 2715 | { A6XX_DBGC_CFG_DBGBUS_OPL }, |
| 2716 | { A6XX_DBGC_CFG_DBGBUS_OPE }, |
| 2717 | { A6XX_DBGC_CFG_DBGBUS_IVTL_0 }, |
| 2718 | { A6XX_DBGC_CFG_DBGBUS_IVTL_1 }, |
| 2719 | { A6XX_DBGC_CFG_DBGBUS_IVTL_2 }, |
| 2720 | { A6XX_DBGC_CFG_DBGBUS_IVTL_3 }, |
| 2721 | { A6XX_DBGC_CFG_DBGBUS_MASKL_0 }, |
| 2722 | { A6XX_DBGC_CFG_DBGBUS_MASKL_1 }, |
| 2723 | { A6XX_DBGC_CFG_DBGBUS_MASKL_2 }, |
| 2724 | { A6XX_DBGC_CFG_DBGBUS_MASKL_3 }, |
| 2725 | { A6XX_DBGC_CFG_DBGBUS_BYTEL_0 }, |
| 2726 | { A6XX_DBGC_CFG_DBGBUS_BYTEL_1 }, |
| 2727 | { A6XX_DBGC_CFG_DBGBUS_IVTE_0 }, |
| 2728 | { A6XX_DBGC_CFG_DBGBUS_IVTE_1 }, |
| 2729 | { A6XX_DBGC_CFG_DBGBUS_IVTE_2 }, |
| 2730 | { A6XX_DBGC_CFG_DBGBUS_IVTE_3 }, |
| 2731 | { A6XX_DBGC_CFG_DBGBUS_MASKE_0 }, |
| 2732 | { A6XX_DBGC_CFG_DBGBUS_MASKE_1 }, |
| 2733 | { A6XX_DBGC_CFG_DBGBUS_MASKE_2 }, |
| 2734 | { A6XX_DBGC_CFG_DBGBUS_MASKE_3 }, |
| 2735 | { A6XX_DBGC_CFG_DBGBUS_NIBBLEE }, |
| 2736 | { A6XX_DBGC_CFG_DBGBUS_PTRC0 }, |
| 2737 | { A6XX_DBGC_CFG_DBGBUS_PTRC1 }, |
| 2738 | { A6XX_DBGC_CFG_DBGBUS_LOADREG }, |
| 2739 | { A6XX_DBGC_CFG_DBGBUS_IDX }, |
| 2740 | { A6XX_DBGC_CFG_DBGBUS_CLRC }, |
| 2741 | { A6XX_DBGC_CFG_DBGBUS_LOADIVT }, |
| 2742 | { A6XX_DBGC_VBIF_DBG_CNTL }, |
| 2743 | { A6XX_DBGC_DBG_LO_HI_GPIO }, |
| 2744 | { A6XX_DBGC_EXT_TRACE_BUS_CNTL }, |
| 2745 | { A6XX_DBGC_READ_AHB_THROUGH_DBG }, |
| 2746 | { A6XX_DBGC_CFG_DBGBUS_TRACE_BUF1 }, |
| 2747 | { A6XX_DBGC_CFG_DBGBUS_TRACE_BUF2 }, |
| 2748 | { A6XX_DBGC_EVT_CFG }, |
| 2749 | { A6XX_DBGC_EVT_INTF_SEL_0 }, |
| 2750 | { A6XX_DBGC_EVT_INTF_SEL_1 }, |
| 2751 | { A6XX_DBGC_PERF_ATB_CFG }, |
| 2752 | { A6XX_DBGC_PERF_ATB_COUNTER_SEL_0 }, |
| 2753 | { A6XX_DBGC_PERF_ATB_COUNTER_SEL_1 }, |
| 2754 | { A6XX_DBGC_PERF_ATB_COUNTER_SEL_2 }, |
| 2755 | { A6XX_DBGC_PERF_ATB_COUNTER_SEL_3 }, |
| 2756 | { A6XX_DBGC_PERF_ATB_TRIG_INTF_SEL_0 }, |
| 2757 | { A6XX_DBGC_PERF_ATB_TRIG_INTF_SEL_1 }, |
| 2758 | { A6XX_DBGC_PERF_ATB_DRAIN_CMD }, |
| 2759 | { A6XX_DBGC_ECO_CNTL }, |
| 2760 | { A6XX_DBGC_AHB_DBG_CNTL }, |
| 2761 | }; |
| 2762 | |
| 2763 | static struct adreno_coresight_register a6xx_coresight_regs_cx[] = { |
| 2764 | { A6XX_CX_DBGC_CFG_DBGBUS_SEL_A }, |
| 2765 | { A6XX_CX_DBGC_CFG_DBGBUS_SEL_B }, |
| 2766 | { A6XX_CX_DBGC_CFG_DBGBUS_SEL_C }, |
| 2767 | { A6XX_CX_DBGC_CFG_DBGBUS_SEL_D }, |
| 2768 | { A6XX_CX_DBGC_CFG_DBGBUS_CNTLT }, |
| 2769 | { A6XX_CX_DBGC_CFG_DBGBUS_CNTLM }, |
| 2770 | { A6XX_CX_DBGC_CFG_DBGBUS_OPL }, |
| 2771 | { A6XX_CX_DBGC_CFG_DBGBUS_OPE }, |
| 2772 | { A6XX_CX_DBGC_CFG_DBGBUS_IVTL_0 }, |
| 2773 | { A6XX_CX_DBGC_CFG_DBGBUS_IVTL_1 }, |
| 2774 | { A6XX_CX_DBGC_CFG_DBGBUS_IVTL_2 }, |
| 2775 | { A6XX_CX_DBGC_CFG_DBGBUS_IVTL_3 }, |
| 2776 | { A6XX_CX_DBGC_CFG_DBGBUS_MASKL_0 }, |
| 2777 | { A6XX_CX_DBGC_CFG_DBGBUS_MASKL_1 }, |
| 2778 | { A6XX_CX_DBGC_CFG_DBGBUS_MASKL_2 }, |
| 2779 | { A6XX_CX_DBGC_CFG_DBGBUS_MASKL_3 }, |
| 2780 | { A6XX_CX_DBGC_CFG_DBGBUS_BYTEL_0 }, |
| 2781 | { A6XX_CX_DBGC_CFG_DBGBUS_BYTEL_1 }, |
| 2782 | { A6XX_CX_DBGC_CFG_DBGBUS_IVTE_0 }, |
| 2783 | { A6XX_CX_DBGC_CFG_DBGBUS_IVTE_1 }, |
| 2784 | { A6XX_CX_DBGC_CFG_DBGBUS_IVTE_2 }, |
| 2785 | { A6XX_CX_DBGC_CFG_DBGBUS_IVTE_3 }, |
| 2786 | { A6XX_CX_DBGC_CFG_DBGBUS_MASKE_0 }, |
| 2787 | { A6XX_CX_DBGC_CFG_DBGBUS_MASKE_1 }, |
| 2788 | { A6XX_CX_DBGC_CFG_DBGBUS_MASKE_2 }, |
| 2789 | { A6XX_CX_DBGC_CFG_DBGBUS_MASKE_3 }, |
| 2790 | { A6XX_CX_DBGC_CFG_DBGBUS_NIBBLEE }, |
| 2791 | { A6XX_CX_DBGC_CFG_DBGBUS_PTRC0 }, |
| 2792 | { A6XX_CX_DBGC_CFG_DBGBUS_PTRC1 }, |
| 2793 | { A6XX_CX_DBGC_CFG_DBGBUS_LOADREG }, |
| 2794 | { A6XX_CX_DBGC_CFG_DBGBUS_IDX }, |
| 2795 | { A6XX_CX_DBGC_CFG_DBGBUS_CLRC }, |
| 2796 | { A6XX_CX_DBGC_CFG_DBGBUS_LOADIVT }, |
| 2797 | { A6XX_CX_DBGC_VBIF_DBG_CNTL }, |
| 2798 | { A6XX_CX_DBGC_DBG_LO_HI_GPIO }, |
| 2799 | { A6XX_CX_DBGC_EXT_TRACE_BUS_CNTL }, |
| 2800 | { A6XX_CX_DBGC_READ_AHB_THROUGH_DBG }, |
| 2801 | { A6XX_CX_DBGC_CFG_DBGBUS_TRACE_BUF1 }, |
| 2802 | { A6XX_CX_DBGC_CFG_DBGBUS_TRACE_BUF2 }, |
| 2803 | { A6XX_CX_DBGC_EVT_CFG }, |
| 2804 | { A6XX_CX_DBGC_EVT_INTF_SEL_0 }, |
| 2805 | { A6XX_CX_DBGC_EVT_INTF_SEL_1 }, |
| 2806 | { A6XX_CX_DBGC_PERF_ATB_CFG }, |
| 2807 | { A6XX_CX_DBGC_PERF_ATB_COUNTER_SEL_0 }, |
| 2808 | { A6XX_CX_DBGC_PERF_ATB_COUNTER_SEL_1 }, |
| 2809 | { A6XX_CX_DBGC_PERF_ATB_COUNTER_SEL_2 }, |
| 2810 | { A6XX_CX_DBGC_PERF_ATB_COUNTER_SEL_3 }, |
| 2811 | { A6XX_CX_DBGC_PERF_ATB_TRIG_INTF_SEL_0 }, |
| 2812 | { A6XX_CX_DBGC_PERF_ATB_TRIG_INTF_SEL_1 }, |
| 2813 | { A6XX_CX_DBGC_PERF_ATB_DRAIN_CMD }, |
| 2814 | { A6XX_CX_DBGC_ECO_CNTL }, |
| 2815 | { A6XX_CX_DBGC_AHB_DBG_CNTL }, |
| 2816 | }; |
| 2817 | |
| 2818 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_sel_a, &a6xx_coresight_regs[0]); |
| 2819 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_sel_b, &a6xx_coresight_regs[1]); |
| 2820 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_sel_c, &a6xx_coresight_regs[2]); |
| 2821 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_sel_d, &a6xx_coresight_regs[3]); |
| 2822 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_cntlt, &a6xx_coresight_regs[4]); |
| 2823 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_cntlm, &a6xx_coresight_regs[5]); |
| 2824 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_opl, &a6xx_coresight_regs[6]); |
| 2825 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ope, &a6xx_coresight_regs[7]); |
| 2826 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ivtl_0, &a6xx_coresight_regs[8]); |
| 2827 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ivtl_1, &a6xx_coresight_regs[9]); |
| 2828 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ivtl_2, &a6xx_coresight_regs[10]); |
| 2829 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ivtl_3, &a6xx_coresight_regs[11]); |
| 2830 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_maskl_0, &a6xx_coresight_regs[12]); |
| 2831 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_maskl_1, &a6xx_coresight_regs[13]); |
| 2832 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_maskl_2, &a6xx_coresight_regs[14]); |
| 2833 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_maskl_3, &a6xx_coresight_regs[15]); |
| 2834 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_bytel_0, &a6xx_coresight_regs[16]); |
| 2835 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_bytel_1, &a6xx_coresight_regs[17]); |
| 2836 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ivte_0, &a6xx_coresight_regs[18]); |
| 2837 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ivte_1, &a6xx_coresight_regs[19]); |
| 2838 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ivte_2, &a6xx_coresight_regs[20]); |
| 2839 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ivte_3, &a6xx_coresight_regs[21]); |
| 2840 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_maske_0, &a6xx_coresight_regs[22]); |
| 2841 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_maske_1, &a6xx_coresight_regs[23]); |
| 2842 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_maske_2, &a6xx_coresight_regs[24]); |
| 2843 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_maske_3, &a6xx_coresight_regs[25]); |
| 2844 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_nibblee, &a6xx_coresight_regs[26]); |
| 2845 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ptrc0, &a6xx_coresight_regs[27]); |
| 2846 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_ptrc1, &a6xx_coresight_regs[28]); |
| 2847 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_loadreg, &a6xx_coresight_regs[29]); |
| 2848 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_idx, &a6xx_coresight_regs[30]); |
| 2849 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_clrc, &a6xx_coresight_regs[31]); |
| 2850 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_loadivt, &a6xx_coresight_regs[32]); |
| 2851 | static ADRENO_CORESIGHT_ATTR(vbif_dbg_cntl, &a6xx_coresight_regs[33]); |
| 2852 | static ADRENO_CORESIGHT_ATTR(dbg_lo_hi_gpio, &a6xx_coresight_regs[34]); |
| 2853 | static ADRENO_CORESIGHT_ATTR(ext_trace_bus_cntl, &a6xx_coresight_regs[35]); |
| 2854 | static ADRENO_CORESIGHT_ATTR(read_ahb_through_dbg, &a6xx_coresight_regs[36]); |
| 2855 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_trace_buf1, &a6xx_coresight_regs[37]); |
| 2856 | static ADRENO_CORESIGHT_ATTR(cfg_dbgbus_trace_buf2, &a6xx_coresight_regs[38]); |
| 2857 | static ADRENO_CORESIGHT_ATTR(evt_cfg, &a6xx_coresight_regs[39]); |
| 2858 | static ADRENO_CORESIGHT_ATTR(evt_intf_sel_0, &a6xx_coresight_regs[40]); |
| 2859 | static ADRENO_CORESIGHT_ATTR(evt_intf_sel_1, &a6xx_coresight_regs[41]); |
| 2860 | static ADRENO_CORESIGHT_ATTR(perf_atb_cfg, &a6xx_coresight_regs[42]); |
| 2861 | static ADRENO_CORESIGHT_ATTR(perf_atb_counter_sel_0, &a6xx_coresight_regs[43]); |
| 2862 | static ADRENO_CORESIGHT_ATTR(perf_atb_counter_sel_1, &a6xx_coresight_regs[44]); |
| 2863 | static ADRENO_CORESIGHT_ATTR(perf_atb_counter_sel_2, &a6xx_coresight_regs[45]); |
| 2864 | static ADRENO_CORESIGHT_ATTR(perf_atb_counter_sel_3, &a6xx_coresight_regs[46]); |
| 2865 | static ADRENO_CORESIGHT_ATTR(perf_atb_trig_intf_sel_0, |
| 2866 | &a6xx_coresight_regs[47]); |
| 2867 | static ADRENO_CORESIGHT_ATTR(perf_atb_trig_intf_sel_1, |
| 2868 | &a6xx_coresight_regs[48]); |
| 2869 | static ADRENO_CORESIGHT_ATTR(perf_atb_drain_cmd, &a6xx_coresight_regs[49]); |
| 2870 | static ADRENO_CORESIGHT_ATTR(eco_cntl, &a6xx_coresight_regs[50]); |
| 2871 | static ADRENO_CORESIGHT_ATTR(ahb_dbg_cntl, &a6xx_coresight_regs[51]); |
| 2872 | |
| 2873 | /*CX debug registers*/ |
| 2874 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_sel_a, |
| 2875 | &a6xx_coresight_regs_cx[0]); |
| 2876 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_sel_b, |
| 2877 | &a6xx_coresight_regs_cx[1]); |
| 2878 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_sel_c, |
| 2879 | &a6xx_coresight_regs_cx[2]); |
| 2880 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_sel_d, |
| 2881 | &a6xx_coresight_regs_cx[3]); |
| 2882 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_cntlt, |
| 2883 | &a6xx_coresight_regs_cx[4]); |
| 2884 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_cntlm, |
| 2885 | &a6xx_coresight_regs_cx[5]); |
| 2886 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_opl, |
| 2887 | &a6xx_coresight_regs_cx[6]); |
| 2888 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ope, |
| 2889 | &a6xx_coresight_regs_cx[7]); |
| 2890 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ivtl_0, |
| 2891 | &a6xx_coresight_regs_cx[8]); |
| 2892 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ivtl_1, |
| 2893 | &a6xx_coresight_regs_cx[9]); |
| 2894 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ivtl_2, |
| 2895 | &a6xx_coresight_regs_cx[10]); |
| 2896 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ivtl_3, |
| 2897 | &a6xx_coresight_regs_cx[11]); |
| 2898 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_maskl_0, |
| 2899 | &a6xx_coresight_regs_cx[12]); |
| 2900 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_maskl_1, |
| 2901 | &a6xx_coresight_regs_cx[13]); |
| 2902 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_maskl_2, |
| 2903 | &a6xx_coresight_regs_cx[14]); |
| 2904 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_maskl_3, |
| 2905 | &a6xx_coresight_regs_cx[15]); |
| 2906 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_bytel_0, |
| 2907 | &a6xx_coresight_regs_cx[16]); |
| 2908 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_bytel_1, |
| 2909 | &a6xx_coresight_regs_cx[17]); |
| 2910 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ivte_0, |
| 2911 | &a6xx_coresight_regs_cx[18]); |
| 2912 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ivte_1, |
| 2913 | &a6xx_coresight_regs_cx[19]); |
| 2914 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ivte_2, |
| 2915 | &a6xx_coresight_regs_cx[20]); |
| 2916 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ivte_3, |
| 2917 | &a6xx_coresight_regs_cx[21]); |
| 2918 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_maske_0, |
| 2919 | &a6xx_coresight_regs_cx[22]); |
| 2920 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_maske_1, |
| 2921 | &a6xx_coresight_regs_cx[23]); |
| 2922 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_maske_2, |
| 2923 | &a6xx_coresight_regs_cx[24]); |
| 2924 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_maske_3, |
| 2925 | &a6xx_coresight_regs_cx[25]); |
| 2926 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_nibblee, |
| 2927 | &a6xx_coresight_regs_cx[26]); |
| 2928 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ptrc0, |
| 2929 | &a6xx_coresight_regs_cx[27]); |
| 2930 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_ptrc1, |
| 2931 | &a6xx_coresight_regs_cx[28]); |
| 2932 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_loadreg, |
| 2933 | &a6xx_coresight_regs_cx[29]); |
| 2934 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_idx, |
| 2935 | &a6xx_coresight_regs_cx[30]); |
| 2936 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_clrc, |
| 2937 | &a6xx_coresight_regs_cx[31]); |
| 2938 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_loadivt, |
| 2939 | &a6xx_coresight_regs_cx[32]); |
| 2940 | static ADRENO_CORESIGHT_ATTR(cx_vbif_dbg_cntl, |
| 2941 | &a6xx_coresight_regs_cx[33]); |
| 2942 | static ADRENO_CORESIGHT_ATTR(cx_dbg_lo_hi_gpio, |
| 2943 | &a6xx_coresight_regs_cx[34]); |
| 2944 | static ADRENO_CORESIGHT_ATTR(cx_ext_trace_bus_cntl, |
| 2945 | &a6xx_coresight_regs_cx[35]); |
| 2946 | static ADRENO_CORESIGHT_ATTR(cx_read_ahb_through_dbg, |
| 2947 | &a6xx_coresight_regs_cx[36]); |
| 2948 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_trace_buf1, |
| 2949 | &a6xx_coresight_regs_cx[37]); |
| 2950 | static ADRENO_CORESIGHT_ATTR(cx_cfg_dbgbus_trace_buf2, |
| 2951 | &a6xx_coresight_regs_cx[38]); |
| 2952 | static ADRENO_CORESIGHT_ATTR(cx_evt_cfg, |
| 2953 | &a6xx_coresight_regs_cx[39]); |
| 2954 | static ADRENO_CORESIGHT_ATTR(cx_evt_intf_sel_0, |
| 2955 | &a6xx_coresight_regs_cx[40]); |
| 2956 | static ADRENO_CORESIGHT_ATTR(cx_evt_intf_sel_1, |
| 2957 | &a6xx_coresight_regs_cx[41]); |
| 2958 | static ADRENO_CORESIGHT_ATTR(cx_perf_atb_cfg, |
| 2959 | &a6xx_coresight_regs_cx[42]); |
| 2960 | static ADRENO_CORESIGHT_ATTR(cx_perf_atb_counter_sel_0, |
| 2961 | &a6xx_coresight_regs_cx[43]); |
| 2962 | static ADRENO_CORESIGHT_ATTR(cx_perf_atb_counter_sel_1, |
| 2963 | &a6xx_coresight_regs_cx[44]); |
| 2964 | static ADRENO_CORESIGHT_ATTR(cx_perf_atb_counter_sel_2, |
| 2965 | &a6xx_coresight_regs_cx[45]); |
| 2966 | static ADRENO_CORESIGHT_ATTR(cx_perf_atb_counter_sel_3, |
| 2967 | &a6xx_coresight_regs_cx[46]); |
| 2968 | static ADRENO_CORESIGHT_ATTR(cx_perf_atb_trig_intf_sel_0, |
| 2969 | &a6xx_coresight_regs_cx[47]); |
| 2970 | static ADRENO_CORESIGHT_ATTR(cx_perf_atb_trig_intf_sel_1, |
| 2971 | &a6xx_coresight_regs_cx[48]); |
| 2972 | static ADRENO_CORESIGHT_ATTR(cx_perf_atb_drain_cmd, |
| 2973 | &a6xx_coresight_regs_cx[49]); |
| 2974 | static ADRENO_CORESIGHT_ATTR(cx_eco_cntl, |
| 2975 | &a6xx_coresight_regs_cx[50]); |
| 2976 | static ADRENO_CORESIGHT_ATTR(cx_ahb_dbg_cntl, |
| 2977 | &a6xx_coresight_regs_cx[51]); |
| 2978 | |
| 2979 | static struct attribute *a6xx_coresight_attrs[] = { |
| 2980 | &coresight_attr_cfg_dbgbus_sel_a.attr.attr, |
| 2981 | &coresight_attr_cfg_dbgbus_sel_b.attr.attr, |
| 2982 | &coresight_attr_cfg_dbgbus_sel_c.attr.attr, |
| 2983 | &coresight_attr_cfg_dbgbus_sel_d.attr.attr, |
| 2984 | &coresight_attr_cfg_dbgbus_cntlt.attr.attr, |
| 2985 | &coresight_attr_cfg_dbgbus_cntlm.attr.attr, |
| 2986 | &coresight_attr_cfg_dbgbus_opl.attr.attr, |
| 2987 | &coresight_attr_cfg_dbgbus_ope.attr.attr, |
| 2988 | &coresight_attr_cfg_dbgbus_ivtl_0.attr.attr, |
| 2989 | &coresight_attr_cfg_dbgbus_ivtl_1.attr.attr, |
| 2990 | &coresight_attr_cfg_dbgbus_ivtl_2.attr.attr, |
| 2991 | &coresight_attr_cfg_dbgbus_ivtl_3.attr.attr, |
| 2992 | &coresight_attr_cfg_dbgbus_maskl_0.attr.attr, |
| 2993 | &coresight_attr_cfg_dbgbus_maskl_1.attr.attr, |
| 2994 | &coresight_attr_cfg_dbgbus_maskl_2.attr.attr, |
| 2995 | &coresight_attr_cfg_dbgbus_maskl_3.attr.attr, |
| 2996 | &coresight_attr_cfg_dbgbus_bytel_0.attr.attr, |
| 2997 | &coresight_attr_cfg_dbgbus_bytel_1.attr.attr, |
| 2998 | &coresight_attr_cfg_dbgbus_ivte_0.attr.attr, |
| 2999 | &coresight_attr_cfg_dbgbus_ivte_1.attr.attr, |
| 3000 | &coresight_attr_cfg_dbgbus_ivte_2.attr.attr, |
| 3001 | &coresight_attr_cfg_dbgbus_ivte_3.attr.attr, |
| 3002 | &coresight_attr_cfg_dbgbus_maske_0.attr.attr, |
| 3003 | &coresight_attr_cfg_dbgbus_maske_1.attr.attr, |
| 3004 | &coresight_attr_cfg_dbgbus_maske_2.attr.attr, |
| 3005 | &coresight_attr_cfg_dbgbus_maske_3.attr.attr, |
| 3006 | &coresight_attr_cfg_dbgbus_nibblee.attr.attr, |
| 3007 | &coresight_attr_cfg_dbgbus_ptrc0.attr.attr, |
| 3008 | &coresight_attr_cfg_dbgbus_ptrc1.attr.attr, |
| 3009 | &coresight_attr_cfg_dbgbus_loadreg.attr.attr, |
| 3010 | &coresight_attr_cfg_dbgbus_idx.attr.attr, |
| 3011 | &coresight_attr_cfg_dbgbus_clrc.attr.attr, |
| 3012 | &coresight_attr_cfg_dbgbus_loadivt.attr.attr, |
| 3013 | &coresight_attr_vbif_dbg_cntl.attr.attr, |
| 3014 | &coresight_attr_dbg_lo_hi_gpio.attr.attr, |
| 3015 | &coresight_attr_ext_trace_bus_cntl.attr.attr, |
| 3016 | &coresight_attr_read_ahb_through_dbg.attr.attr, |
| 3017 | &coresight_attr_cfg_dbgbus_trace_buf1.attr.attr, |
| 3018 | &coresight_attr_cfg_dbgbus_trace_buf2.attr.attr, |
| 3019 | &coresight_attr_evt_cfg.attr.attr, |
| 3020 | &coresight_attr_evt_intf_sel_0.attr.attr, |
| 3021 | &coresight_attr_evt_intf_sel_1.attr.attr, |
| 3022 | &coresight_attr_perf_atb_cfg.attr.attr, |
| 3023 | &coresight_attr_perf_atb_counter_sel_0.attr.attr, |
| 3024 | &coresight_attr_perf_atb_counter_sel_1.attr.attr, |
| 3025 | &coresight_attr_perf_atb_counter_sel_2.attr.attr, |
| 3026 | &coresight_attr_perf_atb_counter_sel_3.attr.attr, |
| 3027 | &coresight_attr_perf_atb_trig_intf_sel_0.attr.attr, |
| 3028 | &coresight_attr_perf_atb_trig_intf_sel_1.attr.attr, |
| 3029 | &coresight_attr_perf_atb_drain_cmd.attr.attr, |
| 3030 | &coresight_attr_eco_cntl.attr.attr, |
| 3031 | &coresight_attr_ahb_dbg_cntl.attr.attr, |
| 3032 | NULL, |
| 3033 | }; |
| 3034 | |
| 3035 | /*cx*/ |
| 3036 | static struct attribute *a6xx_coresight_attrs_cx[] = { |
| 3037 | &coresight_attr_cx_cfg_dbgbus_sel_a.attr.attr, |
| 3038 | &coresight_attr_cx_cfg_dbgbus_sel_b.attr.attr, |
| 3039 | &coresight_attr_cx_cfg_dbgbus_sel_c.attr.attr, |
| 3040 | &coresight_attr_cx_cfg_dbgbus_sel_d.attr.attr, |
| 3041 | &coresight_attr_cx_cfg_dbgbus_cntlt.attr.attr, |
| 3042 | &coresight_attr_cx_cfg_dbgbus_cntlm.attr.attr, |
| 3043 | &coresight_attr_cx_cfg_dbgbus_opl.attr.attr, |
| 3044 | &coresight_attr_cx_cfg_dbgbus_ope.attr.attr, |
| 3045 | &coresight_attr_cx_cfg_dbgbus_ivtl_0.attr.attr, |
| 3046 | &coresight_attr_cx_cfg_dbgbus_ivtl_1.attr.attr, |
| 3047 | &coresight_attr_cx_cfg_dbgbus_ivtl_2.attr.attr, |
| 3048 | &coresight_attr_cx_cfg_dbgbus_ivtl_3.attr.attr, |
| 3049 | &coresight_attr_cx_cfg_dbgbus_maskl_0.attr.attr, |
| 3050 | &coresight_attr_cx_cfg_dbgbus_maskl_1.attr.attr, |
| 3051 | &coresight_attr_cx_cfg_dbgbus_maskl_2.attr.attr, |
| 3052 | &coresight_attr_cx_cfg_dbgbus_maskl_3.attr.attr, |
| 3053 | &coresight_attr_cx_cfg_dbgbus_bytel_0.attr.attr, |
| 3054 | &coresight_attr_cx_cfg_dbgbus_bytel_1.attr.attr, |
| 3055 | &coresight_attr_cx_cfg_dbgbus_ivte_0.attr.attr, |
| 3056 | &coresight_attr_cx_cfg_dbgbus_ivte_1.attr.attr, |
| 3057 | &coresight_attr_cx_cfg_dbgbus_ivte_2.attr.attr, |
| 3058 | &coresight_attr_cx_cfg_dbgbus_ivte_3.attr.attr, |
| 3059 | &coresight_attr_cx_cfg_dbgbus_maske_0.attr.attr, |
| 3060 | &coresight_attr_cx_cfg_dbgbus_maske_1.attr.attr, |
| 3061 | &coresight_attr_cx_cfg_dbgbus_maske_2.attr.attr, |
| 3062 | &coresight_attr_cx_cfg_dbgbus_maske_3.attr.attr, |
| 3063 | &coresight_attr_cx_cfg_dbgbus_nibblee.attr.attr, |
| 3064 | &coresight_attr_cx_cfg_dbgbus_ptrc0.attr.attr, |
| 3065 | &coresight_attr_cx_cfg_dbgbus_ptrc1.attr.attr, |
| 3066 | &coresight_attr_cx_cfg_dbgbus_loadreg.attr.attr, |
| 3067 | &coresight_attr_cx_cfg_dbgbus_idx.attr.attr, |
| 3068 | &coresight_attr_cx_cfg_dbgbus_clrc.attr.attr, |
| 3069 | &coresight_attr_cx_cfg_dbgbus_loadivt.attr.attr, |
| 3070 | &coresight_attr_cx_vbif_dbg_cntl.attr.attr, |
| 3071 | &coresight_attr_cx_dbg_lo_hi_gpio.attr.attr, |
| 3072 | &coresight_attr_cx_ext_trace_bus_cntl.attr.attr, |
| 3073 | &coresight_attr_cx_read_ahb_through_dbg.attr.attr, |
| 3074 | &coresight_attr_cx_cfg_dbgbus_trace_buf1.attr.attr, |
| 3075 | &coresight_attr_cx_cfg_dbgbus_trace_buf2.attr.attr, |
| 3076 | &coresight_attr_cx_evt_cfg.attr.attr, |
| 3077 | &coresight_attr_cx_evt_intf_sel_0.attr.attr, |
| 3078 | &coresight_attr_cx_evt_intf_sel_1.attr.attr, |
| 3079 | &coresight_attr_cx_perf_atb_cfg.attr.attr, |
| 3080 | &coresight_attr_cx_perf_atb_counter_sel_0.attr.attr, |
| 3081 | &coresight_attr_cx_perf_atb_counter_sel_1.attr.attr, |
| 3082 | &coresight_attr_cx_perf_atb_counter_sel_2.attr.attr, |
| 3083 | &coresight_attr_cx_perf_atb_counter_sel_3.attr.attr, |
| 3084 | &coresight_attr_cx_perf_atb_trig_intf_sel_0.attr.attr, |
| 3085 | &coresight_attr_cx_perf_atb_trig_intf_sel_1.attr.attr, |
| 3086 | &coresight_attr_cx_perf_atb_drain_cmd.attr.attr, |
| 3087 | &coresight_attr_cx_eco_cntl.attr.attr, |
| 3088 | &coresight_attr_cx_ahb_dbg_cntl.attr.attr, |
| 3089 | NULL, |
| 3090 | }; |
| 3091 | |
| 3092 | static const struct attribute_group a6xx_coresight_group = { |
| 3093 | .attrs = a6xx_coresight_attrs, |
| 3094 | }; |
| 3095 | |
| 3096 | static const struct attribute_group *a6xx_coresight_groups[] = { |
| 3097 | &a6xx_coresight_group, |
| 3098 | NULL, |
| 3099 | }; |
| 3100 | |
| 3101 | static const struct attribute_group a6xx_coresight_group_cx = { |
| 3102 | .attrs = a6xx_coresight_attrs_cx, |
| 3103 | }; |
| 3104 | |
| 3105 | static const struct attribute_group *a6xx_coresight_groups_cx[] = { |
| 3106 | &a6xx_coresight_group_cx, |
| 3107 | NULL, |
| 3108 | }; |
| 3109 | |
| 3110 | static struct adreno_coresight a6xx_coresight = { |
| 3111 | .registers = a6xx_coresight_regs, |
| 3112 | .count = ARRAY_SIZE(a6xx_coresight_regs), |
| 3113 | .groups = a6xx_coresight_groups, |
| 3114 | }; |
| 3115 | |
| 3116 | static struct adreno_coresight a6xx_coresight_cx = { |
| 3117 | .registers = a6xx_coresight_regs_cx, |
| 3118 | .count = ARRAY_SIZE(a6xx_coresight_regs_cx), |
| 3119 | .groups = a6xx_coresight_groups_cx, |
| 3120 | }; |
| 3121 | |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3122 | static struct adreno_perfcount_register a6xx_perfcounters_cp[] = { |
| 3123 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_0_LO, |
| 3124 | A6XX_RBBM_PERFCTR_CP_0_HI, 0, A6XX_CP_PERFCTR_CP_SEL_0 }, |
| 3125 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_1_LO, |
| 3126 | A6XX_RBBM_PERFCTR_CP_1_HI, 1, A6XX_CP_PERFCTR_CP_SEL_1 }, |
| 3127 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_2_LO, |
| 3128 | A6XX_RBBM_PERFCTR_CP_2_HI, 2, A6XX_CP_PERFCTR_CP_SEL_2 }, |
| 3129 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_3_LO, |
| 3130 | A6XX_RBBM_PERFCTR_CP_3_HI, 3, A6XX_CP_PERFCTR_CP_SEL_3 }, |
| 3131 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_4_LO, |
| 3132 | A6XX_RBBM_PERFCTR_CP_4_HI, 4, A6XX_CP_PERFCTR_CP_SEL_4 }, |
| 3133 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_5_LO, |
| 3134 | A6XX_RBBM_PERFCTR_CP_5_HI, 5, A6XX_CP_PERFCTR_CP_SEL_5 }, |
| 3135 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_6_LO, |
| 3136 | A6XX_RBBM_PERFCTR_CP_6_HI, 6, A6XX_CP_PERFCTR_CP_SEL_6 }, |
| 3137 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_7_LO, |
| 3138 | A6XX_RBBM_PERFCTR_CP_7_HI, 7, A6XX_CP_PERFCTR_CP_SEL_7 }, |
| 3139 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_8_LO, |
| 3140 | A6XX_RBBM_PERFCTR_CP_8_HI, 8, A6XX_CP_PERFCTR_CP_SEL_8 }, |
| 3141 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_9_LO, |
| 3142 | A6XX_RBBM_PERFCTR_CP_9_HI, 9, A6XX_CP_PERFCTR_CP_SEL_9 }, |
| 3143 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_10_LO, |
| 3144 | A6XX_RBBM_PERFCTR_CP_10_HI, 10, A6XX_CP_PERFCTR_CP_SEL_10 }, |
| 3145 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_11_LO, |
| 3146 | A6XX_RBBM_PERFCTR_CP_11_HI, 11, A6XX_CP_PERFCTR_CP_SEL_11 }, |
| 3147 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_12_LO, |
| 3148 | A6XX_RBBM_PERFCTR_CP_12_HI, 12, A6XX_CP_PERFCTR_CP_SEL_12 }, |
| 3149 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CP_13_LO, |
| 3150 | A6XX_RBBM_PERFCTR_CP_13_HI, 13, A6XX_CP_PERFCTR_CP_SEL_13 }, |
| 3151 | }; |
| 3152 | |
| 3153 | static struct adreno_perfcount_register a6xx_perfcounters_rbbm[] = { |
| 3154 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RBBM_0_LO, |
| 3155 | A6XX_RBBM_PERFCTR_RBBM_0_HI, 15, A6XX_RBBM_PERFCTR_RBBM_SEL_0 }, |
| 3156 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RBBM_1_LO, |
| 3157 | A6XX_RBBM_PERFCTR_RBBM_1_HI, 15, A6XX_RBBM_PERFCTR_RBBM_SEL_1 }, |
| 3158 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RBBM_2_LO, |
| 3159 | A6XX_RBBM_PERFCTR_RBBM_2_HI, 16, A6XX_RBBM_PERFCTR_RBBM_SEL_2 }, |
| 3160 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RBBM_3_LO, |
| 3161 | A6XX_RBBM_PERFCTR_RBBM_3_HI, 17, A6XX_RBBM_PERFCTR_RBBM_SEL_3 }, |
| 3162 | }; |
| 3163 | |
| 3164 | static struct adreno_perfcount_register a6xx_perfcounters_pc[] = { |
| 3165 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_PC_0_LO, |
| 3166 | A6XX_RBBM_PERFCTR_PC_0_HI, 18, A6XX_PC_PERFCTR_PC_SEL_0 }, |
| 3167 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_PC_1_LO, |
| 3168 | A6XX_RBBM_PERFCTR_PC_1_HI, 19, A6XX_PC_PERFCTR_PC_SEL_1 }, |
| 3169 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_PC_2_LO, |
| 3170 | A6XX_RBBM_PERFCTR_PC_2_HI, 20, A6XX_PC_PERFCTR_PC_SEL_2 }, |
| 3171 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_PC_3_LO, |
| 3172 | A6XX_RBBM_PERFCTR_PC_3_HI, 21, A6XX_PC_PERFCTR_PC_SEL_3 }, |
| 3173 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_PC_4_LO, |
| 3174 | A6XX_RBBM_PERFCTR_PC_4_HI, 22, A6XX_PC_PERFCTR_PC_SEL_4 }, |
| 3175 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_PC_5_LO, |
| 3176 | A6XX_RBBM_PERFCTR_PC_5_HI, 23, A6XX_PC_PERFCTR_PC_SEL_5 }, |
| 3177 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_PC_6_LO, |
| 3178 | A6XX_RBBM_PERFCTR_PC_6_HI, 24, A6XX_PC_PERFCTR_PC_SEL_6 }, |
| 3179 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_PC_7_LO, |
| 3180 | A6XX_RBBM_PERFCTR_PC_7_HI, 25, A6XX_PC_PERFCTR_PC_SEL_7 }, |
| 3181 | }; |
| 3182 | |
| 3183 | static struct adreno_perfcount_register a6xx_perfcounters_vfd[] = { |
| 3184 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VFD_0_LO, |
| 3185 | A6XX_RBBM_PERFCTR_VFD_0_HI, 26, A6XX_VFD_PERFCTR_VFD_SEL_0 }, |
| 3186 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VFD_1_LO, |
| 3187 | A6XX_RBBM_PERFCTR_VFD_1_HI, 27, A6XX_VFD_PERFCTR_VFD_SEL_1 }, |
| 3188 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VFD_2_LO, |
| 3189 | A6XX_RBBM_PERFCTR_VFD_2_HI, 28, A6XX_VFD_PERFCTR_VFD_SEL_2 }, |
| 3190 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VFD_3_LO, |
| 3191 | A6XX_RBBM_PERFCTR_VFD_3_HI, 29, A6XX_VFD_PERFCTR_VFD_SEL_3 }, |
| 3192 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VFD_4_LO, |
| 3193 | A6XX_RBBM_PERFCTR_VFD_4_HI, 30, A6XX_VFD_PERFCTR_VFD_SEL_4 }, |
| 3194 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VFD_5_LO, |
| 3195 | A6XX_RBBM_PERFCTR_VFD_5_HI, 31, A6XX_VFD_PERFCTR_VFD_SEL_5 }, |
| 3196 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VFD_6_LO, |
| 3197 | A6XX_RBBM_PERFCTR_VFD_6_HI, 32, A6XX_VFD_PERFCTR_VFD_SEL_6 }, |
| 3198 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VFD_7_LO, |
| 3199 | A6XX_RBBM_PERFCTR_VFD_7_HI, 33, A6XX_VFD_PERFCTR_VFD_SEL_7 }, |
| 3200 | }; |
| 3201 | |
| 3202 | static struct adreno_perfcount_register a6xx_perfcounters_hlsq[] = { |
| 3203 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_HLSQ_0_LO, |
| 3204 | A6XX_RBBM_PERFCTR_HLSQ_0_HI, 34, A6XX_HLSQ_PERFCTR_HLSQ_SEL_0 }, |
| 3205 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_HLSQ_1_LO, |
| 3206 | A6XX_RBBM_PERFCTR_HLSQ_1_HI, 35, A6XX_HLSQ_PERFCTR_HLSQ_SEL_1 }, |
| 3207 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_HLSQ_2_LO, |
| 3208 | A6XX_RBBM_PERFCTR_HLSQ_2_HI, 36, A6XX_HLSQ_PERFCTR_HLSQ_SEL_2 }, |
| 3209 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_HLSQ_3_LO, |
| 3210 | A6XX_RBBM_PERFCTR_HLSQ_3_HI, 37, A6XX_HLSQ_PERFCTR_HLSQ_SEL_3 }, |
| 3211 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_HLSQ_4_LO, |
| 3212 | A6XX_RBBM_PERFCTR_HLSQ_4_HI, 38, A6XX_HLSQ_PERFCTR_HLSQ_SEL_4 }, |
| 3213 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_HLSQ_5_LO, |
| 3214 | A6XX_RBBM_PERFCTR_HLSQ_5_HI, 39, A6XX_HLSQ_PERFCTR_HLSQ_SEL_5 }, |
| 3215 | }; |
| 3216 | |
| 3217 | static struct adreno_perfcount_register a6xx_perfcounters_vpc[] = { |
| 3218 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VPC_0_LO, |
| 3219 | A6XX_RBBM_PERFCTR_VPC_0_HI, 40, A6XX_VPC_PERFCTR_VPC_SEL_0 }, |
| 3220 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VPC_1_LO, |
| 3221 | A6XX_RBBM_PERFCTR_VPC_1_HI, 41, A6XX_VPC_PERFCTR_VPC_SEL_1 }, |
| 3222 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VPC_2_LO, |
| 3223 | A6XX_RBBM_PERFCTR_VPC_2_HI, 42, A6XX_VPC_PERFCTR_VPC_SEL_2 }, |
| 3224 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VPC_3_LO, |
| 3225 | A6XX_RBBM_PERFCTR_VPC_3_HI, 43, A6XX_VPC_PERFCTR_VPC_SEL_3 }, |
| 3226 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VPC_4_LO, |
| 3227 | A6XX_RBBM_PERFCTR_VPC_4_HI, 44, A6XX_VPC_PERFCTR_VPC_SEL_4 }, |
| 3228 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VPC_5_LO, |
| 3229 | A6XX_RBBM_PERFCTR_VPC_5_HI, 45, A6XX_VPC_PERFCTR_VPC_SEL_5 }, |
| 3230 | }; |
| 3231 | |
| 3232 | static struct adreno_perfcount_register a6xx_perfcounters_ccu[] = { |
| 3233 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CCU_0_LO, |
| 3234 | A6XX_RBBM_PERFCTR_CCU_0_HI, 46, A6XX_RB_PERFCTR_CCU_SEL_0 }, |
| 3235 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CCU_1_LO, |
| 3236 | A6XX_RBBM_PERFCTR_CCU_1_HI, 47, A6XX_RB_PERFCTR_CCU_SEL_1 }, |
| 3237 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CCU_2_LO, |
| 3238 | A6XX_RBBM_PERFCTR_CCU_2_HI, 48, A6XX_RB_PERFCTR_CCU_SEL_2 }, |
| 3239 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CCU_3_LO, |
| 3240 | A6XX_RBBM_PERFCTR_CCU_3_HI, 49, A6XX_RB_PERFCTR_CCU_SEL_3 }, |
| 3241 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CCU_4_LO, |
| 3242 | A6XX_RBBM_PERFCTR_CCU_4_HI, 50, A6XX_RB_PERFCTR_CCU_SEL_4 }, |
| 3243 | }; |
| 3244 | |
| 3245 | static struct adreno_perfcount_register a6xx_perfcounters_tse[] = { |
| 3246 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TSE_0_LO, |
| 3247 | A6XX_RBBM_PERFCTR_TSE_0_HI, 51, A6XX_GRAS_PERFCTR_TSE_SEL_0 }, |
| 3248 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TSE_1_LO, |
| 3249 | A6XX_RBBM_PERFCTR_TSE_1_HI, 52, A6XX_GRAS_PERFCTR_TSE_SEL_1 }, |
| 3250 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TSE_2_LO, |
| 3251 | A6XX_RBBM_PERFCTR_TSE_2_HI, 53, A6XX_GRAS_PERFCTR_TSE_SEL_2 }, |
| 3252 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TSE_3_LO, |
| 3253 | A6XX_RBBM_PERFCTR_TSE_3_HI, 54, A6XX_GRAS_PERFCTR_TSE_SEL_3 }, |
| 3254 | }; |
| 3255 | |
| 3256 | static struct adreno_perfcount_register a6xx_perfcounters_ras[] = { |
| 3257 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RAS_0_LO, |
| 3258 | A6XX_RBBM_PERFCTR_RAS_0_HI, 55, A6XX_GRAS_PERFCTR_RAS_SEL_0 }, |
| 3259 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RAS_1_LO, |
| 3260 | A6XX_RBBM_PERFCTR_RAS_1_HI, 56, A6XX_GRAS_PERFCTR_RAS_SEL_1 }, |
| 3261 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RAS_2_LO, |
| 3262 | A6XX_RBBM_PERFCTR_RAS_2_HI, 57, A6XX_GRAS_PERFCTR_RAS_SEL_2 }, |
| 3263 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RAS_3_LO, |
| 3264 | A6XX_RBBM_PERFCTR_RAS_3_HI, 58, A6XX_GRAS_PERFCTR_RAS_SEL_3 }, |
| 3265 | }; |
| 3266 | |
| 3267 | static struct adreno_perfcount_register a6xx_perfcounters_uche[] = { |
| 3268 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_0_LO, |
| 3269 | A6XX_RBBM_PERFCTR_UCHE_0_HI, 59, A6XX_UCHE_PERFCTR_UCHE_SEL_0 }, |
| 3270 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_1_LO, |
| 3271 | A6XX_RBBM_PERFCTR_UCHE_1_HI, 60, A6XX_UCHE_PERFCTR_UCHE_SEL_1 }, |
| 3272 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_2_LO, |
| 3273 | A6XX_RBBM_PERFCTR_UCHE_2_HI, 61, A6XX_UCHE_PERFCTR_UCHE_SEL_2 }, |
| 3274 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_3_LO, |
| 3275 | A6XX_RBBM_PERFCTR_UCHE_3_HI, 62, A6XX_UCHE_PERFCTR_UCHE_SEL_3 }, |
| 3276 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_4_LO, |
| 3277 | A6XX_RBBM_PERFCTR_UCHE_4_HI, 63, A6XX_UCHE_PERFCTR_UCHE_SEL_4 }, |
| 3278 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_5_LO, |
| 3279 | A6XX_RBBM_PERFCTR_UCHE_5_HI, 64, A6XX_UCHE_PERFCTR_UCHE_SEL_5 }, |
| 3280 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_6_LO, |
| 3281 | A6XX_RBBM_PERFCTR_UCHE_6_HI, 65, A6XX_UCHE_PERFCTR_UCHE_SEL_6 }, |
| 3282 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_7_LO, |
| 3283 | A6XX_RBBM_PERFCTR_UCHE_7_HI, 66, A6XX_UCHE_PERFCTR_UCHE_SEL_7 }, |
| 3284 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_8_LO, |
| 3285 | A6XX_RBBM_PERFCTR_UCHE_8_HI, 67, A6XX_UCHE_PERFCTR_UCHE_SEL_8 }, |
| 3286 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_9_LO, |
| 3287 | A6XX_RBBM_PERFCTR_UCHE_9_HI, 68, A6XX_UCHE_PERFCTR_UCHE_SEL_9 }, |
| 3288 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_10_LO, |
| 3289 | A6XX_RBBM_PERFCTR_UCHE_10_HI, 69, |
| 3290 | A6XX_UCHE_PERFCTR_UCHE_SEL_10 }, |
| 3291 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_UCHE_11_LO, |
| 3292 | A6XX_RBBM_PERFCTR_UCHE_11_HI, 70, |
| 3293 | A6XX_UCHE_PERFCTR_UCHE_SEL_11 }, |
| 3294 | }; |
| 3295 | |
| 3296 | static struct adreno_perfcount_register a6xx_perfcounters_tp[] = { |
| 3297 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_0_LO, |
| 3298 | A6XX_RBBM_PERFCTR_TP_0_HI, 71, A6XX_TPL1_PERFCTR_TP_SEL_0 }, |
| 3299 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_1_LO, |
| 3300 | A6XX_RBBM_PERFCTR_TP_1_HI, 72, A6XX_TPL1_PERFCTR_TP_SEL_1 }, |
| 3301 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_2_LO, |
| 3302 | A6XX_RBBM_PERFCTR_TP_2_HI, 73, A6XX_TPL1_PERFCTR_TP_SEL_2 }, |
| 3303 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_3_LO, |
| 3304 | A6XX_RBBM_PERFCTR_TP_3_HI, 74, A6XX_TPL1_PERFCTR_TP_SEL_3 }, |
| 3305 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_4_LO, |
| 3306 | A6XX_RBBM_PERFCTR_TP_4_HI, 75, A6XX_TPL1_PERFCTR_TP_SEL_4 }, |
| 3307 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_5_LO, |
| 3308 | A6XX_RBBM_PERFCTR_TP_5_HI, 76, A6XX_TPL1_PERFCTR_TP_SEL_5 }, |
| 3309 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_6_LO, |
| 3310 | A6XX_RBBM_PERFCTR_TP_6_HI, 77, A6XX_TPL1_PERFCTR_TP_SEL_6 }, |
| 3311 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_7_LO, |
| 3312 | A6XX_RBBM_PERFCTR_TP_7_HI, 78, A6XX_TPL1_PERFCTR_TP_SEL_7 }, |
| 3313 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_8_LO, |
| 3314 | A6XX_RBBM_PERFCTR_TP_8_HI, 79, A6XX_TPL1_PERFCTR_TP_SEL_8 }, |
| 3315 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_9_LO, |
| 3316 | A6XX_RBBM_PERFCTR_TP_9_HI, 80, A6XX_TPL1_PERFCTR_TP_SEL_9 }, |
| 3317 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_10_LO, |
| 3318 | A6XX_RBBM_PERFCTR_TP_10_HI, 81, A6XX_TPL1_PERFCTR_TP_SEL_10 }, |
| 3319 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_TP_11_LO, |
| 3320 | A6XX_RBBM_PERFCTR_TP_11_HI, 82, A6XX_TPL1_PERFCTR_TP_SEL_11 }, |
| 3321 | }; |
| 3322 | |
| 3323 | static struct adreno_perfcount_register a6xx_perfcounters_sp[] = { |
| 3324 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_0_LO, |
| 3325 | A6XX_RBBM_PERFCTR_SP_0_HI, 83, A6XX_SP_PERFCTR_SP_SEL_0 }, |
| 3326 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_1_LO, |
| 3327 | A6XX_RBBM_PERFCTR_SP_1_HI, 84, A6XX_SP_PERFCTR_SP_SEL_1 }, |
| 3328 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_2_LO, |
| 3329 | A6XX_RBBM_PERFCTR_SP_2_HI, 85, A6XX_SP_PERFCTR_SP_SEL_2 }, |
| 3330 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_3_LO, |
| 3331 | A6XX_RBBM_PERFCTR_SP_3_HI, 86, A6XX_SP_PERFCTR_SP_SEL_3 }, |
| 3332 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_4_LO, |
| 3333 | A6XX_RBBM_PERFCTR_SP_4_HI, 87, A6XX_SP_PERFCTR_SP_SEL_4 }, |
| 3334 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_5_LO, |
| 3335 | A6XX_RBBM_PERFCTR_SP_5_HI, 88, A6XX_SP_PERFCTR_SP_SEL_5 }, |
| 3336 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_6_LO, |
| 3337 | A6XX_RBBM_PERFCTR_SP_6_HI, 89, A6XX_SP_PERFCTR_SP_SEL_6 }, |
| 3338 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_7_LO, |
| 3339 | A6XX_RBBM_PERFCTR_SP_7_HI, 90, A6XX_SP_PERFCTR_SP_SEL_7 }, |
| 3340 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_8_LO, |
| 3341 | A6XX_RBBM_PERFCTR_SP_8_HI, 91, A6XX_SP_PERFCTR_SP_SEL_8 }, |
| 3342 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_9_LO, |
| 3343 | A6XX_RBBM_PERFCTR_SP_9_HI, 92, A6XX_SP_PERFCTR_SP_SEL_9 }, |
| 3344 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_10_LO, |
| 3345 | A6XX_RBBM_PERFCTR_SP_10_HI, 93, A6XX_SP_PERFCTR_SP_SEL_10 }, |
| 3346 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_11_LO, |
| 3347 | A6XX_RBBM_PERFCTR_SP_11_HI, 94, A6XX_SP_PERFCTR_SP_SEL_11 }, |
| 3348 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_12_LO, |
| 3349 | A6XX_RBBM_PERFCTR_SP_12_HI, 95, A6XX_SP_PERFCTR_SP_SEL_12 }, |
| 3350 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_13_LO, |
| 3351 | A6XX_RBBM_PERFCTR_SP_13_HI, 96, A6XX_SP_PERFCTR_SP_SEL_13 }, |
| 3352 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_14_LO, |
| 3353 | A6XX_RBBM_PERFCTR_SP_14_HI, 97, A6XX_SP_PERFCTR_SP_SEL_14 }, |
| 3354 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_15_LO, |
| 3355 | A6XX_RBBM_PERFCTR_SP_15_HI, 98, A6XX_SP_PERFCTR_SP_SEL_15 }, |
| 3356 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_16_LO, |
| 3357 | A6XX_RBBM_PERFCTR_SP_16_HI, 99, A6XX_SP_PERFCTR_SP_SEL_16 }, |
| 3358 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_17_LO, |
| 3359 | A6XX_RBBM_PERFCTR_SP_17_HI, 100, A6XX_SP_PERFCTR_SP_SEL_17 }, |
| 3360 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_18_LO, |
| 3361 | A6XX_RBBM_PERFCTR_SP_18_HI, 101, A6XX_SP_PERFCTR_SP_SEL_18 }, |
| 3362 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_19_LO, |
| 3363 | A6XX_RBBM_PERFCTR_SP_19_HI, 102, A6XX_SP_PERFCTR_SP_SEL_19 }, |
| 3364 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_20_LO, |
| 3365 | A6XX_RBBM_PERFCTR_SP_20_HI, 103, A6XX_SP_PERFCTR_SP_SEL_20 }, |
| 3366 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_21_LO, |
| 3367 | A6XX_RBBM_PERFCTR_SP_21_HI, 104, A6XX_SP_PERFCTR_SP_SEL_21 }, |
| 3368 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_22_LO, |
| 3369 | A6XX_RBBM_PERFCTR_SP_22_HI, 105, A6XX_SP_PERFCTR_SP_SEL_22 }, |
| 3370 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_SP_23_LO, |
| 3371 | A6XX_RBBM_PERFCTR_SP_23_HI, 106, A6XX_SP_PERFCTR_SP_SEL_23 }, |
| 3372 | }; |
| 3373 | |
| 3374 | static struct adreno_perfcount_register a6xx_perfcounters_rb[] = { |
| 3375 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RB_0_LO, |
| 3376 | A6XX_RBBM_PERFCTR_RB_0_HI, 107, A6XX_RB_PERFCTR_RB_SEL_0 }, |
| 3377 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RB_1_LO, |
| 3378 | A6XX_RBBM_PERFCTR_RB_1_HI, 108, A6XX_RB_PERFCTR_RB_SEL_1 }, |
| 3379 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RB_2_LO, |
| 3380 | A6XX_RBBM_PERFCTR_RB_2_HI, 109, A6XX_RB_PERFCTR_RB_SEL_2 }, |
| 3381 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RB_3_LO, |
| 3382 | A6XX_RBBM_PERFCTR_RB_3_HI, 110, A6XX_RB_PERFCTR_RB_SEL_3 }, |
| 3383 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RB_4_LO, |
| 3384 | A6XX_RBBM_PERFCTR_RB_4_HI, 111, A6XX_RB_PERFCTR_RB_SEL_4 }, |
| 3385 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RB_5_LO, |
| 3386 | A6XX_RBBM_PERFCTR_RB_5_HI, 112, A6XX_RB_PERFCTR_RB_SEL_5 }, |
| 3387 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RB_6_LO, |
| 3388 | A6XX_RBBM_PERFCTR_RB_6_HI, 113, A6XX_RB_PERFCTR_RB_SEL_6 }, |
| 3389 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_RB_7_LO, |
| 3390 | A6XX_RBBM_PERFCTR_RB_7_HI, 114, A6XX_RB_PERFCTR_RB_SEL_7 }, |
| 3391 | }; |
| 3392 | |
| 3393 | static struct adreno_perfcount_register a6xx_perfcounters_vsc[] = { |
| 3394 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VSC_0_LO, |
| 3395 | A6XX_RBBM_PERFCTR_VSC_0_HI, 115, A6XX_VSC_PERFCTR_VSC_SEL_0 }, |
| 3396 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_VSC_1_LO, |
| 3397 | A6XX_RBBM_PERFCTR_VSC_1_HI, 116, A6XX_VSC_PERFCTR_VSC_SEL_1 }, |
| 3398 | }; |
| 3399 | |
| 3400 | static struct adreno_perfcount_register a6xx_perfcounters_lrz[] = { |
| 3401 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_LRZ_0_LO, |
| 3402 | A6XX_RBBM_PERFCTR_LRZ_0_HI, 117, A6XX_GRAS_PERFCTR_LRZ_SEL_0 }, |
| 3403 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_LRZ_1_LO, |
| 3404 | A6XX_RBBM_PERFCTR_LRZ_1_HI, 118, A6XX_GRAS_PERFCTR_LRZ_SEL_1 }, |
| 3405 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_LRZ_2_LO, |
| 3406 | A6XX_RBBM_PERFCTR_LRZ_2_HI, 119, A6XX_GRAS_PERFCTR_LRZ_SEL_2 }, |
| 3407 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_LRZ_3_LO, |
| 3408 | A6XX_RBBM_PERFCTR_LRZ_3_HI, 120, A6XX_GRAS_PERFCTR_LRZ_SEL_3 }, |
| 3409 | }; |
| 3410 | |
| 3411 | static struct adreno_perfcount_register a6xx_perfcounters_cmp[] = { |
| 3412 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CMP_0_LO, |
| 3413 | A6XX_RBBM_PERFCTR_CMP_0_HI, 121, A6XX_RB_PERFCTR_CMP_SEL_0 }, |
| 3414 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CMP_1_LO, |
| 3415 | A6XX_RBBM_PERFCTR_CMP_1_HI, 122, A6XX_RB_PERFCTR_CMP_SEL_1 }, |
| 3416 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CMP_2_LO, |
| 3417 | A6XX_RBBM_PERFCTR_CMP_2_HI, 123, A6XX_RB_PERFCTR_CMP_SEL_2 }, |
| 3418 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_RBBM_PERFCTR_CMP_3_LO, |
| 3419 | A6XX_RBBM_PERFCTR_CMP_3_HI, 124, A6XX_RB_PERFCTR_CMP_SEL_3 }, |
| 3420 | }; |
| 3421 | |
| 3422 | static struct adreno_perfcount_register a6xx_perfcounters_vbif[] = { |
| 3423 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_VBIF_PERF_CNT_LOW0, |
| 3424 | A6XX_VBIF_PERF_CNT_HIGH0, -1, A6XX_VBIF_PERF_CNT_SEL0 }, |
| 3425 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_VBIF_PERF_CNT_LOW1, |
| 3426 | A6XX_VBIF_PERF_CNT_HIGH1, -1, A6XX_VBIF_PERF_CNT_SEL1 }, |
| 3427 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_VBIF_PERF_CNT_LOW2, |
| 3428 | A6XX_VBIF_PERF_CNT_HIGH2, -1, A6XX_VBIF_PERF_CNT_SEL2 }, |
| 3429 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_VBIF_PERF_CNT_LOW3, |
| 3430 | A6XX_VBIF_PERF_CNT_HIGH3, -1, A6XX_VBIF_PERF_CNT_SEL3 }, |
| 3431 | }; |
| 3432 | |
| 3433 | static struct adreno_perfcount_register a6xx_perfcounters_vbif_pwr[] = { |
| 3434 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_VBIF_PERF_PWR_CNT_LOW0, |
| 3435 | A6XX_VBIF_PERF_PWR_CNT_HIGH0, -1, A6XX_VBIF_PERF_PWR_CNT_EN0 }, |
| 3436 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_VBIF_PERF_PWR_CNT_LOW1, |
| 3437 | A6XX_VBIF_PERF_PWR_CNT_HIGH1, -1, A6XX_VBIF_PERF_PWR_CNT_EN1 }, |
| 3438 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_VBIF_PERF_PWR_CNT_LOW2, |
| 3439 | A6XX_VBIF_PERF_PWR_CNT_HIGH2, -1, A6XX_VBIF_PERF_PWR_CNT_EN2 }, |
| 3440 | }; |
| 3441 | |
Rajesh Kemisetti | 77b82ed | 2017-09-24 20:42:41 +0530 | [diff] [blame] | 3442 | |
| 3443 | static struct adreno_perfcount_register a6xx_perfcounters_gbif[] = { |
| 3444 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_GBIF_PERF_CNT_LOW0, |
| 3445 | A6XX_GBIF_PERF_CNT_HIGH0, -1, A6XX_GBIF_PERF_CNT_SEL }, |
| 3446 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_GBIF_PERF_CNT_LOW1, |
| 3447 | A6XX_GBIF_PERF_CNT_HIGH1, -1, A6XX_GBIF_PERF_CNT_SEL }, |
| 3448 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_GBIF_PERF_CNT_LOW2, |
| 3449 | A6XX_GBIF_PERF_CNT_HIGH2, -1, A6XX_GBIF_PERF_CNT_SEL }, |
| 3450 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_GBIF_PERF_CNT_LOW3, |
| 3451 | A6XX_GBIF_PERF_CNT_HIGH3, -1, A6XX_GBIF_PERF_CNT_SEL }, |
| 3452 | }; |
| 3453 | |
| 3454 | static struct adreno_perfcount_register a6xx_perfcounters_gbif_pwr[] = { |
| 3455 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_GBIF_PWR_CNT_LOW0, |
| 3456 | A6XX_GBIF_PWR_CNT_HIGH0, -1, A6XX_GBIF_PERF_PWR_CNT_EN }, |
| 3457 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_GBIF_PWR_CNT_LOW1, |
| 3458 | A6XX_GBIF_PWR_CNT_HIGH1, -1, A6XX_GBIF_PERF_PWR_CNT_EN }, |
| 3459 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_GBIF_PWR_CNT_LOW2, |
| 3460 | A6XX_GBIF_PWR_CNT_HIGH2, -1, A6XX_GBIF_PERF_PWR_CNT_EN }, |
| 3461 | }; |
| 3462 | |
Lynus Vaz | 856ca60 | 2017-05-24 16:56:36 +0530 | [diff] [blame] | 3463 | static struct adreno_perfcount_register a6xx_perfcounters_pwr[] = { |
| 3464 | { KGSL_PERFCOUNTER_BROKEN, 0, 0, 0, 0, -1, 0 }, |
| 3465 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, |
| 3466 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L, |
| 3467 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H, -1, 0 }, |
| 3468 | }; |
| 3469 | |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3470 | static struct adreno_perfcount_register a6xx_perfcounters_alwayson[] = { |
| 3471 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, A6XX_CP_ALWAYS_ON_COUNTER_LO, |
| 3472 | A6XX_CP_ALWAYS_ON_COUNTER_HI, -1 }, |
| 3473 | }; |
| 3474 | |
Lynus Vaz | 4fc97e2 | 2017-06-01 20:03:35 +0530 | [diff] [blame] | 3475 | static struct adreno_perfcount_register a6xx_pwrcounters_gpmu[] = { |
| 3476 | /* |
| 3477 | * A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0 is used for the GPU |
| 3478 | * busy count (see the PWR group above). Mark it as broken |
| 3479 | * so it's not re-used. |
| 3480 | */ |
| 3481 | { KGSL_PERFCOUNTER_BROKEN, 0, 0, |
| 3482 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_L, |
| 3483 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_0_H, -1, |
| 3484 | A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0, }, |
| 3485 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, |
| 3486 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_L, |
| 3487 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_1_H, -1, |
| 3488 | A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0, }, |
| 3489 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, |
| 3490 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_L, |
| 3491 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_2_H, -1, |
| 3492 | A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0, }, |
| 3493 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, |
| 3494 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_L, |
| 3495 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_3_H, -1, |
| 3496 | A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0, }, |
| 3497 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, |
| 3498 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_4_L, |
| 3499 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_4_H, -1, |
| 3500 | A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_1, }, |
| 3501 | { KGSL_PERFCOUNTER_NOT_USED, 0, 0, |
| 3502 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_5_L, |
| 3503 | A6XX_GMU_CX_GMU_POWER_COUNTER_XOCLK_5_H, -1, |
| 3504 | A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_1, }, |
| 3505 | }; |
| 3506 | |
Tarun Karra | 1382e51 | 2017-10-30 19:41:25 -0700 | [diff] [blame] | 3507 | /* |
| 3508 | * ADRENO_PERFCOUNTER_GROUP_RESTORE flag is enabled by default |
| 3509 | * because most of the perfcounter groups need to be restored |
| 3510 | * as part of preemption and IFPC. Perfcounter groups that are |
| 3511 | * not restored as part of preemption and IFPC should be defined |
| 3512 | * using A6XX_PERFCOUNTER_GROUP_FLAGS macro |
| 3513 | */ |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3514 | #define A6XX_PERFCOUNTER_GROUP(offset, name) \ |
Tarun Karra | 1382e51 | 2017-10-30 19:41:25 -0700 | [diff] [blame] | 3515 | ADRENO_PERFCOUNTER_GROUP_FLAGS(a6xx, offset, name, \ |
| 3516 | ADRENO_PERFCOUNTER_GROUP_RESTORE) |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3517 | |
| 3518 | #define A6XX_PERFCOUNTER_GROUP_FLAGS(offset, name, flags) \ |
| 3519 | ADRENO_PERFCOUNTER_GROUP_FLAGS(a6xx, offset, name, flags) |
| 3520 | |
Lynus Vaz | 4fc97e2 | 2017-06-01 20:03:35 +0530 | [diff] [blame] | 3521 | #define A6XX_POWER_COUNTER_GROUP(offset, name) \ |
| 3522 | ADRENO_POWER_COUNTER_GROUP(a6xx, offset, name) |
| 3523 | |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3524 | static struct adreno_perfcount_group a6xx_perfcounter_groups |
| 3525 | [KGSL_PERFCOUNTER_GROUP_MAX] = { |
| 3526 | A6XX_PERFCOUNTER_GROUP(CP, cp), |
Tarun Karra | 1382e51 | 2017-10-30 19:41:25 -0700 | [diff] [blame] | 3527 | A6XX_PERFCOUNTER_GROUP_FLAGS(RBBM, rbbm, 0), |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3528 | A6XX_PERFCOUNTER_GROUP(PC, pc), |
| 3529 | A6XX_PERFCOUNTER_GROUP(VFD, vfd), |
| 3530 | A6XX_PERFCOUNTER_GROUP(HLSQ, hlsq), |
| 3531 | A6XX_PERFCOUNTER_GROUP(VPC, vpc), |
| 3532 | A6XX_PERFCOUNTER_GROUP(CCU, ccu), |
| 3533 | A6XX_PERFCOUNTER_GROUP(CMP, cmp), |
| 3534 | A6XX_PERFCOUNTER_GROUP(TSE, tse), |
| 3535 | A6XX_PERFCOUNTER_GROUP(RAS, ras), |
| 3536 | A6XX_PERFCOUNTER_GROUP(LRZ, lrz), |
| 3537 | A6XX_PERFCOUNTER_GROUP(UCHE, uche), |
| 3538 | A6XX_PERFCOUNTER_GROUP(TP, tp), |
| 3539 | A6XX_PERFCOUNTER_GROUP(SP, sp), |
| 3540 | A6XX_PERFCOUNTER_GROUP(RB, rb), |
| 3541 | A6XX_PERFCOUNTER_GROUP(VSC, vsc), |
Tarun Karra | 1382e51 | 2017-10-30 19:41:25 -0700 | [diff] [blame] | 3542 | A6XX_PERFCOUNTER_GROUP_FLAGS(VBIF, vbif, 0), |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3543 | A6XX_PERFCOUNTER_GROUP_FLAGS(VBIF_PWR, vbif_pwr, |
| 3544 | ADRENO_PERFCOUNTER_GROUP_FIXED), |
Lynus Vaz | 856ca60 | 2017-05-24 16:56:36 +0530 | [diff] [blame] | 3545 | A6XX_PERFCOUNTER_GROUP_FLAGS(PWR, pwr, |
| 3546 | ADRENO_PERFCOUNTER_GROUP_FIXED), |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3547 | A6XX_PERFCOUNTER_GROUP_FLAGS(ALWAYSON, alwayson, |
| 3548 | ADRENO_PERFCOUNTER_GROUP_FIXED), |
Lynus Vaz | 4fc97e2 | 2017-06-01 20:03:35 +0530 | [diff] [blame] | 3549 | A6XX_POWER_COUNTER_GROUP(GPMU, gpmu), |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3550 | }; |
| 3551 | |
| 3552 | static struct adreno_perfcounters a6xx_perfcounters = { |
| 3553 | a6xx_perfcounter_groups, |
| 3554 | ARRAY_SIZE(a6xx_perfcounter_groups), |
| 3555 | }; |
| 3556 | |
Lynus Vaz | 856ca60 | 2017-05-24 16:56:36 +0530 | [diff] [blame] | 3557 | /* Program the GMU power counter to count GPU busy cycles */ |
| 3558 | static int a6xx_enable_pwr_counters(struct adreno_device *adreno_dev, |
| 3559 | unsigned int counter) |
| 3560 | { |
| 3561 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 3562 | |
| 3563 | /* |
| 3564 | * We have a limited number of power counters. Since we're not using |
| 3565 | * total GPU cycle count, return error if requested. |
| 3566 | */ |
| 3567 | if (counter == 0) |
| 3568 | return -EINVAL; |
| 3569 | |
| 3570 | if (!device->gmu.pdev) |
| 3571 | return -ENODEV; |
| 3572 | |
Kyle Piefer | 50af7d0 | 2017-07-25 11:00:17 -0700 | [diff] [blame] | 3573 | kgsl_regwrite(device, A6XX_GPU_GMU_AO_GPU_CX_BUSY_MASK, 0xFF000000); |
Lynus Vaz | 856ca60 | 2017-05-24 16:56:36 +0530 | [diff] [blame] | 3574 | kgsl_regrmw(device, |
Kyle Piefer | 50af7d0 | 2017-07-25 11:00:17 -0700 | [diff] [blame] | 3575 | A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0, 0xFF, 0x20); |
Lynus Vaz | 856ca60 | 2017-05-24 16:56:36 +0530 | [diff] [blame] | 3576 | kgsl_regwrite(device, A6XX_GMU_CX_GMU_POWER_COUNTER_ENABLE, 0x1); |
| 3577 | |
| 3578 | return 0; |
| 3579 | } |
| 3580 | |
Rajesh Kemisetti | 10bbec9 | 2017-10-20 10:55:58 +0530 | [diff] [blame] | 3581 | static void a6xx_efuse_speed_bin(struct adreno_device *adreno_dev) |
| 3582 | { |
| 3583 | unsigned int val; |
| 3584 | unsigned int speed_bin[3]; |
| 3585 | struct kgsl_device *device = &adreno_dev->dev; |
| 3586 | |
| 3587 | if (of_property_read_u32_array(device->pdev->dev.of_node, |
| 3588 | "qcom,gpu-speed-bin", speed_bin, 3)) |
| 3589 | return; |
| 3590 | |
| 3591 | adreno_efuse_read_u32(adreno_dev, speed_bin[0], &val); |
| 3592 | |
| 3593 | adreno_dev->speed_bin = (val & speed_bin[1]) >> speed_bin[2]; |
| 3594 | } |
| 3595 | |
| 3596 | static const struct { |
| 3597 | int (*check)(struct adreno_device *adreno_dev); |
| 3598 | void (*func)(struct adreno_device *adreno_dev); |
| 3599 | } a6xx_efuse_funcs[] = { |
| 3600 | { adreno_is_a615, a6xx_efuse_speed_bin }, |
Deepak Kumar | 5287eea | 2018-03-17 14:33:05 +0530 | [diff] [blame] | 3601 | { adreno_is_a616, a6xx_efuse_speed_bin }, |
Rajesh Kemisetti | 10bbec9 | 2017-10-20 10:55:58 +0530 | [diff] [blame] | 3602 | }; |
| 3603 | |
| 3604 | static void a6xx_check_features(struct adreno_device *adreno_dev) |
| 3605 | { |
| 3606 | unsigned int i; |
| 3607 | |
| 3608 | if (adreno_efuse_map(adreno_dev)) |
| 3609 | return; |
| 3610 | for (i = 0; i < ARRAY_SIZE(a6xx_efuse_funcs); i++) { |
| 3611 | if (a6xx_efuse_funcs[i].check(adreno_dev)) |
| 3612 | a6xx_efuse_funcs[i].func(adreno_dev); |
| 3613 | } |
| 3614 | |
| 3615 | adreno_efuse_unmap(adreno_dev); |
| 3616 | } |
Rajesh Kemisetti | 77b82ed | 2017-09-24 20:42:41 +0530 | [diff] [blame] | 3617 | static void a6xx_platform_setup(struct adreno_device *adreno_dev) |
| 3618 | { |
| 3619 | uint64_t addr; |
| 3620 | struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev); |
| 3621 | |
| 3622 | /* Calculate SP local and private mem addresses */ |
| 3623 | addr = ALIGN(ADRENO_UCHE_GMEM_BASE + adreno_dev->gmem_size, SZ_64K); |
| 3624 | adreno_dev->sp_local_gpuaddr = addr; |
| 3625 | adreno_dev->sp_pvt_gpuaddr = addr + SZ_64K; |
| 3626 | |
| 3627 | if (adreno_has_gbif(adreno_dev)) { |
| 3628 | a6xx_perfcounter_groups[KGSL_PERFCOUNTER_GROUP_VBIF].regs = |
| 3629 | a6xx_perfcounters_gbif; |
| 3630 | a6xx_perfcounter_groups[KGSL_PERFCOUNTER_GROUP_VBIF].reg_count |
| 3631 | = ARRAY_SIZE(a6xx_perfcounters_gbif); |
| 3632 | |
| 3633 | a6xx_perfcounter_groups[KGSL_PERFCOUNTER_GROUP_VBIF_PWR].regs = |
| 3634 | a6xx_perfcounters_gbif_pwr; |
Deepak Kumar | 84b9e03 | 2017-11-08 13:08:50 +0530 | [diff] [blame] | 3635 | a6xx_perfcounter_groups[ |
| 3636 | KGSL_PERFCOUNTER_GROUP_VBIF_PWR].reg_count |
Rajesh Kemisetti | 77b82ed | 2017-09-24 20:42:41 +0530 | [diff] [blame] | 3637 | = ARRAY_SIZE(a6xx_perfcounters_gbif_pwr); |
| 3638 | |
| 3639 | gpudev->vbif_xin_halt_ctrl0_mask = |
| 3640 | A6XX_GBIF_HALT_MASK; |
| 3641 | } else |
| 3642 | gpudev->vbif_xin_halt_ctrl0_mask = |
| 3643 | A6XX_VBIF_XIN_HALT_CTRL0_MASK; |
Rajesh Kemisetti | 10bbec9 | 2017-10-20 10:55:58 +0530 | [diff] [blame] | 3644 | |
| 3645 | /* Check efuse bits for various capabilties */ |
| 3646 | a6xx_check_features(adreno_dev); |
Rajesh Kemisetti | 77b82ed | 2017-09-24 20:42:41 +0530 | [diff] [blame] | 3647 | } |
| 3648 | |
| 3649 | |
Harshdeep Dhatt | 6ba7a94 | 2017-08-21 17:53:52 -0600 | [diff] [blame] | 3650 | static unsigned int a6xx_ccu_invalidate(struct adreno_device *adreno_dev, |
| 3651 | unsigned int *cmds) |
| 3652 | { |
| 3653 | /* CCU_INVALIDATE_DEPTH */ |
| 3654 | *cmds++ = cp_packet(adreno_dev, CP_EVENT_WRITE, 1); |
| 3655 | *cmds++ = 24; |
| 3656 | |
| 3657 | /* CCU_INVALIDATE_COLOR */ |
| 3658 | *cmds++ = cp_packet(adreno_dev, CP_EVENT_WRITE, 1); |
| 3659 | *cmds++ = 25; |
| 3660 | |
| 3661 | return 4; |
| 3662 | } |
| 3663 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3664 | /* Register offset defines for A6XX, in order of enum adreno_regs */ |
| 3665 | static unsigned int a6xx_register_offsets[ADRENO_REG_REGISTER_MAX] = { |
| 3666 | |
| 3667 | ADRENO_REG_DEFINE(ADRENO_REG_CP_RB_BASE, A6XX_CP_RB_BASE), |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 3668 | ADRENO_REG_DEFINE(ADRENO_REG_CP_RB_BASE_HI, A6XX_CP_RB_BASE_HI), |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3669 | ADRENO_REG_DEFINE(ADRENO_REG_CP_RB_RPTR_ADDR_LO, |
| 3670 | A6XX_CP_RB_RPTR_ADDR_LO), |
| 3671 | ADRENO_REG_DEFINE(ADRENO_REG_CP_RB_RPTR_ADDR_HI, |
| 3672 | A6XX_CP_RB_RPTR_ADDR_HI), |
| 3673 | ADRENO_REG_DEFINE(ADRENO_REG_CP_RB_RPTR, A6XX_CP_RB_RPTR), |
| 3674 | ADRENO_REG_DEFINE(ADRENO_REG_CP_RB_WPTR, A6XX_CP_RB_WPTR), |
| 3675 | ADRENO_REG_DEFINE(ADRENO_REG_CP_RB_CNTL, A6XX_CP_RB_CNTL), |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 3676 | ADRENO_REG_DEFINE(ADRENO_REG_CP_ME_CNTL, A6XX_CP_SQE_CNTL), |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3677 | ADRENO_REG_DEFINE(ADRENO_REG_CP_CNTL, A6XX_CP_MISC_CNTL), |
Carter Cooper | 8567af0 | 2017-03-15 14:22:03 -0600 | [diff] [blame] | 3678 | ADRENO_REG_DEFINE(ADRENO_REG_CP_HW_FAULT, A6XX_CP_HW_FAULT), |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 3679 | ADRENO_REG_DEFINE(ADRENO_REG_CP_IB1_BASE, A6XX_CP_IB1_BASE), |
| 3680 | ADRENO_REG_DEFINE(ADRENO_REG_CP_IB1_BASE_HI, A6XX_CP_IB1_BASE_HI), |
| 3681 | ADRENO_REG_DEFINE(ADRENO_REG_CP_IB1_BUFSZ, A6XX_CP_IB1_REM_SIZE), |
| 3682 | ADRENO_REG_DEFINE(ADRENO_REG_CP_IB2_BASE, A6XX_CP_IB2_BASE), |
| 3683 | ADRENO_REG_DEFINE(ADRENO_REG_CP_IB2_BASE_HI, A6XX_CP_IB2_BASE_HI), |
| 3684 | ADRENO_REG_DEFINE(ADRENO_REG_CP_IB2_BUFSZ, A6XX_CP_IB2_REM_SIZE), |
| 3685 | ADRENO_REG_DEFINE(ADRENO_REG_CP_ROQ_ADDR, A6XX_CP_ROQ_DBG_ADDR), |
| 3686 | ADRENO_REG_DEFINE(ADRENO_REG_CP_ROQ_DATA, A6XX_CP_ROQ_DBG_DATA), |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 3687 | ADRENO_REG_DEFINE(ADRENO_REG_CP_PREEMPT, A6XX_CP_CONTEXT_SWITCH_CNTL), |
| 3688 | ADRENO_REG_DEFINE(ADRENO_REG_CP_CONTEXT_SWITCH_SMMU_INFO_LO, |
| 3689 | A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_LO), |
| 3690 | ADRENO_REG_DEFINE(ADRENO_REG_CP_CONTEXT_SWITCH_SMMU_INFO_HI, |
| 3691 | A6XX_CP_CONTEXT_SWITCH_SMMU_INFO_HI), |
Harshdeep Dhatt | 59a6957 | 2017-11-01 14:46:13 -0600 | [diff] [blame] | 3692 | ADRENO_REG_DEFINE( |
| 3693 | ADRENO_REG_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO, |
| 3694 | A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_LO), |
| 3695 | ADRENO_REG_DEFINE( |
| 3696 | ADRENO_REG_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI, |
| 3697 | A6XX_CP_CONTEXT_SWITCH_PRIV_NON_SECURE_RESTORE_ADDR_HI), |
| 3698 | ADRENO_REG_DEFINE( |
| 3699 | ADRENO_REG_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO, |
| 3700 | A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_LO), |
| 3701 | ADRENO_REG_DEFINE( |
| 3702 | ADRENO_REG_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI, |
| 3703 | A6XX_CP_CONTEXT_SWITCH_PRIV_SECURE_RESTORE_ADDR_HI), |
| 3704 | ADRENO_REG_DEFINE(ADRENO_REG_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO, |
| 3705 | A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_LO), |
| 3706 | ADRENO_REG_DEFINE(ADRENO_REG_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI, |
| 3707 | A6XX_CP_CONTEXT_SWITCH_NON_PRIV_RESTORE_ADDR_HI), |
Harshdeep Dhatt | 003f6cf | 2017-12-14 11:00:22 -0700 | [diff] [blame] | 3708 | ADRENO_REG_DEFINE(ADRENO_REG_CP_PREEMPT_LEVEL_STATUS, |
| 3709 | A6XX_CP_CONTEXT_SWITCH_LEVEL_STATUS), |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3710 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_STATUS, A6XX_RBBM_STATUS), |
| 3711 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_STATUS3, A6XX_RBBM_STATUS3), |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3712 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_PERFCTR_CTL, A6XX_RBBM_PERFCTR_CNTL), |
| 3713 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_PERFCTR_LOAD_CMD0, |
| 3714 | A6XX_RBBM_PERFCTR_LOAD_CMD0), |
| 3715 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_PERFCTR_LOAD_CMD1, |
| 3716 | A6XX_RBBM_PERFCTR_LOAD_CMD1), |
| 3717 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_PERFCTR_LOAD_CMD2, |
| 3718 | A6XX_RBBM_PERFCTR_LOAD_CMD2), |
| 3719 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_PERFCTR_LOAD_CMD3, |
| 3720 | A6XX_RBBM_PERFCTR_LOAD_CMD3), |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3721 | |
| 3722 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_INT_0_MASK, A6XX_RBBM_INT_0_MASK), |
| 3723 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_INT_0_STATUS, A6XX_RBBM_INT_0_STATUS), |
| 3724 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_CLOCK_CTL, A6XX_RBBM_CLOCK_CNTL), |
| 3725 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_INT_CLEAR_CMD, |
| 3726 | A6XX_RBBM_INT_CLEAR_CMD), |
| 3727 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_SW_RESET_CMD, A6XX_RBBM_SW_RESET_CMD), |
| 3728 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_BLOCK_SW_RESET_CMD, |
| 3729 | A6XX_RBBM_BLOCK_SW_RESET_CMD), |
| 3730 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_BLOCK_SW_RESET_CMD2, |
| 3731 | A6XX_RBBM_BLOCK_SW_RESET_CMD2), |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3732 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_PERFCTR_LOAD_VALUE_LO, |
| 3733 | A6XX_RBBM_PERFCTR_LOAD_VALUE_LO), |
| 3734 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_PERFCTR_LOAD_VALUE_HI, |
| 3735 | A6XX_RBBM_PERFCTR_LOAD_VALUE_HI), |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3736 | ADRENO_REG_DEFINE(ADRENO_REG_VBIF_VERSION, A6XX_VBIF_VERSION), |
Carter Cooper | afc8591 | 2017-03-20 09:39:18 -0600 | [diff] [blame] | 3737 | ADRENO_REG_DEFINE(ADRENO_REG_VBIF_XIN_HALT_CTRL0, |
| 3738 | A6XX_VBIF_XIN_HALT_CTRL0), |
| 3739 | ADRENO_REG_DEFINE(ADRENO_REG_VBIF_XIN_HALT_CTRL1, |
| 3740 | A6XX_VBIF_XIN_HALT_CTRL1), |
Rajesh Kemisetti | d1ca954 | 2017-10-18 15:35:41 +0530 | [diff] [blame] | 3741 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_GPR0_CNTL, A6XX_RBBM_GPR0_CNTL), |
| 3742 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_VBIF_GX_RESET_STATUS, |
| 3743 | A6XX_RBBM_VBIF_GX_RESET_STATUS), |
Rajesh Kemisetti | 77b82ed | 2017-09-24 20:42:41 +0530 | [diff] [blame] | 3744 | ADRENO_REG_DEFINE(ADRENO_REG_GBIF_HALT, A6XX_GBIF_HALT), |
| 3745 | ADRENO_REG_DEFINE(ADRENO_REG_GBIF_HALT_ACK, A6XX_GBIF_HALT_ACK), |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 3746 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_ALWAYSON_COUNTER_LO, |
| 3747 | A6XX_GMU_ALWAYS_ON_COUNTER_L), |
| 3748 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_ALWAYSON_COUNTER_HI, |
| 3749 | A6XX_GMU_ALWAYS_ON_COUNTER_H), |
Kyle Piefer | da0fa54 | 2017-08-04 13:39:40 -0700 | [diff] [blame] | 3750 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_AO_AHB_FENCE_CTRL, |
| 3751 | A6XX_GMU_AO_AHB_FENCE_CTRL), |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 3752 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_AO_INTERRUPT_EN, |
| 3753 | A6XX_GMU_AO_INTERRUPT_EN), |
Kyle Piefer | e7b06b4 | 2017-04-06 13:53:01 -0700 | [diff] [blame] | 3754 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_AO_HOST_INTERRUPT_CLR, |
| 3755 | A6XX_GMU_AO_HOST_INTERRUPT_CLR), |
| 3756 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_AO_HOST_INTERRUPT_STATUS, |
| 3757 | A6XX_GMU_AO_HOST_INTERRUPT_STATUS), |
| 3758 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_AO_HOST_INTERRUPT_MASK, |
| 3759 | A6XX_GMU_AO_HOST_INTERRUPT_MASK), |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 3760 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_PWR_COL_KEEPALIVE, |
| 3761 | A6XX_GMU_GMU_PWR_COL_KEEPALIVE), |
| 3762 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_AHB_FENCE_STATUS, |
| 3763 | A6XX_GMU_AHB_FENCE_STATUS), |
| 3764 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_HFI_CTRL_STATUS, |
| 3765 | A6XX_GMU_HFI_CTRL_STATUS), |
| 3766 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_HFI_VERSION_INFO, |
| 3767 | A6XX_GMU_HFI_VERSION_INFO), |
| 3768 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_HFI_SFR_ADDR, |
| 3769 | A6XX_GMU_HFI_SFR_ADDR), |
| 3770 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_RPMH_POWER_STATE, |
George Shen | f2d4e05 | 2017-05-11 16:28:23 -0700 | [diff] [blame] | 3771 | A6XX_GPU_GMU_CX_GMU_RPMH_POWER_STATE), |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 3772 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_GMU2HOST_INTR_CLR, |
| 3773 | A6XX_GMU_GMU2HOST_INTR_CLR), |
| 3774 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_GMU2HOST_INTR_INFO, |
| 3775 | A6XX_GMU_GMU2HOST_INTR_INFO), |
Kyle Piefer | e7b06b4 | 2017-04-06 13:53:01 -0700 | [diff] [blame] | 3776 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_GMU2HOST_INTR_MASK, |
| 3777 | A6XX_GMU_GMU2HOST_INTR_MASK), |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 3778 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_HOST2GMU_INTR_SET, |
| 3779 | A6XX_GMU_HOST2GMU_INTR_SET), |
| 3780 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_HOST2GMU_INTR_CLR, |
| 3781 | A6XX_GMU_HOST2GMU_INTR_CLR), |
| 3782 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_HOST2GMU_INTR_RAW_INFO, |
| 3783 | A6XX_GMU_HOST2GMU_INTR_RAW_INFO), |
George Shen | 6927d8f | 2017-07-19 11:38:10 -0700 | [diff] [blame] | 3784 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_NMI_CONTROL_STATUS, |
| 3785 | A6XX_GMU_NMI_CONTROL_STATUS), |
| 3786 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_CM3_CFG, |
| 3787 | A6XX_GMU_CM3_CFG), |
Deepak Kumar | 7c6f008 | 2018-04-27 15:23:10 +0530 | [diff] [blame] | 3788 | ADRENO_REG_DEFINE(ADRENO_REG_GMU_RBBM_INT_UNMASKED_STATUS, |
| 3789 | A6XX_GMU_RBBM_INT_UNMASKED_STATUS), |
Carter Cooper | 4a313ae | 2017-02-23 11:11:56 -0700 | [diff] [blame] | 3790 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_SECVID_TRUST_CONTROL, |
| 3791 | A6XX_RBBM_SECVID_TRUST_CNTL), |
| 3792 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_SECVID_TSB_TRUSTED_BASE, |
| 3793 | A6XX_RBBM_SECVID_TSB_TRUSTED_BASE_LO), |
| 3794 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_SECVID_TSB_TRUSTED_BASE_HI, |
| 3795 | A6XX_RBBM_SECVID_TSB_TRUSTED_BASE_HI), |
| 3796 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_SECVID_TSB_TRUSTED_SIZE, |
| 3797 | A6XX_RBBM_SECVID_TSB_TRUSTED_SIZE), |
| 3798 | ADRENO_REG_DEFINE(ADRENO_REG_RBBM_SECVID_TSB_CONTROL, |
| 3799 | A6XX_RBBM_SECVID_TSB_CNTL), |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3800 | }; |
| 3801 | |
| 3802 | static const struct adreno_reg_offsets a6xx_reg_offsets = { |
| 3803 | .offsets = a6xx_register_offsets, |
| 3804 | .offset_0 = ADRENO_REG_REGISTER_MAX, |
| 3805 | }; |
| 3806 | |
Tarun Karra | 1382e51 | 2017-10-30 19:41:25 -0700 | [diff] [blame] | 3807 | static int a6xx_perfcounter_update(struct adreno_device *adreno_dev, |
| 3808 | struct adreno_perfcount_register *reg, bool update_reg) |
| 3809 | { |
| 3810 | struct kgsl_device *device = KGSL_DEVICE(adreno_dev); |
| 3811 | struct cpu_gpu_lock *lock = adreno_dev->pwrup_reglist.hostptr; |
| 3812 | struct reg_list_pair *reg_pair = (struct reg_list_pair *)(lock + 1); |
| 3813 | unsigned int i; |
| 3814 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
| 3815 | int ret = 0; |
| 3816 | |
| 3817 | lock->flag_kmd = 1; |
| 3818 | /* Write flag_kmd before turn */ |
| 3819 | wmb(); |
| 3820 | lock->turn = 0; |
| 3821 | /* Write these fields before looping */ |
| 3822 | mb(); |
| 3823 | |
| 3824 | /* |
| 3825 | * Spin here while GPU ucode holds the lock, lock->flag_ucode will |
| 3826 | * be set to 0 after GPU ucode releases the lock. Minimum wait time |
| 3827 | * is 1 second and this should be enough for GPU to release the lock |
| 3828 | */ |
| 3829 | while (lock->flag_ucode == 1 && lock->turn == 0) { |
| 3830 | cpu_relax(); |
| 3831 | /* Get the latest updates from GPU */ |
| 3832 | rmb(); |
| 3833 | /* |
| 3834 | * Make sure we wait at least 1sec for the lock, |
| 3835 | * if we did not get it after 1sec return an error. |
| 3836 | */ |
| 3837 | if (time_after(jiffies, timeout) && |
| 3838 | (lock->flag_ucode == 1 && lock->turn == 0)) { |
| 3839 | ret = -EBUSY; |
| 3840 | goto unlock; |
| 3841 | } |
| 3842 | } |
| 3843 | |
| 3844 | /* Read flag_ucode and turn before list_length */ |
| 3845 | rmb(); |
| 3846 | /* |
| 3847 | * If the perfcounter select register is already present in reglist |
| 3848 | * update it, otherwise append the <select register, value> pair to |
| 3849 | * the end of the list. |
| 3850 | */ |
| 3851 | for (i = 0; i < lock->list_length >> 1; i++) |
| 3852 | if (reg_pair[i].offset == reg->select) |
| 3853 | break; |
| 3854 | |
| 3855 | reg_pair[i].offset = reg->select; |
| 3856 | reg_pair[i].val = reg->countable; |
| 3857 | if (i == lock->list_length >> 1) |
| 3858 | lock->list_length += 2; |
| 3859 | |
| 3860 | if (update_reg) |
| 3861 | kgsl_regwrite(device, reg->select, reg->countable); |
| 3862 | |
| 3863 | unlock: |
| 3864 | /* All writes done before releasing the lock */ |
| 3865 | wmb(); |
| 3866 | lock->flag_kmd = 0; |
| 3867 | return ret; |
| 3868 | } |
| 3869 | |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3870 | struct adreno_gpudev adreno_a6xx_gpudev = { |
| 3871 | .reg_offsets = &a6xx_reg_offsets, |
| 3872 | .start = a6xx_start, |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 3873 | .snapshot = a6xx_snapshot, |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3874 | .irq = &a6xx_irq, |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 3875 | .snapshot_data = &a6xx_snapshot_data, |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3876 | .irq_trace = trace_kgsl_a5xx_irq_status, |
| 3877 | .num_prio_levels = KGSL_PRIORITY_MAX_RB_LEVELS, |
| 3878 | .platform_setup = a6xx_platform_setup, |
Shrenuj Bansal | 4166540 | 2016-12-16 15:25:54 -0800 | [diff] [blame] | 3879 | .init = a6xx_init, |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3880 | .rb_start = a6xx_rb_start, |
| 3881 | .regulator_enable = a6xx_sptprac_enable, |
| 3882 | .regulator_disable = a6xx_sptprac_disable, |
Lynus Vaz | 107d289 | 2017-03-01 13:48:06 +0530 | [diff] [blame] | 3883 | .perfcounters = &a6xx_perfcounters, |
Lynus Vaz | 856ca60 | 2017-05-24 16:56:36 +0530 | [diff] [blame] | 3884 | .enable_pwr_counters = a6xx_enable_pwr_counters, |
Oleg Perelet | c2ab7f7 | 2017-06-22 16:45:57 -0700 | [diff] [blame] | 3885 | .count_throttles = a6xx_count_throttles, |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3886 | .microcode_read = a6xx_microcode_read, |
| 3887 | .enable_64bit = a6xx_enable_64bit, |
Sushmita Susheelendra | 7f66cf7 | 2016-09-12 11:04:43 -0600 | [diff] [blame] | 3888 | .llc_configure_gpu_scid = a6xx_llc_configure_gpu_scid, |
Sushmita Susheelendra | 906564d | 2017-01-10 15:53:55 -0700 | [diff] [blame] | 3889 | .llc_configure_gpuhtw_scid = a6xx_llc_configure_gpuhtw_scid, |
Kyle Piefer | 11a48b6 | 2017-03-17 14:53:40 -0700 | [diff] [blame] | 3890 | .llc_enable_overrides = a6xx_llc_enable_overrides, |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 3891 | .oob_set = a6xx_oob_set, |
| 3892 | .oob_clear = a6xx_oob_clear, |
Carter Cooper | df7ba70 | 2017-03-20 11:28:04 -0600 | [diff] [blame] | 3893 | .gpu_keepalive = a6xx_gpu_keepalive, |
Kyle Piefer | b1027b0 | 2017-02-10 13:58:58 -0800 | [diff] [blame] | 3894 | .rpmh_gpu_pwrctrl = a6xx_rpmh_gpu_pwrctrl, |
Oleg Perelet | 62d5cec | 2017-03-27 16:14:52 -0700 | [diff] [blame] | 3895 | .hw_isidle = a6xx_hw_isidle, /* Replaced by NULL if GMU is disabled */ |
Kyle Piefer | 4033f56 | 2017-08-16 10:00:48 -0700 | [diff] [blame] | 3896 | .wait_for_lowest_idle = a6xx_wait_for_lowest_idle, |
Lynus Vaz | 1fde74d | 2017-03-20 18:02:47 +0530 | [diff] [blame] | 3897 | .wait_for_gmu_idle = a6xx_wait_for_gmu_idle, |
| 3898 | .iommu_fault_block = a6xx_iommu_fault_block, |
Shrenuj Bansal | d0fe746 | 2017-05-08 16:11:19 -0700 | [diff] [blame] | 3899 | .reset = a6xx_reset, |
Shrenuj Bansal | 49d0e9f | 2017-05-08 16:10:24 -0700 | [diff] [blame] | 3900 | .soft_reset = a6xx_soft_reset, |
Harshdeep Dhatt | 0cdc899 | 2017-05-31 15:44:05 -0600 | [diff] [blame] | 3901 | .preemption_pre_ibsubmit = a6xx_preemption_pre_ibsubmit, |
| 3902 | .preemption_post_ibsubmit = a6xx_preemption_post_ibsubmit, |
| 3903 | .preemption_init = a6xx_preemption_init, |
| 3904 | .preemption_schedule = a6xx_preemption_schedule, |
Harshdeep Dhatt | aae850c | 2017-08-21 17:19:26 -0600 | [diff] [blame] | 3905 | .set_marker = a6xx_set_marker, |
Harshdeep Dhatt | 2e42f12 | 2017-05-31 17:27:19 -0600 | [diff] [blame] | 3906 | .preemption_context_init = a6xx_preemption_context_init, |
| 3907 | .preemption_context_destroy = a6xx_preemption_context_destroy, |
Shrenuj Bansal | d197bf6 | 2017-04-07 11:00:09 -0700 | [diff] [blame] | 3908 | .gx_is_on = a6xx_gx_is_on, |
| 3909 | .sptprac_is_on = a6xx_sptprac_is_on, |
Harshdeep Dhatt | 6ba7a94 | 2017-08-21 17:53:52 -0600 | [diff] [blame] | 3910 | .ccu_invalidate = a6xx_ccu_invalidate, |
Tarun Karra | 1382e51 | 2017-10-30 19:41:25 -0700 | [diff] [blame] | 3911 | .perfcounter_update = a6xx_perfcounter_update, |
Lokesh Batra | a8300e0 | 2017-05-25 11:17:40 -0700 | [diff] [blame] | 3912 | .coresight = {&a6xx_coresight, &a6xx_coresight_cx}, |
Shrenuj Bansal | acf1ef4 | 2016-06-01 11:11:27 -0700 | [diff] [blame] | 3913 | }; |