mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge branch 'master' into next
Conflicts: fs/namei.c Manually merged per: diff --cc fs/namei.c index 734f2b5,bbc15c2..0000000 --- a/fs/namei.c +++ b/fs/namei.c @@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char nd->flags |= LOOKUP_CONTINUE; err = exec_permission_lite(inode); if (err == -EAGAIN) - err = vfs_permission(nd, MAY_EXEC); + err = inode_permission(nd->path.dentry->d_inode, + MAY_EXEC); + if (!err) + err = ima_path_check(&nd->path, MAY_EXEC); if (err) break; @@@ -1525,14 -1506,9 +1509,14 @@@ int may_open(struct path *path, int acc flag &= ~O_TRUNC; } - error = vfs_permission(nd, acc_mode); + error = inode_permission(inode, acc_mode); if (error) return error; + - error = ima_path_check(&nd->path, ++ error = ima_path_check(path, + acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC)); + if (error) + return error; /* * An append-only file must be opened in append mode for writing. */ Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
1
.mailmap
1
.mailmap
@@ -32,6 +32,7 @@ Christoph Hellwig <hch@lst.de>
|
||||
Corey Minyard <minyard@acm.org>
|
||||
David Brownell <david-b@pacbell.net>
|
||||
David Woodhouse <dwmw2@shinybook.infradead.org>
|
||||
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
|
||||
Domen Puncer <domen@coderock.org>
|
||||
Douglas Gilbert <dougg@torque.net>
|
||||
Ed L. Cashin <ecashin@coraid.com>
|
||||
|
||||
38
CREDITS
38
CREDITS
@@ -369,10 +369,10 @@ P: 1024/8462A731 4C 55 86 34 44 59 A7 99 2B 97 88 4A 88 9A 0D 97
|
||||
D: sun4 port, Sparc hacker
|
||||
|
||||
N: Hugh Blemings
|
||||
E: hugh@misc.nu
|
||||
W: http://misc.nu/hugh/
|
||||
D: Author and maintainer of the Keyspan USB to Serial drivers
|
||||
S: Po Box 234
|
||||
E: hugh@blemings.org
|
||||
W: http://blemings.org/hugh
|
||||
D: Original author of the Keyspan USB to serial drivers, random PowerPC hacker
|
||||
S: PO Box 234
|
||||
S: Belconnen ACT 2616
|
||||
S: Australia
|
||||
|
||||
@@ -464,6 +464,11 @@ S: 1200 Goldenrod Dr.
|
||||
S: Nampa, Idaho 83686
|
||||
S: USA
|
||||
|
||||
N: Dirk J. Brandewie
|
||||
E: dirk.j.brandewie@intel.com
|
||||
E: linux-wimax@intel.com
|
||||
D: Intel Wireless WiMAX Connection 2400 SDIO driver
|
||||
|
||||
N: Derrick J. Brashear
|
||||
E: shadow@dementia.org
|
||||
W: http://www.dementia.org/~shadow
|
||||
@@ -1681,7 +1686,7 @@ E: ajoshi@shell.unixbox.com
|
||||
D: fbdev hacking
|
||||
|
||||
N: Jesper Juhl
|
||||
E: jesper.juhl@gmail.com
|
||||
E: jj@chaosbits.net
|
||||
D: Various fixes, cleanups and minor features all over the tree.
|
||||
D: Wrote initial version of the hdaps driver (since passed on to others).
|
||||
S: Lemnosvej 1, 3.tv
|
||||
@@ -2119,6 +2124,11 @@ N: H.J. Lu
|
||||
E: hjl@gnu.ai.mit.edu
|
||||
D: GCC + libraries hacker
|
||||
|
||||
N: Yanir Lubetkin
|
||||
E: yanirx.lubatkin@intel.com
|
||||
E: linux-wimax@intel.com
|
||||
D: Intel Wireless WiMAX Connection 2400 driver
|
||||
|
||||
N: Michal Ludvig
|
||||
E: michal@logix.cz
|
||||
E: michal.ludvig@asterisk.co.nz
|
||||
@@ -2693,6 +2703,13 @@ S: RR #5, 497 Pole Line Road
|
||||
S: Thunder Bay, Ontario
|
||||
S: CANADA P7C 5M9
|
||||
|
||||
N: Inaky Perez-Gonzalez
|
||||
E: inaky.perez-gonzalez@intel.com
|
||||
E: linux-wimax@intel.com
|
||||
E: inakypg@yahoo.com
|
||||
D: WiMAX stack
|
||||
D: Intel Wireless WiMAX Connection 2400 driver
|
||||
|
||||
N: Yuri Per
|
||||
E: yuri@pts.mipt.ru
|
||||
D: Some smbfs fixes
|
||||
@@ -3769,14 +3786,11 @@ S: The Netherlands
|
||||
|
||||
N: David Woodhouse
|
||||
E: dwmw2@infradead.org
|
||||
D: ARCnet stuff, Applicom board driver, SO_BINDTODEVICE,
|
||||
D: some Alpha platform porting from 2.0, Memory Technology Devices,
|
||||
D: Acquire watchdog timer, PC speaker driver maintenance,
|
||||
D: JFFS2 file system, Memory Technology Device subsystem,
|
||||
D: various other stuff that annoyed me by not working.
|
||||
S: c/o Red Hat Engineering
|
||||
S: Rustat House
|
||||
S: 60 Clifton Road
|
||||
S: Cambridge. CB1 7EG
|
||||
S: c/o Intel Corporation
|
||||
S: Pipers Way
|
||||
S: Swindon. SN3 1RJ
|
||||
S: England
|
||||
|
||||
N: Chris Wright
|
||||
|
||||
@@ -3,8 +3,9 @@ Date: April 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
state. This holds the regulator output state.
|
||||
Some regulator directories will contain a field called
|
||||
state. This reports the regulator enable status, for
|
||||
regulators which can report that value.
|
||||
|
||||
This will be one of the following strings:
|
||||
|
||||
@@ -18,7 +19,8 @@ Description:
|
||||
'disabled' means the regulator output is OFF and is not
|
||||
supplying power to the system..
|
||||
|
||||
'unknown' means software cannot determine the state.
|
||||
'unknown' means software cannot determine the state, or
|
||||
the reported state is invalid.
|
||||
|
||||
NOTE: this field can be used in conjunction with microvolts
|
||||
and microamps to determine regulator output levels.
|
||||
@@ -53,9 +55,10 @@ Date: April 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
microvolts. This holds the regulator output voltage setting
|
||||
measured in microvolts (i.e. E-6 Volts).
|
||||
measured in microvolts (i.e. E-6 Volts), for regulators
|
||||
which can report that voltage.
|
||||
|
||||
NOTE: This value should not be used to determine the regulator
|
||||
output voltage level as this value is the same regardless of
|
||||
@@ -67,9 +70,10 @@ Date: April 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
microamps. This holds the regulator output current limit
|
||||
setting measured in microamps (i.e. E-6 Amps).
|
||||
setting measured in microamps (i.e. E-6 Amps), for regulators
|
||||
which can report that current.
|
||||
|
||||
NOTE: This value should not be used to determine the regulator
|
||||
output current level as this value is the same regardless of
|
||||
@@ -81,8 +85,9 @@ Date: April 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
opmode. This holds the regulator operating mode setting.
|
||||
Some regulator directories will contain a field called
|
||||
opmode. This holds the current regulator operating mode,
|
||||
for regulators which can report it.
|
||||
|
||||
The opmode value can be one of the following strings:
|
||||
|
||||
@@ -92,7 +97,7 @@ Description:
|
||||
'standby'
|
||||
'unknown'
|
||||
|
||||
The modes are described in include/linux/regulator/regulator.h
|
||||
The modes are described in include/linux/regulator/consumer.h
|
||||
|
||||
NOTE: This value should not be used to determine the regulator
|
||||
output operating mode as this value is the same regardless of
|
||||
@@ -104,9 +109,10 @@ Date: April 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
min_microvolts. This holds the minimum safe working regulator
|
||||
output voltage setting for this domain measured in microvolts.
|
||||
output voltage setting for this domain measured in microvolts,
|
||||
for regulators which support voltage constraints.
|
||||
|
||||
NOTE: this will return the string 'constraint not defined' if
|
||||
the power domain has no min microvolts constraint defined by
|
||||
@@ -118,9 +124,10 @@ Date: April 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
max_microvolts. This holds the maximum safe working regulator
|
||||
output voltage setting for this domain measured in microvolts.
|
||||
output voltage setting for this domain measured in microvolts,
|
||||
for regulators which support voltage constraints.
|
||||
|
||||
NOTE: this will return the string 'constraint not defined' if
|
||||
the power domain has no max microvolts constraint defined by
|
||||
@@ -132,10 +139,10 @@ Date: April 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
min_microamps. This holds the minimum safe working regulator
|
||||
output current limit setting for this domain measured in
|
||||
microamps.
|
||||
microamps, for regulators which support current constraints.
|
||||
|
||||
NOTE: this will return the string 'constraint not defined' if
|
||||
the power domain has no min microamps constraint defined by
|
||||
@@ -147,10 +154,10 @@ Date: April 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
max_microamps. This holds the maximum safe working regulator
|
||||
output current limit setting for this domain measured in
|
||||
microamps.
|
||||
microamps, for regulators which support current constraints.
|
||||
|
||||
NOTE: this will return the string 'constraint not defined' if
|
||||
the power domain has no max microamps constraint defined by
|
||||
@@ -185,7 +192,7 @@ Date: April 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
requested_microamps. This holds the total requested load
|
||||
current in microamps for this regulator from all its consumer
|
||||
devices.
|
||||
@@ -204,125 +211,102 @@ Date: May 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
suspend_mem_microvolts. This holds the regulator output
|
||||
voltage setting for this domain measured in microvolts when
|
||||
the system is suspended to memory.
|
||||
|
||||
NOTE: this will return the string 'not defined' if
|
||||
the power domain has no suspend to memory voltage defined by
|
||||
platform code.
|
||||
the system is suspended to memory, for voltage regulators
|
||||
implementing suspend voltage configuration constraints.
|
||||
|
||||
What: /sys/class/regulator/.../suspend_disk_microvolts
|
||||
Date: May 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
suspend_disk_microvolts. This holds the regulator output
|
||||
voltage setting for this domain measured in microvolts when
|
||||
the system is suspended to disk.
|
||||
|
||||
NOTE: this will return the string 'not defined' if
|
||||
the power domain has no suspend to disk voltage defined by
|
||||
platform code.
|
||||
the system is suspended to disk, for voltage regulators
|
||||
implementing suspend voltage configuration constraints.
|
||||
|
||||
What: /sys/class/regulator/.../suspend_standby_microvolts
|
||||
Date: May 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
suspend_standby_microvolts. This holds the regulator output
|
||||
voltage setting for this domain measured in microvolts when
|
||||
the system is suspended to standby.
|
||||
|
||||
NOTE: this will return the string 'not defined' if
|
||||
the power domain has no suspend to standby voltage defined by
|
||||
platform code.
|
||||
the system is suspended to standby, for voltage regulators
|
||||
implementing suspend voltage configuration constraints.
|
||||
|
||||
What: /sys/class/regulator/.../suspend_mem_mode
|
||||
Date: May 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
suspend_mem_mode. This holds the regulator operating mode
|
||||
setting for this domain when the system is suspended to
|
||||
memory.
|
||||
|
||||
NOTE: this will return the string 'not defined' if
|
||||
the power domain has no suspend to memory mode defined by
|
||||
platform code.
|
||||
memory, for regulators implementing suspend mode
|
||||
configuration constraints.
|
||||
|
||||
What: /sys/class/regulator/.../suspend_disk_mode
|
||||
Date: May 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
suspend_disk_mode. This holds the regulator operating mode
|
||||
setting for this domain when the system is suspended to disk.
|
||||
|
||||
NOTE: this will return the string 'not defined' if
|
||||
the power domain has no suspend to disk mode defined by
|
||||
platform code.
|
||||
setting for this domain when the system is suspended to disk,
|
||||
for regulators implementing suspend mode configuration
|
||||
constraints.
|
||||
|
||||
What: /sys/class/regulator/.../suspend_standby_mode
|
||||
Date: May 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
suspend_standby_mode. This holds the regulator operating mode
|
||||
setting for this domain when the system is suspended to
|
||||
standby.
|
||||
|
||||
NOTE: this will return the string 'not defined' if
|
||||
the power domain has no suspend to standby mode defined by
|
||||
platform code.
|
||||
standby, for regulators implementing suspend mode
|
||||
configuration constraints.
|
||||
|
||||
What: /sys/class/regulator/.../suspend_mem_state
|
||||
Date: May 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
suspend_mem_state. This holds the regulator operating state
|
||||
when suspended to memory.
|
||||
when suspended to memory, for regulators implementing suspend
|
||||
configuration constraints.
|
||||
|
||||
This will be one of the following strings:
|
||||
|
||||
'enabled'
|
||||
'disabled'
|
||||
'not defined'
|
||||
This will be one of the same strings reported by
|
||||
the "state" attribute.
|
||||
|
||||
What: /sys/class/regulator/.../suspend_disk_state
|
||||
Date: May 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
suspend_disk_state. This holds the regulator operating state
|
||||
when suspended to disk.
|
||||
when suspended to disk, for regulators implementing
|
||||
suspend configuration constraints.
|
||||
|
||||
This will be one of the following strings:
|
||||
|
||||
'enabled'
|
||||
'disabled'
|
||||
'not defined'
|
||||
This will be one of the same strings reported by
|
||||
the "state" attribute.
|
||||
|
||||
What: /sys/class/regulator/.../suspend_standby_state
|
||||
Date: May 2008
|
||||
KernelVersion: 2.6.26
|
||||
Contact: Liam Girdwood <lrg@slimlogic.co.uk>
|
||||
Description:
|
||||
Each regulator directory will contain a field called
|
||||
Some regulator directories will contain a field called
|
||||
suspend_standby_state. This holds the regulator operating
|
||||
state when suspended to standby.
|
||||
state when suspended to standby, for regulators implementing
|
||||
suspend configuration constraints.
|
||||
|
||||
This will be one of the following strings:
|
||||
|
||||
'enabled'
|
||||
'disabled'
|
||||
'not defined'
|
||||
This will be one of the same strings reported by
|
||||
the "state" attribute.
|
||||
|
||||
@@ -32,14 +32,16 @@ Contact: linux-usb@vger.kernel.org
|
||||
Description:
|
||||
Write:
|
||||
|
||||
<channel> [<bpst offset>]
|
||||
<channel>
|
||||
|
||||
to start beaconing on a specific channel, or stop
|
||||
beaconing if <channel> is -1. Valid channels depends
|
||||
on the radio controller's supported band groups.
|
||||
to force a specific channel to be used when beaconing,
|
||||
or, if <channel> is -1, to prohibit beaconing. If
|
||||
<channel> is 0, then the default channel selection
|
||||
algorithm will be used. Valid channels depends on the
|
||||
radio controller's supported band groups.
|
||||
|
||||
<bpst offset> may be used to try and join a specific
|
||||
beacon group if more than one was found during a scan.
|
||||
Reading returns the currently active channel, or -1 if
|
||||
the radio controller is not beaconing.
|
||||
|
||||
What: /sys/class/uwb_rc/uwbN/scan
|
||||
Date: July 2008
|
||||
|
||||
@@ -6,7 +6,6 @@ Description:
|
||||
internal state of the kernel memory blocks. Files could be
|
||||
added or removed dynamically to represent hot-add/remove
|
||||
operations.
|
||||
|
||||
Users: hotplug memory add/remove tools
|
||||
https://w3.opensource.ibm.com/projects/powerpc-utils/
|
||||
|
||||
@@ -19,6 +18,56 @@ Description:
|
||||
This is useful for a user-level agent to determine
|
||||
identify removable sections of the memory before attempting
|
||||
potentially expensive hot-remove memory operation
|
||||
|
||||
Users: hotplug memory remove tools
|
||||
https://w3.opensource.ibm.com/projects/powerpc-utils/
|
||||
|
||||
What: /sys/devices/system/memory/memoryX/phys_device
|
||||
Date: September 2008
|
||||
Contact: Badari Pulavarty <pbadari@us.ibm.com>
|
||||
Description:
|
||||
The file /sys/devices/system/memory/memoryX/phys_device
|
||||
is read-only and is designed to show the name of physical
|
||||
memory device. Implementation is currently incomplete.
|
||||
|
||||
What: /sys/devices/system/memory/memoryX/phys_index
|
||||
Date: September 2008
|
||||
Contact: Badari Pulavarty <pbadari@us.ibm.com>
|
||||
Description:
|
||||
The file /sys/devices/system/memory/memoryX/phys_index
|
||||
is read-only and contains the section ID in hexadecimal
|
||||
which is equivalent to decimal X contained in the
|
||||
memory section directory name.
|
||||
|
||||
What: /sys/devices/system/memory/memoryX/state
|
||||
Date: September 2008
|
||||
Contact: Badari Pulavarty <pbadari@us.ibm.com>
|
||||
Description:
|
||||
The file /sys/devices/system/memory/memoryX/state
|
||||
is read-write. When read, it's contents show the
|
||||
online/offline state of the memory section. When written,
|
||||
root can toggle the the online/offline state of a removable
|
||||
memory section (see removable file description above)
|
||||
using the following commands.
|
||||
# echo online > /sys/devices/system/memory/memoryX/state
|
||||
# echo offline > /sys/devices/system/memory/memoryX/state
|
||||
|
||||
For example, if /sys/devices/system/memory/memory22/removable
|
||||
contains a value of 1 and
|
||||
/sys/devices/system/memory/memory22/state contains the
|
||||
string "online" the following command can be executed by
|
||||
by root to offline that section.
|
||||
# echo offline > /sys/devices/system/memory/memory22/state
|
||||
Users: hotplug memory remove tools
|
||||
https://w3.opensource.ibm.com/projects/powerpc-utils/
|
||||
|
||||
What: /sys/devices/system/node/nodeX/memoryY
|
||||
Date: September 2008
|
||||
Contact: Gary Hade <garyhade@us.ibm.com>
|
||||
Description:
|
||||
When CONFIG_NUMA is enabled
|
||||
/sys/devices/system/node/nodeX/memoryY is a symbolic link that
|
||||
points to the corresponding /sys/devices/system/memory/memoryY
|
||||
memory section directory. For example, the following symbolic
|
||||
link is created for memory section 9 on node0.
|
||||
/sys/devices/system/node/node0/memory9 -> ../../memory/memory9
|
||||
|
||||
|
||||
@@ -33,10 +33,12 @@ o Gnu make 3.79.1 # make --version
|
||||
o binutils 2.12 # ld -v
|
||||
o util-linux 2.10o # fdformat --version
|
||||
o module-init-tools 0.9.10 # depmod -V
|
||||
o e2fsprogs 1.29 # tune2fs
|
||||
o e2fsprogs 1.41.4 # e2fsck -V
|
||||
o jfsutils 1.1.3 # fsck.jfs -V
|
||||
o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs
|
||||
o xfsprogs 2.6.0 # xfs_db -V
|
||||
o squashfs-tools 4.0 # mksquashfs -version
|
||||
o btrfs-progs 0.18 # btrfsck
|
||||
o pcmciautils 004 # pccardctl -V
|
||||
o quota-tools 3.09 # quota -V
|
||||
o PPP 2.4.0 # pppd --version
|
||||
|
||||
@@ -483,17 +483,25 @@ values. To do the latter, you can stick the following in your .emacs file:
|
||||
(* (max steps 1)
|
||||
c-basic-offset)))
|
||||
|
||||
(add-hook 'c-mode-common-hook
|
||||
(lambda ()
|
||||
;; Add kernel style
|
||||
(c-add-style
|
||||
"linux-tabs-only"
|
||||
'("linux" (c-offsets-alist
|
||||
(arglist-cont-nonempty
|
||||
c-lineup-gcc-asm-reg
|
||||
c-lineup-arglist-tabs-only))))))
|
||||
|
||||
(add-hook 'c-mode-hook
|
||||
(lambda ()
|
||||
(let ((filename (buffer-file-name)))
|
||||
;; Enable kernel mode for the appropriate files
|
||||
(when (and filename
|
||||
(string-match "~/src/linux-trees" filename))
|
||||
(string-match (expand-file-name "~/src/linux-trees")
|
||||
filename))
|
||||
(setq indent-tabs-mode t)
|
||||
(c-set-style "linux")
|
||||
(c-set-offset 'arglist-cont-nonempty
|
||||
'(c-lineup-gcc-asm-reg
|
||||
c-lineup-arglist-tabs-only))))))
|
||||
(c-set-style "linux-tabs-only")))))
|
||||
|
||||
This will make emacs go better with the kernel coding style for C
|
||||
files below ~/src/linux-trees.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This document describes the DMA API. For a more gentle introduction
|
||||
phrased in terms of the pci_ equivalents (and actual examples) see
|
||||
DMA-mapping.txt
|
||||
Documentation/PCI/PCI-DMA-mapping.txt.
|
||||
|
||||
This API is split into two pieces. Part I describes the API and the
|
||||
corresponding pci_ API. Part II describes the extensions to the API
|
||||
@@ -170,16 +170,15 @@ Returns: 0 if successful and a negative error if not.
|
||||
u64
|
||||
dma_get_required_mask(struct device *dev)
|
||||
|
||||
After setting the mask with dma_set_mask(), this API returns the
|
||||
actual mask (within that already set) that the platform actually
|
||||
requires to operate efficiently. Usually this means the returned mask
|
||||
This API returns the mask that the platform requires to
|
||||
operate efficiently. Usually this means the returned mask
|
||||
is the minimum required to cover all of memory. Examining the
|
||||
required mask gives drivers with variable descriptor sizes the
|
||||
opportunity to use smaller descriptors as necessary.
|
||||
|
||||
Requesting the required mask does not alter the current mask. If you
|
||||
wish to take advantage of it, you should issue another dma_set_mask()
|
||||
call to lower the mask again.
|
||||
wish to take advantage of it, you should issue a dma_set_mask()
|
||||
call to set the mask to the value returned.
|
||||
|
||||
|
||||
Part Id - Streaming DMA mappings
|
||||
|
||||
@@ -26,7 +26,7 @@ mapped only for the time they are actually used and unmapped after the DMA
|
||||
transfer.
|
||||
|
||||
The following API will work of course even on platforms where no such
|
||||
hardware exists, see e.g. include/asm-i386/pci.h for how it is implemented on
|
||||
hardware exists, see e.g. arch/x86/include/asm/pci.h for how it is implemented on
|
||||
top of the virt_to_bus interface.
|
||||
|
||||
First of all, you should make sure
|
||||
|
||||
@@ -12,7 +12,7 @@ DOCBOOKS := z8530book.xml mcabook.xml \
|
||||
kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
|
||||
gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
|
||||
genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
|
||||
mac80211.xml debugobjects.xml sh.xml
|
||||
mac80211.xml debugobjects.xml sh.xml regulator.xml
|
||||
|
||||
###
|
||||
# The build process is as follows (targets):
|
||||
|
||||
@@ -74,6 +74,14 @@
|
||||
!Enet/sunrpc/rpcb_clnt.c
|
||||
!Enet/sunrpc/clnt.c
|
||||
</sect1>
|
||||
<sect1><title>WiMAX</title>
|
||||
!Enet/wimax/op-msg.c
|
||||
!Enet/wimax/op-reset.c
|
||||
!Enet/wimax/op-rfkill.c
|
||||
!Enet/wimax/stack.c
|
||||
!Iinclude/net/wimax.h
|
||||
!Iinclude/linux/wimax.h
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
<chapter id="netdev">
|
||||
|
||||
304
Documentation/DocBook/regulator.tmpl
Normal file
304
Documentation/DocBook/regulator.tmpl
Normal file
@@ -0,0 +1,304 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
|
||||
|
||||
<book id="regulator-api">
|
||||
<bookinfo>
|
||||
<title>Voltage and current regulator API</title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Liam</firstname>
|
||||
<surname>Girdwood</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>lrg@slimlogic.co.uk</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Mark</firstname>
|
||||
<surname>Brown</surname>
|
||||
<affiliation>
|
||||
<orgname>Wolfson Microelectronics</orgname>
|
||||
<address>
|
||||
<email>broonie@opensource.wolfsonmicro.com</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<copyright>
|
||||
<year>2007-2008</year>
|
||||
<holder>Wolfson Microelectronics</holder>
|
||||
</copyright>
|
||||
<copyright>
|
||||
<year>2008</year>
|
||||
<holder>Liam Girdwood</holder>
|
||||
</copyright>
|
||||
|
||||
<legalnotice>
|
||||
<para>
|
||||
This documentation is free software; you can redistribute
|
||||
it and/or modify it under the terms of the GNU General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This program is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU General Public License for more details.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
MA 02111-1307 USA
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For more details see the file COPYING in the source
|
||||
distribution of Linux.
|
||||
</para>
|
||||
</legalnotice>
|
||||
</bookinfo>
|
||||
|
||||
<toc></toc>
|
||||
|
||||
<chapter id="intro">
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
This framework is designed to provide a standard kernel
|
||||
interface to control voltage and current regulators.
|
||||
</para>
|
||||
<para>
|
||||
The intention is to allow systems to dynamically control
|
||||
regulator power output in order to save power and prolong
|
||||
battery life. This applies to both voltage regulators (where
|
||||
voltage output is controllable) and current sinks (where current
|
||||
limit is controllable).
|
||||
</para>
|
||||
<para>
|
||||
Note that additional (and currently more complete) documentation
|
||||
is available in the Linux kernel source under
|
||||
<filename>Documentation/power/regulator</filename>.
|
||||
</para>
|
||||
|
||||
<sect1 id="glossary">
|
||||
<title>Glossary</title>
|
||||
<para>
|
||||
The regulator API uses a number of terms which may not be
|
||||
familiar:
|
||||
</para>
|
||||
<glossary>
|
||||
|
||||
<glossentry>
|
||||
<glossterm>Regulator</glossterm>
|
||||
<glossdef>
|
||||
<para>
|
||||
Electronic device that supplies power to other devices. Most
|
||||
regulators can enable and disable their output and some can also
|
||||
control their output voltage or current.
|
||||
</para>
|
||||
</glossdef>
|
||||
</glossentry>
|
||||
|
||||
<glossentry>
|
||||
<glossterm>Consumer</glossterm>
|
||||
<glossdef>
|
||||
<para>
|
||||
Electronic device which consumes power provided by a regulator.
|
||||
These may either be static, requiring only a fixed supply, or
|
||||
dynamic, requiring active management of the regulator at
|
||||
runtime.
|
||||
</para>
|
||||
</glossdef>
|
||||
</glossentry>
|
||||
|
||||
<glossentry>
|
||||
<glossterm>Power Domain</glossterm>
|
||||
<glossdef>
|
||||
<para>
|
||||
The electronic circuit supplied by a given regulator, including
|
||||
the regulator and all consumer devices. The configuration of
|
||||
the regulator is shared between all the components in the
|
||||
circuit.
|
||||
</para>
|
||||
</glossdef>
|
||||
</glossentry>
|
||||
|
||||
<glossentry>
|
||||
<glossterm>Power Management Integrated Circuit</glossterm>
|
||||
<acronym>PMIC</acronym>
|
||||
<glossdef>
|
||||
<para>
|
||||
An IC which contains numerous regulators and often also other
|
||||
subsystems. In an embedded system the primary PMIC is often
|
||||
equivalent to a combination of the PSU and southbridge in a
|
||||
desktop system.
|
||||
</para>
|
||||
</glossdef>
|
||||
</glossentry>
|
||||
</glossary>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
<chapter id="consumer">
|
||||
<title>Consumer driver interface</title>
|
||||
<para>
|
||||
This offers a similar API to the kernel clock framework.
|
||||
Consumer drivers use <link
|
||||
linkend='API-regulator-get'>get</link> and <link
|
||||
linkend='API-regulator-put'>put</link> operations to acquire and
|
||||
release regulators. Functions are
|
||||
provided to <link linkend='API-regulator-enable'>enable</link>
|
||||
and <link linkend='API-regulator-disable'>disable</link> the
|
||||
reguator and to get and set the runtime parameters of the
|
||||
regulator.
|
||||
</para>
|
||||
<para>
|
||||
When requesting regulators consumers use symbolic names for their
|
||||
supplies, such as "Vcc", which are mapped into actual regulator
|
||||
devices by the machine interface.
|
||||
</para>
|
||||
<para>
|
||||
A stub version of this API is provided when the regulator
|
||||
framework is not in use in order to minimise the need to use
|
||||
ifdefs.
|
||||
</para>
|
||||
|
||||
<sect1 id="consumer-enable">
|
||||
<title>Enabling and disabling</title>
|
||||
<para>
|
||||
The regulator API provides reference counted enabling and
|
||||
disabling of regulators. Consumer devices use the <function><link
|
||||
linkend='API-regulator-enable'>regulator_enable</link></function>
|
||||
and <function><link
|
||||
linkend='API-regulator-disable'>regulator_disable</link>
|
||||
</function> functions to enable and disable regulators. Calls
|
||||
to the two functions must be balanced.
|
||||
</para>
|
||||
<para>
|
||||
Note that since multiple consumers may be using a regulator and
|
||||
machine constraints may not allow the regulator to be disabled
|
||||
there is no guarantee that calling
|
||||
<function>regulator_disable</function> will actually cause the
|
||||
supply provided by the regulator to be disabled. Consumer
|
||||
drivers should assume that the regulator may be enabled at all
|
||||
times.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="consumer-config">
|
||||
<title>Configuration</title>
|
||||
<para>
|
||||
Some consumer devices may need to be able to dynamically
|
||||
configure their supplies. For example, MMC drivers may need to
|
||||
select the correct operating voltage for their cards. This may
|
||||
be done while the regulator is enabled or disabled.
|
||||
</para>
|
||||
<para>
|
||||
The <function><link
|
||||
linkend='API-regulator-set-voltage'>regulator_set_voltage</link>
|
||||
</function> and <function><link
|
||||
linkend='API-regulator-set-current-limit'
|
||||
>regulator_set_current_limit</link>
|
||||
</function> functions provide the primary interface for this.
|
||||
Both take ranges of voltages and currents, supporting drivers
|
||||
that do not require a specific value (eg, CPU frequency scaling
|
||||
normally permits the CPU to use a wider range of supply
|
||||
voltages at lower frequencies but does not require that the
|
||||
supply voltage be lowered). Where an exact value is required
|
||||
both minimum and maximum values should be identical.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="consumer-callback">
|
||||
<title>Callbacks</title>
|
||||
<para>
|
||||
Callbacks may also be <link
|
||||
linkend='API-regulator-register-notifier'>registered</link>
|
||||
for events such as regulation failures.
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
<chapter id="driver">
|
||||
<title>Regulator driver interface</title>
|
||||
<para>
|
||||
Drivers for regulator chips <link
|
||||
linkend='API-regulator-register'>register</link> the regulators
|
||||
with the regulator core, providing operations structures to the
|
||||
core. A <link
|
||||
linkend='API-regulator-notifier-call-chain'>notifier</link> interface
|
||||
allows error conditions to be reported to the core.
|
||||
</para>
|
||||
<para>
|
||||
Registration should be triggered by explicit setup done by the
|
||||
platform, supplying a <link
|
||||
linkend='API-struct-regulator-init-data'>struct
|
||||
regulator_init_data</link> for the regulator containing
|
||||
<link linkend='machine-constraint'>constraint</link> and
|
||||
<link linkend='machine-supply'>supply</link> information.
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
<chapter id="machine">
|
||||
<title>Machine interface</title>
|
||||
<para>
|
||||
This interface provides a way to define how regulators are
|
||||
connected to consumers on a given system and what the valid
|
||||
operating parameters are for the system.
|
||||
</para>
|
||||
|
||||
<sect1 id="machine-supply">
|
||||
<title>Supplies</title>
|
||||
<para>
|
||||
Regulator supplies are specified using <link
|
||||
linkend='API-struct-regulator-consumer-supply'>struct
|
||||
regulator_consumer_supply</link>. This is done at
|
||||
<link linkend='driver'>driver registration
|
||||
time</link> as part of the machine constraints.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="machine-constraint">
|
||||
<title>Constraints</title>
|
||||
<para>
|
||||
As well as definining the connections the machine interface
|
||||
also provides constraints definining the operations that
|
||||
clients are allowed to perform and the parameters that may be
|
||||
set. This is required since generally regulator devices will
|
||||
offer more flexibility than it is safe to use on a given
|
||||
system, for example supporting higher supply voltages than the
|
||||
consumers are rated for.
|
||||
</para>
|
||||
<para>
|
||||
This is done at <link linkend='driver'>driver
|
||||
registration time</link> by providing a <link
|
||||
linkend='API-struct-regulation-constraints'>struct
|
||||
regulation_constraints</link>.
|
||||
</para>
|
||||
<para>
|
||||
The constraints may also specify an initial configuration for the
|
||||
regulator in the constraints, which is particularly useful for
|
||||
use with static consumers.
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
<chapter id="api">
|
||||
<title>API reference</title>
|
||||
<para>
|
||||
Due to limitations of the kernel documentation framework and the
|
||||
existing layout of the source code the entire regulator API is
|
||||
documented here.
|
||||
</para>
|
||||
!Iinclude/linux/regulator/consumer.h
|
||||
!Iinclude/linux/regulator/machine.h
|
||||
!Iinclude/linux/regulator/driver.h
|
||||
!Edrivers/regulator/core.c
|
||||
</chapter>
|
||||
</book>
|
||||
@@ -41,6 +41,18 @@ GPL version 2.
|
||||
</abstract>
|
||||
|
||||
<revhistory>
|
||||
<revision>
|
||||
<revnumber>0.7</revnumber>
|
||||
<date>2008-12-23</date>
|
||||
<authorinitials>hjk</authorinitials>
|
||||
<revremark>Added generic platform drivers and offset attribute.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>0.6</revnumber>
|
||||
<date>2008-12-05</date>
|
||||
<authorinitials>hjk</authorinitials>
|
||||
<revremark>Added description of portio sysfs attributes.</revremark>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>0.5</revnumber>
|
||||
<date>2008-05-22</date>
|
||||
@@ -306,6 +318,16 @@ interested in translating it, please email me
|
||||
pointed to by addr.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<filename>offset</filename>: The offset, in bytes, that has to be
|
||||
added to the pointer returned by <function>mmap()</function> to get
|
||||
to the actual device memory. This is important if the device's memory
|
||||
is not page aligned. Remember that pointers returned by
|
||||
<function>mmap()</function> are always page aligned, so it is good
|
||||
style to always add this offset.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
@@ -318,6 +340,54 @@ interested in translating it, please email me
|
||||
offset = N * getpagesize();
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
Sometimes there is hardware with memory-like regions that can not be
|
||||
mapped with the technique described here, but there are still ways to
|
||||
access them from userspace. The most common example are x86 ioports.
|
||||
On x86 systems, userspace can access these ioports using
|
||||
<function>ioperm()</function>, <function>iopl()</function>,
|
||||
<function>inb()</function>, <function>outb()</function>, and similar
|
||||
functions.
|
||||
</para>
|
||||
<para>
|
||||
Since these ioport regions can not be mapped, they will not appear under
|
||||
<filename>/sys/class/uio/uioX/maps/</filename> like the normal memory
|
||||
described above. Without information about the port regions a hardware
|
||||
has to offer, it becomes difficult for the userspace part of the
|
||||
driver to find out which ports belong to which UIO device.
|
||||
</para>
|
||||
<para>
|
||||
To address this situation, the new directory
|
||||
<filename>/sys/class/uio/uioX/portio/</filename> was added. It only
|
||||
exists if the driver wants to pass information about one or more port
|
||||
regions to userspace. If that is the case, subdirectories named
|
||||
<filename>port0</filename>, <filename>port1</filename>, and so on,
|
||||
will appear underneath
|
||||
<filename>/sys/class/uio/uioX/portio/</filename>.
|
||||
</para>
|
||||
<para>
|
||||
Each <filename>portX/</filename> directory contains three read-only
|
||||
files that show start, size, and type of the port region:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<filename>start</filename>: The first port of this region.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<filename>size</filename>: The number of ports in this region.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<filename>porttype</filename>: A string describing the type of port.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
@@ -339,12 +409,12 @@ offset = N * getpagesize();
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<varname>char *name</varname>: Required. The name of your driver as
|
||||
<varname>const char *name</varname>: Required. The name of your driver as
|
||||
it will appear in sysfs. I recommend using the name of your module for this.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
<varname>char *version</varname>: Required. This string appears in
|
||||
<varname>const char *version</varname>: Required. This string appears in
|
||||
<filename>/sys/class/uio/uioX/version</filename>.
|
||||
</para></listitem>
|
||||
|
||||
@@ -355,6 +425,13 @@ mapping you need to fill one of the <varname>uio_mem</varname> structures.
|
||||
See the description below for details.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
<varname>struct uio_port port[ MAX_UIO_PORTS_REGIONS ]</varname>: Required
|
||||
if you want to pass information about ioports to userspace. For each port
|
||||
region you need to fill one of the <varname>uio_port</varname> structures.
|
||||
See the description below for details.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
<varname>long irq</varname>: Required. If your hardware generates an
|
||||
interrupt, it's your modules task to determine the irq number during
|
||||
@@ -448,6 +525,42 @@ Please do not touch the <varname>kobj</varname> element of
|
||||
<varname>struct uio_mem</varname>! It is used by the UIO framework
|
||||
to set up sysfs files for this mapping. Simply leave it alone.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Sometimes, your device can have one or more port regions which can not be
|
||||
mapped to userspace. But if there are other possibilities for userspace to
|
||||
access these ports, it makes sense to make information about the ports
|
||||
available in sysfs. For each region, you have to set up a
|
||||
<varname>struct uio_port</varname> in the <varname>port[]</varname> array.
|
||||
Here's a description of the fields of <varname>struct uio_port</varname>:
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<varname>char *porttype</varname>: Required. Set this to one of the predefined
|
||||
constants. Use <varname>UIO_PORT_X86</varname> for the ioports found in x86
|
||||
architectures.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
<varname>unsigned long start</varname>: Required if the port region is used.
|
||||
Fill in the number of the first port of this region.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
<varname>unsigned long size</varname>: Fill in the number of ports in this
|
||||
region. If <varname>size</varname> is zero, the region is considered unused.
|
||||
Note that you <emphasis>must</emphasis> initialize <varname>size</varname>
|
||||
with zero for all unused regions.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
Please do not touch the <varname>portio</varname> element of
|
||||
<varname>struct uio_port</varname>! It is used internally by the UIO
|
||||
framework to set up sysfs files for this region. Simply leave it alone.
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="adding_irq_handler">
|
||||
@@ -497,6 +610,78 @@ to set up sysfs files for this mapping. Simply leave it alone.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="using_uio_pdrv">
|
||||
<title>Using uio_pdrv for platform devices</title>
|
||||
<para>
|
||||
In many cases, UIO drivers for platform devices can be handled in a
|
||||
generic way. In the same place where you define your
|
||||
<varname>struct platform_device</varname>, you simply also implement
|
||||
your interrupt handler and fill your
|
||||
<varname>struct uio_info</varname>. A pointer to this
|
||||
<varname>struct uio_info</varname> is then used as
|
||||
<varname>platform_data</varname> for your platform device.
|
||||
</para>
|
||||
<para>
|
||||
You also need to set up an array of <varname>struct resource</varname>
|
||||
containing addresses and sizes of your memory mappings. This
|
||||
information is passed to the driver using the
|
||||
<varname>.resource</varname> and <varname>.num_resources</varname>
|
||||
elements of <varname>struct platform_device</varname>.
|
||||
</para>
|
||||
<para>
|
||||
You now have to set the <varname>.name</varname> element of
|
||||
<varname>struct platform_device</varname> to
|
||||
<varname>"uio_pdrv"</varname> to use the generic UIO platform device
|
||||
driver. This driver will fill the <varname>mem[]</varname> array
|
||||
according to the resources given, and register the device.
|
||||
</para>
|
||||
<para>
|
||||
The advantage of this approach is that you only have to edit a file
|
||||
you need to edit anyway. You do not have to create an extra driver.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="using_uio_pdrv_genirq">
|
||||
<title>Using uio_pdrv_genirq for platform devices</title>
|
||||
<para>
|
||||
Especially in embedded devices, you frequently find chips where the
|
||||
irq pin is tied to its own dedicated interrupt line. In such cases,
|
||||
where you can be really sure the interrupt is not shared, we can take
|
||||
the concept of <varname>uio_pdrv</varname> one step further and use a
|
||||
generic interrupt handler. That's what
|
||||
<varname>uio_pdrv_genirq</varname> does.
|
||||
</para>
|
||||
<para>
|
||||
The setup for this driver is the same as described above for
|
||||
<varname>uio_pdrv</varname>, except that you do not implement an
|
||||
interrupt handler. The <varname>.handler</varname> element of
|
||||
<varname>struct uio_info</varname> must remain
|
||||
<varname>NULL</varname>. The <varname>.irq_flags</varname> element
|
||||
must not contain <varname>IRQF_SHARED</varname>.
|
||||
</para>
|
||||
<para>
|
||||
You will set the <varname>.name</varname> element of
|
||||
<varname>struct platform_device</varname> to
|
||||
<varname>"uio_pdrv_genirq"</varname> to use this driver.
|
||||
</para>
|
||||
<para>
|
||||
The generic interrupt handler of <varname>uio_pdrv_genirq</varname>
|
||||
will simply disable the interrupt line using
|
||||
<function>disable_irq_nosync()</function>. After doing its work,
|
||||
userspace can reenable the interrupt by writing 0x00000001 to the UIO
|
||||
device file. The driver already implements an
|
||||
<function>irq_control()</function> to make this possible, you must not
|
||||
implement your own.
|
||||
</para>
|
||||
<para>
|
||||
Using <varname>uio_pdrv_genirq</varname> not only saves a few lines of
|
||||
interrupt handler code. You also do not need to know anything about
|
||||
the chip's internal registers to create the kernel part of the driver.
|
||||
All you need to know is the irq number of the pin the chip is
|
||||
connected to.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
</chapter>
|
||||
|
||||
<chapter id="userspace_driver" xreflabel="Writing a driver in user space">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[ NOTE: The virt_to_bus() and bus_to_virt() functions have been
|
||||
superseded by the functionality provided by the PCI DMA
|
||||
interface (see Documentation/DMA-mapping.txt). They continue
|
||||
superseded by the functionality provided by the PCI DMA interface
|
||||
(see Documentation/PCI/PCI-DMA-mapping.txt). They continue
|
||||
to be documented below for historical purposes, but new code
|
||||
must not use them. --davidm 00/12/12 ]
|
||||
|
||||
|
||||
@@ -294,7 +294,8 @@ NOTE: pci_enable_device() can fail! Check the return value.
|
||||
|
||||
pci_set_master() will enable DMA by setting the bus master bit
|
||||
in the PCI_COMMAND register. It also fixes the latency timer value if
|
||||
it's set to something bogus by the BIOS.
|
||||
it's set to something bogus by the BIOS. pci_clear_master() will
|
||||
disable DMA by clearing the bus master bit.
|
||||
|
||||
If the PCI device can use the PCI Memory-Write-Invalidate transaction,
|
||||
call pci_set_mwi(). This enables the PCI_COMMAND bit for Mem-Wr-Inval
|
||||
|
||||
@@ -12,6 +12,8 @@ rcuref.txt
|
||||
- Reference-count design for elements of lists/arrays protected by RCU
|
||||
rcu.txt
|
||||
- RCU Concepts
|
||||
rcubarrier.txt
|
||||
- Unloading modules that use RCU callbacks
|
||||
RTFP.txt
|
||||
- List of RCU papers (bibliography) going back to 1980.
|
||||
torture.txt
|
||||
|
||||
304
Documentation/RCU/rcubarrier.txt
Normal file
304
Documentation/RCU/rcubarrier.txt
Normal file
@@ -0,0 +1,304 @@
|
||||
RCU and Unloadable Modules
|
||||
|
||||
[Originally published in LWN Jan. 14, 2007: http://lwn.net/Articles/217484/]
|
||||
|
||||
RCU (read-copy update) is a synchronization mechanism that can be thought
|
||||
of as a replacement for read-writer locking (among other things), but with
|
||||
very low-overhead readers that are immune to deadlock, priority inversion,
|
||||
and unbounded latency. RCU read-side critical sections are delimited
|
||||
by rcu_read_lock() and rcu_read_unlock(), which, in non-CONFIG_PREEMPT
|
||||
kernels, generate no code whatsoever.
|
||||
|
||||
This means that RCU writers are unaware of the presence of concurrent
|
||||
readers, so that RCU updates to shared data must be undertaken quite
|
||||
carefully, leaving an old version of the data structure in place until all
|
||||
pre-existing readers have finished. These old versions are needed because
|
||||
such readers might hold a reference to them. RCU updates can therefore be
|
||||
rather expensive, and RCU is thus best suited for read-mostly situations.
|
||||
|
||||
How can an RCU writer possibly determine when all readers are finished,
|
||||
given that readers might well leave absolutely no trace of their
|
||||
presence? There is a synchronize_rcu() primitive that blocks until all
|
||||
pre-existing readers have completed. An updater wishing to delete an
|
||||
element p from a linked list might do the following, while holding an
|
||||
appropriate lock, of course:
|
||||
|
||||
list_del_rcu(p);
|
||||
synchronize_rcu();
|
||||
kfree(p);
|
||||
|
||||
But the above code cannot be used in IRQ context -- the call_rcu()
|
||||
primitive must be used instead. This primitive takes a pointer to an
|
||||
rcu_head struct placed within the RCU-protected data structure and
|
||||
another pointer to a function that may be invoked later to free that
|
||||
structure. Code to delete an element p from the linked list from IRQ
|
||||
context might then be as follows:
|
||||
|
||||
list_del_rcu(p);
|
||||
call_rcu(&p->rcu, p_callback);
|
||||
|
||||
Since call_rcu() never blocks, this code can safely be used from within
|
||||
IRQ context. The function p_callback() might be defined as follows:
|
||||
|
||||
static void p_callback(struct rcu_head *rp)
|
||||
{
|
||||
struct pstruct *p = container_of(rp, struct pstruct, rcu);
|
||||
|
||||
kfree(p);
|
||||
}
|
||||
|
||||
|
||||
Unloading Modules That Use call_rcu()
|
||||
|
||||
But what if p_callback is defined in an unloadable module?
|
||||
|
||||
If we unload the module while some RCU callbacks are pending,
|
||||
the CPUs executing these callbacks are going to be severely
|
||||
disappointed when they are later invoked, as fancifully depicted at
|
||||
http://lwn.net/images/ns/kernel/rcu-drop.jpg.
|
||||
|
||||
We could try placing a synchronize_rcu() in the module-exit code path,
|
||||
but this is not sufficient. Although synchronize_rcu() does wait for a
|
||||
grace period to elapse, it does not wait for the callbacks to complete.
|
||||
|
||||
One might be tempted to try several back-to-back synchronize_rcu()
|
||||
calls, but this is still not guaranteed to work. If there is a very
|
||||
heavy RCU-callback load, then some of the callbacks might be deferred
|
||||
in order to allow other processing to proceed. Such deferral is required
|
||||
in realtime kernels in order to avoid excessive scheduling latencies.
|
||||
|
||||
|
||||
rcu_barrier()
|
||||
|
||||
We instead need the rcu_barrier() primitive. This primitive is similar
|
||||
to synchronize_rcu(), but instead of waiting solely for a grace
|
||||
period to elapse, it also waits for all outstanding RCU callbacks to
|
||||
complete. Pseudo-code using rcu_barrier() is as follows:
|
||||
|
||||
1. Prevent any new RCU callbacks from being posted.
|
||||
2. Execute rcu_barrier().
|
||||
3. Allow the module to be unloaded.
|
||||
|
||||
Quick Quiz #1: Why is there no srcu_barrier()?
|
||||
|
||||
The rcutorture module makes use of rcu_barrier in its exit function
|
||||
as follows:
|
||||
|
||||
1 static void
|
||||
2 rcu_torture_cleanup(void)
|
||||
3 {
|
||||
4 int i;
|
||||
5
|
||||
6 fullstop = 1;
|
||||
7 if (shuffler_task != NULL) {
|
||||
8 VERBOSE_PRINTK_STRING("Stopping rcu_torture_shuffle task");
|
||||
9 kthread_stop(shuffler_task);
|
||||
10 }
|
||||
11 shuffler_task = NULL;
|
||||
12
|
||||
13 if (writer_task != NULL) {
|
||||
14 VERBOSE_PRINTK_STRING("Stopping rcu_torture_writer task");
|
||||
15 kthread_stop(writer_task);
|
||||
16 }
|
||||
17 writer_task = NULL;
|
||||
18
|
||||
19 if (reader_tasks != NULL) {
|
||||
20 for (i = 0; i < nrealreaders; i++) {
|
||||
21 if (reader_tasks[i] != NULL) {
|
||||
22 VERBOSE_PRINTK_STRING(
|
||||
23 "Stopping rcu_torture_reader task");
|
||||
24 kthread_stop(reader_tasks[i]);
|
||||
25 }
|
||||
26 reader_tasks[i] = NULL;
|
||||
27 }
|
||||
28 kfree(reader_tasks);
|
||||
29 reader_tasks = NULL;
|
||||
30 }
|
||||
31 rcu_torture_current = NULL;
|
||||
32
|
||||
33 if (fakewriter_tasks != NULL) {
|
||||
34 for (i = 0; i < nfakewriters; i++) {
|
||||
35 if (fakewriter_tasks[i] != NULL) {
|
||||
36 VERBOSE_PRINTK_STRING(
|
||||
37 "Stopping rcu_torture_fakewriter task");
|
||||
38 kthread_stop(fakewriter_tasks[i]);
|
||||
39 }
|
||||
40 fakewriter_tasks[i] = NULL;
|
||||
41 }
|
||||
42 kfree(fakewriter_tasks);
|
||||
43 fakewriter_tasks = NULL;
|
||||
44 }
|
||||
45
|
||||
46 if (stats_task != NULL) {
|
||||
47 VERBOSE_PRINTK_STRING("Stopping rcu_torture_stats task");
|
||||
48 kthread_stop(stats_task);
|
||||
49 }
|
||||
50 stats_task = NULL;
|
||||
51
|
||||
52 /* Wait for all RCU callbacks to fire. */
|
||||
53 rcu_barrier();
|
||||
54
|
||||
55 rcu_torture_stats_print(); /* -After- the stats thread is stopped! */
|
||||
56
|
||||
57 if (cur_ops->cleanup != NULL)
|
||||
58 cur_ops->cleanup();
|
||||
59 if (atomic_read(&n_rcu_torture_error))
|
||||
60 rcu_torture_print_module_parms("End of test: FAILURE");
|
||||
61 else
|
||||
62 rcu_torture_print_module_parms("End of test: SUCCESS");
|
||||
63 }
|
||||
|
||||
Line 6 sets a global variable that prevents any RCU callbacks from
|
||||
re-posting themselves. This will not be necessary in most cases, since
|
||||
RCU callbacks rarely include calls to call_rcu(). However, the rcutorture
|
||||
module is an exception to this rule, and therefore needs to set this
|
||||
global variable.
|
||||
|
||||
Lines 7-50 stop all the kernel tasks associated with the rcutorture
|
||||
module. Therefore, once execution reaches line 53, no more rcutorture
|
||||
RCU callbacks will be posted. The rcu_barrier() call on line 53 waits
|
||||
for any pre-existing callbacks to complete.
|
||||
|
||||
Then lines 55-62 print status and do operation-specific cleanup, and
|
||||
then return, permitting the module-unload operation to be completed.
|
||||
|
||||
Quick Quiz #2: Is there any other situation where rcu_barrier() might
|
||||
be required?
|
||||
|
||||
Your module might have additional complications. For example, if your
|
||||
module invokes call_rcu() from timers, you will need to first cancel all
|
||||
the timers, and only then invoke rcu_barrier() to wait for any remaining
|
||||
RCU callbacks to complete.
|
||||
|
||||
|
||||
Implementing rcu_barrier()
|
||||
|
||||
Dipankar Sarma's implementation of rcu_barrier() makes use of the fact
|
||||
that RCU callbacks are never reordered once queued on one of the per-CPU
|
||||
queues. His implementation queues an RCU callback on each of the per-CPU
|
||||
callback queues, and then waits until they have all started executing, at
|
||||
which point, all earlier RCU callbacks are guaranteed to have completed.
|
||||
|
||||
The original code for rcu_barrier() was as follows:
|
||||
|
||||
1 void rcu_barrier(void)
|
||||
2 {
|
||||
3 BUG_ON(in_interrupt());
|
||||
4 /* Take cpucontrol mutex to protect against CPU hotplug */
|
||||
5 mutex_lock(&rcu_barrier_mutex);
|
||||
6 init_completion(&rcu_barrier_completion);
|
||||
7 atomic_set(&rcu_barrier_cpu_count, 0);
|
||||
8 on_each_cpu(rcu_barrier_func, NULL, 0, 1);
|
||||
9 wait_for_completion(&rcu_barrier_completion);
|
||||
10 mutex_unlock(&rcu_barrier_mutex);
|
||||
11 }
|
||||
|
||||
Line 3 verifies that the caller is in process context, and lines 5 and 10
|
||||
use rcu_barrier_mutex to ensure that only one rcu_barrier() is using the
|
||||
global completion and counters at a time, which are initialized on lines
|
||||
6 and 7. Line 8 causes each CPU to invoke rcu_barrier_func(), which is
|
||||
shown below. Note that the final "1" in on_each_cpu()'s argument list
|
||||
ensures that all the calls to rcu_barrier_func() will have completed
|
||||
before on_each_cpu() returns. Line 9 then waits for the completion.
|
||||
|
||||
This code was rewritten in 2008 to support rcu_barrier_bh() and
|
||||
rcu_barrier_sched() in addition to the original rcu_barrier().
|
||||
|
||||
The rcu_barrier_func() runs on each CPU, where it invokes call_rcu()
|
||||
to post an RCU callback, as follows:
|
||||
|
||||
1 static void rcu_barrier_func(void *notused)
|
||||
2 {
|
||||
3 int cpu = smp_processor_id();
|
||||
4 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
|
||||
5 struct rcu_head *head;
|
||||
6
|
||||
7 head = &rdp->barrier;
|
||||
8 atomic_inc(&rcu_barrier_cpu_count);
|
||||
9 call_rcu(head, rcu_barrier_callback);
|
||||
10 }
|
||||
|
||||
Lines 3 and 4 locate RCU's internal per-CPU rcu_data structure,
|
||||
which contains the struct rcu_head that needed for the later call to
|
||||
call_rcu(). Line 7 picks up a pointer to this struct rcu_head, and line
|
||||
8 increments a global counter. This counter will later be decremented
|
||||
by the callback. Line 9 then registers the rcu_barrier_callback() on
|
||||
the current CPU's queue.
|
||||
|
||||
The rcu_barrier_callback() function simply atomically decrements the
|
||||
rcu_barrier_cpu_count variable and finalizes the completion when it
|
||||
reaches zero, as follows:
|
||||
|
||||
1 static void rcu_barrier_callback(struct rcu_head *notused)
|
||||
2 {
|
||||
3 if (atomic_dec_and_test(&rcu_barrier_cpu_count))
|
||||
4 complete(&rcu_barrier_completion);
|
||||
5 }
|
||||
|
||||
Quick Quiz #3: What happens if CPU 0's rcu_barrier_func() executes
|
||||
immediately (thus incrementing rcu_barrier_cpu_count to the
|
||||
value one), but the other CPU's rcu_barrier_func() invocations
|
||||
are delayed for a full grace period? Couldn't this result in
|
||||
rcu_barrier() returning prematurely?
|
||||
|
||||
|
||||
rcu_barrier() Summary
|
||||
|
||||
The rcu_barrier() primitive has seen relatively little use, since most
|
||||
code using RCU is in the core kernel rather than in modules. However, if
|
||||
you are using RCU from an unloadable module, you need to use rcu_barrier()
|
||||
so that your module may be safely unloaded.
|
||||
|
||||
|
||||
Answers to Quick Quizzes
|
||||
|
||||
Quick Quiz #1: Why is there no srcu_barrier()?
|
||||
|
||||
Answer: Since there is no call_srcu(), there can be no outstanding SRCU
|
||||
callbacks. Therefore, there is no need to wait for them.
|
||||
|
||||
Quick Quiz #2: Is there any other situation where rcu_barrier() might
|
||||
be required?
|
||||
|
||||
Answer: Interestingly enough, rcu_barrier() was not originally
|
||||
implemented for module unloading. Nikita Danilov was using
|
||||
RCU in a filesystem, which resulted in a similar situation at
|
||||
filesystem-unmount time. Dipankar Sarma coded up rcu_barrier()
|
||||
in response, so that Nikita could invoke it during the
|
||||
filesystem-unmount process.
|
||||
|
||||
Much later, yours truly hit the RCU module-unload problem when
|
||||
implementing rcutorture, and found that rcu_barrier() solves
|
||||
this problem as well.
|
||||
|
||||
Quick Quiz #3: What happens if CPU 0's rcu_barrier_func() executes
|
||||
immediately (thus incrementing rcu_barrier_cpu_count to the
|
||||
value one), but the other CPU's rcu_barrier_func() invocations
|
||||
are delayed for a full grace period? Couldn't this result in
|
||||
rcu_barrier() returning prematurely?
|
||||
|
||||
Answer: This cannot happen. The reason is that on_each_cpu() has its last
|
||||
argument, the wait flag, set to "1". This flag is passed through
|
||||
to smp_call_function() and further to smp_call_function_on_cpu(),
|
||||
causing this latter to spin until the cross-CPU invocation of
|
||||
rcu_barrier_func() has completed. This by itself would prevent
|
||||
a grace period from completing on non-CONFIG_PREEMPT kernels,
|
||||
since each CPU must undergo a context switch (or other quiescent
|
||||
state) before the grace period can complete. However, this is
|
||||
of no use in CONFIG_PREEMPT kernels.
|
||||
|
||||
Therefore, on_each_cpu() disables preemption across its call
|
||||
to smp_call_function() and also across the local call to
|
||||
rcu_barrier_func(). This prevents the local CPU from context
|
||||
switching, again preventing grace periods from completing. This
|
||||
means that all CPUs have executed rcu_barrier_func() before
|
||||
the first rcu_barrier_callback() can possibly execute, in turn
|
||||
preventing rcu_barrier_cpu_count from prematurely reaching zero.
|
||||
|
||||
Currently, -rt implementations of RCU keep but a single global
|
||||
queue for RCU callbacks, and thus do not suffer from this
|
||||
problem. However, when the -rt RCU eventually does have per-CPU
|
||||
callback queues, things will have to change. One simple change
|
||||
is to add an rcu_read_lock() before line 8 of rcu_barrier()
|
||||
and an rcu_read_unlock() after line 8 of this same function. If
|
||||
you can think of a better change, please let me know!
|
||||
@@ -392,6 +392,10 @@ int main(int argc, char *argv[])
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (!maskset && !tid && !containerset) {
|
||||
usage();
|
||||
goto err;
|
||||
}
|
||||
|
||||
do {
|
||||
int i;
|
||||
|
||||
45
Documentation/bad_memory.txt
Normal file
45
Documentation/bad_memory.txt
Normal file
@@ -0,0 +1,45 @@
|
||||
March 2008
|
||||
Jan-Simon Moeller, dl9pf@gmx.de
|
||||
|
||||
|
||||
How to deal with bad memory e.g. reported by memtest86+ ?
|
||||
#########################################################
|
||||
|
||||
There are three possibilities I know of:
|
||||
|
||||
1) Reinsert/swap the memory modules
|
||||
|
||||
2) Buy new modules (best!) or try to exchange the memory
|
||||
if you have spare-parts
|
||||
|
||||
3) Use BadRAM or memmap
|
||||
|
||||
This Howto is about number 3) .
|
||||
|
||||
|
||||
BadRAM
|
||||
######
|
||||
BadRAM is the actively developed and available as kernel-patch
|
||||
here: http://rick.vanrein.org/linux/badram/
|
||||
|
||||
For more details see the BadRAM documentation.
|
||||
|
||||
memmap
|
||||
######
|
||||
|
||||
memmap is already in the kernel and usable as kernel-parameter at
|
||||
boot-time. Its syntax is slightly strange and you may need to
|
||||
calculate the values by yourself!
|
||||
|
||||
Syntax to exclude a memory area (see kernel-parameters.txt for details):
|
||||
memmap=<size>$<address>
|
||||
|
||||
Example: memtest86+ reported here errors at address 0x18691458, 0x18698424 and
|
||||
some others. All had 0x1869xxxx in common, so I chose a pattern of
|
||||
0x18690000,0xffff0000.
|
||||
|
||||
With the numbers of the example above:
|
||||
memmap=64K$0x18690000
|
||||
or
|
||||
memmap=0x10000$0x18690000
|
||||
|
||||
@@ -9,3 +9,6 @@ cachefeatures.txt
|
||||
|
||||
Filesystems
|
||||
- Requirements for mounting the root file system.
|
||||
|
||||
bfin-gpio-note.txt
|
||||
- Notes in developing/using bfin-gpio driver.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user