aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/iommu
Commit message (Collapse)AuthorAgeFilesLines
* dmar: reserve memory windows of PCIe root portRyan Libby2020-12-092-5/+69
| | | | | | | | | | | | | | | | | | PCI memory address space is shared between memory-mapped devices (MMIO) and host memory (which may be remapped by an IOMMU). Device accesses to an address within a memory aperture in a PCIe root port will be treated as peer-to-peer and not forwarded to an IOMMU. To avoid this, reserve the address space of the root port's memory apertures in the address space used by the IOMMU for remapping. Reviewed by: kib, tychon Discussed with: Anton Rang <rang@acm.org> Tested by: tychon Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27503 Notes: svn path=/head/; revision=368490
* Fix a bug in assertion: entry flags also includes IOMMU_MAP_ENTRY_UNMAPPED.Ruslan Bukin2020-11-161-2/+4
| | | | | | | | | | | The entry->flags field is initialized in iommu_gas_init_domain(). Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D27235 Notes: svn path=/head/; revision=367726
* Add device_t member to struct iommu.Ruslan Bukin2020-11-161-0/+1
| | | | | | | | | | | | This is needed on arm64 for the interface between iommu framework and iommu controller drivers. Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D27229 Notes: svn path=/head/; revision=367725
* o Add iommu de-initialization method for MSI interface.Ruslan Bukin2020-10-242-0/+26
| | | | | | | | | | | | o Add iommu_unmap_msi() to release the msi GAS entry. o Provide default implementations for iommu init/deinit methods. Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26906 Notes: svn path=/head/; revision=367016
* Assign the reserved apic region (GAS entry) to the iommu domain msi_entry.Ruslan Bukin2020-10-192-2/+4
| | | | | | | | | | Requested by: kib Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26859 Notes: svn path=/head/; revision=366835
* Manage MSI iommu pages.Ruslan Bukin2020-10-193-0/+113
| | | | | | | | | | | | | This allows the interrupt controller driver only need a small change to create a map for the page the device will write to raise an interrupt. Submitted by: andrew Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26705 Notes: svn path=/head/; revision=366833
* Split-out Guest Address Space (GAS) macroses to a separate header.Ruslan Bukin2020-10-154-23/+62
| | | | | | | Sponsored by: Innovate DSbD Notes: svn path=/head/; revision=366724
* Split-out iommu type definitions to a separate header.Ruslan Bukin2020-10-142-4/+43
| | | | | | | | | Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26780 Notes: svn path=/head/; revision=366710
* Add a per-each macro IOMMU_DOMAIN_UNLOAD_SLEEP which allows to sleepRuslan Bukin2020-10-141-3/+3
| | | | | | | | | | | during iommu guest address space entries unload. Suggested by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26722 Notes: svn path=/head/; revision=366704
* Add iommu_get_ctx_domain() that allows to get iommu domain for a givenRuslan Bukin2020-10-142-0/+8
| | | | | | | | | | iommu context. Submitted by: andrew Sponsored by: Innovate DSbD Notes: svn path=/head/; revision=366702
* Rename a header protection macro.Ruslan Bukin2020-10-141-3/+3
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=366701
* Add iommu_get_dev_ctx() helper that allows to instantiate an iommu contextRuslan Bukin2020-10-092-7/+18
| | | | | | | | | | | for a given device_t. Submitted by: andrew Reviewed by: kib Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=366571
* o Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().Ruslan Bukin2020-09-293-3/+3
| | | | | | | | | | | | | This function isn't ACPI dependent and we may use it on FDT systems as well. o Don't repeat the function declaration, include iommu.h instead. Reviewed by: andrew, kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D26584 Notes: svn path=/head/; revision=366257
* Move the rid variable to the generic iommu context.Ruslan Bukin2020-09-101-0/+1
| | | | | | | | | | | It could be used in various IOMMU platforms, not only DMAR. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D26373 Notes: svn path=/head/; revision=365577
* Move dmar_domain_unload_task to busdma_iommu.c.Ruslan Bukin2020-08-061-0/+21
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25972 Notes: svn path=/head/; revision=363949
* Add iommu_domain constructor and destructor.Ruslan Bukin2020-08-062-0/+23
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25956 Notes: svn path=/head/; revision=363946
* o Add machine/iommu.h and include MD iommu headers from it,Ruslan Bukin2020-08-052-10/+3
| | | | | | | | | | | | | so we don't ifdef for every arch in busdma_iommu.c; o No need to include specialreg.h for x86, remove it. Requested by: andrew Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25957 Notes: svn path=/head/; revision=363929
* Remove unneeded cast to struct iommu_domain *.Ruslan Bukin2020-08-041-2/+2
| | | | | | | Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=363865
* Remove free_domain() and uma_zfree_domain().Mark Johnston2020-08-041-4/+4
| | | | | | | | | | | | | | These functions were introduced before UMA started ensuring that freed memory gets placed in domain-local caches. They no longer serve any purpose since UMA now provides their functionality by default. Remove them to simplyify the kernel memory allocator interfaces a bit. Reviewed by: cem, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25937 Notes: svn path=/head/; revision=363834
* Add iommu_domain_map_ops virtual table with map/unmap methodsRuslan Bukin2020-07-312-9/+14
| | | | | | | | | | | so x86 can support Intel DMAR and AMD IOMMU simultaneously. Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25894 Notes: svn path=/head/; revision=363747
* o Don't include headers from iommu.h, include them from the headerRuslan Bukin2020-07-292-12/+4
| | | | | | | | | | | | consumers instead; o Order includes properly. Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25878 Notes: svn path=/head/; revision=363675
* o Move iommu_set_buswide_ctx, iommu_is_buswide_ctx toRuslan Bukin2020-07-292-0/+27
| | | | | | | | | | | | | the generic iommu busdma backend; o Move bus_dma_iommu_set_buswide, bus_dma_iommu_load_ident prototypes to iommu.h. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D25866 Notes: svn path=/head/; revision=363663
* o Move the buswide_ctxs bitmap to iommu_unit and rename related functions.Ruslan Bukin2020-07-282-5/+15
| | | | | | | | | | | o Rename bus_dma_dmar_load_ident() as well. Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25852 Notes: svn path=/head/; revision=363650
* Rename DMAR flags:Ruslan Bukin2020-07-263-19/+19
| | | | | | | | | | | | o DMAR_DOMAIN_* -> IOMMU_DOMAIN_* o DMAR_PGF_* -> IOMMU_PGF_* Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25812 Notes: svn path=/head/; revision=363560
* o Make the _hw_iommu sysctl node non-static;Ruslan Bukin2020-07-252-2/+5
| | | | | | | | | | | o Move the dmar sysctl knobs to _hw_iommu_dmar. Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25807 Notes: svn path=/head/; revision=363534
* o Move iommu gas prototypes, DMAR flags to iommu.h;Ruslan Bukin2020-07-252-0/+48
| | | | | | | | | | | o Move hw.dmar sysctl node to iommu_gas.c. Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25802 Notes: svn path=/head/; revision=363533
* Move Intel GAS to dev/iommu/ as now a part of generic iommu framework.Ruslan Bukin2020-07-251-0/+729
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25799 Notes: svn path=/head/; revision=363524
* Split-out the Intel GAS (Guest Address Space) management componentRuslan Bukin2020-07-251-0/+9
| | | | | | | | | | | from Intel DMAR support, so it can be used on other IOMMU systems. Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25743 Notes: svn path=/head/; revision=363515
* Move sys/iommu.h to dev/iommu/ as a part of generic IOMMU busdma backend.Ruslan Bukin2020-07-213-2/+170
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25750 Notes: svn path=/head/; revision=363388
* Move the Intel DMAR busdma backend to a generic place soRuslan Bukin2020-07-212-0/+1116
it can be used on other IOMMU systems. Reviewed by: kib Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D25720 Notes: svn path=/head/; revision=363387