From nobody Tue Jan 02 00:42:38 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T3vFq0GD0z56089; Tue, 2 Jan 2024 00:42:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T3vFp5dwNz3RrQ; Tue, 2 Jan 2024 00:42:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704156158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qLp69zZ+1q6bx2vavX9TUdH7ivIW4XMIBDHusfvUjdI=; b=xNIZMLxUcGYVh7wEACZNPo/vKvm0zTFz/X4vZr/jqxz+m3v0N5jdwTyHAtMZwp5wthQRe0 rhstoJ5FiqiAjUfrBAM+zKaLICoYT45df6FlRQQZY+OC/RsqD2snyEAPEbmMN4txW1d00x VmLsI1UF9n1B1Oo59ylP3nS550bzkNUZBFtntmJcc4g7jLbqdFm+TUPexL5Me/IpzNGqbI Q+2DwWZwonj13xPAx0ErfLke66cklk7He9qjCDnK2xUmjaPqYIdKIUOiGpHW8hA5Osjxix FqmF4XcW70QT2krPbvFFQsXTIvS8oyaw6hu2Z4E9wVWU5VropRbWc5iWZzt+qg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704156158; a=rsa-sha256; cv=none; b=KvwWv6Rht5m6mRTJ3QCGve+tWa50cP3RUvwCyyU6EOXr+PGUdRAA5Bk8ZucdjMLjfy/9HZ h/Ibg7zYWkIezNCzidDNiCR1xlhcMSlctQbz99T9516DEcRc2ggf5vjhU0nJQRBEWbACTQ aFBnYvLEDiBNSBxmGmu1kxj/XI4ot5QapqBIeLqXdmv4LU4dTJHX4No8raOTw4y7UHCsHw A/W6uSJH+qWRK44fFflglUwZQyOgeRH9EAC2qSppYf4WYkwcWp2cj/XCcGRbEJAKgBr4qR OU7oYJrLfsWxXRm0NbMnkACh2+IR080HMs57jpRoJT02uUQ73azzDrEalcepGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704156158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qLp69zZ+1q6bx2vavX9TUdH7ivIW4XMIBDHusfvUjdI=; b=pz52c75pkUp89qEVCV6zJOANlSyxLIl2HcaSm0lvelteQJX1GVYo4Art5TbivXF5uwSP7E LIIiX77zpJxYgVLLwAF5+DHKVDeIHoOknhm8d4cmkhB/5ySeIWmQ1+u9LusLhWr/SsOkac sgQU5N46KkOnvA5Dt1XjB1CVmSVE5OQ1KbKfHh6odYtFXLiws+4bwfU4i6Y2czM98vhaFA aUcMyF/tGfr3R1ZSGWR7r4HDgEgl61xdz5Lgcl4tMSuF+R9N8m+0rqVG5+jXwfwQACOLE/ FNkMYizn+a5v6p8/o6G/Oq1SwDYZFfm/huikaqHs3H+nIJU0ElgLHDobD8sZUQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T3vFp4l67zfYx; Tue, 2 Jan 2024 00:42:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4020gcVG003898; Tue, 2 Jan 2024 00:42:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4020gcaR003895; Tue, 2 Jan 2024 00:42:38 GMT (envelope-from git) Date: Tue, 2 Jan 2024 00:42:38 GMT Message-Id: <202401020042.4020gcaR003895@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5eb2fcd1f232 - stable/13 - iommu_gas: add ddb 'show iommu_domain' command List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5eb2fcd1f232f992c2c77549e5cb04aff9ae6dae Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5eb2fcd1f232f992c2c77549e5cb04aff9ae6dae commit 5eb2fcd1f232f992c2c77549e5cb04aff9ae6dae Author: Konstantin Belousov AuthorDate: 2023-12-24 14:52:00 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-02 00:42:13 +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 + +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