Date: Wed, 11 Sep 2024 08:44:30 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c7447c45fb00 - stable/14 - x86 dmar: generalize dmar_domain_free_entry() into iommu_domain_free_entry() Message-ID: <202409110844.48B8iUlX007759@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c7447c45fb00cfd06b639d9b78f7b5b7ab79520c commit c7447c45fb00cfd06b639d9b78f7b5b7ab79520c Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-07-07 03:22:00 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-09-11 08:44:00 +0000 x86 dmar: generalize dmar_domain_free_entry() into iommu_domain_free_entry() (cherry picked from commit b3042e3a7c6ffee3867d52b192c6a9f4f49faf4b) --- sys/x86/iommu/intel_ctx.c | 19 +++---------------- sys/x86/iommu/intel_dmar.h | 1 - sys/x86/iommu/iommu_utils.c | 14 ++++++++++++++ sys/x86/iommu/x86_iommu.h | 2 ++ 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c index 41135628ffa8..814a5a8c7105 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -834,19 +834,6 @@ dmar_find_ctx_locked(struct dmar_unit *dmar, uint16_t rid) return (NULL); } -void -dmar_domain_free_entry(struct iommu_map_entry *entry, bool free) -{ - if ((entry->flags & IOMMU_MAP_ENTRY_RMRR) != 0) - iommu_gas_free_region(entry); - else - iommu_gas_free_space(entry); - if (free) - iommu_gas_free_entry(entry); - else - entry->flags = 0; -} - /* * If the given value for "free" is true, then the caller must not be using * the entry's dmamap_link field. @@ -875,12 +862,12 @@ dmar_domain_unload_entry(struct iommu_map_entry *entry, bool free, } else { iommu_qi_invalidate_sync(&domain->iodom, entry->start, entry->end - entry->start, cansleep); - dmar_domain_free_entry(entry, false); + iommu_domain_free_entry(entry, false); } } else { domain_flush_iotlb_sync(domain, entry->start, entry->end - entry->start); - dmar_domain_free_entry(entry, free); + iommu_domain_free_entry(entry, free); } } @@ -916,7 +903,7 @@ dmar_domain_unload(struct iommu_domain *iodom, domain_flush_iotlb_sync(domain, entry->start, entry->end - entry->start); TAILQ_REMOVE(entries, entry, dmamap_link); - dmar_domain_free_entry(entry, true); + iommu_domain_free_entry(entry, true); } } if (TAILQ_EMPTY(entries)) diff --git a/sys/x86/iommu/intel_dmar.h b/sys/x86/iommu/intel_dmar.h index 0242e0cb954f..edb152f42fe7 100644 --- a/sys/x86/iommu/intel_dmar.h +++ b/sys/x86/iommu/intel_dmar.h @@ -243,7 +243,6 @@ void dmar_free_ctx_method(struct iommu_ctx *ctx); struct dmar_ctx *dmar_find_ctx_locked(struct dmar_unit *dmar, uint16_t rid); struct iommu_ctx *dmar_get_ctx(struct iommu_unit *iommu, device_t dev, uint16_t rid, bool id_mapped, bool rmrr_init); -void dmar_domain_free_entry(struct iommu_map_entry *entry, bool free); void dmar_domain_unload_entry(struct iommu_map_entry *entry, bool free, bool cansleep); void dmar_domain_unload(struct iommu_domain *iodom, diff --git a/sys/x86/iommu/iommu_utils.c b/sys/x86/iommu/iommu_utils.c index 20ca7890ce65..9c6cae5ff51f 100644 --- a/sys/x86/iommu/iommu_utils.c +++ b/sys/x86/iommu/iommu_utils.c @@ -605,3 +605,17 @@ iommu_device_tag_init(struct iommu_ctx *ctx, device_t dev) ctx->tag->ctx = ctx; ctx->tag->owner = dev; } + +void +iommu_domain_free_entry(struct iommu_map_entry *entry, bool free) +{ + if ((entry->flags & IOMMU_MAP_ENTRY_RMRR) != 0) + iommu_gas_free_region(entry); + else + iommu_gas_free_space(entry); + if (free) + iommu_gas_free_entry(entry); + else + entry->flags = 0; +} + diff --git a/sys/x86/iommu/x86_iommu.h b/sys/x86/iommu/x86_iommu.h index 5f56a2db74b5..9e3a82283729 100644 --- a/sys/x86/iommu/x86_iommu.h +++ b/sys/x86/iommu/x86_iommu.h @@ -167,6 +167,8 @@ struct x86_unit_common { struct iommu_msi_data intrs[IOMMU_MAX_MSI]; }; +void iommu_domain_free_entry(struct iommu_map_entry *entry, bool free); + void iommu_qi_emit_wait_seq(struct iommu_unit *unit, struct iommu_qi_genseq * pseq, bool emit_wait); void iommu_qi_wait_for_seq(struct iommu_unit *unit, const struct
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202409110844.48B8iUlX007759>