aboutsummaryrefslogtreecommitdiff
path: root/sys/x86/iommu/intel_ctx.c
diff options
context:
space:
mode:
authorRuslan Bukin <br@FreeBSD.org>2020-09-10 14:12:25 +0000
committerRuslan Bukin <br@FreeBSD.org>2020-09-10 14:12:25 +0000
commitcb9050dd21b28f6e735649556ca63d09c4ba4efb (patch)
tree956a9e1f8a6d165cebe4fec2544d463c82c79613 /sys/x86/iommu/intel_ctx.c
parent22a39a89129067ab2d3edd486f159ee668b52394 (diff)
downloadsrc-cb9050dd21b28f6e735649556ca63d09c4ba4efb.tar.gz
src-cb9050dd21b28f6e735649556ca63d09c4ba4efb.zip
Move the rid variable to the generic iommu context.
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
Notes: svn path=/head/; revision=365577
Diffstat (limited to 'sys/x86/iommu/intel_ctx.c')
-rw-r--r--sys/x86/iommu/intel_ctx.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c
index 207988ce30ba..7a582a91828c 100644
--- a/sys/x86/iommu/intel_ctx.c
+++ b/sys/x86/iommu/intel_ctx.c
@@ -118,9 +118,9 @@ dmar_map_ctx_entry(struct dmar_ctx *ctx, struct sf_buf **sfp)
dmar = CTX2DMAR(ctx);
- ctxp = dmar_map_pgtbl(dmar->ctx_obj, 1 +
- PCI_RID2BUS(ctx->rid), IOMMU_PGF_NOALLOC | IOMMU_PGF_WAITOK, sfp);
- ctxp += ctx->rid & 0xff;
+ ctxp = dmar_map_pgtbl(dmar->ctx_obj, 1 + PCI_RID2BUS(ctx->context.rid),
+ IOMMU_PGF_NOALLOC | IOMMU_PGF_WAITOK, sfp);
+ ctxp += ctx->context.rid & 0xff;
return (ctxp);
}
@@ -386,7 +386,7 @@ dmar_ctx_alloc(struct dmar_domain *domain, uint16_t rid)
ctx->context.domain = DOM2IODOM(domain);
ctx->context.tag = malloc(sizeof(struct bus_dma_tag_iommu),
M_DMAR_CTX, M_WAITOK | M_ZERO);
- ctx->rid = rid;
+ ctx->context.rid = rid;
ctx->refs = 1;
return (ctx);
}
@@ -643,8 +643,9 @@ dmar_move_ctx_to_domain(struct dmar_domain *domain, struct dmar_ctx *ctx)
error = dmar_flush_for_ctx_entry(dmar, true);
/* If flush failed, rolling back would not work as well. */
printf("dmar%d rid %x domain %d->%d %s-mapped\n",
- dmar->iommu.unit, ctx->rid, old_domain->domain, domain->domain,
- (domain->iodom.flags & IOMMU_DOMAIN_IDMAP) != 0 ? "id" : "re");
+ dmar->iommu.unit, ctx->context.rid, old_domain->domain,
+ domain->domain, (domain->iodom.flags & IOMMU_DOMAIN_IDMAP) != 0 ?
+ "id" : "re");
dmar_unref_domain_locked(dmar, old_domain);
TD_PINNED_ASSERT;
return (error);
@@ -776,7 +777,7 @@ dmar_find_ctx_locked(struct dmar_unit *dmar, uint16_t rid)
LIST_FOREACH(domain, &dmar->domains, link) {
LIST_FOREACH(ctx, &domain->contexts, link) {
- if (ctx->rid == rid)
+ if (ctx->context.rid == rid)
return (ctx);
}
}