Lines Matching refs:vm

43 static void acrn_ioeventfd_shutdown(struct acrn_vm *vm, struct hsm_ioeventfd *p)
45 lockdep_assert_held(&vm->ioeventfds_lock);
52 static bool hsm_ioeventfd_is_conflict(struct acrn_vm *vm,
57 lockdep_assert_held(&vm->ioeventfds_lock);
60 list_for_each_entry(p, &vm->ioeventfds, list)
76 static int acrn_ioeventfd_assign(struct acrn_vm *vm,
121 mutex_lock(&vm->ioeventfds_lock);
123 if (hsm_ioeventfd_is_conflict(vm, p)) {
129 ret = acrn_ioreq_range_add(vm->ioeventfd_client, p->type,
134 list_add_tail(&p->list, &vm->ioeventfds);
135 mutex_unlock(&vm->ioeventfds_lock);
140 mutex_unlock(&vm->ioeventfds_lock);
147 static int acrn_ioeventfd_deassign(struct acrn_vm *vm,
157 mutex_lock(&vm->ioeventfds_lock);
158 list_for_each_entry(p, &vm->ioeventfds, list) {
162 acrn_ioreq_range_del(vm->ioeventfd_client, p->type,
164 acrn_ioeventfd_shutdown(vm, p);
167 mutex_unlock(&vm->ioeventfds_lock);
173 static struct hsm_ioeventfd *hsm_ioeventfd_match(struct acrn_vm *vm, u64 addr,
178 lockdep_assert_held(&vm->ioeventfds_lock);
180 list_for_each_entry(p, &vm->ioeventfds, list) {
223 mutex_lock(&client->vm->ioeventfds_lock);
224 p = hsm_ioeventfd_match(client->vm, addr, val, size, req->type);
227 mutex_unlock(&client->vm->ioeventfds_lock);
232 int acrn_ioeventfd_config(struct acrn_vm *vm, struct acrn_ioeventfd *args)
237 ret = acrn_ioeventfd_deassign(vm, args);
239 ret = acrn_ioeventfd_assign(vm, args);
244 int acrn_ioeventfd_init(struct acrn_vm *vm)
248 mutex_init(&vm->ioeventfds_lock);
249 INIT_LIST_HEAD(&vm->ioeventfds);
250 snprintf(name, sizeof(name), "ioeventfd-%u", vm->vmid);
251 vm->ioeventfd_client = acrn_ioreq_client_create(vm,
254 if (!vm->ioeventfd_client) {
259 dev_dbg(acrn_dev.this_device, "VM %u ioeventfd init.\n", vm->vmid);
263 void acrn_ioeventfd_deinit(struct acrn_vm *vm)
267 dev_dbg(acrn_dev.this_device, "VM %u ioeventfd deinit.\n", vm->vmid);
268 acrn_ioreq_client_destroy(vm->ioeventfd_client);
269 mutex_lock(&vm->ioeventfds_lock);
270 list_for_each_entry_safe(p, next, &vm->ioeventfds, list)
271 acrn_ioeventfd_shutdown(vm, p);
272 mutex_unlock(&vm->ioeventfds_lock);