From f5cafae199500b3aad9ad81dc2dc6e9d97bd87df Mon Sep 17 00:00:00 2001 From: Ruslan Bukin Date: Wed, 14 Oct 2020 14:12:15 +0000 Subject: [PATCH] Add iommu_get_ctx_domain() that allows to get iommu domain for a given iommu context. Submitted by: andrew Sponsored by: Innovate DSbD --- sys/dev/iommu/iommu.h | 1 + sys/dev/iommu/iommu_gas.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/sys/dev/iommu/iommu.h b/sys/dev/iommu/iommu.h index 04b8bf8ce62..cf4aad1e44f 100644 --- a/sys/dev/iommu/iommu.h +++ b/sys/dev/iommu/iommu.h @@ -234,6 +234,7 @@ int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dma_tag_t iommu_get_dma_tag(device_t dev, device_t child); struct iommu_ctx *iommu_get_dev_ctx(device_t dev); +struct iommu_domain *iommu_get_ctx_domain(struct iommu_ctx *ctx); SYSCTL_DECL(_hw_iommu); diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index d6a09d852bf..02b82946b4a 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -208,6 +208,13 @@ iommu_gas_rb_remove(struct iommu_domain *domain, struct iommu_map_entry *entry) RB_REMOVE(iommu_gas_entries_tree, &domain->rb_root, entry); } +struct iommu_domain * +iommu_get_ctx_domain(struct iommu_ctx *ctx) +{ + + return (ctx->domain); +} + void iommu_gas_init_domain(struct iommu_domain *domain) {