From nobody Wed Sep 04 21:50: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 4WzblX2qlvz5VS4w; Wed, 04 Sep 2024 21:50: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 4WzblX17rbz4hQy; Wed, 4 Sep 2024 21:50:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725486648; 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=Chra9jl4EA/8VYddGt6Ag1COTiIt6Jbc6xgmocofp1E=; b=AB2Gvx0NtCS3xmMNCyP/uQNKsjp/8292CzLIc+YWuXgfSG7tVEw11fBvID7/ReckhUPXZ/ 3IbrnIWYgHFLH6jmsvS2rKdYH64JljoeWI9Ow1RhQP9S+38JUe5BCtMEqrfq3sJi0Akq5z eXwyA5cO1VHoqiMsBoIiv16zDR1ZRKgSU+yKF6m4oKFf0bpyTYhxKlKE/hMGtHJJb4gjao q4w8hRv5ICXdsP05m9fM4lbCxE+aPWzV4aHNyTvc5vvJjYfaVC4ZUIOHlOJeXtMG5SanZr WjHMP0PpsC0lWqbybgvWzUvlLmBqBexYWCin/nmhC3HFjQeRG8e8KX1bwLpDAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725486648; a=rsa-sha256; cv=none; b=IQfrX3WnI08vdkutsCYC52PTXvPEfsURNxPg21eG6MshJAfBKwWTUGjl+KxBLoKut2wciq JEHikFSnCtrCt53eKBhh36V4Qe1Ah8UPYWoV9q5C9FKUYcG2mrXBrHgT2Q/woRbjv7rxZ9 T6tOBkfUfZHebiPQVT91ihRvltFfTBihJuB587paBZz/52xBe2qNUT8rXpmfS5dn65mBxW /sjRWyzvDz/+UsqOPuEV3y2koipaDpC73+Eru9OQHQUS3VZmmIQVJTQmnubcVJoeZxHg03 JM6SEbA6KDJ0ntu9hZx8aMPRfaPy4/nTOo9xiN5MYrOXqDCovn7XU2FS19w1Mw== 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=1725486648; 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=Chra9jl4EA/8VYddGt6Ag1COTiIt6Jbc6xgmocofp1E=; b=eKJyrOm7OjSv9vBAT9W/8pzONzUJfaE72qn/AAG5K/+1lq0l+taUdvklHZdGC9m91QZYvj wqUN+oimbmZoEAcnQK9L7Q6yBRj88MybH2ZsS/+kNX8m9OS0B2AHrQ9yWUNTvQoGqV8Pim EbJR8pOatlxsMXvP9hc7N6tfoTsAUYsmApZRGkRebwiGjAoNok0mcD/pKkdQl6tBb1vOeP uYMcv/TXx7g+icQaZUhNsMFK1hzK1kpMwY1S19bJDY7L4h+ivEw/Fbbel8aLGok/iDw4RN tdRaUT/hpNmzzxQ8bd64lWsPEEbcE9rwV8sTxNvmrEbvv3Pq57qX9mORbn+RjA== 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 4WzblX0mCSzhmf; Wed, 4 Sep 2024 21:50: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 484LompP032725; Wed, 4 Sep 2024 21:50:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484LomsT032722; Wed, 4 Sep 2024 21:50:48 GMT (envelope-from git) Date: Wed, 4 Sep 2024 21:50:48 GMT Message-Id: <202409042150.484LomsT032722@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: ff54674b0950 - main - x86 iommu: move device_tag_init() to utils 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/main X-Git-Reftype: branch X-Git-Commit: ff54674b09501f4302e675bb2d3e34a752a63405 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ff54674b09501f4302e675bb2d3e34a752a63405 commit ff54674b09501f4302e675bb2d3e34a752a63405 Author: Konstantin Belousov AuthorDate: 2024-06-30 01:16:51 +0000 Commit: Konstantin Belousov CommitDate: 2024-09-04 21:50:19 +0000 x86 iommu: move device_tag_init() to utils Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/x86/iommu/intel_ctx.c | 21 +-------------------- sys/x86/iommu/iommu_utils.c | 17 +++++++++++++++++ sys/x86/iommu/x86_iommu.h | 2 ++ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c index e39d2a136d8a..12dd0f0a5259 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -124,25 +124,6 @@ dmar_map_ctx_entry(struct dmar_ctx *ctx, struct sf_buf **sfp) return (ctxp); } -static void -device_tag_init(struct dmar_ctx *ctx, device_t dev) -{ - struct dmar_domain *domain; - bus_addr_t maxaddr; - - domain = CTX2DOM(ctx); - maxaddr = MIN(domain->iodom.end, BUS_SPACE_MAXADDR); - ctx->context.tag->common.impl = &bus_dma_iommu_impl; - ctx->context.tag->common.boundary = 0; - ctx->context.tag->common.lowaddr = maxaddr; - ctx->context.tag->common.highaddr = maxaddr; - ctx->context.tag->common.maxsize = maxaddr; - ctx->context.tag->common.nsegments = BUS_SPACE_UNRESTRICTED; - ctx->context.tag->common.maxsegsz = maxaddr; - ctx->context.tag->ctx = CTX2IOCTX(ctx); - ctx->context.tag->owner = dev; -} - static void ctx_id_entry_init_one(dmar_ctx_entry_t *ctxp, struct dmar_domain *domain, vm_page_t ctx_root) @@ -586,7 +567,7 @@ dmar_get_ctx_for_dev1(struct dmar_unit *dmar, device_t dev, uint16_t rid, ctx = ctx1; dmar_ctx_link(ctx); ctx->context.tag->owner = dev; - device_tag_init(ctx, dev); + iommu_device_tag_init(CTX2IOCTX(ctx), dev); /* * This is the first activated context for the diff --git a/sys/x86/iommu/iommu_utils.c b/sys/x86/iommu/iommu_utils.c index 04d42799310e..20ca7890ce65 100644 --- a/sys/x86/iommu/iommu_utils.c +++ b/sys/x86/iommu/iommu_utils.c @@ -588,3 +588,20 @@ iommu_release_intr(struct iommu_unit *unit, int idx) dev, dmd->irq); dmd->irq = -1; } + +void +iommu_device_tag_init(struct iommu_ctx *ctx, device_t dev) +{ + bus_addr_t maxaddr; + + maxaddr = MIN(ctx->domain->end, BUS_SPACE_MAXADDR); + ctx->tag->common.impl = &bus_dma_iommu_impl; + ctx->tag->common.boundary = 0; + ctx->tag->common.lowaddr = maxaddr; + ctx->tag->common.highaddr = maxaddr; + ctx->tag->common.maxsize = maxaddr; + ctx->tag->common.nsegments = BUS_SPACE_UNRESTRICTED; + ctx->tag->common.maxsegsz = maxaddr; + ctx->tag->ctx = ctx; + ctx->tag->owner = dev; +} diff --git a/sys/x86/iommu/x86_iommu.h b/sys/x86/iommu/x86_iommu.h index d6e3ea56bd2c..5f56a2db74b5 100644 --- a/sys/x86/iommu/x86_iommu.h +++ b/sys/x86/iommu/x86_iommu.h @@ -183,4 +183,6 @@ void iommu_qi_common_fini(struct iommu_unit *unit, void (*disable_qi)( int iommu_alloc_irq(struct iommu_unit *unit, int idx); void iommu_release_intr(struct iommu_unit *unit, int idx); +void iommu_device_tag_init(struct iommu_ctx *ctx, device_t dev); + #endif