Merge branch 'for-4.12/asus' into for-linus
This commit is contained in:
Коммит
4d6ca227c7
|
@ -270,8 +270,8 @@ m68k/
|
|||
- directory with info about Linux on Motorola 68k architecture.
|
||||
mailbox.txt
|
||||
- How to write drivers for the common mailbox framework (IPC).
|
||||
md-cluster.txt
|
||||
- info on shared-device RAID MD cluster.
|
||||
md/
|
||||
- directory with info about Linux Software RAID
|
||||
media/
|
||||
- info on media drivers: uAPI, kAPI and driver documentation.
|
||||
memory-barriers.txt
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
What: /sys/block/zram<id>/num_reads
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The num_reads file is read-only and specifies the number of
|
||||
reads (failed or successful) done on this device.
|
||||
Now accessible via zram<id>/stat node.
|
||||
|
||||
What: /sys/block/zram<id>/num_writes
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The num_writes file is read-only and specifies the number of
|
||||
writes (failed or successful) done on this device.
|
||||
Now accessible via zram<id>/stat node.
|
||||
|
||||
What: /sys/block/zram<id>/invalid_io
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The invalid_io file is read-only and specifies the number of
|
||||
non-page-size-aligned I/O requests issued to this device.
|
||||
Now accessible via zram<id>/io_stat node.
|
||||
|
||||
What: /sys/block/zram<id>/failed_reads
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The failed_reads file is read-only and specifies the number of
|
||||
failed reads happened on this device.
|
||||
Now accessible via zram<id>/io_stat node.
|
||||
|
||||
What: /sys/block/zram<id>/failed_writes
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The failed_writes file is read-only and specifies the number of
|
||||
failed writes happened on this device.
|
||||
Now accessible via zram<id>/io_stat node.
|
||||
|
||||
What: /sys/block/zram<id>/notify_free
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The notify_free file is read-only. Depending on device usage
|
||||
scenario it may account a) the number of pages freed because
|
||||
of swap slot free notifications or b) the number of pages freed
|
||||
because of REQ_DISCARD requests sent by bio. The former ones
|
||||
are sent to a swap block device when a swap slot is freed, which
|
||||
implies that this disk is being used as a swap disk. The latter
|
||||
ones are sent by filesystem mounted with discard option,
|
||||
whenever some data blocks are getting discarded.
|
||||
Now accessible via zram<id>/io_stat node.
|
||||
|
||||
What: /sys/block/zram<id>/zero_pages
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The zero_pages file is read-only and specifies number of zero
|
||||
filled pages written to this disk. No memory is allocated for
|
||||
such pages.
|
||||
Now accessible via zram<id>/mm_stat node.
|
||||
|
||||
What: /sys/block/zram<id>/orig_data_size
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The orig_data_size file is read-only and specifies uncompressed
|
||||
size of data stored in this disk. This excludes zero-filled
|
||||
pages (zero_pages) since no memory is allocated for them.
|
||||
Unit: bytes
|
||||
Now accessible via zram<id>/mm_stat node.
|
||||
|
||||
What: /sys/block/zram<id>/compr_data_size
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The compr_data_size file is read-only and specifies compressed
|
||||
size of data stored in this disk. So, compression ratio can be
|
||||
calculated using orig_data_size and this statistic.
|
||||
Unit: bytes
|
||||
Now accessible via zram<id>/mm_stat node.
|
||||
|
||||
What: /sys/block/zram<id>/mem_used_total
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The mem_used_total file is read-only and specifies the amount
|
||||
of memory, including allocator fragmentation and metadata
|
||||
overhead, allocated for this disk. So, allocator space
|
||||
efficiency can be calculated using compr_data_size and this
|
||||
statistic.
|
||||
Unit: bytes
|
||||
Now accessible via zram<id>/mm_stat node.
|
||||
|
||||
What: /sys/block/zram<id>/mem_used_max
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The mem_used_max file is read/write and specifies the amount
|
||||
of maximum memory zram have consumed to store compressed data.
|
||||
For resetting the value, you should write "0". Otherwise,
|
||||
you could see -EINVAL.
|
||||
Unit: bytes
|
||||
Downgraded to write-only node: so it's possible to set new
|
||||
value only; its current value is stored in zram<id>/mm_stat
|
||||
node.
|
||||
|
||||
What: /sys/block/zram<id>/mem_limit
|
||||
Date: August 2015
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The mem_limit file is read/write and specifies the maximum
|
||||
amount of memory ZRAM can use to store the compressed data.
|
||||
The limit could be changed in run time and "0" means disable
|
||||
the limit. No limit is the initial state. Unit: bytes
|
||||
Downgraded to write-only node: so it's possible to set new
|
||||
value only; its current value is stored in zram<id>/mm_stat
|
||||
node.
|
|
@ -20,3 +20,11 @@ Description: RDMA-CM based connections from HCA <hca> at port <port-num>
|
|||
will be initiated with this RoCE type as default.
|
||||
The possible RoCE types are either "IB/RoCE v1" or "RoCE v2".
|
||||
This parameter has RW access.
|
||||
|
||||
What: /config/rdma_cm/<hca>/ports/<port-num>/default_roce_tos
|
||||
Date: February 7, 2017
|
||||
KernelVersion: 4.11.0
|
||||
Description: RDMA-CM QPs from HCA <hca> at port <port-num>
|
||||
will be created with this TOS as default.
|
||||
This can be overridden by using the rdma_set_option API.
|
||||
The possible RoCE TOS values are 0-255.
|
||||
|
|
|
@ -22,41 +22,6 @@ Description:
|
|||
device. The reset operation frees all the memory associated
|
||||
with this device.
|
||||
|
||||
What: /sys/block/zram<id>/num_reads
|
||||
Date: August 2010
|
||||
Contact: Nitin Gupta <ngupta@vflare.org>
|
||||
Description:
|
||||
The num_reads file is read-only and specifies the number of
|
||||
reads (failed or successful) done on this device.
|
||||
|
||||
What: /sys/block/zram<id>/num_writes
|
||||
Date: August 2010
|
||||
Contact: Nitin Gupta <ngupta@vflare.org>
|
||||
Description:
|
||||
The num_writes file is read-only and specifies the number of
|
||||
writes (failed or successful) done on this device.
|
||||
|
||||
What: /sys/block/zram<id>/invalid_io
|
||||
Date: August 2010
|
||||
Contact: Nitin Gupta <ngupta@vflare.org>
|
||||
Description:
|
||||
The invalid_io file is read-only and specifies the number of
|
||||
non-page-size-aligned I/O requests issued to this device.
|
||||
|
||||
What: /sys/block/zram<id>/failed_reads
|
||||
Date: February 2014
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The failed_reads file is read-only and specifies the number of
|
||||
failed reads happened on this device.
|
||||
|
||||
What: /sys/block/zram<id>/failed_writes
|
||||
Date: February 2014
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Description:
|
||||
The failed_writes file is read-only and specifies the number of
|
||||
failed writes happened on this device.
|
||||
|
||||
What: /sys/block/zram<id>/max_comp_streams
|
||||
Date: February 2014
|
||||
Contact: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
|
@ -73,74 +38,24 @@ Description:
|
|||
available and selected compression algorithms, change
|
||||
compression algorithm selection.
|
||||
|
||||
What: /sys/block/zram<id>/notify_free
|
||||
Date: August 2010
|
||||
Contact: Nitin Gupta <ngupta@vflare.org>
|
||||
Description:
|
||||
The notify_free file is read-only. Depending on device usage
|
||||
scenario it may account a) the number of pages freed because
|
||||
of swap slot free notifications or b) the number of pages freed
|
||||
because of REQ_DISCARD requests sent by bio. The former ones
|
||||
are sent to a swap block device when a swap slot is freed, which
|
||||
implies that this disk is being used as a swap disk. The latter
|
||||
ones are sent by filesystem mounted with discard option,
|
||||
whenever some data blocks are getting discarded.
|
||||
|
||||
What: /sys/block/zram<id>/zero_pages
|
||||
Date: August 2010
|
||||
Contact: Nitin Gupta <ngupta@vflare.org>
|
||||
Description:
|
||||
The zero_pages file is read-only and specifies number of zero
|
||||
filled pages written to this disk. No memory is allocated for
|
||||
such pages.
|
||||
|
||||
What: /sys/block/zram<id>/orig_data_size
|
||||
Date: August 2010
|
||||
Contact: Nitin Gupta <ngupta@vflare.org>
|
||||
Description:
|
||||
The orig_data_size file is read-only and specifies uncompressed
|
||||
size of data stored in this disk. This excludes zero-filled
|
||||
pages (zero_pages) since no memory is allocated for them.
|
||||
Unit: bytes
|
||||
|
||||
What: /sys/block/zram<id>/compr_data_size
|
||||
Date: August 2010
|
||||
Contact: Nitin Gupta <ngupta@vflare.org>
|
||||
Description:
|
||||
The compr_data_size file is read-only and specifies compressed
|
||||
size of data stored in this disk. So, compression ratio can be
|
||||
calculated using orig_data_size and this statistic.
|
||||
Unit: bytes
|
||||
|
||||
What: /sys/block/zram<id>/mem_used_total
|
||||
Date: August 2010
|
||||
Contact: Nitin Gupta <ngupta@vflare.org>
|
||||
Description:
|
||||
The mem_used_total file is read-only and specifies the amount
|
||||
of memory, including allocator fragmentation and metadata
|
||||
overhead, allocated for this disk. So, allocator space
|
||||
efficiency can be calculated using compr_data_size and this
|
||||
statistic.
|
||||
Unit: bytes
|
||||
|
||||
What: /sys/block/zram<id>/mem_used_max
|
||||
Date: August 2014
|
||||
Contact: Minchan Kim <minchan@kernel.org>
|
||||
Description:
|
||||
The mem_used_max file is read/write and specifies the amount
|
||||
of maximum memory zram have consumed to store compressed data.
|
||||
For resetting the value, you should write "0". Otherwise,
|
||||
you could see -EINVAL.
|
||||
The mem_used_max file is write-only and is used to reset
|
||||
the counter of maximum memory zram have consumed to store
|
||||
compressed data. For resetting the value, you should write
|
||||
"0". Otherwise, you could see -EINVAL.
|
||||
Unit: bytes
|
||||
|
||||
What: /sys/block/zram<id>/mem_limit
|
||||
Date: August 2014
|
||||
Contact: Minchan Kim <minchan@kernel.org>
|
||||
Description:
|
||||
The mem_limit file is read/write and specifies the maximum
|
||||
amount of memory ZRAM can use to store the compressed data. The
|
||||
limit could be changed in run time and "0" means disable the
|
||||
limit. No limit is the initial state. Unit: bytes
|
||||
The mem_limit file is write-only and specifies the maximum
|
||||
amount of memory ZRAM can use to store the compressed data.
|
||||
The limit could be changed in run time and "0" means disable
|
||||
the limit. No limit is the initial state. Unit: bytes
|
||||
|
||||
What: /sys/block/zram<id>/compact
|
||||
Date: August 2015
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
What: /sys/bus/i2c/devices/.../trickle_charge_bypass
|
||||
Date: Jan 2017
|
||||
KernelVersion: 4.11
|
||||
Contact: Enric Balletbo i Serra <eballetbo@gmail.com>
|
||||
Description: Attribute for enable/disable the trickle charge bypass
|
||||
The trickle_charge_bypass attribute allows the userspace to
|
||||
enable/disable the Trickle charge FET bypass.
|
|
@ -170,6 +170,16 @@ Description:
|
|||
Has all of the equivalent parameters as per voltageY. Units
|
||||
after application of scale and offset are m/s^2.
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_gravity_x_raw
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_gravity_y_raw
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_gravity_z_raw
|
||||
KernelVersion: 4.11
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Gravity in direction x, y or z (may be arbitrarily assigned
|
||||
but should match other such assignments on device).
|
||||
Units after application of scale and offset are m/s^2.
|
||||
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_x_raw
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_y_raw
|
||||
What: /sys/bus/iio/devices/iio:deviceX/in_anglvel_z_raw
|
||||
|
@ -805,7 +815,7 @@ Description:
|
|||
attribute. E.g. if in_voltage0_raw_thresh_rising_value is set to 1200
|
||||
and in_voltage0_raw_thresh_rising_hysteresis is set to 50. The event
|
||||
will get activated once in_voltage0_raw goes above 1200 and will become
|
||||
deactived again once the value falls below 1150.
|
||||
deactivated again once the value falls below 1150.
|
||||
|
||||
What: /sys/.../events/in_accel_x_raw_roc_rising_value
|
||||
What: /sys/.../events/in_accel_x_raw_roc_falling_value
|
||||
|
@ -1245,7 +1255,8 @@ Description:
|
|||
reflectivity of infrared or ultrasound emitted.
|
||||
Often these sensors are unit less and as such conversion
|
||||
to SI units is not possible. Higher proximity measurements
|
||||
indicate closer objects, and vice versa.
|
||||
indicate closer objects, and vice versa. Units after
|
||||
application of scale and offset are meters.
|
||||
|
||||
What: /sys/.../iio:deviceX/in_illuminance_input
|
||||
What: /sys/.../iio:deviceX/in_illuminance_raw
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
What: /sys/bus/iio/devices/triggerX/trigger_polarity
|
||||
KernelVersion: 4.11
|
||||
Contact: fabrice.gasnier@st.com
|
||||
Description:
|
||||
The STM32 ADC can be configured to use external trigger sources
|
||||
(e.g. timers, pwm or exti gpio). Then, it can be tuned to start
|
||||
conversions on external trigger by either:
|
||||
- "rising-edge"
|
||||
- "falling-edge"
|
||||
- "both-edges".
|
||||
Reading returns current trigger polarity.
|
||||
Writing value before enabling conversions sets trigger polarity.
|
||||
|
||||
What: /sys/bus/iio/devices/triggerX/trigger_polarity_available
|
||||
KernelVersion: 4.11
|
||||
Contact: fabrice.gasnier@st.com
|
||||
Description:
|
||||
List all available trigger_polarity settings.
|
|
@ -0,0 +1,22 @@
|
|||
What /sys/bus/iio/devices/iio:deviceX/sensor_sensitivity
|
||||
Date: January 2017
|
||||
KernelVersion: 4.11
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Show or set the gain boost of the amp, from 0-31 range.
|
||||
default 31
|
||||
|
||||
What /sys/bus/iio/devices/iio:deviceX/sensor_max_range
|
||||
Date: January 2017
|
||||
KernelVersion: 4.11
|
||||
Contact: linux-iio@vger.kernel.org
|
||||
Description:
|
||||
Show or set the maximum range between the sensor and the
|
||||
first object echoed in meters. Default value is 6.020.
|
||||
This setting limits the time the driver is waiting for a
|
||||
echo.
|
||||
Showing the range of available values is represented as the
|
||||
minimum value, the step and the maximum value, all enclosed
|
||||
in square brackets.
|
||||
Example:
|
||||
[0.043 0.043 11.008]
|
|
@ -0,0 +1,29 @@
|
|||
What: /sys/bus/iio/devices/triggerX/master_mode_available
|
||||
KernelVersion: 4.11
|
||||
Contact: benjamin.gaignard@st.com
|
||||
Description:
|
||||
Reading returns the list possible master modes which are:
|
||||
- "reset" : The UG bit from the TIMx_EGR register is used as trigger output (TRGO).
|
||||
- "enable" : The Counter Enable signal CNT_EN is used as trigger output.
|
||||
- "update" : The update event is selected as trigger output.
|
||||
For instance a master timer can then be used as a prescaler for a slave timer.
|
||||
- "compare_pulse" : The trigger output send a positive pulse when the CC1IF flag is to be set.
|
||||
- "OC1REF" : OC1REF signal is used as trigger output.
|
||||
- "OC2REF" : OC2REF signal is used as trigger output.
|
||||
- "OC3REF" : OC3REF signal is used as trigger output.
|
||||
- "OC4REF" : OC4REF signal is used as trigger output.
|
||||
|
||||
What: /sys/bus/iio/devices/triggerX/master_mode
|
||||
KernelVersion: 4.11
|
||||
Contact: benjamin.gaignard@st.com
|
||||
Description:
|
||||
Reading returns the current master modes.
|
||||
Writing set the master mode
|
||||
|
||||
What: /sys/bus/iio/devices/triggerX/sampling_frequency
|
||||
KernelVersion: 4.11
|
||||
Contact: benjamin.gaignard@st.com
|
||||
Description:
|
||||
Reading returns the current sampling frequency.
|
||||
Writing an value different of 0 set and start sampling.
|
||||
Writing 0 stop sampling.
|
|
@ -42,7 +42,7 @@ requirements you pass the flag GFP_DMA to kmalloc.
|
|||
|
||||
Unfortunately the memory available for ISA DMA is scarce so unless you
|
||||
allocate the memory during boot-up it's a good idea to also pass
|
||||
__GFP_REPEAT and __GFP_NOWARN to make the allocater try a bit harder.
|
||||
__GFP_REPEAT and __GFP_NOWARN to make the allocator try a bit harder.
|
||||
|
||||
(This scarcity also means that you should allocate the buffer as
|
||||
early as possible and not release it until the driver is unloaded.)
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
# list of DOCBOOKS.
|
||||
|
||||
DOCBOOKS := z8530book.xml \
|
||||
kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
|
||||
kernel-hacking.xml kernel-locking.xml \
|
||||
writing_usb_driver.xml networking.xml \
|
||||
kernel-api.xml filesystems.xml lsm.xml kgdb.xml \
|
||||
gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
|
||||
genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
|
||||
sh.xml regulator.xml w1.xml \
|
||||
writing_musb_glue_layer.xml iio.xml
|
||||
genericirq.xml s390-drivers.xml scsi.xml \
|
||||
sh.xml w1.xml \
|
||||
writing_musb_glue_layer.xml
|
||||
|
||||
ifeq ($(DOCBOOKS),)
|
||||
|
||||
|
@ -71,6 +71,7 @@ installmandocs: mandocs
|
|||
# no-op for the DocBook toolchain
|
||||
epubdocs:
|
||||
latexdocs:
|
||||
linkcheckdocs:
|
||||
|
||||
###
|
||||
#External programs used
|
||||
|
@ -272,6 +273,6 @@ cleandocs:
|
|||
$(Q)rm -rf $(call objectify, $(clean-dirs))
|
||||
|
||||
# Declare the contents of the .PHONY variable as phony. We keep that
|
||||
# information in a variable se we can use it in if_changed and friends.
|
||||
# information in a variable so we can use it in if_changed and friends.
|
||||
|
||||
.PHONY: $(PHONY)
|
||||
|
|
|
@ -1,323 +0,0 @@
|
|||
<?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="DoingIO">
|
||||
<bookinfo>
|
||||
<title>Bus-Independent Device Accesses</title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Matthew</firstname>
|
||||
<surname>Wilcox</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>matthew@wil.cx</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Alan</firstname>
|
||||
<surname>Cox</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>alan@lxorguk.ukuu.org.uk</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<copyright>
|
||||
<year>2001</year>
|
||||
<holder>Matthew Wilcox</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 as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
</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>
|
||||
Linux provides an API which abstracts performing IO across all busses
|
||||
and devices, allowing device drivers to be written independently of
|
||||
bus type.
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
<chapter id="bugs">
|
||||
<title>Known Bugs And Assumptions</title>
|
||||
<para>
|
||||
None.
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
<chapter id="mmio">
|
||||
<title>Memory Mapped IO</title>
|
||||
<sect1 id="getting_access_to_the_device">
|
||||
<title>Getting Access to the Device</title>
|
||||
<para>
|
||||
The most widely supported form of IO is memory mapped IO.
|
||||
That is, a part of the CPU's address space is interpreted
|
||||
not as accesses to memory, but as accesses to a device. Some
|
||||
architectures define devices to be at a fixed address, but most
|
||||
have some method of discovering devices. The PCI bus walk is a
|
||||
good example of such a scheme. This document does not cover how
|
||||
to receive such an address, but assumes you are starting with one.
|
||||
Physical addresses are of type unsigned long.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This address should not be used directly. Instead, to get an
|
||||
address suitable for passing to the accessor functions described
|
||||
below, you should call <function>ioremap</function>.
|
||||
An address suitable for accessing the device will be returned to you.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
After you've finished using the device (say, in your module's
|
||||
exit routine), call <function>iounmap</function> in order to return
|
||||
the address space to the kernel. Most architectures allocate new
|
||||
address space each time you call <function>ioremap</function>, and
|
||||
they can run out unless you call <function>iounmap</function>.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="accessing_the_device">
|
||||
<title>Accessing the device</title>
|
||||
<para>
|
||||
The part of the interface most used by drivers is reading and
|
||||
writing memory-mapped registers on the device. Linux provides
|
||||
interfaces to read and write 8-bit, 16-bit, 32-bit and 64-bit
|
||||
quantities. Due to a historical accident, these are named byte,
|
||||
word, long and quad accesses. Both read and write accesses are
|
||||
supported; there is no prefetch support at this time.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The functions are named <function>readb</function>,
|
||||
<function>readw</function>, <function>readl</function>,
|
||||
<function>readq</function>, <function>readb_relaxed</function>,
|
||||
<function>readw_relaxed</function>, <function>readl_relaxed</function>,
|
||||
<function>readq_relaxed</function>, <function>writeb</function>,
|
||||
<function>writew</function>, <function>writel</function> and
|
||||
<function>writeq</function>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Some devices (such as framebuffers) would like to use larger
|
||||
transfers than 8 bytes at a time. For these devices, the
|
||||
<function>memcpy_toio</function>, <function>memcpy_fromio</function>
|
||||
and <function>memset_io</function> functions are provided.
|
||||
Do not use memset or memcpy on IO addresses; they
|
||||
are not guaranteed to copy data in order.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The read and write functions are defined to be ordered. That is the
|
||||
compiler is not permitted to reorder the I/O sequence. When the
|
||||
ordering can be compiler optimised, you can use <function>
|
||||
__readb</function> and friends to indicate the relaxed ordering. Use
|
||||
this with care.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
While the basic functions are defined to be synchronous with respect
|
||||
to each other and ordered with respect to each other the busses the
|
||||
devices sit on may themselves have asynchronicity. In particular many
|
||||
authors are burned by the fact that PCI bus writes are posted
|
||||
asynchronously. A driver author must issue a read from the same
|
||||
device to ensure that writes have occurred in the specific cases the
|
||||
author cares. This kind of property cannot be hidden from driver
|
||||
writers in the API. In some cases, the read used to flush the device
|
||||
may be expected to fail (if the card is resetting, for example). In
|
||||
that case, the read should be done from config space, which is
|
||||
guaranteed to soft-fail if the card doesn't respond.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following is an example of flushing a write to a device when
|
||||
the driver would like to ensure the write's effects are visible prior
|
||||
to continuing execution.
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
static inline void
|
||||
qla1280_disable_intrs(struct scsi_qla_host *ha)
|
||||
{
|
||||
struct device_reg *reg;
|
||||
|
||||
reg = ha->iobase;
|
||||
/* disable risc and host interrupts */
|
||||
WRT_REG_WORD(&reg->ictrl, 0);
|
||||
/*
|
||||
* The following read will ensure that the above write
|
||||
* has been received by the device before we return from this
|
||||
* function.
|
||||
*/
|
||||
RD_REG_WORD(&reg->ictrl);
|
||||
ha->flags.ints_enabled = 0;
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
In addition to write posting, on some large multiprocessing systems
|
||||
(e.g. SGI Challenge, Origin and Altix machines) posted writes won't
|
||||
be strongly ordered coming from different CPUs. Thus it's important
|
||||
to properly protect parts of your driver that do memory-mapped writes
|
||||
with locks and use the <function>mmiowb</function> to make sure they
|
||||
arrive in the order intended. Issuing a regular <function>readX
|
||||
</function> will also ensure write ordering, but should only be used
|
||||
when the driver has to be sure that the write has actually arrived
|
||||
at the device (not that it's simply ordered with respect to other
|
||||
writes), since a full <function>readX</function> is a relatively
|
||||
expensive operation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Generally, one should use <function>mmiowb</function> prior to
|
||||
releasing a spinlock that protects regions using <function>writeb
|
||||
</function> or similar functions that aren't surrounded by <function>
|
||||
readb</function> calls, which will ensure ordering and flushing. The
|
||||
following pseudocode illustrates what might occur if write ordering
|
||||
isn't guaranteed via <function>mmiowb</function> or one of the
|
||||
<function>readX</function> functions.
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
CPU A: spin_lock_irqsave(&dev_lock, flags)
|
||||
CPU A: ...
|
||||
CPU A: writel(newval, ring_ptr);
|
||||
CPU A: spin_unlock_irqrestore(&dev_lock, flags)
|
||||
...
|
||||
CPU B: spin_lock_irqsave(&dev_lock, flags)
|
||||
CPU B: writel(newval2, ring_ptr);
|
||||
CPU B: ...
|
||||
CPU B: spin_unlock_irqrestore(&dev_lock, flags)
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
In the case above, newval2 could be written to ring_ptr before
|
||||
newval. Fixing it is easy though:
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
CPU A: spin_lock_irqsave(&dev_lock, flags)
|
||||
CPU A: ...
|
||||
CPU A: writel(newval, ring_ptr);
|
||||
CPU A: mmiowb(); /* ensure no other writes beat us to the device */
|
||||
CPU A: spin_unlock_irqrestore(&dev_lock, flags)
|
||||
...
|
||||
CPU B: spin_lock_irqsave(&dev_lock, flags)
|
||||
CPU B: writel(newval2, ring_ptr);
|
||||
CPU B: ...
|
||||
CPU B: mmiowb();
|
||||
CPU B: spin_unlock_irqrestore(&dev_lock, flags)
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
See tg3.c for a real world example of how to use <function>mmiowb
|
||||
</function>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
PCI ordering rules also guarantee that PIO read responses arrive
|
||||
after any outstanding DMA writes from that bus, since for some devices
|
||||
the result of a <function>readb</function> call may signal to the
|
||||
driver that a DMA transaction is complete. In many cases, however,
|
||||
the driver may want to indicate that the next
|
||||
<function>readb</function> call has no relation to any previous DMA
|
||||
writes performed by the device. The driver can use
|
||||
<function>readb_relaxed</function> for these cases, although only
|
||||
some platforms will honor the relaxed semantics. Using the relaxed
|
||||
read functions will provide significant performance benefits on
|
||||
platforms that support it. The qla2xxx driver provides examples
|
||||
of how to use <function>readX_relaxed</function>. In many cases,
|
||||
a majority of the driver's <function>readX</function> calls can
|
||||
safely be converted to <function>readX_relaxed</function> calls, since
|
||||
only a few will indicate or depend on DMA completion.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
</chapter>
|
||||
|
||||
<chapter id="port_space_accesses">
|
||||
<title>Port Space Accesses</title>
|
||||
<sect1 id="port_space_explained">
|
||||
<title>Port Space Explained</title>
|
||||
|
||||
<para>
|
||||
Another form of IO commonly supported is Port Space. This is a
|
||||
range of addresses separate to the normal memory address space.
|
||||
Access to these addresses is generally not as fast as accesses
|
||||
to the memory mapped addresses, and it also has a potentially
|
||||
smaller address space.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Unlike memory mapped IO, no preparation is required
|
||||
to access port space.
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
<sect1 id="accessing_port_space">
|
||||
<title>Accessing Port Space</title>
|
||||
<para>
|
||||
Accesses to this space are provided through a set of functions
|
||||
which allow 8-bit, 16-bit and 32-bit accesses; also
|
||||
known as byte, word and long. These functions are
|
||||
<function>inb</function>, <function>inw</function>,
|
||||
<function>inl</function>, <function>outb</function>,
|
||||
<function>outw</function> and <function>outl</function>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Some variants are provided for these functions. Some devices
|
||||
require that accesses to their ports are slowed down. This
|
||||
functionality is provided by appending a <function>_p</function>
|
||||
to the end of the function. There are also equivalents to memcpy.
|
||||
The <function>ins</function> and <function>outs</function>
|
||||
functions copy bytes, words or longs to the given port.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
</chapter>
|
||||
|
||||
<chapter id="pubfunctions">
|
||||
<title>Public Functions Provided</title>
|
||||
!Iarch/x86/include/asm/io.h
|
||||
!Elib/pci_iomap.c
|
||||
</chapter>
|
||||
|
||||
</book>
|
|
@ -1,697 +0,0 @@
|
|||
<?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="iioid">
|
||||
<bookinfo>
|
||||
<title>Industrial I/O driver developer's guide </title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Daniel</firstname>
|
||||
<surname>Baluta</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>daniel.baluta@intel.com</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
<copyright>
|
||||
<year>2015</year>
|
||||
<holder>Intel Corporation</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.
|
||||
</para>
|
||||
</legalnotice>
|
||||
</bookinfo>
|
||||
|
||||
<toc></toc>
|
||||
|
||||
<chapter id="intro">
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
The main purpose of the Industrial I/O subsystem (IIO) is to provide
|
||||
support for devices that in some sense perform either analog-to-digital
|
||||
conversion (ADC) or digital-to-analog conversion (DAC) or both. The aim
|
||||
is to fill the gap between the somewhat similar hwmon and input
|
||||
subsystems.
|
||||
Hwmon is directed at low sample rate sensors used to monitor and
|
||||
control the system itself, like fan speed control or temperature
|
||||
measurement. Input is, as its name suggests, focused on human interaction
|
||||
input devices (keyboard, mouse, touchscreen). In some cases there is
|
||||
considerable overlap between these and IIO.
|
||||
</para>
|
||||
<para>
|
||||
Devices that fall into this category include:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
analog to digital converters (ADCs)
|
||||
</listitem>
|
||||
<listitem>
|
||||
accelerometers
|
||||
</listitem>
|
||||
<listitem>
|
||||
capacitance to digital converters (CDCs)
|
||||
</listitem>
|
||||
<listitem>
|
||||
digital to analog converters (DACs)
|
||||
</listitem>
|
||||
<listitem>
|
||||
gyroscopes
|
||||
</listitem>
|
||||
<listitem>
|
||||
inertial measurement units (IMUs)
|
||||
</listitem>
|
||||
<listitem>
|
||||
color and light sensors
|
||||
</listitem>
|
||||
<listitem>
|
||||
magnetometers
|
||||
</listitem>
|
||||
<listitem>
|
||||
pressure sensors
|
||||
</listitem>
|
||||
<listitem>
|
||||
proximity sensors
|
||||
</listitem>
|
||||
<listitem>
|
||||
temperature sensors
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
Usually these sensors are connected via SPI or I2C. A common use case of the
|
||||
sensors devices is to have combined functionality (e.g. light plus proximity
|
||||
sensor).
|
||||
</para>
|
||||
</chapter>
|
||||
<chapter id='iiosubsys'>
|
||||
<title>Industrial I/O core</title>
|
||||
<para>
|
||||
The Industrial I/O core offers:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
a unified framework for writing drivers for many different types of
|
||||
embedded sensors.
|
||||
</listitem>
|
||||
<listitem>
|
||||
a standard interface to user space applications manipulating sensors.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
The implementation can be found under <filename>
|
||||
drivers/iio/industrialio-*</filename>
|
||||
</para>
|
||||
<sect1 id="iiodevice">
|
||||
<title> Industrial I/O devices </title>
|
||||
|
||||
!Finclude/linux/iio/iio.h iio_dev
|
||||
!Fdrivers/iio/industrialio-core.c iio_device_alloc
|
||||
!Fdrivers/iio/industrialio-core.c iio_device_free
|
||||
!Fdrivers/iio/industrialio-core.c iio_device_register
|
||||
!Fdrivers/iio/industrialio-core.c iio_device_unregister
|
||||
|
||||
<para>
|
||||
An IIO device usually corresponds to a single hardware sensor and it
|
||||
provides all the information needed by a driver handling a device.
|
||||
Let's first have a look at the functionality embedded in an IIO
|
||||
device then we will show how a device driver makes use of an IIO
|
||||
device.
|
||||
</para>
|
||||
<para>
|
||||
There are two ways for a user space application to interact
|
||||
with an IIO driver.
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<filename>/sys/bus/iio/iio:deviceX/</filename>, this
|
||||
represents a hardware sensor and groups together the data
|
||||
channels of the same chip.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<filename>/dev/iio:deviceX</filename>, character device node
|
||||
interface used for buffered data transfer and for events information
|
||||
retrieval.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
A typical IIO driver will register itself as an I2C or SPI driver and will
|
||||
create two routines, <function> probe </function> and <function> remove
|
||||
</function>. At <function>probe</function>:
|
||||
<itemizedlist>
|
||||
<listitem>call <function>iio_device_alloc</function>, which allocates memory
|
||||
for an IIO device.
|
||||
</listitem>
|
||||
<listitem> initialize IIO device fields with driver specific information
|
||||
(e.g. device name, device channels).
|
||||
</listitem>
|
||||
<listitem>call <function> iio_device_register</function>, this registers the
|
||||
device with the IIO core. After this call the device is ready to accept
|
||||
requests from user space applications.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
At <function>remove</function>, we free the resources allocated in
|
||||
<function>probe</function> in reverse order:
|
||||
<itemizedlist>
|
||||
<listitem><function>iio_device_unregister</function>, unregister the device
|
||||
from the IIO core.
|
||||
</listitem>
|
||||
<listitem><function>iio_device_free</function>, free the memory allocated
|
||||
for the IIO device.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<sect2 id="iioattr"> <title> IIO device sysfs interface </title>
|
||||
<para>
|
||||
Attributes are sysfs files used to expose chip info and also allowing
|
||||
applications to set various configuration parameters. For device
|
||||
with index X, attributes can be found under
|
||||
<filename>/sys/bus/iio/iio:deviceX/ </filename> directory.
|
||||
Common attributes are:
|
||||
<itemizedlist>
|
||||
<listitem><filename>name</filename>, description of the physical
|
||||
chip.
|
||||
</listitem>
|
||||
<listitem><filename>dev</filename>, shows the major:minor pair
|
||||
associated with <filename>/dev/iio:deviceX</filename> node.
|
||||
</listitem>
|
||||
<listitem><filename>sampling_frequency_available</filename>,
|
||||
available discrete set of sampling frequency values for
|
||||
device.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
Available standard attributes for IIO devices are described in the
|
||||
<filename>Documentation/ABI/testing/sysfs-bus-iio </filename> file
|
||||
in the Linux kernel sources.
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2 id="iiochannel"> <title> IIO device channels </title>
|
||||
!Finclude/linux/iio/iio.h iio_chan_spec structure.
|
||||
<para>
|
||||
An IIO device channel is a representation of a data channel. An
|
||||
IIO device can have one or multiple channels. For example:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
a thermometer sensor has one channel representing the
|
||||
temperature measurement.
|
||||
</listitem>
|
||||
<listitem>
|
||||
a light sensor with two channels indicating the measurements in
|
||||
the visible and infrared spectrum.
|
||||
</listitem>
|
||||
<listitem>
|
||||
an accelerometer can have up to 3 channels representing
|
||||
acceleration on X, Y and Z axes.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
An IIO channel is described by the <type> struct iio_chan_spec
|
||||
</type>. A thermometer driver for the temperature sensor in the
|
||||
example above would have to describe its channel as follows:
|
||||
<programlisting>
|
||||
static const struct iio_chan_spec temp_channel[] = {
|
||||
{
|
||||
.type = IIO_TEMP,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
|
||||
},
|
||||
};
|
||||
|
||||
</programlisting>
|
||||
Channel sysfs attributes exposed to userspace are specified in
|
||||
the form of <emphasis>bitmasks</emphasis>. Depending on their
|
||||
shared info, attributes can be set in one of the following masks:
|
||||
<itemizedlist>
|
||||
<listitem><emphasis>info_mask_separate</emphasis>, attributes will
|
||||
be specific to this channel</listitem>
|
||||
<listitem><emphasis>info_mask_shared_by_type</emphasis>,
|
||||
attributes are shared by all channels of the same type</listitem>
|
||||
<listitem><emphasis>info_mask_shared_by_dir</emphasis>, attributes
|
||||
are shared by all channels of the same direction </listitem>
|
||||
<listitem><emphasis>info_mask_shared_by_all</emphasis>,
|
||||
attributes are shared by all channels</listitem>
|
||||
</itemizedlist>
|
||||
When there are multiple data channels per channel type we have two
|
||||
ways to distinguish between them:
|
||||
<itemizedlist>
|
||||
<listitem> set <emphasis> .modified</emphasis> field of <type>
|
||||
iio_chan_spec</type> to 1. Modifiers are specified using
|
||||
<emphasis>.channel2</emphasis> field of the same
|
||||
<type>iio_chan_spec</type> structure and are used to indicate a
|
||||
physically unique characteristic of the channel such as its direction
|
||||
or spectral response. For example, a light sensor can have two channels,
|
||||
one for infrared light and one for both infrared and visible light.
|
||||
</listitem>
|
||||
<listitem> set <emphasis>.indexed </emphasis> field of
|
||||
<type>iio_chan_spec</type> to 1. In this case the channel is
|
||||
simply another instance with an index specified by the
|
||||
<emphasis>.channel</emphasis> field.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
Here is how we can make use of the channel's modifiers:
|
||||
<programlisting>
|
||||
static const struct iio_chan_spec light_channels[] = {
|
||||
{
|
||||
.type = IIO_INTENSITY,
|
||||
.modified = 1,
|
||||
.channel2 = IIO_MOD_LIGHT_IR,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
|
||||
.info_mask_shared = BIT(IIO_CHAN_INFO_SAMP_FREQ),
|
||||
},
|
||||
{
|
||||
.type = IIO_INTENSITY,
|
||||
.modified = 1,
|
||||
.channel2 = IIO_MOD_LIGHT_BOTH,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
|
||||
.info_mask_shared = BIT(IIO_CHAN_INFO_SAMP_FREQ),
|
||||
},
|
||||
{
|
||||
.type = IIO_LIGHT,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
|
||||
.info_mask_shared = BIT(IIO_CHAN_INFO_SAMP_FREQ),
|
||||
},
|
||||
|
||||
}
|
||||
</programlisting>
|
||||
This channel's definition will generate two separate sysfs files
|
||||
for raw data retrieval:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<filename>/sys/bus/iio/iio:deviceX/in_intensity_ir_raw</filename>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<filename>/sys/bus/iio/iio:deviceX/in_intensity_both_raw</filename>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
one file for processed data:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<filename>/sys/bus/iio/iio:deviceX/in_illuminance_input
|
||||
</filename>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
and one shared sysfs file for sampling frequency:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<filename>/sys/bus/iio/iio:deviceX/sampling_frequency.
|
||||
</filename>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Here is how we can make use of the channel's indexing:
|
||||
<programlisting>
|
||||
static const struct iio_chan_spec light_channels[] = {
|
||||
{
|
||||
.type = IIO_VOLTAGE,
|
||||
.indexed = 1,
|
||||
.channel = 0,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
|
||||
},
|
||||
{
|
||||
.type = IIO_VOLTAGE,
|
||||
.indexed = 1,
|
||||
.channel = 1,
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
|
||||
},
|
||||
}
|
||||
</programlisting>
|
||||
This will generate two separate attributes files for raw data
|
||||
retrieval:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<filename>/sys/bus/iio/devices/iio:deviceX/in_voltage0_raw</filename>,
|
||||
representing voltage measurement for channel 0.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<filename>/sys/bus/iio/devices/iio:deviceX/in_voltage1_raw</filename>,
|
||||
representing voltage measurement for channel 1.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="iiobuffer"> <title> Industrial I/O buffers </title>
|
||||
!Finclude/linux/iio/buffer.h iio_buffer
|
||||
!Edrivers/iio/industrialio-buffer.c
|
||||
|
||||
<para>
|
||||
The Industrial I/O core offers a way for continuous data capture
|
||||
based on a trigger source. Multiple data channels can be read at once
|
||||
from <filename>/dev/iio:deviceX</filename> character device node,
|
||||
thus reducing the CPU load.
|
||||
</para>
|
||||
|
||||
<sect2 id="iiobuffersysfs">
|
||||
<title>IIO buffer sysfs interface </title>
|
||||
<para>
|
||||
An IIO buffer has an associated attributes directory under <filename>
|
||||
/sys/bus/iio/iio:deviceX/buffer/</filename>. Here are the existing
|
||||
attributes:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<emphasis>length</emphasis>, the total number of data samples
|
||||
(capacity) that can be stored by the buffer.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<emphasis>enable</emphasis>, activate buffer capture.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2 id="iiobuffersetup"> <title> IIO buffer setup </title>
|
||||
<para>The meta information associated with a channel reading
|
||||
placed in a buffer is called a <emphasis> scan element </emphasis>.
|
||||
The important bits configuring scan elements are exposed to
|
||||
userspace applications via the <filename>
|
||||
/sys/bus/iio/iio:deviceX/scan_elements/</filename> directory. This
|
||||
file contains attributes of the following form:
|
||||
<itemizedlist>
|
||||
<listitem><emphasis>enable</emphasis>, used for enabling a channel.
|
||||
If and only if its attribute is non zero, then a triggered capture
|
||||
will contain data samples for this channel.
|
||||
</listitem>
|
||||
<listitem><emphasis>type</emphasis>, description of the scan element
|
||||
data storage within the buffer and hence the form in which it is
|
||||
read from user space. Format is <emphasis>
|
||||
[be|le]:[s|u]bits/storagebitsXrepeat[>>shift] </emphasis>.
|
||||
<itemizedlist>
|
||||
<listitem> <emphasis>be</emphasis> or <emphasis>le</emphasis>, specifies
|
||||
big or little endian.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<emphasis>s </emphasis>or <emphasis>u</emphasis>, specifies if
|
||||
signed (2's complement) or unsigned.
|
||||
</listitem>
|
||||
<listitem><emphasis>bits</emphasis>, is the number of valid data
|
||||
bits.
|
||||
</listitem>
|
||||
<listitem><emphasis>storagebits</emphasis>, is the number of bits
|
||||
(after padding) that it occupies in the buffer.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<emphasis>shift</emphasis>, if specified, is the shift that needs
|
||||
to be applied prior to masking out unused bits.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<emphasis>repeat</emphasis>, specifies the number of bits/storagebits
|
||||
repetitions. When the repeat element is 0 or 1, then the repeat
|
||||
value is omitted.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
For example, a driver for a 3-axis accelerometer with 12 bit
|
||||
resolution where data is stored in two 8-bits registers as
|
||||
follows:
|
||||
<programlisting>
|
||||
7 6 5 4 3 2 1 0
|
||||
+---+---+---+---+---+---+---+---+
|
||||
|D3 |D2 |D1 |D0 | X | X | X | X | (LOW byte, address 0x06)
|
||||
+---+---+---+---+---+---+---+---+
|
||||
|
||||
7 6 5 4 3 2 1 0
|
||||
+---+---+---+---+---+---+---+---+
|
||||
|D11|D10|D9 |D8 |D7 |D6 |D5 |D4 | (HIGH byte, address 0x07)
|
||||
+---+---+---+---+---+---+---+---+
|
||||
</programlisting>
|
||||
|
||||
will have the following scan element type for each axis:
|
||||
<programlisting>
|
||||
$ cat /sys/bus/iio/devices/iio:device0/scan_elements/in_accel_y_type
|
||||
le:s12/16>>4
|
||||
</programlisting>
|
||||
A user space application will interpret data samples read from the
|
||||
buffer as two byte little endian signed data, that needs a 4 bits
|
||||
right shift before masking out the 12 valid bits of data.
|
||||
</para>
|
||||
<para>
|
||||
For implementing buffer support a driver should initialize the following
|
||||
fields in <type>iio_chan_spec</type> definition:
|
||||
<programlisting>
|
||||
struct iio_chan_spec {
|
||||
/* other members */
|
||||
int scan_index
|
||||
struct {
|
||||
char sign;
|
||||
u8 realbits;
|
||||
u8 storagebits;
|
||||
u8 shift;
|
||||
u8 repeat;
|
||||
enum iio_endian endianness;
|
||||
} scan_type;
|
||||
};
|
||||
</programlisting>
|
||||
The driver implementing the accelerometer described above will
|
||||
have the following channel definition:
|
||||
<programlisting>
|
||||
struct struct iio_chan_spec accel_channels[] = {
|
||||
{
|
||||
.type = IIO_ACCEL,
|
||||
.modified = 1,
|
||||
.channel2 = IIO_MOD_X,
|
||||
/* other stuff here */
|
||||
.scan_index = 0,
|
||||
.scan_type = {
|
||||
.sign = 's',
|
||||
.realbits = 12,
|
||||
.storagebits = 16,
|
||||
.shift = 4,
|
||||
.endianness = IIO_LE,
|
||||
},
|
||||
}
|
||||
/* similar for Y (with channel2 = IIO_MOD_Y, scan_index = 1)
|
||||
* and Z (with channel2 = IIO_MOD_Z, scan_index = 2) axis
|
||||
*/
|
||||
}
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Here <emphasis> scan_index </emphasis> defines the order in which
|
||||
the enabled channels are placed inside the buffer. Channels with a lower
|
||||
scan_index will be placed before channels with a higher index. Each
|
||||
channel needs to have a unique scan_index.
|
||||
</para>
|
||||
<para>
|
||||
Setting scan_index to -1 can be used to indicate that the specific
|
||||
channel does not support buffered capture. In this case no entries will
|
||||
be created for the channel in the scan_elements directory.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="iiotrigger"> <title> Industrial I/O triggers </title>
|
||||
!Finclude/linux/iio/trigger.h iio_trigger
|
||||
!Edrivers/iio/industrialio-trigger.c
|
||||
<para>
|
||||
In many situations it is useful for a driver to be able to
|
||||
capture data based on some external event (trigger) as opposed
|
||||
to periodically polling for data. An IIO trigger can be provided
|
||||
by a device driver that also has an IIO device based on hardware
|
||||
generated events (e.g. data ready or threshold exceeded) or
|
||||
provided by a separate driver from an independent interrupt
|
||||
source (e.g. GPIO line connected to some external system, timer
|
||||
interrupt or user space writing a specific file in sysfs). A
|
||||
trigger may initiate data capture for a number of sensors and
|
||||
also it may be completely unrelated to the sensor itself.
|
||||
</para>
|
||||
|
||||
<sect2 id="iiotrigsysfs"> <title> IIO trigger sysfs interface </title>
|
||||
There are two locations in sysfs related to triggers:
|
||||
<itemizedlist>
|
||||
<listitem><filename>/sys/bus/iio/devices/triggerY</filename>,
|
||||
this file is created once an IIO trigger is registered with
|
||||
the IIO core and corresponds to trigger with index Y. Because
|
||||
triggers can be very different depending on type there are few
|
||||
standard attributes that we can describe here:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<emphasis>name</emphasis>, trigger name that can be later
|
||||
used for association with a device.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<emphasis>sampling_frequency</emphasis>, some timer based
|
||||
triggers use this attribute to specify the frequency for
|
||||
trigger calls.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<filename>/sys/bus/iio/devices/iio:deviceX/trigger/</filename>, this
|
||||
directory is created once the device supports a triggered
|
||||
buffer. We can associate a trigger with our device by writing
|
||||
the trigger's name in the <filename>current_trigger</filename> file.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="iiotrigattr"> <title> IIO trigger setup</title>
|
||||
|
||||
<para>
|
||||
Let's see a simple example of how to setup a trigger to be used
|
||||
by a driver.
|
||||
|
||||
<programlisting>
|
||||
struct iio_trigger_ops trigger_ops = {
|
||||
.set_trigger_state = sample_trigger_state,
|
||||
.validate_device = sample_validate_device,
|
||||
}
|
||||
|
||||
struct iio_trigger *trig;
|
||||
|
||||
/* first, allocate memory for our trigger */
|
||||
trig = iio_trigger_alloc(dev, "trig-%s-%d", name, idx);
|
||||
|
||||
/* setup trigger operations field */
|
||||
trig->ops = &trigger_ops;
|
||||
|
||||
/* now register the trigger with the IIO core */
|
||||
iio_trigger_register(trig);
|
||||
</programlisting>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="iiotrigsetup"> <title> IIO trigger ops</title>
|
||||
!Finclude/linux/iio/trigger.h iio_trigger_ops
|
||||
<para>
|
||||
Notice that a trigger has a set of operations attached:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<function>set_trigger_state</function>, switch the trigger on/off
|
||||
on demand.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<function>validate_device</function>, function to validate the
|
||||
device when the current trigger gets changed.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 id="iiotriggered_buffer">
|
||||
<title> Industrial I/O triggered buffers </title>
|
||||
<para>
|
||||
Now that we know what buffers and triggers are let's see how they
|
||||
work together.
|
||||
</para>
|
||||
<sect2 id="iiotrigbufsetup"> <title> IIO triggered buffer setup</title>
|
||||
!Edrivers/iio/buffer/industrialio-triggered-buffer.c
|
||||
!Finclude/linux/iio/iio.h iio_buffer_setup_ops
|
||||
|
||||
|
||||
<para>
|
||||
A typical triggered buffer setup looks like this:
|
||||
<programlisting>
|
||||
const struct iio_buffer_setup_ops sensor_buffer_setup_ops = {
|
||||
.preenable = sensor_buffer_preenable,
|
||||
.postenable = sensor_buffer_postenable,
|
||||
.postdisable = sensor_buffer_postdisable,
|
||||
.predisable = sensor_buffer_predisable,
|
||||
};
|
||||
|
||||
irqreturn_t sensor_iio_pollfunc(int irq, void *p)
|
||||
{
|
||||
pf->timestamp = iio_get_time_ns((struct indio_dev *)p);
|
||||
return IRQ_WAKE_THREAD;
|
||||
}
|
||||
|
||||
irqreturn_t sensor_trigger_handler(int irq, void *p)
|
||||
{
|
||||
u16 buf[8];
|
||||
int i = 0;
|
||||
|
||||
/* read data for each active channel */
|
||||
for_each_set_bit(bit, active_scan_mask, masklength)
|
||||
buf[i++] = sensor_get_data(bit)
|
||||
|
||||
iio_push_to_buffers_with_timestamp(indio_dev, buf, timestamp);
|
||||
|
||||
iio_trigger_notify_done(trigger);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
/* setup triggered buffer, usually in probe function */
|
||||
iio_triggered_buffer_setup(indio_dev, sensor_iio_polfunc,
|
||||
sensor_trigger_handler,
|
||||
sensor_buffer_setup_ops);
|
||||
</programlisting>
|
||||
</para>
|
||||
The important things to notice here are:
|
||||
<itemizedlist>
|
||||
<listitem><function> iio_buffer_setup_ops</function>, the buffer setup
|
||||
functions to be called at predefined points in the buffer configuration
|
||||
sequence (e.g. before enable, after disable). If not specified, the
|
||||
IIO core uses the default <type>iio_triggered_buffer_setup_ops</type>.
|
||||
</listitem>
|
||||
<listitem><function>sensor_iio_pollfunc</function>, the function that
|
||||
will be used as top half of poll function. It should do as little
|
||||
processing as possible, because it runs in interrupt context. The most
|
||||
common operation is recording of the current timestamp and for this reason
|
||||
one can use the IIO core defined <function>iio_pollfunc_store_time
|
||||
</function> function.
|
||||
</listitem>
|
||||
<listitem><function>sensor_trigger_handler</function>, the function that
|
||||
will be used as bottom half of the poll function. This runs in the
|
||||
context of a kernel thread and all the processing takes place here.
|
||||
It usually reads data from the device and stores it in the internal
|
||||
buffer together with the timestamp recorded in the top half.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</sect2>
|
||||
</sect1>
|
||||
</chapter>
|
||||
<chapter id='iioresources'>
|
||||
<title> Resources </title>
|
||||
IIO core may change during time so the best documentation to read is the
|
||||
source code. There are several locations where you should look:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<filename>drivers/iio/</filename>, contains the IIO core plus
|
||||
and directories for each sensor type (e.g. accel, magnetometer,
|
||||
etc.)
|
||||
</listitem>
|
||||
<listitem>
|
||||
<filename>include/linux/iio/</filename>, contains the header
|
||||
files, nice to read for the internal kernel interfaces.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<filename>include/uapi/linux/iio/</filename>, contains files to be
|
||||
used by user space applications.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<filename>tools/iio/</filename>, contains tools for rapidly
|
||||
testing buffers, events and device creation.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<filename>drivers/staging/iio/</filename>, contains code for some
|
||||
drivers or experimental features that are not yet mature enough
|
||||
to be moved out.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
Besides the code, there are some good online documentation sources:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<ulink url="http://marc.info/?l=linux-iio"> Industrial I/O mailing
|
||||
list </ulink>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<ulink url="http://wiki.analog.com/software/linux/docs/iio/iio">
|
||||
Analog Device IIO wiki page </ulink>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<ulink url="https://fosdem.org/2015/schedule/event/iiosdr/">
|
||||
Using the Linux IIO framework for SDR, Lars-Peter Clausen's
|
||||
presentation at FOSDEM </ulink>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</chapter>
|
||||
</book>
|
||||
|
||||
<!--
|
||||
vim: softtabstop=2:shiftwidth=2:expandtab:textwidth=72
|
||||
-->
|
|
@ -115,12 +115,12 @@
|
|||
</para>
|
||||
<para>
|
||||
If the architecture that you are using supports the kernel option
|
||||
CONFIG_DEBUG_RODATA, you should consider turning it off. This
|
||||
CONFIG_STRICT_KERNEL_RWX, you should consider turning it off. This
|
||||
option will prevent the use of software breakpoints because it
|
||||
marks certain regions of the kernel's memory space as read-only.
|
||||
If kgdb supports it for the architecture you are using, you can
|
||||
use hardware breakpoints if you desire to run with the
|
||||
CONFIG_DEBUG_RODATA option turned on, else you need to turn off
|
||||
CONFIG_STRICT_KERNEL_RWX option turned on, else you need to turn off
|
||||
this option.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -135,7 +135,7 @@
|
|||
<para>Here is an example set of .config symbols to enable or
|
||||
disable for kgdb:
|
||||
<itemizedlist>
|
||||
<listitem><para># CONFIG_DEBUG_RODATA is not set</para></listitem>
|
||||
<listitem><para># CONFIG_STRICT_KERNEL_RWX is not set</para></listitem>
|
||||
<listitem><para>CONFIG_FRAME_POINTER=y</para></listitem>
|
||||
<listitem><para>CONFIG_KGDB=y</para></listitem>
|
||||
<listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem>
|
||||
|
@ -166,7 +166,7 @@
|
|||
</para>
|
||||
<para>Here is an example set of .config symbols to enable/disable kdb:
|
||||
<itemizedlist>
|
||||
<listitem><para># CONFIG_DEBUG_RODATA is not set</para></listitem>
|
||||
<listitem><para># CONFIG_STRICT_KERNEL_RWX is not set</para></listitem>
|
||||
<listitem><para>CONFIG_FRAME_POINTER=y</para></listitem>
|
||||
<listitem><para>CONFIG_KGDB=y</para></listitem>
|
||||
<listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem>
|
||||
|
|
|
@ -1020,7 +1020,7 @@ and other resources, etc.
|
|||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
Of errors detected as above, the followings are not ATA/ATAPI
|
||||
Of errors detected as above, the following are not ATA/ATAPI
|
||||
device errors but ATA bus errors and should be handled
|
||||
according to <xref linkend="excatATAbusErr"/>.
|
||||
</para>
|
||||
|
|
|
@ -1,304 +0,0 @@
|
|||
<?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
|
||||
regulator 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 defining the connections the machine interface
|
||||
also provides constraints defining 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>
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -257,7 +257,7 @@ and tell you when they come and go.
|
|||
|
||||
Creating the User
|
||||
|
||||
To user the message handler, you must first create a user using
|
||||
To use the message handler, you must first create a user using
|
||||
ipmi_create_user. The interface number specifies which SMI you want
|
||||
to connect to, and you must supply callback functions to be called
|
||||
when data comes in. The callback function can run at interrupt level,
|
||||
|
|
|
@ -43,7 +43,7 @@ ALLSPHINXOPTS = $(KERNELDOC_CONF) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS)
|
|||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
# commands; the 'cmd' from scripts/Kbuild.include is not *loopable*
|
||||
loop_cmd = $(echo-cmd) $(cmd_$(1))
|
||||
loop_cmd = $(echo-cmd) $(cmd_$(1)) || exit;
|
||||
|
||||
# $2 sphinx builder e.g. "html"
|
||||
# $3 name of the build subfolder / e.g. "media", used as:
|
||||
|
@ -54,7 +54,8 @@ loop_cmd = $(echo-cmd) $(cmd_$(1))
|
|||
# e.g. "media" for the linux-tv book-set at ./Documentation/media
|
||||
|
||||
quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
|
||||
cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media $2;\
|
||||
cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media $2 && \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \
|
||||
$(SPHINXBUILD) \
|
||||
-b $2 \
|
||||
|
@ -63,13 +64,16 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
|
|||
-D version=$(KERNELVERSION) -D release=$(KERNELRELEASE) \
|
||||
$(ALLSPHINXOPTS) \
|
||||
$(abspath $(srctree)/$(src)/$5) \
|
||||
$(abspath $(BUILDDIR)/$3/$4);
|
||||
$(abspath $(BUILDDIR)/$3/$4)
|
||||
|
||||
htmldocs:
|
||||
@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
|
||||
@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
|
||||
|
||||
linkcheckdocs:
|
||||
@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
|
||||
|
||||
latexdocs:
|
||||
@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))
|
||||
@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))
|
||||
|
||||
ifeq ($(HAVE_PDFLATEX),0)
|
||||
|
||||
|
@ -80,27 +84,34 @@ pdfdocs:
|
|||
else # HAVE_PDFLATEX
|
||||
|
||||
pdfdocs: latexdocs
|
||||
$(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX=$(PDFLATEX) LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex;)
|
||||
$(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX=$(PDFLATEX) LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit;)
|
||||
|
||||
endif # HAVE_PDFLATEX
|
||||
|
||||
epubdocs:
|
||||
@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))
|
||||
@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))
|
||||
|
||||
xmldocs:
|
||||
@$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var)))
|
||||
@+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var)))
|
||||
|
||||
endif # HAVE_SPHINX
|
||||
|
||||
# The following targets are independent of HAVE_SPHINX, and the rules should
|
||||
# work or silently pass without Sphinx.
|
||||
|
||||
# no-ops for the Sphinx toolchain
|
||||
sgmldocs:
|
||||
@:
|
||||
psdocs:
|
||||
@:
|
||||
mandocs:
|
||||
@:
|
||||
installmandocs:
|
||||
@:
|
||||
|
||||
cleandocs:
|
||||
$(Q)rm -rf $(BUILDDIR)
|
||||
$(Q)$(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) -C Documentation/media clean
|
||||
|
||||
endif # HAVE_SPHINX
|
||||
$(Q)$(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media clean
|
||||
|
||||
dochelp:
|
||||
@echo ' Linux kernel internal documentation in different formats (Sphinx):'
|
||||
|
@ -109,6 +120,7 @@ dochelp:
|
|||
@echo ' pdfdocs - PDF'
|
||||
@echo ' epubdocs - EPUB'
|
||||
@echo ' xmldocs - XML'
|
||||
@echo ' linkcheckdocs - check for broken external links (will connect to external hosts)'
|
||||
@echo ' cleandocs - clean all generated files'
|
||||
@echo
|
||||
@echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2'
|
||||
|
|
|
@ -162,8 +162,6 @@ The following old APIs to enable and disable MSI or MSI-X interrupts should
|
|||
not be used in new code:
|
||||
|
||||
pci_enable_msi() /* deprecated */
|
||||
pci_enable_msi_range() /* deprecated */
|
||||
pci_enable_msi_exact() /* deprecated */
|
||||
pci_disable_msi() /* deprecated */
|
||||
pci_enable_msix_range() /* deprecated */
|
||||
pci_enable_msix_exact() /* deprecated */
|
||||
|
@ -268,5 +266,5 @@ or disabled (0). If 0 is found in any of the msi_bus files belonging
|
|||
to bridges between the PCI root and the device, MSIs are disabled.
|
||||
|
||||
It is also worth checking the device driver to see whether it supports MSIs.
|
||||
For example, it may contain calls to pci_enable_msi_range() or
|
||||
pci_enable_msix_range().
|
||||
For example, it may contain calls to pci_irq_alloc_vectors() with the
|
||||
PCI_IRQ_MSI or PCI_IRQ_MSIX flags.
|
||||
|
|
|
@ -161,21 +161,13 @@ Since all service drivers of a PCI-PCI Bridge Port device are
|
|||
allowed to run simultaneously, below lists a few of possible resource
|
||||
conflicts with proposed solutions.
|
||||
|
||||
6.1 MSI Vector Resource
|
||||
6.1 MSI and MSI-X Vector Resource
|
||||
|
||||
The MSI capability structure enables a device software driver to call
|
||||
pci_enable_msi to request MSI based interrupts. Once MSI interrupts
|
||||
are enabled on a device, it stays in this mode until a device driver
|
||||
calls pci_disable_msi to disable MSI interrupts and revert back to
|
||||
INTx emulation mode. Since service drivers of the same PCI-PCI Bridge
|
||||
port share the same physical device, if an individual service driver
|
||||
calls pci_enable_msi/pci_disable_msi it may result unpredictable
|
||||
behavior. For example, two service drivers run simultaneously on the
|
||||
same physical Root Port. Both service drivers call pci_enable_msi to
|
||||
request MSI based interrupts. A service driver may not know whether
|
||||
any other service drivers have run on this Root Port. If either one
|
||||
of them calls pci_disable_msi, it puts the other service driver
|
||||
in a wrong interrupt mode.
|
||||
Once MSI or MSI-X interrupts are enabled on a device, it stays in this
|
||||
mode until they are disabled again. Since service drivers of the same
|
||||
PCI-PCI Bridge port share the same physical device, if an individual
|
||||
service driver enables or disables MSI/MSI-X mode it may result
|
||||
unpredictable behavior.
|
||||
|
||||
To avoid this situation all service drivers are not permitted to
|
||||
switch interrupt mode on its device. The PCI Express Port Bus driver
|
||||
|
@ -187,17 +179,6 @@ driver. Service drivers should use (struct pcie_device*)dev->irq to
|
|||
call request_irq/free_irq. In addition, the interrupt mode is stored
|
||||
in the field interrupt_mode of struct pcie_device.
|
||||
|
||||
6.2 MSI-X Vector Resources
|
||||
|
||||
Similar to the MSI a device driver for an MSI-X capable device can
|
||||
call pci_enable_msix to request MSI-X interrupts. All service drivers
|
||||
are not permitted to switch interrupt mode on its device. The PCI
|
||||
Express Port Bus driver is responsible for determining the interrupt
|
||||
mode and this should be transparent to service drivers. Any attempt
|
||||
by service driver to call pci_enable_msix/pci_disable_msix may
|
||||
result unpredictable behavior. Service drivers should use
|
||||
(struct pcie_device*)dev->irq and call request_irq/free_irq.
|
||||
|
||||
6.3 PCI Memory/IO Mapped Regions
|
||||
|
||||
Service drivers for PCI Express Power Management (PME), Advanced
|
||||
|
|
|
@ -78,7 +78,6 @@ struct pci_error_handlers
|
|||
{
|
||||
int (*error_detected)(struct pci_dev *dev, enum pci_channel_state);
|
||||
int (*mmio_enabled)(struct pci_dev *dev);
|
||||
int (*link_reset)(struct pci_dev *dev);
|
||||
int (*slot_reset)(struct pci_dev *dev);
|
||||
void (*resume)(struct pci_dev *dev);
|
||||
};
|
||||
|
@ -104,8 +103,7 @@ if it implements any, it must implement error_detected(). If a callback
|
|||
is not implemented, the corresponding feature is considered unsupported.
|
||||
For example, if mmio_enabled() and resume() aren't there, then it
|
||||
is assumed that the driver is not doing any direct recovery and requires
|
||||
a slot reset. If link_reset() is not implemented, the card is assumed to
|
||||
not care about link resets. Typically a driver will want to know about
|
||||
a slot reset. Typically a driver will want to know about
|
||||
a slot_reset().
|
||||
|
||||
The actual steps taken by a platform to recover from a PCI error
|
||||
|
@ -232,25 +230,9 @@ proceeds to STEP 4 (Slot Reset)
|
|||
|
||||
STEP 3: Link Reset
|
||||
------------------
|
||||
The platform resets the link, and then calls the link_reset() callback
|
||||
on all affected device drivers. This is a PCI-Express specific state
|
||||
The platform resets the link. This is a PCI-Express specific step
|
||||
and is done whenever a non-fatal error has been detected that can be
|
||||
"solved" by resetting the link. This call informs the driver of the
|
||||
reset and the driver should check to see if the device appears to be
|
||||
in working condition.
|
||||
|
||||
The driver is not supposed to restart normal driver I/O operations
|
||||
at this point. It should limit itself to "probing" the device to
|
||||
check its recoverability status. If all is right, then the platform
|
||||
will call resume() once all drivers have ack'd link_reset().
|
||||
|
||||
Result codes:
|
||||
(identical to STEP 3 (MMIO Enabled)
|
||||
|
||||
The platform then proceeds to either STEP 4 (Slot Reset) or STEP 5
|
||||
(Resume Operations).
|
||||
|
||||
>>> The current powerpc implementation does not implement this callback.
|
||||
"solved" by resetting the link.
|
||||
|
||||
STEP 4: Slot Reset
|
||||
------------------
|
||||
|
|
|
@ -382,18 +382,18 @@ The fundamental difference between MSI and MSI-X is how multiple
|
|||
"vectors" get allocated. MSI requires contiguous blocks of vectors
|
||||
while MSI-X can allocate several individual ones.
|
||||
|
||||
MSI capability can be enabled by calling pci_enable_msi() or
|
||||
pci_enable_msix() before calling request_irq(). This causes
|
||||
the PCI support to program CPU vector data into the PCI device
|
||||
capability registers.
|
||||
MSI capability can be enabled by calling pci_alloc_irq_vectors() with the
|
||||
PCI_IRQ_MSI and/or PCI_IRQ_MSIX flags before calling request_irq(). This
|
||||
causes the PCI support to program CPU vector data into the PCI device
|
||||
capability registers. Many architectures, chip-sets, or BIOSes do NOT
|
||||
support MSI or MSI-X and a call to pci_alloc_irq_vectors with just
|
||||
the PCI_IRQ_MSI and PCI_IRQ_MSIX flags will fail, so try to always
|
||||
specify PCI_IRQ_LEGACY as well.
|
||||
|
||||
If your PCI device supports both, try to enable MSI-X first.
|
||||
Only one can be enabled at a time. Many architectures, chip-sets,
|
||||
or BIOSes do NOT support MSI or MSI-X and the call to pci_enable_msi/msix
|
||||
will fail. This is important to note since many drivers have
|
||||
two (or more) interrupt handlers: one for MSI/MSI-X and another for IRQs.
|
||||
They choose which handler to register with request_irq() based on the
|
||||
return value from pci_enable_msi/msix().
|
||||
Drivers that have different interrupt handlers for MSI/MSI-X and
|
||||
legacy INTx should chose the right one based on the msi_enabled
|
||||
and msix_enabled flags in the pci_dev structure after calling
|
||||
pci_alloc_irq_vectors.
|
||||
|
||||
There are (at least) two really good reasons for using MSI:
|
||||
1) MSI is an exclusive interrupt vector by definition.
|
||||
|
|
|
@ -256,7 +256,7 @@ After reboot with new kernel or insert the module, a device file named
|
|||
|
||||
Then, you need a user space tool named aer-inject, which can be gotten
|
||||
from:
|
||||
http://www.kernel.org/pub/linux/utils/pci/aer-inject/
|
||||
https://git.kernel.org/cgit/linux/kernel/git/gong.chen/aer-inject.git/
|
||||
|
||||
More information about aer-inject can be found in the document comes
|
||||
with its source code.
|
||||
|
|
|
@ -57,7 +57,7 @@ Note: To get the ACPI debug object output (Store (AAAA, Debug)),
|
|||
3. undo your changes
|
||||
The "undo" operation is not supported for a new inserted method
|
||||
right now, i.e. we can not remove a method currently.
|
||||
For an overrided method, in order to undo your changes, please
|
||||
For an overridden method, in order to undo your changes, please
|
||||
save a copy of the method original ASL code in step c) section 1,
|
||||
and redo step c) ~ g) to override the method with the original one.
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ tracing facility.
|
|||
Users can enable/disable this debug tracing feature by executing
|
||||
the following command:
|
||||
# echo string > /sys/module/acpi/parameters/trace_state
|
||||
Where "string" should be one of the followings:
|
||||
Where "string" should be one of the following:
|
||||
"disable"
|
||||
Disable the method tracing feature.
|
||||
"enable"
|
||||
|
|
|
@ -17,7 +17,7 @@ What is Linux?
|
|||
loading, shared copy-on-write executables, proper memory management,
|
||||
and multistack networking including IPv4 and IPv6.
|
||||
|
||||
It is distributed under the GNU General Public License - see the
|
||||
It is distributed under the GNU General Public License v2 - see the
|
||||
accompanying COPYING file for more details.
|
||||
|
||||
On what hardware does it run?
|
||||
|
@ -236,7 +236,7 @@ Configuring the kernel
|
|||
|
||||
- Having unnecessary drivers will make the kernel bigger, and can
|
||||
under some circumstances lead to problems: probing for a
|
||||
nonexistent controller card may confuse your other controllers
|
||||
nonexistent controller card may confuse your other controllers.
|
||||
|
||||
- A kernel with math-emulation compiled in will still use the
|
||||
coprocessor if one is present: the math emulation will just
|
||||
|
|
|
@ -93,9 +93,9 @@ Command Language Reference
|
|||
At the lexical level, a command comprises a sequence of words separated
|
||||
by spaces or tabs. So these are all equivalent::
|
||||
|
||||
nullarbor:~ # echo -c 'file svcsock.c line 1603 +p' >
|
||||
nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
|
||||
<debugfs>/dynamic_debug/control
|
||||
nullarbor:~ # echo -c ' file svcsock.c line 1603 +p ' >
|
||||
nullarbor:~ # echo -n ' file svcsock.c line 1603 +p ' >
|
||||
<debugfs>/dynamic_debug/control
|
||||
nullarbor:~ # echo -n 'file svcsock.c line 1603 +p' >
|
||||
<debugfs>/dynamic_debug/control
|
||||
|
|
|
@ -653,6 +653,9 @@
|
|||
cpuidle.off=1 [CPU_IDLE]
|
||||
disable the cpuidle sub-system
|
||||
|
||||
cpufreq.off=1 [CPU_FREQ]
|
||||
disable the cpufreq sub-system
|
||||
|
||||
cpu_init_udelay=N
|
||||
[X86] Delay for N microsec between assert and de-assert
|
||||
of APIC INIT to start processors. This delay occurs
|
||||
|
@ -957,6 +960,12 @@
|
|||
serial port must already be setup and configured.
|
||||
Options are not yet supported.
|
||||
|
||||
lantiq,<addr>
|
||||
Start an early, polled-mode console on a lantiq serial
|
||||
(lqasc) port at the specified address. The serial port
|
||||
must already be setup and configured. Options are not
|
||||
yet supported.
|
||||
|
||||
lpuart,<addr>
|
||||
lpuart32,<addr>
|
||||
Use early console provided by Freescale LP UART driver
|
||||
|
@ -970,9 +979,10 @@
|
|||
address. The serial port must already be setup
|
||||
and configured. Options are not yet supported.
|
||||
|
||||
earlyprintk= [X86,SH,BLACKFIN,ARM,M68k]
|
||||
earlyprintk= [X86,SH,BLACKFIN,ARM,M68k,S390]
|
||||
earlyprintk=vga
|
||||
earlyprintk=efi
|
||||
earlyprintk=sclp
|
||||
earlyprintk=xen
|
||||
earlyprintk=serial[,ttySn[,baudrate]]
|
||||
earlyprintk=serial[,0x...[,baudrate]]
|
||||
|
@ -1007,6 +1017,8 @@
|
|||
|
||||
The xen output can only be used by Xen PV guests.
|
||||
|
||||
The sclp output can only be used on s390.
|
||||
|
||||
edac_report= [HW,EDAC] Control how to report EDAC event
|
||||
Format: {"on" | "off" | "force"}
|
||||
on: enable EDAC to report H/W event. May be overridden
|
||||
|
@ -1174,6 +1186,12 @@
|
|||
functions that can be changed at run time by the
|
||||
set_graph_notrace file in the debugfs tracing directory.
|
||||
|
||||
ftrace_graph_max_depth=<uint>
|
||||
[FTRACE] Used with the function graph tracer. This is
|
||||
the max depth it will trace into a function. This value
|
||||
can be changed at run time by the max_graph_depth file
|
||||
in the tracefs tracing directory. default: 0 (no limit)
|
||||
|
||||
gamecon.map[2|3]=
|
||||
[HW,JOY] Multisystem joystick and NES/SNES/PSX pad
|
||||
support via parallel port (up to 5 devices per port)
|
||||
|
@ -1192,6 +1210,10 @@
|
|||
When zero, profiling data is discarded and associated
|
||||
debugfs files are removed at module unload time.
|
||||
|
||||
goldfish [X86] Enable the goldfish android emulator platform.
|
||||
Don't use this when you are not running on the
|
||||
android emulator
|
||||
|
||||
gpt [EFI] Forces disk with valid GPT signature but
|
||||
invalid Protective MBR to be treated as GPT. If the
|
||||
primary GPT is corrupted, it enables the backup/alternate
|
||||
|
@ -3681,6 +3703,14 @@
|
|||
last alloc / free. For more information see
|
||||
Documentation/vm/slub.txt.
|
||||
|
||||
slub_memcg_sysfs= [MM, SLUB]
|
||||
Determines whether to enable sysfs directories for
|
||||
memory cgroup sub-caches. 1 to enable, 0 to disable.
|
||||
The default is determined by CONFIG_SLUB_MEMCG_SYSFS_ON.
|
||||
Enabling this can lead to a very high number of debug
|
||||
directories and files being created under
|
||||
/sys/kernel/slub.
|
||||
|
||||
slub_max_order= [MM, SLUB]
|
||||
Determines the maximum allowed order for slabs.
|
||||
A high setting may cause OOMs due to memory
|
||||
|
|
|
@ -725,3 +725,8 @@ These currently include:
|
|||
to 1. Setting this to 0 disables bypass accounting and
|
||||
requires preread stripes to wait until all full-width stripe-
|
||||
writes are complete. Valid values are 0 to stripe_cache_size.
|
||||
|
||||
journal_mode (currently raid5 only)
|
||||
The cache mode for raid5. raid5 could include an extra disk for
|
||||
caching. The mode can be "write-throuth" and "write-back". The
|
||||
default is "write-through".
|
||||
|
|
|
@ -81,7 +81,7 @@ That defines some categories of errors:
|
|||
still run, eventually replacing the affected hardware by a hot spare,
|
||||
if available.
|
||||
|
||||
Also, when an error happens on an userspace process, it is also possible to
|
||||
Also, when an error happens on a userspace process, it is also possible to
|
||||
kill such process and let userspace restart it.
|
||||
|
||||
The mechanism for handling non-fatal errors is usually complex and may
|
||||
|
|
|
@ -63,10 +63,18 @@ SunXi family
|
|||
+ User Manual
|
||||
http://dl.linux-sunxi.org/A33/A33%20user%20manual%20release%201.1.pdf
|
||||
|
||||
- Allwinner H2+ (sun8i)
|
||||
+ No document available now, but is known to be working properly with
|
||||
H3 drivers and memory map.
|
||||
|
||||
- Allwinner H3 (sun8i)
|
||||
+ Datasheet
|
||||
http://dl.linux-sunxi.org/H3/Allwinner_H3_Datasheet_V1.0.pdf
|
||||
|
||||
- Allwinner V3s (sun8i)
|
||||
+ Datasheet
|
||||
http://linux-sunxi.org/File:Allwinner_V3s_Datasheet_V1.0.pdf
|
||||
|
||||
* Quad ARM Cortex-A15, Quad ARM Cortex-A7 based SoCs
|
||||
- Allwinner A80
|
||||
+ Datasheet
|
||||
|
|
|
@ -0,0 +1,240 @@
|
|||
ARM64 CPU Feature Registers
|
||||
===========================
|
||||
|
||||
Author: Suzuki K Poulose <suzuki.poulose@arm.com>
|
||||
|
||||
|
||||
This file describes the ABI for exporting the AArch64 CPU ID/feature
|
||||
registers to userspace. The availability of this ABI is advertised
|
||||
via the HWCAP_CPUID in HWCAPs.
|
||||
|
||||
1. Motivation
|
||||
---------------
|
||||
|
||||
The ARM architecture defines a set of feature registers, which describe
|
||||
the capabilities of the CPU/system. Access to these system registers is
|
||||
restricted from EL0 and there is no reliable way for an application to
|
||||
extract this information to make better decisions at runtime. There is
|
||||
limited information available to the application via HWCAPs, however
|
||||
there are some issues with their usage.
|
||||
|
||||
a) Any change to the HWCAPs requires an update to userspace (e.g libc)
|
||||
to detect the new changes, which can take a long time to appear in
|
||||
distributions. Exposing the registers allows applications to get the
|
||||
information without requiring updates to the toolchains.
|
||||
|
||||
b) Access to HWCAPs is sometimes limited (e.g prior to libc, or
|
||||
when ld is initialised at startup time).
|
||||
|
||||
c) HWCAPs cannot represent non-boolean information effectively. The
|
||||
architecture defines a canonical format for representing features
|
||||
in the ID registers; this is well defined and is capable of
|
||||
representing all valid architecture variations.
|
||||
|
||||
|
||||
2. Requirements
|
||||
-----------------
|
||||
|
||||
a) Safety :
|
||||
Applications should be able to use the information provided by the
|
||||
infrastructure to run safely across the system. This has greater
|
||||
implications on a system with heterogeneous CPUs.
|
||||
The infrastructure exports a value that is safe across all the
|
||||
available CPU on the system.
|
||||
|
||||
e.g, If at least one CPU doesn't implement CRC32 instructions, while
|
||||
others do, we should report that the CRC32 is not implemented.
|
||||
Otherwise an application could crash when scheduled on the CPU
|
||||
which doesn't support CRC32.
|
||||
|
||||
b) Security :
|
||||
Applications should only be able to receive information that is
|
||||
relevant to the normal operation in userspace. Hence, some of the
|
||||
fields are masked out(i.e, made invisible) and their values are set to
|
||||
indicate the feature is 'not supported'. See Section 4 for the list
|
||||
of visible features. Also, the kernel may manipulate the fields
|
||||
based on what it supports. e.g, If FP is not supported by the
|
||||
kernel, the values could indicate that the FP is not available
|
||||
(even when the CPU provides it).
|
||||
|
||||
c) Implementation Defined Features
|
||||
The infrastructure doesn't expose any register which is
|
||||
IMPLEMENTATION DEFINED as per ARMv8-A Architecture.
|
||||
|
||||
d) CPU Identification :
|
||||
MIDR_EL1 is exposed to help identify the processor. On a
|
||||
heterogeneous system, this could be racy (just like getcpu()). The
|
||||
process could be migrated to another CPU by the time it uses the
|
||||
register value, unless the CPU affinity is set. Hence, there is no
|
||||
guarantee that the value reflects the processor that it is
|
||||
currently executing on. The REVIDR is not exposed due to this
|
||||
constraint, as REVIDR makes sense only in conjunction with the
|
||||
MIDR. Alternately, MIDR_EL1 and REVIDR_EL1 are exposed via sysfs
|
||||
at:
|
||||
|
||||
/sys/devices/system/cpu/cpu$ID/regs/identification/
|
||||
\- midr
|
||||
\- revidr
|
||||
|
||||
3. Implementation
|
||||
--------------------
|
||||
|
||||
The infrastructure is built on the emulation of the 'MRS' instruction.
|
||||
Accessing a restricted system register from an application generates an
|
||||
exception and ends up in SIGILL being delivered to the process.
|
||||
The infrastructure hooks into the exception handler and emulates the
|
||||
operation if the source belongs to the supported system register space.
|
||||
|
||||
The infrastructure emulates only the following system register space:
|
||||
Op0=3, Op1=0, CRn=0, CRm=0,4,5,6,7
|
||||
|
||||
(See Table C5-6 'System instruction encodings for non-Debug System
|
||||
register accesses' in ARMv8 ARM DDI 0487A.h, for the list of
|
||||
registers).
|
||||
|
||||
The following rules are applied to the value returned by the
|
||||
infrastructure:
|
||||
|
||||
a) The value of an 'IMPLEMENTATION DEFINED' field is set to 0.
|
||||
b) The value of a reserved field is populated with the reserved
|
||||
value as defined by the architecture.
|
||||
c) The value of a 'visible' field holds the system wide safe value
|
||||
for the particular feature (except for MIDR_EL1, see section 4).
|
||||
d) All other fields (i.e, invisible fields) are set to indicate
|
||||
the feature is missing (as defined by the architecture).
|
||||
|
||||
4. List of registers with visible features
|
||||
-------------------------------------------
|
||||
|
||||
1) ID_AA64ISAR0_EL1 - Instruction Set Attribute Register 0
|
||||
x--------------------------------------------------x
|
||||
| Name | bits | visible |
|
||||
|--------------------------------------------------|
|
||||
| RES0 | [63-32] | n |
|
||||
|--------------------------------------------------|
|
||||
| RDM | [31-28] | y |
|
||||
|--------------------------------------------------|
|
||||
| ATOMICS | [23-20] | y |
|
||||
|--------------------------------------------------|
|
||||
| CRC32 | [19-16] | y |
|
||||
|--------------------------------------------------|
|
||||
| SHA2 | [15-12] | y |
|
||||
|--------------------------------------------------|
|
||||
| SHA1 | [11-8] | y |
|
||||
|--------------------------------------------------|
|
||||
| AES | [7-4] | y |
|
||||
|--------------------------------------------------|
|
||||
| RES0 | [3-0] | n |
|
||||
x--------------------------------------------------x
|
||||
|
||||
|
||||
2) ID_AA64PFR0_EL1 - Processor Feature Register 0
|
||||
x--------------------------------------------------x
|
||||
| Name | bits | visible |
|
||||
|--------------------------------------------------|
|
||||
| RES0 | [63-28] | n |
|
||||
|--------------------------------------------------|
|
||||
| GIC | [27-24] | n |
|
||||
|--------------------------------------------------|
|
||||
| AdvSIMD | [23-20] | y |
|
||||
|--------------------------------------------------|
|
||||
| FP | [19-16] | y |
|
||||
|--------------------------------------------------|
|
||||
| EL3 | [15-12] | n |
|
||||
|--------------------------------------------------|
|
||||
| EL2 | [11-8] | n |
|
||||
|--------------------------------------------------|
|
||||
| EL1 | [7-4] | n |
|
||||
|--------------------------------------------------|
|
||||
| EL0 | [3-0] | n |
|
||||
x--------------------------------------------------x
|
||||
|
||||
|
||||
3) MIDR_EL1 - Main ID Register
|
||||
x--------------------------------------------------x
|
||||
| Name | bits | visible |
|
||||
|--------------------------------------------------|
|
||||
| Implementer | [31-24] | y |
|
||||
|--------------------------------------------------|
|
||||
| Variant | [23-20] | y |
|
||||
|--------------------------------------------------|
|
||||
| Architecture | [19-16] | y |
|
||||
|--------------------------------------------------|
|
||||
| PartNum | [15-4] | y |
|
||||
|--------------------------------------------------|
|
||||
| Revision | [3-0] | y |
|
||||
x--------------------------------------------------x
|
||||
|
||||
NOTE: The 'visible' fields of MIDR_EL1 will contain the value
|
||||
as available on the CPU where it is fetched and is not a system
|
||||
wide safe value.
|
||||
|
||||
Appendix I: Example
|
||||
---------------------------
|
||||
|
||||
/*
|
||||
* Sample program to demonstrate the MRS emulation ABI.
|
||||
*
|
||||
* Copyright (C) 2015-2016, ARM Ltd
|
||||
*
|
||||
* Author: Suzuki K Poulose <suzuki.poulose@arm.com>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* 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.
|
||||
* This program 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <asm/hwcap.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/auxv.h>
|
||||
|
||||
#define get_cpu_ftr(id) ({ \
|
||||
unsigned long __val; \
|
||||
asm("mrs %0, "#id : "=r" (__val)); \
|
||||
printf("%-20s: 0x%016lx\n", #id, __val); \
|
||||
})
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) {
|
||||
fputs("CPUID registers unavailable\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
get_cpu_ftr(ID_AA64ISAR0_EL1);
|
||||
get_cpu_ftr(ID_AA64ISAR1_EL1);
|
||||
get_cpu_ftr(ID_AA64MMFR0_EL1);
|
||||
get_cpu_ftr(ID_AA64MMFR1_EL1);
|
||||
get_cpu_ftr(ID_AA64PFR0_EL1);
|
||||
get_cpu_ftr(ID_AA64PFR1_EL1);
|
||||
get_cpu_ftr(ID_AA64DFR0_EL1);
|
||||
get_cpu_ftr(ID_AA64DFR1_EL1);
|
||||
|
||||
get_cpu_ftr(MIDR_EL1);
|
||||
get_cpu_ftr(MPIDR_EL1);
|
||||
get_cpu_ftr(REVIDR_EL1);
|
||||
|
||||
#if 0
|
||||
/* Unexposed register access causes SIGILL */
|
||||
get_cpu_ftr(ID_MMFR0_EL1);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -42,24 +42,30 @@ file acts as a registry of software workarounds in the Linux Kernel and
|
|||
will be updated when new workarounds are committed and backported to
|
||||
stable kernels.
|
||||
|
||||
| Implementor | Component | Erratum ID | Kconfig |
|
||||
+----------------+-----------------+-----------------+-------------------------+
|
||||
| ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 |
|
||||
| ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
|
||||
| ARM | Cortex-A53 | #824069 | ARM64_ERRATUM_824069 |
|
||||
| ARM | Cortex-A53 | #819472 | ARM64_ERRATUM_819472 |
|
||||
| ARM | Cortex-A53 | #845719 | ARM64_ERRATUM_845719 |
|
||||
| ARM | Cortex-A53 | #843419 | ARM64_ERRATUM_843419 |
|
||||
| ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 |
|
||||
| ARM | Cortex-A57 | #852523 | N/A |
|
||||
| ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 |
|
||||
| ARM | Cortex-A72 | #853709 | N/A |
|
||||
| ARM | MMU-500 | #841119,#826419 | N/A |
|
||||
| | | | |
|
||||
| Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 |
|
||||
| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 |
|
||||
| Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 |
|
||||
| Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 |
|
||||
| Cavium | ThunderX SMMUv2 | #27704 | N/A |
|
||||
| | | | |
|
||||
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
|
||||
| Implementor | Component | Erratum ID | Kconfig |
|
||||
+----------------+-----------------+-----------------+-----------------------------+
|
||||
| ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 |
|
||||
| ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
|
||||
| ARM | Cortex-A53 | #824069 | ARM64_ERRATUM_824069 |
|
||||
| ARM | Cortex-A53 | #819472 | ARM64_ERRATUM_819472 |
|
||||
| ARM | Cortex-A53 | #845719 | ARM64_ERRATUM_845719 |
|
||||
| ARM | Cortex-A53 | #843419 | ARM64_ERRATUM_843419 |
|
||||
| ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 |
|
||||
| ARM | Cortex-A57 | #852523 | N/A |
|
||||
| ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 |
|
||||
| ARM | Cortex-A72 | #853709 | N/A |
|
||||
| ARM | MMU-500 | #841119,#826419 | N/A |
|
||||
| | | | |
|
||||
| Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 |
|
||||
| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 |
|
||||
| Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 |
|
||||
| Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 |
|
||||
| Cavium | ThunderX SMMUv2 | #27704 | N/A |
|
||||
| | | | |
|
||||
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
|
||||
| | | | |
|
||||
| Hisilicon | Hip0{5,6,7} | #161010101 | HISILICON_ERRATUM_161010101 |
|
||||
| | | | |
|
||||
| Qualcomm Tech. | Falkor v1 | E1003 | QCOM_FALKOR_ERRATUM_1003 |
|
||||
| Qualcomm Tech. | Falkor v1 | E1009 | QCOM_FALKOR_ERRATUM_1009 |
|
||||
| Qualcomm Tech. | QDF2400 ITS | E0065 | QCOM_QDF2400_ERRATUM_0065 |
|
||||
|
|
|
@ -90,7 +90,7 @@ and thus removes any access restriction implied by it.
|
|||
4. IOC_PR_PREEMPT
|
||||
|
||||
This ioctl command releases the existing reservation referred to by
|
||||
old_key and replaces it with a a new reservation of type for the
|
||||
old_key and replaces it with a new reservation of type for the
|
||||
reservation key new_key.
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ driver and currently works well under standard IDE subsystem. Actually it's
|
|||
one chip SSD. IO mode is ATA-like custom mode for the host that doesn't have
|
||||
IDE interface.
|
||||
|
||||
Followings are brief descriptions about IO mode.
|
||||
Following are brief descriptions about IO mode.
|
||||
A. IO mode based on ATA protocol and uses some custom command. (read confirm,
|
||||
write confirm)
|
||||
B. IO mode uses SRAM bus interface.
|
||||
|
|
|
@ -161,42 +161,14 @@ Name access description
|
|||
disksize RW show and set the device's disk size
|
||||
initstate RO shows the initialization state of the device
|
||||
reset WO trigger device reset
|
||||
num_reads RO the number of reads
|
||||
failed_reads RO the number of failed reads
|
||||
num_write RO the number of writes
|
||||
failed_writes RO the number of failed writes
|
||||
invalid_io RO the number of non-page-size-aligned I/O requests
|
||||
mem_used_max WO reset the `mem_used_max' counter (see later)
|
||||
mem_limit WO specifies the maximum amount of memory ZRAM can use
|
||||
to store the compressed data
|
||||
max_comp_streams RW the number of possible concurrent compress operations
|
||||
comp_algorithm RW show and change the compression algorithm
|
||||
notify_free RO the number of notifications to free pages (either
|
||||
slot free notifications or REQ_DISCARD requests)
|
||||
zero_pages RO the number of zero filled pages written to this disk
|
||||
orig_data_size RO uncompressed size of data stored in this disk
|
||||
compr_data_size RO compressed size of data stored in this disk
|
||||
mem_used_total RO the amount of memory allocated for this disk
|
||||
mem_used_max RW the maximum amount of memory zram have consumed to
|
||||
store the data (to reset this counter to the actual
|
||||
current value, write 1 to this attribute)
|
||||
mem_limit RW the maximum amount of memory ZRAM can use to store
|
||||
the compressed data
|
||||
pages_compacted RO the number of pages freed during compaction
|
||||
(available only via zram<id>/mm_stat node)
|
||||
compact WO trigger memory compaction
|
||||
debug_stat RO this file is used for zram debugging purposes
|
||||
|
||||
WARNING
|
||||
=======
|
||||
per-stat sysfs attributes are considered to be deprecated.
|
||||
The basic strategy is:
|
||||
-- the existing RW nodes will be downgraded to WO nodes (in linux 4.11)
|
||||
-- deprecated RO sysfs nodes will eventually be removed (in linux 4.11)
|
||||
|
||||
The list of deprecated attributes can be found here:
|
||||
Documentation/ABI/obsolete/sysfs-block-zram
|
||||
|
||||
Basically, every attribute that has its own read accessible sysfs node
|
||||
(e.g. num_reads) *AND* is accessible via one of the stat files (zram<id>/stat
|
||||
or zram<id>/io_stat or zram<id>/mm_stat) is considered to be deprecated.
|
||||
|
||||
User space is advised to use the following files to read the device statistics.
|
||||
|
||||
|
@ -211,22 +183,40 @@ The stat file represents device's I/O statistics not accounted by block
|
|||
layer and, thus, not available in zram<id>/stat file. It consists of a
|
||||
single line of text and contains the following stats separated by
|
||||
whitespace:
|
||||
failed_reads
|
||||
failed_writes
|
||||
invalid_io
|
||||
notify_free
|
||||
failed_reads the number of failed reads
|
||||
failed_writes the number of failed writes
|
||||
invalid_io the number of non-page-size-aligned I/O requests
|
||||
notify_free Depending on device usage scenario it may account
|
||||
a) the number of pages freed because of swap slot free
|
||||
notifications or b) the number of pages freed because of
|
||||
REQ_DISCARD requests sent by bio. The former ones are
|
||||
sent to a swap block device when a swap slot is freed,
|
||||
which implies that this disk is being used as a swap disk.
|
||||
The latter ones are sent by filesystem mounted with
|
||||
discard option, whenever some data blocks are getting
|
||||
discarded.
|
||||
|
||||
File /sys/block/zram<id>/mm_stat
|
||||
|
||||
The stat file represents device's mm statistics. It consists of a single
|
||||
line of text and contains the following stats separated by whitespace:
|
||||
orig_data_size
|
||||
compr_data_size
|
||||
mem_used_total
|
||||
mem_limit
|
||||
mem_used_max
|
||||
zero_pages
|
||||
num_migrated
|
||||
orig_data_size uncompressed size of data stored in this disk.
|
||||
This excludes same-element-filled pages (same_pages) since
|
||||
no memory is allocated for them.
|
||||
Unit: bytes
|
||||
compr_data_size compressed size of data stored in this disk
|
||||
mem_used_total the amount of memory allocated for this disk. This
|
||||
includes allocator fragmentation and metadata overhead,
|
||||
allocated for this disk. So, allocator space efficiency
|
||||
can be calculated using compr_data_size and this statistic.
|
||||
Unit: bytes
|
||||
mem_limit the maximum amount of memory ZRAM can use to store
|
||||
the compressed data
|
||||
mem_used_max the maximum amount of memory zram have consumed to
|
||||
store the data
|
||||
same_pages the number of same element filled pages written to this disk.
|
||||
No memory is allocated for such pages.
|
||||
pages_compacted the number of pages freed during compaction
|
||||
|
||||
9) Deactivate:
|
||||
swapoff /dev/zram0
|
||||
|
|
|
@ -615,7 +615,7 @@ to allocate a page of memory for that task.
|
|||
|
||||
If a cpuset has its 'cpuset.cpus' modified, then each task in that cpuset
|
||||
will have its allowed CPU placement changed immediately. Similarly,
|
||||
if a task's pid is written to another cpusets 'cpuset.tasks' file, then its
|
||||
if a task's pid is written to another cpuset's 'tasks' file, then its
|
||||
allowed CPU placement is changed immediately. If such a task had been
|
||||
bound to some subset of its cpuset using the sched_setaffinity() call,
|
||||
the task will be allowed to run on any CPU allowed in its new cpuset,
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
RDMA Controller
|
||||
----------------
|
||||
|
||||
Contents
|
||||
--------
|
||||
|
||||
1. Overview
|
||||
1-1. What is RDMA controller?
|
||||
1-2. Why RDMA controller needed?
|
||||
1-3. How is RDMA controller implemented?
|
||||
2. Usage Examples
|
||||
|
||||
1. Overview
|
||||
|
||||
1-1. What is RDMA controller?
|
||||
-----------------------------
|
||||
|
||||
RDMA controller allows user to limit RDMA/IB specific resources that a given
|
||||
set of processes can use. These processes are grouped using RDMA controller.
|
||||
|
||||
RDMA controller defines two resources which can be limited for processes of a
|
||||
cgroup.
|
||||
|
||||
1-2. Why RDMA controller needed?
|
||||
--------------------------------
|
||||
|
||||
Currently user space applications can easily take away all the rdma verb
|
||||
specific resources such as AH, CQ, QP, MR etc. Due to which other applications
|
||||
in other cgroup or kernel space ULPs may not even get chance to allocate any
|
||||
rdma resources. This can leads to service unavailability.
|
||||
|
||||
Therefore RDMA controller is needed through which resource consumption
|
||||
of processes can be limited. Through this controller different rdma
|
||||
resources can be accounted.
|
||||
|
||||
1-3. How is RDMA controller implemented?
|
||||
----------------------------------------
|
||||
|
||||
RDMA cgroup allows limit configuration of resources. Rdma cgroup maintains
|
||||
resource accounting per cgroup, per device using resource pool structure.
|
||||
Each such resource pool is limited up to 64 resources in given resource pool
|
||||
by rdma cgroup, which can be extended later if required.
|
||||
|
||||
This resource pool object is linked to the cgroup css. Typically there
|
||||
are 0 to 4 resource pool instances per cgroup, per device in most use cases.
|
||||
But nothing limits to have it more. At present hundreds of RDMA devices per
|
||||
single cgroup may not be handled optimally, however there is no
|
||||
known use case or requirement for such configuration either.
|
||||
|
||||
Since RDMA resources can be allocated from any process and can be freed by any
|
||||
of the child processes which shares the address space, rdma resources are
|
||||
always owned by the creator cgroup css. This allows process migration from one
|
||||
to other cgroup without major complexity of transferring resource ownership;
|
||||
because such ownership is not really present due to shared nature of
|
||||
rdma resources. Linking resources around css also ensures that cgroups can be
|
||||
deleted after processes migrated. This allow progress migration as well with
|
||||
active resources, even though that is not a primary use case.
|
||||
|
||||
Whenever RDMA resource charging occurs, owner rdma cgroup is returned to
|
||||
the caller. Same rdma cgroup should be passed while uncharging the resource.
|
||||
This also allows process migrated with active RDMA resource to charge
|
||||
to new owner cgroup for new resource. It also allows to uncharge resource of
|
||||
a process from previously charged cgroup which is migrated to new cgroup,
|
||||
even though that is not a primary use case.
|
||||
|
||||
Resource pool object is created in following situations.
|
||||
(a) User sets the limit and no previous resource pool exist for the device
|
||||
of interest for the cgroup.
|
||||
(b) No resource limits were configured, but IB/RDMA stack tries to
|
||||
charge the resource. So that it correctly uncharge them when applications are
|
||||
running without limits and later on when limits are enforced during uncharging,
|
||||
otherwise usage count will drop to negative.
|
||||
|
||||
Resource pool is destroyed if all the resource limits are set to max and
|
||||
it is the last resource getting deallocated.
|
||||
|
||||
User should set all the limit to max value if it intents to remove/unconfigure
|
||||
the resource pool for a particular device.
|
||||
|
||||
IB stack honors limits enforced by the rdma controller. When application
|
||||
query about maximum resource limits of IB device, it returns minimum of
|
||||
what is configured by user for a given cgroup and what is supported by
|
||||
IB device.
|
||||
|
||||
Following resources can be accounted by rdma controller.
|
||||
hca_handle Maximum number of HCA Handles
|
||||
hca_object Maximum number of HCA Objects
|
||||
|
||||
2. Usage Examples
|
||||
-----------------
|
||||
|
||||
(a) Configure resource limit:
|
||||
echo mlx4_0 hca_handle=2 hca_object=2000 > /sys/fs/cgroup/rdma/1/rdma.max
|
||||
echo ocrdma1 hca_handle=3 > /sys/fs/cgroup/rdma/2/rdma.max
|
||||
|
||||
(b) Query resource limit:
|
||||
cat /sys/fs/cgroup/rdma/2/rdma.max
|
||||
#Output:
|
||||
mlx4_0 hca_handle=2 hca_object=2000
|
||||
ocrdma1 hca_handle=3 hca_object=max
|
||||
|
||||
(c) Query current usage:
|
||||
cat /sys/fs/cgroup/rdma/2/rdma.current
|
||||
#Output:
|
||||
mlx4_0 hca_handle=1 hca_object=20
|
||||
ocrdma1 hca_handle=1 hca_object=23
|
||||
|
||||
(d) Delete resource limit:
|
||||
echo echo mlx4_0 hca_handle=max hca_object=max > /sys/fs/cgroup/rdma/1/rdma.max
|
|
@ -47,6 +47,12 @@ CONTENTS
|
|||
5-3. IO
|
||||
5-3-1. IO Interface Files
|
||||
5-3-2. Writeback
|
||||
5-4. PID
|
||||
5-4-1. PID Interface Files
|
||||
5-5. RDMA
|
||||
5-5-1. RDMA Interface Files
|
||||
5-6. Misc
|
||||
5-6-1. perf_event
|
||||
6. Namespace
|
||||
6-1. Basics
|
||||
6-2. The Root and Views
|
||||
|
@ -328,14 +334,12 @@ a process with a non-root euid to migrate a target process into a
|
|||
cgroup by writing its PID to the "cgroup.procs" file, the following
|
||||
conditions must be met.
|
||||
|
||||
- The writer's euid must match either uid or suid of the target process.
|
||||
|
||||
- The writer must have write access to the "cgroup.procs" file.
|
||||
|
||||
- The writer must have write access to the "cgroup.procs" file of the
|
||||
common ancestor of the source and destination cgroups.
|
||||
|
||||
The above three constraints ensure that while a delegatee may migrate
|
||||
The above two constraints ensure that while a delegatee may migrate
|
||||
processes around freely in the delegated sub-hierarchy it can't pull
|
||||
in from or push out to outside the sub-hierarchy.
|
||||
|
||||
|
@ -350,10 +354,10 @@ all processes under C0 and C1 belong to U0.
|
|||
|
||||
Let's also say U0 wants to write the PID of a process which is
|
||||
currently in C10 into "C00/cgroup.procs". U0 has write access to the
|
||||
file and uid match on the process; however, the common ancestor of the
|
||||
source cgroup C10 and the destination cgroup C00 is above the points
|
||||
of delegation and U0 would not have write access to its "cgroup.procs"
|
||||
files and thus the write will be denied with -EACCES.
|
||||
file; however, the common ancestor of the source cgroup C10 and the
|
||||
destination cgroup C00 is above the points of delegation and U0 would
|
||||
not have write access to its "cgroup.procs" files and thus the write
|
||||
will be denied with -EACCES.
|
||||
|
||||
|
||||
2-6. Guidelines
|
||||
|
@ -1119,6 +1123,92 @@ writeback as follows.
|
|||
vm.dirty[_background]_ratio.
|
||||
|
||||
|
||||
5-4. PID
|
||||
|
||||
The process number controller is used to allow a cgroup to stop any
|
||||
new tasks from being fork()'d or clone()'d after a specified limit is
|
||||
reached.
|
||||
|
||||
The number of tasks in a cgroup can be exhausted in ways which other
|
||||
controllers cannot prevent, thus warranting its own controller. For
|
||||
example, a fork bomb is likely to exhaust the number of tasks before
|
||||
hitting memory restrictions.
|
||||
|
||||
Note that PIDs used in this controller refer to TIDs, process IDs as
|
||||
used by the kernel.
|
||||
|
||||
|
||||
5-4-1. PID Interface Files
|
||||
|
||||
pids.max
|
||||
|
||||
A read-write single value file which exists on non-root
|
||||
cgroups. The default is "max".
|
||||
|
||||
Hard limit of number of processes.
|
||||
|
||||
pids.current
|
||||
|
||||
A read-only single value file which exists on all cgroups.
|
||||
|
||||
The number of processes currently in the cgroup and its
|
||||
descendants.
|
||||
|
||||
Organisational operations are not blocked by cgroup policies, so it is
|
||||
possible to have pids.current > pids.max. This can be done by either
|
||||
setting the limit to be smaller than pids.current, or attaching enough
|
||||
processes to the cgroup such that pids.current is larger than
|
||||
pids.max. However, it is not possible to violate a cgroup PID policy
|
||||
through fork() or clone(). These will return -EAGAIN if the creation
|
||||
of a new process would cause a cgroup policy to be violated.
|
||||
|
||||
|
||||
5-5. RDMA
|
||||
|
||||
The "rdma" controller regulates the distribution and accounting of
|
||||
of RDMA resources.
|
||||
|
||||
5-5-1. RDMA Interface Files
|
||||
|
||||
rdma.max
|
||||
A readwrite nested-keyed file that exists for all the cgroups
|
||||
except root that describes current configured resource limit
|
||||
for a RDMA/IB device.
|
||||
|
||||
Lines are keyed by device name and are not ordered.
|
||||
Each line contains space separated resource name and its configured
|
||||
limit that can be distributed.
|
||||
|
||||
The following nested keys are defined.
|
||||
|
||||
hca_handle Maximum number of HCA Handles
|
||||
hca_object Maximum number of HCA Objects
|
||||
|
||||
An example for mlx4 and ocrdma device follows.
|
||||
|
||||
mlx4_0 hca_handle=2 hca_object=2000
|
||||
ocrdma1 hca_handle=3 hca_object=max
|
||||
|
||||
rdma.current
|
||||
A read-only file that describes current resource usage.
|
||||
It exists for all the cgroup except root.
|
||||
|
||||
An example for mlx4 and ocrdma device follows.
|
||||
|
||||
mlx4_0 hca_handle=1 hca_object=20
|
||||
ocrdma1 hca_handle=1 hca_object=23
|
||||
|
||||
|
||||
5-6. Misc
|
||||
|
||||
5-6-1. perf_event
|
||||
|
||||
perf_event controller, if not mounted on a legacy hierarchy, is
|
||||
automatically enabled on the v2 hierarchy so that perf events can
|
||||
always be filtered by cgroup v2 path. The controller can still be
|
||||
moved to a legacy hierarchy after v2 hierarchy is populated.
|
||||
|
||||
|
||||
6. Namespace
|
||||
|
||||
6-1. Basics
|
||||
|
|
|
@ -58,7 +58,7 @@ master_doc = 'index'
|
|||
|
||||
# General information about the project.
|
||||
project = 'The Linux Kernel'
|
||||
copyright = '2016, The kernel development community'
|
||||
copyright = 'The kernel development community'
|
||||
author = 'The kernel development community'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
|
@ -135,7 +135,7 @@ pygments_style = 'sphinx'
|
|||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = False
|
||||
|
||||
primary_domain = 'C'
|
||||
primary_domain = 'c'
|
||||
highlight_language = 'none'
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
|
|
@ -0,0 +1,372 @@
|
|||
=========================
|
||||
CPU hotplug in the Kernel
|
||||
=========================
|
||||
|
||||
:Date: December, 2016
|
||||
:Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
|
||||
Rusty Russell <rusty@rustcorp.com.au>,
|
||||
Srivatsa Vaddagiri <vatsa@in.ibm.com>,
|
||||
Ashok Raj <ashok.raj@intel.com>,
|
||||
Joel Schopp <jschopp@austin.ibm.com>
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
Modern advances in system architectures have introduced advanced error
|
||||
reporting and correction capabilities in processors. There are couple OEMS that
|
||||
support NUMA hardware which are hot pluggable as well, where physical node
|
||||
insertion and removal require support for CPU hotplug.
|
||||
|
||||
Such advances require CPUs available to a kernel to be removed either for
|
||||
provisioning reasons, or for RAS purposes to keep an offending CPU off
|
||||
system execution path. Hence the need for CPU hotplug support in the
|
||||
Linux kernel.
|
||||
|
||||
A more novel use of CPU-hotplug support is its use today in suspend resume
|
||||
support for SMP. Dual-core and HT support makes even a laptop run SMP kernels
|
||||
which didn't support these methods.
|
||||
|
||||
|
||||
Command Line Switches
|
||||
=====================
|
||||
``maxcpus=n``
|
||||
Restrict boot time CPUs to *n*. Say if you have fourV CPUs, using
|
||||
``maxcpus=2`` will only boot two. You can choose to bring the
|
||||
other CPUs later online.
|
||||
|
||||
``nr_cpus=n``
|
||||
Restrict the total amount CPUs the kernel will support. If the number
|
||||
supplied here is lower than the number of physically available CPUs than
|
||||
those CPUs can not be brought online later.
|
||||
|
||||
``additional_cpus=n``
|
||||
Use this to limit hotpluggable CPUs. This option sets
|
||||
``cpu_possible_mask = cpu_present_mask + additional_cpus``
|
||||
|
||||
This option is limited to the IA64 architecture.
|
||||
|
||||
``possible_cpus=n``
|
||||
This option sets ``possible_cpus`` bits in ``cpu_possible_mask``.
|
||||
|
||||
This option is limited to the X86 and S390 architecture.
|
||||
|
||||
``cede_offline={"off","on"}``
|
||||
Use this option to disable/enable putting offlined processors to an extended
|
||||
``H_CEDE`` state on supported pseries platforms. If nothing is specified,
|
||||
``cede_offline`` is set to "on".
|
||||
|
||||
This option is limited to the PowerPC architecture.
|
||||
|
||||
``cpu0_hotplug``
|
||||
Allow to shutdown CPU0.
|
||||
|
||||
This option is limited to the X86 architecture.
|
||||
|
||||
CPU maps
|
||||
========
|
||||
|
||||
``cpu_possible_mask``
|
||||
Bitmap of possible CPUs that can ever be available in the
|
||||
system. This is used to allocate some boot time memory for per_cpu variables
|
||||
that aren't designed to grow/shrink as CPUs are made available or removed.
|
||||
Once set during boot time discovery phase, the map is static, i.e no bits
|
||||
are added or removed anytime. Trimming it accurately for your system needs
|
||||
upfront can save some boot time memory.
|
||||
|
||||
``cpu_online_mask``
|
||||
Bitmap of all CPUs currently online. Its set in ``__cpu_up()``
|
||||
after a CPU is available for kernel scheduling and ready to receive
|
||||
interrupts from devices. Its cleared when a CPU is brought down using
|
||||
``__cpu_disable()``, before which all OS services including interrupts are
|
||||
migrated to another target CPU.
|
||||
|
||||
``cpu_present_mask``
|
||||
Bitmap of CPUs currently present in the system. Not all
|
||||
of them may be online. When physical hotplug is processed by the relevant
|
||||
subsystem (e.g ACPI) can change and new bit either be added or removed
|
||||
from the map depending on the event is hot-add/hot-remove. There are currently
|
||||
no locking rules as of now. Typical usage is to init topology during boot,
|
||||
at which time hotplug is disabled.
|
||||
|
||||
You really don't need to manipulate any of the system CPU maps. They should
|
||||
be read-only for most use. When setting up per-cpu resources almost always use
|
||||
``cpu_possible_mask`` or ``for_each_possible_cpu()`` to iterate. To macro
|
||||
``for_each_cpu()`` can be used to iterate over a custom CPU mask.
|
||||
|
||||
Never use anything other than ``cpumask_t`` to represent bitmap of CPUs.
|
||||
|
||||
|
||||
Using CPU hotplug
|
||||
=================
|
||||
The kernel option *CONFIG_HOTPLUG_CPU* needs to be enabled. It is currently
|
||||
available on multiple architectures including ARM, MIPS, PowerPC and X86. The
|
||||
configuration is done via the sysfs interface: ::
|
||||
|
||||
$ ls -lh /sys/devices/system/cpu
|
||||
total 0
|
||||
drwxr-xr-x 9 root root 0 Dec 21 16:33 cpu0
|
||||
drwxr-xr-x 9 root root 0 Dec 21 16:33 cpu1
|
||||
drwxr-xr-x 9 root root 0 Dec 21 16:33 cpu2
|
||||
drwxr-xr-x 9 root root 0 Dec 21 16:33 cpu3
|
||||
drwxr-xr-x 9 root root 0 Dec 21 16:33 cpu4
|
||||
drwxr-xr-x 9 root root 0 Dec 21 16:33 cpu5
|
||||
drwxr-xr-x 9 root root 0 Dec 21 16:33 cpu6
|
||||
drwxr-xr-x 9 root root 0 Dec 21 16:33 cpu7
|
||||
drwxr-xr-x 2 root root 0 Dec 21 16:33 hotplug
|
||||
-r--r--r-- 1 root root 4.0K Dec 21 16:33 offline
|
||||
-r--r--r-- 1 root root 4.0K Dec 21 16:33 online
|
||||
-r--r--r-- 1 root root 4.0K Dec 21 16:33 possible
|
||||
-r--r--r-- 1 root root 4.0K Dec 21 16:33 present
|
||||
|
||||
The files *offline*, *online*, *possible*, *present* represent the CPU masks.
|
||||
Each CPU folder contains an *online* file which controls the logical on (1) and
|
||||
off (0) state. To logically shutdown CPU4: ::
|
||||
|
||||
$ echo 0 > /sys/devices/system/cpu/cpu4/online
|
||||
smpboot: CPU 4 is now offline
|
||||
|
||||
Once the CPU is shutdown, it will be removed from */proc/interrupts*,
|
||||
*/proc/cpuinfo* and should also not be shown visible by the *top* command. To
|
||||
bring CPU4 back online: ::
|
||||
|
||||
$ echo 1 > /sys/devices/system/cpu/cpu4/online
|
||||
smpboot: Booting Node 0 Processor 4 APIC 0x1
|
||||
|
||||
The CPU is usable again. This should work on all CPUs. CPU0 is often special
|
||||
and excluded from CPU hotplug. On X86 the kernel option
|
||||
*CONFIG_BOOTPARAM_HOTPLUG_CPU0* has to be enabled in order to be able to
|
||||
shutdown CPU0. Alternatively the kernel command option *cpu0_hotplug* can be
|
||||
used. Some known dependencies of CPU0:
|
||||
|
||||
* Resume from hibernate/suspend. Hibernate/suspend will fail if CPU0 is offline.
|
||||
* PIC interrupts. CPU0 can't be removed if a PIC interrupt is detected.
|
||||
|
||||
Please let Fenghua Yu <fenghua.yu@intel.com> know if you find any dependencies
|
||||
on CPU0.
|
||||
|
||||
The CPU hotplug coordination
|
||||
============================
|
||||
|
||||
The offline case
|
||||
----------------
|
||||
Once a CPU has been logically shutdown the teardown callbacks of registered
|
||||
hotplug states will be invoked, starting with ``CPUHP_ONLINE`` and terminating
|
||||
at state ``CPUHP_OFFLINE``. This includes:
|
||||
|
||||
* If tasks are frozen due to a suspend operation then *cpuhp_tasks_frozen*
|
||||
will be set to true.
|
||||
* All processes are migrated away from this outgoing CPU to new CPUs.
|
||||
The new CPU is chosen from each process' current cpuset, which may be
|
||||
a subset of all online CPUs.
|
||||
* All interrupts targeted to this CPU are migrated to a new CPU
|
||||
* timers are also migrated to a new CPU
|
||||
* Once all services are migrated, kernel calls an arch specific routine
|
||||
``__cpu_disable()`` to perform arch specific cleanup.
|
||||
|
||||
Using the hotplug API
|
||||
---------------------
|
||||
It is possible to receive notifications once a CPU is offline or onlined. This
|
||||
might be important to certain drivers which need to perform some kind of setup
|
||||
or clean up functions based on the number of available CPUs: ::
|
||||
|
||||
#include <linux/cpuhotplug.h>
|
||||
|
||||
ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "X/Y:online",
|
||||
Y_online, Y_prepare_down);
|
||||
|
||||
*X* is the subsystem and *Y* the particular driver. The *Y_online* callback
|
||||
will be invoked during registration on all online CPUs. If an error
|
||||
occurs during the online callback the *Y_prepare_down* callback will be
|
||||
invoked on all CPUs on which the online callback was previously invoked.
|
||||
After registration completed, the *Y_online* callback will be invoked
|
||||
once a CPU is brought online and *Y_prepare_down* will be invoked when a
|
||||
CPU is shutdown. All resources which were previously allocated in
|
||||
*Y_online* should be released in *Y_prepare_down*.
|
||||
The return value *ret* is negative if an error occurred during the
|
||||
registration process. Otherwise a positive value is returned which
|
||||
contains the allocated hotplug for dynamically allocated states
|
||||
(*CPUHP_AP_ONLINE_DYN*). It will return zero for predefined states.
|
||||
|
||||
The callback can be remove by invoking ``cpuhp_remove_state()``. In case of a
|
||||
dynamically allocated state (*CPUHP_AP_ONLINE_DYN*) use the returned state.
|
||||
During the removal of a hotplug state the teardown callback will be invoked.
|
||||
|
||||
Multiple instances
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
If a driver has multiple instances and each instance needs to perform the
|
||||
callback independently then it is likely that a ''multi-state'' should be used.
|
||||
First a multi-state state needs to be registered: ::
|
||||
|
||||
ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "X/Y:online,
|
||||
Y_online, Y_prepare_down);
|
||||
Y_hp_online = ret;
|
||||
|
||||
The ``cpuhp_setup_state_multi()`` behaves similar to ``cpuhp_setup_state()``
|
||||
except it prepares the callbacks for a multi state and does not invoke
|
||||
the callbacks. This is a one time setup.
|
||||
Once a new instance is allocated, you need to register this new instance: ::
|
||||
|
||||
ret = cpuhp_state_add_instance(Y_hp_online, &d->node);
|
||||
|
||||
This function will add this instance to your previously allocated
|
||||
*Y_hp_online* state and invoke the previously registered callback
|
||||
(*Y_online*) on all online CPUs. The *node* element is a ``struct
|
||||
hlist_node`` member of your per-instance data structure.
|
||||
|
||||
On removal of the instance: ::
|
||||
cpuhp_state_remove_instance(Y_hp_online, &d->node)
|
||||
|
||||
should be invoked which will invoke the teardown callback on all online
|
||||
CPUs.
|
||||
|
||||
Manual setup
|
||||
~~~~~~~~~~~~
|
||||
Usually it is handy to invoke setup and teardown callbacks on registration or
|
||||
removal of a state because usually the operation needs to performed once a CPU
|
||||
goes online (offline) and during initial setup (shutdown) of the driver. However
|
||||
each registration and removal function is also available with a ``_nocalls``
|
||||
suffix which does not invoke the provided callbacks if the invocation of the
|
||||
callbacks is not desired. During the manual setup (or teardown) the functions
|
||||
``get_online_cpus()`` and ``put_online_cpus()`` should be used to inhibit CPU
|
||||
hotplug operations.
|
||||
|
||||
|
||||
The ordering of the events
|
||||
--------------------------
|
||||
The hotplug states are defined in ``include/linux/cpuhotplug.h``:
|
||||
|
||||
* The states *CPUHP_OFFLINE* … *CPUHP_AP_OFFLINE* are invoked before the
|
||||
CPU is up.
|
||||
* The states *CPUHP_AP_OFFLINE* … *CPUHP_AP_ONLINE* are invoked
|
||||
just the after the CPU has been brought up. The interrupts are off and
|
||||
the scheduler is not yet active on this CPU. Starting with *CPUHP_AP_OFFLINE*
|
||||
the callbacks are invoked on the target CPU.
|
||||
* The states between *CPUHP_AP_ONLINE_DYN* and *CPUHP_AP_ONLINE_DYN_END* are
|
||||
reserved for the dynamic allocation.
|
||||
* The states are invoked in the reverse order on CPU shutdown starting with
|
||||
*CPUHP_ONLINE* and stopping at *CPUHP_OFFLINE*. Here the callbacks are
|
||||
invoked on the CPU that will be shutdown until *CPUHP_AP_OFFLINE*.
|
||||
|
||||
A dynamically allocated state via *CPUHP_AP_ONLINE_DYN* is often enough.
|
||||
However if an earlier invocation during the bring up or shutdown is required
|
||||
then an explicit state should be acquired. An explicit state might also be
|
||||
required if the hotplug event requires specific ordering in respect to
|
||||
another hotplug event.
|
||||
|
||||
Testing of hotplug states
|
||||
=========================
|
||||
One way to verify whether a custom state is working as expected or not is to
|
||||
shutdown a CPU and then put it online again. It is also possible to put the CPU
|
||||
to certain state (for instance *CPUHP_AP_ONLINE*) and then go back to
|
||||
*CPUHP_ONLINE*. This would simulate an error one state after *CPUHP_AP_ONLINE*
|
||||
which would lead to rollback to the online state.
|
||||
|
||||
All registered states are enumerated in ``/sys/devices/system/cpu/hotplug/states``: ::
|
||||
|
||||
$ tail /sys/devices/system/cpu/hotplug/states
|
||||
138: mm/vmscan:online
|
||||
139: mm/vmstat:online
|
||||
140: lib/percpu_cnt:online
|
||||
141: acpi/cpu-drv:online
|
||||
142: base/cacheinfo:online
|
||||
143: virtio/net:online
|
||||
144: x86/mce:online
|
||||
145: printk:online
|
||||
168: sched:active
|
||||
169: online
|
||||
|
||||
To rollback CPU4 to ``lib/percpu_cnt:online`` and back online just issue: ::
|
||||
|
||||
$ cat /sys/devices/system/cpu/cpu4/hotplug/state
|
||||
169
|
||||
$ echo 140 > /sys/devices/system/cpu/cpu4/hotplug/target
|
||||
$ cat /sys/devices/system/cpu/cpu4/hotplug/state
|
||||
140
|
||||
|
||||
It is important to note that the teardown callbac of state 140 have been
|
||||
invoked. And now get back online: ::
|
||||
|
||||
$ echo 169 > /sys/devices/system/cpu/cpu4/hotplug/target
|
||||
$ cat /sys/devices/system/cpu/cpu4/hotplug/state
|
||||
169
|
||||
|
||||
With trace events enabled, the individual steps are visible, too: ::
|
||||
|
||||
# TASK-PID CPU# TIMESTAMP FUNCTION
|
||||
# | | | | |
|
||||
bash-394 [001] 22.976: cpuhp_enter: cpu: 0004 target: 140 step: 169 (cpuhp_kick_ap_work)
|
||||
cpuhp/4-31 [004] 22.977: cpuhp_enter: cpu: 0004 target: 140 step: 168 (sched_cpu_deactivate)
|
||||
cpuhp/4-31 [004] 22.990: cpuhp_exit: cpu: 0004 state: 168 step: 168 ret: 0
|
||||
cpuhp/4-31 [004] 22.991: cpuhp_enter: cpu: 0004 target: 140 step: 144 (mce_cpu_pre_down)
|
||||
cpuhp/4-31 [004] 22.992: cpuhp_exit: cpu: 0004 state: 144 step: 144 ret: 0
|
||||
cpuhp/4-31 [004] 22.993: cpuhp_multi_enter: cpu: 0004 target: 140 step: 143 (virtnet_cpu_down_prep)
|
||||
cpuhp/4-31 [004] 22.994: cpuhp_exit: cpu: 0004 state: 143 step: 143 ret: 0
|
||||
cpuhp/4-31 [004] 22.995: cpuhp_enter: cpu: 0004 target: 140 step: 142 (cacheinfo_cpu_pre_down)
|
||||
cpuhp/4-31 [004] 22.996: cpuhp_exit: cpu: 0004 state: 142 step: 142 ret: 0
|
||||
bash-394 [001] 22.997: cpuhp_exit: cpu: 0004 state: 140 step: 169 ret: 0
|
||||
bash-394 [005] 95.540: cpuhp_enter: cpu: 0004 target: 169 step: 140 (cpuhp_kick_ap_work)
|
||||
cpuhp/4-31 [004] 95.541: cpuhp_enter: cpu: 0004 target: 169 step: 141 (acpi_soft_cpu_online)
|
||||
cpuhp/4-31 [004] 95.542: cpuhp_exit: cpu: 0004 state: 141 step: 141 ret: 0
|
||||
cpuhp/4-31 [004] 95.543: cpuhp_enter: cpu: 0004 target: 169 step: 142 (cacheinfo_cpu_online)
|
||||
cpuhp/4-31 [004] 95.544: cpuhp_exit: cpu: 0004 state: 142 step: 142 ret: 0
|
||||
cpuhp/4-31 [004] 95.545: cpuhp_multi_enter: cpu: 0004 target: 169 step: 143 (virtnet_cpu_online)
|
||||
cpuhp/4-31 [004] 95.546: cpuhp_exit: cpu: 0004 state: 143 step: 143 ret: 0
|
||||
cpuhp/4-31 [004] 95.547: cpuhp_enter: cpu: 0004 target: 169 step: 144 (mce_cpu_online)
|
||||
cpuhp/4-31 [004] 95.548: cpuhp_exit: cpu: 0004 state: 144 step: 144 ret: 0
|
||||
cpuhp/4-31 [004] 95.549: cpuhp_enter: cpu: 0004 target: 169 step: 145 (console_cpu_notify)
|
||||
cpuhp/4-31 [004] 95.550: cpuhp_exit: cpu: 0004 state: 145 step: 145 ret: 0
|
||||
cpuhp/4-31 [004] 95.551: cpuhp_enter: cpu: 0004 target: 169 step: 168 (sched_cpu_activate)
|
||||
cpuhp/4-31 [004] 95.552: cpuhp_exit: cpu: 0004 state: 168 step: 168 ret: 0
|
||||
bash-394 [005] 95.553: cpuhp_exit: cpu: 0004 state: 169 step: 140 ret: 0
|
||||
|
||||
As it an be seen, CPU4 went down until timestamp 22.996 and then back up until
|
||||
95.552. All invoked callbacks including their return codes are visible in the
|
||||
trace.
|
||||
|
||||
Architecture's requirements
|
||||
===========================
|
||||
The following functions and configurations are required:
|
||||
|
||||
``CONFIG_HOTPLUG_CPU``
|
||||
This entry needs to be enabled in Kconfig
|
||||
|
||||
``__cpu_up()``
|
||||
Arch interface to bring up a CPU
|
||||
|
||||
``__cpu_disable()``
|
||||
Arch interface to shutdown a CPU, no more interrupts can be handled by the
|
||||
kernel after the routine returns. This includes the shutdown of the timer.
|
||||
|
||||
``__cpu_die()``
|
||||
This actually supposed to ensure death of the CPU. Actually look at some
|
||||
example code in other arch that implement CPU hotplug. The processor is taken
|
||||
down from the ``idle()`` loop for that specific architecture. ``__cpu_die()``
|
||||
typically waits for some per_cpu state to be set, to ensure the processor dead
|
||||
routine is called to be sure positively.
|
||||
|
||||
User Space Notification
|
||||
=======================
|
||||
After CPU successfully onlined or offline udev events are sent. A udev rule like: ::
|
||||
|
||||
SUBSYSTEM=="cpu", DRIVERS=="processor", DEVPATH=="/devices/system/cpu/*", RUN+="the_hotplug_receiver.sh"
|
||||
|
||||
will receive all events. A script like: ::
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
if [ "${ACTION}" = "offline" ]
|
||||
then
|
||||
echo "CPU ${DEVPATH##*/} offline"
|
||||
|
||||
elif [ "${ACTION}" = "online" ]
|
||||
then
|
||||
echo "CPU ${DEVPATH##*/} online"
|
||||
|
||||
fi
|
||||
|
||||
can process the event further.
|
||||
|
||||
Kernel Inline Documentations Reference
|
||||
======================================
|
||||
|
||||
.. kernel-doc:: include/linux/cpuhotplug.h
|
|
@ -13,6 +13,7 @@ Core utilities
|
|||
|
||||
assoc_array
|
||||
atomic_ops
|
||||
cpu_hotplug
|
||||
local_ops
|
||||
workqueue
|
||||
|
||||
|
|
|
@ -82,7 +82,9 @@ UltraSPARC-III
|
|||
-------
|
||||
|
||||
Several "PowerBook" and "iBook2" notebooks are supported.
|
||||
|
||||
The following POWER processors are supported in powernv mode:
|
||||
POWER8
|
||||
POWER9
|
||||
|
||||
1.5 SuperH
|
||||
----------
|
||||
|
|
|
@ -1,452 +0,0 @@
|
|||
CPU hotplug Support in Linux(tm) Kernel
|
||||
|
||||
Maintainers:
|
||||
CPU Hotplug Core:
|
||||
Rusty Russell <rusty@rustcorp.com.au>
|
||||
Srivatsa Vaddagiri <vatsa@in.ibm.com>
|
||||
i386:
|
||||
Zwane Mwaikambo <zwanem@gmail.com>
|
||||
ppc64:
|
||||
Nathan Lynch <nathanl@austin.ibm.com>
|
||||
Joel Schopp <jschopp@austin.ibm.com>
|
||||
ia64/x86_64:
|
||||
Ashok Raj <ashok.raj@intel.com>
|
||||
s390:
|
||||
Heiko Carstens <heiko.carstens@de.ibm.com>
|
||||
|
||||
Authors: Ashok Raj <ashok.raj@intel.com>
|
||||
Lots of feedback: Nathan Lynch <nathanl@austin.ibm.com>,
|
||||
Joel Schopp <jschopp@austin.ibm.com>
|
||||
|
||||
Introduction
|
||||
|
||||
Modern advances in system architectures have introduced advanced error
|
||||
reporting and correction capabilities in processors. CPU architectures permit
|
||||
partitioning support, where compute resources of a single CPU could be made
|
||||
available to virtual machine environments. There are couple OEMS that
|
||||
support NUMA hardware which are hot pluggable as well, where physical
|
||||
node insertion and removal require support for CPU hotplug.
|
||||
|
||||
Such advances require CPUs available to a kernel to be removed either for
|
||||
provisioning reasons, or for RAS purposes to keep an offending CPU off
|
||||
system execution path. Hence the need for CPU hotplug support in the
|
||||
Linux kernel.
|
||||
|
||||
A more novel use of CPU-hotplug support is its use today in suspend
|
||||
resume support for SMP. Dual-core and HT support makes even
|
||||
a laptop run SMP kernels which didn't support these methods. SMP support
|
||||
for suspend/resume is a work in progress.
|
||||
|
||||
General Stuff about CPU Hotplug
|
||||
--------------------------------
|
||||
|
||||
Command Line Switches
|
||||
---------------------
|
||||
maxcpus=n Restrict boot time cpus to n. Say if you have 4 cpus, using
|
||||
maxcpus=2 will only boot 2. You can choose to bring the
|
||||
other cpus later online, read FAQ's for more info.
|
||||
|
||||
additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets
|
||||
cpu_possible_mask = cpu_present_mask + additional_cpus
|
||||
|
||||
cede_offline={"off","on"} Use this option to disable/enable putting offlined
|
||||
processors to an extended H_CEDE state on
|
||||
supported pseries platforms.
|
||||
If nothing is specified,
|
||||
cede_offline is set to "on".
|
||||
|
||||
(*) Option valid only for following architectures
|
||||
- ia64
|
||||
|
||||
ia64 uses the number of disabled local apics in ACPI tables MADT to
|
||||
determine the number of potentially hot-pluggable cpus. The implementation
|
||||
should only rely on this to count the # of cpus, but *MUST* not rely
|
||||
on the apicid values in those tables for disabled apics. In the event
|
||||
BIOS doesn't mark such hot-pluggable cpus as disabled entries, one could
|
||||
use this parameter "additional_cpus=x" to represent those cpus in the
|
||||
cpu_possible_mask.
|
||||
|
||||
possible_cpus=n [s390,x86_64] use this to set hotpluggable cpus.
|
||||
This option sets possible_cpus bits in
|
||||
cpu_possible_mask. Thus keeping the numbers of bits set
|
||||
constant even if the machine gets rebooted.
|
||||
|
||||
CPU maps and such
|
||||
-----------------
|
||||
[More on cpumaps and primitive to manipulate, please check
|
||||
include/linux/cpumask.h that has more descriptive text.]
|
||||
|
||||
cpu_possible_mask: Bitmap of possible CPUs that can ever be available in the
|
||||
system. This is used to allocate some boot time memory for per_cpu variables
|
||||
that aren't designed to grow/shrink as CPUs are made available or removed.
|
||||
Once set during boot time discovery phase, the map is static, i.e no bits
|
||||
are added or removed anytime. Trimming it accurately for your system needs
|
||||
upfront can save some boot time memory. See below for how we use heuristics
|
||||
in x86_64 case to keep this under check.
|
||||
|
||||
cpu_online_mask: Bitmap of all CPUs currently online. It's set in __cpu_up()
|
||||
after a CPU is available for kernel scheduling and ready to receive
|
||||
interrupts from devices. It's cleared when a CPU is brought down using
|
||||
__cpu_disable(), before which all OS services including interrupts are
|
||||
migrated to another target CPU.
|
||||
|
||||
cpu_present_mask: Bitmap of CPUs currently present in the system. Not all
|
||||
of them may be online. When physical hotplug is processed by the relevant
|
||||
subsystem (e.g ACPI) can change and new bit either be added or removed
|
||||
from the map depending on the event is hot-add/hot-remove. There are currently
|
||||
no locking rules as of now. Typical usage is to init topology during boot,
|
||||
at which time hotplug is disabled.
|
||||
|
||||
You really dont need to manipulate any of the system cpu maps. They should
|
||||
be read-only for most use. When setting up per-cpu resources almost always use
|
||||
cpu_possible_mask/for_each_possible_cpu() to iterate.
|
||||
|
||||
Never use anything other than cpumask_t to represent bitmap of CPUs.
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
|
||||
for_each_possible_cpu - Iterate over cpu_possible_mask
|
||||
for_each_online_cpu - Iterate over cpu_online_mask
|
||||
for_each_present_cpu - Iterate over cpu_present_mask
|
||||
for_each_cpu(x,mask) - Iterate over some random collection of cpu mask.
|
||||
|
||||
#include <linux/cpu.h>
|
||||
get_online_cpus() and put_online_cpus():
|
||||
|
||||
The above calls are used to inhibit cpu hotplug operations. While the
|
||||
cpu_hotplug.refcount is non zero, the cpu_online_mask will not change.
|
||||
If you merely need to avoid cpus going away, you could also use
|
||||
preempt_disable() and preempt_enable() for those sections.
|
||||
Just remember the critical section cannot call any
|
||||
function that can sleep or schedule this process away. The preempt_disable()
|
||||
will work as long as stop_machine_run() is used to take a cpu down.
|
||||
|
||||
CPU Hotplug - Frequently Asked Questions.
|
||||
|
||||
Q: How to enable my kernel to support CPU hotplug?
|
||||
A: When doing make defconfig, Enable CPU hotplug support
|
||||
|
||||
"Processor type and Features" -> Support for Hotpluggable CPUs
|
||||
|
||||
Make sure that you have CONFIG_SMP turned on as well.
|
||||
|
||||
You would need to enable CONFIG_HOTPLUG_CPU for SMP suspend/resume support
|
||||
as well.
|
||||
|
||||
Q: What architectures support CPU hotplug?
|
||||
A: As of 2.6.14, the following architectures support CPU hotplug.
|
||||
|
||||
i386 (Intel), ppc, ppc64, parisc, s390, ia64 and x86_64
|
||||
|
||||
Q: How to test if hotplug is supported on the newly built kernel?
|
||||
A: You should now notice an entry in sysfs.
|
||||
|
||||
Check if sysfs is mounted, using the "mount" command. You should notice
|
||||
an entry as shown below in the output.
|
||||
|
||||
....
|
||||
none on /sys type sysfs (rw)
|
||||
....
|
||||
|
||||
If this is not mounted, do the following.
|
||||
|
||||
#mkdir /sys
|
||||
#mount -t sysfs sys /sys
|
||||
|
||||
Now you should see entries for all present cpu, the following is an example
|
||||
in a 8-way system.
|
||||
|
||||
#pwd
|
||||
#/sys/devices/system/cpu
|
||||
#ls -l
|
||||
total 0
|
||||
drwxr-xr-x 10 root root 0 Sep 19 07:44 .
|
||||
drwxr-xr-x 13 root root 0 Sep 19 07:45 ..
|
||||
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu0
|
||||
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu1
|
||||
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu2
|
||||
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu3
|
||||
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu4
|
||||
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu5
|
||||
drwxr-xr-x 3 root root 0 Sep 19 07:44 cpu6
|
||||
drwxr-xr-x 3 root root 0 Sep 19 07:48 cpu7
|
||||
|
||||
Under each directory you would find an "online" file which is the control
|
||||
file to logically online/offline a processor.
|
||||
|
||||
Q: Does hot-add/hot-remove refer to physical add/remove of cpus?
|
||||
A: The usage of hot-add/remove may not be very consistently used in the code.
|
||||
CONFIG_HOTPLUG_CPU enables logical online/offline capability in the kernel.
|
||||
To support physical addition/removal, one would need some BIOS hooks and
|
||||
the platform should have something like an attention button in PCI hotplug.
|
||||
CONFIG_ACPI_HOTPLUG_CPU enables ACPI support for physical add/remove of CPUs.
|
||||
|
||||
Q: How do I logically offline a CPU?
|
||||
A: Do the following.
|
||||
|
||||
#echo 0 > /sys/devices/system/cpu/cpuX/online
|
||||
|
||||
Once the logical offline is successful, check
|
||||
|
||||
#cat /proc/interrupts
|
||||
|
||||
You should now not see the CPU that you removed. Also online file will report
|
||||
the state as 0 when a CPU is offline and 1 when it's online.
|
||||
|
||||
#To display the current cpu state.
|
||||
#cat /sys/devices/system/cpu/cpuX/online
|
||||
|
||||
Q: Why can't I remove CPU0 on some systems?
|
||||
A: Some architectures may have some special dependency on a certain CPU.
|
||||
|
||||
For e.g in IA64 platforms we have ability to send platform interrupts to the
|
||||
OS. a.k.a Corrected Platform Error Interrupts (CPEI). In current ACPI
|
||||
specifications, we didn't have a way to change the target CPU. Hence if the
|
||||
current ACPI version doesn't support such re-direction, we disable that CPU
|
||||
by making it not-removable.
|
||||
|
||||
In such cases you will also notice that the online file is missing under cpu0.
|
||||
|
||||
Q: Is CPU0 removable on X86?
|
||||
A: Yes. If kernel is compiled with CONFIG_BOOTPARAM_HOTPLUG_CPU0=y, CPU0 is
|
||||
removable by default. Otherwise, CPU0 is also removable by kernel option
|
||||
cpu0_hotplug.
|
||||
|
||||
But some features depend on CPU0. Two known dependencies are:
|
||||
|
||||
1. Resume from hibernate/suspend depends on CPU0. Hibernate/suspend will fail if
|
||||
CPU0 is offline and you need to online CPU0 before hibernate/suspend can
|
||||
continue.
|
||||
2. PIC interrupts also depend on CPU0. CPU0 can't be removed if a PIC interrupt
|
||||
is detected.
|
||||
|
||||
It's said poweroff/reboot may depend on CPU0 on some machines although I haven't
|
||||
seen any poweroff/reboot failure so far after CPU0 is offline on a few tested
|
||||
machines.
|
||||
|
||||
Please let me know if you know or see any other dependencies of CPU0.
|
||||
|
||||
If the dependencies are under your control, you can turn on CPU0 hotplug feature
|
||||
either by CONFIG_BOOTPARAM_HOTPLUG_CPU0 or by kernel parameter cpu0_hotplug.
|
||||
|
||||
--Fenghua Yu <fenghua.yu@intel.com>
|
||||
|
||||
Q: How do I find out if a particular CPU is not removable?
|
||||
A: Depending on the implementation, some architectures may show this by the
|
||||
absence of the "online" file. This is done if it can be determined ahead of
|
||||
time that this CPU cannot be removed.
|
||||
|
||||
In some situations, this can be a run time check, i.e if you try to remove the
|
||||
last CPU, this will not be permitted. You can find such failures by
|
||||
investigating the return value of the "echo" command.
|
||||
|
||||
Q: What happens when a CPU is being logically offlined?
|
||||
A: The following happen, listed in no particular order :-)
|
||||
|
||||
- A notification is sent to in-kernel registered modules by sending an event
|
||||
CPU_DOWN_PREPARE or CPU_DOWN_PREPARE_FROZEN, depending on whether or not the
|
||||
CPU is being offlined while tasks are frozen due to a suspend operation in
|
||||
progress
|
||||
- All processes are migrated away from this outgoing CPU to new CPUs.
|
||||
The new CPU is chosen from each process' current cpuset, which may be
|
||||
a subset of all online CPUs.
|
||||
- All interrupts targeted to this CPU are migrated to a new CPU
|
||||
- timers/bottom half/task lets are also migrated to a new CPU
|
||||
- Once all services are migrated, kernel calls an arch specific routine
|
||||
__cpu_disable() to perform arch specific cleanup.
|
||||
- Once this is successful, an event for successful cleanup is sent by an event
|
||||
CPU_DEAD (or CPU_DEAD_FROZEN if tasks are frozen due to a suspend while the
|
||||
CPU is being offlined).
|
||||
|
||||
"It is expected that each service cleans up when the CPU_DOWN_PREPARE
|
||||
notifier is called, when CPU_DEAD is called it's expected there is nothing
|
||||
running on behalf of this CPU that was offlined"
|
||||
|
||||
Q: If I have some kernel code that needs to be aware of CPU arrival and
|
||||
departure, how to i arrange for proper notification?
|
||||
A: This is what you would need in your kernel code to receive notifications.
|
||||
|
||||
#include <linux/cpu.h>
|
||||
static int foobar_cpu_callback(struct notifier_block *nfb,
|
||||
unsigned long action, void *hcpu)
|
||||
{
|
||||
unsigned int cpu = (unsigned long)hcpu;
|
||||
|
||||
switch (action) {
|
||||
case CPU_ONLINE:
|
||||
case CPU_ONLINE_FROZEN:
|
||||
foobar_online_action(cpu);
|
||||
break;
|
||||
case CPU_DEAD:
|
||||
case CPU_DEAD_FROZEN:
|
||||
foobar_dead_action(cpu);
|
||||
break;
|
||||
}
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static struct notifier_block foobar_cpu_notifier =
|
||||
{
|
||||
.notifier_call = foobar_cpu_callback,
|
||||
};
|
||||
|
||||
You need to call register_cpu_notifier() from your init function.
|
||||
Init functions could be of two types:
|
||||
1. early init (init function called when only the boot processor is online).
|
||||
2. late init (init function called _after_ all the CPUs are online).
|
||||
|
||||
For the first case, you should add the following to your init function
|
||||
|
||||
register_cpu_notifier(&foobar_cpu_notifier);
|
||||
|
||||
For the second case, you should add the following to your init function
|
||||
|
||||
register_hotcpu_notifier(&foobar_cpu_notifier);
|
||||
|
||||
You can fail PREPARE notifiers if something doesn't work to prepare resources.
|
||||
This will stop the activity and send a following CANCELED event back.
|
||||
|
||||
CPU_DEAD should not be failed, its just a goodness indication, but bad
|
||||
things will happen if a notifier in path sent a BAD notify code.
|
||||
|
||||
Q: I don't see my action being called for all CPUs already up and running?
|
||||
A: Yes, CPU notifiers are called only when new CPUs are on-lined or offlined.
|
||||
If you need to perform some action for each CPU already in the system, then
|
||||
do this:
|
||||
|
||||
for_each_online_cpu(i) {
|
||||
foobar_cpu_callback(&foobar_cpu_notifier, CPU_UP_PREPARE, i);
|
||||
foobar_cpu_callback(&foobar_cpu_notifier, CPU_ONLINE, i);
|
||||
}
|
||||
|
||||
However, if you want to register a hotplug callback, as well as perform
|
||||
some initialization for CPUs that are already online, then do this:
|
||||
|
||||
Version 1: (Correct)
|
||||
---------
|
||||
|
||||
cpu_notifier_register_begin();
|
||||
|
||||
for_each_online_cpu(i) {
|
||||
foobar_cpu_callback(&foobar_cpu_notifier,
|
||||
CPU_UP_PREPARE, i);
|
||||
foobar_cpu_callback(&foobar_cpu_notifier,
|
||||
CPU_ONLINE, i);
|
||||
}
|
||||
|
||||
/* Note the use of the double underscored version of the API */
|
||||
__register_cpu_notifier(&foobar_cpu_notifier);
|
||||
|
||||
cpu_notifier_register_done();
|
||||
|
||||
Note that the following code is *NOT* the right way to achieve this,
|
||||
because it is prone to an ABBA deadlock between the cpu_add_remove_lock
|
||||
and the cpu_hotplug.lock.
|
||||
|
||||
Version 2: (Wrong!)
|
||||
---------
|
||||
|
||||
get_online_cpus();
|
||||
|
||||
for_each_online_cpu(i) {
|
||||
foobar_cpu_callback(&foobar_cpu_notifier,
|
||||
CPU_UP_PREPARE, i);
|
||||
foobar_cpu_callback(&foobar_cpu_notifier,
|
||||
CPU_ONLINE, i);
|
||||
}
|
||||
|
||||
register_cpu_notifier(&foobar_cpu_notifier);
|
||||
|
||||
put_online_cpus();
|
||||
|
||||
So always use the first version shown above when you want to register
|
||||
callbacks as well as initialize the already online CPUs.
|
||||
|
||||
|
||||
Q: If I would like to develop CPU hotplug support for a new architecture,
|
||||
what do I need at a minimum?
|
||||
A: The following are what is required for CPU hotplug infrastructure to work
|
||||
correctly.
|
||||
|
||||
- Make sure you have an entry in Kconfig to enable CONFIG_HOTPLUG_CPU
|
||||
- __cpu_up() - Arch interface to bring up a CPU
|
||||
- __cpu_disable() - Arch interface to shutdown a CPU, no more interrupts
|
||||
can be handled by the kernel after the routine
|
||||
returns. Including local APIC timers etc are
|
||||
shutdown.
|
||||
- __cpu_die() - This actually supposed to ensure death of the CPU.
|
||||
Actually look at some example code in other arch
|
||||
that implement CPU hotplug. The processor is taken
|
||||
down from the idle() loop for that specific
|
||||
architecture. __cpu_die() typically waits for some
|
||||
per_cpu state to be set, to ensure the processor
|
||||
dead routine is called to be sure positively.
|
||||
|
||||
Q: I need to ensure that a particular CPU is not removed when there is some
|
||||
work specific to this CPU in progress.
|
||||
A: There are two ways. If your code can be run in interrupt context, use
|
||||
smp_call_function_single(), otherwise use work_on_cpu(). Note that
|
||||
work_on_cpu() is slow, and can fail due to out of memory:
|
||||
|
||||
int my_func_on_cpu(int cpu)
|
||||
{
|
||||
int err;
|
||||
get_online_cpus();
|
||||
if (!cpu_online(cpu))
|
||||
err = -EINVAL;
|
||||
else
|
||||
#if NEEDS_BLOCKING
|
||||
err = work_on_cpu(cpu, __my_func_on_cpu, NULL);
|
||||
#else
|
||||
smp_call_function_single(cpu, __my_func_on_cpu, &err,
|
||||
true);
|
||||
#endif
|
||||
put_online_cpus();
|
||||
return err;
|
||||
}
|
||||
|
||||
Q: How do we determine how many CPUs are available for hotplug.
|
||||
A: There is no clear spec defined way from ACPI that can give us that
|
||||
information today. Based on some input from Natalie of Unisys,
|
||||
that the ACPI MADT (Multiple APIC Description Tables) marks those possible
|
||||
CPUs in a system with disabled status.
|
||||
|
||||
Andi implemented some simple heuristics that count the number of disabled
|
||||
CPUs in MADT as hotpluggable CPUS. In the case there are no disabled CPUS
|
||||
we assume 1/2 the number of CPUs currently present can be hotplugged.
|
||||
|
||||
Caveat: ACPI MADT can only provide 256 entries in systems with only ACPI 2.0c
|
||||
or earlier ACPI version supported, because the apicid field in MADT is only
|
||||
8 bits. From ACPI 3.0, this limitation was removed since the apicid field
|
||||
was extended to 32 bits with x2APIC introduced.
|
||||
|
||||
User Space Notification
|
||||
|
||||
Hotplug support for devices is common in Linux today. Its being used today to
|
||||
support automatic configuration of network, usb and pci devices. A hotplug
|
||||
event can be used to invoke an agent script to perform the configuration task.
|
||||
|
||||
You can add /etc/hotplug/cpu.agent to handle hotplug notification user space
|
||||
scripts.
|
||||
|
||||
#!/bin/bash
|
||||
# $Id: cpu.agent
|
||||
# Kernel hotplug params include:
|
||||
#ACTION=%s [online or offline]
|
||||
#DEVPATH=%s
|
||||
#
|
||||
cd /etc/hotplug
|
||||
. ./hotplug.functions
|
||||
|
||||
case $ACTION in
|
||||
online)
|
||||
echo `date` ":cpu.agent" add cpu >> /tmp/hotplug.txt
|
||||
;;
|
||||
offline)
|
||||
echo `date` ":cpu.agent" remove cpu >>/tmp/hotplug.txt
|
||||
;;
|
||||
*)
|
||||
debug_mesg CPU $ACTION event not supported
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -14,7 +14,7 @@ Asynchronous Message Digest API
|
|||
:doc: Asynchronous Message Digest API
|
||||
|
||||
.. kernel-doc:: include/crypto/hash.h
|
||||
:functions: crypto_alloc_ahash crypto_free_ahash crypto_ahash_init crypto_ahash_digestsize crypto_ahash_reqtfm crypto_ahash_reqsize crypto_ahash_setkey crypto_ahash_finup crypto_ahash_final crypto_ahash_digest crypto_ahash_export crypto_ahash_import
|
||||
:functions: crypto_alloc_ahash crypto_free_ahash crypto_ahash_init crypto_ahash_digestsize crypto_ahash_reqtfm crypto_ahash_reqsize crypto_ahash_statesize crypto_ahash_setkey crypto_ahash_finup crypto_ahash_final crypto_ahash_digest crypto_ahash_export crypto_ahash_import
|
||||
|
||||
Asynchronous Hash Request Handle
|
||||
--------------------------------
|
||||
|
|
|
@ -59,4 +59,4 @@ Synchronous Block Cipher API - Deprecated
|
|||
:doc: Synchronous Block Cipher API
|
||||
|
||||
.. kernel-doc:: include/linux/crypto.h
|
||||
:functions: crypto_alloc_blkcipher rypto_free_blkcipher crypto_has_blkcipher crypto_blkcipher_name crypto_blkcipher_ivsize crypto_blkcipher_blocksize crypto_blkcipher_setkey crypto_blkcipher_encrypt crypto_blkcipher_encrypt_iv crypto_blkcipher_decrypt crypto_blkcipher_decrypt_iv crypto_blkcipher_set_iv crypto_blkcipher_get_iv
|
||||
:functions: crypto_alloc_blkcipher crypto_free_blkcipher crypto_has_blkcipher crypto_blkcipher_name crypto_blkcipher_ivsize crypto_blkcipher_blocksize crypto_blkcipher_setkey crypto_blkcipher_encrypt crypto_blkcipher_encrypt_iv crypto_blkcipher_decrypt crypto_blkcipher_decrypt_iv crypto_blkcipher_set_iv crypto_blkcipher_get_iv
|
||||
|
|
|
@ -10,7 +10,7 @@ Note that kcov does not aim to collect as much coverage as possible. It aims
|
|||
to collect more or less stable coverage that is function of syscall inputs.
|
||||
To achieve this goal it does not collect coverage in soft/hard interrupts
|
||||
and instrumentation of some inherently non-deterministic parts of kernel is
|
||||
disbled (e.g. scheduler, locking).
|
||||
disabled (e.g. scheduler, locking).
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
|
|
@ -103,3 +103,9 @@ have already built it.
|
|||
|
||||
The optional make variable CF can be used to pass arguments to sparse. The
|
||||
build system passes -Wbitwise to sparse automatically.
|
||||
|
||||
Checking RCU annotations
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
RCU annotations are not checked by default. To enable RCU annotation
|
||||
checks, include -DCONFIG_SPARSE_RCU_POINTER in your CF flags.
|
||||
|
|
|
@ -319,7 +319,7 @@ Version History
|
|||
1.5.2 'mismatch_cnt' is zero unless [last_]sync_action is "check".
|
||||
1.6.0 Add discard support (and devices_handle_discard_safely module param).
|
||||
1.7.0 Add support for MD RAID0 mappings.
|
||||
1.8.0 Explictely check for compatible flags in the superblock metadata
|
||||
1.8.0 Explicitly check for compatible flags in the superblock metadata
|
||||
and reject to start the raid set if any are set by a newer
|
||||
target version, thus avoiding data corruption on a raid set
|
||||
with a reshape in progress.
|
||||
|
|
|
@ -40,6 +40,8 @@ Board compatible values:
|
|||
- "hardkernel,odroid-c2" (Meson gxbb)
|
||||
- "amlogic,p200" (Meson gxbb)
|
||||
- "amlogic,p201" (Meson gxbb)
|
||||
- "wetek,hub" (Meson gxbb)
|
||||
- "wetek,play2" (Meson gxbb)
|
||||
- "amlogic,p212" (Meson gxl s905x)
|
||||
- "amlogic,p230" (Meson gxl s905d)
|
||||
- "amlogic,p231" (Meson gxl s905d)
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
Device tree bindings for Axentia ARM devices
|
||||
============================================
|
||||
|
||||
Linea CPU module
|
||||
----------------
|
||||
|
||||
Required root node properties:
|
||||
compatible = "axentia,linea",
|
||||
"atmel,sama5d31", "atmel,sama5d3", "atmel,sama5";
|
||||
and following the rules from atmel-at91.txt for a sama5d31 SoC.
|
||||
|
||||
|
||||
TSE-850 v3 board
|
||||
----------------
|
||||
|
||||
Required root node properties:
|
||||
compatible = "axentia,tse850v3", "axentia,linea",
|
||||
"atmel,sama5d31", "atmel,sama5d3", "atmel,sama5";
|
||||
and following the rules from above for the axentia,linea CPU module.
|
|
@ -158,6 +158,7 @@ nodes to be present and contain the properties described below.
|
|||
"arm,cortex-a53"
|
||||
"arm,cortex-a57"
|
||||
"arm,cortex-a72"
|
||||
"arm,cortex-a73"
|
||||
"arm,cortex-m0"
|
||||
"arm,cortex-m0+"
|
||||
"arm,cortex-m1"
|
||||
|
@ -202,6 +203,7 @@ nodes to be present and contain the properties described below.
|
|||
"marvell,armada-380-smp"
|
||||
"marvell,armada-390-smp"
|
||||
"marvell,armada-xp-smp"
|
||||
"marvell,98dx3236-smp"
|
||||
"mediatek,mt6589-smp"
|
||||
"mediatek,mt81xx-tz-smp"
|
||||
"qcom,gcc-msm8660"
|
||||
|
|
|
@ -13,6 +13,10 @@ EnBW AM1808 based CMC board
|
|||
Required root node properties:
|
||||
- compatible = "enbw,cmc", "ti,da850;
|
||||
|
||||
LEGO MINDSTORMS EV3 (AM1808 based)
|
||||
Required root node properties:
|
||||
- compatible = "lego,ev3", "ti,da850";
|
||||
|
||||
Generic DaVinci Boards
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ status.
|
|||
- compatible: Should contain a chip-specific compatible string,
|
||||
Chip-specific strings are of the form "fsl,<chip>-scfg",
|
||||
The following <chip>s are known to be supported:
|
||||
ls1021a, ls1043a, ls1046a, ls2080a.
|
||||
ls1012a, ls1021a, ls1043a, ls1046a, ls2080a.
|
||||
|
||||
- reg: should contain base address and length of SCFG memory-mapped registers
|
||||
|
||||
|
@ -126,7 +126,7 @@ core start address and release the secondary core from holdoff and startup.
|
|||
- compatible: Should contain a chip-specific compatible string,
|
||||
Chip-specific strings are of the form "fsl,<chip>-dcfg",
|
||||
The following <chip>s are known to be supported:
|
||||
ls1021a, ls1043a, ls1046a, ls2080a.
|
||||
ls1012a, ls1021a, ls1043a, ls1046a, ls2080a.
|
||||
|
||||
- reg : should contain base address and length of DCFG memory-mapped registers
|
||||
|
||||
|
@ -139,6 +139,22 @@ Example:
|
|||
Freescale ARMv8 based Layerscape SoC family Device Tree Bindings
|
||||
----------------------------------------------------------------
|
||||
|
||||
LS1012A SoC
|
||||
Required root node properties:
|
||||
- compatible = "fsl,ls1012a";
|
||||
|
||||
LS1012A ARMv8 based RDB Board
|
||||
Required root node properties:
|
||||
- compatible = "fsl,ls1012a-rdb", "fsl,ls1012a";
|
||||
|
||||
LS1012A ARMv8 based FRDM Board
|
||||
Required root node properties:
|
||||
- compatible = "fsl,ls1012a-frdm", "fsl,ls1012a";
|
||||
|
||||
LS1012A ARMv8 based QDS Board
|
||||
Required root node properties:
|
||||
- compatible = "fsl,ls1012a-qds", "fsl,ls1012a";
|
||||
|
||||
LS1043A SoC
|
||||
Required root node properties:
|
||||
- compatible = "fsl,ls1043a";
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
Hisilicon Platforms Device Tree Bindings
|
||||
----------------------------------------------------
|
||||
Hi3660 SoC
|
||||
Required root node properties:
|
||||
- compatible = "hisilicon,hi3660";
|
||||
|
||||
Hi4511 Board
|
||||
Required root node properties:
|
||||
- compatible = "hisilicon,hi3620-hi4511";
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
Resume Control
|
||||
--------------
|
||||
Available on Marvell SOCs: 98DX3336 and 98DX4251
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: must be "marvell,98dx3336-resume-ctrl"
|
||||
|
||||
- reg: Should contain resume control registers location and length
|
||||
|
||||
Example:
|
||||
|
||||
resume@20980 {
|
||||
compatible = "marvell,98dx3336-resume-ctrl";
|
||||
reg = <0x20980 0x10>;
|
||||
};
|
|
@ -0,0 +1,23 @@
|
|||
Marvell 98DX3236, 98DX3336 and 98DX4251 Platforms Device Tree Bindings
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Boards with a SoC of the Marvell 98DX3236, 98DX3336 and 98DX4251 families
|
||||
shall have the following property:
|
||||
|
||||
Required root node property:
|
||||
|
||||
compatible: must contain "marvell,armadaxp-98dx3236"
|
||||
|
||||
In addition, boards using the Marvell 98DX3336 SoC shall have the
|
||||
following property:
|
||||
|
||||
Required root node property:
|
||||
|
||||
compatible: must contain "marvell,armadaxp-98dx3336"
|
||||
|
||||
In addition, boards using the Marvell 98DX4251 SoC shall have the
|
||||
following property:
|
||||
|
||||
Required root node property:
|
||||
|
||||
compatible: must contain "marvell,armadaxp-98dx4251"
|
|
@ -151,6 +151,9 @@ Boards:
|
|||
- AM335X SBC-T335 : single board computer, built around the Sitara AM3352/4
|
||||
compatible = "compulab,sbc-t335", "compulab,cm-t335", "ti,am33xx"
|
||||
|
||||
- AM335X phyCORE-AM335x: Development kit
|
||||
compatible = "phytec,am335x-pcm-953", "phytec,am335x-phycore-som", "ti,am33xx"
|
||||
|
||||
- OMAP5 EVM : Evaluation Module
|
||||
compatible = "ti,omap5-evm", "ti,omap5"
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ Boards:
|
|||
compatible = "renesas,rskrza1", "renesas,r7s72100"
|
||||
- Salvator-X (RTP0RC7795SIPB0010S)
|
||||
compatible = "renesas,salvator-x", "renesas,r8a7795";
|
||||
- Salvator-X
|
||||
- Salvator-X (RTP0RC7796SIPB0011S)
|
||||
compatible = "renesas,salvator-x", "renesas,r8a7796";
|
||||
- SILK (RTP0RC7794LCB00011S)
|
||||
compatible = "renesas,silk", "renesas,r8a7794"
|
||||
|
|
|
@ -12,6 +12,7 @@ using one of the following compatible strings:
|
|||
allwinner,sun8i-a23
|
||||
allwinner,sun8i-a33
|
||||
allwinner,sun8i-a83t
|
||||
allwinner,sun8i-h2-plus
|
||||
allwinner,sun8i-h3
|
||||
allwinner,sun9i-a80
|
||||
allwinner,sun50i-a64
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
Device tree binding for the TI DA850 AHCI SATA Controller
|
||||
---------------------------------------------------------
|
||||
|
||||
Required properties:
|
||||
- compatible: must be "ti,da850-ahci"
|
||||
- reg: physical base addresses and sizes of the two register regions
|
||||
used by the controller: the register map as defined by the
|
||||
AHCI 1.1 standard and the Power Down Control Register (PWRDN)
|
||||
for enabling/disabling the SATA clock receiver
|
||||
- interrupts: interrupt specifier (refer to the interrupt binding)
|
||||
|
||||
Example:
|
||||
|
||||
sata: sata@218000 {
|
||||
compatible = "ti,da850-ahci";
|
||||
reg = <0x218000 0x2000>, <0x22c018 0x4>;
|
||||
interrupts = <67>;
|
||||
};
|
|
@ -51,7 +51,7 @@ Required properties:
|
|||
- compatible: should be one of:
|
||||
"qcom,msm8660-ebi2"
|
||||
"qcom,apq8060-ebi2"
|
||||
- #address-cells: shoule be <2>: the first cell is the chipselect,
|
||||
- #address-cells: should be <2>: the first cell is the chipselect,
|
||||
the second cell is the offset inside the memory range
|
||||
- #size-cells: should be <1>
|
||||
- ranges: should be set to:
|
||||
|
@ -64,7 +64,7 @@ Required properties:
|
|||
- reg: two ranges of registers: EBI2 config and XMEM config areas
|
||||
- reg-names: should be "ebi2", "xmem"
|
||||
- clocks: two clocks, EBI_2X and EBI
|
||||
- clock-names: shoule be "ebi2x", "ebi2"
|
||||
- clock-names: should be "ebi2x", "ebi2"
|
||||
|
||||
Optional subnodes:
|
||||
- Nodes inside the EBI2 will be considered device nodes.
|
||||
|
@ -100,7 +100,7 @@ Optional properties arrays for FAST chip selects:
|
|||
assertion, with respect to the cycle where ADV (address valid) is asserted.
|
||||
2 means 2 cycles between ADV and OE. Valid values 0, 1, 2 or 3.
|
||||
- qcom,xmem-read-hold-cycles: the length in cycles of the first segment of a
|
||||
read transfer. For a single read trandfer this will be the time from CS
|
||||
read transfer. For a single read transfer this will be the time from CS
|
||||
assertion to OE assertion. Valid values 0 thru 15.
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,20 @@ Required properties:
|
|||
- #clock-cells: Should be <1>. The permitted clock-specifier values can be
|
||||
found in include/dt-bindings/clock/bcm2835.h
|
||||
- reg: Specifies base physical address and size of the registers
|
||||
- clocks: The external oscillator clock phandle
|
||||
- clocks: phandles to the parent clocks used as input to the module, in
|
||||
the following order:
|
||||
|
||||
- External oscillator
|
||||
- DSI0 byte clock
|
||||
- DSI0 DDR2 clock
|
||||
- DSI0 DDR clock
|
||||
- DSI1 byte clock
|
||||
- DSI1 DDR2 clock
|
||||
- DSI1 DDR clock
|
||||
|
||||
Only external oscillator is required. The DSI clocks may
|
||||
not be present, in which case their children will be
|
||||
unusable.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
* Samsung Exynos4415 Clock Controller
|
||||
|
||||
The Exynos4415 clock controller generates and supplies clock to various
|
||||
consumer devices within the Exynos4415 SoC.
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: should be one of the following:
|
||||
- "samsung,exynos4415-cmu" - for the main system clocks controller
|
||||
(CMU_LEFTBUS, CMU_RIGHTBUS, CMU_TOP, CMU_CPU clock domains).
|
||||
- "samsung,exynos4415-cmu-dmc" - for the Exynos4415 SoC DRAM Memory
|
||||
Controller (DMC) domain clock controller.
|
||||
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
|
||||
- #clock-cells: should be 1.
|
||||
|
||||
Each clock is assigned an identifier and client nodes can use this identifier
|
||||
to specify the clock which they consume.
|
||||
|
||||
All available clocks are defined as preprocessor macros in
|
||||
dt-bindings/clock/exynos4415.h header and can be used in device
|
||||
tree sources.
|
||||
|
||||
Example 1: An example of a clock controller node is listed below.
|
||||
|
||||
cmu: clock-controller@10030000 {
|
||||
compatible = "samsung,exynos4415-cmu";
|
||||
reg = <0x10030000 0x18000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
cmu-dmc: clock-controller@105C0000 {
|
||||
compatible = "samsung,exynos4415-cmu-dmc";
|
||||
reg = <0x105C0000 0x3000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
|
@ -0,0 +1,42 @@
|
|||
* Hisilicon Hi3660 Clock Controller
|
||||
|
||||
The Hi3660 clock controller generates and supplies clock to various
|
||||
controllers within the Hi3660 SoC.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: the compatible should be one of the following strings to
|
||||
indicate the clock controller functionality.
|
||||
|
||||
- "hisilicon,hi3660-crgctrl"
|
||||
- "hisilicon,hi3660-pctrl"
|
||||
- "hisilicon,hi3660-pmuctrl"
|
||||
- "hisilicon,hi3660-sctrl"
|
||||
- "hisilicon,hi3660-iomcu"
|
||||
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
|
||||
- #clock-cells: should be 1.
|
||||
|
||||
Each clock is assigned an identifier and client nodes use this identifier
|
||||
to specify the clock which they consume.
|
||||
|
||||
All these identifier could be found in <dt-bindings/clock/hi3660-clock.h>.
|
||||
|
||||
Examples:
|
||||
crg_ctrl: clock-controller@fff35000 {
|
||||
compatible = "hisilicon,hi3660-crgctrl", "syscon";
|
||||
reg = <0x0 0xfff35000 0x0 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
uart0: serial@fdf02000 {
|
||||
compatible = "arm,pl011", "arm,primecell";
|
||||
reg = <0x0 0xfdf02000 0x0 0x1000>;
|
||||
interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&crg_ctrl HI3660_CLK_MUX_UART0>,
|
||||
<&crg_ctrl HI3660_PCLK>;
|
||||
clock-names = "uartclk", "apb_pclk";
|
||||
status = "disabled";
|
||||
};
|
|
@ -0,0 +1,65 @@
|
|||
Binding for IDT VersaClock5 programmable i2c clock generator.
|
||||
|
||||
The IDT VersaClock5 are programmable i2c clock generators providing
|
||||
from 3 to 12 output clocks.
|
||||
|
||||
==I2C device node==
|
||||
|
||||
Required properties:
|
||||
- compatible: shall be one of "idt,5p49v5923" , "idt,5p49v5933".
|
||||
- reg: i2c device address, shall be 0x68 or 0x6a.
|
||||
- #clock-cells: from common clock binding; shall be set to 1.
|
||||
- clocks: from common clock binding; list of parent clock handles,
|
||||
- 5p49v5923: (required) either or both of XTAL or CLKIN
|
||||
reference clock.
|
||||
- 5p49v5933: (optional) property not present (internal
|
||||
Xtal used) or CLKIN reference
|
||||
clock.
|
||||
- clock-names: from common clock binding; clock input names, can be
|
||||
- 5p49v5923: (required) either or both of "xin", "clkin".
|
||||
- 5p49v5933: (optional) property not present or "clkin".
|
||||
|
||||
==Mapping between clock specifier and physical pins==
|
||||
|
||||
When referencing the provided clock in the DT using phandle and
|
||||
clock specifier, the following mapping applies:
|
||||
|
||||
5P49V5923:
|
||||
0 -- OUT0_SEL_I2CB
|
||||
1 -- OUT1
|
||||
2 -- OUT2
|
||||
|
||||
5P49V5933:
|
||||
0 -- OUT0_SEL_I2CB
|
||||
1 -- OUT1
|
||||
2 -- OUT4
|
||||
|
||||
==Example==
|
||||
|
||||
/* 25MHz reference crystal */
|
||||
ref25: ref25m {
|
||||
compatible = "fixed-clock";
|
||||
#clock-cells = <0>;
|
||||
clock-frequency = <25000000>;
|
||||
};
|
||||
|
||||
i2c-master-node {
|
||||
|
||||
/* IDT 5P49V5923 i2c clock generator */
|
||||
vc5: clock-generator@6a {
|
||||
compatible = "idt,5p49v5923";
|
||||
reg = <0x6a>;
|
||||
#clock-cells = <1>;
|
||||
|
||||
/* Connect XIN input to 25MHz reference */
|
||||
clocks = <&ref25m>;
|
||||
clock-names = "xin";
|
||||
};
|
||||
};
|
||||
|
||||
/* Consumer referencing the 5P49V5923 pin OUT1 */
|
||||
consumer {
|
||||
...
|
||||
clocks = <&vc5 1>;
|
||||
...
|
||||
}
|
|
@ -7,6 +7,7 @@ Required properties:
|
|||
- compatible : must be "marvell,armada-370-corediv-clock",
|
||||
"marvell,armada-375-corediv-clock",
|
||||
"marvell,armada-380-corediv-clock",
|
||||
"marvell,mv98dx3236-corediv-clock",
|
||||
|
||||
- reg : must be the register address of Core Divider control register
|
||||
- #clock-cells : from common clock binding; shall be set to 1
|
||||
|
|
|
@ -3,6 +3,7 @@ Device Tree Clock bindings for cpu clock of Marvell EBU platforms
|
|||
Required properties:
|
||||
- compatible : shall be one of the following:
|
||||
"marvell,armada-xp-cpu-clock" - cpu clocks for Armada XP
|
||||
"marvell,mv98dx3236-cpu-clock" - cpu clocks for 98DX3236 SoC
|
||||
- reg : Address and length of the clock complex register set, followed
|
||||
by address and length of the PMU DFS registers
|
||||
- #clock-cells : should be set to 1.
|
||||
|
|
|
@ -117,7 +117,7 @@ ID Clock Peripheral
|
|||
25 tdm Time Division Mplx
|
||||
28 xor1 XOR DMA 1
|
||||
29 sata1lnk
|
||||
30 sata1 SATA Host 0
|
||||
30 sata1 SATA Host 1
|
||||
|
||||
The following is a list of provided IDs for Dove:
|
||||
ID Clock Peripheral
|
||||
|
|
|
@ -11,6 +11,7 @@ Required properties :
|
|||
compatible "qcom,rpmcc" should be also included.
|
||||
|
||||
"qcom,rpmcc-msm8916", "qcom,rpmcc"
|
||||
"qcom,rpmcc-msm8974", "qcom,rpmcc"
|
||||
"qcom,rpmcc-apq8064", "qcom,rpmcc"
|
||||
|
||||
- #clock-cells : shall contain 1
|
||||
|
|
|
@ -31,6 +31,7 @@ Required properties:
|
|||
* "fsl,t4240-clockgen"
|
||||
* "fsl,b4420-clockgen"
|
||||
* "fsl,b4860-clockgen"
|
||||
* "fsl,ls1012a-clockgen"
|
||||
* "fsl,ls1021a-clockgen"
|
||||
* "fsl,ls1043a-clockgen"
|
||||
* "fsl,ls1046a-clockgen"
|
||||
|
|
|
@ -42,6 +42,10 @@ Required Properties:
|
|||
Domain bindings in
|
||||
Documentation/devicetree/bindings/power/power_domain.txt.
|
||||
|
||||
- #reset-cells: Must be 1
|
||||
- The single reset specifier cell must be the module number, as defined
|
||||
in the datasheet.
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
@ -55,6 +59,7 @@ Examples
|
|||
clock-names = "extal", "extalr";
|
||||
#clock-cells = <2>;
|
||||
#power-domain-cells = <0>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
|
||||
|
@ -69,5 +74,6 @@ Examples
|
|||
dmas = <&dmac1 0x13>, <&dmac1 0x12>;
|
||||
dma-names = "tx", "rx";
|
||||
power-domains = <&cpg>;
|
||||
resets = <&cpg 310>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
* Rockchip RK3328 Clock and Reset Unit
|
||||
|
||||
The RK3328 clock controller generates and supplies clock to various
|
||||
controllers within the SoC and also implements a reset controller for SoC
|
||||
peripherals.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be "rockchip,rk3328-cru"
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
- #clock-cells: should be 1.
|
||||
- #reset-cells: should be 1.
|
||||
|
||||
Optional Properties:
|
||||
|
||||
- rockchip,grf: phandle to the syscon managing the "general register files"
|
||||
If missing pll rates are not changeable, due to the missing pll lock status.
|
||||
|
||||
Each clock is assigned an identifier and client nodes can use this identifier
|
||||
to specify the clock which they consume. All available clocks are defined as
|
||||
preprocessor macros in the dt-bindings/clock/rk3328-cru.h headers and can be
|
||||
used in device tree sources. Similar macros exist for the reset sources in
|
||||
these files.
|
||||
|
||||
External clocks:
|
||||
|
||||
There are several clocks that are generated outside the SoC. It is expected
|
||||
that they are defined using standard clock bindings with following
|
||||
clock-output-names:
|
||||
- "xin24m" - crystal input - required,
|
||||
- "clkin_i2s" - external I2S clock - optional,
|
||||
- "gmac_clkin" - external GMAC clock - optional
|
||||
- "phy_50m_out" - output clock of the pll in the mac phy
|
||||
|
||||
Example: Clock controller node:
|
||||
|
||||
cru: clock-controller@ff440000 {
|
||||
compatible = "rockchip,rk3328-cru";
|
||||
reg = <0x0 0xff440000 0x0 0x1000>;
|
||||
rockchip,grf = <&grf>;
|
||||
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
Example: UART controller node that consumes the clock generated by the clock
|
||||
controller:
|
||||
|
||||
uart0: serial@ff120000 {
|
||||
compatible = "snps,dw-apb-uart";
|
||||
reg = <0xff120000 0x100>;
|
||||
interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&cru SCLK_UART0>;
|
||||
};
|
|
@ -13,6 +13,12 @@ Required Properties:
|
|||
- #clock-cells: should be 1.
|
||||
- #reset-cells: should be 1.
|
||||
|
||||
Optional Properties:
|
||||
|
||||
- rockchip,grf: phandle to the syscon managing the "general register files".
|
||||
It is used for GRF muxes, if missing any muxes present in the GRF will not
|
||||
be available.
|
||||
|
||||
Each clock is assigned an identifier and client nodes can use this identifier
|
||||
to specify the clock which they consume. All available clocks are defined as
|
||||
preprocessor macros in the dt-bindings/clock/rk3399-cru.h headers and can be
|
||||
|
|
|
@ -10,6 +10,7 @@ Required properties:
|
|||
- compatible: Should be:
|
||||
"st,stm32f42xx-rcc"
|
||||
"st,stm32f469-rcc"
|
||||
"st,stm32f746-rcc"
|
||||
- reg: should be register base and length as documented in the
|
||||
datasheet
|
||||
- #reset-cells: 1, see below
|
||||
|
@ -17,6 +18,9 @@ Required properties:
|
|||
property, containing a phandle to the clock device node, an index selecting
|
||||
between gated clocks and other clocks and an index specifying the clock to
|
||||
use.
|
||||
- clocks: External oscillator clock phandle
|
||||
- high speed external clock signal (HSE)
|
||||
- external I2S clock (I2S_CKIN)
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -25,6 +29,7 @@ Example:
|
|||
#clock-cells = <2>
|
||||
compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
|
||||
reg = <0x40023800 0x400>;
|
||||
clocks = <&clk_hse>, <&clk_i2s_ckin>;
|
||||
};
|
||||
|
||||
Specifying gated clocks
|
||||
|
@ -66,6 +71,38 @@ The secondary index is bound with the following magic numbers:
|
|||
|
||||
0 SYSTICK
|
||||
1 FCLK
|
||||
2 CLK_LSI (low-power clock source)
|
||||
3 CLK_LSE (generated from a 32.768 kHz low-speed external
|
||||
crystal or ceramic resonator)
|
||||
4 CLK_HSE_RTC (HSE division factor for RTC clock)
|
||||
5 CLK_RTC (real-time clock)
|
||||
6 PLL_VCO_I2S (vco frequency of I2S pll)
|
||||
7 PLL_VCO_SAI (vco frequency of SAI pll)
|
||||
8 CLK_LCD (LCD-TFT)
|
||||
9 CLK_I2S (I2S clocks)
|
||||
10 CLK_SAI1 (audio clocks)
|
||||
11 CLK_SAI2
|
||||
12 CLK_I2SQ_PDIV (post divisor of pll i2s q divisor)
|
||||
13 CLK_SAIQ_PDIV (post divisor of pll sai q divisor)
|
||||
|
||||
14 CLK_HSI (Internal ocscillator clock)
|
||||
15 CLK_SYSCLK (System Clock)
|
||||
16 CLK_HDMI_CEC (HDMI-CEC clock)
|
||||
17 CLK_SPDIF (SPDIF-Rx clock)
|
||||
18 CLK_USART1 (U(s)arts clocks)
|
||||
19 CLK_USART2
|
||||
20 CLK_USART3
|
||||
21 CLK_UART4
|
||||
22 CLK_UART5
|
||||
23 CLK_USART6
|
||||
24 CLK_UART7
|
||||
25 CLK_UART8
|
||||
26 CLK_I2C1 (I2S clocks)
|
||||
27 CLK_I2C2
|
||||
28 CLK_I2C3
|
||||
29 CLK_I2C4
|
||||
30 CLK_LPTIMER (LPTimer1 clock)
|
||||
)
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
Clock bindings for ST-Ericsson ABx500 clocks
|
||||
|
||||
Required properties :
|
||||
- compatible : shall contain the following:
|
||||
"stericsson,ab8500-clk"
|
||||
- #clock-cells should be <1>
|
||||
|
||||
The ABx500 clocks need to be placed as a subnode of an AB8500
|
||||
device node, see mfd/ab8500.txt
|
||||
|
||||
All available clocks are defined as preprocessor macros in
|
||||
dt-bindings/clock/ste-ab8500.h header and can be used in device
|
||||
tree sources.
|
||||
|
||||
Example:
|
||||
|
||||
clock-controller {
|
||||
compatible = "stericsson,ab8500-clk";
|
||||
#clock-cells = <1>;
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
Allwinner A80 Display Engine Clock Control Binding
|
||||
--------------------------------------------------
|
||||
|
||||
Required properties :
|
||||
- compatible: must contain one of the following compatibles:
|
||||
- "allwinner,sun9i-a80-de-clks"
|
||||
|
||||
- reg: Must contain the registers base address and length
|
||||
- clocks: phandle to the clocks feeding the display engine subsystem.
|
||||
Three are needed:
|
||||
- "mod": the display engine module clock
|
||||
- "dram": the DRAM bus clock for the system
|
||||
- "bus": the bus clock for the whole display engine subsystem
|
||||
- clock-names: Must contain the clock names described just above
|
||||
- resets: phandle to the reset control for the display engine subsystem.
|
||||
- #clock-cells : must contain 1
|
||||
- #reset-cells : must contain 1
|
||||
|
||||
Example:
|
||||
de_clocks: clock@3000000 {
|
||||
compatible = "allwinner,sun9i-a80-de-clks";
|
||||
reg = <0x03000000 0x30>;
|
||||
clocks = <&ccu CLK_DE>, <&ccu CLK_SDRAM>, <&ccu CLK_BUS_DE>;
|
||||
clock-names = "mod", "dram", "bus";
|
||||
resets = <&ccu RST_BUS_DE>;
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
|
@ -0,0 +1,24 @@
|
|||
Allwinner A80 USB Clock Control Binding
|
||||
---------------------------------------
|
||||
|
||||
Required properties :
|
||||
- compatible: must contain one of the following compatibles:
|
||||
- "allwinner,sun9i-a80-usb-clocks"
|
||||
|
||||
- reg: Must contain the registers base address and length
|
||||
- clocks: phandle to the clocks feeding the USB subsystem. Two are needed:
|
||||
- "bus": the bus clock for the whole USB subsystem
|
||||
- "hosc": the high frequency oscillator (usually at 24MHz)
|
||||
- clock-names: Must contain the clock names described just above
|
||||
- #clock-cells : must contain 1
|
||||
- #reset-cells : must contain 1
|
||||
|
||||
Example:
|
||||
usb_clocks: clock@a08000 {
|
||||
compatible = "allwinner,sun9i-a80-usb-clks";
|
||||
reg = <0x00a08000 0x8>;
|
||||
clocks = <&ccu CLK_BUS_USB>, <&osc24M>;
|
||||
clock-names = "bus", "hosc";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
|
@ -7,6 +7,8 @@ Required properties :
|
|||
- "allwinner,sun8i-a23-ccu"
|
||||
- "allwinner,sun8i-a33-ccu"
|
||||
- "allwinner,sun8i-h3-ccu"
|
||||
- "allwinner,sun8i-v3s-ccu"
|
||||
- "allwinner,sun9i-a80-ccu"
|
||||
- "allwinner,sun50i-a64-ccu"
|
||||
|
||||
- reg: Must contain the registers base address and length
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
Binding for TO CDCE925 programmable I2C clock synthesizers.
|
||||
Binding for TI CDCE913/925/937/949 programmable I2C clock synthesizers.
|
||||
|
||||
Reference
|
||||
This binding uses the common clock binding[1].
|
||||
|
||||
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
|
||||
[2] http://www.ti.com/product/cdce925
|
||||
[2] http://www.ti.com/product/cdce913
|
||||
[3] http://www.ti.com/product/cdce925
|
||||
[4] http://www.ti.com/product/cdce937
|
||||
[5] http://www.ti.com/product/cdce949
|
||||
|
||||
The driver provides clock sources for each output Y1 through Y5.
|
||||
|
||||
Required properties:
|
||||
- compatible: Shall be "ti,cdce925"
|
||||
- compatible: Shall be one of the following:
|
||||
- "ti,cdce913": 1-PLL, 3 Outputs
|
||||
- "ti,cdce925": 2-PLL, 5 Outputs
|
||||
- "ti,cdce937": 3-PLL, 7 Outputs
|
||||
- "ti,cdce949": 4-PLL, 9 Outputs
|
||||
- reg: I2C device address.
|
||||
- clocks: Points to a fixed parent clock that provides the input frequency.
|
||||
- #clock-cells: From common clock bindings: Shall be 1.
|
||||
|
@ -18,7 +25,7 @@ Optional properties:
|
|||
- xtal-load-pf: Crystal load-capacitor value to fine-tune performance on a
|
||||
board, or to compensate for external influences.
|
||||
|
||||
For both PLL1 and PLL2 an optional child node can be used to specify spread
|
||||
For all PLL1, PLL2, ... an optional child node can be used to specify spread
|
||||
spectrum clocking parameters for a board.
|
||||
- spread-spectrum: SSC mode as defined in the data sheet.
|
||||
- spread-spectrum-center: Use "centered" mode instead of "max" mode. When
|
||||
|
|
|
@ -13,6 +13,9 @@ Required properties:
|
|||
"zte,zx296718-lsp1crm":
|
||||
zx296718 device level clock selection and gating
|
||||
|
||||
"zte,zx296718-audiocrm":
|
||||
zx296718 audio clock selection, divider and gating
|
||||
|
||||
- reg: Address and length of the register set
|
||||
|
||||
The clock consumer should specify the desired clock by having the clock
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
The Broadcom Secure Processing Unit (SPU) hardware supports symmetric
|
||||
cryptographic offload for Broadcom SoCs. A SoC may have multiple SPU hardware
|
||||
blocks.
|
||||
|
||||
Required properties:
|
||||
- compatible: Should be one of the following:
|
||||
brcm,spum-crypto - for devices with SPU-M hardware
|
||||
brcm,spu2-crypto - for devices with SPU2 hardware
|
||||
brcm,spu2-v2-crypto - for devices with enhanced SPU2 hardware features like SHA3
|
||||
and Rabin Fingerprint support
|
||||
brcm,spum-nsp-crypto - for the Northstar Plus variant of the SPU-M hardware
|
||||
|
||||
- reg: Should contain SPU registers location and length.
|
||||
- mboxes: The mailbox channel to be used to communicate with the SPU.
|
||||
Mailbox channels correspond to DMA rings on the device.
|
||||
|
||||
Example:
|
||||
crypto@612d0000 {
|
||||
compatible = "brcm,spum-crypto";
|
||||
reg = <0 0x612d0000 0 0x900>;
|
||||
mboxes = <&pdc0 0>;
|
||||
};
|
|
@ -0,0 +1,27 @@
|
|||
MediaTek cryptographic accelerators
|
||||
|
||||
Required properties:
|
||||
- compatible: Should be "mediatek,eip97-crypto"
|
||||
- reg: Address and length of the register set for the device
|
||||
- interrupts: Should contain the five crypto engines interrupts in numeric
|
||||
order. These are global system and four descriptor rings.
|
||||
- clocks: the clock used by the core
|
||||
- clock-names: the names of the clock listed in the clocks property. These are
|
||||
"ethif", "cryp"
|
||||
- power-domains: Must contain a reference to the PM domain.
|
||||
|
||||
|
||||
Example:
|
||||
crypto: crypto@1b240000 {
|
||||
compatible = "mediatek,eip97-crypto";
|
||||
reg = <0 0x1b240000 0 0x20000>;
|
||||
interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_LOW>,
|
||||
<GIC_SPI 83 IRQ_TYPE_LEVEL_LOW>,
|
||||
<GIC_SPI 84 IRQ_TYPE_LEVEL_LOW>,
|
||||
<GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>,
|
||||
<GIC_SPI 97 IRQ_TYPE_LEVEL_LOW>;
|
||||
clocks = <&topckgen CLK_TOP_ETHIF_SEL>,
|
||||
<ðsys CLK_ETHSYS_CRYPTO>;
|
||||
clock-names = "ethif","cryp";
|
||||
power-domains = <&scpsys MT2701_POWER_DOMAIN_ETH>;
|
||||
};
|
|
@ -22,7 +22,7 @@ Required properties:
|
|||
|
||||
- clocks: contains phandle and clock specifier pairs for the entries
|
||||
in the clock-names property. See
|
||||
Documentation/devicetree/binding/clock/clock-bindings.txt
|
||||
Documentation/devicetree/bindings/clock/clock-bindings.txt
|
||||
|
||||
Optional properties:
|
||||
|
||||
|
|
|
@ -56,6 +56,18 @@ Required properties for V3D:
|
|||
- interrupts: The interrupt number
|
||||
See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
|
||||
|
||||
Required properties for DSI:
|
||||
- compatible: Should be "brcm,bcm2835-dsi0" or "brcm,bcm2835-dsi1"
|
||||
- reg: Physical base address and length of the DSI block's registers
|
||||
- interrupts: The interrupt number
|
||||
See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
|
||||
- clocks: a) phy: The DSI PLL clock feeding the DSI analog PHY
|
||||
b) escape: The DSI ESC clock from CPRMAN
|
||||
c) pixel: The DSI pixel clock from CPRMAN
|
||||
- clock-output-names:
|
||||
The 3 clocks output from the DSI analog PHY: dsi[01]_byte,
|
||||
dsi[01]_ddr2, and dsi[01]_ddr
|
||||
|
||||
[1] Documentation/devicetree/bindings/media/video-interfaces.txt
|
||||
|
||||
Example:
|
||||
|
@ -99,6 +111,29 @@ dpi: dpi@7e208000 {
|
|||
};
|
||||
};
|
||||
|
||||
dsi1: dsi@7e700000 {
|
||||
compatible = "brcm,bcm2835-dsi1";
|
||||
reg = <0x7e700000 0x8c>;
|
||||
interrupts = <2 12>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
#clock-cells = <1>;
|
||||
|
||||
clocks = <&clocks BCM2835_PLLD_DSI1>,
|
||||
<&clocks BCM2835_CLOCK_DSI1E>,
|
||||
<&clocks BCM2835_CLOCK_DSI1P>;
|
||||
clock-names = "phy", "escape", "pixel";
|
||||
|
||||
clock-output-names = "dsi1_byte", "dsi1_ddr2", "dsi1_ddr";
|
||||
|
||||
pitouchscreen: panel@0 {
|
||||
compatible = "raspberrypi,touchscreen";
|
||||
reg = <0>;
|
||||
|
||||
<...>
|
||||
};
|
||||
};
|
||||
|
||||
vec: vec@7e806000 {
|
||||
compatible = "brcm,bcm2835-vec";
|
||||
reg = <0x7e806000 0x1000>;
|
||||
|
|
|
@ -38,10 +38,22 @@ The following input format properties are required except in "rgb 1x" and
|
|||
- adi,input-justification: The input bit justification ("left", "evenly",
|
||||
"right").
|
||||
|
||||
- avdd-supply: A 1.8V supply that powers up the AVDD pin on the chip.
|
||||
- dvdd-supply: A 1.8V supply that powers up the DVDD pin on the chip.
|
||||
- pvdd-supply: A 1.8V supply that powers up the PVDD pin on the chip.
|
||||
- dvdd-3v-supply: A 3.3V supply that powers up the pin called DVDD_3V
|
||||
on the chip.
|
||||
- bgvdd-supply: A 1.8V supply that powers up the BGVDD pin. This is
|
||||
needed only for ADV7511.
|
||||
|
||||
The following properties are required for ADV7533:
|
||||
|
||||
- adi,dsi-lanes: Number of DSI data lanes connected to the DSI host. It should
|
||||
be one of 1, 2, 3 or 4.
|
||||
- a2vdd-supply: 1.8V supply that powers up the A2VDD pin on the chip.
|
||||
- v3p3-supply: A 3.3V supply that powers up the V3P3 pin on the chip.
|
||||
- v1p2-supply: A supply that powers up the V1P2 pin on the chip. It can be
|
||||
either 1.2V or 1.8V.
|
||||
|
||||
Optional properties:
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ Optional properties for dp-controller:
|
|||
in Documentation/devicetree/bindings/media/video-interfaces.txt,
|
||||
please refer to the SoC specific binding document:
|
||||
* Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
|
||||
* Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
|
||||
* Documentation/devicetree/bindings/display/rockchip/analogix_dp-rockchip.txt
|
||||
|
||||
[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
|
@ -1,52 +1,33 @@
|
|||
DesignWare HDMI bridge bindings
|
||||
Synopsys DesignWare HDMI TX Encoder
|
||||
===================================
|
||||
|
||||
Required properties:
|
||||
- compatible: platform specific such as:
|
||||
* "snps,dw-hdmi-tx"
|
||||
* "fsl,imx6q-hdmi"
|
||||
* "fsl,imx6dl-hdmi"
|
||||
* "rockchip,rk3288-dw-hdmi"
|
||||
- reg: Physical base address and length of the controller's registers.
|
||||
- interrupts: The HDMI interrupt number
|
||||
- clocks, clock-names : must have the phandles to the HDMI iahb and isfr clocks,
|
||||
as described in Documentation/devicetree/bindings/clock/clock-bindings.txt,
|
||||
the clocks are soc specific, the clock-names should be "iahb", "isfr"
|
||||
-port@[X]: SoC specific port nodes with endpoint definitions as defined
|
||||
in Documentation/devicetree/bindings/media/video-interfaces.txt,
|
||||
please refer to the SoC specific binding document:
|
||||
* Documentation/devicetree/bindings/display/imx/hdmi.txt
|
||||
* Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt
|
||||
This document defines device tree properties for the Synopsys DesignWare HDMI
|
||||
TX Encoder (DWC HDMI TX). It doesn't constitue a device tree binding
|
||||
specification by itself but is meant to be referenced by platform-specific
|
||||
device tree bindings.
|
||||
|
||||
Optional properties
|
||||
- reg-io-width: the width of the reg:1,4, default set to 1 if not present
|
||||
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing,
|
||||
if the property is omitted, a functionally reduced I2C bus
|
||||
controller on DW HDMI is probed
|
||||
- clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
|
||||
When referenced from platform device tree bindings the properties defined in
|
||||
this document are defined as follows. The platform device tree bindings are
|
||||
responsible for defining whether each property is required or optional.
|
||||
|
||||
Example:
|
||||
hdmi: hdmi@0120000 {
|
||||
compatible = "fsl,imx6q-hdmi";
|
||||
reg = <0x00120000 0x9000>;
|
||||
interrupts = <0 115 0x04>;
|
||||
gpr = <&gpr>;
|
||||
clocks = <&clks 123>, <&clks 124>;
|
||||
clock-names = "iahb", "isfr";
|
||||
ddc-i2c-bus = <&i2c2>;
|
||||
- reg: Memory mapped base address and length of the DWC HDMI TX registers.
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
- reg-io-width: Width of the registers specified by the reg property. The
|
||||
value is expressed in bytes and must be equal to 1 or 4 if specified. The
|
||||
register width defaults to 1 if the property is not present.
|
||||
|
||||
hdmi_mux_0: endpoint {
|
||||
remote-endpoint = <&ipu1_di0_hdmi>;
|
||||
};
|
||||
};
|
||||
- interrupts: Reference to the DWC HDMI TX interrupt.
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
- clocks: References to all the clocks specified in the clock-names property
|
||||
as specified in Documentation/devicetree/bindings/clock/clock-bindings.txt.
|
||||
|
||||
hdmi_mux_1: endpoint {
|
||||
remote-endpoint = <&ipu1_di1_hdmi>;
|
||||
};
|
||||
};
|
||||
};
|
||||
- clock-names: The DWC HDMI TX uses the following clocks.
|
||||
|
||||
- "iahb" is the bus clock for either AHB and APB (mandatory).
|
||||
- "isfr" is the internal register configuration clock (mandatory).
|
||||
- "cec" is the HDMI CEC controller main clock (optional).
|
||||
|
||||
- ports: The connectivity of the DWC HDMI TX with the rest of the system is
|
||||
expressed in using ports as specified in the device graph bindings defined
|
||||
in Documentation/devicetree/bindings/graph.txt. The numbering of the ports
|
||||
is platform-specific.
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
THS8135 Video DAC
|
||||
-----------------
|
||||
|
||||
This is the binding for Texas Instruments THS8135 Video DAC bridge.
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: Must be "ti,ths8135"
|
||||
|
||||
Required nodes:
|
||||
|
||||
This device has two video ports. Their connections are modelled using the OF
|
||||
graph bindings specified in Documentation/devicetree/bindings/graph.txt.
|
||||
|
||||
- Video port 0 for RGB input
|
||||
- Video port 1 for VGA output
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
vga-bridge {
|
||||
compatible = "ti,ths8135";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
|
||||
vga_bridge_in: endpoint {
|
||||
remote-endpoint = <&lcdc_out_vga>;
|
||||
};
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
|
||||
vga_bridge_out: endpoint {
|
||||
remote-endpoint = <&vga_con_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
|
@ -6,7 +6,7 @@ Required properties:
|
|||
location and size of the framebuffer memory.
|
||||
- clocks : phandle + clock specifier pair of the FB reference clock.
|
||||
- display : phandle to a display node as described in
|
||||
Documentation/devicetree/bindings/display/display-timing.txt.
|
||||
Documentation/devicetree/bindings/display/panel/display-timing.txt.
|
||||
Additionally, the display node has to define properties:
|
||||
- bits-per-pixel: Bits per pixel.
|
||||
- ac-prescale : LCD AC bias frequency. This frequency is the required
|
||||
|
|
|
@ -33,12 +33,12 @@ Required properties:
|
|||
- i80-if-timings: timing configuration for lcd i80 interface support.
|
||||
|
||||
Optional Properties:
|
||||
- samsung,power-domain: a phandle to DECON power domain node.
|
||||
- power-domains: a phandle to DECON power domain node.
|
||||
- display-timings: timing settings for DECON, as described in document [1].
|
||||
Can be used in case timings cannot be provided otherwise
|
||||
or to override timings provided by the panel.
|
||||
|
||||
[1]: Documentation/devicetree/bindings/display/display-timing.txt
|
||||
[1]: Documentation/devicetree/bindings/display/panel/display-timing.txt
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ in [2]. The following are properties specific to those nodes:
|
|||
3 - for parallel output,
|
||||
4 - for write-back interface
|
||||
|
||||
[1]: Documentation/devicetree/bindings/display/display-timing.txt
|
||||
[1]: Documentation/devicetree/bindings/display/panel/display-timing.txt
|
||||
[2]: Documentation/devicetree/bindings/media/video-interfaces.txt
|
||||
|
||||
Example:
|
||||
|
|
|
@ -16,7 +16,7 @@ Required properties:
|
|||
"clk_ade_core" for the ADE core clock.
|
||||
"clk_codec_jpeg" for the media NOC QoS clock, which use the same clock with
|
||||
jpeg codec.
|
||||
"clk_ade_pix" for the ADE pixel clok.
|
||||
"clk_ade_pix" for the ADE pixel clock.
|
||||
- assigned-clocks: Should contain "clk_ade_core" and "clk_codec_jpeg" clocks'
|
||||
phandle + clock-specifier pairs.
|
||||
- assigned-clock-rates: clock rates, one for each entry in assigned-clocks.
|
||||
|
|
|
@ -9,7 +9,7 @@ Required properties:
|
|||
|
||||
Required nodes:
|
||||
- display: Phandle to a display node as described in
|
||||
Documentation/devicetree/bindings/display/display-timing.txt
|
||||
Documentation/devicetree/bindings/display/panel/display-timing.txt
|
||||
Additional, the display node has to define properties:
|
||||
- bits-per-pixel: Bits per pixel
|
||||
- fsl,pcr: LCDC PCR value
|
||||
|
|
|
@ -1,29 +1,36 @@
|
|||
Device-Tree bindings for HDMI Transmitter
|
||||
Freescale i.MX6 DWC HDMI TX Encoder
|
||||
===================================
|
||||
|
||||
HDMI Transmitter
|
||||
================
|
||||
The HDMI transmitter is a Synopsys DesignWare HDMI 1.4 TX controller IP
|
||||
with a companion PHY IP.
|
||||
|
||||
These DT bindings follow the Synopsys DWC HDMI TX bindings defined in
|
||||
Documentation/devicetree/bindings/display/bridge/dw_hdmi.txt with the
|
||||
following device-specific properties.
|
||||
|
||||
The HDMI Transmitter is a Synopsys DesignWare HDMI 1.4 TX controller IP
|
||||
with accompanying PHY IP.
|
||||
|
||||
Required properties:
|
||||
- #address-cells : should be <1>
|
||||
- #size-cells : should be <0>
|
||||
- compatible : should be "fsl,imx6q-hdmi" or "fsl,imx6dl-hdmi".
|
||||
- gpr : should be <&gpr>.
|
||||
The phandle points to the iomuxc-gpr region containing the HDMI
|
||||
multiplexer control register.
|
||||
- clocks, clock-names : phandles to the HDMI iahb and isrf clocks, as described
|
||||
in Documentation/devicetree/bindings/clock/clock-bindings.txt and
|
||||
Documentation/devicetree/bindings/clock/imx6q-clock.txt.
|
||||
- port@[0-4]: Up to four port nodes with endpoint definitions as defined in
|
||||
Documentation/devicetree/bindings/media/video-interfaces.txt,
|
||||
corresponding to the four inputs to the HDMI multiplexer.
|
||||
|
||||
Optional properties:
|
||||
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
|
||||
- compatible : Shall be one of "fsl,imx6q-hdmi" or "fsl,imx6dl-hdmi".
|
||||
- reg: See dw_hdmi.txt.
|
||||
- interrupts: HDMI interrupt number
|
||||
- clocks: See dw_hdmi.txt.
|
||||
- clock-names: Shall contain "iahb" and "isfr" as defined in dw_hdmi.txt.
|
||||
- ports: See dw_hdmi.txt. The DWC HDMI shall have between one and four ports,
|
||||
numbered 0 to 3, corresponding to the four inputs of the HDMI multiplexer.
|
||||
Each port shall have a single endpoint.
|
||||
- gpr : Shall contain a phandle to the iomuxc-gpr region containing the HDMI
|
||||
multiplexer control register.
|
||||
|
||||
example:
|
||||
Optional properties
|
||||
|
||||
- ddc-i2c-bus: The HDMI DDC bus can be connected to either a system I2C master
|
||||
or the functionally-reduced I2C master contained in the DWC HDMI. When
|
||||
connected to a system I2C master this property contains a phandle to that
|
||||
I2C master controller.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
gpr: iomuxc-gpr@020e0000 {
|
||||
/* ... */
|
||||
|
|
|
@ -64,7 +64,7 @@ Required properties:
|
|||
Optional properties (required if display-timings are used):
|
||||
- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
|
||||
- display-timings : A node that describes the display timings as defined in
|
||||
Documentation/devicetree/bindings/display/display-timing.txt.
|
||||
Documentation/devicetree/bindings/display/panel/display-timing.txt.
|
||||
- fsl,data-mapping : should be "spwg" or "jeida"
|
||||
This describes how the color bits are laid out in the
|
||||
serialized LVDS signal.
|
||||
|
|
|
@ -55,7 +55,7 @@ Required properties (DMA function blocks):
|
|||
"mediatek,<chip>-disp-rdma"
|
||||
"mediatek,<chip>-disp-wdma"
|
||||
- larb: Should contain a phandle pointing to the local arbiter device as defined
|
||||
in Documentation/devicetree/bindings/soc/mediatek/mediatek,smi-larb.txt
|
||||
in Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
|
||||
- iommus: Should point to the respective IOMMU block with master port as
|
||||
argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
|
||||
for details.
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче