Lines Matching refs:res
53 struct vmw_resource res; member
124 static int vmw_cotable_bind(struct vmw_resource *res,
126 static int vmw_cotable_unbind(struct vmw_resource *res,
129 static int vmw_cotable_create(struct vmw_resource *res);
130 static int vmw_cotable_destroy(struct vmw_resource *res);
153 static struct vmw_cotable *vmw_cotable(struct vmw_resource *res) in vmw_cotable() argument
155 return container_of(res, struct vmw_cotable, res); in vmw_cotable()
166 static int vmw_cotable_destroy(struct vmw_resource *res) in vmw_cotable_destroy() argument
168 res->id = -1; in vmw_cotable_destroy()
181 static int vmw_cotable_unscrub(struct vmw_resource *res) in vmw_cotable_unscrub() argument
183 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_unscrub()
184 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_unscrub()
185 struct ttm_buffer_object *bo = &res->guest_memory_bo->tbo; in vmw_cotable_unscrub()
223 static int vmw_cotable_bind(struct vmw_resource *res, in vmw_cotable_bind() argument
233 val_buf->bo = &res->guest_memory_bo->tbo; in vmw_cotable_bind()
235 return vmw_cotable_unscrub(res); in vmw_cotable_bind()
256 int vmw_cotable_scrub(struct vmw_resource *res, bool readback) in vmw_cotable_scrub() argument
258 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_scrub()
259 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_scrub()
294 vcotbl->size_read_back = res->guest_memory_size; in vmw_cotable_scrub()
306 res->id = -1; in vmw_cotable_scrub()
321 static int vmw_cotable_unbind(struct vmw_resource *res, in vmw_cotable_unbind() argument
325 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_unbind()
326 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_unbind()
330 if (!vmw_resource_mob_attached(res)) in vmw_cotable_unbind()
356 static int vmw_cotable_readback(struct vmw_resource *res) in vmw_cotable_readback() argument
358 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_readback()
359 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_readback()
376 vcotbl->size_read_back = res->guest_memory_size; in vmw_cotable_readback()
381 vmw_bo_fence_single(&res->guest_memory_bo->tbo, fence); in vmw_cotable_readback()
399 static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) in vmw_cotable_resize() argument
402 struct vmw_private *dev_priv = res->dev_priv; in vmw_cotable_resize()
403 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_resize()
404 struct vmw_bo *buf, *old_buf = res->guest_memory_bo; in vmw_cotable_resize()
405 struct ttm_buffer_object *bo, *old_bo = &res->guest_memory_bo->tbo; in vmw_cotable_resize()
406 size_t old_size = res->guest_memory_size; in vmw_cotable_resize()
423 ret = vmw_cotable_readback(res); in vmw_cotable_resize()
484 vmw_resource_mob_detach(res); in vmw_cotable_resize()
485 res->guest_memory_bo = buf; in vmw_cotable_resize()
486 res->guest_memory_size = new_size; in vmw_cotable_resize()
493 ret = vmw_cotable_unscrub(res); in vmw_cotable_resize()
496 res->guest_memory_bo = old_buf; in vmw_cotable_resize()
497 res->guest_memory_size = old_size; in vmw_cotable_resize()
499 vmw_resource_mob_attach(res); in vmw_cotable_resize()
503 vmw_resource_mob_attach(res); in vmw_cotable_resize()
506 res->id = vcotbl->type; in vmw_cotable_resize()
544 static int vmw_cotable_create(struct vmw_resource *res) in vmw_cotable_create() argument
546 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_create()
547 size_t new_size = res->guest_memory_size; in vmw_cotable_create()
556 if (likely(new_size <= res->guest_memory_size)) { in vmw_cotable_create()
557 if (vcotbl->scrubbed && vmw_resource_mob_attached(res)) { in vmw_cotable_create()
558 ret = vmw_cotable_unscrub(res); in vmw_cotable_create()
562 res->id = vcotbl->type; in vmw_cotable_create()
566 return vmw_cotable_resize(res, new_size); in vmw_cotable_create()
576 static void vmw_hw_cotable_destroy(struct vmw_resource *res) in vmw_hw_cotable_destroy() argument
578 (void) vmw_cotable_destroy(res); in vmw_hw_cotable_destroy()
586 static void vmw_cotable_free(struct vmw_resource *res) in vmw_cotable_free() argument
588 kfree(res); in vmw_cotable_free()
613 ret = vmw_resource_init(dev_priv, &vcotbl->res, true, in vmw_cotable_alloc()
619 vcotbl->res.id = type; in vmw_cotable_alloc()
620 vcotbl->res.guest_memory_size = PAGE_SIZE; in vmw_cotable_alloc()
623 vcotbl->res.guest_memory_size = co_info[type].min_initial_entries * in vmw_cotable_alloc()
625 vcotbl->res.guest_memory_size = PFN_ALIGN(vcotbl->res.guest_memory_size); in vmw_cotable_alloc()
633 vcotbl->res.hw_destroy = vmw_hw_cotable_destroy; in vmw_cotable_alloc()
635 return &vcotbl->res; in vmw_cotable_alloc()
649 int vmw_cotable_notify(struct vmw_resource *res, int id) in vmw_cotable_notify() argument
651 struct vmw_cotable *vcotbl = vmw_cotable(res); in vmw_cotable_notify()
661 res->id = -1; in vmw_cotable_notify()
675 void vmw_cotable_add_resource(struct vmw_resource *res, struct list_head *head) in vmw_cotable_add_resource() argument
678 container_of(res, struct vmw_cotable, res); in vmw_cotable_add_resource()