kvmgt.c (062e720cd209d8091c4f3d118d93973f02209aca) kvmgt.c (290aac5df88a83e264b3a73ec146e5e5b3c45793)
1/*
2 * KVMGT - the implementation of Intel mediated pass-through framework for KVM
3 *
4 * Copyright(c) 2011-2016 Intel Corporation. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation

--- 109 unchanged lines hidden (view full) ---

118 char *buf)
119{
120 struct intel_vgpu_type *type =
121 container_of(mtype, struct intel_vgpu_type, type);
122
123 return sprintf(buf, "%u\n", type->avail_instance);
124}
125
1/*
2 * KVMGT - the implementation of Intel mediated pass-through framework for KVM
3 *
4 * Copyright(c) 2011-2016 Intel Corporation. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation

--- 109 unchanged lines hidden (view full) ---

118 char *buf)
119{
120 struct intel_vgpu_type *type =
121 container_of(mtype, struct intel_vgpu_type, type);
122
123 return sprintf(buf, "%u\n", type->avail_instance);
124}
125
126static ssize_t device_api_show(struct mdev_type *mtype,
127 struct mdev_type_attribute *attr, char *buf)
128{
129 return sprintf(buf, "%s\n", VFIO_DEVICE_API_PCI_STRING);
130}
131
132static ssize_t description_show(struct mdev_type *mtype,
133 struct mdev_type_attribute *attr, char *buf)
134{
135 struct intel_vgpu_type *type =
136 container_of(mtype, struct intel_vgpu_type, type);
137
138 return sprintf(buf, "low_gm_size: %dMB\nhigh_gm_size: %dMB\n"
139 "fence: %d\nresolution: %s\n"

--- 6 unchanged lines hidden (view full) ---

146
147static ssize_t name_show(struct mdev_type *mtype,
148 struct mdev_type_attribute *attr, char *buf)
149{
150 return sprintf(buf, "%s\n", mtype->sysfs_name);
151}
152
153static MDEV_TYPE_ATTR_RO(available_instances);
126static ssize_t description_show(struct mdev_type *mtype,
127 struct mdev_type_attribute *attr, char *buf)
128{
129 struct intel_vgpu_type *type =
130 container_of(mtype, struct intel_vgpu_type, type);
131
132 return sprintf(buf, "low_gm_size: %dMB\nhigh_gm_size: %dMB\n"
133 "fence: %d\nresolution: %s\n"

--- 6 unchanged lines hidden (view full) ---

140
141static ssize_t name_show(struct mdev_type *mtype,
142 struct mdev_type_attribute *attr, char *buf)
143{
144 return sprintf(buf, "%s\n", mtype->sysfs_name);
145}
146
147static MDEV_TYPE_ATTR_RO(available_instances);
154static MDEV_TYPE_ATTR_RO(device_api);
155static MDEV_TYPE_ATTR_RO(description);
156static MDEV_TYPE_ATTR_RO(name);
157
158static const struct attribute *gvt_type_attrs[] = {
159 &mdev_type_attr_available_instances.attr,
148static MDEV_TYPE_ATTR_RO(description);
149static MDEV_TYPE_ATTR_RO(name);
150
151static const struct attribute *gvt_type_attrs[] = {
152 &mdev_type_attr_available_instances.attr,
160 &mdev_type_attr_device_api.attr,
161 &mdev_type_attr_description.attr,
162 &mdev_type_attr_name.attr,
163 NULL,
164};
165
166static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
167 unsigned long size)
168{

--- 1376 unchanged lines hidden (view full) ---

1545 if (WARN_ON_ONCE(vgpu->attached))
1546 return;
1547
1548 vfio_unregister_group_dev(&vgpu->vfio_device);
1549 vfio_put_device(&vgpu->vfio_device);
1550}
1551
1552static struct mdev_driver intel_vgpu_mdev_driver = {
153 &mdev_type_attr_description.attr,
154 &mdev_type_attr_name.attr,
155 NULL,
156};
157
158static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
159 unsigned long size)
160{

--- 1376 unchanged lines hidden (view full) ---

1537 if (WARN_ON_ONCE(vgpu->attached))
1538 return;
1539
1540 vfio_unregister_group_dev(&vgpu->vfio_device);
1541 vfio_put_device(&vgpu->vfio_device);
1542}
1543
1544static struct mdev_driver intel_vgpu_mdev_driver = {
1545 .device_api = VFIO_DEVICE_API_PCI_STRING,
1553 .driver = {
1554 .name = "intel_vgpu_mdev",
1555 .owner = THIS_MODULE,
1556 .dev_groups = intel_vgpu_groups,
1557 },
1558 .probe = intel_vgpu_probe,
1559 .remove = intel_vgpu_remove,
1560 .types_attrs = gvt_type_attrs,

--- 472 unchanged lines hidden ---
1546 .driver = {
1547 .name = "intel_vgpu_mdev",
1548 .owner = THIS_MODULE,
1549 .dev_groups = intel_vgpu_groups,
1550 },
1551 .probe = intel_vgpu_probe,
1552 .remove = intel_vgpu_remove,
1553 .types_attrs = gvt_type_attrs,

--- 472 unchanged lines hidden ---