cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

intel_breadcrumbs.h (1570B)


      1/* SPDX-License-Identifier: MIT */
      2/*
      3 * Copyright © 2019 Intel Corporation
      4 */
      5
      6#ifndef __INTEL_BREADCRUMBS__
      7#define __INTEL_BREADCRUMBS__
      8
      9#include <linux/atomic.h>
     10#include <linux/irq_work.h>
     11
     12#include "intel_breadcrumbs_types.h"
     13
     14struct drm_printer;
     15struct i915_request;
     16struct intel_breadcrumbs;
     17
     18struct intel_breadcrumbs *
     19intel_breadcrumbs_create(struct intel_engine_cs *irq_engine);
     20void intel_breadcrumbs_free(struct kref *kref);
     21
     22void intel_breadcrumbs_reset(struct intel_breadcrumbs *b);
     23void __intel_breadcrumbs_park(struct intel_breadcrumbs *b);
     24
     25static inline void intel_breadcrumbs_unpark(struct intel_breadcrumbs *b)
     26{
     27	atomic_inc(&b->active);
     28}
     29
     30static inline void intel_breadcrumbs_park(struct intel_breadcrumbs *b)
     31{
     32	if (atomic_dec_and_test(&b->active))
     33		__intel_breadcrumbs_park(b);
     34}
     35
     36static inline void
     37intel_engine_signal_breadcrumbs(struct intel_engine_cs *engine)
     38{
     39	irq_work_queue(&engine->breadcrumbs->irq_work);
     40}
     41
     42void intel_engine_print_breadcrumbs(struct intel_engine_cs *engine,
     43				    struct drm_printer *p);
     44
     45bool i915_request_enable_breadcrumb(struct i915_request *request);
     46void i915_request_cancel_breadcrumb(struct i915_request *request);
     47
     48void intel_context_remove_breadcrumbs(struct intel_context *ce,
     49				      struct intel_breadcrumbs *b);
     50
     51static inline struct intel_breadcrumbs *
     52intel_breadcrumbs_get(struct intel_breadcrumbs *b)
     53{
     54	kref_get(&b->ref);
     55	return b;
     56}
     57
     58static inline void intel_breadcrumbs_put(struct intel_breadcrumbs *b)
     59{
     60	kref_put(&b->ref, intel_breadcrumbs_free);
     61}
     62
     63#endif /* __INTEL_BREADCRUMBS__ */