aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2017-03-16 06:06:39 -0400
committerZhenyu Wang <zhenyuw@linux.intel.com>2017-03-29 03:28:51 -0400
commit7a7a65617b84912287ec4c6ed7b85f9418c7304b (patch)
treedf55e24e5c3ab75bb160288b71d1b7c5d924375c
parente2e02cbb5beb5f7bfdfd73558794e3949868267c (diff)
drm/i915/gvt: Add mdev device attribute group
This adds initial attribute group for mdev to hold vGPU related for each mdev device, currently just vGPU id is shown. v2: rename group name as "intel_vgpu" Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
-rw-r--r--drivers/gpu/drm/i915/gvt/kvmgt.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 1ea3eb270de8..c7e7c9377cef 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -1146,8 +1146,40 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
1146 return 0; 1146 return 0;
1147} 1147}
1148 1148
1149static ssize_t
1150vgpu_id_show(struct device *dev, struct device_attribute *attr,
1151 char *buf)
1152{
1153 struct mdev_device *mdev = mdev_from_dev(dev);
1154
1155 if (mdev) {
1156 struct intel_vgpu *vgpu = (struct intel_vgpu *)
1157 mdev_get_drvdata(mdev);
1158 return sprintf(buf, "%d\n", vgpu->id);
1159 }
1160 return sprintf(buf, "\n");
1161}
1162
1163static DEVICE_ATTR_RO(vgpu_id);
1164
1165static struct attribute *intel_vgpu_attrs[] = {
1166 &dev_attr_vgpu_id.attr,
1167 NULL
1168};
1169
1170static const struct attribute_group intel_vgpu_group = {
1171 .name = "intel_vgpu",
1172 .attrs = intel_vgpu_attrs,
1173};
1174
1175static const struct attribute_group *intel_vgpu_groups[] = {
1176 &intel_vgpu_group,
1177 NULL,
1178};
1179
1149static const struct mdev_parent_ops intel_vgpu_ops = { 1180static const struct mdev_parent_ops intel_vgpu_ops = {
1150 .supported_type_groups = intel_vgpu_type_groups, 1181 .supported_type_groups = intel_vgpu_type_groups,
1182 .mdev_attr_groups = intel_vgpu_groups,
1151 .create = intel_vgpu_create, 1183 .create = intel_vgpu_create,
1152 .remove = intel_vgpu_remove, 1184 .remove = intel_vgpu_remove,
1153 1185