From nobody Sat Oct 05 07:11:31 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 4XLGmh4FgVz5Xrmc; Sat, 05 Oct 2024 07:11:32 +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 4XLGmh1KFtz4Nc0; Sat, 5 Oct 2024 07:11:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728112292; 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=yfwAle2T8qzdPiA5g8VKAIkWHrGSWbS5dSKClPLI0mw=; b=yY94mnmQm2cZQ4oAmfIPZWqHxzfxXeDm5l1uJZ74JYpam3KDIcPqg5mqj8KQLpfMNcDiCg uDvEeLHhsDiFOZwg3ygDNs02P1ErJ2LjMRUAGHnJ45dSGZsBHvIclOBDaTJ21kePmBmvxl eWCCnFh+XWJLtdJbKEvhGTnmiuCQQ0ZHzaVSsRkFADX3Z5mtm3p6Rh4fXYKTzi1tS3jlMb yEDerMwIGL1W8JbHarPLsrF8kxUoInbuSOuFdVLHqX06H46ySch4QWH5E2jpFqCRF49nxr MZmmDI0ku5vc+CuTIPO2xhGtePkoRn6KxWQtU0BSDiltVHwfLG8x2+eLi90HMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728112292; 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=yfwAle2T8qzdPiA5g8VKAIkWHrGSWbS5dSKClPLI0mw=; b=fvIaCwiyRYDMw6m3uNGIpe1ullxY3nhlYQJ1KC+BwL1/swbhLp62b2P9u827idNh0YzaJt yqpa8cmtOAYwc2egJCB7Gzf9lau6R7cWtutsuTMbi0frW23aA0nBy4be+mdU8xYRyuQl/s 6ilFgI8G/6PkjRQY2T6p7L5hgkT6su/LW7ETi4SBWVSKOkmUdOVPqZTU9z+r9nM5cQmyCM UFyqCzoq86NEsr7r13BDbXFJdtXiJHMYybbR2jCMNpyhMy0oCoY/r3Zpz15u0bm4GB9qjc 1IGkTplmLhXuVM8xmOKQiIdLmXJCe4VBOOV9cxx3q3qMxrvGVr9wI7iQ/y1vTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728112292; a=rsa-sha256; cv=none; b=eXjJ13X87xIu5U4ZbCdC6BBtpykutjOylHQOrxXOhpkmhQWxFZtYQna9PNv0sV2OHQJmzb KH7uCP4OZ61eX8Jgilur8T3/c2/fdNTHJm0WFpO6W/xXi9sQ6oQwLMzGy46v7xyGq+QG2B xP5O7UVNNMFALvVS4UHgTUxB0fUEwRPWU2Zd6xNgn6O/RD3L2HX14Hd/wbN2b6TNr4QoCn cO6SaYnGmm8k2WXg/iZIAP5rtrNRp0YaeBnnyRXrMkHV4FSXF8VA6jqLwLrV8m6kdfJtXn uEbHL4HPWtcHpJgS8jEIMU8WDrwC4387CE8aQUo2rAfW4cs6PMeMpoBVpSLiWw== 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 4XLGmh0Y8lz17mF; Sat, 5 Oct 2024 07:11:32 +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 4957BV4s001752; Sat, 5 Oct 2024 07:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4957BVVH001749; Sat, 5 Oct 2024 07:11:31 GMT (envelope-from git) Date: Sat, 5 Oct 2024 07:11:31 GMT Message-Id: <202410050711.4957BVVH001749@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: 5e70f9aa9eec - stable/14 - iommu: add per-unit sysctls reporting the state of DMA and interrupt remapping 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: 5e70f9aa9eecc1f7ad177575720281af8b8747d6 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5e70f9aa9eecc1f7ad177575720281af8b8747d6 commit 5e70f9aa9eecc1f7ad177575720281af8b8747d6 Author: Konstantin Belousov AuthorDate: 2024-09-27 01:17:57 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-05 07:08:56 +0000 iommu: add per-unit sysctls reporting the state of DMA and interrupt remapping (cherry picked from commit d50403a6919a641abfb0da4d60eb58ce42302de5) --- sys/arm64/iommu/iommu.c | 2 ++ sys/dev/iommu/busdma_iommu.c | 4 ++++ sys/dev/iommu/iommu.h | 1 + sys/x86/iommu/intel_drv.c | 2 ++ sys/x86/iommu/intel_intrmap.c | 5 ++++- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/arm64/iommu/iommu.c b/sys/arm64/iommu/iommu.c index d876d443ffa0..cdff7cdf4ae2 100644 --- a/sys/arm64/iommu/iommu.c +++ b/sys/arm64/iommu/iommu.c @@ -456,6 +456,7 @@ iommu_register(struct iommu_unit *iommu) LIST_INSERT_HEAD(&iommu_list, entry, next); IOMMU_LIST_UNLOCK(); + sysctl_ctx_init(&iommu->sysctl_ctx); iommu_init_busdma(iommu); return (0); @@ -476,6 +477,7 @@ iommu_unregister(struct iommu_unit *iommu) IOMMU_LIST_UNLOCK(); iommu_fini_busdma(iommu); + sysctl_ctx_free(&iommu->sysctl_ctx); mtx_destroy(&iommu->lock); diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c index 0d86ff0d4468..f3b58306d6af 100644 --- a/sys/dev/iommu/busdma_iommu.c +++ b/sys/dev/iommu/busdma_iommu.c @@ -974,6 +974,10 @@ iommu_init_busdma(struct iommu_unit *unit) error = TUNABLE_INT_FETCH("hw.iommu.dma", &unit->dma_enabled); if (error == 0) /* compatibility */ TUNABLE_INT_FETCH("hw.dmar.dma", &unit->dma_enabled); + SYSCTL_ADD_INT(&unit->sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(unit->dev)), + OID_AUTO, "dma", CTLFLAG_RD, &unit->dma_enabled, 0, + "DMA ops enabled"); TAILQ_INIT(&unit->delayed_maps); TASK_INIT(&unit->dmamap_load_task, 0, iommu_bus_task_dmamap, unit); unit->delayed_taskqueue = taskqueue_create("iommu", M_WAITOK, diff --git a/sys/dev/iommu/iommu.h b/sys/dev/iommu/iommu.h index 9845b09e8732..957d4e14e8e2 100644 --- a/sys/dev/iommu/iommu.h +++ b/sys/dev/iommu/iommu.h @@ -67,6 +67,7 @@ struct iommu_unit { struct mtx lock; device_t dev; int unit; + struct sysctl_ctx_list sysctl_ctx; int dma_enabled; diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c index 05fb49538add..cc16759ebe34 100644 --- a/sys/x86/iommu/intel_drv.c +++ b/sys/x86/iommu/intel_drv.c @@ -256,6 +256,7 @@ dmar_release_resources(device_t dev, struct dmar_unit *unit) vm_object_deallocate(unit->ctx_obj); unit->ctx_obj = NULL; } + sysctl_ctx_free(&unit->iommu.sysctl_ctx); } #ifdef DEV_APIC @@ -337,6 +338,7 @@ dmar_attach(device_t dev) unit = device_get_softc(dev); unit->iommu.unit = device_get_unit(dev); unit->iommu.dev = dev; + sysctl_ctx_init(&unit->iommu.sysctl_ctx); dmaru = dmar_find_by_index(unit->iommu.unit); if (dmaru == NULL) return (EINVAL); diff --git a/sys/x86/iommu/intel_intrmap.c b/sys/x86/iommu/intel_intrmap.c index d2f8f8df4691..122b92827b77 100644 --- a/sys/x86/iommu/intel_intrmap.c +++ b/sys/x86/iommu/intel_intrmap.c @@ -326,7 +326,10 @@ clp2(u_int v) int dmar_init_irt(struct dmar_unit *unit) { - + SYSCTL_ADD_INT(&unit->iommu.sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(unit->iommu.dev)), + OID_AUTO, "ir", CTLFLAG_RD, &unit->ir_enabled, 0, + "Interrupt remapping ops enabled"); if ((unit->hw_ecap & DMAR_ECAP_IR) == 0) return (0); unit->ir_enabled = 1;