Chris Wilson | 16bafdf | 2014-09-04 09:26:24 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2014 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 | * IN THE SOFTWARE. |
| 22 | */ |
| 23 | |
| 24 | #ifndef IGT_GT_H |
| 25 | #define IGT_GT_H |
| 26 | |
Daniel Vetter | 3cd45de | 2015-02-10 17:46:43 +0100 | [diff] [blame] | 27 | #include "igt_debugfs.h" |
| 28 | |
Daniel Vetter | c66b242 | 2015-02-06 10:49:20 +0100 | [diff] [blame] | 29 | void igt_require_hang_ring(int fd, int ring); |
Chris Wilson | 16bafdf | 2014-09-04 09:26:24 +0100 | [diff] [blame] | 30 | |
Daniel Vetter | 3cd45de | 2015-02-10 17:46:43 +0100 | [diff] [blame] | 31 | typedef struct igt_hang_ring { |
Chris Wilson | 16bafdf | 2014-09-04 09:26:24 +0100 | [diff] [blame] | 32 | unsigned handle; |
Chris Wilson | 19642c6 | 2015-12-11 13:27:49 +0000 | [diff] [blame] | 33 | unsigned ctx; |
Chris Wilson | 16bafdf | 2014-09-04 09:26:24 +0100 | [diff] [blame] | 34 | unsigned ban; |
Chris Wilson | 19642c6 | 2015-12-11 13:27:49 +0000 | [diff] [blame] | 35 | unsigned flags; |
Daniel Vetter | 3cd45de | 2015-02-10 17:46:43 +0100 | [diff] [blame] | 36 | } igt_hang_ring_t; |
| 37 | |
Chris Wilson | 19642c6 | 2015-12-11 13:27:49 +0000 | [diff] [blame] | 38 | #define HANG_POISON 0xc5c5c5c5 |
| 39 | |
| 40 | struct igt_hang_ring igt_hang_ctx(int fd, |
| 41 | uint32_t ctx, |
| 42 | int ring, |
| 43 | unsigned flags, |
| 44 | uint64_t *offset); |
| 45 | #define HANG_ALLOW_BAN 1 |
| 46 | #define HANG_ALLOW_CAPTURE 2 |
| 47 | |
Daniel Vetter | 3cd45de | 2015-02-10 17:46:43 +0100 | [diff] [blame] | 48 | struct igt_hang_ring igt_hang_ring(int fd, int ring); |
Thomas Wood | 26f4081 | 2015-02-20 11:31:01 +0000 | [diff] [blame] | 49 | void igt_post_hang_ring(int fd, struct igt_hang_ring arg); |
Chris Wilson | 16bafdf | 2014-09-04 09:26:24 +0100 | [diff] [blame] | 50 | |
Daniele Ceraolo Spurio | 03c7f84 | 2016-03-01 11:01:32 +0000 | [diff] [blame] | 51 | void igt_force_gpu_reset(void); |
| 52 | |
Daniel Vetter | d8d1eab | 2015-12-03 07:45:34 +0100 | [diff] [blame] | 53 | void igt_fork_hang_helper(void); |
Daniel Vetter | 3cd45de | 2015-02-10 17:46:43 +0100 | [diff] [blame] | 54 | void igt_stop_hang_helper(void); |
| 55 | |
| 56 | int igt_open_forcewake_handle(void); |
| 57 | |
Chris Wilson | a6090c7 | 2016-01-08 16:32:29 +0000 | [diff] [blame] | 58 | int igt_setup_clflush(void); |
| 59 | void igt_clflush_range(void *addr, int size); |
| 60 | |
Chris Wilson | 5b675f7 | 2016-01-22 17:33:40 +0000 | [diff] [blame] | 61 | unsigned intel_detect_and_clear_missed_interrupts(int fd); |
| 62 | |
Chris Wilson | 04f5215 | 2016-01-27 14:07:27 +0000 | [diff] [blame] | 63 | extern const struct intel_execution_engine { |
| 64 | const char *name; |
Chris Wilson | 38fe49d | 2016-02-04 11:17:42 +0000 | [diff] [blame] | 65 | const char *full_name; |
Chris Wilson | 04f5215 | 2016-01-27 14:07:27 +0000 | [diff] [blame] | 66 | unsigned exec_id; |
| 67 | unsigned flags; |
| 68 | } intel_execution_engines[]; |
| 69 | |
Chris Wilson | 697c3f5 | 2016-03-04 10:19:38 +0000 | [diff] [blame] | 70 | #define for_if(expr__) if (!(expr__)) {} else |
| 71 | |
| 72 | #define for_each_engine(fd__, flags__) \ |
| 73 | for (const struct intel_execution_engine *e__ = intel_execution_engines;\ |
| 74 | e__->name; \ |
| 75 | e__++) \ |
| 76 | for_if (gem_has_ring(fd, flags__ = e__->exec_id | e__->flags)) |
| 77 | |
| 78 | |
Chris Wilson | 16bafdf | 2014-09-04 09:26:24 +0100 | [diff] [blame] | 79 | #endif /* IGT_GT_H */ |