From nobody Tue Dec 26 01:28:50 2023 X-Original-To: dev-commits-src-main@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 4SzccL3Qn0z55Gvl; Tue, 26 Dec 2023 01:28:50 +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 4SzccL2BZ0z3fxp; Tue, 26 Dec 2023 01:28:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703554130; 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=qP5yZSJO+jBzEusfp9SjXuMiCuxOZJNP+xS/RU+FjvE=; b=SMra+y7F+Z4+zktPNVanNJ+wy0G8GZbUvkfwo/QUjz6+q5zGFeudAPxGVmpQskA4w/a3Ys f1pM3jIaZ71SsLeZJ3jgARjnE9ug9tJw8q4XdnoxcH/jEefeQwgIWRK+dTW5nLrG+vSxhU PCsy6SkJsWhIPB6rnrDxj/le4og/pOfY4I87Vh7kZAAY9IHfsLcKVIkr4fwYRDNZlIgdIo KSAQClQTbatgsD0RBRxy45pHJuprWeLxhbnv+jog2edEMzSNYha1seTndXQxFQlUQlFaM5 asbiL0DnEMfURJcgO369JvXuQ3mAFouj+Y0yCHcvGgHU/nND+zPVVUM0Oy8PZw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703554130; a=rsa-sha256; cv=none; b=u6XgiUnIrCO10dTDF9/Vp/+LAYfC8SiLL51odt5uVocbZXEydUKc8CnSCOS1jYKdFwlewe 1nqhOhCSO3Yb1ci9ahrpZUFOxJygAEPJ0Zvd7WXg+WRFMYn5ShBSxAeSW2gV8IofP6mXyc uzaixJyrHc9QNUrIsyCrmA9EW/inqzdB8SMkU/AsRBfgi7MB0Gr3JTLY8Kf5SB0aVU/lAV SCKD0dNnJ5PBCb25Fo9JBusqNSx6WFwTDNKbQHQVGE5yGYemau1OR7I8Axzc368TUR9xP3 WjNKALKDTugTw1ffkAlO6llObXOm85gkImJlRV3RoP2w+DsuSGRxdV/4ZwSMyA== 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=1703554130; 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=qP5yZSJO+jBzEusfp9SjXuMiCuxOZJNP+xS/RU+FjvE=; b=qbHDPn7TdvXQ6ioZ1cQ3uxK6L73+HLLQu6Sra8lNH03ADUwGRfi++ecGdxxZE712v4PPG+ 9IdDEaNG7NSp/DKy4DaP+JUIlS6cVaaJsku2DaPgFUZZnOzFlFOJ1L1EJQFNcI6ZEe670C 15jHjg/F23THEMoZyjqXSug/+seEjYs7pVNY8IuQ7cc/XhlB2JEnM8xYDOYU/j6yDDzIMn VCtvoj5wZ6sd4q0a+//XVyRcJtNORWnVGQavjFmj02YiBWEgSImdSf5d+c/Wp11UjSyDSh T5AVol45DD3biiUyhgj+asMDd5xTunGl6eZq2ZwaT4S/RUeIPoXoxwrdXUxXPA== 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 4SzccL1GK4zZvC; Tue, 26 Dec 2023 01:28:50 +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 3BQ1Soff035438; Tue, 26 Dec 2023 01:28:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BQ1SoTx035435; Tue, 26 Dec 2023 01:28:50 GMT (envelope-from git) Date: Tue, 26 Dec 2023 01:28:50 GMT Message-Id: <202312260128.3BQ1SoTx035435@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 30ce85ca1143 - main - iommu_gas: add ddb 'show iommu_domain' command List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 30ce85ca11433ba05cdbab8aedceaa15a93bd97a Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=30ce85ca11433ba05cdbab8aedceaa15a93bd97a commit 30ce85ca11433ba05cdbab8aedceaa15a93bd97a Author: Konstantin Belousov AuthorDate: 2023-12-24 14:52:00 +0000 Commit: Konstantin Belousov 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 + +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