linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [-next 0/5] Add the pci_is_vga() helper and use it
@ 2023-08-30 11:15 Sui Jingfeng
  2023-08-30 11:15 ` [-next 1/5] PCI: Add the pci_is_vga() helper Sui Jingfeng
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Sui Jingfeng @ 2023-08-30 11:15 UTC (permalink / raw)
  To: Bjorn Helgaas, Gerd Hoffmann, Gurchetan Singh, Chia-I Wu
  Cc: dri-devel, linux-pci, linux-kernel, virtualization, Sui Jingfeng

From: Sui Jingfeng <suijingfeng@loongson.cn>

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
-- 
2.34.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-10-06 22:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-30 11:15 [-next 0/5] Add the pci_is_vga() helper and use it Sui Jingfeng
2023-08-30 11:15 ` [-next 1/5] PCI: Add the pci_is_vga() helper Sui Jingfeng
2023-10-05 22:51   ` Bjorn Helgaas
2023-10-06 11:40     ` Sui Jingfeng
2023-10-06 12:10       ` Maciej W. Rozycki
2023-08-30 11:15 ` [-next 2/5] PCI/VGA: Deal with VGA devices Sui Jingfeng
2023-08-30 11:15 ` [-next 3/5] PCI/sysfs: Use pci_is_vga() helper Sui Jingfeng
2023-08-30 11:15 ` [-next 4/5] drm/virgpu: Switch to pci_is_vga() Sui Jingfeng
2023-10-05 21:57   ` Bjorn Helgaas
2023-10-05 22:10     ` Bjorn Helgaas
2023-10-06 11:22     ` Sui Jingfeng
2023-08-30 11:15 ` [-next 5/5] drm/qxl: " Sui Jingfeng
2023-10-06 22:19 ` [-next 0/5] Add the pci_is_vga() helper and use it Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).