From nobody Tue Nov 12 00:38:20 2024 X-Original-To: dev-commits-src-branches@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 4XnSFT2m6kz5crVx; Tue, 12 Nov 2024 00:38:21 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XnSFT0wlPz4ysW; Tue, 12 Nov 2024 00:38:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731371901; 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=DkwCCOEG/cesyoh90eo8RA91ZC8DgnOGbv8vetju6WU=; b=eC/3nISQGbLrP4apG4AbQ1alH5d+o/4BeRe1sX+CQT5isSVRY7VI5hu7dXcezOzsTguI3P 1lwzk8Jh29XG17IfInOJULOC+vmMoM5aBIIj1QlXvxpOUwdJUp7+lNbukIANCxBe+XQlr5 9Homlz8IH9mG5PrI+5kixYCtCBQl4er3Dql85rI2ry9Cu1dV0sLrtDC1475cJ/OmcCA+cH YV9nhn0/OeJh7GlcjuSNIyidg4g/xvD24YHz2YAg0ZX2AvssYatM0WVv5YoHWPQGujuA2N DICwwsMUZfnOMFKKORSSN/tw0EZSbciippzmXvw8MqVObKg54KPc+DNugx1JDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731371901; 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=DkwCCOEG/cesyoh90eo8RA91ZC8DgnOGbv8vetju6WU=; b=rzPdF9sLattWNfx0VyMgv8zKppXiLzGRysOPRReAPKEWbVOY4HbejKWaQLOSJD34qP/4E9 RIjpdGtkEAs7U/iNfqTvWuzUkh/YN23Un/Pu1+YPSjAo6DZnSvCprnB6iVoc17Z9uQdjgO ePosdfgK54sixJPqmZ6I0nVtLRKkieT88diRh7LPKPhHvGH6f9xOjAmxjkfSuzlyvCaKFs 2fjqjSfGKHfCTgfIqSly2Csu3C1V8xizy0fESdKy0guLuODsjY4aEjj73nSoBO3o0JLcNS xLEuUzagfPk7XDq0IFF6lrpvNZYAucA/aiIstM5QsPD+i5Od6QaWC+kmWQMkQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731371901; a=rsa-sha256; cv=none; b=L08Hsk4kPpAgour8dRiKn8SG6bUa7vO03I1/zFpMPA81vvoc6V6uWSM0/Mh185U0dT/XWO HOEKkmBFvB3D0fnY7baMXC0EYCGDQlGjHcyZnNHl39LRYsn4+B1RSQcu/8MqBes+h16q5x ODVtHcPLN5Ozq3HfJ3pGYtRRQWELSje0FOTLhkNQTzihTT8ChBvhLST1arBv3WbAlR45su i9kzK14vXYcCpzSdOV0dMvJ0YvczYvN6l3/lnBnhK7BTEZbbEkCtPnpDdr7eiFpFOPyYDE zXDYK8ahOJZ4832ZSTS0nhrn3RlUIR0dpdO7/cQvEz64/lBBB+DISvmOoIfguQ== 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 4XnSFT0Y14znhb; Tue, 12 Nov 2024 00:38:21 +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 4AC0cKDT061390; Tue, 12 Nov 2024 00:38:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AC0cKFG061387; Tue, 12 Nov 2024 00:38:20 GMT (envelope-from git) Date: Tue, 12 Nov 2024 00:38:20 GMT Message-Id: <202411120038.4AC0cKFG061387@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: 19cefbb3ddb1 - stable/14 - amdiommu: short-circuit all amdiommu_find_unit() functions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 19cefbb3ddb157dfa3d24be0be7f1990b9567733 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=19cefbb3ddb157dfa3d24be0be7f1990b9567733 commit 19cefbb3ddb157dfa3d24be0be7f1990b9567733 Author: Konstantin Belousov AuthorDate: 2024-11-09 22:29:20 +0000 Commit: Konstantin Belousov CommitDate: 2024-11-12 00:27:24 +0000 amdiommu: short-circuit all amdiommu_find_unit() functions (cherry picked from commit 9805e5b071a10711cfcd3c7a750ac4a4d14b6e3f) --- sys/x86/iommu/amd_drv.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/x86/iommu/amd_drv.c b/sys/x86/iommu/amd_drv.c index f1ee34467f46..4373987ae24a 100644 --- a/sys/x86/iommu/amd_drv.c +++ b/sys/x86/iommu/amd_drv.c @@ -879,6 +879,9 @@ amdiommu_find_unit(device_t dev, struct amdiommu_unit **unitp, uint16_t *ridp, int error, flags; bool res; + if (!amdiommu_enable) + return (ENXIO); + if (device_get_devclass(device_get_parent(dev)) != devclass_find("pci")) return (ENXIO); @@ -943,6 +946,9 @@ amdiommu_find_unit_for_ioapic(int apic_id, struct amdiommu_unit **unitp, device_t apic_dev; bool res; + if (!amdiommu_enable) + return (ENXIO); + bzero(&ifu, sizeof(ifu)); ifu.type = IFU_DEV_IOAPIC; ifu.devno = apic_id; @@ -992,6 +998,9 @@ amdiommu_find_unit_for_hpet(device_t hpet, struct amdiommu_unit **unitp, int hpet_no; bool res; + if (!amdiommu_enable) + return (ENXIO); + hpet_no = hpet_get_uid(hpet); bzero(&ifu, sizeof(ifu)); ifu.type = IFU_DEV_HPET; @@ -1042,7 +1051,7 @@ amdiommu_find_method(device_t dev, bool verbose) error = amdiommu_find_unit(dev, &unit, &rid, &dte, &edte, verbose); if (error != 0) { - if (verbose) + if (verbose && amdiommu_enable) device_printf(dev, "cannot find amdiommu unit, error %d\n", error);