From nobody Wed Sep 11 08:44:29 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 4X3Yz13Thlz5W7WR; Wed, 11 Sep 2024 08:44:29 +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 4X3Yz12l3Vz41Nq; Wed, 11 Sep 2024 08:44:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726044269; 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=btctu+wyvmzhCR0+AVFZdbnbQ7HfDR30mQ2ulnVd3EY=; b=ty6k0Ae0cfE4xwTON/cl7fhpoSDg/fs4MRS/6GmukQdjDVp5WqbYj+dCF39zbP94urYBtv uczMetMpFfiAJZoPxrTn5z7XQFwVfCkV9FZ39F4N9sZWzaUj/mmwdLNdgR5qmYcmXCwLjh 4lJr2ABEdi72uTWSlq6MzQOoVblZ5vgeCE8u8ila4QX+yCTzkaUlDv5FGcfnGLdQq4v2bA 2zNKmoNbFeIzAfweAJ8nNAUESW7UnwiMjKRJgQKA+hMUvglMJ43kc6J4l09DIKqr2H/L8+ Zf/pe7OL2nXnZs6luS2u1eVghcqufViUN/rFwHVWJPvNSduzrJvBt5y6XZDrHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726044269; a=rsa-sha256; cv=none; b=EN42r+rWSTofNy2g7ScGGX00t1euFMbDuQaFPMlbwKx3lza/j81OzQGow+0Fr7Ch7Ewmzv Nw3sYZIgGfaG7+KcyZ74SW+zpMoEnX5Pd2omaAwMg2Rl6zGMnXGSTKaJal5aqgTUHWqTKN jIRv/CbBu3CKtblOn49EBCOfK7ADkfWFckenXTnIHZiQ5aIQ5XVl8uWFom2W10AX5SxlEY rzlhnIvOKu99nJl5wHY2KdOr1yPQaPR55auiobCS6hZb/BrdpXa/kPJggZK6ZP6q9pZS/C aEa/hv4kqhZJ3hjjg5vul1QSz0gjLWgcEDeZGuXCbU8I7kyikFvYIseJdDLDig== 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=1726044269; 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=btctu+wyvmzhCR0+AVFZdbnbQ7HfDR30mQ2ulnVd3EY=; b=k8eTFnXcMJDcSbIvx9aHgZiApkE2L8uwI3iGq4ab10DIl4Se+rRlPbiB/5ukUV2SVRrWjD tkYlPsQj13hbl1O0WQeL8IxfmH9p0Y8y9NVYk+YAHZwGq4pHHKzcMFNUxxtF5AAUq0kbDt rKhJNrTR6YKf0/pB71pwNVRwL5JcvCYcx/W1Iagd7mBPEBN4aJ2KMBj8lNBGrvKtR08NDt IVsMzRw8fvPgs81punYEaXHqvn4JM1+KY1rPVQAQTGjjvn6wCP1Oe4X0tLVqngJJQs+j58 3YQp7g+0cTT30GFbctgijxK7KHMX3SG9A8UruUxEIDmpCHACbac39QADUFkKaw== 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 4X3Yz12Ln3zNqF; Wed, 11 Sep 2024 08:44:29 +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 48B8iTKW007715; Wed, 11 Sep 2024 08:44:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48B8iTCd007712; Wed, 11 Sep 2024 08:44:29 GMT (envelope-from git) Date: Wed, 11 Sep 2024 08:44:29 GMT Message-Id: <202409110844.48B8iTCd007712@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: 046d7aea4d8a - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 046d7aea4d8a707d134394396dcd941063318539 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=046d7aea4d8a707d134394396dcd941063318539 commit 046d7aea4d8a707d134394396dcd941063318539 Author: Konstantin Belousov AuthorDate: 2024-06-30 01:16:51 +0000 Commit: Konstantin Belousov CommitDate: 2024-09-11 08:43:59 +0000 x86 iommu: move device_tag_init() to utils (cherry picked from commit ff54674b09501f4302e675bb2d3e34a752a63405) --- sys/x86/iommu/intel_ctx.c | 22 +--------------------- sys/x86/iommu/iommu_utils.c | 17 +++++++++++++++++ sys/x86/iommu/x86_iommu.h | 2 ++ 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c index 082c05ff4c83..41135628ffa8 100644 --- a/sys/x86/iommu/intel_ctx.c +++ b/sys/x86/iommu/intel_ctx.c @@ -125,26 +125,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.ref_count = 1; /* Prevent free */ - 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) @@ -588,7 +568,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