| 958 | } |
| 959 | |
| 960 | int |
| 961 | vm_assign_pptdev(struct vm *vm, int bus, int slot, int func) |
| 962 | { |
| 963 | int error; |
| 964 | vm_paddr_t maxaddr; |
| 965 | |
| 966 | /* Set up the IOMMU to do the 'gpa' to 'hpa' translation */ |
| 967 | if (ppt_assigned_devices(vm) == 0) { |
| 968 | KASSERT(vm->iommu == NULL, |
| 969 | ("vm_assign_pptdev: iommu must be NULL")); |
| 970 | maxaddr = vmm_sysmem_maxaddr(vm); |
| 971 | vm->iommu = iommu_create_domain(maxaddr); |
| 972 | if (vm->iommu == NULL) |
| 973 | return (ENXIO); |
| 974 | vm_iommu_map(vm); |
| 975 | } |
| 976 | |
| 977 | error = ppt_assign_device(vm, bus, slot, func); |
| 978 | return (error); |
| 979 | } |
| 980 | |
| 981 | void * |
| 982 | vm_gpa_hold(struct vm *vm, int vcpuid, vm_paddr_t gpa, size_t len, int reqprot, |
no test coverage detected