From nobody Wed Aug 28 00:40:23 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 4Wtltv6Lrwz5MS4C; Wed, 28 Aug 2024 00:40:23 +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 4Wtltv5s0Zz47dQ; Wed, 28 Aug 2024 00:40:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724805623; 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=6MKd4RhTe2HfyWAlSa9krHS1nc/FVypUM+j1cOjzxC8=; b=DFqYsJPPm/5NT0nfxGMnWTHMPxjlYVVUOVRuLT3PYSx3MDjS3UVT7WmjDikX/VImdDhUx0 kvZ5ASteskbK/YIVk1BBFnqgSy5MtLkYG42S8+5/D6kTWIXAqrFaN9Hd99tdYr9wH+FgM9 UktsEcoCTkMt5UI3xbk+AB39iN6d2mWgT2tbLd2Fvmoo6eWGxb3hhDK0U3QRoO3kNxfOA3 tiozBEyAEeGsrga6FJ05o1qdvJ6rKo07BMGw/zQch3ReJNxBgqZ/bh6UOKY0l1sCDUdf8N LQuXG2g2ahjGc06CXhAGCemaiKnuo1UKpHxkWtUUj184IW987j8QzUlO9uiibQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724805623; a=rsa-sha256; cv=none; b=JZXP70VVoXocNI5TB3J+D85iMNqyvMPGHpgx7/ZPK0EBYPac1JVXTW/NYjoCOLNx0bO0+C T/8NaxyM1nD64BrfG6lzdfKHB6h7v5yUu0YKJ/UBTFDtP7dKFJBTAUx2kHheUDEA9hOFWW 2P09ouHN+Ajffn4xFO8cwZJczP5XeWWM0a2NTyNV7JKfp34Q8lF+f24AUMyHomXse3WsMr D5JKCcmGreKtV0bQbtOF506iNq2629yuAcSgtYJaQrHU1Bij1VY7DLL3WF6usozs5FH4t+ q0Hc2ahIzdws5yCFfP3vQ7Q4rBuBPCj/BZgFnLyy8AgeB2/AkDq94yGCIsDSUA== 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=1724805623; 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=6MKd4RhTe2HfyWAlSa9krHS1nc/FVypUM+j1cOjzxC8=; b=EdbYgvlA8DOYf6C2y+k05Dc9TZmIaz8RplAgoVJH8QR5ORZBCSFTU5kENHFn4zIOi8+dAY jV+Z4VWl4Q/Y2su9G/Ca6RhNUGpuEPVeiEHJp/medeblW7t4DFs7j2knhcRWYbQFXjhUw4 0h0p6VF50U5AcA6Ih5BsEkiraMLhKJF7qR1CouSRL/iZM7hE9mWgRVaS78Pvcdl7mjZ2rT uHRRSfPbR/xT/WYv9WIf8nC10rQSkbNSY6/R1ywkJk8XQ8Nke9p0MQW9zQb0xmfVp7W31B WjrCsjVvoPCBCi0XBftgtYGHvVDG8XuRkY2ZPYh64drupligZflat1ohoM/1GA== 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 4Wtltv5LMzz1Bhg; Wed, 28 Aug 2024 00:40:23 +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 47S0eN1k064577; Wed, 28 Aug 2024 00:40:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47S0eNVA064574; Wed, 28 Aug 2024 00:40:23 GMT (envelope-from git) Date: Wed, 28 Aug 2024 00:40:23 GMT Message-Id: <202408280040.47S0eNVA064574@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: d66c4853b840 - stable/14 - DMAR: clear dmar_devs[unit] if attach failed 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: d66c4853b84002c064bc314a0824a8667a0089c6 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d66c4853b84002c064bc314a0824a8667a0089c6 commit d66c4853b84002c064bc314a0824a8667a0089c6 Author: Konstantin Belousov AuthorDate: 2024-08-20 14:41:33 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-28 00:26:33 +0000 DMAR: clear dmar_devs[unit] if attach failed PR: 280817 (cherry picked from commit 45543d3424d46f84a5399879e190fc359dcefbd4) --- sys/x86/iommu/intel_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c index 0b25620114cd..636534173715 100644 --- a/sys/x86/iommu/intel_drv.c +++ b/sys/x86/iommu/intel_drv.c @@ -422,6 +422,7 @@ dmar_attach(device_t dev) &unit->reg_rid, RF_ACTIVE); if (unit->regs == NULL) { device_printf(dev, "cannot allocate register window\n"); + dmar_devs[unit->iommu.unit] = NULL; return (ENOMEM); } unit->hw_ver = dmar_read4(unit, DMAR_VER_REG); @@ -449,6 +450,7 @@ dmar_attach(device_t dev) error = dmar_alloc_irq(dev, unit, DMAR_INTR_FAULT); if (error != 0) { dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } if (DMAR_HAS_QI(unit)) { @@ -463,6 +465,7 @@ dmar_attach(device_t dev) error = dmar_alloc_irq(dev, unit, DMAR_INTR_QI); if (error != 0) { dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } } @@ -496,12 +499,14 @@ dmar_attach(device_t dev) if (error != 0) { DMAR_UNLOCK(unit); dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } error = dmar_inv_ctx_glob(unit); if (error != 0) { DMAR_UNLOCK(unit); dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } if ((unit->hw_ecap & DMAR_ECAP_DI) != 0) { @@ -509,6 +514,7 @@ dmar_attach(device_t dev) if (error != 0) { DMAR_UNLOCK(unit); dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } } @@ -517,16 +523,19 @@ dmar_attach(device_t dev) error = dmar_init_fault_log(unit); if (error != 0) { dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } error = dmar_init_qi(unit); if (error != 0) { dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } error = dmar_init_irt(unit); if (error != 0) { dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } @@ -542,6 +551,7 @@ dmar_attach(device_t dev) error = iommu_init_busdma(&unit->iommu); if (error != 0) { dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } @@ -551,6 +561,7 @@ dmar_attach(device_t dev) if (error != 0) { DMAR_UNLOCK(unit); dmar_release_resources(dev, unit); + dmar_devs[unit->iommu.unit] = NULL; return (error); } DMAR_UNLOCK(unit);