mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
drm/xe/pf: Derive admin-only PF mode from xe_device state
Stop tracking admin-only PF mode in a separate `xe->sriov.pf.admin_only` field and use `xe_device_is_admin_only(xe)` as the single source of admin mode. Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Link: https://patch.msgid.link/20260413095637.2871287-2-satyanarayana.k.v.p@intel.com
This commit is contained in:
parent
d88c4bac8c
commit
3e3fbb5ee3
|
|
@ -13,11 +13,28 @@
|
|||
#define TEST_MAX_VFS 63
|
||||
#define TEST_VRAM 0x7a800000ull /* random size that works on 32-bit */
|
||||
|
||||
static bool xe_device_is_admin_only_stub_enable(const struct xe_device *xe)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool xe_device_is_admin_only_stub_disable(const struct xe_device *xe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void pf_set_admin_mode(struct xe_device *xe, bool enable)
|
||||
{
|
||||
/* should match logic of xe_sriov_pf_admin_only() */
|
||||
xe->sriov.pf.admin_only = enable;
|
||||
typeof(xe_device_is_admin_only) *stub = enable ?
|
||||
xe_device_is_admin_only_stub_enable :
|
||||
xe_device_is_admin_only_stub_disable;
|
||||
|
||||
kunit_activate_static_stub(kunit_get_current_test(),
|
||||
xe_device_is_admin_only,
|
||||
*stub);
|
||||
|
||||
KUNIT_EXPECT_EQ(kunit_get_current_test(), enable, xe_sriov_pf_admin_only(xe));
|
||||
KUNIT_EXPECT_EQ(kunit_get_current_test(), enable, xe_device_is_admin_only(xe));
|
||||
}
|
||||
|
||||
static void pf_set_usable_vram(struct xe_device *xe, u64 usable)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <drm/drm_managed.h>
|
||||
#include <drm/drm_pagemap_util.h>
|
||||
#include <drm/drm_print.h>
|
||||
#include <kunit/static_stub.h>
|
||||
#include <uapi/drm/xe_drm.h>
|
||||
|
||||
#include "display/xe_display.h"
|
||||
|
|
@ -445,6 +446,7 @@ static struct drm_driver admin_only_driver = {
|
|||
*/
|
||||
bool xe_device_is_admin_only(const struct xe_device *xe)
|
||||
{
|
||||
KUNIT_STATIC_STUB_REDIRECT(xe_device_is_admin_only, xe);
|
||||
return xe->drm.driver == &admin_only_driver;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,11 +20,6 @@
|
|||
#include "xe_sriov_pf_sysfs.h"
|
||||
#include "xe_sriov_printk.h"
|
||||
|
||||
static bool wanted_admin_only(struct xe_device *xe)
|
||||
{
|
||||
return xe_configfs_admin_only_pf(to_pci_dev(xe->drm.dev));
|
||||
}
|
||||
|
||||
static unsigned int wanted_max_vfs(struct xe_device *xe)
|
||||
{
|
||||
return xe_configfs_get_max_vfs(to_pci_dev(xe->drm.dev));
|
||||
|
|
@ -79,7 +74,6 @@ bool xe_sriov_pf_readiness(struct xe_device *xe)
|
|||
|
||||
pf_reduce_totalvfs(xe, newlimit);
|
||||
|
||||
xe->sriov.pf.admin_only = wanted_admin_only(xe);
|
||||
xe->sriov.pf.device_total_vfs = totalvfs;
|
||||
xe->sriov.pf.driver_max_vfs = newlimit;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#define _XE_SRIOV_PF_HELPERS_H_
|
||||
|
||||
#include "xe_assert.h"
|
||||
#include "xe_device.h"
|
||||
#include "xe_device_types.h"
|
||||
#include "xe_sriov.h"
|
||||
#include "xe_sriov_types.h"
|
||||
|
|
@ -57,7 +58,7 @@ static inline unsigned int xe_sriov_pf_num_vfs(const struct xe_device *xe)
|
|||
static inline bool xe_sriov_pf_admin_only(const struct xe_device *xe)
|
||||
{
|
||||
xe_assert(xe, IS_SRIOV_PF(xe));
|
||||
return xe->sriov.pf.admin_only;
|
||||
return xe_device_is_admin_only(xe);
|
||||
}
|
||||
|
||||
static inline struct mutex *xe_sriov_pf_master_mutex(struct xe_device *xe)
|
||||
|
|
|
|||
|
|
@ -36,9 +36,6 @@ struct xe_sriov_metadata {
|
|||
* @XE_SRIOV_MODE_PF mode.
|
||||
*/
|
||||
struct xe_device_pf {
|
||||
/** @admin_only: PF functionality focused on VFs management only. */
|
||||
bool admin_only;
|
||||
|
||||
/** @device_total_vfs: Maximum number of VFs supported by the device. */
|
||||
u16 device_total_vfs;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user