Linux Audio

Check our new training course

Loading...
Note: File does not exist in v5.4.
 1/* SPDX-License-Identifier: MIT */
 2/*
 3 * Copyright © 2023-2024 Intel Corporation
 4 */
 5
 6#ifndef _XE_SRIOV_PF_HELPERS_H_
 7#define _XE_SRIOV_PF_HELPERS_H_
 8
 9#include "xe_assert.h"
10#include "xe_device_types.h"
11#include "xe_sriov.h"
12#include "xe_sriov_types.h"
13
14/**
15 * xe_sriov_pf_assert_vfid() - warn if &id is not a supported VF number when debugging.
16 * @xe: the PF &xe_device to assert on
17 * @vfid: the VF number to assert
18 *
19 * Assert that &xe represents the Physical Function (PF) device and provided &vfid
20 * is within a range of supported VF numbers (up to maximum number of VFs that
21 * driver can support, including VF0 that represents the PF itself).
22 *
23 * Note: Effective only on debug builds. See `Xe ASSERTs`_ for more information.
24 */
25#define xe_sriov_pf_assert_vfid(xe, vfid) \
26	xe_assert((xe), (vfid) <= xe_sriov_pf_get_totalvfs(xe))
27
28/**
29 * xe_sriov_pf_get_totalvfs() - Get maximum number of VFs that driver can support.
30 * @xe: the &xe_device to query (shall be PF)
31 *
32 * Return: Maximum number of VFs that this PF driver supports.
33 */
34static inline int xe_sriov_pf_get_totalvfs(struct xe_device *xe)
35{
36	xe_assert(xe, IS_SRIOV_PF(xe));
37	return xe->sriov.pf.driver_max_vfs;
38}
39
40static inline struct mutex *xe_sriov_pf_master_mutex(struct xe_device *xe)
41{
42	xe_assert(xe, IS_SRIOV_PF(xe));
43	return &xe->sriov.pf.master_lock;
44}
45
46#endif