vgpu.c (e39c5add322184de3be052d438dfd24375bfeaea) vgpu.c (04d348ae3f0aea6523bc3b0688b5fc90c1c60d0e)
1/*
2 * Copyright(c) 2011-2016 Intel Corporation. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

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

141{
142 struct intel_gvt *gvt = vgpu->gvt;
143
144 mutex_lock(&gvt->lock);
145
146 vgpu->active = false;
147 idr_remove(&gvt->vgpu_idr, vgpu->id);
148
1/*
2 * Copyright(c) 2011-2016 Intel Corporation. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the

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

141{
142 struct intel_gvt *gvt = vgpu->gvt;
143
144 mutex_lock(&gvt->lock);
145
146 vgpu->active = false;
147 idr_remove(&gvt->vgpu_idr, vgpu->id);
148
149 intel_vgpu_clean_display(vgpu);
149 intel_vgpu_clean_opregion(vgpu);
150 intel_vgpu_clean_gtt(vgpu);
151 intel_gvt_hypervisor_detach_vgpu(vgpu);
152 intel_vgpu_free_resource(vgpu);
153 clean_vgpu_mmio(vgpu);
154 vfree(vgpu);
155
156 mutex_unlock(&gvt->lock);

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

211 goto out_detach_hypervisor_vgpu;
212
213 if (intel_gvt_host.hypervisor_type == INTEL_GVT_HYPERVISOR_KVM) {
214 ret = intel_vgpu_init_opregion(vgpu, 0);
215 if (ret)
216 goto out_clean_gtt;
217 }
218
150 intel_vgpu_clean_opregion(vgpu);
151 intel_vgpu_clean_gtt(vgpu);
152 intel_gvt_hypervisor_detach_vgpu(vgpu);
153 intel_vgpu_free_resource(vgpu);
154 clean_vgpu_mmio(vgpu);
155 vfree(vgpu);
156
157 mutex_unlock(&gvt->lock);

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

212 goto out_detach_hypervisor_vgpu;
213
214 if (intel_gvt_host.hypervisor_type == INTEL_GVT_HYPERVISOR_KVM) {
215 ret = intel_vgpu_init_opregion(vgpu, 0);
216 if (ret)
217 goto out_clean_gtt;
218 }
219
220 ret = intel_vgpu_init_display(vgpu);
221 if (ret)
222 goto out_clean_opregion;
223
219 vgpu->active = true;
220 mutex_unlock(&gvt->lock);
221
222 return vgpu;
223
224 vgpu->active = true;
225 mutex_unlock(&gvt->lock);
226
227 return vgpu;
228
229out_clean_opregion:
230 intel_vgpu_clean_opregion(vgpu);
224out_clean_gtt:
225 intel_vgpu_clean_gtt(vgpu);
226out_detach_hypervisor_vgpu:
227 intel_gvt_hypervisor_detach_vgpu(vgpu);
228out_clean_vgpu_resource:
229 intel_vgpu_free_resource(vgpu);
230out_clean_vgpu_mmio:
231 clean_vgpu_mmio(vgpu);
232out_free_vgpu:
233 vfree(vgpu);
234 mutex_unlock(&gvt->lock);
235 return ERR_PTR(ret);
236}
231out_clean_gtt:
232 intel_vgpu_clean_gtt(vgpu);
233out_detach_hypervisor_vgpu:
234 intel_gvt_hypervisor_detach_vgpu(vgpu);
235out_clean_vgpu_resource:
236 intel_vgpu_free_resource(vgpu);
237out_clean_vgpu_mmio:
238 clean_vgpu_mmio(vgpu);
239out_free_vgpu:
240 vfree(vgpu);
241 mutex_unlock(&gvt->lock);
242 return ERR_PTR(ret);
243}