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

sf.h (890B)


      1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
      2/* Copyright (c) 2021 Mellanox Technologies Ltd */
      3
      4#ifndef __LIB_MLX5_SF_H__
      5#define __LIB_MLX5_SF_H__
      6
      7#include <linux/mlx5/driver.h>
      8
      9static inline u16 mlx5_sf_start_function_id(const struct mlx5_core_dev *dev)
     10{
     11	return MLX5_CAP_GEN(dev, sf_base_id);
     12}
     13
     14#ifdef CONFIG_MLX5_SF
     15
     16static inline bool mlx5_sf_supported(const struct mlx5_core_dev *dev)
     17{
     18	return MLX5_CAP_GEN(dev, sf);
     19}
     20
     21static inline u16 mlx5_sf_max_functions(const struct mlx5_core_dev *dev)
     22{
     23	if (!mlx5_sf_supported(dev))
     24		return 0;
     25	if (MLX5_CAP_GEN(dev, max_num_sf))
     26		return MLX5_CAP_GEN(dev, max_num_sf);
     27	else
     28		return 1 << MLX5_CAP_GEN(dev, log_max_sf);
     29}
     30
     31#else
     32
     33static inline bool mlx5_sf_supported(const struct mlx5_core_dev *dev)
     34{
     35	return false;
     36}
     37
     38static inline u16 mlx5_sf_max_functions(const struct mlx5_core_dev *dev)
     39{
     40	return 0;
     41}
     42
     43#endif
     44
     45#endif