From nobody Thu Jun 11 17:12:01 2026 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 4gbq2B30cPz6htxr for ; Thu, 11 Jun 2026 17:12:02 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gbq295Gpsz46sB for ; Thu, 11 Jun 2026 17:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781197921; 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=BiwT9PXX8/42u2p8Wvj2ZIGJh8ZRSIp9BqzroSkwAu0=; b=astizPMRvinboGMWWs/ql7Snlt9qiJwGNctMuge0V5ukm4KTtVdMINsQJGwTgmJOPWYirt HHrQISn/c4TDfFr7iYMnYOBCRIPUx5odssDLpB0BI1kMWThxM4tiFTDMK0uZlHypsGlm+w QBW82Nj9FHxTC6xq3KqX3FWyZ14b15aVYlmq2ENhtmpqLAJoYUoUWM7kItVE9opStJcy/a go2dwpKPkphsnhvl+KwA9pVvxCh2wy/Uh8UKpthpbIPoRTIbomAuj4EmByP5GwPY6tH/BO 2DSvdh1IcqrZSO7jpojm6EqqAfL5JMLY5Jl+uGRU+BMb0+HHaEdab68z/yRLBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781197921; a=rsa-sha256; cv=none; b=edpGkLQqvew4eHMGveCVIRu/R7lP9km8akLtacWpgMmd5vwajn32yCi4JiqWJ+7efpj557 obGHuBp2xSzauo6OtBKPbYBHB0ujj4dSZO2Lm2FauMEgoAN4WmEbTiHebyjc5Xk/KAc1Bz LtTWflSEMlHkyrmuAEzvT9ioAzfrtGGkcbT7HTCU2pZxpM3/3PEBvdSc2D42cXjwqzpfa/ +O9PQ+oGqUXf/PD9776EiKMOma5nEeAaUMnuOUEzlCunI/DWRkFQww6K+WHvPfPGT7vLz2 J4ownYDXusydwwHLugjnvOCkkhXyi+PsHaKfp20GFfyoDCRzt8ogsnQyW14VqA== 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=1781197921; 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=BiwT9PXX8/42u2p8Wvj2ZIGJh8ZRSIp9BqzroSkwAu0=; b=uD8Ezn0/RzfBe+8/G4p5pmF3WC2QK1glMa42OXZ/6U702OtCfrPYYggKW7uNaspClPVAn0 YucH/jaGASQZXHzaiVYNaPKPTaaF8kVZT/badFB9ng7D7X8UCTVDg+D2tPmExoebqIQJ+8 HoOh3eUClrQkRZJClzH/Nv7E2tm+4SHGai+9+y/qDWmZMqdGOz73ZZ9J+Q9VFTq+72DcMh aXBlSPYzbrPr5WpC9Ia6i4GzCxicQ46s19RvFPZWnHssgw79sapfZVnRtEaPxVBD6h9lnd 0VJm8z5fYylJEFw/+e1kyO/Zd/evhcDDwcfrIJIVlzLThLP7O14GQHXB2PLjfA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gbq294t8Cz10vL for ; Thu, 11 Jun 2026 17:12:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b665 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 11 Jun 2026 17:12:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 6d526fa72b72 - stable/14 - linux/io: handle memtype_wc mapping for !DMAP range 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6d526fa72b723f28e72e0e8ff40029f0ae7db9b9 Auto-Submitted: auto-generated Date: Thu, 11 Jun 2026 17:12:01 +0000 Message-Id: <6a2aec61.3b665.746993a5@gitrepo.freebsd.org> The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6d526fa72b723f28e72e0e8ff40029f0ae7db9b9 commit 6d526fa72b723f28e72e0e8ff40029f0ae7db9b9 Author: Mitchell Horne AuthorDate: 2026-05-14 14:20:22 +0000 Commit: Mitchell Horne CommitDate: 2026-06-11 17:11:40 +0000 linux/io: handle memtype_wc mapping for !DMAP range The amdgpu driver in drm-kmod will attempt to update/reserve certain GPU VRAM ranges as write-combining. Depending on the system, this address range may fall outside of FreeBSD's constructed DMAP. We cannot use pmap_change_attr() in this case. When INVARIANTS is enabled, this results in the following: panic: physical address 0x880000000 not covered by the DMAP Add a guard against triggering the KASSERT in PHYS_TO_DMAP(). This limitation in our implementation of arch_io_reserve_memtype_wc() is already known in drm-kmod's amdgpu_bo_init(), and errors are ignored there (see "BSDFIXME"). This change is only to eliminate the preventable assertion failure within this scheme. Tested by: kevans Reviewed by: kib, emaste MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56971 (cherry picked from commit 988c03980452a56fb0fbb15e18b0a644602d0ab3) --- sys/compat/linuxkpi/common/include/linux/io.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h index 164347dbc4e7..021add1153f7 100644 --- a/sys/compat/linuxkpi/common/include/linux/io.h +++ b/sys/compat/linuxkpi/common/include/linux/io.h @@ -547,6 +547,9 @@ arch_io_reserve_memtype_wc(resource_size_t start, resource_size_t size) #if defined(__amd64__) vm_offset_t va; + if (!PHYS_IN_DMAP(start) || !PHYS_IN_DMAP(start + size)) + return (-EINVAL); + va = PHYS_TO_DMAP(start); return (-pmap_change_attr(va, size, VM_MEMATTR_WRITE_COMBINING)); #else @@ -560,8 +563,10 @@ arch_io_free_memtype_wc(resource_size_t start, resource_size_t size) #if defined(__amd64__) vm_offset_t va; - va = PHYS_TO_DMAP(start); + if (!PHYS_IN_DMAP(start) || !PHYS_IN_DMAP(start + size)) + return; + va = PHYS_TO_DMAP(start); pmap_change_attr(va, size, VM_MEMATTR_WRITE_BACK); #endif }