#include <drm/drm_managed.h>
#include "xe_assert.h"
+#include "xe_pm.h"
#include "xe_sriov.h"
+#include "xe_sriov_pf.h"
#include "xe_sriov_pf_helpers.h"
#include "xe_sriov_pf_sysfs.h"
#include "xe_sriov_printk.h"
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;
- return vattr->store(xe, buf, count);
+ xe_pm_runtime_get(xe);
+ ret = xe_sriov_pf_wait_ready(xe) ?: vattr->store(xe, buf, count);
+ xe_pm_runtime_put(xe);
+
+ return ret;
}
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;
- return vattr->store(xe, vfid, buf, count);
+ 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;
}
static const struct sysfs_ops xe_sriov_dev_sysfs_ops = {