Skip to content

Add the pci_is_vga() helper and use it

Sui Jingfeng dri-devel linux-pci lkml virtualization 1 version Applied

Status from this message: I applied these on pci/vga for v6.7, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 7 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/5PCI: Add the pci_is_vga() helperinclude/linux/pci.h+27 -03 replies
2/5PCI/VGA: Deal with VGA devicesdrivers/pci/vgaarb.c+9 -100 replies
3/5PCI/sysfs: Use pci_is_vga() helperdrivers/pci/pci-sysfs.c+3 -30 replies
4/5drm/virgpu: Switch to pci_is_vga()drivers/gpu/drm/virtio/virtgpu_drv.c+1 -13 replies
5/5drm/qxl: Switch to pci_is_vga()drivers/gpu/drm/qxl/qxl_drv.c+3 -80 replies

Reviews trailers per patch

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

PatchMario Limonciello
1/5
2/5R-b
3/5
4/5
5/5

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

Read the v1 thread

Cover letter [-next 0/5] Add the pci_is_vga() helper and use it

From: Sui Jingfeng <[email protected]>

The PCI code and ID assignment specification defined four types of display controllers for the display base class(03h), and the devices with 0x00h sub-class code are VGA devices. VGA devices with programming interface 0x00 is VGA-compatible, VGA devices with programming interface 0x01 are 8514-compatible controllers. Besides, PCI_CLASS_NOT_DEFINED_VGA is defined to provide backward compatibility for devices that were built before the class code field was defined. Thus, PCI(e) device with the PCI_CLASS_NOT_DEFINED_VGA class code should also be handled as the normal VGA-compatible devices.

Compared with the "if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)" code, the newly implemented pci_is_vga() is shorter and straightforward. So it is more easy to use. It is designed as a inline function, the more common case "if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA))" is put before the less common case "if ((pdev->class >> 8) == PCI_CLASS_NOT_DEFINED_VGA)", so there should no performance penalty.

Sui Jingfeng (5):
PCI: Add the pci_is_vga() helper
PCI/VGA: Deal with VGA devices
PCI/sysfs: Use pci_is_vga() helper
drm/virgpu: Switch to pci_is_vga()
drm/qxl: Switch to pci_is_vga()

 drivers/gpu/drm/qxl/qxl_drv.c        | 11 +++--------
 drivers/gpu/drm/virtio/virtgpu_drv.c |  2 +-
 drivers/pci/pci-sysfs.c              |  6 +++---
 drivers/pci/vgaarb.c                 | 19 +++++++++----------
 include/linux/pci.h                  | 27 +++++++++++++++++++++++++++
 5 files changed, 43 insertions(+), 22 deletions(-)

base-commit: 43cc31da9146f9ce60e4a03d96ef0807c2cdac94

Signature · 1 line
2.34.1