Skip to content

Commit f5b6fd4

Browse files
committed
drm/mgag200: Fix caching setup for remapped video memory
I/O video memory for the framebuffer supports write-combine caching mode. Simplify the driver's code that sets up the caching mode. * Map video memory with ioremap_wc(), which automatically sets up the PAT entry with write-combine caching. * Remove the now obsolete call to devm_arch_io_reserve_memtype_wc(). It is only required to mmap the video memory to user space, which the driver doesn't do. * According to the PAT documentation, arch_phys_wc_add() is best called after remapping I/O memory, so move it after ioremap. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240105082714.21881-1-tzimmermann@suse.de
1 parent 26a4591 commit f5b6fd4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/gpu/drm/mgag200/mgag200_drv.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,13 @@ int mgag200_device_preinit(struct mga_device *mdev)
146146
}
147147
mdev->vram_res = res;
148148

149-
/* Don't fail on errors, but performance might be reduced. */
150-
devm_arch_io_reserve_memtype_wc(dev->dev, res->start, resource_size(res));
151-
devm_arch_phys_wc_add(dev->dev, res->start, resource_size(res));
152-
153-
mdev->vram = devm_ioremap(dev->dev, res->start, resource_size(res));
149+
mdev->vram = devm_ioremap_wc(dev->dev, res->start, resource_size(res));
154150
if (!mdev->vram)
155151
return -ENOMEM;
156152

153+
/* Don't fail on errors, but performance might be reduced. */
154+
devm_arch_phys_wc_add(dev->dev, res->start, resource_size(res));
155+
157156
return 0;
158157
}
159158

0 commit comments

Comments
 (0)