mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
drm/xe/pf: Automatically provision VFs only in auto-mode
We shouldn't attempt to auto-provision VFs once we allow other provisioning methods. Make the code aware of the new condition. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com> Link: https://lore.kernel.org/r/20251015091211.592-3-michal.wajdeczko@intel.com
This commit is contained in:
parent
a5efeaf8a1
commit
5546bc2071
|
|
@ -9,6 +9,14 @@
|
|||
#include "xe_sriov.h"
|
||||
#include "xe_sriov_pf_helpers.h"
|
||||
#include "xe_sriov_pf_provision.h"
|
||||
#include "xe_sriov_pf_provision_types.h"
|
||||
|
||||
static bool pf_auto_provisioning_mode(struct xe_device *xe)
|
||||
{
|
||||
xe_assert(xe, IS_SRIOV_PF(xe));
|
||||
|
||||
return xe->sriov.pf.provision.mode == XE_SRIOV_PROVISIONING_MODE_AUTO;
|
||||
}
|
||||
|
||||
static bool pf_needs_provisioning(struct xe_gt *gt, unsigned int num_vfs)
|
||||
{
|
||||
|
|
@ -30,7 +38,7 @@ static int pf_provision_vfs(struct xe_device *xe, unsigned int num_vfs)
|
|||
|
||||
for_each_gt(gt, xe, id) {
|
||||
if (!pf_needs_provisioning(gt, num_vfs))
|
||||
continue;
|
||||
return -EUCLEAN;
|
||||
err = xe_gt_sriov_pf_config_set_fair(gt, VFID(1), num_vfs);
|
||||
result = result ?: err;
|
||||
}
|
||||
|
|
@ -62,6 +70,9 @@ int xe_sriov_pf_provision_vfs(struct xe_device *xe, unsigned int num_vfs)
|
|||
{
|
||||
xe_assert(xe, IS_SRIOV_PF(xe));
|
||||
|
||||
if (!pf_auto_provisioning_mode(xe))
|
||||
return 0;
|
||||
|
||||
return pf_provision_vfs(xe, num_vfs);
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +89,9 @@ int xe_sriov_pf_unprovision_vfs(struct xe_device *xe, unsigned int num_vfs)
|
|||
{
|
||||
xe_assert(xe, IS_SRIOV_PF(xe));
|
||||
|
||||
if (!pf_auto_provisioning_mode(xe))
|
||||
return 0;
|
||||
|
||||
pf_unprovision_vfs(xe, num_vfs);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
32
drivers/gpu/drm/xe/xe_sriov_pf_provision_types.h
Normal file
32
drivers/gpu/drm/xe/xe_sriov_pf_provision_types.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/* SPDX-License-Identifier: MIT */
|
||||
/*
|
||||
* Copyright © 2025 Intel Corporation
|
||||
*/
|
||||
|
||||
#ifndef _XE_SRIOV_PF_PROVISION_TYPES_H_
|
||||
#define _XE_SRIOV_PF_PROVISION_TYPES_H_
|
||||
|
||||
#include <linux/build_bug.h>
|
||||
|
||||
/**
|
||||
* enum xe_sriov_provisioning_mode - SR-IOV provisioning mode.
|
||||
*
|
||||
* @XE_SRIOV_PROVISIONING_MODE_AUTO: VFs are provisioned during VFs enabling.
|
||||
* Any allocated resources to the VFs will be
|
||||
* automatically released when disabling VFs.
|
||||
* This is a default mode.
|
||||
*/
|
||||
enum xe_sriov_provisioning_mode {
|
||||
XE_SRIOV_PROVISIONING_MODE_AUTO,
|
||||
};
|
||||
static_assert(XE_SRIOV_PROVISIONING_MODE_AUTO == 0);
|
||||
|
||||
/**
|
||||
* struct xe_sriov_pf_provision - Data used by the PF provisioning.
|
||||
*/
|
||||
struct xe_sriov_pf_provision {
|
||||
/** @mode: selected provisioning mode. */
|
||||
enum xe_sriov_provisioning_mode mode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "xe_sriov_pf_provision_types.h"
|
||||
#include "xe_sriov_pf_service_types.h"
|
||||
|
||||
/**
|
||||
|
|
@ -35,6 +36,9 @@ struct xe_device_pf {
|
|||
/** @master_lock: protects all VFs configurations across GTs */
|
||||
struct mutex master_lock;
|
||||
|
||||
/** @provision: device level provisioning data. */
|
||||
struct xe_sriov_pf_provision provision;
|
||||
|
||||
/** @service: device level service data. */
|
||||
struct xe_sriov_pf_service service;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user