lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250626204347.GA1638339@bhelgaas>
Date: Thu, 26 Jun 2025 15:43:47 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Mario Limonciello <superm1@...nel.org>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
	Alex Deucher <alexander.deucher@....com>,
	Christian König <christian.koenig@....com>,
	David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
	Lukas Wunner <lukas@...ner.de>,
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
	Maxime Ripard <mripard@...nel.org>,
	Thomas Zimmermann <tzimmermann@...e.de>,
	David Woodhouse <dwmw2@...radead.org>,
	Lu Baolu <baolu.lu@...ux.intel.com>, Joerg Roedel <joro@...tes.org>,
	Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
	Alex Williamson <alex.williamson@...hat.com>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
	"open list:DRM DRIVERS" <dri-devel@...ts.freedesktop.org>,
	open list <linux-kernel@...r.kernel.org>,
	"open list:INTEL IOMMU (VT-d)" <iommu@...ts.linux.dev>,
	"open list:PCI SUBSYSTEM" <linux-pci@...r.kernel.org>,
	"open list:VFIO DRIVER" <kvm@...r.kernel.org>,
	"open list:SOUND" <linux-sound@...r.kernel.org>,
	Daniel Dadap <ddadap@...dia.com>,
	Mario Limonciello <mario.limonciello@....com>,
	Simona Vetter <simona.vetter@...ll.ch>
Subject: Re: [PATCH v5 1/9] PCI: Add helper for checking if a PCI device is a
 display controller

On Tue, Jun 24, 2025 at 03:30:34PM -0500, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@....com>
> 
> Several places in the kernel do class shifting to match whether a
> PCI device is display class.  Introduce a helper for those places to
> use.
> 
> Reviewed-by: Daniel Dadap <ddadap@...dia.com>
> Reviewed-by: Simona Vetter <simona.vetter@...ll.ch>
> Signed-off-by: Mario Limonciello <mario.limonciello@....com>

Acked-by: Bjorn Helgaas <bhelgaas@...gle.com>

Not sure how this should be merged, let me know if you want me to do
something with it.

> ---
>  include/linux/pci.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 05e68f35f3923..e77754e43c629 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -744,6 +744,21 @@ static inline bool pci_is_vga(struct pci_dev *pdev)
>  	return false;
>  }
>  
> +/**
> + * pci_is_display - Check if a PCI device is a display controller
> + * @pdev: Pointer to the PCI device structure
> + *
> + * This function determines 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
> -- 
> 2.43.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ