From b637576aff3aad57c332710d84d34d445ca7f5dd Mon Sep 17 00:00:00 2001 From: tychon Date: Wed, 27 Mar 2019 20:15:51 +0000 Subject: [PATCH] Use the BUS_DMA_NOWRITE flag to expose and create the read-only VT-d IOMMU mappings. Reviewed by: kib Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D19729 --- sys/x86/iommu/busdma_dmar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/x86/iommu/busdma_dmar.c b/sys/x86/iommu/busdma_dmar.c index c4bcef01b461..a8d02a5af96d 100644 --- a/sys/x86/iommu/busdma_dmar.c +++ b/sys/x86/iommu/busdma_dmar.c @@ -527,7 +527,8 @@ dmar_bus_dmamap_load_something1(struct bus_dma_tag_dmar *tag, gas_flags |= DMAR_GM_CANSPLIT; error = dmar_gas_map(domain, &tag->common, size, offset, - DMAR_MAP_ENTRY_READ | DMAR_MAP_ENTRY_WRITE, + DMAR_MAP_ENTRY_READ | + ((flags & BUS_DMA_NOWRITE) == 0 ? DMAR_MAP_ENTRY_WRITE : 0), gas_flags, ma + idx, &entry); if (error != 0) break;