| 381 | } |
| 382 | |
| 383 | int |
| 384 | ppt_assign_device(struct vm *vm, int bus, int slot, int func) |
| 385 | { |
| 386 | struct pptdev *ppt; |
| 387 | int error; |
| 388 | |
| 389 | /* Passing NULL requires the device to be unowned. */ |
| 390 | error = ppt_find(NULL, bus, slot, func, &ppt); |
| 391 | if (error) |
| 392 | return (error); |
| 393 | |
| 394 | pci_save_state(ppt->dev); |
| 395 | ppt_pci_reset(ppt->dev); |
| 396 | pci_restore_state(ppt->dev); |
| 397 | ppt->vm = vm; |
| 398 | iommu_add_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev)); |
| 399 | return (0); |
| 400 | } |
| 401 | |
| 402 | int |
| 403 | ppt_unassign_device(struct vm *vm, int bus, int slot, int func) |
no test coverage detected