brintos

brintos / linux-shallow public Read only

0
0
Text · 1.2 KiB · 688fbab Raw
48 lines · c
1/* SPDX-License-Identifier: MIT */2/*3 * Copyright © 2023 Intel Corporation4 */5 6#ifndef _XE_SRIOV_H_7#define _XE_SRIOV_H_8 9#include "xe_assert.h"10#include "xe_device_types.h"11#include "xe_sriov_types.h"12 13struct drm_printer;14 15const char *xe_sriov_mode_to_string(enum xe_sriov_mode mode);16const char *xe_sriov_function_name(unsigned int n, char *buf, size_t len);17 18void xe_sriov_probe_early(struct xe_device *xe);19void xe_sriov_print_info(struct xe_device *xe, struct drm_printer *p);20int xe_sriov_init(struct xe_device *xe);21 22static inline enum xe_sriov_mode xe_device_sriov_mode(const struct xe_device *xe)23{24	xe_assert(xe, xe->sriov.__mode);25	return xe->sriov.__mode;26}27 28static inline bool xe_device_is_sriov_pf(const struct xe_device *xe)29{30	return xe_device_sriov_mode(xe) == XE_SRIOV_MODE_PF;31}32 33static inline bool xe_device_is_sriov_vf(const struct xe_device *xe)34{35	return xe_device_sriov_mode(xe) == XE_SRIOV_MODE_VF;36}37 38#ifdef CONFIG_PCI_IOV39#define IS_SRIOV_PF(xe) xe_device_is_sriov_pf(xe)40#else41#define IS_SRIOV_PF(xe) (typecheck(struct xe_device *, (xe)) && false)42#endif43#define IS_SRIOV_VF(xe) xe_device_is_sriov_vf(xe)44 45#define IS_SRIOV(xe) (IS_SRIOV_PF(xe) || IS_SRIOV_VF(xe))46 47#endif48