mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 21:14:56 -04:00
Merge branch 'pci/boot-display'
- Add pci_is_display() to check for "Display" base class and use it in ALSA hda, vfio, vga_switcheroo, vt-d (Mario Limonciello) * pci/boot-display: ALSA: hda: Use pci_is_display() iommu/vt-d: Use pci_is_display() vga_switcheroo: Use pci_is_display() vfio/pci: Use pci_is_display() PCI: Add pci_is_display() to check if device is a display controller
This commit is contained in:
@@ -437,7 +437,7 @@ find_active_client(struct list_head *head)
|
||||
*/
|
||||
bool vga_switcheroo_client_probe_defer(struct pci_dev *pdev)
|
||||
{
|
||||
if ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
|
||||
if (pci_is_display(pdev)) {
|
||||
/*
|
||||
* apple-gmux is needed on pre-retina MacBook Pro
|
||||
* to probe the panel if pdev is the inactive GPU.
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#define ROOT_SIZE VTD_PAGE_SIZE
|
||||
#define CONTEXT_SIZE VTD_PAGE_SIZE
|
||||
|
||||
#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
|
||||
#define IS_GFX_DEVICE(pdev) pci_is_display(pdev)
|
||||
#define IS_USB_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB)
|
||||
#define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
|
||||
#define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e)
|
||||
|
||||
@@ -437,8 +437,7 @@ static int vfio_pci_igd_cfg_init(struct vfio_pci_core_device *vdev)
|
||||
|
||||
bool vfio_pci_is_intel_display(struct pci_dev *pdev)
|
||||
{
|
||||
return (pdev->vendor == PCI_VENDOR_ID_INTEL) &&
|
||||
((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY);
|
||||
return (pdev->vendor == PCI_VENDOR_ID_INTEL) && pci_is_display(pdev);
|
||||
}
|
||||
|
||||
int vfio_pci_igd_init(struct vfio_pci_core_device *vdev)
|
||||
|
||||
@@ -744,6 +744,21 @@ static inline bool pci_is_vga(struct pci_dev *pdev)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* pci_is_display - check if the PCI device is a display controller
|
||||
* @pdev: PCI device
|
||||
*
|
||||
* Determine whether the given PCI device corresponds to a display
|
||||
* controller. Display controllers are typically used for graphical output
|
||||
* and are identified based on their class code.
|
||||
*
|
||||
* Return: true if the PCI device is a display controller, false otherwise.
|
||||
*/
|
||||
static inline bool pci_is_display(struct pci_dev *pdev)
|
||||
{
|
||||
return (pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY;
|
||||
}
|
||||
|
||||
#define for_each_pci_bridge(dev, bus) \
|
||||
list_for_each_entry(dev, &bus->devices, bus_list) \
|
||||
if (!pci_is_bridge(dev)) {} else
|
||||
|
||||
@@ -155,7 +155,7 @@ static int i915_gfx_present(struct pci_dev *hdac_pci)
|
||||
|
||||
for_each_pci_dev(display_dev) {
|
||||
if (display_dev->vendor != PCI_VENDOR_ID_INTEL ||
|
||||
(display_dev->class >> 16) != PCI_BASE_CLASS_DISPLAY)
|
||||
!pci_is_display(display_dev))
|
||||
continue;
|
||||
|
||||
if (pci_match_id(denylist, display_dev))
|
||||
|
||||
@@ -1465,7 +1465,7 @@ static struct pci_dev *get_bound_vga(struct pci_dev *pci)
|
||||
* the dGPU is the one who is involved in
|
||||
* vgaswitcheroo.
|
||||
*/
|
||||
if (((p->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
|
||||
if (pci_is_display(p) &&
|
||||
(atpx_present() || apple_gmux_detect(NULL, NULL)))
|
||||
return p;
|
||||
pci_dev_put(p);
|
||||
@@ -1477,7 +1477,7 @@ static struct pci_dev *get_bound_vga(struct pci_dev *pci)
|
||||
p = pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus),
|
||||
pci->bus->number, 0);
|
||||
if (p) {
|
||||
if ((p->class >> 16) == PCI_BASE_CLASS_DISPLAY)
|
||||
if (pci_is_display(p))
|
||||
return p;
|
||||
pci_dev_put(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user