mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kyle Moffett <mrmacman_g4@mac.com>
To: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Jon Smirl <jonsmirl@gmail.com>, Dave Airlie <airlied@gmail.com>,
	Greg KH <greg@kroah.com>, Ian Romanick <idr@us.ibm.com>,
	Dave Airlie <airlied@linux.ie>,
	Arjan van de Ven <arjan@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Add a "enable" sysfs attribute to the pci devices to allow userspace (Xorg) to enable devices without doing foul direct access
Date: Sun, 7 May 2006 15:07:08 -0400	[thread overview]
Message-ID: <E4FD2AAC-98AA-42EF-951D-02757C24550C@mac.com> (raw)
In-Reply-To: <m3mzdum448.fsf@defiant.localdomain>

On May 7, 2006, at 08:05:59, Krzysztof Halasa wrote:
> Kyle Moffett <mrmacman_g4@mac.com> writes:
>> Jon Smirl gave a great description of exactly how to write such a  
>> "driver".  I seem to recall that we already have the ability to  
>> trigger manual PCI binding by bus:slot number; in combination with  
>> an appropriate "write EEPROM with firmware file" driver that has  
>> no default list of PCI devices; you could easily manually trigger  
>> a bind of the device.
>
> Writing EEPROM is not a problem and can be done safely from user  
> space (mmap /dev/mem).

This is *exactly* what we don't want to do!  The whole point of this  
thread is to prevent the need to use /dev/mem and /dev/kmem for  
anything except debugging.

> Doing it in the kernel seems like an overkill, especially if you do  
> the operation once in few years it's much easier to just download a  
> (statically linked?) binary than messing with the kernel.

Ewww, I certainly wouldn't trust a binary statically-linked binary  
program that mmaps /dev/mem or /dev/kmem, and I certainly bet that  
90% of the people on this list would feel likewise.  We'd much prefer  
a program which does this:

   #! /bin/sh
   cp firmware.bin /lib/firmware/some_firmware_file.bin
   echo -n eeprom_load_driver >/sys/device/$PCI_ID/bind
   echo -n 1 >/sys/device/$PCI_ID/unbind

Simple, obviously correct, and uses a nice reuseable driver too!

> It doesn't even interfere with the "main" driver and can be done  
> while the device is operating (given that previous EEPROM made  
> sense, otherwise the driver would not load).

No!  That would be even worse!  You're then having userspace poke at  
the driver while a kernel driver is loaded, which is *exactly* what X  
is getting into trouble for doing.  If you want to add firmware  
update capability, add it to the preexisting primary driver.

>> In any case what you really need for all those cases is a  
>> simplistic stub driver that provides some sort of in-kernel mutual  
>> exclusion.
>
> Right. I.e., "enable" interface with, possibly, locking mechanism,  
> instead of some per-class "driver".

No, not an "enable" interface.  In this case the kernel should do  
basically all of the poking at PCI resources for you.  If you  
_really_ want to do that kind of update in userspace, write a stub  
driver which just enables the device on bind, disables it on unbind,  
and mmap and write to the sysfs "rom" file.

Cheers,
Kyle Moffett


  reply	other threads:[~2006-05-07 19:07 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-29  8:46 Arjan van de Ven
2006-04-29  8:51 ` Andrew Morton
2006-04-29  8:59   ` Arjan van de Ven
2006-04-29  9:04     ` Dave Airlie
2006-05-02 16:14       ` Bjorn Helgaas
2006-05-02 16:21         ` Greg KH
2006-05-02 16:51           ` Jesse Barnes
2006-05-04 19:09       ` Bjorn Helgaas
2006-05-04 19:11         ` Arjan van de Ven
2006-05-04 19:26           ` Bjorn Helgaas
2006-05-04 19:42             ` Matthew Garrett
2006-05-04 20:40               ` Jon Smirl
2006-05-04 21:05                 ` Peter Jones
2006-05-04 21:17                   ` Martin Mares
2006-05-04 21:29                     ` Peter Jones
2006-05-04 21:37                       ` Martin Mares
2006-05-04 21:38                       ` Jon Smirl
2006-05-04 23:22                         ` Peter Jones
2006-05-05 19:20                           ` Ian Romanick
2006-05-05 20:14                             ` Jon Smirl
2006-05-05 20:26                               ` Greg KH
2006-05-05 20:35                                 ` Jon Smirl
2006-05-05 20:43                                   ` Jon Smirl
2006-05-05 21:10                                     ` Greg KH
2006-05-05 21:06                                   ` Greg KH
2006-05-05 21:15                                     ` Jon Smirl
2006-05-05 22:27                                       ` Greg KH
2006-05-06  0:05                                         ` Jon Smirl
2006-05-06  1:57                                           ` Dave Airlie
2006-05-06  3:39                                             ` Jon Smirl
2006-05-06 12:42                                               ` Krzysztof Halasa
2006-05-06 13:08                                                 ` Jon Smirl
2006-05-06 18:10                                                   ` Krzysztof Halasa
2006-05-06 18:24                                                     ` Jon Smirl
2006-05-06 23:16                                                       ` Krzysztof Halasa
2006-05-07  5:56                                                         ` Kyle Moffett
2006-05-07 12:05                                                           ` Krzysztof Halasa
2006-05-07 19:07                                                             ` Kyle Moffett [this message]
2006-05-08  0:03                                                               ` Krzysztof Halasa
2006-05-07 13:12                                             ` Pavel Machek
2006-05-08 14:26                                               ` Kyle Moffett
2006-05-08 14:54                                                 ` Arjan van de Ven
2006-05-08  4:06                                           ` Dave Airlie
2006-05-08  5:27                                             ` Jon Smirl
2006-05-07  8:54                                 ` Adam Belay
2006-05-14  0:29                       ` Benjamin Herrenschmidt
2006-05-14  0:56                         ` Jon Smirl
2006-05-14 23:57                           ` Benjamin Herrenschmidt
2006-05-15  0:14                             ` Jon Smirl
2006-05-14  0:57                         ` Patrick McFarland
2006-05-14  1:11                           ` Jon Smirl
2006-05-04 21:18                   ` Jon Smirl
2006-05-04 21:38                     ` Peter Jones
2006-05-04 21:48                       ` Jon Smirl
2006-05-04 21:57                         ` Peter Jones
2006-05-04 22:05                           ` Jon Smirl
2006-05-04 19:49             ` Arjan van de Ven
2006-05-15  2:10     ` Eric W. Biederman
2006-05-02 16:38 ` Jon Smirl
2006-05-02 16:45   ` Arjan van de Ven
2006-05-02 16:59     ` Jon Smirl
2006-05-02 17:00       ` Arjan van de Ven
2006-05-02 17:13         ` Jon Smirl
2006-05-02 18:27           ` Arjan van de Ven
2006-05-02 19:00             ` Jon Smirl
2006-05-02 19:29               ` Peter Jones
2006-05-02 21:40               ` Dave Airlie
2006-05-02 21:52                 ` Jon Smirl
2006-05-02 23:36                   ` Dave Airlie
2006-05-03  0:19                   ` Matthew Wilcox
2006-05-03  0:26                     ` Valdis.Kletnieks
2006-05-03  1:24                     ` Jon Smirl
2006-05-03  1:30                       ` Dave Airlie
2006-05-03  6:02                   ` Arjan van de Ven
2006-05-03 13:23                     ` Jon Smirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E4FD2AAC-98AA-42EF-951D-02757C24550C@mac.com \
    --to=mrmacman_g4@mac.com \
    --cc=airlied@gmail.com \
    --cc=airlied@linux.ie \
    --cc=arjan@linux.intel.com \
    --cc=greg@kroah.com \
    --cc=idr@us.ibm.com \
    --cc=jonsmirl@gmail.com \
    --cc=khc@pm.waw.pl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®