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: <02f7455e-d1b3-414b-a4cb-27b9353a4034@suse.de>
Date: Wed, 10 Sep 2025 16:28:57 +0200
From: Thomas Zimmermann <tzimmermann@...e.de>
To: "Mario Limonciello (AMD)" <superm1@...nel.org>,
 David Airlie <airlied@...il.com>, Bjorn Helgaas <bhelgaas@...gle.com>
Cc: Alex Deucher <alexander.deucher@....com>,
 Christian König <christian.koenig@....com>,
 Simona Vetter <simona@...ll.ch>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
 Maxime Ripard <mripard@...nel.org>,
 "open list:DRM DRIVERS" <dri-devel@...ts.freedesktop.org>,
 open list <linux-kernel@...r.kernel.org>,
 "open list:PCI SUBSYSTEM" <linux-pci@...r.kernel.org>,
 Daniel Dadap <ddadap@...dia.com>, Manivannan Sadhasivam <mani@...nel.org>
Subject: Re: [PATCH v10 4/4] DRM: Add a new 'boot_display' attribute



Am 11.08.25 um 18:26 schrieb Mario Limonciello (AMD):
> On systems with multiple GPUs there can be uncertainty which GPU is the
> primary one used to drive the display at bootup. In some desktop
> environments this can lead to increased power consumption because
> secondary GPUs may be used for rendering and never go to a low power
> state. In order to disambiguate this add a new sysfs attribute
> 'boot_display' that uses the output of video_is_primary_device() to
> populate whether the PCI device was used for driving the display.
>
> Suggested-by: Manivannan Sadhasivam <mani@...nel.org>
> Acked-by: Manivannan Sadhasivam <mani@...nel.org>
> Link: https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/issues/23
> Signed-off-by: Mario Limonciello (AMD) <superm1@...nel.org>

Reviewed-by: Thomas Zimmermann <tzimmermann@...e.de>

> ---
> v10:
>   * Rebase on 6.17-rc1
>   * Drop Thomas' tag, as this is now in a totally different subsystem
>     (although same code)
>   * Squash "Adjust visibility of boot_display attribute instead of creation"
>   * Squash "PCI: Move boot display attribute to DRM"
> ---
>   Documentation/ABI/testing/sysfs-class-drm |  8 +++++
>   drivers/gpu/drm/drm_sysfs.c               | 41 +++++++++++++++++++++++
>   2 files changed, 49 insertions(+)
>   create mode 100644 Documentation/ABI/testing/sysfs-class-drm
>
> diff --git a/Documentation/ABI/testing/sysfs-class-drm b/Documentation/ABI/testing/sysfs-class-drm
> new file mode 100644
> index 0000000000000..d23fed5e29a74
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-class-drm
> @@ -0,0 +1,8 @@
> +What:		/sys/class/drm/.../boot_display
> +Date:		January 2026
> +Contact:	Linux DRI developers <dri-devel@...r.kernel.org>
> +Description:
> +		This file indicates that displays connected to the device were
> +		used to display the boot sequence.  If a display connected to
> +		the device was used to display the boot sequence the file will
> +		be present and contain "1".
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index a455c56dbbeb7..b01ffa4d65098 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -18,6 +18,7 @@
>   #include <linux/gfp.h>
>   #include <linux/i2c.h>
>   #include <linux/kdev_t.h>
> +#include <linux/pci.h>
>   #include <linux/property.h>
>   #include <linux/slab.h>
>   
> @@ -30,6 +31,8 @@
>   #include <drm/drm_property.h>
>   #include <drm/drm_sysfs.h>
>   
> +#include <asm/video.h>
> +
>   #include "drm_internal.h"
>   #include "drm_crtc_internal.h"
>   
> @@ -508,6 +511,43 @@ void drm_sysfs_connector_property_event(struct drm_connector *connector,
>   }
>   EXPORT_SYMBOL(drm_sysfs_connector_property_event);
>   
> +static ssize_t boot_display_show(struct device *dev, struct device_attribute *attr,
> +				 char *buf)
> +{
> +	return sysfs_emit(buf, "1\n");
> +}
> +static DEVICE_ATTR_RO(boot_display);
> +
> +static struct attribute *display_attrs[] = {
> +	&dev_attr_boot_display.attr,
> +	NULL
> +};
> +
> +static umode_t boot_display_visible(struct kobject *kobj,
> +				    struct attribute *a, int n)
> +{
> +	struct device *dev = kobj_to_dev(kobj)->parent;
> +
> +	if (dev_is_pci(dev)) {
> +		struct pci_dev *pdev = to_pci_dev(dev);
> +
> +		if (video_is_primary_device(&pdev->dev))
> +			return a->mode;
> +	}
> +
> +	return 0;
> +}
> +
> +static const struct attribute_group display_attr_group = {
> +	.attrs = display_attrs,
> +	.is_visible = boot_display_visible,
> +};
> +
> +static const struct attribute_group *card_dev_groups[] = {
> +	&display_attr_group,
> +	NULL
> +};
> +
>   struct device *drm_sysfs_minor_alloc(struct drm_minor *minor)
>   {
>   	const char *minor_str;
> @@ -531,6 +571,7 @@ struct device *drm_sysfs_minor_alloc(struct drm_minor *minor)
>   
>   		kdev->devt = MKDEV(DRM_MAJOR, minor->index);
>   		kdev->class = drm_class;
> +		kdev->groups = card_dev_groups;
>   		kdev->type = &drm_sysfs_device_minor;
>   	}
>   

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ