* [PATCH v4 0/1] Move `boot_display` from PCI to DRM
@ 2025-07-21 18:57 Mario Limonciello
2025-07-21 18:57 ` [PATCH v4 1/1] PCI: Move boot display attribute " Mario Limonciello
0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2025-07-21 18:57 UTC (permalink / raw)
To: David Airlie, Bjorn Helgaas
Cc: Alex Deucher, Christian König, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
open list:DRM DRIVERS, open list, open list:PCI SUBSYSTEM,
Daniel Dadap, Mario Limonciello
From: Mario Limonciello <mario.limonciello@amd.com>
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
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v4 1/1] PCI: Move boot display attribute to DRM
2025-07-21 18:57 [PATCH v4 0/1] Move `boot_display` from PCI to DRM Mario Limonciello
@ 2025-07-21 18:57 ` Mario Limonciello
2025-07-22 16:00 ` Manivannan Sadhasivam
0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2025-07-21 18:57 UTC (permalink / raw)
To: David Airlie, Bjorn Helgaas
Cc: Alex Deucher, Christian König, Simona Vetter,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
open list:DRM DRIVERS, open list, open list:PCI SUBSYSTEM,
Daniel Dadap, Mario Limonciello, Manivannan Sadhasivam,
Stephen Rothwell
From: Mario Limonciello <mario.limonciello@amd.com>
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.
Suggested-by: Manivannan Sadhasivam <mani@kernel.org>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Closes: https://lore.kernel.org/linux-next/20250718224118.5b3f22b0@canb.auug.org.au/
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
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
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
index a2c74d4ebeadd..69f952fffec72 100644
--- a/Documentation/ABI/testing/sysfs-bus-pci
+++ b/Documentation/ABI/testing/sysfs-bus-pci
@@ -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 <linux-pci@vger.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/Documentation/ABI/testing/sysfs-class-drm b/Documentation/ABI/testing/sysfs-class-drm
new file mode 100644
index 0000000000000..536820afca05b
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-drm
@@ -0,0 +1,8 @@
+What: /sys/class/drm/.../boot_display
+Date: October 2025
+Contact: Linux DRI developers <dri-devel@vger.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 60c1f26edb6fa..1bc2e6abaa1a9 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;
}
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 6ccd65f5b1051..b3fb6024e0ba7 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -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);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4 1/1] PCI: Move boot display attribute to DRM
2025-07-21 18:57 ` [PATCH v4 1/1] PCI: Move boot display attribute " Mario Limonciello
@ 2025-07-22 16:00 ` Manivannan Sadhasivam
0 siblings, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2025-07-22 16:00 UTC (permalink / raw)
To: Mario Limonciello
Cc: David Airlie, Bjorn Helgaas, Alex Deucher, Christian König,
Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, open list:DRM DRIVERS, open list,
open list:PCI SUBSYSTEM, Daniel Dadap, Mario Limonciello,
Stephen Rothwell
On Mon, Jul 21, 2025 at 01:57:26PM GMT, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> 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.
>
> Suggested-by: Manivannan Sadhasivam <mani@kernel.org>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Closes: https://lore.kernel.org/linux-next/20250718224118.5b3f22b0@canb.auug.org.au/
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Thanks Mario!
- Mani
> ---
> 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
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci
> index a2c74d4ebeadd..69f952fffec72 100644
> --- a/Documentation/ABI/testing/sysfs-bus-pci
> +++ b/Documentation/ABI/testing/sysfs-bus-pci
> @@ -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 <linux-pci@vger.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/Documentation/ABI/testing/sysfs-class-drm b/Documentation/ABI/testing/sysfs-class-drm
> new file mode 100644
> index 0000000000000..536820afca05b
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-class-drm
> @@ -0,0 +1,8 @@
> +What: /sys/class/drm/.../boot_display
> +Date: October 2025
> +Contact: Linux DRI developers <dri-devel@vger.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 60c1f26edb6fa..1bc2e6abaa1a9 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;
> }
>
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index 6ccd65f5b1051..b3fb6024e0ba7 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -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);
> }
>
> --
> 2.43.0
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-22 16:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21 18:57 [PATCH v4 0/1] Move `boot_display` from PCI to DRM Mario Limonciello
2025-07-21 18:57 ` [PATCH v4 1/1] PCI: Move boot display attribute " Mario Limonciello
2025-07-22 16:00 ` Manivannan Sadhasivam
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).