Skip to content

Commit

Permalink
Revert "drm/i915/pf: Export API to be used by i915-vfio-pci"
Browse files Browse the repository at this point in the history
This reverts commit e5a5616.
  • Loading branch information
zul-husni authored and sys-oak committed Sep 24, 2024
1 parent b209d6c commit 28076ef
Showing 4 changed files with 0 additions and 333 deletions.
35 changes: 0 additions & 35 deletions drivers/gpu/drm/i915/gt/iov/intel_iov_state.c
Original file line number Diff line number Diff line change
@@ -172,16 +172,6 @@ static void pf_clear_vf_ggtt_entries(struct intel_iov *iov, u32 vfid)
i915_ggtt_set_space_owner(gt->ggtt, vfid, &config->ggtt_region);
}

static void pf_reset_vf_guc_migration_state(struct intel_iov *iov, u32 vfid)
{
struct intel_iov_data *data = &iov->pf.state.data[vfid];
void *guc_state = fetch_and_zero(&data->guc_state);

lockdep_assert_held(pf_provisioning_mutex(iov));

kfree(guc_state);
}

static int pf_process_vf_flr_finish(struct intel_iov *iov, u32 vfid)
{
/* Wa_14017568299:mtl - Clear Unsupported Request Detected status*/
@@ -190,7 +180,6 @@ static int pf_process_vf_flr_finish(struct intel_iov *iov, u32 vfid)
intel_iov_event_reset(iov, vfid);

mutex_lock(pf_provisioning_mutex(iov));
pf_reset_vf_guc_migration_state(iov, vfid);
pf_clear_vf_ggtt_entries(iov, vfid);
mutex_unlock(pf_provisioning_mutex(iov));

@@ -780,27 +769,3 @@ int intel_iov_state_restore_vf(struct intel_iov *iov, u32 vfid, const void *buf,

return err;
}

int intel_iov_state_store_guc_migration_state(struct intel_iov *iov, u32 vfid,
const void *buf, size_t size)
{
struct intel_iov_data *data = &iov->pf.state.data[vfid];
void *guc_state;

if (size != PF2GUC_SAVE_RESTORE_VF_BUFF_SIZE)
return -EINVAL;

mutex_lock(pf_provisioning_mutex(iov));
guc_state = kzalloc(size, GFP_KERNEL);
if (!guc_state) {
mutex_unlock(pf_provisioning_mutex(iov));
return -ENOMEM;
}

memcpy(guc_state, buf, size);

data->guc_state = guc_state;
mutex_unlock(pf_provisioning_mutex(iov));

return 0;
}
2 changes: 0 additions & 2 deletions drivers/gpu/drm/i915/gt/iov/intel_iov_state.h
Original file line number Diff line number Diff line change
@@ -24,8 +24,6 @@ ssize_t intel_iov_state_save_ggtt(struct intel_iov *iov, u32 vfid, void *buf, si
int intel_iov_state_restore_ggtt(struct intel_iov *iov, u32 vfid, const void *buf, size_t size);
int intel_iov_state_save_vf(struct intel_iov *iov, u32 vfid, void *buf, size_t size);
int intel_iov_state_restore_vf(struct intel_iov *iov, u32 vfid, const void *buf, size_t size);
int intel_iov_state_store_guc_migration_state(struct intel_iov *iov, u32 vfid,
const void *buf, size_t size);

int intel_iov_state_process_guc2pf(struct intel_iov *iov,
const u32 *msg, u32 len);
263 changes: 0 additions & 263 deletions drivers/gpu/drm/i915/i915_sriov.c
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@
* Copyright © 2023 Intel Corporation
*/

#include <drm/i915_sriov.h>

#include "i915_sriov.h"
#include "i915_sriov_sysfs.h"
#include "i915_drv.h"
@@ -997,267 +995,6 @@ int i915_sriov_pf_resume_vf(struct drm_i915_private *i915, unsigned int vfid)
return result;
}

/**
* i915_sriov_pause_vf - Pause VF.
* @pdev: the i915 struct
* @vfid: VF identifier
*
* This function will pause VF on all tiles.
* This function shall be called only on PF.
*
* Return: 0 on success or a negative error code on failure.
*/
int i915_sriov_pause_vf(struct pci_dev *pdev, unsigned int vfid)
{
struct drm_i915_private *i915 = pci_get_drvdata(pdev);

if (!IS_SRIOV_PF(i915))
return -ENODEV;

return i915_sriov_pf_pause_vf(i915, vfid);
}
EXPORT_SYMBOL_NS_GPL(i915_sriov_pause_vf, I915);

/**
* i915_sriov_resume_vf - Resume VF.
* @pdev: the i915 struct
* @vfid: VF identifier
*
* This function will resume VF on all tiles.
* This function shall be called only on PF.
*
* Return: 0 on success or a negative error code on failure.
*/
int i915_sriov_resume_vf(struct pci_dev *pdev, unsigned int vfid)
{
struct drm_i915_private *i915 = pci_get_drvdata(pdev);

if (!IS_SRIOV_PF(i915))
return -ENODEV;

return i915_sriov_pf_resume_vf(i915, vfid);
}
EXPORT_SYMBOL_NS_GPL(i915_sriov_resume_vf, I915);

/**
* i915_sriov_wait_vf_flr_done - Wait for VF FLR completion.
* @pdev: PF pci device
* @vfid: VF identifier
*
* This function will wait until VF FLR is processed by PF on all tiles (or
* until timeout occurs).
* This function shall be called only on PF.
*
* Return: 0 on success or a negative error code on failure.
*/
int i915_sriov_wait_vf_flr_done(struct pci_dev *pdev, unsigned int vfid)
{
struct drm_i915_private *i915 = pci_get_drvdata(pdev);
struct intel_gt *gt;
unsigned int id;
int ret;

if (!IS_SRIOV_PF(i915))
return -ENODEV;

for_each_gt(gt, i915, id) {
ret = wait_for(intel_iov_state_no_flr(&gt->iov, vfid), I915_VF_FLR_TIMEOUT_MS);
if (ret)
return ret;
}

return 0;
}
EXPORT_SYMBOL_NS_GPL(i915_sriov_wait_vf_flr_done, I915);

static struct intel_gt *
sriov_to_gt(struct pci_dev *pdev, unsigned int tile)
{
struct drm_i915_private *i915 = pci_get_drvdata(pdev);
struct intel_gt *gt;

if (!i915 || !IS_SRIOV_PF(i915))
return NULL;

if (!HAS_EXTRA_GT_LIST(i915) && tile > 0)
return NULL;

gt = NULL;
if (tile < ARRAY_SIZE(i915->gt))
gt = i915->gt[tile];

return gt;
}

/**
* i915_sriov_ggtt_size - Get size needed to store VF GGTT.
* @pdev: PF pci device
* @vfid: VF identifier
* @tile: tile identifier
*
* This function shall be called only on PF.
*
* Return: Size in bytes.
*/
size_t
i915_sriov_ggtt_size(struct pci_dev *pdev, unsigned int vfid, unsigned int tile)
{
struct intel_gt *gt;
ssize_t size;

gt = sriov_to_gt(pdev, tile);
if (!gt)
return 0;

if (gt->type == GT_MEDIA)
return 0;

size = intel_iov_state_save_ggtt(&gt->iov, vfid, NULL, 0);
WARN_ON(size < 0);

return size;
}
EXPORT_SYMBOL_NS_GPL(i915_sriov_ggtt_size, I915);

/**
* i915_sriov_ggtt_save - Save VF GGTT.
* @pdev: PF pci device
* @vfid: VF identifier
* @tile: tile identifier
* @buf: buffer to save VF GGTT
* @size: size of buffer to save VF GGTT
*
* This function shall be called only on PF.
*
* Return: Size of data written on success or a negative error code on failure.
*/
ssize_t i915_sriov_ggtt_save(struct pci_dev *pdev, unsigned int vfid, unsigned int tile,
void *buf, size_t size)
{
struct intel_gt *gt;

gt = sriov_to_gt(pdev, tile);
if (!gt)
return -ENODEV;

if (gt->type == GT_MEDIA)
return -ENODEV;

WARN_ON(buf == NULL && size == 0);

return intel_iov_state_save_ggtt(&gt->iov, vfid, buf, size);
}
EXPORT_SYMBOL_NS_GPL(i915_sriov_ggtt_save, I915);

/**
* i915_sriov_ggtt_load - Load VF GGTT.
* @pdev: PF pci device
* @vfid: VF identifier
* @tile: tile identifier
* @buf: buffer with VF GGTT
* @size: size of buffer with VF GGTT
*
* This function shall be called only on PF.
*
* Return: 0 on success or a negative error code on failure.
*/
int
i915_sriov_ggtt_load(struct pci_dev *pdev, unsigned int vfid, unsigned int tile,
const void *buf, size_t size)
{
struct intel_gt *gt;

gt = sriov_to_gt(pdev, tile);
if (!gt)
return -ENODEV;

if (gt->type == GT_MEDIA)
return -ENODEV;

return intel_iov_state_restore_ggtt(&gt->iov, vfid, buf, size);
}
EXPORT_SYMBOL_NS_GPL(i915_sriov_ggtt_load, I915);

/**
* i915_sriov_fw_state_size - Get size needed to store GuC FW state.
* @pdev: PF pci device
* @vfid: VF identifier
* @tile: tile identifier
*
* This function shall be called only on PF.
*
* Return: Size in bytes.
*/
size_t
i915_sriov_fw_state_size(struct pci_dev *pdev, unsigned int vfid, unsigned int tile)
{
struct intel_gt *gt;

gt = sriov_to_gt(pdev, tile);
if (!gt)
return 0;

return SZ_4K;
}
EXPORT_SYMBOL_NS_GPL(i915_sriov_fw_state_size, I915);

/**
* i915_sriov_fw_state_save - Save GuC FW state.
* @pdev: PF pci device
* @vfid: VF identifier
* @tile: tile identifier
* @buf: buffer to save GuC FW state
* @size: size of buffer to save GuC FW state
*
* This function shall be called only on PF.
*
* Return: Size of data written on success or a negative error code on failure.
*/
ssize_t
i915_sriov_fw_state_save(struct pci_dev *pdev, unsigned int vfid, unsigned int tile,
void *buf, size_t size)
{
struct intel_gt *gt;
int ret;

gt = sriov_to_gt(pdev, tile);
if (!gt)
return -ENODEV;

ret = intel_iov_state_save_vf(&gt->iov, vfid, buf, size);
if (ret)
return ret;

return SZ_4K;
}
EXPORT_SYMBOL_NS_GPL(i915_sriov_fw_state_save, I915);

/**
* i915_sriov_fw_state_load - Load GuC FW state.
* @pdev: PF pci device
* @vfid: VF identifier
* @tile: tile identifier
* @buf: buffer with GuC FW state to load
* @size: size of buffer with GuC FW state
*
* This function shall be called only on PF.
*
* Return: 0 on success or a negative error code on failure.
*/
int
i915_sriov_fw_state_load(struct pci_dev *pdev, unsigned int vfid, unsigned int tile,
const void *buf, size_t size)
{
struct intel_gt *gt;

gt = sriov_to_gt(pdev, tile);
if (!gt)
return -ENODEV;

return intel_iov_state_store_guc_migration_state(&gt->iov, vfid, buf, size);
}
EXPORT_SYMBOL_NS_GPL(i915_sriov_fw_state_load, I915);

/**
* i915_sriov_pf_clear_vf - Unprovision VF.
* @i915: the i915 struct
33 changes: 0 additions & 33 deletions include/drm/i915_sriov.h

This file was deleted.

0 comments on commit 28076ef

Please sign in to comment.