From nobody Thu May 14 14:25:31 2026 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 4gGXg010Ynz6dDG2 for ; Thu, 14 May 2026 14:25:32 +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 4gGXg00KK7z3WHT for ; Thu, 14 May 2026 14:25:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778768732; 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=sx9vSnI7IaE2lZg6S9flXg59MaYcLCqsNDeFlWmjyos=; b=Mvw/DKVLKdaZEr0uYxrNSUzPkDHeteSLyAdZ8ddSWW36AwNR2ppT0v26HvBLrvJ1Vo28gY xEX3d275nIi+kUDL+l9ab7xB3HSh7RuBb1QgauCHFstbUEKhlfoCkaZPbl7RogMoY16rXH FVwqCxDjQvriyajrL5nSUPTFgijipjtpiQd2QJi/qk8JCT4u2Tn7GBoYHNh2896EuhCJdM fVFE1JALRFo2yMCs1qMDZ72Ky70ykmtC3AUyoNUlUJgeFqFVPj18lG4b5S08D3nO6ZcfVk jaBGVSMSflP+lQo6wL6pHp3rl56ExeqOAdvEj3WU9tlS5gQ8G12ZBFgjmCt33A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1778768732; a=rsa-sha256; cv=none; b=L+CXfmrwHbmE5H2nkqoQixdC+D9v3BfNWV0St0B9ZFZ2HTjYHgwUJmjyP6RnIiY6c7qOZ+ E1+mh5yRoO0OkcDJpdEiNJi2APe+vOI7OEozwm+r/oMK/yWR1JK+9G4EC/z6bVxW4tkR8g CFuv4weTdFjLEoD1lm6+FJkcO50VbVUwmj9nmlJU2WNq6wFSFwhyBsasom3Y0NoYXlUwPk wGo2816i4uearlQqqDS7TmFYxNLkQLV/xv8jCj7v7EQQgWKhJ5MkA5Uq/o6hkX6WUyhNTZ jcRQYDECisfxOtoC0nSWZQjKnM6JIgWBYPPMvqsTJ+EBCJsK0FDaIGvSbcEbJQ== 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=1778768732; 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=sx9vSnI7IaE2lZg6S9flXg59MaYcLCqsNDeFlWmjyos=; b=PhCq7fLygzFzTb3Ry/w2JFNp7KzYy0ucIccYpEQXwD/1t3oYSNiqya/fuEK8YPseyWFPel VCs8j3hshtyb3/3qOqgwdxA//hVH3AU2nFgtR8J/2A0ttbA2LoqxiU/kHKSxGcbsGaA8tm /eGl9CBbhmTLDqP0gpyp3Llvnw/3t+xiXzzifDloGfCK/rhetg5Zw2mYiFhj9gWe2efZF3 bPLFJKAnLjnY3c4yd6izGyzNfQo5VrUmrr8kEO1GafXjue8YbGUXTPz/cjvAjYXTxxm5LY LAmdjSNAGia33G7Upy2ur14YlBSoFhLBYaFq+AWJQdgbzx/FeCDbDFslavMBtw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gGXfz72F3zhSR for ; Thu, 14 May 2026 14:25:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30187 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 14 May 2026 14:25:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 988c03980452 - main - linux/io: handle memtype_wc mapping for !DMAP range 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 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/main X-Git-Reftype: branch X-Git-Commit: 988c03980452a56fb0fbb15e18b0a644602d0ab3 Auto-Submitted: auto-generated Date: Thu, 14 May 2026 14:25:31 +0000 Message-Id: <6a05db5b.30187.4ea0a4f2@gitrepo.freebsd.org> The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=988c03980452a56fb0fbb15e18b0a644602d0ab3 commit 988c03980452a56fb0fbb15e18b0a644602d0ab3 Author: Mitchell Horne AuthorDate: 2026-05-14 14:20:22 +0000 Commit: Mitchell Horne CommitDate: 2026-05-14 14:25:09 +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 --- 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 f89c150e7a3b..4dfc04b3f3fc 100644 --- a/sys/compat/linuxkpi/common/include/linux/io.h +++ b/sys/compat/linuxkpi/common/include/linux/io.h @@ -544,6 +544,9 @@ arch_io_reserve_memtype_wc(resource_size_t start, resource_size_t size) #if defined(__amd64__) void *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 @@ -557,8 +560,10 @@ arch_io_free_memtype_wc(resource_size_t start, resource_size_t size) #if defined(__amd64__) void *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 }