From nobody Sun Oct 13 22:30:51 2024 X-Original-To: dev-commits-src-main@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 4XRZnl5rtpz5Yg52; Sun, 13 Oct 2024 22:30:51 +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 4XRZnl52mQz4q1S; Sun, 13 Oct 2024 22:30:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728858651; 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=dF5PpLeVecpQbi3hsZiNF5YVMrMnx2beX9+jefLi9hA=; b=mSqabCD7H2bX2+4vVfOc9ZsMMj4CtR5hGCB8nzm+eW8TfCmsbL83FU4/I7ybIPKLQXc4EV xctqD6d62xUE7wAJuNviEfrAf3HBQL5DH0mcQTldqaX5RHeP3uzIRmlmVZnulUSVdBA2fa JcJlBFp9r1wjlfAVAtKprCBOsHRUCva1qUTQlB8Ec+0JCcUTCPf4T4VRg6MZxIuvWHuv48 8kOAEIXjIpJYvRiT6Ip0FiUFJLbgGtelNhVI4ET7p+JRm7b32aJAYKPUuO2rCACGHe01kJ j12JJvttzWxMlIbfKf6/U3rhaB5/0BsUMeEAw1u5a9rpVgCi7dSj0lVsfTVyYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728858651; 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=dF5PpLeVecpQbi3hsZiNF5YVMrMnx2beX9+jefLi9hA=; b=xXiOUejL1fmnnzGEraLwrUSx6tUe014T0NzvSon8HtkPO/3M6ULX1H6sxRUeTM0a6alOz7 NFDWWAGPRd3R8DseZ8c/oHldFLwk/L2EuDpTY7NyJznwSNx/9V9PyG0fNgFT87WLkpNbqW KcNQICRBs3F2JwqTD0vWaKTziBMj24pVjIcT9d+YTFjuapMv2RkiP/kxB1s8h+L85baIIk i5ItvFH8tOnS/xxPwr4MhAS2vr+o9Giy5uGi7hoky6KIkr0igpSn0Wm9FPUX2jvuwuGozr syxaJ94xwMM3HSvrpCDGQuhdG879NFmn55RYYW+3Jd6wfUsW7tzrStBq4STMpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728858651; a=rsa-sha256; cv=none; b=x0b35dyslNxPfjw+0kqD+k011hiqDqjmIZ/SYWl3QTLnmoa5P561DPju6lDUclQKthRGIe RTgh3PHm0HpJsqabM61lObkYqv+HtjUlvyWWTIDVuE+IZaIZJEyxmoghuzOrdslIuePMkb njEHwjTkB3sf0K94klwzQklIEi0hMcmbSDUBEvMhdOy/TSqDp6KTS+QfR7tsSUjkWSVt5y eUJDV3ZoxVvk7XfJpSjyjC8pCSS+gcchKICuaJk7XVBe15DTcQRbCsMAZvp4FTlKmBGQ4p QBeehXruzK5Y+sdXFcjnQDHqrGfeDe305RMnROZgntNdr1g9CvjQnoamox5/YA== 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 4XRZnl4fQ1z1Bx8; Sun, 13 Oct 2024 22:30:51 +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 49DMUpIL040117; Sun, 13 Oct 2024 22:30:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49DMUpuW040114; Sun, 13 Oct 2024 22:30:51 GMT (envelope-from git) Date: Sun, 13 Oct 2024 22:30:51 GMT Message-Id: <202410132230.49DMUpuW040114@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: 7896b03fff4d - main - iommu_get_requester(): do not panic if asked about non-pci device List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 7896b03fff4d9c2e9c35ecf1dce2e0d672467a5a Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7896b03fff4d9c2e9c35ecf1dce2e0d672467a5a commit 7896b03fff4d9c2e9c35ecf1dce2e0d672467a5a Author: Konstantin Belousov AuthorDate: 2024-10-13 10:04:32 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-13 22:30:26 +0000 iommu_get_requester(): do not panic if asked about non-pci device For now, return zero rid and the device itself. Add a comment noting that eventually ACPI HID can be used to calculate rid for some more devices. Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/dev/iommu/busdma_iommu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c index 7a0ca39172f3..4d295ed7c6b2 100644 --- a/sys/dev/iommu/busdma_iommu.c +++ b/sys/dev/iommu/busdma_iommu.c @@ -126,6 +126,12 @@ iommu_get_requester(device_t dev, uint16_t *rid) pci_class = devclass_find("pci"); l = requester = dev; + pci = device_get_parent(dev); + if (pci == NULL || device_get_devclass(pci) != pci_class) { + *rid = 0; /* XXXKIB: Could be ACPI HID */ + return (requester); + } + *rid = pci_get_rid(dev); /*