From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D13F129AB05 for ; Sat, 25 Jul 2026 23:28:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785022114; cv=none; b=trMIN8DXHsKJP+gkNeRpP/XfkxzL/8UczuVAWVFVd7lST4sO7TNfK+z5GaNm7ryMS/ejKnD+lTgk0vMxXkwzzuA6qdZpFgoronMRQ64nci0cShdLsNq0bAbtBEx5mV6rFQzv7xlC8GbJ/yMgK3rr4Mq50sqvQ0VnI+0JgAdsTxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785022114; c=relaxed/simple; bh=hsb0sG3xQrzIWfbMpLDW2y2O5saBGuPW7KlD/qWLdy0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=JjVKWFvFg1WBEL9iXSwiFIACV1UG+xGq5KX0WAUcWI3zvhl7MyAn2T30mSijNCfWgJ2LS5vKTQlgRdW6G6jFidp24q8Vi84PVitY1tUgLVZk/u6SsaVbDgOi1RijOMnt5a13VUqQhzQ8S9Ek8MtsCsNPQF8j3MI4xdUI6lsAL9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SsryXRgX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SsryXRgX" Received: by smtp.kernel.org (Postfix) with ESMTPS id 51C30C2BCB8; Sat, 25 Jul 2026 23:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1785022114; bh=hsb0sG3xQrzIWfbMpLDW2y2O5saBGuPW7KlD/qWLdy0=; h=From:Date:Subject:To:Cc:Reply-To:From; b=SsryXRgX4UQ+dWepb1sFPKMiu/UTlfG6m9lvRauTsnh6AA5b4GCUwXsVWxqHeRvWA k8usURVqIUOY0d/0opV7fbsNK6/9rGLIqTlzHUY8WVnINeUaskTWC81Ferhx8ZLrfu pIi4EOIjaBCycm2SgSoKORLSAbXJecbr6trDhuK9epOCeQOfWgMHx4bswJBIdVCCs1 3SdfVEwAhZk0b6gVLC+aWIX9cYAXTRd9HViNYDVa5dqLFvncgtQGo820RN/8r/aGET /8U38lIqEGR8haH7upNEsu5WZ+dv1EVW9OzykDoYbnE2QLlY8R1CEjIv8BVr4DlJoz UjYYlMiYIp39Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2850CC531F9; Sat, 25 Jul 2026 23:28:34 +0000 (UTC) From: Aaron Kling via B4 Relay Date: Sat, 25 Jul 2026 18:28:32 -0500 Subject: [PATCH RFC] drm/nouveau: Use write-combined maps for coherent on Tegra 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: 7bit Message-Id: <20260725-tegra-coherent-wc-v1-1-dfdcc929c21b@gmail.com> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzMDcyNT3ZLU9KJE3eT8jNSi1LwS3fJkXUNLSxPDFMNE00QzAyWgvoKi1LT MCrCZ0UpBbs5KsbW1AA2ZuwFoAAAA X-Change-ID: 20260725-tegra-coherent-wc-19941d1a5a60 To: Lyude Paul , Danilo Krummrich , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, Faith Ekstrand , Aaron Kling X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785022113; l=1746; i=webgeek1234@gmail.com; s=20250217; h=from:subject:message-id; bh=xGh6pnkZaocwOU8pE4vCOlQMWxF+mRIdr+h8cac+BR8=; b=sZmYcD/8oqKCgPrreK+uUgwVNQC8Jhvg4Efd/oYQ2kQl27ZNYV1yAG5oJGt6ob13Hf9ei1CYJ FamnB0RS4/7Bo+AHo4Uv/Koyj/a4UZPu1n3Z6O1Iyb6aXJKPXnmi/sJ X-Developer-Key: i=webgeek1234@gmail.com; a=ed25519; pk=TQwd6q26txw7bkK7B8qtI/kcAohZc7bHHGSD7domdrU= X-Endpoint-Received: by B4 Relay for webgeek1234@gmail.com/20250217 with auth_id=342 X-Original-From: Aaron Kling Reply-To: webgeek1234@gmail.com From: Faith Ekstrand On Tegra devices, uncached maps traslate to device memory, causing unaligned accesses by userspace resulting in a SIGBUS. Instead, use write-combined maps to ensure proper access. Signed-off-by: Faith Ekstrand Co-developed-by: Aaron Kling Signed-off-by: Aaron Kling --- This patch is marked RFC because there is not complete confidence that the change is correct. Without this change, nouveau can easily hit sigbus errors in Android UI rendering via nvk or running vulkan deqp tests on Tegra. Changing coherent maps to use write-combined stops the crashing, but it is unknown what the performance impact is, if any. --- drivers/gpu/drm/nouveau/nouveau_sgdma.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index fa3b4ebf38a83..10f6ef1c541bd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c @@ -72,9 +72,12 @@ nouveau_sgdma_create_ttm(struct ttm_buffer_object *bo, uint32_t page_flags) struct nouveau_sgdma_be *nvbe; enum ttm_caching caching; - if (nvbo->force_coherent) - caching = ttm_uncached; - else if (drm->agp.bridge) + if (nvbo->force_coherent) { + if (drm->client.device.info.platform == NV_DEVICE_INFO_V0_SOC) + caching = ttm_write_combined; + else + caching = ttm_uncached; + } else if (drm->agp.bridge) caching = ttm_write_combined; else caching = ttm_cached; --- base-commit: 1a1757b76427f6201bfe0bf1bea9f7574f332a93 change-id: 20260725-tegra-coherent-wc-19941d1a5a60 Best regards, -- Aaron Kling