All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luben Tuikov <luben.tuikov@amd.com>
To: AMD Graphics <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <Alexander.Deucher@amd.com>,
	Mikhail Krylov <sqarert@gmail.com>,
	Luben Tuikov <luben.tuikov@amd.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Direct Rendering Infrastructure - Development
	<dri-devel@lists.freedesktop.org>
Subject: [PATCH] drm/radeon: Fix screen corruption (v2)
Date: Sun, 11 Dec 2022 21:08:21 -0500	[thread overview]
Message-ID: <20221212020821.8248-1-luben.tuikov@amd.com> (raw)
In-Reply-To: <20221211114226.57398-1-luben.tuikov@amd.com>

Fix screen corruption on older 32-bit systems using AGP chips.

On older systems with little memory, for instance 1.5 GiB, using an AGP chip,
the device's DMA mask is 0xFFFFFFFF, but the memory mask is 0x7FFFFFF, and
subsequently dma_addressing_limited() returns 0xFFFFFFFF < 0x7FFFFFFF,
false. As such the result of this static inline isn't suitable for the last
argument to ttm_device_init()--it simply needs to now whether to use GFP_DMA32
when allocating DMA buffers.

Partially reverts commit 33b3ad3788aba846fc8b9a065fe2685a0b64f713.

v2: Amend the commit description.

Cc: Mikhail Krylov <sqarert@gmail.com>
Cc: Alex Deucher <Alexander.Deucher@amd.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Direct Rendering Infrastructure - Development <dri-devel@lists.freedesktop.org>
Cc: AMD Graphics <amd-gfx@lists.freedesktop.org>
Fixes: 33b3ad3788aba8 ("drm/radeon: handle PCIe root ports with addressing limitations")
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
---
 drivers/gpu/drm/radeon/radeon.h        | 1 +
 drivers/gpu/drm/radeon/radeon_device.c | 2 +-
 drivers/gpu/drm/radeon/radeon_ttm.c    | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 37dec92339b16a..4fe38fd9be3267 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -2426,6 +2426,7 @@ struct radeon_device {
 	struct radeon_wb		wb;
 	struct radeon_dummy_page	dummy_page;
 	bool				shutdown;
+	bool                            need_dma32;
 	bool				need_swiotlb;
 	bool				accel_working;
 	bool				fastfb_working; /* IGP feature*/
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 6344454a772172..3643a3cfe061bd 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1370,7 +1370,7 @@ int radeon_device_init(struct radeon_device *rdev,
 	if (rdev->family == CHIP_CEDAR)
 		dma_bits = 32;
 #endif
-
+	rdev->need_dma32 = dma_bits == 32;
 	r = dma_set_mask_and_coherent(&rdev->pdev->dev, DMA_BIT_MASK(dma_bits));
 	if (r) {
 		pr_warn("radeon: No suitable DMA available\n");
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index bdb4c0e0736ba2..3debaeb720d173 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -696,7 +696,7 @@ int radeon_ttm_init(struct radeon_device *rdev)
 			       rdev->ddev->anon_inode->i_mapping,
 			       rdev->ddev->vma_offset_manager,
 			       rdev->need_swiotlb,
-			       dma_addressing_limited(&rdev->pdev->dev));
+			       rdev->need_dma32);
 	if (r) {
 		DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
 		return r;

base-commit: 20e03e7f6e8efd42168db6d3fe044b804e0ede8f
-- 
2.39.0.rc2


  reply	other threads:[~2022-12-12  2:09 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-23 16:31 Screen corruption using radeon kernel driver Krylov Michael
2022-04-25 17:22 ` Alex Deucher
2022-05-16 13:01   ` Mikhail Krylov
2022-11-28 14:31   ` Mikhail Krylov
2022-11-28 14:50     ` Alex Deucher
2022-11-28 20:48       ` Mikhail Krylov
2022-11-29 14:44         ` Alex Deucher
2022-11-29 15:59           ` Mikhail Krylov
2022-11-29 16:05             ` Alex Deucher
2022-11-29 17:11               ` Mikhail Krylov
2022-11-30 12:54                 ` Robin Murphy
2022-11-30 14:28                   ` Alex Deucher
2022-11-30 15:42                     ` Robin Murphy
2022-11-30 16:07                       ` Alex Deucher
2022-11-30 19:59                         ` Mikhail Krylov
2022-12-01 14:00                           ` Robin Murphy
2022-12-01 14:06                             ` Alex Deucher
2022-12-01 15:28                             ` Mikhail Krylov
2022-12-01 15:28                               ` Mikhail Krylov
2022-12-10 15:32                         ` Mikhail Krylov
2022-12-11  5:52                           ` Luben Tuikov
2022-12-11 11:42                             ` [PATCH] drm/radeon: Fix screen corruption Luben Tuikov
2022-12-12  2:08                               ` Luben Tuikov [this message]
2022-12-14 21:53                                 ` [PATCH] drm/radeon: Fix screen corruption (v2) Robin Murphy
2022-12-14 22:02                                   ` Alex Deucher
2022-12-14 23:08                                     ` Robin Murphy
2022-12-15  8:07                                       ` Christian König
2022-12-15  9:08                                         ` Luben Tuikov
2022-12-15  9:46                                           ` Christian König
2022-12-15 10:19                                             ` Luben Tuikov
2022-12-15 11:27                                               ` Christian König
2022-12-15 11:40                                                 ` Luben Tuikov
2022-12-15 11:53                                                   ` Robin Murphy
2022-12-15 12:07                                                     ` Luben Tuikov
2023-01-19 16:56                                                       ` Krylov Michael
2023-01-19 16:56                                                         ` Krylov Michael
2023-01-20  4:31                                                         ` Luben Tuikov
2023-01-20  4:31                                                           ` Luben Tuikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221212020821.8248-1-luben.tuikov@amd.com \
    --to=luben.tuikov@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robin.murphy@arm.com \
    --cc=sqarert@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.