video/aperture: Provide a VGA helper for gma500 and internal use
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 6 Apr 2023 13:21:09 +0000 (15:21 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Sun, 16 Apr 2023 12:18:10 +0000 (14:18 +0200)
commit116b1c5a364bcbdc40be64d4f3ec9dbc32e264dd
tree022d48d0daef251a872e92514ff3df09cad0ca47
parent5ca1479cd35d9003040e6ac829380debe89b802b
video/aperture: Provide a VGA helper for gma500 and internal use

The hardware for gma500 is different from the rest, as it uses stolen
framebuffer memory that is not available via PCI BAR. The regular PCI
removal helper cannot detect the framebuffer, while the non-PCI helper
misses possible conflicting VGA devices (i.e., a framebuffer or text
console).

Gma500 therefore calls both helpers to catch all cases. It's confusing
as it implies that there's something about the PCI device that requires
ownership management. The relationship between the PCI device and the
VGA devices is non-obvious. At worst, readers might assume that calling
two functions for clearing aperture ownership is a bug in the driver.

Hence, move the PCI removal helper's code for VGA functionality into
a separate function and call this function from gma500. Documents the
purpose of each call to aperture helpers. The change contains comments
and example code form the discussion at [1].

v5:
* fix grammar in gma500 comment (Javier)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230404201842.567344-1-daniel.vetter@ffwll.ch/
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230406132109.32050-10-tzimmermann@suse.de
drivers/gpu/drm/gma500/psb_drv.c
drivers/video/aperture.c
include/linux/aperture.h