From nobody Tue Jan 21 16:03:06 2025 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 4YcsSB2Rztz5lGn0; Tue, 21 Jan 2025 16:03:06 +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 4YcsSB1r7Lz3H7r; Tue, 21 Jan 2025 16:03:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737475386; 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=qi2GGd4Ayorf1PBBVAEupKMFRk3sbNzB9kN5300gxrI=; b=BeYE/3q8oFy5nvCaf8LRqtMabnxsH9+pOU1Yc0xyocEpFHUXATAvDtCcHaONmj2faHX0HY b0YYbJpPVhns6WgxCYQayEldsSHCY4W6YMkM7QBIRIFIWxEV96E/s2cF73GfmjCQCSWEd8 S4u+QdWXgiU0cw4CfB83ME4eFt9gbhK+ZubsVd/fe3BXQ4oLYGYRop/DySopNhRk3bJR4D yO26BQQYf7oKO33ZmwEaF2qEr06Ww2rQmHecqqX+hzVIuS+Uu9Mxqh7SGMrvsyivTfo5Yv KJkE7Bosnmgo2fbzn38NZaWGn/KTwNWYkvHYLRyeFVtB7cL9KJybv363BbM7FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737475386; 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=qi2GGd4Ayorf1PBBVAEupKMFRk3sbNzB9kN5300gxrI=; b=OXVHVqk9dQTjhHRL9zayg6bD7nXPNPVLHVtRSTYbc+XXtV4Yjxt1sfjLrIKkoURgRIlEOL Dkg5YfiWKZ1MGLVy55stiLVzyxGHpo6dSvbNix/KY0ufP0q8UGUqfeDFrjGX9U8XFO62t0 XgIda+7dQdrLbGFVLFOR9Pw3rYpvQrs3WoU9nsVL9wMzbuchtPyTDCUBjN7WUcJJwxwTl1 I3jhChBBdt7A7/602Q6IacMP6TELC93yEXaE/roLdGFyPdXg3J9cwojA/e05a/SRzaDzYp NYmPwB8WcEBiRepcBLxMrQeV9XcUORYMXZT0o7M/Xi7It7go6lP5SjfPZgZLmw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737475386; a=rsa-sha256; cv=none; b=nYpoc/k/OHdecW7i44T1vZmGIgvjZwj6Wdi2iSM1xRhMmpRoujyt6/IhQdOPXQZ+gJRnl8 Yi2tfsVHqbguilFY8rpKDWzjJhLKGKQ3KqeHc0kb7dNa3pKqTDUBawJtZ6sYvninrnc+oo 8XmoznbnnoqwqaEeXso0vzHQX4LIxRjz/edQ0D3Hh6OfmhC/8QOeQdTl2NKLrk4zK2V719 C6UyVCN5yKtt8mK7W8r5JvTAGlA40cN6Snd0aPK13gIxE9gvaUSb1WjAe+do00OKgPw1MD XILcjlYXECVEnxCRhyFZLazPuDMPPnySrInuxaVjAyNLWRKJjJwaq9oCfcjP5g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YcsSB1HBkz1CXJ; Tue, 21 Jan 2025 16:03:06 +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 50LG36LU071604; Tue, 21 Jan 2025 16:03:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50LG36Di071601; Tue, 21 Jan 2025 16:03:06 GMT (envelope-from git) Date: Tue, 21 Jan 2025 16:03:06 GMT Message-Id: <202501211603.50LG36Di071601@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c19f1ad1c252 - main - pci_host_generic: Use SYS_RES_MEMORY for the parent of I/O resource ranges 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c19f1ad1c252f434146c7210155d805b2ed0ff95 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c19f1ad1c252f434146c7210155d805b2ed0ff95 commit c19f1ad1c252f434146c7210155d805b2ed0ff95 Author: John Baldwin AuthorDate: 2025-01-21 15:51:53 +0000 Commit: John Baldwin CommitDate: 2025-01-21 16:02:34 +0000 pci_host_generic: Use SYS_RES_MEMORY for the parent of I/O resource ranges When a SYS_RES_IOPORT resource crosses a pci_host_generic bridge, it is translated into a memory access for an associated range, so use SYS_RES_MEMORY for the resource allocated from the parent. Tested by: markj Differential Revision: https://reviews.freebsd.org/D44207 --- sys/dev/pci/pci_host_generic.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 884ab25548ce..49b131cd2299 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -91,7 +91,7 @@ pci_host_generic_core_attach(device_t dev) const char *range_descr; char buf[64]; int domain, error; - int flags, rid, tuple, type; + int flags, rid, tuple; sc = device_get_softc(dev); sc->dev = dev; @@ -187,19 +187,16 @@ pci_host_generic_core_attach(device_t dev) sc->has_pmem = true; range_descr = "prefetch"; flags = RF_PREFETCHABLE; - type = SYS_RES_MEMORY; rm = &sc->pmem_rman; break; case FLAG_TYPE_MEM: range_descr = "memory"; flags = 0; - type = SYS_RES_MEMORY; rm = &sc->mem_rman; break; case FLAG_TYPE_IO: range_descr = "I/O port"; flags = 0; - type = SYS_RES_IOPORT; rm = &sc->io_rman; break; default: @@ -209,7 +206,8 @@ pci_host_generic_core_attach(device_t dev) device_printf(dev, "PCI addr: 0x%jx, CPU addr: 0x%jx, Size: 0x%jx, Type: %s\n", pci_base, phys_base, size, range_descr); - error = bus_set_resource(dev, type, rid, phys_base, size); + error = bus_set_resource(dev, SYS_RES_MEMORY, rid, phys_base, + size); if (error != 0) { device_printf(dev, "failed to set resource for range %d: %d\n", tuple, @@ -217,8 +215,8 @@ pci_host_generic_core_attach(device_t dev) continue; } sc->ranges[tuple].rid = rid; - sc->ranges[tuple].res = bus_alloc_resource_any(dev, type, &rid, - RF_ACTIVE | RF_UNMAPPED | flags); + sc->ranges[tuple].res = bus_alloc_resource_any(dev, + SYS_RES_MEMORY, &rid, RF_ACTIVE | RF_UNMAPPED | flags); if (sc->ranges[tuple].res == NULL) { device_printf(dev, "failed to allocate resource for range %d\n", tuple); @@ -253,7 +251,7 @@ int pci_host_generic_core_detach(device_t dev) { struct generic_pcie_core_softc *sc; - int error, rid, tuple, type; + int error, rid, tuple; sc = device_get_softc(dev); @@ -272,18 +270,15 @@ pci_host_generic_core_detach(device_t dev) switch (FLAG_TYPE(sc->ranges[tuple].flags)) { case FLAG_TYPE_PMEM: case FLAG_TYPE_MEM: - type = SYS_RES_MEMORY; - break; case FLAG_TYPE_IO: - type = SYS_RES_IOPORT; break; default: continue; } if (sc->ranges[tuple].res != NULL) - bus_release_resource(dev, type, rid, + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->ranges[tuple].res); - bus_delete_resource(dev, type, rid); + bus_delete_resource(dev, SYS_RES_MEMORY, rid); } rman_fini(&sc->io_rman); rman_fini(&sc->mem_rman);