1 // SPDX-License-Identifier: GPL-2.0+ 2 /* Copyright (C) 2015-2018 Broadcom */ 3 4 #include <linux/delay.h> 5 #include <linux/mutex.h> 6 #include <linux/pm_runtime.h> 7 #include <linux/spinlock_types.h> 8 #include <linux/workqueue.h> 9 10 #include <drm/drm_device.h> 11 #include <drm/drm_exec.h> 12 #include <drm/drm_gem.h> 13 #include <drm/drm_gem_shmem_helper.h> 14 #include <drm/gpu_scheduler.h> 15 16 #include "v3d_performance_counters.h" 17 18 #include "uapi/drm/v3d_drm.h" 19 20 struct clk; 21 struct platform_device; 22 struct reset_control; 23 24 #define V3D_MMU_PAGE_SHIFT 12 25 #define V3D_PAGE_FACTOR (PAGE_SIZE >> V3D_MMU_PAGE_SHIFT) 26 27 #define V3D_MAX_QUEUES (V3D_CPU + 1) 28 29 static inline char *v3d_queue_to_string(enum v3d_queue queue) 30 { 31 switch (queue) { 32 case V3D_BIN: return "bin"; 33 case V3D_RENDER: return "render"; 34 case V3D_TFU: return "tfu"; 35 case V3D_CSD: return "csd"; 36 case V3D_CACHE_CLEAN: return "cache_clean"; 37 case V3D_CPU: return "cpu"; 38 } 39 return "UNKNOWN"; 40 } 41 42 struct v3d_stats { 43 struct kref refcount; 44 45 u64 start_ns; 46 u64 enabled_ns; 47 u64 jobs_completed; 48 49 /* 50 * This seqcount is used to protect the access to the GPU stats 51 * variables. It must be used as, while we are reading the stats, 52 * IRQs can happen and the stats can be updated. 53 * 54 * However, we use the raw seqcount helpers to interact with this lock 55 * to avoid false positives from lockdep, which is unable to detect that 56 * our readers are never from irq or softirq context, and that, for CPU 57 * job queues, even the write side never is. 58 */ 59 seqcount_t lock; 60 61 atomic_t reset_counter; 62 }; 63 64 struct v3d_queue_state { 65 struct drm_gpu_scheduler sched; 66 67 u64 fence_context; 68 u64 emit_seqno; 69 70 /* Stores the GPU stats for this queue in the global context. */ 71 struct v3d_stats *stats; 72 73 /* Currently active job for this queue */ 74 struct v3d_job *active_job; 75 spinlock_t queue_lock; 76 }; 77 78 /* Performance monitor object 79 * 80 * The performance monitor (perfmon) lifetime is controlled by userspace using 81 * perfmon related ioctls. A perfmon can be attached to a CL or CSD submission 82 * request, and when it is, HW performance counters will be activated just 83 * before the job is submitted to the GPU and disabled when the job is done. 84 * This way, only events related to a specific submission will be counted. 85 */ 86 struct v3d_perfmon { 87 struct v3d_dev *v3d; 88 89 /* Tracks the number of users of the perfmon, when this counter reaches 90 * zero the perfmon is destroyed. 91 */ 92 refcount_t refcnt; 93 94 /* Number of counters activated in this perfmon instance 95 * (should be less than DRM_V3D_MAX_PERF_COUNTERS). 96 */ 97 u8 ncounters; 98 99 /* Events counted by the HW perf counters. */ 100 u8 counters[DRM_V3D_MAX_PERF_COUNTERS]; 101 102 /* Storage for counter values. Counters are incremented by the 103 * HW perf counter values every time the perfmon is attached 104 * to a GPU job. This way, perfmon users don't have to 105 * retrieve the results after each job if they want to track 106 * events covering several submissions. Note that counter 107 * values can't be reset, but you can fake a reset by 108 * destroying the perfmon and creating a new one. 109 */ 110 u64 values[] __counted_by(ncounters); 111 }; 112 113 enum v3d_gen { 114 V3D_GEN_33 = 33, 115 V3D_GEN_41 = 41, 116 V3D_GEN_42 = 42, 117 V3D_GEN_71 = 71, 118 }; 119 120 enum v3d_irq { 121 V3D_CORE_IRQ, 122 V3D_HUB_IRQ, 123 V3D_MAX_IRQS, 124 }; 125 126 struct v3d_dev { 127 struct drm_device drm; 128 129 /* Short representation (e.g. 33, 41) of the V3D tech version */ 130 enum v3d_gen ver; 131 132 /* Short representation (e.g. 5, 6) of the V3D tech revision */ 133 int rev; 134 135 bool single_irq_line; 136 137 int irq[V3D_MAX_IRQS]; 138 139 struct v3d_perfmon_info perfmon_info; 140 141 void __iomem *hub_regs; 142 void __iomem *core_regs[3]; 143 void __iomem *bridge_regs; 144 void __iomem *gca_regs; 145 void __iomem *sms_regs; 146 struct clk *clk; 147 struct reset_control *reset; 148 149 /* Virtual and DMA addresses of the single shared page table. */ 150 volatile u32 *pt; 151 dma_addr_t pt_paddr; 152 153 /* Virtual and DMA addresses of the MMU's scratch page. When 154 * a read or write is invalid in the MMU, it will be 155 * redirected here. 156 */ 157 void *mmu_scratch; 158 dma_addr_t mmu_scratch_paddr; 159 /* virtual address bits from V3D to the MMU. */ 160 int va_width; 161 162 /* Number of V3D cores. */ 163 u32 cores; 164 165 /* Allocator managing the address space. All units are in 166 * number of pages. 167 */ 168 struct drm_mm mm; 169 spinlock_t mm_lock; 170 171 struct work_struct overflow_mem_work; 172 173 struct v3d_queue_state queue[V3D_MAX_QUEUES]; 174 175 /* 176 * Tracks the performance monitor state and consistency. 177 * 178 * When a non-global perfmon is attached to a job, the scheduler must 179 * not run any other job on the HW concurrently (otherwise, the 180 * counters would be polluted by unrelated work). 181 */ 182 struct { 183 /* Protects @active. */ 184 spinlock_t lock; 185 186 /* Perfmon currently programmed in HW (or NULL if none). */ 187 struct v3d_perfmon *active; 188 189 /* Number of perfmons alive on this device. Jobs are not 190 * serialized if the number is zero. 191 */ 192 atomic_t nperfmons; 193 194 /* Finished fence of the most recently submitted job that 195 * opened a serialization window (i.e. a job with a non-global 196 * perfmon attached). 197 */ 198 struct dma_fence *fence; 199 200 /* Finished fence of the most recently submitted job on each HW 201 * queue, which is used so that a new perfmon-carrying job can 202 * depend on every job currently in-flight across all queues. 203 * 204 * Finished fences are only tracked if @nperfmons > 0 and no 205 * global perfmon is set. 206 */ 207 struct dma_fence *last_hw_fence[V3D_MAX_QUEUES]; 208 } perfmon_state; 209 210 /* Protects bo_stats */ 211 struct mutex bo_lock; 212 213 /* Ordered workqueue shared by every queue's scheduler timeout work. 214 * V3D reset is global to all queues, so the timeout handlers must not 215 * run concurrently. 216 */ 217 struct workqueue_struct *reset_wq; 218 219 /* Lock taken when creating and pushing the GPU scheduler 220 * jobs, to keep the sched-fence seqnos in order. 221 */ 222 struct mutex sched_lock; 223 224 /* Lock taken during a cache clean and when initiating an L2 225 * flush, to keep L2 flushes from interfering with the 226 * synchronous L2 cleans. 227 */ 228 struct mutex cache_clean_lock; 229 230 struct { 231 u32 num_allocated; 232 u32 pages_allocated; 233 } bo_stats; 234 235 /* To support a performance analysis tool in user space, we require 236 * a single, globally configured performance monitor (perfmon) for 237 * all jobs. 238 */ 239 struct v3d_perfmon *global_perfmon; 240 241 /* Global reset counter incremented on each GPU reset. */ 242 atomic_t reset_counter; 243 }; 244 245 static inline struct v3d_dev * 246 to_v3d_dev(struct drm_device *dev) 247 { 248 return container_of(dev, struct v3d_dev, drm); 249 } 250 251 static inline bool 252 v3d_has_csd(struct v3d_dev *v3d) 253 { 254 return v3d->ver >= V3D_GEN_41; 255 } 256 257 #define v3d_to_pdev(v3d) to_platform_device((v3d)->drm.dev) 258 259 /* The per-fd struct, which tracks the MMU mappings. */ 260 struct v3d_file_priv { 261 struct v3d_dev *v3d; 262 263 struct xarray perfmons; 264 265 struct drm_sched_entity sched_entity[V3D_MAX_QUEUES]; 266 267 /* Stores the GPU stats for a specific queue for this fd. */ 268 struct v3d_stats *stats[V3D_MAX_QUEUES]; 269 }; 270 271 struct v3d_bo { 272 struct drm_gem_shmem_object base; 273 274 struct drm_mm_node node; 275 276 /* List entry for the BO's position in 277 * v3d_render_job->unref_list 278 */ 279 struct list_head unref_head; 280 281 void *vaddr; 282 }; 283 284 static inline struct v3d_bo * 285 to_v3d_bo(struct drm_gem_object *bo) 286 { 287 return (struct v3d_bo *)bo; 288 } 289 290 struct v3d_fence { 291 struct dma_fence base; 292 struct drm_device *dev; 293 /* v3d seqno for signaled() test */ 294 u64 seqno; 295 enum v3d_queue queue; 296 }; 297 298 static inline struct v3d_fence * 299 to_v3d_fence(struct dma_fence *fence) 300 { 301 return (struct v3d_fence *)fence; 302 } 303 304 #define V3D_READ(offset) readl(v3d->hub_regs + offset) 305 #define V3D_WRITE(offset, val) writel(val, v3d->hub_regs + offset) 306 307 #define V3D_BRIDGE_READ(offset) readl(v3d->bridge_regs + offset) 308 #define V3D_BRIDGE_WRITE(offset, val) writel(val, v3d->bridge_regs + offset) 309 310 #define V3D_GCA_READ(offset) readl(v3d->gca_regs + offset) 311 #define V3D_GCA_WRITE(offset, val) writel(val, v3d->gca_regs + offset) 312 313 #define V3D_SMS_IDLE 0x0 314 #define V3D_SMS_ISOLATING_FOR_RESET 0xa 315 #define V3D_SMS_RESETTING 0xb 316 #define V3D_SMS_ISOLATING_FOR_POWER_OFF 0xc 317 #define V3D_SMS_POWER_OFF_STATE 0xd 318 319 #define V3D_SMS_READ(offset) readl(v3d->sms_regs + (offset)) 320 #define V3D_SMS_WRITE(offset, val) writel(val, v3d->sms_regs + (offset)) 321 322 #define V3D_CORE_READ(core, offset) readl(v3d->core_regs[core] + offset) 323 #define V3D_CORE_WRITE(core, offset, val) writel(val, v3d->core_regs[core] + offset) 324 325 #define V3D_MAX_JOBS_PER_SUBMISSION 3 326 327 /* Per-ioctl submission context */ 328 struct v3d_submit { 329 struct v3d_dev *v3d; 330 331 struct drm_file *file_priv; 332 333 /* DRM exec context for this submission. */ 334 struct drm_exec exec; 335 336 /* Ordered array of jobs forming the submission chain. Jobs are 337 * appended via v3d_submit_add_job(), then chained and pushed to 338 * the scheduler by v3d_submit_jobs(). 339 */ 340 struct v3d_job *jobs[V3D_MAX_JOBS_PER_SUBMISSION]; 341 342 /* Number of jobs currently in @jobs. */ 343 u32 job_count; 344 }; 345 346 struct v3d_job { 347 struct drm_sched_job base; 348 349 struct kref refcount; 350 351 struct v3d_dev *v3d; 352 353 /* The queue that the job was submitted on. */ 354 enum v3d_queue queue; 355 356 /* This is the array of BOs that were looked up at the start 357 * of submission. 358 */ 359 struct drm_gem_object **bo; 360 u32 bo_count; 361 362 /* v3d fence to be signaled by IRQ handler when the job is complete. */ 363 struct dma_fence *irq_fence; 364 365 /* scheduler fence for when the job is considered complete and 366 * the BO reservations can be released. 367 */ 368 struct dma_fence *done_fence; 369 370 /* Pointer to a performance monitor object if the user requested it, 371 * NULL otherwise. 372 */ 373 struct v3d_perfmon *perfmon; 374 375 /* File descriptor of the process that submitted the job that could be used 376 * to collect per-process information about the GPU. 377 */ 378 struct v3d_file_priv *file_priv; 379 380 /* Pointers to this job's per-fd and global queue stats. */ 381 struct v3d_stats *client_stats; 382 struct v3d_stats *global_stats; 383 384 /* Callback for the freeing of the job on refcount going to 0. */ 385 void (*free)(struct kref *ref); 386 387 bool has_pm_ref; 388 389 /* Whether the job needs implicit dependencies, i.e. must wait for 390 * other contexts still writing its BOs. 391 */ 392 bool has_implicit_dep; 393 }; 394 395 struct v3d_bin_job { 396 struct v3d_job base; 397 398 /* GPU virtual addresses of the start/end of the CL job. */ 399 u32 start, end; 400 401 u32 timedout_ctca, timedout_ctra; 402 403 /* Corresponding render job, for attaching our overflow memory. */ 404 struct v3d_render_job *render; 405 406 /* Submitted tile memory allocation start/size, tile state. */ 407 u32 qma, qms, qts; 408 }; 409 410 struct v3d_render_job { 411 struct v3d_job base; 412 413 /* GPU virtual addresses of the start/end of the CL job. */ 414 u32 start, end; 415 416 u32 timedout_ctca, timedout_ctra; 417 418 /* List of overflow BOs used in the job that need to be 419 * released once the job is complete. 420 */ 421 struct list_head unref_list; 422 }; 423 424 struct v3d_tfu_job { 425 struct v3d_job base; 426 427 struct drm_v3d_submit_tfu args; 428 }; 429 430 struct v3d_csd_job { 431 struct v3d_job base; 432 433 u32 timedout_batches; 434 435 struct drm_v3d_submit_csd args; 436 }; 437 438 enum v3d_cpu_job_type { 439 V3D_CPU_JOB_TYPE_INDIRECT_CSD = 1, 440 V3D_CPU_JOB_TYPE_TIMESTAMP_QUERY, 441 V3D_CPU_JOB_TYPE_RESET_TIMESTAMP_QUERY, 442 V3D_CPU_JOB_TYPE_COPY_TIMESTAMP_QUERY, 443 V3D_CPU_JOB_TYPE_RESET_PERFORMANCE_QUERY, 444 V3D_CPU_JOB_TYPE_COPY_PERFORMANCE_QUERY, 445 }; 446 447 struct v3d_timestamp_query { 448 /* Offset of this query in the timestamp BO for its value. */ 449 u32 offset; 450 451 /* Syncobj that indicates the timestamp availability */ 452 struct drm_syncobj *syncobj; 453 }; 454 455 struct v3d_performance_query { 456 /* Performance monitor IDs for this query */ 457 u32 *kperfmon_ids; 458 459 /* Syncobj that indicates the query availability */ 460 struct drm_syncobj *syncobj; 461 }; 462 463 struct v3d_indirect_csd_info { 464 /* Indirect CSD */ 465 struct v3d_csd_job *job; 466 467 /* Indirect CSD args, stashed by the extension parser and later used 468 * to create the CSD job from them. 469 */ 470 struct drm_v3d_submit_csd args; 471 472 /* Offset within the BO where the workgroup counts are stored */ 473 u32 offset; 474 475 /* Workgroups size */ 476 u32 wg_size; 477 478 /* Indices of the uniforms with the workgroup dispatch counts 479 * in the uniform stream. 480 */ 481 u32 wg_uniform_offsets[3]; 482 483 /* Indirect BO */ 484 struct drm_gem_object *indirect; 485 }; 486 487 struct v3d_timestamp_query_info { 488 struct v3d_timestamp_query *queries; 489 490 u32 count; 491 }; 492 493 struct v3d_performance_query_info { 494 struct v3d_performance_query *queries; 495 496 /* Number of performance queries */ 497 u32 count; 498 499 /* Number of performance monitors related to that query pool */ 500 u32 nperfmons; 501 502 /* Number of performance counters related to that query pool */ 503 u32 ncounters; 504 }; 505 506 struct v3d_copy_query_results_info { 507 /* Define if should write to buffer using 64 or 32 bits */ 508 bool do_64bit; 509 510 /* Define if it can write to buffer even if the query is not available */ 511 bool do_partial; 512 513 /* Define if it should write availability bit to buffer */ 514 bool availability_bit; 515 516 /* Offset of the copy buffer in the BO */ 517 u32 offset; 518 519 /* Stride of the copy buffer in the BO */ 520 u32 stride; 521 }; 522 523 struct v3d_cpu_job { 524 struct v3d_job base; 525 526 enum v3d_cpu_job_type job_type; 527 528 struct v3d_indirect_csd_info indirect_csd; 529 530 struct v3d_timestamp_query_info timestamp_query; 531 532 struct v3d_copy_query_results_info copy; 533 534 struct v3d_performance_query_info performance_query; 535 }; 536 537 typedef void (*v3d_cpu_job_fn)(struct v3d_cpu_job *); 538 539 struct v3d_submit_outsync { 540 struct drm_syncobj *syncobj; 541 }; 542 543 struct v3d_submit_ext { 544 u32 flags; 545 u32 wait_stage; 546 547 u32 in_sync_count; 548 u64 in_syncs; 549 550 u32 out_sync_count; 551 struct v3d_submit_outsync *out_syncs; 552 }; 553 554 /** 555 * __wait_for - magic wait macro 556 * 557 * Macro to help avoid open coding check/wait/timeout patterns. Note that it's 558 * important that we check the condition again after having timed out, since the 559 * timeout could be due to preemption or similar and we've never had a chance to 560 * check the condition before the timeout. 561 */ 562 #define __wait_for(OP, COND, US, Wmin, Wmax) ({ \ 563 const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ 564 long wait__ = (Wmin); /* recommended min for usleep is 10 us */ \ 565 int ret__; \ 566 might_sleep(); \ 567 for (;;) { \ 568 const bool expired__ = ktime_after(ktime_get_raw(), end__); \ 569 OP; \ 570 /* Guarantee COND check prior to timeout */ \ 571 barrier(); \ 572 if (COND) { \ 573 ret__ = 0; \ 574 break; \ 575 } \ 576 if (expired__) { \ 577 ret__ = -ETIMEDOUT; \ 578 break; \ 579 } \ 580 usleep_range(wait__, wait__ * 2); \ 581 if (wait__ < (Wmax)) \ 582 wait__ <<= 1; \ 583 } \ 584 ret__; \ 585 }) 586 587 #define _wait_for(COND, US, Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ 588 (Wmax)) 589 #define wait_for(COND, MS) _wait_for((COND), (MS) * 1000, 10, 1000) 590 591 static inline unsigned long nsecs_to_jiffies_timeout(const u64 n) 592 { 593 /* nsecs_to_jiffies64() does not guard against overflow */ 594 if ((NSEC_PER_SEC % HZ) != 0 && 595 div_u64(n, NSEC_PER_SEC) >= MAX_JIFFY_OFFSET / HZ) 596 return MAX_JIFFY_OFFSET; 597 598 return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1); 599 } 600 601 /* v3d_bo.c */ 602 struct drm_gem_object *v3d_create_object(struct drm_device *dev, size_t size); 603 void v3d_free_object(struct drm_gem_object *gem_obj); 604 struct v3d_bo *v3d_bo_create(struct drm_device *dev, struct drm_file *file_priv, 605 size_t size); 606 void v3d_get_bo_vaddr(struct v3d_bo *bo); 607 void v3d_put_bo_vaddr(struct v3d_bo *bo); 608 int v3d_create_bo_ioctl(struct drm_device *dev, void *data, 609 struct drm_file *file_priv); 610 int v3d_mmap_bo_ioctl(struct drm_device *dev, void *data, 611 struct drm_file *file_priv); 612 int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data, 613 struct drm_file *file_priv); 614 int v3d_wait_bo_ioctl(struct drm_device *dev, void *data, 615 struct drm_file *file_priv); 616 struct drm_gem_object *v3d_prime_import_sg_table(struct drm_device *dev, 617 struct dma_buf_attachment *attach, 618 struct sg_table *sgt); 619 620 /* v3d_debugfs.c */ 621 void v3d_debugfs_init(struct drm_minor *minor); 622 623 /* v3d_drv.c */ 624 void v3d_get_stats(const struct v3d_stats *stats, u64 timestamp, 625 u64 *active_runtime, u64 *jobs_completed); 626 627 /* v3d_fence.c */ 628 extern const struct dma_fence_ops v3d_fence_ops; 629 struct dma_fence *v3d_fence_create(struct v3d_dev *v3d, enum v3d_queue q); 630 631 /* v3d_gem.c */ 632 extern bool super_pages; 633 void v3d_init_hw_state(struct v3d_dev *v3d); 634 int v3d_gem_init(struct drm_device *dev); 635 void v3d_gem_destroy(struct drm_device *dev); 636 void v3d_idle_axi(struct v3d_dev *v3d, int core); 637 void v3d_idle_gca(struct v3d_dev *v3d); 638 void v3d_reset_sms(struct v3d_dev *v3d); 639 void v3d_reset(struct v3d_dev *v3d); 640 void v3d_invalidate_caches(struct v3d_dev *v3d); 641 void v3d_clean_caches(struct v3d_dev *v3d); 642 643 /* v3d_submit.c */ 644 void v3d_job_cleanup(struct v3d_job *job); 645 void v3d_job_put(struct v3d_job *job); 646 int v3d_submit_cl_ioctl(struct drm_device *dev, void *data, 647 struct drm_file *file_priv); 648 int v3d_submit_tfu_ioctl(struct drm_device *dev, void *data, 649 struct drm_file *file_priv); 650 int v3d_submit_csd_ioctl(struct drm_device *dev, void *data, 651 struct drm_file *file_priv); 652 int v3d_submit_cpu_ioctl(struct drm_device *dev, void *data, 653 struct drm_file *file_priv); 654 655 /* v3d_irq.c */ 656 int v3d_irq_init(struct v3d_dev *v3d); 657 void v3d_irq_enable(struct v3d_dev *v3d); 658 void v3d_irq_disable(struct v3d_dev *v3d); 659 void v3d_irq_reset(struct v3d_dev *v3d); 660 661 /* v3d_mmu.c */ 662 int v3d_mmu_flush_all(struct v3d_dev *v3d); 663 int v3d_mmu_set_page_table(struct v3d_dev *v3d); 664 void v3d_mmu_insert_ptes(struct v3d_bo *bo); 665 void v3d_mmu_remove_ptes(struct v3d_bo *bo); 666 667 /* v3d_power.c */ 668 int v3d_power_suspend(struct device *dev); 669 int v3d_power_resume(struct device *dev); 670 671 static __always_inline int v3d_pm_runtime_get(struct v3d_dev *v3d) 672 { 673 return pm_runtime_resume_and_get(v3d->drm.dev); 674 } 675 676 static __always_inline int v3d_pm_runtime_put(struct v3d_dev *v3d) 677 { 678 return pm_runtime_put_autosuspend(v3d->drm.dev); 679 } 680 681 /* v3d_sched.c */ 682 void v3d_timestamp_query_info_free(struct v3d_timestamp_query_info *query_info, 683 unsigned int count); 684 void v3d_performance_query_info_free(struct v3d_performance_query_info *query_info, 685 unsigned int count); 686 struct v3d_stats *v3d_stats_alloc(void); 687 void v3d_stats_release(struct kref *refcount); 688 void v3d_job_update_stats(struct v3d_job *job); 689 int v3d_sched_init(struct v3d_dev *v3d); 690 void v3d_sched_fini(struct v3d_dev *v3d); 691 692 static inline struct v3d_stats *v3d_stats_get(struct v3d_stats *stats) 693 { 694 kref_get(&stats->refcount); 695 return stats; 696 } 697 698 static inline void v3d_stats_put(struct v3d_stats *stats) 699 { 700 kref_put(&stats->refcount, v3d_stats_release); 701 } 702 703 /* v3d_perfmon.c */ 704 void v3d_perfmon_init(struct v3d_dev *v3d); 705 void v3d_perfmon_get(struct v3d_perfmon *perfmon); 706 void v3d_perfmon_put(struct v3d_perfmon *perfmon); 707 void v3d_perfmon_start(struct v3d_dev *v3d, struct v3d_perfmon *perfmon); 708 void v3d_perfmon_stop(struct v3d_dev *v3d, struct v3d_perfmon *perfmon, 709 bool capture); 710 void v3d_perfmon_suspend(struct v3d_dev *v3d); 711 void v3d_perfmon_resume(struct v3d_dev *v3d); 712 struct v3d_perfmon *v3d_perfmon_find(struct v3d_file_priv *v3d_priv, int id); 713 void v3d_perfmon_open_file(struct v3d_file_priv *v3d_priv); 714 void v3d_perfmon_close_file(struct v3d_file_priv *v3d_priv); 715 int v3d_perfmon_create_ioctl(struct drm_device *dev, void *data, 716 struct drm_file *file_priv); 717 int v3d_perfmon_destroy_ioctl(struct drm_device *dev, void *data, 718 struct drm_file *file_priv); 719 int v3d_perfmon_get_values_ioctl(struct drm_device *dev, void *data, 720 struct drm_file *file_priv); 721 int v3d_perfmon_get_counter_ioctl(struct drm_device *dev, void *data, 722 struct drm_file *file_priv); 723 int v3d_perfmon_set_global_ioctl(struct drm_device *dev, void *data, 724 struct drm_file *file_priv); 725 726 /* v3d_sysfs.c */ 727 int v3d_sysfs_init(struct device *dev); 728 void v3d_sysfs_destroy(struct device *dev); 729