]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/bochs: use devm_ioremap_wc() to map framebuffer
authorYan Zhao <yan.y.zhao@intel.com>
Mon, 9 Sep 2024 13:16:43 +0000 (21:16 +0800)
committerThomas Zimmermann <tzimmermann@suse.de>
Fri, 13 Sep 2024 06:35:46 +0000 (08:35 +0200)
commit9388ccf69925223223c87355a417ba39b13a5e8e
tree07ca990df5dfe284920f75509bda99517b972335
parent9d443deb0441b9dbb22a9aac3b471da05220df1b
drm/bochs: use devm_ioremap_wc() to map framebuffer

Opt for devm_ioremap_wc() over devm_ioremap() when mapping the framebuffer.

Using devm_ioremap() results in the VA being mapped with PAT=UC-, which
considerably slows down drm_fb_memcpy(). In contrast, devm_ioremap_wc()
maps the VA with PAT set to WC, leading to better performance on platforms
where access to UC memory is much slower than WC memory.

Here's the performance data measured in a guest on the physical machine
"Sapphire Rapids XCC".
With host KVM honors guest PAT memory types, the effective memory type
for this framebuffer range is
- WC when devm_ioremap_wc() is used
- UC- when devm_ioremap() is used.

The data presented is an average from 10 execution runs.

Cycles: Avg cycles of executed bochs_primary_plane_helper_atomic_update()
        from VM boot to GDM show up
Cnt:    Avg cnt of executed bochs_primary_plane_helper_atomic_update()
        from VM boot to GDM show up
T:      Avg time of each bochs_primary_plane_helper_atomic_update().

 -------------------------------------------------
|            | devm_ioremap() | devm_ioremap_wc() |
|------------|----------------|-------------------|
|  Cycles    |    211.545M    |   0.157M          |
|------------|----------------|-------------------|
|  Cnt       |     142        |   1917            |
|------------|----------------|-------------------|
|  T         |    0.1748s     |   0.0004s         |
 -------------------------------------------------

Note:
Following the rebase to [3], the previously reported GDM failure on the
VGA device [1] can no longer be reproduced, thanks to the memory management
improvements made in [2]. Despite this, I have proceeded to submit this
patch because of the noticeable performance improvements it provides.

Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Closes: https://lore.kernel.org/all/87jzfutmfc.fsf@redhat.com/#t
Cc: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Link: https://lore.kernel.org/all/87jzfutmfc.fsf@redhat.com/#t
Link: https://patchwork.freedesktop.org/series/138086
Link: https://gitlab.freedesktop.org/drm/misc/kernel/-/tree/drm-misc-next
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240909131643.28915-1-yan.y.zhao@intel.com
drivers/gpu/drm/tiny/bochs.c