git: 30ce85ca1143 - main - iommu_gas: add ddb 'show iommu_domain' command
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Dec 2023 01:28:50 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=30ce85ca11433ba05cdbab8aedceaa15a93bd97a commit 30ce85ca11433ba05cdbab8aedceaa15a93bd97a Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-12-24 14:52:00 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-12-26 01:28:22 +0000 iommu_gas: add ddb 'show iommu_domain' command Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/dev/iommu/iommu_gas.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index cc541e748f48..72db5ca871ec 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -1031,3 +1031,48 @@ SYSCTL_INT(_hw_iommu, OID_AUTO, check_free, CTLFLAG_RWTUN, &iommu_check_free, 0, "Check the GPA RBtree for free_down and free_after validity"); #endif + +#include "opt_ddb.h" +#ifdef DDB + +#include <ddb/ddb.h> + +static void +iommu_debug_dump_gas(struct iommu_domain *domain) +{ + struct iommu_map_entry *entry; + + db_printf("iommu_domain %p tree %p iommu %p fl %#x\n", domain, + &domain->rb_root, domain->iommu, domain->flags); + db_printf("iommu_domain %p tree %p\n", domain, &domain->rb_root); + RB_FOREACH(entry, iommu_gas_entries_tree, &domain->rb_root) { + db_printf( + " e %p [%#jx %#jx] fl %#x first %#jx last %#jx free_down %#jx", + entry, (uintmax_t)entry->start, (uintmax_t)entry->end, + entry->flags, + (uintmax_t)entry->first, (uintmax_t)entry->last, + (uintmax_t)entry->free_down); + if (entry == domain->start_gap) + db_printf(" start_gap"); + if (entry == domain->first_place) + db_printf(" first_place"); + if (entry == domain->last_place) + db_printf(" last_place"); + db_printf("\n"); + } +} + +DB_SHOW_COMMAND(iommu_domain, iommu_domain_show) +{ + struct iommu_domain *domain; + + if (!have_addr) { + db_printf("show iommu_domain addr\n"); + return; + } + + domain = (void *)addr; + iommu_debug_dump_gas(domain); +} + +#endif