Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jan 2024 00:41:53 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: 1bb758df1aec - stable/14 - iommu_gas: add ddb 'show iommu_domain' command
Message-ID:  <202401020041.4020frDv096714@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=1bb758df1aecbeaae484b7faf3d16ccfbb314b4f

commit 1bb758df1aecbeaae484b7faf3d16ccfbb314b4f
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-12-24 14:52:00 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-02 00:41:38 +0000

    iommu_gas: add ddb 'show iommu_domain' command
    
    (cherry picked from commit 30ce85ca11433ba05cdbab8aedceaa15a93bd97a)
---
 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401020041.4020frDv096714>