Re: [PATCH] drm/bochs: use ioremap_wc() to map framebuffer during driver probing

From: Yan Zhao
Date: Mon Sep 09 2024 - 09:21:27 EST


On Mon, Sep 09, 2024 at 08:40:30AM +0200, Thomas Zimmermann wrote:
> Hi
>
> Am 09.09.24 um 07:15 schrieb Yan Zhao:
> > Use ioremap_wc() instead of ioremap() to map framebuffer during driver
> > probing phase.
> >
> > Using ioremap() results in a VA being mapped with PAT=UC-. Additionally,
> > on x86 architectures, ioremap() invokes memtype_reserve() to reserve the
> > memory type as UC- for the physical range. This reservation can cause
> > subsequent calls to ioremap_wc() to fail to map the VA with PAT=WC to the
> > same physical range for framebuffre in ttm_kmap_iter_linear_io_init().
> > Consequently, the operation drm_gem_vram_bo_driver_move() ->
> > ttm_bo_move_memcpy() -> ttm_move_memcpy() becomes significantly slow on
> > platforms where UC memory access is slow.
>
> I've noticed this too and pushed a major update that replaces the entire
> memory management. [1]
>
> The patch is still welcome, I think, but you may want to rebase onto the
> latest drm-misc-next branch. [2]
>
> Best regards
> Thomas
>
> [1] https://patchwork.freedesktop.org/series/138086/
> [2] https://gitlab.freedesktop.org/drm/misc/kernel/-/tree/drm-misc-next
Thanks!

The updated version is at
https://lore.kernel.org/all/20240909131643.28915-1-yan.y.zhao@xxxxxxxxx