Move `boot_display` from PCI to DRM
Subsystems (3)
v4 cover Move `boot_display` from PCI to DRM
From: Mario Limonciello <[email protected]>
Shortly after the series for introducing boot_display was merged Manivannan Sadhasivam suggested that it's better not to introduce new top level PCI attributes where possible.
He proposed that the boot_display attribute should be provided by DRM instead and that userspace should look for that.
Change the owner of boot_display from the PCI device to the DRM card. This should also have the side effect that non-PCI DRM drivers can add support more easily.
NOTE: If acceptable this should be merged through the PCI tree as it depends upon changes and symbols from the boot_display series.
Mario Limonciello (1):
PCI: Move boot display attribute to drm
Documentation/ABI/testing/sysfs-bus-pci | 9 ----- drivers/gpu/drm/drm_sysfs.c | 41 ++++++++++++++++++++++ drivers/pci/pci-sysfs.c | 45 ------------------------- 3 files changed, 41 insertions(+), 54 deletions(-)
base-commit: c4f2dc1e5293c4383844d8161d9922adda534e7c
Signature · 1 line
2.43.0
PATCH v4 1/1 PCI: Move boot display attribute to DRM
From: Mario Limonciello <[email protected]>
The boot_display attribute is currently created by PCI core, but the main reason it exists is for userspace software that interacts with drm to make decisions. Move the attribute to DRM.
This also fixes a compilation failure when compiled without CONFIG_VIDEO on sparc.
--- Documentation/ABI/testing/sysfs-bus-pci | 9 ----- Documentation/ABI/testing/sysfs-class-drm | 8 ++++ drivers/gpu/drm/drm_sysfs.c | 41 +++++++++++++++++++++ drivers/pci/pci-sysfs.c | 45 ----------------------- 4 files changed, 49 insertions(+), 54 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-drm
Documentation/ABI/testing/sysfs-bus-pci +0 -9
@@ -612,12 +612,3 @@ Description: # ls doe_features 0001:01 0001:02 doe_discovery - -What: /sys/bus/pci/devices/.../boot_display -Date: October 2025 -Contact: Linux PCI developers <[email protected]> -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".
Documentation/ABI/testing/sysfs-class-drm new file +8 -0
@@ -0,0 +1,8 @@ +What: /sys/class/drm/.../boot_display +Date: October 2025 +Contact: Linux DRI developers <[email protected]> +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".
drivers/gpu/drm/drm_sysfs.c +41 -0
65 lines not on this page · raw message
drivers/pci/pci-sysfs.c +0 -45
72 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v4 1/1] PCI: Move boot display attribute to DRM
Quoted 6 lines · Mario Limonciello
From: Mario Limonciello <[email protected]>
The
boot_displayattribute is currently created by PCI core, but the main reason it exists is for userspace software that interacts with drm to make decisions. Move the attribute to DRM.
Quoted 7 lines
This also fixes a compilation failure when compiled without
CONFIG_VIDEOon sparc.Suggested-by Manivannan Sadhasivam <[email protected]>Reported-by Stephen Rothwell <[email protected]>Signed-off-by Mario Limonciello <[email protected]>
Thanks Mario!
- Mani
Quoted 195 lines
--- Documentation/ABI/testing/sysfs-bus-pci | 9 ----- Documentation/ABI/testing/sysfs-class-drm | 8 ++++ drivers/gpu/drm/drm_sysfs.c | 41 +++++++++++++++++++++ drivers/pci/pci-sysfs.c | 45 ----------------------- 4 files changed, 49 insertions(+), 54 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-drmDocumentation/ABI/testing/sysfs-bus-pci +0
-9@@ -612,12 +612,3 @@ Description: # ls doe_features 0001:01 0001:02 doe_discovery - -What: /sys/bus/pci/devices/.../boot_display -Date: October 2025 -Contact: Linux PCI developers <[email protected]> -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".Documentation/ABI/testing/sysfs-class-drm new file +8
-0@@ -0,0 +1,8 @@ +What: /sys/class/drm/.../boot_display +Date: October 2025 +Contact: Linux DRI developers <[email protected]> +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".drivers/gpu/drm/drm_sysfs.c +41
-0@@ -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; }drivers/pci/pci-sysfs.c +0
-45@@ -680,13 +680,6 @@ const struct attribute_group *pcibus_groups[] = { NULL, }; -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 ssize_t boot_vga_show (struct device *dev,struct device_attribute *attr,char *buf) {@@ -1059,37 +1052,6 @@ void pci_remove_legacy_files(struct pci_bus *b) }#endif /* HAVE_PCI_LEGACY */ -/** -* pci_create_boot_display_file - create "boot_display" -* @pdev: dev in question -* -* Create "boot_display" in sysfs for the PCI device @pdev if it is the -* boot display device. -*/ -static int pci_create_boot_display_file (struct pci_dev *pdev) -{ -#ifdef CONFIG_VIDEO -if (video_is_primary_device (&pdev->dev)) -return sysfs_create_file (&pdev->dev.kobj, &dev_attr_boot_display.attr); -#endif -return 0 ; -} - -/** -* pci_remove_boot_display_file - remove "boot_display" -* @pdev: dev in question -* -* Remove "boot_display" in sysfs for the PCI device @pdev if it is the -* boot display device. -*/ -static void pci_remove_boot_display_file (struct pci_dev *pdev) -{ -#ifdef CONFIG_VIDEO -if (video_is_primary_device (&pdev->dev)) -sysfs_remove_file (&pdev->dev.kobj, &dev_attr_boot_display.attr); -#endif -} -#if defined(HAVE_PCI_MMAP ) || defined(ARCH_GENERIC_PCI_MMAP_RESOURCE )/** * pci_mmap_resource - map a PCI resource into user memory space @@ -1693,15 +1655,9 @@ static const struct attribute_group pci_dev_resource_resize_group = {int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) { -int retval; -if (!sysfs_initialized)return -EACCES ; - retval =pci_create_boot_display_file (pdev); -if (retval) -return retval; -return pci_create_resource_files (pdev); }@@ -1716,7 +1672,6 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev)if (!sysfs_initialized)return ; -pci_remove_boot_display_file (pdev);pci_remove_resource_files (pdev); }Signature · 1 line
2.43.0
Signature · 1 line
மணிவண்ணன் சதாசிவம்