From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5716332604 for ; Mon, 20 Apr 2026 21:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776722156; cv=none; b=GBeCQFMjDHnovX9Sbjt2f3x3gOBjvZ2ejUhpNdH3lagtreyRJfQk2TSoXqjaxCMZzA3FxqENEa7v9AMgMI7umyVNs7f9rY8Wi9hBhyglYlbV8JKVqahKYKmvZdYtenbX+JanK3dGDNpSgD9fpTp/djQF8WGAC1xQeInWAF9fAmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776722156; c=relaxed/simple; bh=w+3+7D8I1N+j2pOZG4/w/Tn5xMRqwYVSXrbz6iuzedM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f6gPJ4noN0IDzhMmuZiPTnbyS0tMLsmDvsCJpe/vhzZZzZeak+rnUvEGieywXVM+nL525QO8DzBNZMpve7zB7eYFdIsKgZw+Z7wW1kIPx54bo7+2dekmxyOft0XUa7UxQRh+FWy1tA2qRmbFA/Zf32+Ff0eail92qJFRe6WHXfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Gw6Xf07y; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Gw6Xf07y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1776722155; x=1808258155; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w+3+7D8I1N+j2pOZG4/w/Tn5xMRqwYVSXrbz6iuzedM=; b=Gw6Xf07ye7PQBMW5HcVwZvKm/KV0STEkirwJunWRhTYgHLc2wMlU2wwr oo9cCSgcnaDsb8dns19NBPUjkEMel17rhLGzvE3VqcV0y5RcAorCUl02l jxdePqTls6sQ4ccqRZftoW+ZUIxnZLoljhuDGdfkqiGGnoHZWw/9pb/OK SRyY2FUjHMDjTY6v400SqehevOCrlZcruWN+zv25oDiB7yCHlHN4OZ2+b gd/EsFTxxr/TZS0FvF/u3EfvY8ONuMtjBzt4iefZmZH8UxipkeoRIMMFJ T8DEpQ78DjI4hL1nj7kNpBck5e7O5/j64zJjwgGBK6stuMW8Ah4N/4lrj Q==; X-CSE-ConnectionGUID: vZ38pm+ZSSS5W8/uieN2gA== X-CSE-MsgGUID: bGqQ/zHbTiezqVtOnp8TbQ== X-IronPort-AV: E=McAfee;i="6800,10657,11762"; a="88348265" X-IronPort-AV: E=Sophos;i="6.23,190,1770624000"; d="scan'208";a="88348265" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2026 14:55:54 -0700 X-CSE-ConnectionGUID: vIyOxeQSTKqfmJqE424eeQ== X-CSE-MsgGUID: wIc//DBMSIu+dULRm5/kvA== X-ExtLoop1: 1 Received: from arjan-box.jf.intel.com ([10.88.27.153]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2026 14:55:54 -0700 From: arjan@linux.intel.com To: amd-gfx@lists.freedesktop.org Cc: Arjan van de Ven , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/amdgpu: fix zero-size GDS range init on RDNA4 Date: Mon, 20 Apr 2026 14:57:15 -0700 Message-ID: <20260420215717.223372-1-arjan@linux.intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Arjan van de Ven RDNA4 (GFX 12) hardware removes the GDS, GWS, and OA on-chip memory resources. The gfx_v12_0 initialisation code correctly leaves adev->gds.gds_size, adev->gds.gws_size, and adev->gds.oa_size at zero to reflect this. amdgpu_ttm_init() unconditionally calls amdgpu_ttm_init_on_chip() for each of these resources regardless of size. When the size is zero, amdgpu_ttm_init_on_chip() forwards the call to ttm_range_man_init(), which calls drm_mm_init(mm, 0, 0). drm_mm_init() immediately fires DRM_MM_BUG_ON(start + size <= start) -- trivially true when size is zero -- crashing the kernel during modprobe of amdgpu on an RX 9070 XT. Guard against this by returning 0 early from amdgpu_ttm_init_on_chip() when size_in_page is zero. This skips TTM resource manager registration for hardware resources that are absent, without affecting any other GPU type. Link: https://lore.kernel.org/all/bug-221376-2300@https.bugzilla.kernel.org%2F/ Link: https://bugzilla.kernel.org/show_bug.cgi?id=221376 Oops-Analysis: http://oops.fenrus.org/reports/bugzilla.korg/221376/report.html Assisted-by: GitHub Copilot:Claude Sonnet 4.6 linux-kernel-oops-x86. Signed-off-by: Arjan van de Ven Cc: Alex Deucher Cc: "Christian König" Cc: amd-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index afaaab6496def..8075ac735321e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -75,6 +75,9 @@ static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev, unsigned int type, uint64_t size_in_page) { + if (!size_in_page) + return 0; + return ttm_range_man_init(&adev->mman.bdev, type, false, size_in_page); }