Skip to content

PCI/VGA: Improve the default VGA device selection

Sui Jingfeng amd-gfx dri-devel intel-gfx kvm linux-fbdev linux-pci lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest posting 2/29 patches 17 repliesIn review
  2. v3 posting 1/25 of 9 patches 0 repliesSuperseded
  3. v26 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches0 repliesSuperseded

Changes in v3 from the cover letter

* Fix a mistake for drm/i915 implement
* Fix patch can not be applied problem because of drm/amdgpu merged other people's patch.

Patches in v3 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9video/aperture: Add a helper to detect if an aperture contains firmware FBdrivers/gpu/drm/drm_aperture.c drivers/video/aperture.c include/drm/drm_aperture.h +1 more+54 -02 replies
2/9video/aperture: Add a helper for determining if an unmoved aperture contain FBdrivers/video/aperture.c include/linux/aperture.h+43 -00 replies
3/9PCI/VGA: Switch to aperture_contain_firmware_fb_nonreloc()drivers/pci/vgaarb.c+4 -152 replies
4/9PCI/VGA: Improve the default VGA device selectiondrivers/gpu/drm/amd/amdgpu/amdgpu_device.c drivers/gpu/drm/i915/display/intel_vga.c drivers/gpu/drm/loongson/lsdc_drv.c +5 more+61 -159 replies
5/9drm/amdgpu: Implement the is_primary_gpu callback of vga_client_register()drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+11 -10 replies
6/9drm/radeon: Add an implement for the is_primary_gpu function callbackdrivers/gpu/drm/radeon/radeon_device.c+11 -10 replies
7/9drm/i915: Add an implement for the is_primary_gpu hookdrivers/gpu/drm/i915/display/intel_vga.c+29 -10 replies
8/9drm/ast: Register as a vga client to vgaarb by calling vga_client_register()drivers/gpu/drm/ast/ast_drv.c+29 -00 replies
9/9drm/loongson: Add an implement for the is_primary_gpu function callbackdrivers/gpu/drm/loongson/lsdc_drv.c+9 -10 replies

Reviews trailers per patch

1 of 9 patches has a Reviewed-by or Acked-by.

PatchJani NikulaLyude Paul
1/9
2/9
3/9
4/9A-b R-b
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/9] PCI/VGA: Improve the default VGA device selection

From: Sui Jingfeng <[email protected]>

Currently, the default VGA device selection is not perfect. Potential problems are:

1) This function is a no-op on non-x86 architectures.
2) It does not take the PCI Bar may get relocated into consideration.
3) It is not effective for the PCI device without a dedicated VRAM Bar.
4) It is device-agnostic, thus it has to waste the effort to iterate all of the PCI Bar to find the VRAM aperture.
5) It has invented lots of methods to determine which one is the default boot device on a multiple video card coexistence system. But this is still a policy because it doesn't give the user a choice to override.

With the observation that device drivers or video aperture helpers may have better knowledge about which PCI bar contains the firmware FB,

This patch tries to solve the above problems by introducing a function callback to the vga_client_register() function interface. DRM device drivers for the PCI device need to register the is_boot_device() function callback during the driver loading time. Once the driver binds the device successfully, VRAARB will call back to the driver. This gives the device drivers a chance to provide accurate boot device identification. Which in turn unlock the abitration service to non-x86 architectures. A device driver can also pass a NULL pointer to keep the original behavior.

This series is applied on the drm-tip branch (with a cleanup patch set[1] applied beforehand)

[1] https://patchwork.freedesktop.org/series/120548/

v2:
* Add a simple implemment for drm/i915 and drm/ast
* Pick up all tags (Mario)
v3:
* Fix a mistake for drm/i915 implement
* Fix patch can not be applied problem because of drm/amdgpu merged other people's patch.

Sui Jingfeng (9):
video/aperture: Add a helper to detect if an aperture contains
firmware FB
video/aperture: Add a helper for determining if an unmoved aperture
contain FB
PCI/VGA: Switch to aperture_contain_firmware_fb_nonreloc() PCI/VGA: Improve the default VGA device selection drm/amdgpu: Implement the is_primary_gpu callback of
vga_client_register()
drm/radeon: Add an implement for the is_primary_gpu function callback drm/i915: Add an implement for the is_primary_gpu hook drm/ast: Register as a vga client to vgaarb by calling
vga_client_register()
drm/loongson: Add an implement for the is_primary_gpu function
callback

 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +++-
 drivers/gpu/drm/ast/ast_drv.c              | 29 +++++++++
 drivers/gpu/drm/drm_aperture.c             | 16 +++++
 drivers/gpu/drm/i915/display/intel_vga.c   | 31 ++++++++-
 drivers/gpu/drm/loongson/lsdc_drv.c        | 10 ++-
 drivers/gpu/drm/nouveau/nouveau_vga.c      |  2 +-
 drivers/gpu/drm/radeon/radeon_device.c     | 12 +++-
 drivers/pci/vgaarb.c                       | 74 ++++++++++++++++------
 drivers/vfio/pci/vfio_pci_core.c           |  2 +-
 drivers/video/aperture.c                   | 65 +++++++++++++++++++
 include/drm/drm_aperture.h                 |  2 +
 include/linux/aperture.h                   | 14 ++++
 include/linux/vgaarb.h                     |  8 ++-
 13 files changed, 247 insertions(+), 30 deletions(-)
Signature · 1 line
2.25.1