From nobody Sun Oct 20 00:34:48 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 4XWKG074YSz5ZWcb; Sun, 20 Oct 2024 00:34:48 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XWKG04pt2z4ZPd; Sun, 20 Oct 2024 00:34:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729384488; 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=/Dblnaa6N97Q/tWoZ5Dp+J9dpz8CGUbzT6zJ4T2z+O4=; b=uFBoetJOo/CsiRzGLNRy7F5xnVHXzAoAboxBTe9yOBI5M7UdrBxlmOiPHaPJYGllCOEDW/ q+bfBBeAW+ICA8nuqpkHtRP3l7N+kYso0OHdCsHqvYtP6BHpR+qNB2hJJUaxgaHftMvyCK J6xDlyYyqk/rWI8vzIvtpkCJ5xMesZJICwy0ZQwgK4krBtxH1SAWDzGXnSB+7wNmUzgZKZ zFP9LdRcBTS96aMGZPisN2ECSm3EfNZnGVxxgoocra0KZzG1WY+ANOQJo9ZbCytis8FNvD a0V9K3N1BLa9WrSpO0SM+VxXcFsJrZfKC1YRo6eH6lraxHWb/azm6jPDOgH3FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729384488; 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=/Dblnaa6N97Q/tWoZ5Dp+J9dpz8CGUbzT6zJ4T2z+O4=; b=EvW+F0xGNW5rN+2CIjUVKW52qdJqFc9YYlidwbNvuRL/pHr3Gaurm1Pf1U4d5SXJVr79md r7gk5xKguQGBskzLufUXK/xnfcXJZ9orBpzDq7U5BoaNl/6elg/uo0/fTJu+8tZuwCa4Aa lZIZv2agn0b26ULc0e6TkJXSV1k8BdeRyAdP9kaS1yywUQqhice0Hv3Vr8+eKuyleN3GiN l4YvTVZCyXzviMZa5hnb6B0IJ2F49gRegkx7mUvrrvMucOgLkL7scdQkE70dK5KW8gjvTJ ff0yzXKTPp37O2RxDYp4sNgIS44bjlJmv3/9cauGrnZae3wNGKRnScQViCkxkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729384488; a=rsa-sha256; cv=none; b=tkUj0USKDECKOUBA41RJdQhbvBu7jAjS+b0VwQbWNkDQ76kMlsRwWfwYFjFmpJ8NdJjNeF ZofUjSi5Gs0FeyCUpwOFAhTFuVlGPzYBj9ohmKiTio+1tJG6k/y+jD01+HnDbedf1dwdkH 5iq7AK+m2Jg4nGF3OorTITKbs6UJnAh/RUJC6CyCJ8p/fSBml7rn2Zrk0+cJxGy8i26rxY Fa9JhXYd6TYnvFwBChEZUrzT+AYNQQ4M9hvzmB8uwes4QkfWfDcScGKavtM4j8gRh2Og/I AIOtaT7XzDlYdl1AEenzlvu4laV6fekFZxXIxwmAb5Znqpsl1abwD9e1nAF8qg== 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 4XWKG04NJjzfmF; Sun, 20 Oct 2024 00:34:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49K0YmvT061467; Sun, 20 Oct 2024 00:34:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49K0YmqN061464; Sun, 20 Oct 2024 00:34:48 GMT (envelope-from git) Date: Sun, 20 Oct 2024 00:34:48 GMT Message-Id: <202410200034.49K0YmqN061464@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: d4bcad451f5d - stable/14 - iommu: extract driver-independent ddb context and mapping reporting 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/14 X-Git-Reftype: branch X-Git-Commit: d4bcad451f5dc920748dda66b460a7985354b0da Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d4bcad451f5dc920748dda66b460a7985354b0da commit d4bcad451f5dc920748dda66b460a7985354b0da Author: Konstantin Belousov AuthorDate: 2024-10-12 20:18:05 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-20 00:33:04 +0000 iommu: extract driver-independent ddb context and mapping reporting (cherry picked from commit c9e22c749c0f3950b4526f630f6853ab104ab52f) --- sys/x86/iommu/intel_drv.c | 28 +++++----------------------- sys/x86/iommu/iommu_utils.c | 35 +++++++++++++++++++++++++++++++++++ sys/x86/iommu/x86_iommu.h | 2 ++ 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c index e973115df21b..ebc77879480b 100644 --- a/sys/x86/iommu/intel_drv.c +++ b/sys/x86/iommu/intel_drv.c @@ -1057,8 +1057,6 @@ static void dmar_print_domain(struct dmar_domain *domain, bool show_mappings) { struct iommu_domain *iodom; - struct iommu_map_entry *entry; - struct iommu_ctx *ctx; iodom = DOM2IODOM(domain); @@ -1068,27 +1066,11 @@ dmar_print_domain(struct dmar_domain *domain, bool show_mappings) domain, domain->domain, domain->mgaw, domain->agaw, domain->pglvl, (uintmax_t)domain->iodom.end, domain->refs, domain->ctx_cnt, domain->iodom.flags, domain->pgtbl_obj, domain->iodom.entries_cnt); - if (!LIST_EMPTY(&iodom->contexts)) { - db_printf(" Contexts:\n"); - LIST_FOREACH(ctx, &iodom->contexts, link) - iommu_db_print_ctx(ctx); - } - if (!show_mappings) - return; - db_printf(" mapped:\n"); - RB_FOREACH(entry, iommu_gas_entries_tree, &iodom->rb_root) { - iommu_db_print_domain_entry(entry); - if (db_pager_quit) - break; - } - if (db_pager_quit) - return; - db_printf(" unloading:\n"); - TAILQ_FOREACH(entry, &domain->iodom.unload_entries, dmamap_link) { - iommu_db_print_domain_entry(entry); - if (db_pager_quit) - break; - } + + iommu_db_domain_print_contexts(iodom); + + if (show_mappings) + iommu_db_domain_print_mappings(iodom); } DB_SHOW_COMMAND_FLAGS(dmar_domain, db_dmar_print_domain, CS_OWN) diff --git a/sys/x86/iommu/iommu_utils.c b/sys/x86/iommu/iommu_utils.c index fde3f150947b..259c87403b07 100644 --- a/sys/x86/iommu/iommu_utils.c +++ b/sys/x86/iommu/iommu_utils.c @@ -796,4 +796,39 @@ iommu_db_print_ctx(struct iommu_ctx *ctx) pci_get_function(ctx->tag->owner), ctx->refs, ctx->flags, ctx->loads, ctx->unloads); } + +void +iommu_db_domain_print_contexts(struct iommu_domain *iodom) +{ + struct iommu_ctx *ctx; + + if (LIST_EMPTY(&iodom->contexts)) + return; + + db_printf(" Contexts:\n"); + LIST_FOREACH(ctx, &iodom->contexts, link) + iommu_db_print_ctx(ctx); +} + +void +iommu_db_domain_print_mappings(struct iommu_domain *iodom) +{ + struct iommu_map_entry *entry; + + db_printf(" mapped:\n"); + RB_FOREACH(entry, iommu_gas_entries_tree, &iodom->rb_root) { + iommu_db_print_domain_entry(entry); + if (db_pager_quit) + break; + } + if (db_pager_quit) + return; + db_printf(" unloading:\n"); + TAILQ_FOREACH(entry, &iodom->unload_entries, dmamap_link) { + iommu_db_print_domain_entry(entry); + if (db_pager_quit) + break; + } +} + #endif diff --git a/sys/x86/iommu/x86_iommu.h b/sys/x86/iommu/x86_iommu.h index 043935a3e0de..92ac993e7c9c 100644 --- a/sys/x86/iommu/x86_iommu.h +++ b/sys/x86/iommu/x86_iommu.h @@ -196,5 +196,7 @@ iommu_gaddr_t pglvl_page_size(int total_pglvl, int lvl); void iommu_db_print_domain_entry(const struct iommu_map_entry *entry); void iommu_db_print_ctx(struct iommu_ctx *ctx); +void iommu_db_domain_print_contexts(struct iommu_domain *iodom); +void iommu_db_domain_print_mappings(struct iommu_domain *iodom); #endif