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

link_enc_cfg.h (3849B)


      1/*
      2 * Copyright 2021 Advanced Micro Devices, Inc.
      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 shall be included in
     12 * all copies or substantial portions of the Software.
     13 *
     14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     20 * OTHER DEALINGS IN THE SOFTWARE.
     21 *
     22 * Authors: AMD
     23 *
     24 */
     25
     26#ifndef DC_INC_LINK_ENC_CFG_H_
     27#define DC_INC_LINK_ENC_CFG_H_
     28
     29/* This module implements functionality for dynamically assigning DIG link
     30 * encoder resources to display endpoints (links).
     31 */
     32
     33#include "core_types.h"
     34
     35/*
     36 * Initialise link encoder resource tracking.
     37 */
     38void link_enc_cfg_init(
     39		const struct dc *dc,
     40		struct dc_state *state);
     41
     42/*
     43 * Copies a link encoder assignment from another state.
     44 */
     45void link_enc_cfg_copy(const struct dc_state *src_ctx, struct dc_state *dst_ctx);
     46
     47/*
     48 * Algorithm for assigning available DIG link encoders to streams.
     49 *
     50 * Update link_enc_assignments table and link_enc_avail list accordingly in
     51 * struct resource_context.
     52 *
     53 * Loop over all streams twice:
     54 * a) First assign encoders to unmappable endpoints.
     55 * b) Then assign encoders to mappable endpoints.
     56 */
     57void link_enc_cfg_link_encs_assign(
     58		struct dc *dc,
     59		struct dc_state *state,
     60		struct dc_stream_state *streams[],
     61		uint8_t stream_count);
     62
     63/*
     64 * Unassign a link encoder from a stream.
     65 *
     66 * Update link_enc_assignments table and link_enc_avail list accordingly in
     67 * struct resource_context.
     68 */
     69void link_enc_cfg_link_enc_unassign(
     70		struct dc_state *state,
     71		struct dc_stream_state *stream);
     72
     73/*
     74 * Check whether the transmitter driven by a link encoder is a mappable
     75 * endpoint.
     76 */
     77bool link_enc_cfg_is_transmitter_mappable(
     78		struct dc *dc,
     79		struct link_encoder *link_enc);
     80
     81/* Return stream using DIG link encoder resource. NULL if unused. */
     82struct dc_stream_state *link_enc_cfg_get_stream_using_link_enc(
     83		struct dc *dc,
     84		enum engine_id eng_id);
     85
     86/* Return link using DIG link encoder resource. NULL if unused. */
     87struct dc_link *link_enc_cfg_get_link_using_link_enc(
     88		struct dc *dc,
     89		enum engine_id eng_id);
     90
     91/* Return DIG link encoder used by link. NULL if unused. */
     92struct link_encoder *link_enc_cfg_get_link_enc_used_by_link(
     93		struct dc *dc,
     94		const struct dc_link *link);
     95
     96/* Return next available DIG link encoder. NULL if none available. */
     97struct link_encoder *link_enc_cfg_get_next_avail_link_enc(struct dc *dc);
     98
     99/* Return DIG link encoder used by stream. NULL if unused. */
    100struct link_encoder *link_enc_cfg_get_link_enc_used_by_stream(
    101		struct dc *dc,
    102		const struct dc_stream_state *stream);
    103
    104/* Return DIG link encoder. NULL if unused. */
    105struct link_encoder *link_enc_cfg_get_link_enc(const struct dc_link *link);
    106
    107/* Return true if encoder available to use. */
    108bool link_enc_cfg_is_link_enc_avail(struct dc *dc, enum engine_id eng_id, struct dc_link *link);
    109
    110/* Returns true if encoder assignments in supplied state pass validity checks. */
    111bool link_enc_cfg_validate(struct dc *dc, struct dc_state *state);
    112
    113#endif /* DC_INC_LINK_ENC_CFG_H_ */