2006-05-02 16:14:52

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: Add a "enable" sysfs attribute to the pci devices to allow userspace (Xorg) to enable devices without doing foul direct access

On Saturday 29 April 2006 03:04, Dave Airlie wrote:
>
> > This patch adds an "enable" sysfs attribute to each PCI device. When read it
> > shows the "enabled-ness" of the device, but you can write a "0" into it to
> > disable a device, and a "1" to enable it.
> >
> > This later is needed for X and other cases where userspace wants to enable
> > the BARs on a device (typical example: to run the video bios on a secundary
> > head). Right now X does all this "by hand" via bitbanging, that's just evil.
> > This allows X to no longer do that but to just let the kernel do this.
> >
> > Signed-off-by: Arjan van de Ven <[email protected]>
> > CC: Peter Jones <[email protected]>
> > CC: Dave Airlie <[email protected]>
>
> ACK
>
> This would allow me to remove the issue in X where loading the DRM at X
> startup acts differently than loading the DRM before X runs, due to Xs PCI
> probe running in-between... with this I can just enable all VGA devices
> and no worry whether they have a DRM or not..

This sysfs "enable" patch seems like goodness.

But I hope that when X uses this, it only enables & disables VGA
devices it's actually using. In the past, it seems like X has
blindly disabled *all* VGA devices in the system, even though
they might be in use by another X server. I'm sure that's all
well-understood and cleaned up now; just wanted to make sure
this nightmare didn't recur.


2006-05-02 16:23:20

by Greg KH

[permalink] [raw]
Subject: Re: Add a "enable" sysfs attribute to the pci devices to allow userspace (Xorg) to enable devices without doing foul direct access

On Tue, May 02, 2006 at 10:14:45AM -0600, Bjorn Helgaas wrote:
> On Saturday 29 April 2006 03:04, Dave Airlie wrote:
> >
> > > This patch adds an "enable" sysfs attribute to each PCI device. When read it
> > > shows the "enabled-ness" of the device, but you can write a "0" into it to
> > > disable a device, and a "1" to enable it.
> > >
> > > This later is needed for X and other cases where userspace wants to enable
> > > the BARs on a device (typical example: to run the video bios on a secundary
> > > head). Right now X does all this "by hand" via bitbanging, that's just evil.
> > > This allows X to no longer do that but to just let the kernel do this.
> > >
> > > Signed-off-by: Arjan van de Ven <[email protected]>
> > > CC: Peter Jones <[email protected]>
> > > CC: Dave Airlie <[email protected]>
> >
> > ACK
> >
> > This would allow me to remove the issue in X where loading the DRM at X
> > startup acts differently than loading the DRM before X runs, due to Xs PCI
> > probe running in-between... with this I can just enable all VGA devices
> > and no worry whether they have a DRM or not..
>
> This sysfs "enable" patch seems like goodness.
>
> But I hope that when X uses this, it only enables & disables VGA
> devices it's actually using. In the past, it seems like X has
> blindly disabled *all* VGA devices in the system, even though
> they might be in use by another X server. I'm sure that's all
> well-understood and cleaned up now; just wanted to make sure
> this nightmare didn't recur.

Hopefully with the recent PCI changes to X, this will not happen. If it
does, that's a big bug in X :)

thanks,

greg k-h

2006-05-02 16:51:41

by Jesse Barnes

[permalink] [raw]
Subject: Re: Add a "enable" sysfs attribute to the pci devices to allow userspace (Xorg) to enable devices without doing foul direct access

> > But I hope that when X uses this, it only enables & disables VGA
> > devices it's actually using. In the past, it seems like X has
> > blindly disabled *all* VGA devices in the system, even though
> > they might be in use by another X server. I'm sure that's all
> > well-understood and cleaned up now; just wanted to make sure
> > this nightmare didn't recur.
>
> Hopefully with the recent PCI changes to X, this will not happen. If
> it does, that's a big bug in X :)

On some machines it still has no alternative, since the kernel doesn't
have a VGA arbiter of any kind. Yes this sucks.

Jesse