int xe_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)
{
struct xe_device *xe = pdev_to_xe_device(pdev);
- int ret;
if (!IS_SRIOV_PF(xe))
return -ENODEV;
if (num_vfs && pci_num_vf(pdev))
return -EBUSY;
- xe_pm_runtime_get(xe);
+ guard(xe_pm_runtime)(xe);
if (num_vfs > 0)
- ret = pf_enable_vfs(xe, num_vfs);
+ return pf_enable_vfs(xe, num_vfs);
else
- ret = pf_disable_vfs(xe);
- xe_pm_runtime_put(xe);
-
- return ret;
+ return pf_disable_vfs(xe);
}
/**
struct xe_sriov_dev_attr *vattr = to_xe_sriov_dev_attr(attr);
struct xe_sriov_kobj *vkobj = to_xe_sriov_kobj(kobj);
struct xe_device *xe = vkobj->xe;
- ssize_t ret;
if (!vattr->store)
return -EPERM;
- xe_pm_runtime_get(xe);
- ret = xe_sriov_pf_wait_ready(xe) ?: vattr->store(xe, buf, count);
- xe_pm_runtime_put(xe);
-
- return ret;
+ guard(xe_pm_runtime)(xe);
+ return xe_sriov_pf_wait_ready(xe) ?: vattr->store(xe, buf, count);
}
static ssize_t xe_sriov_vf_attr_show(struct kobject *kobj, struct attribute *attr, char *buf)
struct xe_sriov_kobj *vkobj = to_xe_sriov_kobj(kobj);
struct xe_device *xe = vkobj->xe;
unsigned int vfid = vkobj->vfid;
- ssize_t ret;
xe_sriov_pf_assert_vfid(xe, vfid);
if (!vattr->store)
return -EPERM;
- xe_pm_runtime_get(xe);
- ret = xe_sriov_pf_wait_ready(xe) ?: vattr->store(xe, vfid, buf, count);
- xe_pm_runtime_get(xe);
-
- return ret;
+ guard(xe_pm_runtime)(xe);
+ return xe_sriov_pf_wait_ready(xe) ?: vattr->store(xe, vfid, buf, count);
}
static const struct sysfs_ops xe_sriov_dev_sysfs_ops = {
if (!IS_VF_CCS_READY(xe))
return;
- xe_pm_runtime_get(xe);
-
+ guard(xe_pm_runtime)(xe);
for_each_ccs_rw_ctx(ctx_id) {
bb_pool = xe->sriov.vf.ccs.contexts[ctx_id].mem.ccs_bb_pool;
if (!bb_pool)
drm_suballoc_dump_debug_info(&bb_pool->base, p, xe_sa_manager_gpu_addr(bb_pool));
drm_puts(p, "\n");
}
-
- xe_pm_runtime_put(xe);
}
if (val > (TYPE)~0ull) \
return -EOVERFLOW; \
\
- xe_pm_runtime_get(xe); \
+ guard(xe_pm_runtime)(xe); \
err = xe_sriov_pf_wait_ready(xe) ?: \
xe_gt_sriov_pf_config_set_##CONFIG(gt, vfid, val); \
if (!err) \
xe_sriov_pf_provision_set_custom_mode(xe); \
- xe_pm_runtime_put(xe); \
\
return err; \
} \