summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-09 15:34:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-09 15:34:26 -0400
commite9a83bd2322035ed9d7dcf35753d3f984d76c6a5 (patch)
tree66dc466ff9aec0f9bb7f39cba50a47eab6585559
parent7011b7e1b702cc76f9e969b41d9a95969f2aecaa (diff)
parent454f96f2b738374da4b0a703b1e2e7aed82c4486 (diff)
Merge tag 'docs-5.3' of git://git.lwn.net/linux
Pull Documentation updates from Jonathan Corbet: "It's been a relatively busy cycle for docs: - A fair pile of RST conversions, many from Mauro. These create more than the usual number of simple but annoying merge conflicts with other trees, unfortunately. He has a lot more of these waiting on the wings that, I think, will go to you directly later on. - A new document on how to use merges and rebases in kernel repos, and one on Spectre vulnerabilities. - Various improvements to the build system, including automatic markup of function() references because some people, for reasons I will never understand, were of the opinion that :c:func:``function()`` is unattractive and not fun to type. - We now recommend using sphinx 1.7, but still support back to 1.4. - Lots of smaller improvements, warning fixes, typo fixes, etc" * tag 'docs-5.3' of git://git.lwn.net/linux: (129 commits) docs: automarkup.py: ignore exceptions when seeking for xrefs docs: Move binderfs to admin-guide Disable Sphinx SmartyPants in HTML output doc: RCU callback locks need only _bh, not necessarily _irq docs: format kernel-parameters -- as code Doc : doc-guide : Fix a typo platform: x86: get rid of a non-existent document Add the RCU docs to the core-api manual Documentation: RCU: Add TOC tree hooks Documentation: RCU: Rename txt files to rst Documentation: RCU: Convert RCU UP systems to reST Documentation: RCU: Convert RCU linked list to reST Documentation: RCU: Convert RCU basic concepts to reST docs: filesystems: Remove uneeded .rst extension on toctables scripts/sphinx-pre-install: fix out-of-tree build docs: zh_CN: submitting-drivers.rst: Remove a duplicated Documentation/ Documentation: PGP: update for newer HW devices Documentation: Add section about CPU vulnerabilities for Spectre Documentation: platform: Delete x86-laptop-drivers.txt docs: Note that :c:func: should no longer be used ...
-rw-r--r--Documentation/ABI/testing/sysfs-devices-system-cpu3
-rw-r--r--Documentation/ABI/testing/sysfs-kernel-uids2
-rw-r--r--Documentation/DMA-API.txt2
-rw-r--r--Documentation/EDID/howto.rst (renamed from Documentation/EDID/HOWTO.txt)35
-rw-r--r--Documentation/Kconfig13
-rw-r--r--Documentation/Makefile14
-rw-r--r--Documentation/RCU/UP.rst (renamed from Documentation/RCU/UP.txt)50
-rw-r--r--Documentation/RCU/index.rst19
-rw-r--r--Documentation/RCU/listRCU.rst (renamed from Documentation/RCU/listRCU.txt)38
-rw-r--r--Documentation/RCU/rcu.rst92
-rw-r--r--Documentation/RCU/rcu.txt89
-rw-r--r--Documentation/accelerators/ocxl.rst2
-rw-r--r--Documentation/acpi/dsd/leds.txt2
-rw-r--r--Documentation/admin-guide/README.rst2
-rw-r--r--Documentation/admin-guide/binderfs.rst (renamed from Documentation/filesystems/binderfs.rst)0
-rw-r--r--Documentation/admin-guide/bug-hunting.rst2
-rw-r--r--Documentation/admin-guide/hw-vuln/index.rst1
-rw-r--r--Documentation/admin-guide/hw-vuln/spectre.rst697
-rw-r--r--Documentation/admin-guide/index.rst1
-rw-r--r--Documentation/admin-guide/kernel-parameters.rst10
-rw-r--r--Documentation/admin-guide/kernel-parameters.txt38
-rw-r--r--Documentation/admin-guide/mm/numaperf.rst5
-rw-r--r--Documentation/admin-guide/ras.rst2
-rw-r--r--Documentation/aoe/aoe.rst (renamed from Documentation/aoe/aoe.txt)65
-rw-r--r--Documentation/aoe/examples.rst23
-rw-r--r--Documentation/aoe/index.rst19
-rw-r--r--Documentation/aoe/todo.rst (renamed from Documentation/aoe/todo.txt)3
-rw-r--r--Documentation/aoe/udev.txt2
-rw-r--r--Documentation/arm/mem_alignment2
-rw-r--r--Documentation/arm/stm32/overview.rst2
-rw-r--r--Documentation/arm/stm32/stm32f429-overview.rst2
-rw-r--r--Documentation/arm/stm32/stm32f746-overview.rst2
-rw-r--r--Documentation/arm/stm32/stm32f769-overview.rst2
-rw-r--r--Documentation/arm/stm32/stm32h743-overview.rst2
-rw-r--r--Documentation/arm/stm32/stm32mp157-overview.rst2
-rw-r--r--Documentation/arm64/acpi_object_usage.rst (renamed from Documentation/arm64/acpi_object_usage.txt)288
-rw-r--r--Documentation/arm64/arm-acpi.rst (renamed from Documentation/arm64/arm-acpi.txt)163
-rw-r--r--Documentation/arm64/booting.rst (renamed from Documentation/arm64/booting.txt)91
-rw-r--r--Documentation/arm64/cpu-feature-registers.rst (renamed from Documentation/arm64/cpu-feature-registers.txt)210
-rw-r--r--Documentation/arm64/elf_hwcaps.rst (renamed from Documentation/arm64/elf_hwcaps.txt)56
-rw-r--r--Documentation/arm64/hugetlbpage.rst (renamed from Documentation/arm64/hugetlbpage.txt)7
-rw-r--r--Documentation/arm64/index.rst28
-rw-r--r--Documentation/arm64/legacy_instructions.rst (renamed from Documentation/arm64/legacy_instructions.txt)43
-rw-r--r--Documentation/arm64/memory.rst98
-rw-r--r--Documentation/arm64/memory.txt97
-rw-r--r--Documentation/arm64/pointer-authentication.rst (renamed from Documentation/arm64/pointer-authentication.txt)2
-rw-r--r--Documentation/arm64/silicon-errata.rst (renamed from Documentation/arm64/silicon-errata.txt)65
-rw-r--r--Documentation/arm64/sve.rst (renamed from Documentation/arm64/sve.txt)12
-rw-r--r--Documentation/arm64/tagged-pointers.rst (renamed from Documentation/arm64/tagged-pointers.txt)6
-rw-r--r--Documentation/bpf/btf.rst2
-rw-r--r--Documentation/cdrom/Makefile21
-rw-r--r--Documentation/cdrom/cdrom-standard.rst1063
-rw-r--r--Documentation/cdrom/cdrom-standard.tex1026
-rw-r--r--Documentation/cdrom/ide-cd.rst (renamed from Documentation/cdrom/ide-cd)202
-rw-r--r--Documentation/cdrom/index.rst19
-rw-r--r--Documentation/cdrom/packet-writing.rst (renamed from Documentation/cdrom/packet-writing.txt)27
-rw-r--r--Documentation/conf.py5
-rw-r--r--Documentation/core-api/index.rst2
-rw-r--r--Documentation/core-api/kernel-api.rst14
-rw-r--r--Documentation/core-api/protection-keys.rst (renamed from Documentation/x86/protection-keys.rst)0
-rw-r--r--Documentation/core-api/timekeeping.rst2
-rw-r--r--Documentation/core-api/xarray.rst270
-rw-r--r--Documentation/device-mapper/cache-policies.rst (renamed from Documentation/device-mapper/cache-policies.txt)24
-rw-r--r--Documentation/device-mapper/cache.rst (renamed from Documentation/device-mapper/cache.txt)214
-rw-r--r--Documentation/device-mapper/delay.rst (renamed from Documentation/device-mapper/delay.txt)29
-rw-r--r--Documentation/device-mapper/dm-crypt.rst (renamed from Documentation/device-mapper/dm-crypt.txt)61
-rw-r--r--Documentation/device-mapper/dm-flakey.rst (renamed from Documentation/device-mapper/dm-flakey.txt)45
-rw-r--r--Documentation/device-mapper/dm-init.rst (renamed from Documentation/device-mapper/dm-init.txt)89
-rw-r--r--Documentation/device-mapper/dm-integrity.rst (renamed from Documentation/device-mapper/dm-integrity.txt)62
-rw-r--r--Documentation/device-mapper/dm-io.rst (renamed from Documentation/device-mapper/dm-io.txt)14
-rw-r--r--Documentation/device-mapper/dm-log.rst (renamed from Documentation/device-mapper/dm-log.txt)5
-rw-r--r--Documentation/device-mapper/dm-queue-length.rst (renamed from Documentation/device-mapper/dm-queue-length.txt)25
-rw-r--r--Documentation/device-mapper/dm-raid.rst (renamed from Documentation/device-mapper/dm-raid.txt)225
-rw-r--r--Documentation/device-mapper/dm-service-time.rst (renamed from Documentation/device-mapper/dm-service-time.txt)76
-rw-r--r--Documentation/device-mapper/dm-uevent.rst110
-rw-r--r--Documentation/device-mapper/dm-uevent.txt97
-rw-r--r--Documentation/device-mapper/dm-zoned.rst (renamed from Documentation/device-mapper/dm-zoned.txt)10
-rw-r--r--Documentation/device-mapper/era.rst (renamed from Documentation/device-mapper/era.txt)36
-rw-r--r--Documentation/device-mapper/index.rst44
-rw-r--r--Documentation/device-mapper/kcopyd.rst (renamed from Documentation/device-mapper/kcopyd.txt)10
-rw-r--r--Documentation/device-mapper/linear.rst63
-rw-r--r--Documentation/device-mapper/linear.txt61
-rw-r--r--Documentation/device-mapper/log-writes.rst (renamed from Documentation/device-mapper/log-writes.txt)105
-rw-r--r--Documentation/device-mapper/persistent-data.rst (renamed from Documentation/device-mapper/persistent-data.txt)4
-rw-r--r--Documentation/device-mapper/snapshot.rst (renamed from Documentation/device-mapper/snapshot.txt)116
-rw-r--r--Documentation/device-mapper/statistics.rst (renamed from Documentation/device-mapper/statistics.txt)62
-rw-r--r--Documentation/device-mapper/striped.rst61
-rw-r--r--Documentation/device-mapper/striped.txt57
-rw-r--r--Documentation/device-mapper/switch.rst (renamed from Documentation/device-mapper/switch.txt)47
-rw-r--r--Documentation/device-mapper/thin-provisioning.rst (renamed from Documentation/device-mapper/thin-provisioning.txt)68
-rw-r--r--Documentation/device-mapper/unstriped.rst (renamed from Documentation/device-mapper/unstriped.txt)93
-rw-r--r--Documentation/device-mapper/verity.rst (renamed from Documentation/device-mapper/verity.txt)20
-rw-r--r--Documentation/device-mapper/writecache.rst (renamed from Documentation/device-mapper/writecache.txt)13
-rw-r--r--Documentation/device-mapper/zero.rst (renamed from Documentation/device-mapper/zero.txt)14
-rw-r--r--Documentation/devicetree/bindings/net/fsl-enetc.txt7
-rw-r--r--Documentation/devicetree/bindings/pci/amlogic,meson-pcie.txt2
-rw-r--r--Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt2
-rw-r--r--Documentation/devicetree/booting-without-of.txt2
-rw-r--r--Documentation/doc-guide/kernel-doc.rst2
-rw-r--r--Documentation/doc-guide/sphinx.rst32
-rw-r--r--Documentation/docutils.conf2
-rw-r--r--Documentation/driver-api/basics.rst3
-rw-r--r--Documentation/driver-api/clk.rst6
-rw-r--r--Documentation/driver-api/firmware/other_interfaces.rst2
-rw-r--r--Documentation/driver-api/gpio/board.rst2
-rw-r--r--Documentation/driver-api/gpio/consumer.rst2
-rw-r--r--Documentation/driver-api/iio/hw-consumer.rst1
-rw-r--r--Documentation/driver-api/pps.rst (renamed from Documentation/pps/pps.txt)67
-rw-r--r--Documentation/driver-api/ptp.rst (renamed from Documentation/ptp/ptp.txt)26
-rw-r--r--Documentation/driver-api/target.rst4
-rw-r--r--Documentation/fault-injection/fault-injection.rst (renamed from Documentation/fault-injection/fault-injection.txt)281
-rw-r--r--Documentation/fault-injection/index.rst20
-rw-r--r--Documentation/fault-injection/notifier-error-inject.rst (renamed from Documentation/fault-injection/notifier-error-inject.txt)18
-rw-r--r--Documentation/fault-injection/nvme-fault-injection.rst178
-rw-r--r--Documentation/fault-injection/nvme-fault-injection.txt172
-rw-r--r--Documentation/fault-injection/provoke-crashes.rst48
-rw-r--r--Documentation/fault-injection/provoke-crashes.txt38
-rw-r--r--Documentation/fb/api.rst (renamed from Documentation/fb/api.txt)29
-rw-r--r--Documentation/fb/arkfb.rst (renamed from Documentation/fb/arkfb.txt)8
-rw-r--r--Documentation/fb/aty128fb.rst (renamed from Documentation/fb/aty128fb.txt)35
-rw-r--r--Documentation/fb/cirrusfb.rst (renamed from Documentation/fb/cirrusfb.txt)47
-rw-r--r--Documentation/fb/cmap_xfbdev.rst (renamed from Documentation/fb/cmap_xfbdev.txt)57
-rw-r--r--Documentation/fb/deferred_io.rst (renamed from Documentation/fb/deferred_io.txt)28
-rw-r--r--Documentation/fb/efifb.rst (renamed from Documentation/fb/efifb.txt)18
-rw-r--r--Documentation/fb/ep93xx-fb.rst (renamed from Documentation/fb/ep93xx-fb.txt)27
-rw-r--r--Documentation/fb/fbcon.rst (renamed from Documentation/fb/fbcon.txt)179
-rw-r--r--Documentation/fb/framebuffer.rst (renamed from Documentation/fb/framebuffer.txt)80
-rw-r--r--Documentation/fb/gxfb.rst (renamed from Documentation/fb/gxfb.txt)24
-rw-r--r--Documentation/fb/index.rst50
-rw-r--r--Documentation/fb/intel810.rst (renamed from Documentation/fb/intel810.txt)79
-rw-r--r--Documentation/fb/intelfb.rst (renamed from Documentation/fb/intelfb.txt)62
-rw-r--r--Documentation/fb/internals.rst (renamed from Documentation/fb/internals.txt)24
-rw-r--r--Documentation/fb/lxfb.rst (renamed from Documentation/fb/lxfb.txt)25
-rw-r--r--Documentation/fb/matroxfb.rst443
-rw-r--r--Documentation/fb/matroxfb.txt413
-rw-r--r--Documentation/fb/metronomefb.rst (renamed from Documentation/fb/metronomefb.txt)8
-rw-r--r--Documentation/fb/modedb.rst (renamed from Documentation/fb/modedb.txt)44
-rw-r--r--Documentation/fb/pvr2fb.rst66
-rw-r--r--Documentation/fb/pvr2fb.txt65
-rw-r--r--Documentation/fb/pxafb.rst (renamed from Documentation/fb/pxafb.txt)81
-rw-r--r--Documentation/fb/s3fb.rst (renamed from Documentation/fb/s3fb.txt)8
-rw-r--r--Documentation/fb/sa1100fb.rst (renamed from Documentation/fb/sa1100fb.txt)23
-rw-r--r--Documentation/fb/sh7760fb.rst130
-rw-r--r--Documentation/fb/sh7760fb.txt131
-rw-r--r--Documentation/fb/sisfb.rst (renamed from Documentation/fb/sisfb.txt)40
-rw-r--r--Documentation/fb/sm501.rst (renamed from Documentation/fb/sm501.txt)7
-rw-r--r--Documentation/fb/sm712fb.rst (renamed from Documentation/fb/sm712fb.txt)18
-rw-r--r--Documentation/fb/sstfb.rst207
-rw-r--r--Documentation/fb/sstfb.txt174
-rw-r--r--Documentation/fb/tgafb.rst (renamed from Documentation/fb/tgafb.txt)30
-rw-r--r--Documentation/fb/tridentfb.rst (renamed from Documentation/fb/tridentfb.txt)36
-rw-r--r--Documentation/fb/udlfb.rst (renamed from Documentation/fb/udlfb.txt)55
-rw-r--r--Documentation/fb/uvesafb.rst (renamed from Documentation/fb/uvesafb.txt)142
-rw-r--r--Documentation/fb/vesafb.rst (renamed from Documentation/fb/vesafb.txt)121
-rw-r--r--Documentation/fb/viafb.rst297
-rw-r--r--Documentation/fb/viafb.txt252
-rw-r--r--Documentation/fb/vt8623fb.rst (renamed from Documentation/fb/vt8623fb.txt)10
-rw-r--r--Documentation/features/debug/stackprotector/arch-support.txt2
-rw-r--r--Documentation/filesystems/api-summary.rst3
-rw-r--r--Documentation/filesystems/ext4/index.rst8
-rw-r--r--Documentation/filesystems/index.rst13
-rw-r--r--Documentation/filesystems/porting10
-rw-r--r--Documentation/filesystems/ubifs-authentication.md4
-rw-r--r--Documentation/filesystems/vfs.rst1428
-rw-r--r--Documentation/filesystems/vfs.txt1268
-rw-r--r--Documentation/filesystems/xfs-delayed-logging-design.txt2
-rw-r--r--Documentation/firmware-guide/acpi/enumeration.rst2
-rw-r--r--Documentation/firmware-guide/acpi/method-tracing.rst2
-rw-r--r--Documentation/fpga/dfl.rst (renamed from Documentation/fpga/dfl.txt)58
-rw-r--r--Documentation/fpga/index.rst17
-rw-r--r--Documentation/gpu/msm-crash-dump.rst2
-rw-r--r--Documentation/hid/hid-transport.txt6
-rw-r--r--Documentation/i2c/instantiating-devices4
-rw-r--r--Documentation/i2c/upgrading-clients4
-rw-r--r--Documentation/ide/changelogs.rst17
-rw-r--r--Documentation/ide/ide-tape.rst (renamed from Documentation/ide/ide-tape.txt)23
-rw-r--r--Documentation/ide/ide.rst (renamed from Documentation/ide/ide.txt)147
-rw-r--r--Documentation/ide/index.rst21
-rw-r--r--Documentation/ide/warm-plug-howto.rst (renamed from Documentation/ide/warm-plug-howto.txt)10
-rw-r--r--Documentation/index.rst1
-rw-r--r--Documentation/interconnect/interconnect.rst7
-rw-r--r--Documentation/iostats.txt4
-rw-r--r--Documentation/kbuild/headers_install.rst (renamed from Documentation/kbuild/headers_install.txt)5
-rw-r--r--Documentation/kbuild/index.rst27
-rw-r--r--Documentation/kbuild/issues.rst11
-rw-r--r--Documentation/kbuild/kbuild.rst (renamed from Documentation/kbuild/kbuild.txt)119
-rw-r--r--Documentation/kbuild/kconfig-language.rst (renamed from Documentation/kbuild/kconfig-language.txt)242
-rw-r--r--Documentation/kbuild/kconfig-macro-language.rst (renamed from Documentation/kbuild/kconfig-macro-language.txt)37
-rw-r--r--Documentation/kbuild/kconfig.rst (renamed from Documentation/kbuild/kconfig.txt)136
-rw-r--r--Documentation/kbuild/makefiles.rst (renamed from Documentation/kbuild/makefiles.txt)530
-rw-r--r--Documentation/kbuild/modules.rst (renamed from Documentation/kbuild/modules.txt)170
-rw-r--r--Documentation/kdump/index.rst21
-rw-r--r--Documentation/kdump/kdump.rst (renamed from Documentation/kdump/kdump.txt)131
-rw-r--r--Documentation/kdump/vmcoreinfo.rst (renamed from Documentation/kdump/vmcoreinfo.txt)59
-rw-r--r--Documentation/kernel-hacking/hacking.rst4
-rw-r--r--Documentation/kernel-hacking/locking.rst6
-rw-r--r--Documentation/kernel-per-CPU-kthreads.txt2
-rw-r--r--Documentation/laptops/lg-laptop.rst2
-rw-r--r--Documentation/maintainer/index.rst1
-rw-r--r--Documentation/maintainer/rebasing-and-merging.rst226
-rw-r--r--Documentation/memory-barriers.txt2
-rw-r--r--Documentation/mic/index.rst18
-rw-r--r--Documentation/mic/mic_overview.rst (renamed from Documentation/mic/mic_overview.txt)6
-rw-r--r--Documentation/mic/scif_overview.rst (renamed from Documentation/mic/scif_overview.txt)58
-rw-r--r--Documentation/netlabel/cipso_ipv4.rst (renamed from Documentation/netlabel/cipso_ipv4.txt)19
-rw-r--r--Documentation/netlabel/draft_ietf.rst5
-rw-r--r--Documentation/netlabel/index.rst21
-rw-r--r--Documentation/netlabel/introduction.rst (renamed from Documentation/netlabel/introduction.txt)16
-rw-r--r--Documentation/netlabel/lsm_interface.rst (renamed from Documentation/netlabel/lsm_interface.txt)16
-rw-r--r--Documentation/networking/device_drivers/freescale/dpaa2/dpio-driver.rst4
-rw-r--r--Documentation/networking/dsa/dsa.rst4
-rw-r--r--Documentation/networking/dsa/sja1105.rst6
-rw-r--r--Documentation/networking/timestamping.txt2
-rw-r--r--Documentation/nvdimm/nvdimm.txt4
-rw-r--r--Documentation/pcmcia/devicetable.rst (renamed from Documentation/pcmcia/devicetable.txt)4
-rw-r--r--Documentation/pcmcia/driver-changes.rst (renamed from Documentation/pcmcia/driver-changes.txt)35
-rw-r--r--Documentation/pcmcia/driver.rst (renamed from Documentation/pcmcia/driver.txt)18
-rw-r--r--Documentation/pcmcia/index.rst20
-rw-r--r--Documentation/pcmcia/locking.rst (renamed from Documentation/pcmcia/locking.txt)39
-rw-r--r--Documentation/platform/x86-laptop-drivers.txt18
-rw-r--r--Documentation/powerpc/firmware-assisted-dump.txt2
-rw-r--r--Documentation/powerpc/isa-versions.rst2
-rw-r--r--Documentation/process/4.Coding.rst2
-rw-r--r--Documentation/process/coding-style.rst2
-rw-r--r--Documentation/process/maintainer-pgp-guide.rst31
-rw-r--r--Documentation/process/submit-checklist.rst2
-rw-r--r--Documentation/riscv/index.rst17
-rw-r--r--Documentation/riscv/pmu.rst (renamed from Documentation/riscv/pmu.txt)98
-rw-r--r--Documentation/scheduler/completion.rst (renamed from Documentation/scheduler/completion.txt)38
-rw-r--r--Documentation/scheduler/index.rst29
-rw-r--r--Documentation/scheduler/sched-arch.rst (renamed from Documentation/scheduler/sched-arch.txt)18
-rw-r--r--Documentation/scheduler/sched-bwc.rst (renamed from Documentation/scheduler/sched-bwc.txt)30
-rw-r--r--Documentation/scheduler/sched-deadline.rst (renamed from Documentation/scheduler/sched-deadline.txt)311
-rw-r--r--Documentation/scheduler/sched-design-CFS.rst (renamed from Documentation/scheduler/sched-design-CFS.txt)15
-rw-r--r--Documentation/scheduler/sched-domains.rst (renamed from Documentation/scheduler/sched-domains.txt)8
-rw-r--r--Documentation/scheduler/sched-energy.rst (renamed from Documentation/scheduler/sched-energy.txt)47
-rw-r--r--Documentation/scheduler/sched-nice-design.rst (renamed from Documentation/scheduler/sched-nice-design.txt)6
-rw-r--r--Documentation/scheduler/sched-rt-group.rst (renamed from Documentation/scheduler/sched-rt-group.txt)28
-rw-r--r--Documentation/scheduler/sched-stats.rst (renamed from Documentation/scheduler/sched-stats.txt)35
-rw-r--r--Documentation/scheduler/text_files.rst5
-rw-r--r--Documentation/security/keys/core.rst16
-rw-r--r--Documentation/security/keys/trusted-encrypted.rst4
-rw-r--r--Documentation/sphinx/automarkup.py101
-rw-r--r--Documentation/sphinx/cdomain.py5
-rw-r--r--Documentation/sphinx/requirements.txt4
-rw-r--r--Documentation/sysctl/kernel.txt4
-rw-r--r--Documentation/target/index.rst19
-rw-r--r--Documentation/target/scripts.rst11
-rw-r--r--Documentation/target/tcm_mod_builder.rst149
-rw-r--r--Documentation/target/tcm_mod_builder.txt145
-rw-r--r--Documentation/target/tcmu-design.rst (renamed from Documentation/target/tcmu-design.txt)272
-rw-r--r--Documentation/tee.txt2
-rw-r--r--Documentation/timers/highres.rst (renamed from Documentation/timers/highres.txt)13
-rw-r--r--Documentation/timers/hpet.rst (renamed from Documentation/timers/hpet.txt)4
-rw-r--r--Documentation/timers/hrtimers.rst (renamed from Documentation/timers/hrtimers.txt)6
-rw-r--r--Documentation/timers/index.rst22
-rw-r--r--Documentation/timers/no_hz.rst (renamed from Documentation/timers/NO_HZ.txt)40
-rw-r--r--Documentation/timers/timekeeping.rst (renamed from Documentation/timers/timekeeping.txt)3
-rw-r--r--Documentation/timers/timers-howto.rst (renamed from Documentation/timers/timers-howto.txt)15
-rw-r--r--Documentation/trace/coresight.txt82
-rw-r--r--Documentation/trace/histogram.rst10
-rw-r--r--Documentation/trace/kprobetrace.rst7
-rw-r--r--Documentation/trace/uprobetracer.rst7
-rw-r--r--Documentation/translations/it_IT/admin-guide/kernel-parameters.rst12
-rw-r--r--Documentation/translations/it_IT/doc-guide/sphinx.rst17
-rw-r--r--Documentation/translations/it_IT/kernel-hacking/hacking.rst4
-rw-r--r--Documentation/translations/it_IT/kernel-hacking/locking.rst6
-rw-r--r--Documentation/translations/it_IT/process/4.Coding.rst2
-rw-r--r--Documentation/translations/it_IT/process/adding-syscalls.rst2
-rw-r--r--Documentation/translations/it_IT/process/coding-style.rst2
-rw-r--r--Documentation/translations/it_IT/process/howto.rst2
-rw-r--r--Documentation/translations/it_IT/process/license-rules.rst28
-rw-r--r--Documentation/translations/it_IT/process/magic-number.rst2
-rw-r--r--Documentation/translations/it_IT/process/stable-kernel-rules.rst4
-rw-r--r--Documentation/translations/it_IT/process/submit-checklist.rst2
-rw-r--r--Documentation/translations/ko_KR/memory-barriers.txt2
-rw-r--r--Documentation/translations/zh_CN/arm64/booting.txt4
-rw-r--r--Documentation/translations/zh_CN/arm64/legacy_instructions.txt4
-rw-r--r--Documentation/translations/zh_CN/arm64/memory.txt4
-rw-r--r--Documentation/translations/zh_CN/arm64/silicon-errata.txt4
-rw-r--r--Documentation/translations/zh_CN/arm64/tagged-pointers.txt4
-rw-r--r--Documentation/translations/zh_CN/basic_profiling.txt71
-rw-r--r--Documentation/translations/zh_CN/oops-tracing.txt2
-rw-r--r--Documentation/translations/zh_CN/process/4.Coding.rst4
-rw-r--r--Documentation/translations/zh_CN/process/coding-style.rst2
-rw-r--r--Documentation/translations/zh_CN/process/management-style.rst4
-rw-r--r--Documentation/translations/zh_CN/process/programming-language.rst59
-rw-r--r--Documentation/translations/zh_CN/process/submit-checklist.rst2
-rw-r--r--Documentation/translations/zh_CN/process/submitting-drivers.rst2
-rw-r--r--Documentation/userspace-api/spec_ctrl.rst2
-rw-r--r--Documentation/virtual/kvm/amd-memory-encryption.rst3
-rw-r--r--Documentation/virtual/kvm/api.txt2
-rw-r--r--Documentation/virtual/kvm/devices/arm-vgic-its.txt2
-rw-r--r--Documentation/vm/hwpoison.rst52
-rw-r--r--Documentation/vm/numa.rst2
-rw-r--r--Documentation/watchdog/convert_drivers_to_kernel_api.rst (renamed from Documentation/watchdog/convert_drivers_to_kernel_api.txt)109
-rw-r--r--Documentation/watchdog/hpwdt.rst (renamed from Documentation/watchdog/hpwdt.txt)27
-rw-r--r--Documentation/watchdog/index.rst25
-rw-r--r--Documentation/watchdog/mlx-wdt.rst (renamed from Documentation/watchdog/mlx-wdt.txt)24
-rw-r--r--Documentation/watchdog/pcwd-watchdog.rst (renamed from Documentation/watchdog/pcwd-watchdog.txt)13
-rw-r--r--Documentation/watchdog/watchdog-api.rst (renamed from Documentation/watchdog/watchdog-api.txt)76
-rw-r--r--Documentation/watchdog/watchdog-kernel-api.rst (renamed from Documentation/watchdog/watchdog-kernel-api.txt)91
-rw-r--r--Documentation/watchdog/watchdog-parameters.rst736
-rw-r--r--Documentation/watchdog/watchdog-parameters.txt410
-rw-r--r--Documentation/watchdog/watchdog-pm.rst (renamed from Documentation/watchdog/watchdog-pm.txt)3
-rw-r--r--Documentation/watchdog/wdt.rst (renamed from Documentation/watchdog/wdt.txt)31
-rw-r--r--Documentation/x86/index.rst1
-rw-r--r--Documentation/x86/resctrl_ui.rst30
-rw-r--r--Documentation/x86/x86_64/5level-paging.rst2
-rw-r--r--Documentation/x86/x86_64/boot-options.rst4
-rw-r--r--Documentation/x86/x86_64/fake-numa-for-cpusets.rst2
-rw-r--r--Documentation/xilinx/eemi.rst (renamed from Documentation/xilinx/eemi.txt)8
-rw-r--r--Documentation/xilinx/index.rst17
-rw-r--r--Kconfig4
-rw-r--r--MAINTAINERS26
-rw-r--r--arch/arc/plat-eznps/Kconfig2
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/arm64/Kconfig2
-rw-r--r--arch/arm64/include/asm/efi.h2
-rw-r--r--arch/arm64/include/asm/image.h2
-rw-r--r--arch/arm64/include/uapi/asm/sigcontext.h2
-rw-r--r--arch/arm64/kernel/kexec_image.c2
-rw-r--r--arch/c6x/Kconfig2
-rw-r--r--arch/m68k/q40/README2
-rw-r--r--arch/microblaze/Kconfig.debug2
-rw-r--r--arch/microblaze/Kconfig.platform2
-rw-r--r--arch/nds32/Kconfig2
-rw-r--r--arch/openrisc/Kconfig2
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/sysdev/Kconfig2
-rw-r--r--arch/riscv/Kconfig2
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/x86/Kconfig20
-rw-r--r--arch/x86/Kconfig.debug2
-rw-r--r--arch/x86/boot/header.S2
-rw-r--r--arch/x86/entry/entry_64.S2
-rw-r--r--arch/x86/include/asm/bootparam_utils.h2
-rw-r--r--arch/x86/include/asm/page_64_types.h2
-rw-r--r--arch/x86/include/asm/pgtable_64_types.h2
-rw-r--r--arch/x86/kernel/cpu/microcode/amd.c2
-rw-r--r--arch/x86/kernel/kexec-bzimage64.c2
-rw-r--r--arch/x86/kernel/kprobes/core.c2
-rw-r--r--arch/x86/kernel/pci-dma.c2
-rw-r--r--arch/x86/mm/tlb.c2
-rw-r--r--arch/x86/platform/pvh/enlighten.c2
-rw-r--r--drivers/acpi/Kconfig10
-rw-r--r--drivers/auxdisplay/Kconfig2
-rw-r--r--drivers/block/Kconfig2
-rw-r--r--drivers/cdrom/cdrom.c2
-rw-r--r--drivers/firmware/Kconfig2
-rw-r--r--drivers/gpu/drm/Kconfig2
-rw-r--r--drivers/ide/Kconfig20
-rw-r--r--drivers/ide/ide-cd.c2
-rw-r--r--drivers/isdn/mISDN/dsp_core.c2
-rw-r--r--drivers/md/Kconfig2
-rw-r--r--drivers/md/dm-init.c2
-rw-r--r--drivers/md/dm-raid.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/anysee.c2
-rw-r--r--drivers/misc/lkdtm/core.c2
-rw-r--r--drivers/mtd/devices/Kconfig2
-rw-r--r--drivers/net/ethernet/faraday/ftgmac100.c2
-rw-r--r--drivers/net/ethernet/smsc/Kconfig6
-rw-r--r--drivers/net/wireless/intel/iwlegacy/Kconfig4
-rw-r--r--drivers/net/wireless/intel/iwlwifi/Kconfig2
-rw-r--r--drivers/parport/Kconfig2
-rw-r--r--drivers/pcmcia/ds.c2
-rw-r--r--drivers/platform/x86/Kconfig3
-rw-r--r--drivers/regulator/core.c2
-rw-r--r--drivers/scsi/Kconfig4
-rw-r--r--drivers/scsi/hpsa.c4
-rw-r--r--drivers/staging/fieldbus/Documentation/fieldbus_dev.txt4
-rw-r--r--drivers/staging/sm750fb/Kconfig2
-rw-r--r--drivers/tty/Kconfig2
-rw-r--r--drivers/usb/misc/Kconfig4
-rw-r--r--drivers/vhost/vhost.c2
-rw-r--r--drivers/video/fbdev/Kconfig38
-rw-r--r--drivers/video/fbdev/matrox/matroxfb_base.c2
-rw-r--r--drivers/video/fbdev/pxafb.c2
-rw-r--r--drivers/video/fbdev/sh7760fb.c2
-rw-r--r--drivers/watchdog/Kconfig6
-rw-r--r--drivers/watchdog/smsc37b787_wdt.c2
-rw-r--r--include/acpi/acpi_drivers.h2
-rw-r--r--include/linux/dcache.h4
-rw-r--r--include/linux/fault-inject.h2
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/fs_context.h2
-rw-r--r--include/linux/iopoll.h4
-rw-r--r--include/linux/lsm_hooks.h2
-rw-r--r--include/linux/regmap.h4
-rw-r--r--include/pcmcia/ds.h2
-rw-r--r--include/pcmcia/ss.h2
-rw-r--r--init/Kconfig6
-rw-r--r--kernel/sched/deadline.c2
-rw-r--r--lib/Kconfig.debug2
-rw-r--r--lib/list_sort.c2
-rw-r--r--mm/Kconfig2
-rw-r--r--net/bridge/netfilter/Kconfig2
-rw-r--r--net/ipv4/netfilter/Kconfig2
-rw-r--r--net/ipv6/netfilter/Kconfig2
-rw-r--r--net/netfilter/Kconfig16
-rw-r--r--net/tipc/Kconfig2
-rw-r--r--scripts/Kbuild.include4
-rw-r--r--scripts/Makefile.host2
-rwxr-xr-xscripts/checkpatch.pl8
-rwxr-xr-xscripts/documentation-file-ref-check58
-rw-r--r--scripts/kconfig/symbol.c2
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/expected_stderr14
-rwxr-xr-xscripts/kernel-doc18
-rwxr-xr-xscripts/sphinx-pre-install76
-rw-r--r--security/Kconfig2
-rw-r--r--sound/oss/dmasound/Kconfig6
-rw-r--r--sound/soc/sof/ops.h2
-rw-r--r--tools/include/linux/err.h2
-rw-r--r--tools/objtool/Documentation/stack-validation.txt4
-rw-r--r--tools/testing/fault-injection/failcmd.sh2
-rw-r--r--tools/testing/selftests/x86/protection_keys.c2
416 files changed, 12159 insertions, 8581 deletions
diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu
index 923fe2001472..d404603c6b52 100644
--- a/Documentation/ABI/testing/sysfs-devices-system-cpu
+++ b/Documentation/ABI/testing/sysfs-devices-system-cpu
@@ -137,7 +137,8 @@ Description: Discover cpuidle policy and mechanism
137 current_governor: (RW) displays current idle policy. Users can 137 current_governor: (RW) displays current idle policy. Users can
138 switch the governor at runtime by writing to this file. 138 switch the governor at runtime by writing to this file.
139 139
140 See files in Documentation/cpuidle/ for more information. 140 See Documentation/admin-guide/pm/cpuidle.rst and
141 Documentation/driver-api/pm/cpuidle.rst for more information.
141 142
142 143
143What: /sys/devices/system/cpu/cpuX/cpuidle/stateN/name 144What: /sys/devices/system/cpu/cpuX/cpuidle/stateN/name
diff --git a/Documentation/ABI/testing/sysfs-kernel-uids b/Documentation/ABI/testing/sysfs-kernel-uids
index 28f14695a852..4182b7061816 100644
--- a/Documentation/ABI/testing/sysfs-kernel-uids
+++ b/Documentation/ABI/testing/sysfs-kernel-uids
@@ -11,4 +11,4 @@ Description:
11 example would be, if User A has shares = 1024 and user 11 example would be, if User A has shares = 1024 and user
12 B has shares = 2048, User B will get twice the CPU 12 B has shares = 2048, User B will get twice the CPU
13 bandwidth user A will. For more details refer 13 bandwidth user A will. For more details refer
14 Documentation/scheduler/sched-design-CFS.txt 14 Documentation/scheduler/sched-design-CFS.rst
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index 0076150fdccb..e47c63bd4887 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -198,7 +198,7 @@ call to set the mask to the value returned.
198:: 198::
199 199
200 size_t 200 size_t
201 dma_direct_max_mapping_size(struct device *dev); 201 dma_max_mapping_size(struct device *dev);
202 202
203Returns the maximum size of a mapping for the device. The size parameter 203Returns the maximum size of a mapping for the device. The size parameter
204of the mapping functions like dma_map_single(), dma_map_page() and 204of the mapping functions like dma_map_single(), dma_map_page() and
diff --git a/Documentation/EDID/HOWTO.txt b/Documentation/EDID/howto.rst
index 539871c3b785..725fd49a88ca 100644
--- a/Documentation/EDID/HOWTO.txt
+++ b/Documentation/EDID/howto.rst
@@ -1,3 +1,9 @@
1:orphan:
2
3====
4EDID
5====
6
1In the good old days when graphics parameters were configured explicitly 7In the good old days when graphics parameters were configured explicitly
2in a file called xorg.conf, even broken hardware could be managed. 8in a file called xorg.conf, even broken hardware could be managed.
3 9
@@ -34,16 +40,19 @@ Makefile. Please note that the EDID data structure expects the timing
34values in a different way as compared to the standard X11 format. 40values in a different way as compared to the standard X11 format.
35 41
36X11: 42X11:
37HTimings: hdisp hsyncstart hsyncend htotal 43 HTimings:
38VTimings: vdisp vsyncstart vsyncend vtotal 44 hdisp hsyncstart hsyncend htotal
39 45 VTimings:
40EDID: 46 vdisp vsyncstart vsyncend vtotal
41#define XPIX hdisp 47
42#define XBLANK htotal-hdisp 48EDID::
43#define XOFFSET hsyncstart-hdisp 49
44#define XPULSE hsyncend-hsyncstart 50 #define XPIX hdisp
45 51 #define XBLANK htotal-hdisp
46#define YPIX vdisp 52 #define XOFFSET hsyncstart-hdisp
47#define YBLANK vtotal-vdisp 53 #define XPULSE hsyncend-hsyncstart
48#define YOFFSET vsyncstart-vdisp 54
49#define YPULSE vsyncend-vsyncstart 55 #define YPIX vdisp
56 #define YBLANK vtotal-vdisp
57 #define YOFFSET vsyncstart-vdisp
58 #define YPULSE vsyncend-vsyncstart
diff --git a/Documentation/Kconfig b/Documentation/Kconfig
new file mode 100644
index 000000000000..66046fa1c341
--- /dev/null
+++ b/Documentation/Kconfig
@@ -0,0 +1,13 @@
1config WARN_MISSING_DOCUMENTS
2
3 bool "Warn if there's a missing documentation file"
4 depends on COMPILE_TEST
5 help
6 It is not uncommon that a document gets renamed.
7 This option makes the Kernel to check for missing dependencies,
8 warning when something is missing. Works only if the Kernel
9 is built from a git tree.
10
11 If unsure, select 'N'.
12
13
diff --git a/Documentation/Makefile b/Documentation/Makefile
index e889e7cb8511..e145e4db508b 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -4,6 +4,11 @@
4 4
5subdir-y := devicetree/bindings/ 5subdir-y := devicetree/bindings/
6 6
7# Check for broken documentation file references
8ifeq ($(CONFIG_WARN_MISSING_DOCUMENTS),y)
9$(shell $(srctree)/scripts/documentation-file-ref-check --warn)
10endif
11
7# You can set these variables from the command line. 12# You can set these variables from the command line.
8SPHINXBUILD = sphinx-build 13SPHINXBUILD = sphinx-build
9SPHINXOPTS = 14SPHINXOPTS =
@@ -23,11 +28,13 @@ ifeq ($(HAVE_SPHINX),0)
23.DEFAULT: 28.DEFAULT:
24 $(warning The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed and in PATH, or set the SPHINXBUILD make variable to point to the full path of the '$(SPHINXBUILD)' executable.) 29 $(warning The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed and in PATH, or set the SPHINXBUILD make variable to point to the full path of the '$(SPHINXBUILD)' executable.)
25 @echo 30 @echo
26 @./scripts/sphinx-pre-install 31 @$(srctree)/scripts/sphinx-pre-install
27 @echo " SKIP Sphinx $@ target." 32 @echo " SKIP Sphinx $@ target."
28 33
29else # HAVE_SPHINX 34else # HAVE_SPHINX
30 35
36export SPHINXOPTS = $(shell perl -e 'open IN,"sphinx-build --version 2>&1 |"; while (<IN>) { if (m/([\d\.]+)/) { print "-jauto" if ($$1 >= "1.7") } ;} close IN')
37
31# User-friendly check for pdflatex and latexmk 38# User-friendly check for pdflatex and latexmk
32HAVE_PDFLATEX := $(shell if which $(PDFLATEX) >/dev/null 2>&1; then echo 1; else echo 0; fi) 39HAVE_PDFLATEX := $(shell if which $(PDFLATEX) >/dev/null 2>&1; then echo 1; else echo 0; fi)
33HAVE_LATEXMK := $(shell if which latexmk >/dev/null 2>&1; then echo 1; else echo 0; fi) 40HAVE_LATEXMK := $(shell if which latexmk >/dev/null 2>&1; then echo 1; else echo 0; fi)
@@ -70,12 +77,14 @@ quiet_cmd_sphinx = SPHINX $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
70 $(abspath $(BUILDDIR)/$3/$4) 77 $(abspath $(BUILDDIR)/$3/$4)
71 78
72htmldocs: 79htmldocs:
80 @$(srctree)/scripts/sphinx-pre-install --version-check
73 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var))) 81 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,html,$(var),,$(var)))
74 82
75linkcheckdocs: 83linkcheckdocs:
76 @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var))) 84 @$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,linkcheck,$(var),,$(var)))
77 85
78latexdocs: 86latexdocs:
87 @$(srctree)/scripts/sphinx-pre-install --version-check
79 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var))) 88 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,latex,$(var),latex,$(var)))
80 89
81ifeq ($(HAVE_PDFLATEX),0) 90ifeq ($(HAVE_PDFLATEX),0)
@@ -87,14 +96,17 @@ pdfdocs:
87else # HAVE_PDFLATEX 96else # HAVE_PDFLATEX
88 97
89pdfdocs: latexdocs 98pdfdocs: latexdocs
99 @$(srctree)/scripts/sphinx-pre-install --version-check
90 $(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit;) 100 $(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX="$(PDFLATEX)" LATEXOPTS="$(LATEXOPTS)" -C $(BUILDDIR)/$(var)/latex || exit;)
91 101
92endif # HAVE_PDFLATEX 102endif # HAVE_PDFLATEX
93 103
94epubdocs: 104epubdocs:
105 @$(srctree)/scripts/sphinx-pre-install --version-check
95 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var))) 106 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,epub,$(var),epub,$(var)))
96 107
97xmldocs: 108xmldocs:
109 @$(srctree)/scripts/sphinx-pre-install --version-check
98 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var))) 110 @+$(foreach var,$(SPHINXDIRS),$(call loop_cmd,sphinx,xml,$(var),xml,$(var)))
99 111
100endif # HAVE_SPHINX 112endif # HAVE_SPHINX
diff --git a/Documentation/RCU/UP.txt b/Documentation/RCU/UP.rst
index 53bde717017b..e26dda27430c 100644
--- a/Documentation/RCU/UP.txt
+++ b/Documentation/RCU/UP.rst
@@ -1,17 +1,19 @@
1RCU on Uniprocessor Systems 1.. _up_doc:
2 2
3RCU on Uniprocessor Systems
4===========================
3 5
4A common misconception is that, on UP systems, the call_rcu() primitive 6A common misconception is that, on UP systems, the call_rcu() primitive
5may immediately invoke its function. The basis of this misconception 7may immediately invoke its function. The basis of this misconception
6is that since there is only one CPU, it should not be necessary to 8is that since there is only one CPU, it should not be necessary to
7wait for anything else to get done, since there are no other CPUs for 9wait for anything else to get done, since there are no other CPUs for
8anything else to be happening on. Although this approach will -sort- -of- 10anything else to be happening on. Although this approach will *sort of*
9work a surprising amount of the time, it is a very bad idea in general. 11work a surprising amount of the time, it is a very bad idea in general.
10This document presents three examples that demonstrate exactly how bad 12This document presents three examples that demonstrate exactly how bad
11an idea this is. 13an idea this is.
12 14
13
14Example 1: softirq Suicide 15Example 1: softirq Suicide
16--------------------------
15 17
16Suppose that an RCU-based algorithm scans a linked list containing 18Suppose that an RCU-based algorithm scans a linked list containing
17elements A, B, and C in process context, and can delete elements from 19elements A, B, and C in process context, and can delete elements from
@@ -28,8 +30,8 @@ your kernel.
28This same problem can occur if call_rcu() is invoked from a hardware 30This same problem can occur if call_rcu() is invoked from a hardware
29interrupt handler. 31interrupt handler.
30 32
31
32Example 2: Function-Call Fatality 33Example 2: Function-Call Fatality
34---------------------------------
33 35
34Of course, one could avert the suicide described in the preceding example 36Of course, one could avert the suicide described in the preceding example
35by having call_rcu() directly invoke its arguments only if it was called 37by having call_rcu() directly invoke its arguments only if it was called
@@ -46,11 +48,13 @@ its arguments would cause it to fail to make the fundamental guarantee
46underlying RCU, namely that call_rcu() defers invoking its arguments until 48underlying RCU, namely that call_rcu() defers invoking its arguments until
47all RCU read-side critical sections currently executing have completed. 49all RCU read-side critical sections currently executing have completed.
48 50
49Quick Quiz #1: why is it -not- legal to invoke synchronize_rcu() in 51Quick Quiz #1:
50 this case? 52 Why is it *not* legal to invoke synchronize_rcu() in this case?
51 53
54:ref:`Answers to Quick Quiz <answer_quick_quiz_up>`
52 55
53Example 3: Death by Deadlock 56Example 3: Death by Deadlock
57----------------------------
54 58
55Suppose that call_rcu() is invoked while holding a lock, and that the 59Suppose that call_rcu() is invoked while holding a lock, and that the
56callback function must acquire this same lock. In this case, if 60callback function must acquire this same lock. In this case, if
@@ -76,25 +80,30 @@ there are cases where this can be quite ugly:
76If call_rcu() directly invokes the callback, painful locking restrictions 80If call_rcu() directly invokes the callback, painful locking restrictions
77or API changes would be required. 81or API changes would be required.
78 82
79Quick Quiz #2: What locking restriction must RCU callbacks respect? 83Quick Quiz #2:
84 What locking restriction must RCU callbacks respect?
80 85
86:ref:`Answers to Quick Quiz <answer_quick_quiz_up>`
81 87
82Summary 88Summary
89-------
83 90
84Permitting call_rcu() to immediately invoke its arguments breaks RCU, 91Permitting call_rcu() to immediately invoke its arguments breaks RCU,
85even on a UP system. So do not do it! Even on a UP system, the RCU 92even on a UP system. So do not do it! Even on a UP system, the RCU
86infrastructure -must- respect grace periods, and -must- invoke callbacks 93infrastructure *must* respect grace periods, and *must* invoke callbacks
87from a known environment in which no locks are held. 94from a known environment in which no locks are held.
88 95
89Note that it -is- safe for synchronize_rcu() to return immediately on 96Note that it *is* safe for synchronize_rcu() to return immediately on
90UP systems, including !PREEMPT SMP builds running on UP systems. 97UP systems, including PREEMPT SMP builds running on UP systems.
91 98
92Quick Quiz #3: Why can't synchronize_rcu() return immediately on 99Quick Quiz #3:
93 UP systems running preemptable RCU? 100 Why can't synchronize_rcu() return immediately on UP systems running
101 preemptable RCU?
94 102
103.. _answer_quick_quiz_up:
95 104
96Answer to Quick Quiz #1: 105Answer to Quick Quiz #1:
97 Why is it -not- legal to invoke synchronize_rcu() in this case? 106 Why is it *not* legal to invoke synchronize_rcu() in this case?
98 107
99 Because the calling function is scanning an RCU-protected linked 108 Because the calling function is scanning an RCU-protected linked
100 list, and is therefore within an RCU read-side critical section. 109 list, and is therefore within an RCU read-side critical section.
@@ -104,12 +113,13 @@ Answer to Quick Quiz #1:
104Answer to Quick Quiz #2: 113Answer to Quick Quiz #2:
105 What locking restriction must RCU callbacks respect? 114 What locking restriction must RCU callbacks respect?
106 115
107 Any lock that is acquired within an RCU callback must be 116 Any lock that is acquired within an RCU callback must be acquired
108 acquired elsewhere using an _irq variant of the spinlock 117 elsewhere using an _bh variant of the spinlock primitive.
109 primitive. For example, if "mylock" is acquired by an 118 For example, if "mylock" is acquired by an RCU callback, then
110 RCU callback, then a process-context acquisition of this 119 a process-context acquisition of this lock must use something
111 lock must use something like spin_lock_irqsave() to 120 like spin_lock_bh() to acquire the lock. Please note that
112 acquire the lock. 121 it is also OK to use _irq variants of spinlocks, for example,
122 spin_lock_irqsave().
113 123
114 If the process-context code were to simply use spin_lock(), 124 If the process-context code were to simply use spin_lock(),
115 then, since RCU callbacks can be invoked from softirq context, 125 then, since RCU callbacks can be invoked from softirq context,
@@ -119,7 +129,7 @@ Answer to Quick Quiz #2:
119 129
120 This restriction might seem gratuitous, since very few RCU 130 This restriction might seem gratuitous, since very few RCU
121 callbacks acquire locks directly. However, a great many RCU 131 callbacks acquire locks directly. However, a great many RCU
122 callbacks do acquire locks -indirectly-, for example, via 132 callbacks do acquire locks *indirectly*, for example, via
123 the kfree() primitive. 133 the kfree() primitive.
124 134
125Answer to Quick Quiz #3: 135Answer to Quick Quiz #3:
diff --git a/Documentation/RCU/index.rst b/Documentation/RCU/index.rst
new file mode 100644
index 000000000000..340a9725676c
--- /dev/null
+++ b/Documentation/RCU/index.rst
@@ -0,0 +1,19 @@
1.. _rcu_concepts:
2
3============
4RCU concepts
5============
6
7.. toctree::
8 :maxdepth: 1
9
10 rcu
11 listRCU
12 UP
13
14.. only:: subproject and html
15
16 Indices
17 =======
18
19 * :ref:`genindex`
diff --git a/Documentation/RCU/listRCU.txt b/Documentation/RCU/listRCU.rst
index adb5a3782846..7956ff33042b 100644
--- a/Documentation/RCU/listRCU.txt
+++ b/Documentation/RCU/listRCU.rst
@@ -1,5 +1,7 @@
1Using RCU to Protect Read-Mostly Linked Lists 1.. _list_rcu_doc:
2 2
3Using RCU to Protect Read-Mostly Linked Lists
4=============================================
3 5
4One of the best applications of RCU is to protect read-mostly linked lists 6One of the best applications of RCU is to protect read-mostly linked lists
5("struct list_head" in list.h). One big advantage of this approach 7("struct list_head" in list.h). One big advantage of this approach
@@ -7,8 +9,8 @@ is that all of the required memory barriers are included for you in
7the list macros. This document describes several applications of RCU, 9the list macros. This document describes several applications of RCU,
8with the best fits first. 10with the best fits first.
9 11
10
11Example 1: Read-Side Action Taken Outside of Lock, No In-Place Updates 12Example 1: Read-Side Action Taken Outside of Lock, No In-Place Updates
13----------------------------------------------------------------------
12 14
13The best applications are cases where, if reader-writer locking were 15The best applications are cases where, if reader-writer locking were
14used, the read-side lock would be dropped before taking any action 16used, the read-side lock would be dropped before taking any action
@@ -24,7 +26,7 @@ added or deleted, rather than being modified in place.
24 26
25A straightforward example of this use of RCU may be found in the 27A straightforward example of this use of RCU may be found in the
26system-call auditing support. For example, a reader-writer locked 28system-call auditing support. For example, a reader-writer locked
27implementation of audit_filter_task() might be as follows: 29implementation of audit_filter_task() might be as follows::
28 30
29 static enum audit_state audit_filter_task(struct task_struct *tsk) 31 static enum audit_state audit_filter_task(struct task_struct *tsk)
30 { 32 {
@@ -48,7 +50,7 @@ the corresponding value is returned. By the time that this value is acted
48on, the list may well have been modified. This makes sense, since if 50on, the list may well have been modified. This makes sense, since if
49you are turning auditing off, it is OK to audit a few extra system calls. 51you are turning auditing off, it is OK to audit a few extra system calls.
50 52
51This means that RCU can be easily applied to the read side, as follows: 53This means that RCU can be easily applied to the read side, as follows::
52 54
53 static enum audit_state audit_filter_task(struct task_struct *tsk) 55 static enum audit_state audit_filter_task(struct task_struct *tsk)
54 { 56 {
@@ -73,7 +75,7 @@ become list_for_each_entry_rcu(). The _rcu() list-traversal primitives
73insert the read-side memory barriers that are required on DEC Alpha CPUs. 75insert the read-side memory barriers that are required on DEC Alpha CPUs.
74 76
75The changes to the update side are also straightforward. A reader-writer 77The changes to the update side are also straightforward. A reader-writer
76lock might be used as follows for deletion and insertion: 78lock might be used as follows for deletion and insertion::
77 79
78 static inline int audit_del_rule(struct audit_rule *rule, 80 static inline int audit_del_rule(struct audit_rule *rule,
79 struct list_head *list) 81 struct list_head *list)
@@ -106,7 +108,7 @@ lock might be used as follows for deletion and insertion:
106 return 0; 108 return 0;
107 } 109 }
108 110
109Following are the RCU equivalents for these two functions: 111Following are the RCU equivalents for these two functions::
110 112
111 static inline int audit_del_rule(struct audit_rule *rule, 113 static inline int audit_del_rule(struct audit_rule *rule,
112 struct list_head *list) 114 struct list_head *list)
@@ -154,13 +156,13 @@ otherwise cause concurrent readers to fail spectacularly.
154So, when readers can tolerate stale data and when entries are either added 156So, when readers can tolerate stale data and when entries are either added
155or deleted, without in-place modification, it is very easy to use RCU! 157or deleted, without in-place modification, it is very easy to use RCU!
156 158
157
158Example 2: Handling In-Place Updates 159Example 2: Handling In-Place Updates
160------------------------------------
159 161
160The system-call auditing code does not update auditing rules in place. 162The system-call auditing code does not update auditing rules in place.
161However, if it did, reader-writer-locked code to do so might look as 163However, if it did, reader-writer-locked code to do so might look as
162follows (presumably, the field_count is only permitted to decrease, 164follows (presumably, the field_count is only permitted to decrease,
163otherwise, the added fields would need to be filled in): 165otherwise, the added fields would need to be filled in)::
164 166
165 static inline int audit_upd_rule(struct audit_rule *rule, 167 static inline int audit_upd_rule(struct audit_rule *rule,
166 struct list_head *list, 168 struct list_head *list,
@@ -187,7 +189,7 @@ otherwise, the added fields would need to be filled in):
187The RCU version creates a copy, updates the copy, then replaces the old 189The RCU version creates a copy, updates the copy, then replaces the old
188entry with the newly updated entry. This sequence of actions, allowing 190entry with the newly updated entry. This sequence of actions, allowing
189concurrent reads while doing a copy to perform an update, is what gives 191concurrent reads while doing a copy to perform an update, is what gives
190RCU ("read-copy update") its name. The RCU code is as follows: 192RCU ("read-copy update") its name. The RCU code is as follows::
191 193
192 static inline int audit_upd_rule(struct audit_rule *rule, 194 static inline int audit_upd_rule(struct audit_rule *rule,
193 struct list_head *list, 195 struct list_head *list,
@@ -216,8 +218,8 @@ RCU ("read-copy update") its name. The RCU code is as follows:
216Again, this assumes that the caller holds audit_netlink_sem. Normally, 218Again, this assumes that the caller holds audit_netlink_sem. Normally,
217the reader-writer lock would become a spinlock in this sort of code. 219the reader-writer lock would become a spinlock in this sort of code.
218 220
219
220Example 3: Eliminating Stale Data 221Example 3: Eliminating Stale Data
222---------------------------------
221 223
222The auditing examples above tolerate stale data, as do most algorithms 224The auditing examples above tolerate stale data, as do most algorithms
223that are tracking external state. Because there is a delay from the 225that are tracking external state. Because there is a delay from the
@@ -231,13 +233,16 @@ per-entry spinlock, and, if the "deleted" flag is set, pretends that the
231entry does not exist. For this to be helpful, the search function must 233entry does not exist. For this to be helpful, the search function must
232return holding the per-entry spinlock, as ipc_lock() does in fact do. 234return holding the per-entry spinlock, as ipc_lock() does in fact do.
233 235
234Quick Quiz: Why does the search function need to return holding the 236Quick Quiz:
235 per-entry lock for this deleted-flag technique to be helpful? 237 Why does the search function need to return holding the per-entry lock for
238 this deleted-flag technique to be helpful?
239
240:ref:`Answer to Quick Quiz <answer_quick_quiz_list>`
236 241
237If the system-call audit module were to ever need to reject stale data, 242If the system-call audit module were to ever need to reject stale data,
238one way to accomplish this would be to add a "deleted" flag and a "lock" 243one way to accomplish this would be to add a "deleted" flag and a "lock"
239spinlock to the audit_entry structure, and modify audit_filter_task() 244spinlock to the audit_entry structure, and modify audit_filter_task()
240as follows: 245as follows::
241 246
242 static enum audit_state audit_filter_task(struct task_struct *tsk) 247 static enum audit_state audit_filter_task(struct task_struct *tsk)
243 { 248 {
@@ -268,7 +273,7 @@ audit_upd_rule() would need additional memory barriers to ensure
268that the list_add_rcu() was really executed before the list_del_rcu(). 273that the list_add_rcu() was really executed before the list_del_rcu().
269 274
270The audit_del_rule() function would need to set the "deleted" 275The audit_del_rule() function would need to set the "deleted"
271flag under the spinlock as follows: 276flag under the spinlock as follows::
272 277
273 static inline int audit_del_rule(struct audit_rule *rule, 278 static inline int audit_del_rule(struct audit_rule *rule,
274 struct list_head *list) 279 struct list_head *list)
@@ -290,8 +295,8 @@ flag under the spinlock as follows:
290 return -EFAULT; /* No matching rule */ 295 return -EFAULT; /* No matching rule */
291 } 296 }
292 297
293
294Summary 298Summary
299-------
295 300
296Read-mostly list-based data structures that can tolerate stale data are 301Read-mostly list-based data structures that can tolerate stale data are
297the most amenable to use of RCU. The simplest case is where entries are 302the most amenable to use of RCU. The simplest case is where entries are
@@ -302,8 +307,9 @@ If stale data cannot be tolerated, then a "deleted" flag may be used
302in conjunction with a per-entry spinlock in order to allow the search 307in conjunction with a per-entry spinlock in order to allow the search
303function to reject newly deleted data. 308function to reject newly deleted data.
304 309
310.. _answer_quick_quiz_list:
305 311
306Answer to Quick Quiz 312Answer to Quick Quiz:
307 Why does the search function need to return holding the per-entry 313 Why does the search function need to return holding the per-entry
308 lock for this deleted-flag technique to be helpful? 314 lock for this deleted-flag technique to be helpful?
309 315
diff --git a/Documentation/RCU/rcu.rst b/Documentation/RCU/rcu.rst
new file mode 100644
index 000000000000..8dfb437dacc3
--- /dev/null
+++ b/Documentation/RCU/rcu.rst
@@ -0,0 +1,92 @@
1.. _rcu_doc:
2
3RCU Concepts
4============
5
6The basic idea behind RCU (read-copy update) is to split destructive
7operations into two parts, one that prevents anyone from seeing the data
8item being destroyed, and one that actually carries out the destruction.
9A "grace period" must elapse between the two parts, and this grace period
10must be long enough that any readers accessing the item being deleted have
11since dropped their references. For example, an RCU-protected deletion
12from a linked list would first remove the item from the list, wait for
13a grace period to elapse, then free the element. See the
14Documentation/RCU/listRCU.rst file for more information on using RCU with
15linked lists.
16
17Frequently Asked Questions
18--------------------------
19
20- Why would anyone want to use RCU?
21
22 The advantage of RCU's two-part approach is that RCU readers need
23 not acquire any locks, perform any atomic instructions, write to
24 shared memory, or (on CPUs other than Alpha) execute any memory
25 barriers. The fact that these operations are quite expensive
26 on modern CPUs is what gives RCU its performance advantages
27 in read-mostly situations. The fact that RCU readers need not
28 acquire locks can also greatly simplify deadlock-avoidance code.
29
30- How can the updater tell when a grace period has completed
31 if the RCU readers give no indication when they are done?
32
33 Just as with spinlocks, RCU readers are not permitted to
34 block, switch to user-mode execution, or enter the idle loop.
35 Therefore, as soon as a CPU is seen passing through any of these
36 three states, we know that that CPU has exited any previous RCU
37 read-side critical sections. So, if we remove an item from a
38 linked list, and then wait until all CPUs have switched context,
39 executed in user mode, or executed in the idle loop, we can
40 safely free up that item.
41
42 Preemptible variants of RCU (CONFIG_PREEMPT_RCU) get the
43 same effect, but require that the readers manipulate CPU-local
44 counters. These counters allow limited types of blocking within
45 RCU read-side critical sections. SRCU also uses CPU-local
46 counters, and permits general blocking within RCU read-side
47 critical sections. These variants of RCU detect grace periods
48 by sampling these counters.
49
50- If I am running on a uniprocessor kernel, which can only do one
51 thing at a time, why should I wait for a grace period?
52
53 See the Documentation/RCU/UP.rst file for more information.
54
55- How can I see where RCU is currently used in the Linux kernel?
56
57 Search for "rcu_read_lock", "rcu_read_unlock", "call_rcu",
58 "rcu_read_lock_bh", "rcu_read_unlock_bh", "srcu_read_lock",
59 "srcu_read_unlock", "synchronize_rcu", "synchronize_net",
60 "synchronize_srcu", and the other RCU primitives. Or grab one
61 of the cscope databases from:
62
63 (http://www.rdrop.com/users/paulmck/RCU/linuxusage/rculocktab.html).
64
65- What guidelines should I follow when writing code that uses RCU?
66
67 See the checklist.txt file in this directory.
68
69- Why the name "RCU"?
70
71 "RCU" stands for "read-copy update". The file Documentation/RCU/listRCU.rst
72 has more information on where this name came from, search for
73 "read-copy update" to find it.
74
75- I hear that RCU is patented? What is with that?
76
77 Yes, it is. There are several known patents related to RCU,
78 search for the string "Patent" in RTFP.txt to find them.
79 Of these, one was allowed to lapse by the assignee, and the
80 others have been contributed to the Linux kernel under GPL.
81 There are now also LGPL implementations of user-level RCU
82 available (http://liburcu.org/).
83
84- I hear that RCU needs work in order to support realtime kernels?
85
86 Realtime-friendly RCU can be enabled via the CONFIG_PREEMPT_RCU
87 kernel configuration parameter.
88
89- Where can I find more information on RCU?
90
91 See the RTFP.txt file in this directory.
92 Or point your browser at (http://www.rdrop.com/users/paulmck/RCU/).
diff --git a/Documentation/RCU/rcu.txt b/Documentation/RCU/rcu.txt
deleted file mode 100644
index c818cf65c5a9..000000000000
--- a/Documentation/RCU/rcu.txt
+++ /dev/null
@@ -1,89 +0,0 @@
1RCU Concepts
2
3
4The basic idea behind RCU (read-copy update) is to split destructive
5operations into two parts, one that prevents anyone from seeing the data
6item being destroyed, and one that actually carries out the destruction.
7A "grace period" must elapse between the two parts, and this grace period
8must be long enough that any readers accessing the item being deleted have
9since dropped their references. For example, an RCU-protected deletion
10from a linked list would first remove the item from the list, wait for
11a grace period to elapse, then free the element. See the listRCU.txt
12file for more information on using RCU with linked lists.
13
14
15Frequently Asked Questions
16
17o Why would anyone want to use RCU?
18
19 The advantage of RCU's two-part approach is that RCU readers need
20 not acquire any locks, perform any atomic instructions, write to
21 shared memory, or (on CPUs other than Alpha) execute any memory
22 barriers. The fact that these operations are quite expensive
23 on modern CPUs is what gives RCU its performance advantages
24 in read-mostly situations. The fact that RCU readers need not
25 acquire locks can also greatly simplify deadlock-avoidance code.
26
27o How can the updater tell when a grace period has completed
28 if the RCU readers give no indication when they are done?
29
30 Just as with spinlocks, RCU readers are not permitted to
31 block, switch to user-mode execution, or enter the idle loop.
32 Therefore, as soon as a CPU is seen passing through any of these
33 three states, we know that that CPU has exited any previous RCU
34 read-side critical sections. So, if we remove an item from a
35 linked list, and then wait until all CPUs have switched context,
36 executed in user mode, or executed in the idle loop, we can
37 safely free up that item.
38
39 Preemptible variants of RCU (CONFIG_PREEMPT_RCU) get the
40 same effect, but require that the readers manipulate CPU-local
41 counters. These counters allow limited types of blocking within
42 RCU read-side critical sections. SRCU also uses CPU-local
43 counters, and permits general blocking within RCU read-side
44 critical sections. These variants of RCU detect grace periods
45 by sampling these counters.
46
47o If I am running on a uniprocessor kernel, which can only do one
48 thing at a time, why should I wait for a grace period?
49
50 See the UP.txt file in this directory.
51
52o How can I see where RCU is currently used in the Linux kernel?
53
54 Search for "rcu_read_lock", "rcu_read_unlock", "call_rcu",
55 "rcu_read_lock_bh", "rcu_read_unlock_bh", "srcu_read_lock",
56 "srcu_read_unlock", "synchronize_rcu", "synchronize_net",
57 "synchronize_srcu", and the other RCU primitives. Or grab one
58 of the cscope databases from:
59
60 http://www.rdrop.com/users/paulmck/RCU/linuxusage/rculocktab.html
61
62o What guidelines should I follow when writing code that uses RCU?
63
64 See the checklist.txt file in this directory.
65
66o Why the name "RCU"?
67
68 "RCU" stands for "read-copy update". The file listRCU.txt has
69 more information on where this name came from, search for
70 "read-copy update" to find it.
71
72o I hear that RCU is patented? What is with that?
73
74 Yes, it is. There are several known patents related to RCU,
75 search for the string "Patent" in RTFP.txt to find them.
76 Of these, one was allowed to lapse by the assignee, and the
77 others have been contributed to the Linux kernel under GPL.
78 There are now also LGPL implementations of user-level RCU
79 available (http://liburcu.org/).
80
81o I hear that RCU needs work in order to support realtime kernels?
82
83 Realtime-friendly RCU can be enabled via the CONFIG_PREEMPT_RCU
84 kernel configuration parameter.
85
86o Where can I find more information on RCU?
87
88 See the RTFP.txt file in this directory.
89 Or point your browser at http://www.rdrop.com/users/paulmck/RCU/.
diff --git a/Documentation/accelerators/ocxl.rst b/Documentation/accelerators/ocxl.rst
index 14cefc020e2d..b1cea19a90f5 100644
--- a/Documentation/accelerators/ocxl.rst
+++ b/Documentation/accelerators/ocxl.rst
@@ -1,3 +1,5 @@
1:orphan:
2
1======================================================== 3========================================================
2OpenCAPI (Open Coherent Accelerator Processor Interface) 4OpenCAPI (Open Coherent Accelerator Processor Interface)
3======================================================== 5========================================================
diff --git a/Documentation/acpi/dsd/leds.txt b/Documentation/acpi/dsd/leds.txt
index 81a63af42ed2..cc58b1a574c5 100644
--- a/Documentation/acpi/dsd/leds.txt
+++ b/Documentation/acpi/dsd/leds.txt
@@ -96,4 +96,4 @@ where
96 <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>, 96 <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
97 referenced 2019-02-21. 97 referenced 2019-02-21.
98 98
99[7] Documentation/acpi/dsd/data-node-reference.txt 99[7] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
diff --git a/Documentation/admin-guide/README.rst b/Documentation/admin-guide/README.rst
index a582c780c3bd..cc6151fc0845 100644
--- a/Documentation/admin-guide/README.rst
+++ b/Documentation/admin-guide/README.rst
@@ -227,7 +227,7 @@ Configuring the kernel
227 "make tinyconfig" Configure the tiniest possible kernel. 227 "make tinyconfig" Configure the tiniest possible kernel.
228 228
229 You can find more information on using the Linux kernel config tools 229 You can find more information on using the Linux kernel config tools
230 in Documentation/kbuild/kconfig.txt. 230 in Documentation/kbuild/kconfig.rst.
231 231
232 - NOTES on ``make config``: 232 - NOTES on ``make config``:
233 233
diff --git a/Documentation/filesystems/binderfs.rst b/Documentation/admin-guide/binderfs.rst
index c009671f8434..c009671f8434 100644
--- a/Documentation/filesystems/binderfs.rst
+++ b/Documentation/admin-guide/binderfs.rst
diff --git a/Documentation/admin-guide/bug-hunting.rst b/Documentation/admin-guide/bug-hunting.rst
index f278b289e260..b761aa2a51d2 100644
--- a/Documentation/admin-guide/bug-hunting.rst
+++ b/Documentation/admin-guide/bug-hunting.rst
@@ -90,7 +90,7 @@ the disk is not available then you have three options:
90 run a null modem to a second machine and capture the output there 90 run a null modem to a second machine and capture the output there
91 using your favourite communication program. Minicom works well. 91 using your favourite communication program. Minicom works well.
92 92
93(3) Use Kdump (see Documentation/kdump/kdump.txt), 93(3) Use Kdump (see Documentation/kdump/kdump.rst),
94 extract the kernel ring buffer from old memory with using dmesg 94 extract the kernel ring buffer from old memory with using dmesg
95 gdbmacro in Documentation/kdump/gdbmacros.txt. 95 gdbmacro in Documentation/kdump/gdbmacros.txt.
96 96
diff --git a/Documentation/admin-guide/hw-vuln/index.rst b/Documentation/admin-guide/hw-vuln/index.rst
index ffc064c1ec68..49311f3da6f2 100644
--- a/Documentation/admin-guide/hw-vuln/index.rst
+++ b/Documentation/admin-guide/hw-vuln/index.rst
@@ -9,5 +9,6 @@ are configurable at compile, boot or run time.
9.. toctree:: 9.. toctree::
10 :maxdepth: 1 10 :maxdepth: 1
11 11
12 spectre
12 l1tf 13 l1tf
13 mds 14 mds
diff --git a/Documentation/admin-guide/hw-vuln/spectre.rst b/Documentation/admin-guide/hw-vuln/spectre.rst
new file mode 100644
index 000000000000..25f3b2532198
--- /dev/null
+++ b/Documentation/admin-guide/hw-vuln/spectre.rst
@@ -0,0 +1,697 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3Spectre Side Channels
4=====================
5
6Spectre is a class of side channel attacks that exploit branch prediction
7and speculative execution on modern CPUs to read memory, possibly
8bypassing access controls. Speculative execution side channel exploits
9do not modify memory but attempt to infer privileged data in the memory.
10
11This document covers Spectre variant 1 and Spectre variant 2.
12
13Affected processors
14-------------------
15
16Speculative execution side channel methods affect a wide range of modern
17high performance processors, since most modern high speed processors
18use branch prediction and speculative execution.
19
20The following CPUs are vulnerable:
21
22 - Intel Core, Atom, Pentium, and Xeon processors
23
24 - AMD Phenom, EPYC, and Zen processors
25
26 - IBM POWER and zSeries processors
27
28 - Higher end ARM processors
29
30 - Apple CPUs
31
32 - Higher end MIPS CPUs
33
34 - Likely most other high performance CPUs. Contact your CPU vendor for details.
35
36Whether a processor is affected or not can be read out from the Spectre
37vulnerability files in sysfs. See :ref:`spectre_sys_info`.
38
39Related CVEs
40------------
41
42The following CVE entries describe Spectre variants:
43
44 ============= ======================= =================
45 CVE-2017-5753 Bounds check bypass Spectre variant 1
46 CVE-2017-5715 Branch target injection Spectre variant 2
47 ============= ======================= =================
48
49Problem
50-------
51
52CPUs use speculative operations to improve performance. That may leave
53traces of memory accesses or computations in the processor's caches,
54buffers, and branch predictors. Malicious software may be able to
55influence the speculative execution paths, and then use the side effects
56of the speculative execution in the CPUs' caches and buffers to infer
57privileged data touched during the speculative execution.
58
59Spectre variant 1 attacks take advantage of speculative execution of
60conditional branches, while Spectre variant 2 attacks use speculative
61execution of indirect branches to leak privileged memory.
62See :ref:`[1] <spec_ref1>` :ref:`[5] <spec_ref5>` :ref:`[7] <spec_ref7>`
63:ref:`[10] <spec_ref10>` :ref:`[11] <spec_ref11>`.
64
65Spectre variant 1 (Bounds Check Bypass)
66---------------------------------------
67
68The bounds check bypass attack :ref:`[2] <spec_ref2>` takes advantage
69of speculative execution that bypasses conditional branch instructions
70used for memory access bounds check (e.g. checking if the index of an
71array results in memory access within a valid range). This results in
72memory accesses to invalid memory (with out-of-bound index) that are
73done speculatively before validation checks resolve. Such speculative
74memory accesses can leave side effects, creating side channels which
75leak information to the attacker.
76
77There are some extensions of Spectre variant 1 attacks for reading data
78over the network, see :ref:`[12] <spec_ref12>`. However such attacks
79are difficult, low bandwidth, fragile, and are considered low risk.
80
81Spectre variant 2 (Branch Target Injection)
82-------------------------------------------
83
84The branch target injection attack takes advantage of speculative
85execution of indirect branches :ref:`[3] <spec_ref3>`. The indirect
86branch predictors inside the processor used to guess the target of
87indirect branches can be influenced by an attacker, causing gadget code
88to be speculatively executed, thus exposing sensitive data touched by
89the victim. The side effects left in the CPU's caches during speculative
90execution can be measured to infer data values.
91
92.. _poison_btb:
93
94In Spectre variant 2 attacks, the attacker can steer speculative indirect
95branches in the victim to gadget code by poisoning the branch target
96buffer of a CPU used for predicting indirect branch addresses. Such
97poisoning could be done by indirect branching into existing code,
98with the address offset of the indirect branch under the attacker's
99control. Since the branch prediction on impacted hardware does not
100fully disambiguate branch address and uses the offset for prediction,
101this could cause privileged code's indirect branch to jump to a gadget
102code with the same offset.
103
104The most useful gadgets take an attacker-controlled input parameter (such
105as a register value) so that the memory read can be controlled. Gadgets
106without input parameters might be possible, but the attacker would have
107very little control over what memory can be read, reducing the risk of
108the attack revealing useful data.
109
110One other variant 2 attack vector is for the attacker to poison the
111return stack buffer (RSB) :ref:`[13] <spec_ref13>` to cause speculative
112subroutine return instruction execution to go to a gadget. An attacker's
113imbalanced subroutine call instructions might "poison" entries in the
114return stack buffer which are later consumed by a victim's subroutine
115return instructions. This attack can be mitigated by flushing the return
116stack buffer on context switch, or virtual machine (VM) exit.
117
118On systems with simultaneous multi-threading (SMT), attacks are possible
119from the sibling thread, as level 1 cache and branch target buffer
120(BTB) may be shared between hardware threads in a CPU core. A malicious
121program running on the sibling thread may influence its peer's BTB to
122steer its indirect branch speculations to gadget code, and measure the
123speculative execution's side effects left in level 1 cache to infer the
124victim's data.
125
126Attack scenarios
127----------------
128
129The following list of attack scenarios have been anticipated, but may
130not cover all possible attack vectors.
131
1321. A user process attacking the kernel
133^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134
135 The attacker passes a parameter to the kernel via a register or
136 via a known address in memory during a syscall. Such parameter may
137 be used later by the kernel as an index to an array or to derive
138 a pointer for a Spectre variant 1 attack. The index or pointer
139 is invalid, but bound checks are bypassed in the code branch taken
140 for speculative execution. This could cause privileged memory to be
141 accessed and leaked.
142
143 For kernel code that has been identified where data pointers could
144 potentially be influenced for Spectre attacks, new "nospec" accessor
145 macros are used to prevent speculative loading of data.
146
147 Spectre variant 2 attacker can :ref:`poison <poison_btb>` the branch
148 target buffer (BTB) before issuing syscall to launch an attack.
149 After entering the kernel, the kernel could use the poisoned branch
150 target buffer on indirect jump and jump to gadget code in speculative
151 execution.
152
153 If an attacker tries to control the memory addresses leaked during
154 speculative execution, he would also need to pass a parameter to the
155 gadget, either through a register or a known address in memory. After
156 the gadget has executed, he can measure the side effect.
157
158 The kernel can protect itself against consuming poisoned branch
159 target buffer entries by using return trampolines (also known as
160 "retpoline") :ref:`[3] <spec_ref3>` :ref:`[9] <spec_ref9>` for all
161 indirect branches. Return trampolines trap speculative execution paths
162 to prevent jumping to gadget code during speculative execution.
163 x86 CPUs with Enhanced Indirect Branch Restricted Speculation
164 (Enhanced IBRS) available in hardware should use the feature to
165 mitigate Spectre variant 2 instead of retpoline. Enhanced IBRS is
166 more efficient than retpoline.
167
168 There may be gadget code in firmware which could be exploited with
169 Spectre variant 2 attack by a rogue user process. To mitigate such
170 attacks on x86, Indirect Branch Restricted Speculation (IBRS) feature
171 is turned on before the kernel invokes any firmware code.
172
1732. A user process attacking another user process
174^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
175
176 A malicious user process can try to attack another user process,
177 either via a context switch on the same hardware thread, or from the
178 sibling hyperthread sharing a physical processor core on simultaneous
179 multi-threading (SMT) system.
180
181 Spectre variant 1 attacks generally require passing parameters
182 between the processes, which needs a data passing relationship, such
183 as remote procedure calls (RPC). Those parameters are used in gadget
184 code to derive invalid data pointers accessing privileged memory in
185 the attacked process.
186
187 Spectre variant 2 attacks can be launched from a rogue process by
188 :ref:`poisoning <poison_btb>` the branch target buffer. This can
189 influence the indirect branch targets for a victim process that either
190 runs later on the same hardware thread, or running concurrently on
191 a sibling hardware thread sharing the same physical core.
192
193 A user process can protect itself against Spectre variant 2 attacks
194 by using the prctl() syscall to disable indirect branch speculation
195 for itself. An administrator can also cordon off an unsafe process
196 from polluting the branch target buffer by disabling the process's
197 indirect branch speculation. This comes with a performance cost
198 from not using indirect branch speculation and clearing the branch
199 target buffer. When SMT is enabled on x86, for a process that has
200 indirect branch speculation disabled, Single Threaded Indirect Branch
201 Predictors (STIBP) :ref:`[4] <spec_ref4>` are turned on to prevent the
202 sibling thread from controlling branch target buffer. In addition,
203 the Indirect Branch Prediction Barrier (IBPB) is issued to clear the
204 branch target buffer when context switching to and from such process.
205
206 On x86, the return stack buffer is stuffed on context switch.
207 This prevents the branch target buffer from being used for branch
208 prediction when the return stack buffer underflows while switching to
209 a deeper call stack. Any poisoned entries in the return stack buffer
210 left by the previous process will also be cleared.
211
212 User programs should use address space randomization to make attacks
213 more difficult (Set /proc/sys/kernel/randomize_va_space = 1 or 2).
214
2153. A virtualized guest attacking the host
216^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
217
218 The attack mechanism is similar to how user processes attack the
219 kernel. The kernel is entered via hyper-calls or other virtualization
220 exit paths.
221
222 For Spectre variant 1 attacks, rogue guests can pass parameters
223 (e.g. in registers) via hyper-calls to derive invalid pointers to
224 speculate into privileged memory after entering the kernel. For places
225 where such kernel code has been identified, nospec accessor macros
226 are used to stop speculative memory access.
227
228 For Spectre variant 2 attacks, rogue guests can :ref:`poison
229 <poison_btb>` the branch target buffer or return stack buffer, causing
230 the kernel to jump to gadget code in the speculative execution paths.
231
232 To mitigate variant 2, the host kernel can use return trampolines
233 for indirect branches to bypass the poisoned branch target buffer,
234 and flushing the return stack buffer on VM exit. This prevents rogue
235 guests from affecting indirect branching in the host kernel.
236
237 To protect host processes from rogue guests, host processes can have
238 indirect branch speculation disabled via prctl(). The branch target
239 buffer is cleared before context switching to such processes.
240
2414. A virtualized guest attacking other guest
242^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
243
244 A rogue guest may attack another guest to get data accessible by the
245 other guest.
246
247 Spectre variant 1 attacks are possible if parameters can be passed
248 between guests. This may be done via mechanisms such as shared memory
249 or message passing. Such parameters could be used to derive data
250 pointers to privileged data in guest. The privileged data could be
251 accessed by gadget code in the victim's speculation paths.
252
253 Spectre variant 2 attacks can be launched from a rogue guest by
254 :ref:`poisoning <poison_btb>` the branch target buffer or the return
255 stack buffer. Such poisoned entries could be used to influence
256 speculation execution paths in the victim guest.
257
258 Linux kernel mitigates attacks to other guests running in the same
259 CPU hardware thread by flushing the return stack buffer on VM exit,
260 and clearing the branch target buffer before switching to a new guest.
261
262 If SMT is used, Spectre variant 2 attacks from an untrusted guest
263 in the sibling hyperthread can be mitigated by the administrator,
264 by turning off the unsafe guest's indirect branch speculation via
265 prctl(). A guest can also protect itself by turning on microcode
266 based mitigations (such as IBPB or STIBP on x86) within the guest.
267
268.. _spectre_sys_info:
269
270Spectre system information
271--------------------------
272
273The Linux kernel provides a sysfs interface to enumerate the current
274mitigation status of the system for Spectre: whether the system is
275vulnerable, and which mitigations are active.
276
277The sysfs file showing Spectre variant 1 mitigation status is:
278
279 /sys/devices/system/cpu/vulnerabilities/spectre_v1
280
281The possible values in this file are:
282
283 ======================================= =================================
284 'Mitigation: __user pointer sanitation' Protection in kernel on a case by
285 case base with explicit pointer
286 sanitation.
287 ======================================= =================================
288
289However, the protections are put in place on a case by case basis,
290and there is no guarantee that all possible attack vectors for Spectre
291variant 1 are covered.
292
293The spectre_v2 kernel file reports if the kernel has been compiled with
294retpoline mitigation or if the CPU has hardware mitigation, and if the
295CPU has support for additional process-specific mitigation.
296
297This file also reports CPU features enabled by microcode to mitigate
298attack between user processes:
299
3001. Indirect Branch Prediction Barrier (IBPB) to add additional
301 isolation between processes of different users.
3022. Single Thread Indirect Branch Predictors (STIBP) to add additional
303 isolation between CPU threads running on the same core.
304
305These CPU features may impact performance when used and can be enabled
306per process on a case-by-case base.
307
308The sysfs file showing Spectre variant 2 mitigation status is:
309
310 /sys/devices/system/cpu/vulnerabilities/spectre_v2
311
312The possible values in this file are:
313
314 - Kernel status:
315
316 ==================================== =================================
317 'Not affected' The processor is not vulnerable
318 'Vulnerable' Vulnerable, no mitigation
319 'Mitigation: Full generic retpoline' Software-focused mitigation
320 'Mitigation: Full AMD retpoline' AMD-specific software mitigation
321 'Mitigation: Enhanced IBRS' Hardware-focused mitigation
322 ==================================== =================================
323
324 - Firmware status: Show if Indirect Branch Restricted Speculation (IBRS) is
325 used to protect against Spectre variant 2 attacks when calling firmware (x86 only).
326
327 ========== =============================================================
328 'IBRS_FW' Protection against user program attacks when calling firmware
329 ========== =============================================================
330
331 - Indirect branch prediction barrier (IBPB) status for protection between
332 processes of different users. This feature can be controlled through
333 prctl() per process, or through kernel command line options. This is
334 an x86 only feature. For more details see below.
335
336 =================== ========================================================
337 'IBPB: disabled' IBPB unused
338 'IBPB: always-on' Use IBPB on all tasks
339 'IBPB: conditional' Use IBPB on SECCOMP or indirect branch restricted tasks
340 =================== ========================================================
341
342 - Single threaded indirect branch prediction (STIBP) status for protection
343 between different hyper threads. This feature can be controlled through
344 prctl per process, or through kernel command line options. This is x86
345 only feature. For more details see below.
346
347 ==================== ========================================================
348 'STIBP: disabled' STIBP unused
349 'STIBP: forced' Use STIBP on all tasks
350 'STIBP: conditional' Use STIBP on SECCOMP or indirect branch restricted tasks
351 ==================== ========================================================
352
353 - Return stack buffer (RSB) protection status:
354
355 ============= ===========================================
356 'RSB filling' Protection of RSB on context switch enabled
357 ============= ===========================================
358
359Full mitigation might require a microcode update from the CPU
360vendor. When the necessary microcode is not available, the kernel will
361report vulnerability.
362
363Turning on mitigation for Spectre variant 1 and Spectre variant 2
364-----------------------------------------------------------------
365
3661. Kernel mitigation
367^^^^^^^^^^^^^^^^^^^^
368
369 For the Spectre variant 1, vulnerable kernel code (as determined
370 by code audit or scanning tools) is annotated on a case by case
371 basis to use nospec accessor macros for bounds clipping :ref:`[2]
372 <spec_ref2>` to avoid any usable disclosure gadgets. However, it may
373 not cover all attack vectors for Spectre variant 1.
374
375 For Spectre variant 2 mitigation, the compiler turns indirect calls or
376 jumps in the kernel into equivalent return trampolines (retpolines)
377 :ref:`[3] <spec_ref3>` :ref:`[9] <spec_ref9>` to go to the target
378 addresses. Speculative execution paths under retpolines are trapped
379 in an infinite loop to prevent any speculative execution jumping to
380 a gadget.
381
382 To turn on retpoline mitigation on a vulnerable CPU, the kernel
383 needs to be compiled with a gcc compiler that supports the
384 -mindirect-branch=thunk-extern -mindirect-branch-register options.
385 If the kernel is compiled with a Clang compiler, the compiler needs
386 to support -mretpoline-external-thunk option. The kernel config
387 CONFIG_RETPOLINE needs to be turned on, and the CPU needs to run with
388 the latest updated microcode.
389
390 On Intel Skylake-era systems the mitigation covers most, but not all,
391 cases. See :ref:`[3] <spec_ref3>` for more details.
392
393 On CPUs with hardware mitigation for Spectre variant 2 (e.g. Enhanced
394 IBRS on x86), retpoline is automatically disabled at run time.
395
396 The retpoline mitigation is turned on by default on vulnerable
397 CPUs. It can be forced on or off by the administrator
398 via the kernel command line and sysfs control files. See
399 :ref:`spectre_mitigation_control_command_line`.
400
401 On x86, indirect branch restricted speculation is turned on by default
402 before invoking any firmware code to prevent Spectre variant 2 exploits
403 using the firmware.
404
405 Using kernel address space randomization (CONFIG_RANDOMIZE_SLAB=y
406 and CONFIG_SLAB_FREELIST_RANDOM=y in the kernel configuration) makes
407 attacks on the kernel generally more difficult.
408
4092. User program mitigation
410^^^^^^^^^^^^^^^^^^^^^^^^^^
411
412 User programs can mitigate Spectre variant 1 using LFENCE or "bounds
413 clipping". For more details see :ref:`[2] <spec_ref2>`.
414
415 For Spectre variant 2 mitigation, individual user programs
416 can be compiled with return trampolines for indirect branches.
417 This protects them from consuming poisoned entries in the branch
418 target buffer left by malicious software. Alternatively, the
419 programs can disable their indirect branch speculation via prctl()
420 (See :ref:`Documentation/userspace-api/spec_ctrl.rst <set_spec_ctrl>`).
421 On x86, this will turn on STIBP to guard against attacks from the
422 sibling thread when the user program is running, and use IBPB to
423 flush the branch target buffer when switching to/from the program.
424
425 Restricting indirect branch speculation on a user program will
426 also prevent the program from launching a variant 2 attack
427 on x86. All sand-boxed SECCOMP programs have indirect branch
428 speculation restricted by default. Administrators can change
429 that behavior via the kernel command line and sysfs control files.
430 See :ref:`spectre_mitigation_control_command_line`.
431
432 Programs that disable their indirect branch speculation will have
433 more overhead and run slower.
434
435 User programs should use address space randomization
436 (/proc/sys/kernel/randomize_va_space = 1 or 2) to make attacks more
437 difficult.
438
4393. VM mitigation
440^^^^^^^^^^^^^^^^
441
442 Within the kernel, Spectre variant 1 attacks from rogue guests are
443 mitigated on a case by case basis in VM exit paths. Vulnerable code
444 uses nospec accessor macros for "bounds clipping", to avoid any
445 usable disclosure gadgets. However, this may not cover all variant
446 1 attack vectors.
447
448 For Spectre variant 2 attacks from rogue guests to the kernel, the
449 Linux kernel uses retpoline or Enhanced IBRS to prevent consumption of
450 poisoned entries in branch target buffer left by rogue guests. It also
451 flushes the return stack buffer on every VM exit to prevent a return
452 stack buffer underflow so poisoned branch target buffer could be used,
453 or attacker guests leaving poisoned entries in the return stack buffer.
454
455 To mitigate guest-to-guest attacks in the same CPU hardware thread,
456 the branch target buffer is sanitized by flushing before switching
457 to a new guest on a CPU.
458
459 The above mitigations are turned on by default on vulnerable CPUs.
460
461 To mitigate guest-to-guest attacks from sibling thread when SMT is
462 in use, an untrusted guest running in the sibling thread can have
463 its indirect branch speculation disabled by administrator via prctl().
464
465 The kernel also allows guests to use any microcode based mitigation
466 they choose to use (such as IBPB or STIBP on x86) to protect themselves.
467
468.. _spectre_mitigation_control_command_line:
469
470Mitigation control on the kernel command line
471---------------------------------------------
472
473Spectre variant 2 mitigation can be disabled or force enabled at the
474kernel command line.
475
476 nospectre_v2
477
478 [X86] Disable all mitigations for the Spectre variant 2
479 (indirect branch prediction) vulnerability. System may
480 allow data leaks with this option, which is equivalent
481 to spectre_v2=off.
482
483
484 spectre_v2=
485
486 [X86] Control mitigation of Spectre variant 2
487 (indirect branch speculation) vulnerability.
488 The default operation protects the kernel from
489 user space attacks.
490
491 on
492 unconditionally enable, implies
493 spectre_v2_user=on
494 off
495 unconditionally disable, implies
496 spectre_v2_user=off
497 auto
498 kernel detects whether your CPU model is
499 vulnerable
500
501 Selecting 'on' will, and 'auto' may, choose a
502 mitigation method at run time according to the
503 CPU, the available microcode, the setting of the
504 CONFIG_RETPOLINE configuration option, and the
505 compiler with which the kernel was built.
506
507 Selecting 'on' will also enable the mitigation
508 against user space to user space task attacks.
509
510 Selecting 'off' will disable both the kernel and
511 the user space protections.
512
513 Specific mitigations can also be selected manually:
514
515 retpoline
516 replace indirect branches
517 retpoline,generic
518 google's original retpoline
519 retpoline,amd
520 AMD-specific minimal thunk
521
522 Not specifying this option is equivalent to
523 spectre_v2=auto.
524
525For user space mitigation:
526
527 spectre_v2_user=
528
529 [X86] Control mitigation of Spectre variant 2
530 (indirect branch speculation) vulnerability between
531 user space tasks
532
533 on
534 Unconditionally enable mitigations. Is
535 enforced by spectre_v2=on
536
537 off
538 Unconditionally disable mitigations. Is
539 enforced by spectre_v2=off
540
541 prctl
542 Indirect branch speculation is enabled,
543 but mitigation can be enabled via prctl
544 per thread. The mitigation control state
545 is inherited on fork.
546
547 prctl,ibpb
548 Like "prctl" above, but only STIBP is
549 controlled per thread. IBPB is issued
550 always when switching between different user
551 space processes.
552
553 seccomp
554 Same as "prctl" above, but all seccomp
555 threads will enable the mitigation unless
556 they explicitly opt out.
557
558 seccomp,ibpb
559 Like "seccomp" above, but only STIBP is
560 controlled per thread. IBPB is issued
561 always when switching between different
562 user space processes.
563
564 auto
565 Kernel selects the mitigation depending on
566 the available CPU features and vulnerability.
567
568 Default mitigation:
569 If CONFIG_SECCOMP=y then "seccomp", otherwise "prctl"
570
571 Not specifying this option is equivalent to
572 spectre_v2_user=auto.
573
574 In general the kernel by default selects
575 reasonable mitigations for the current CPU. To
576 disable Spectre variant 2 mitigations, boot with
577 spectre_v2=off. Spectre variant 1 mitigations
578 cannot be disabled.
579
580Mitigation selection guide
581--------------------------
582
5831. Trusted userspace
584^^^^^^^^^^^^^^^^^^^^
585
586 If all userspace applications are from trusted sources and do not
587 execute externally supplied untrusted code, then the mitigations can
588 be disabled.
589
5902. Protect sensitive programs
591^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
592
593 For security-sensitive programs that have secrets (e.g. crypto
594 keys), protection against Spectre variant 2 can be put in place by
595 disabling indirect branch speculation when the program is running
596 (See :ref:`Documentation/userspace-api/spec_ctrl.rst <set_spec_ctrl>`).
597
5983. Sandbox untrusted programs
599^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
600
601 Untrusted programs that could be a source of attacks can be cordoned
602 off by disabling their indirect branch speculation when they are run
603 (See :ref:`Documentation/userspace-api/spec_ctrl.rst <set_spec_ctrl>`).
604 This prevents untrusted programs from polluting the branch target
605 buffer. All programs running in SECCOMP sandboxes have indirect
606 branch speculation restricted by default. This behavior can be
607 changed via the kernel command line and sysfs control files. See
608 :ref:`spectre_mitigation_control_command_line`.
609
6103. High security mode
611^^^^^^^^^^^^^^^^^^^^^
612
613 All Spectre variant 2 mitigations can be forced on
614 at boot time for all programs (See the "on" option in
615 :ref:`spectre_mitigation_control_command_line`). This will add
616 overhead as indirect branch speculations for all programs will be
617 restricted.
618
619 On x86, branch target buffer will be flushed with IBPB when switching
620 to a new program. STIBP is left on all the time to protect programs
621 against variant 2 attacks originating from programs running on
622 sibling threads.
623
624 Alternatively, STIBP can be used only when running programs
625 whose indirect branch speculation is explicitly disabled,
626 while IBPB is still used all the time when switching to a new
627 program to clear the branch target buffer (See "ibpb" option in
628 :ref:`spectre_mitigation_control_command_line`). This "ibpb" option
629 has less performance cost than the "on" option, which leaves STIBP
630 on all the time.
631
632References on Spectre
633---------------------
634
635Intel white papers:
636
637.. _spec_ref1:
638
639[1] `Intel analysis of speculative execution side channels <https://newsroom.intel.com/wp-content/uploads/sites/11/2018/01/Intel-Analysis-of-Speculative-Execution-Side-Channels.pdf>`_.
640
641.. _spec_ref2:
642
643[2] `Bounds check bypass <https://software.intel.com/security-software-guidance/software-guidance/bounds-check-bypass>`_.
644
645.. _spec_ref3:
646
647[3] `Deep dive: Retpoline: A branch target injection mitigation <https://software.intel.com/security-software-guidance/insights/deep-dive-retpoline-branch-target-injection-mitigation>`_.
648
649.. _spec_ref4:
650
651[4] `Deep Dive: Single Thread Indirect Branch Predictors <https://software.intel.com/security-software-guidance/insights/deep-dive-single-thread-indirect-branch-predictors>`_.
652
653AMD white papers:
654
655.. _spec_ref5:
656
657[5] `AMD64 technology indirect branch control extension <https://developer.amd.com/wp-content/resources/Architecture_Guidelines_Update_Indirect_Branch_Control.pdf>`_.
658
659.. _spec_ref6:
660
661[6] `Software techniques for managing speculation on AMD processors <https://developer.amd.com/wp-content/resources/90343-B_SoftwareTechniquesforManagingSpeculation_WP_7-18Update_FNL.pdf>`_.
662
663ARM white papers:
664
665.. _spec_ref7:
666
667[7] `Cache speculation side-channels <https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability/download-the-whitepaper>`_.
668
669.. _spec_ref8:
670
671[8] `Cache speculation issues update <https://developer.arm.com/support/arm-security-updates/speculative-processor-vulnerability/latest-updates/cache-speculation-issues-update>`_.
672
673Google white paper:
674
675.. _spec_ref9:
676
677[9] `Retpoline: a software construct for preventing branch-target-injection <https://support.google.com/faqs/answer/7625886>`_.
678
679MIPS white paper:
680
681.. _spec_ref10:
682
683[10] `MIPS: response on speculative execution and side channel vulnerabilities <https://www.mips.com/blog/mips-response-on-speculative-execution-and-side-channel-vulnerabilities/>`_.
684
685Academic papers:
686
687.. _spec_ref11:
688
689[11] `Spectre Attacks: Exploiting Speculative Execution <https://spectreattack.com/spectre.pdf>`_.
690
691.. _spec_ref12:
692
693[12] `NetSpectre: Read Arbitrary Memory over Network <https://arxiv.org/abs/1807.10535>`_.
694
695.. _spec_ref13:
696
697[13] `Spectre Returns! Speculation Attacks using the Return Stack Buffer <https://www.usenix.org/system/files/conference/woot18/woot18-paper-koruyeh.pdf>`_.
diff --git a/Documentation/admin-guide/index.rst b/Documentation/admin-guide/index.rst
index 8001917ee012..24fbe0568eff 100644
--- a/Documentation/admin-guide/index.rst
+++ b/Documentation/admin-guide/index.rst
@@ -70,6 +70,7 @@ configure specific aspects of kernel behavior to your liking.
70 ras 70 ras
71 bcache 71 bcache
72 ext4 72 ext4
73 binderfs
73 pm/index 74 pm/index
74 thunderbolt 75 thunderbolt
75 LSM/index 76 LSM/index
diff --git a/Documentation/admin-guide/kernel-parameters.rst b/Documentation/admin-guide/kernel-parameters.rst
index 0124980dca2d..5d29ba5ad88c 100644
--- a/Documentation/admin-guide/kernel-parameters.rst
+++ b/Documentation/admin-guide/kernel-parameters.rst
@@ -9,11 +9,11 @@ and sorted into English Dictionary order (defined as ignoring all
9punctuation and sorting digits before letters in a case insensitive 9punctuation and sorting digits before letters in a case insensitive
10manner), and with descriptions where known. 10manner), and with descriptions where known.
11 11
12The kernel parses parameters from the kernel command line up to "--"; 12The kernel parses parameters from the kernel command line up to "``--``";
13if it doesn't recognize a parameter and it doesn't contain a '.', the 13if it doesn't recognize a parameter and it doesn't contain a '.', the
14parameter gets passed to init: parameters with '=' go into init's 14parameter gets passed to init: parameters with '=' go into init's
15environment, others are passed as command line arguments to init. 15environment, others are passed as command line arguments to init.
16Everything after "--" is passed as an argument to init. 16Everything after "``--``" is passed as an argument to init.
17 17
18Module parameters can be specified in two ways: via the kernel command 18Module parameters can be specified in two ways: via the kernel command
19line with a module name prefix, or via modprobe, e.g.:: 19line with a module name prefix, or via modprobe, e.g.::
@@ -167,7 +167,7 @@ parameter is applicable::
167 X86-32 X86-32, aka i386 architecture is enabled. 167 X86-32 X86-32, aka i386 architecture is enabled.
168 X86-64 X86-64 architecture is enabled. 168 X86-64 X86-64 architecture is enabled.
169 More X86-64 boot options can be found in 169 More X86-64 boot options can be found in
170 Documentation/x86/x86_64/boot-options.txt . 170 Documentation/x86/x86_64/boot-options.rst.
171 X86 Either 32-bit or 64-bit x86 (same as X86-32+X86-64) 171 X86 Either 32-bit or 64-bit x86 (same as X86-32+X86-64)
172 X86_UV SGI UV support is enabled. 172 X86_UV SGI UV support is enabled.
173 XEN Xen support is enabled 173 XEN Xen support is enabled
@@ -181,10 +181,10 @@ In addition, the following text indicates that the option::
181Parameters denoted with BOOT are actually interpreted by the boot 181Parameters denoted with BOOT are actually interpreted by the boot
182loader, and have no meaning to the kernel directly. 182loader, and have no meaning to the kernel directly.
183Do not modify the syntax of boot loader parameters without extreme 183Do not modify the syntax of boot loader parameters without extreme
184need or coordination with <Documentation/x86/boot.txt>. 184need or coordination with <Documentation/x86/boot.rst>.
185 185
186There are also arch-specific kernel-parameters not documented here. 186There are also arch-specific kernel-parameters not documented here.
187See for example <Documentation/x86/x86_64/boot-options.txt>. 187See for example <Documentation/x86/x86_64/boot-options.rst>.
188 188
189Note that ALL kernel parameters listed below are CASE SENSITIVE, and that 189Note that ALL kernel parameters listed below are CASE SENSITIVE, and that
190a trailing = on the name of any parameter states that that parameter will 190a trailing = on the name of any parameter states that that parameter will
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 74d28efa1c40..f1c433daef6b 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -53,7 +53,7 @@
53 ACPI_DEBUG_PRINT statements, e.g., 53 ACPI_DEBUG_PRINT statements, e.g.,
54 ACPI_DEBUG_PRINT((ACPI_DB_INFO, ... 54 ACPI_DEBUG_PRINT((ACPI_DB_INFO, ...
55 The debug_level mask defaults to "info". See 55 The debug_level mask defaults to "info". See
56 Documentation/acpi/debug.txt for more information about 56 Documentation/firmware-guide/acpi/debug.rst for more information about
57 debug layers and levels. 57 debug layers and levels.
58 58
59 Enable processor driver info messages: 59 Enable processor driver info messages:
@@ -708,14 +708,14 @@
708 [KNL, x86_64] select a region under 4G first, and 708 [KNL, x86_64] select a region under 4G first, and
709 fall back to reserve region above 4G when '@offset' 709 fall back to reserve region above 4G when '@offset'
710 hasn't been specified. 710 hasn't been specified.
711 See Documentation/kdump/kdump.txt for further details. 711 See Documentation/kdump/kdump.rst for further details.
712 712
713 crashkernel=range1:size1[,range2:size2,...][@offset] 713 crashkernel=range1:size1[,range2:size2,...][@offset]
714 [KNL] Same as above, but depends on the memory 714 [KNL] Same as above, but depends on the memory
715 in the running system. The syntax of range is 715 in the running system. The syntax of range is
716 start-[end] where start and end are both 716 start-[end] where start and end are both
717 a memory unit (amount[KMG]). See also 717 a memory unit (amount[KMG]). See also
718 Documentation/kdump/kdump.txt for an example. 718 Documentation/kdump/kdump.rst for an example.
719 719
720 crashkernel=size[KMG],high 720 crashkernel=size[KMG],high
721 [KNL, x86_64] range could be above 4G. Allow kernel 721 [KNL, x86_64] range could be above 4G. Allow kernel
@@ -932,7 +932,7 @@
932 edid/1680x1050.bin, or edid/1920x1080.bin is given 932 edid/1680x1050.bin, or edid/1920x1080.bin is given
933 and no file with the same name exists. Details and 933 and no file with the same name exists. Details and
934 instructions how to build your own EDID data are 934 instructions how to build your own EDID data are
935 available in Documentation/EDID/HOWTO.txt. An EDID 935 available in Documentation/EDID/howto.rst. An EDID
936 data set will only be used for a particular connector, 936 data set will only be used for a particular connector,
937 if its name and a colon are prepended to the EDID 937 if its name and a colon are prepended to the EDID
938 name. Each connector may use a unique EDID data 938 name. Each connector may use a unique EDID data
@@ -963,7 +963,7 @@
963 for details. 963 for details.
964 964
965 nompx [X86] Disables Intel Memory Protection Extensions. 965 nompx [X86] Disables Intel Memory Protection Extensions.
966 See Documentation/x86/intel_mpx.txt for more 966 See Documentation/x86/intel_mpx.rst for more
967 information about the feature. 967 information about the feature.
968 968
969 nopku [X86] Disable Memory Protection Keys CPU feature found 969 nopku [X86] Disable Memory Protection Keys CPU feature found
@@ -1189,7 +1189,7 @@
1189 that is to be dynamically loaded by Linux. If there are 1189 that is to be dynamically loaded by Linux. If there are
1190 multiple variables with the same name but with different 1190 multiple variables with the same name but with different
1191 vendor GUIDs, all of them will be loaded. See 1191 vendor GUIDs, all of them will be loaded. See
1192 Documentation/acpi/ssdt-overlays.txt for details. 1192 Documentation/admin-guide/acpi/ssdt-overlays.rst for details.
1193 1193
1194 1194
1195 eisa_irq_edge= [PARISC,HW] 1195 eisa_irq_edge= [PARISC,HW]
@@ -1209,7 +1209,7 @@
1209 Specifies physical address of start of kernel core 1209 Specifies physical address of start of kernel core
1210 image elf header and optionally the size. Generally 1210 image elf header and optionally the size. Generally
1211 kexec loader will pass this option to capture kernel. 1211 kexec loader will pass this option to capture kernel.
1212 See Documentation/kdump/kdump.txt for details. 1212 See Documentation/kdump/kdump.rst for details.
1213 1213
1214 enable_mtrr_cleanup [X86] 1214 enable_mtrr_cleanup [X86]
1215 The kernel tries to adjust MTRR layout from continuous 1215 The kernel tries to adjust MTRR layout from continuous
@@ -1388,9 +1388,6 @@
1388 Valid parameters: "on", "off" 1388 Valid parameters: "on", "off"
1389 Default: "on" 1389 Default: "on"
1390 1390
1391 hisax= [HW,ISDN]
1392 See Documentation/isdn/README.HiSax.
1393
1394 hlt [BUGS=ARM,SH] 1391 hlt [BUGS=ARM,SH]
1395 1392
1396 hpet= [X86-32,HPET] option to control HPET usage 1393 hpet= [X86-32,HPET] option to control HPET usage
@@ -1507,7 +1504,7 @@
1507 Format: =0.0 to prevent dma on hda, =0.1 hdb =1.0 hdc 1504 Format: =0.0 to prevent dma on hda, =0.1 hdb =1.0 hdc
1508 .vlb_clock .pci_clock .noflush .nohpa .noprobe .nowerr 1505 .vlb_clock .pci_clock .noflush .nohpa .noprobe .nowerr
1509 .cdrom .chs .ignore_cable are additional options 1506 .cdrom .chs .ignore_cable are additional options
1510 See Documentation/ide/ide.txt. 1507 See Documentation/ide/ide.rst.
1511 1508
1512 ide-generic.probe-mask= [HW] (E)IDE subsystem 1509 ide-generic.probe-mask= [HW] (E)IDE subsystem
1513 Format: <int> 1510 Format: <int>
@@ -2383,7 +2380,7 @@
2383 2380
2384 mce [X86-32] Machine Check Exception 2381 mce [X86-32] Machine Check Exception
2385 2382
2386 mce=option [X86-64] See Documentation/x86/x86_64/boot-options.txt 2383 mce=option [X86-64] See Documentation/x86/x86_64/boot-options.rst
2387 2384
2388 md= [HW] RAID subsystems devices and level 2385 md= [HW] RAID subsystems devices and level
2389 See Documentation/admin-guide/md.rst. 2386 See Documentation/admin-guide/md.rst.
@@ -2439,7 +2436,7 @@
2439 set according to the 2436 set according to the
2440 CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE kernel config 2437 CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE kernel config
2441 option. 2438 option.
2442 See Documentation/memory-hotplug.txt. 2439 See Documentation/admin-guide/mm/memory-hotplug.rst.
2443 2440
2444 memmap=exactmap [KNL,X86] Enable setting of an exact 2441 memmap=exactmap [KNL,X86] Enable setting of an exact
2445 E820 memory map, as specified by the user. 2442 E820 memory map, as specified by the user.
@@ -2528,7 +2525,7 @@
2528 mem_encrypt=on: Activate SME 2525 mem_encrypt=on: Activate SME
2529 mem_encrypt=off: Do not activate SME 2526 mem_encrypt=off: Do not activate SME
2530 2527
2531 Refer to Documentation/x86/amd-memory-encryption.txt 2528 Refer to Documentation/virtual/kvm/amd-memory-encryption.rst
2532 for details on when memory encryption can be activated. 2529 for details on when memory encryption can be activated.
2533 2530
2534 mem_sleep_default= [SUSPEND] Default system suspend mode: 2531 mem_sleep_default= [SUSPEND] Default system suspend mode:
@@ -2836,8 +2833,9 @@
2836 0 - turn hardlockup detector in nmi_watchdog off 2833 0 - turn hardlockup detector in nmi_watchdog off
2837 1 - turn hardlockup detector in nmi_watchdog on 2834 1 - turn hardlockup detector in nmi_watchdog on
2838 When panic is specified, panic when an NMI watchdog 2835 When panic is specified, panic when an NMI watchdog
2839 timeout occurs (or 'nopanic' to override the opposite 2836 timeout occurs (or 'nopanic' to not panic on an NMI
2840 default). To disable both hard and soft lockup detectors, 2837 watchdog, if CONFIG_BOOTPARAM_HARDLOCKUP_PANIC is set)
2838 To disable both hard and soft lockup detectors,
2841 please see 'nowatchdog'. 2839 please see 'nowatchdog'.
2842 This is useful when you use a panic=... timeout and 2840 This is useful when you use a panic=... timeout and
2843 need the box quickly up again. 2841 need the box quickly up again.
@@ -3528,7 +3526,7 @@
3528 See Documentation/blockdev/paride.txt. 3526 See Documentation/blockdev/paride.txt.
3529 3527
3530 pirq= [SMP,APIC] Manual mp-table setup 3528 pirq= [SMP,APIC] Manual mp-table setup
3531 See Documentation/x86/i386/IO-APIC.txt. 3529 See Documentation/x86/i386/IO-APIC.rst.
3532 3530
3533 plip= [PPT,NET] Parallel port network link 3531 plip= [PPT,NET] Parallel port network link
3534 Format: { parport<nr> | timid | 0 } 3532 Format: { parport<nr> | timid | 0 }
@@ -5032,7 +5030,7 @@
5032 vector=percpu: enable percpu vector domain 5030 vector=percpu: enable percpu vector domain
5033 5031
5034 video= [FB] Frame buffer configuration 5032 video= [FB] Frame buffer configuration
5035 See Documentation/fb/modedb.txt. 5033 See Documentation/fb/modedb.rst.
5036 5034
5037 video.brightness_switch_enabled= [0,1] 5035 video.brightness_switch_enabled= [0,1]
5038 If set to 1, on receiving an ACPI notify event 5036 If set to 1, on receiving an ACPI notify event
@@ -5060,7 +5058,7 @@
5060 Can be used multiple times for multiple devices. 5058 Can be used multiple times for multiple devices.
5061 5059
5062 vga= [BOOT,X86-32] Select a particular video mode 5060 vga= [BOOT,X86-32] Select a particular video mode
5063 See Documentation/x86/boot.txt and 5061 See Documentation/x86/boot.rst and
5064 Documentation/svga.txt. 5062 Documentation/svga.txt.
5065 Use vga=ask for menu. 5063 Use vga=ask for menu.
5066 This is actually a boot loader parameter; the value is 5064 This is actually a boot loader parameter; the value is
@@ -5167,7 +5165,7 @@
5167 Default: 3 = cyan. 5165 Default: 3 = cyan.
5168 5166
5169 watchdog timers [HW,WDT] For information on watchdog timers, 5167 watchdog timers [HW,WDT] For information on watchdog timers,
5170 see Documentation/watchdog/watchdog-parameters.txt 5168 see Documentation/watchdog/watchdog-parameters.rst
5171 or other driver-specific files in the 5169 or other driver-specific files in the
5172 Documentation/watchdog/ directory. 5170 Documentation/watchdog/ directory.
5173 5171
diff --git a/Documentation/admin-guide/mm/numaperf.rst b/Documentation/admin-guide/mm/numaperf.rst
index c067ed145158..a80c3c37226e 100644
--- a/Documentation/admin-guide/mm/numaperf.rst
+++ b/Documentation/admin-guide/mm/numaperf.rst
@@ -165,5 +165,6 @@ write-through caching.
165======== 165========
166See Also 166See Also
167======== 167========
168.. [1] https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf 168
169 Section 5.2.27 169[1] https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf
170- Section 5.2.27
diff --git a/Documentation/admin-guide/ras.rst b/Documentation/admin-guide/ras.rst
index c7495e42e6f4..2b20f5f7380d 100644
--- a/Documentation/admin-guide/ras.rst
+++ b/Documentation/admin-guide/ras.rst
@@ -199,7 +199,7 @@ Architecture (MCA)\ [#f3]_.
199 mode). 199 mode).
200 200
201.. [#f3] For more details about the Machine Check Architecture (MCA), 201.. [#f3] For more details about the Machine Check Architecture (MCA),
202 please read Documentation/x86/x86_64/machinecheck at the Kernel tree. 202 please read Documentation/x86/x86_64/machinecheck.rst at the Kernel tree.
203 203
204EDAC - Error Detection And Correction 204EDAC - Error Detection And Correction
205************************************* 205*************************************
diff --git a/Documentation/aoe/aoe.txt b/Documentation/aoe/aoe.rst
index c71487d399d1..58747ecec71d 100644
--- a/Documentation/aoe/aoe.txt
+++ b/Documentation/aoe/aoe.rst
@@ -1,3 +1,6 @@
1Introduction
2============
3
1ATA over Ethernet is a network protocol that provides simple access to 4ATA over Ethernet is a network protocol that provides simple access to
2block storage on the LAN. 5block storage on the LAN.
3 6
@@ -22,7 +25,8 @@ document the use of the driver and are not necessary if you install
22the aoetools. 25the aoetools.
23 26
24 27
25CREATING DEVICE NODES 28Creating Device Nodes
29=====================
26 30
27 Users of udev should find the block device nodes created 31 Users of udev should find the block device nodes created
28 automatically, but to create all the necessary device nodes, use the 32 automatically, but to create all the necessary device nodes, use the
@@ -38,7 +42,8 @@ CREATING DEVICE NODES
38 confusing when an AoE device is not present the first time the a 42 confusing when an AoE device is not present the first time the a
39 command is run but appears a second later. 43 command is run but appears a second later.
40 44
41USING DEVICE NODES 45Using Device Nodes
46==================
42 47
43 "cat /dev/etherd/err" blocks, waiting for error diagnostic output, 48 "cat /dev/etherd/err" blocks, waiting for error diagnostic output,
44 like any retransmitted packets. 49 like any retransmitted packets.
@@ -55,7 +60,7 @@ USING DEVICE NODES
55 by sysfs counterparts. Using the commands in aoetools insulates 60 by sysfs counterparts. Using the commands in aoetools insulates
56 users from these implementation details. 61 users from these implementation details.
57 62
58 The block devices are named like this: 63 The block devices are named like this::
59 64
60 e{shelf}.{slot} 65 e{shelf}.{slot}
61 e{shelf}.{slot}p{part} 66 e{shelf}.{slot}p{part}
@@ -64,7 +69,8 @@ USING DEVICE NODES
64 first shelf (shelf address zero). That's the whole disk. The first 69 first shelf (shelf address zero). That's the whole disk. The first
65 partition on that disk would be "e0.2p1". 70 partition on that disk would be "e0.2p1".
66 71
67USING SYSFS 72Using sysfs
73===========
68 74
69 Each aoe block device in /sys/block has the extra attributes of 75 Each aoe block device in /sys/block has the extra attributes of
70 state, mac, and netif. The state attribute is "up" when the device 76 state, mac, and netif. The state attribute is "up" when the device
@@ -78,29 +84,29 @@ USING SYSFS
78 84
79 There is a script in this directory that formats this information in 85 There is a script in this directory that formats this information in
80 a convenient way. Users with aoetools should use the aoe-stat 86 a convenient way. Users with aoetools should use the aoe-stat
81 command. 87 command::
82 88
83 root@makki root# sh Documentation/aoe/status.sh 89 root@makki root# sh Documentation/aoe/status.sh
84 e10.0 eth3 up 90 e10.0 eth3 up
85 e10.1 eth3 up 91 e10.1 eth3 up
86 e10.2 eth3 up 92 e10.2 eth3 up
87 e10.3 eth3 up 93 e10.3 eth3 up
88 e10.4 eth3 up 94 e10.4 eth3 up
89 e10.5 eth3 up 95 e10.5 eth3 up
90 e10.6 eth3 up 96 e10.6 eth3 up
91 e10.7 eth3 up 97 e10.7 eth3 up
92 e10.8 eth3 up 98 e10.8 eth3 up
93 e10.9 eth3 up 99 e10.9 eth3 up
94 e4.0 eth1 up 100 e4.0 eth1 up
95 e4.1 eth1 up 101 e4.1 eth1 up
96 e4.2 eth1 up 102 e4.2 eth1 up
97 e4.3 eth1 up 103 e4.3 eth1 up
98 e4.4 eth1 up 104 e4.4 eth1 up
99 e4.5 eth1 up 105 e4.5 eth1 up
100 e4.6 eth1 up 106 e4.6 eth1 up
101 e4.7 eth1 up 107 e4.7 eth1 up
102 e4.8 eth1 up 108 e4.8 eth1 up
103 e4.9 eth1 up 109 e4.9 eth1 up
104 110
105 Use /sys/module/aoe/parameters/aoe_iflist (or better, the driver 111 Use /sys/module/aoe/parameters/aoe_iflist (or better, the driver
106 option discussed below) instead of /dev/etherd/interfaces to limit 112 option discussed below) instead of /dev/etherd/interfaces to limit
@@ -113,12 +119,13 @@ USING SYSFS
113 for this purpose. You can also directly use the 119 for this purpose. You can also directly use the
114 /dev/etherd/discover special file described above. 120 /dev/etherd/discover special file described above.
115 121
116DRIVER OPTIONS 122Driver Options
123==============
117 124
118 There is a boot option for the built-in aoe driver and a 125 There is a boot option for the built-in aoe driver and a
119 corresponding module parameter, aoe_iflist. Without this option, 126 corresponding module parameter, aoe_iflist. Without this option,
120 all network interfaces may be used for ATA over Ethernet. Here is a 127 all network interfaces may be used for ATA over Ethernet. Here is a
121 usage example for the module parameter. 128 usage example for the module parameter::
122 129
123 modprobe aoe_iflist="eth1 eth3" 130 modprobe aoe_iflist="eth1 eth3"
124 131
diff --git a/Documentation/aoe/examples.rst b/Documentation/aoe/examples.rst
new file mode 100644
index 000000000000..91f3198e52c1
--- /dev/null
+++ b/Documentation/aoe/examples.rst
@@ -0,0 +1,23 @@
1Example of udev rules
2---------------------
3
4 .. include:: udev.txt
5 :literal:
6
7Example of udev install rules script
8------------------------------------
9
10 .. literalinclude:: udev-install.sh
11 :language: shell
12
13Example script to get status
14----------------------------
15
16 .. literalinclude:: status.sh
17 :language: shell
18
19Example of AoE autoload script
20------------------------------
21
22 .. literalinclude:: autoload.sh
23 :language: shell
diff --git a/Documentation/aoe/index.rst b/Documentation/aoe/index.rst
new file mode 100644
index 000000000000..4394b9b7913c
--- /dev/null
+++ b/Documentation/aoe/index.rst
@@ -0,0 +1,19 @@
1:orphan:
2
3=======================
4ATA over Ethernet (AoE)
5=======================
6
7.. toctree::
8 :maxdepth: 1
9
10 aoe
11 todo
12 examples
13
14.. only:: subproject and html
15
16 Indices
17 =======
18
19 * :ref:`genindex`
diff --git a/Documentation/aoe/todo.txt b/Documentation/aoe/todo.rst
index c09dfad4aed8..dea8db5a33e1 100644
--- a/Documentation/aoe/todo.txt
+++ b/Documentation/aoe/todo.rst
@@ -1,3 +1,6 @@
1TODO
2====
3
1There is a potential for deadlock when allocating a struct sk_buff for 4There is a potential for deadlock when allocating a struct sk_buff for
2data that needs to be written out to aoe storage. If the data is 5data that needs to be written out to aoe storage. If the data is
3being written from a dirty page in order to free that page, and if 6being written from a dirty page in order to free that page, and if
diff --git a/Documentation/aoe/udev.txt b/Documentation/aoe/udev.txt
index 1f06daf03f5b..54feda5a0772 100644
--- a/Documentation/aoe/udev.txt
+++ b/Documentation/aoe/udev.txt
@@ -11,7 +11,7 @@
11# udev_rules="/etc/udev/rules.d/" 11# udev_rules="/etc/udev/rules.d/"
12# bash# ls /etc/udev/rules.d/ 12# bash# ls /etc/udev/rules.d/
13# 10-wacom.rules 50-udev.rules 13# 10-wacom.rules 50-udev.rules
14# bash# cp /path/to/linux-2.6.xx/Documentation/aoe/udev.txt \ 14# bash# cp /path/to/linux/Documentation/aoe/udev.txt \
15# /etc/udev/rules.d/60-aoe.rules 15# /etc/udev/rules.d/60-aoe.rules
16# 16#
17 17
diff --git a/Documentation/arm/mem_alignment b/Documentation/arm/mem_alignment
index 6335fcacbba9..e110e2781039 100644
--- a/Documentation/arm/mem_alignment
+++ b/Documentation/arm/mem_alignment
@@ -1,4 +1,4 @@
1Too many problems poped up because of unnoticed misaligned memory access in 1Too many problems popped up because of unnoticed misaligned memory access in
2kernel code lately. Therefore the alignment fixup is now unconditionally 2kernel code lately. Therefore the alignment fixup is now unconditionally
3configured in for SA11x0 based targets. According to Alan Cox, this is a 3configured in for SA11x0 based targets. According to Alan Cox, this is a
4bad idea to configure it out, but Russell King has some good reasons for 4bad idea to configure it out, but Russell King has some good reasons for
diff --git a/Documentation/arm/stm32/overview.rst b/Documentation/arm/stm32/overview.rst
index 85cfc8410798..f7e734153860 100644
--- a/Documentation/arm/stm32/overview.rst
+++ b/Documentation/arm/stm32/overview.rst
@@ -1,3 +1,5 @@
1:orphan:
2
1======================== 3========================
2STM32 ARM Linux Overview 4STM32 ARM Linux Overview
3======================== 5========================
diff --git a/Documentation/arm/stm32/stm32f429-overview.rst b/Documentation/arm/stm32/stm32f429-overview.rst
index 18feda97f483..65bbb1c3b423 100644
--- a/Documentation/arm/stm32/stm32f429-overview.rst
+++ b/Documentation/arm/stm32/stm32f429-overview.rst
@@ -1,3 +1,5 @@
1:orphan:
2
1STM32F429 Overview 3STM32F429 Overview
2================== 4==================
3 5
diff --git a/Documentation/arm/stm32/stm32f746-overview.rst b/Documentation/arm/stm32/stm32f746-overview.rst
index b5f4b6ce7656..42d593085015 100644
--- a/Documentation/arm/stm32/stm32f746-overview.rst
+++ b/Documentation/arm/stm32/stm32f746-overview.rst
@@ -1,3 +1,5 @@
1:orphan:
2
1STM32F746 Overview 3STM32F746 Overview
2================== 4==================
3 5
diff --git a/Documentation/arm/stm32/stm32f769-overview.rst b/Documentation/arm/stm32/stm32f769-overview.rst
index 228656ced2fe..f6adac862b17 100644
--- a/Documentation/arm/stm32/stm32f769-overview.rst
+++ b/Documentation/arm/stm32/stm32f769-overview.rst
@@ -1,3 +1,5 @@
1:orphan:
2
1STM32F769 Overview 3STM32F769 Overview
2================== 4==================
3 5
diff --git a/Documentation/arm/stm32/stm32h743-overview.rst b/Documentation/arm/stm32/stm32h743-overview.rst
index 3458dc00095d..c525835e7473 100644
--- a/Documentation/arm/stm32/stm32h743-overview.rst
+++ b/Documentation/arm/stm32/stm32h743-overview.rst
@@ -1,3 +1,5 @@
1:orphan:
2
1STM32H743 Overview 3STM32H743 Overview
2================== 4==================
3 5
diff --git a/Documentation/arm/stm32/stm32mp157-overview.rst b/Documentation/arm/stm32/stm32mp157-overview.rst
index 62e176d47ca7..2c52cd020601 100644
--- a/Documentation/arm/stm32/stm32mp157-overview.rst
+++ b/Documentation/arm/stm32/stm32mp157-overview.rst
@@ -1,3 +1,5 @@
1:orphan:
2
1STM32MP157 Overview 3STM32MP157 Overview
2=================== 4===================
3 5
diff --git a/Documentation/arm64/acpi_object_usage.txt b/Documentation/arm64/acpi_object_usage.rst
index c77010c5c1f0..d51b69dc624d 100644
--- a/Documentation/arm64/acpi_object_usage.txt
+++ b/Documentation/arm64/acpi_object_usage.rst
@@ -1,5 +1,7 @@
1===========
1ACPI Tables 2ACPI Tables
2----------- 3===========
4
3The expectations of individual ACPI tables are discussed in the list that 5The expectations of individual ACPI tables are discussed in the list that
4follows. 6follows.
5 7
@@ -11,54 +13,71 @@ outside of the UEFI Forum (see Section 5.2.6 of the specification).
11 13
12For ACPI on arm64, tables also fall into the following categories: 14For ACPI on arm64, tables also fall into the following categories:
13 15
14 -- Required: DSDT, FADT, GTDT, MADT, MCFG, RSDP, SPCR, XSDT 16 - Required: DSDT, FADT, GTDT, MADT, MCFG, RSDP, SPCR, XSDT
15 17
16 -- Recommended: BERT, EINJ, ERST, HEST, PCCT, SSDT 18 - Recommended: BERT, EINJ, ERST, HEST, PCCT, SSDT
17 19
18 -- Optional: BGRT, CPEP, CSRT, DBG2, DRTM, ECDT, FACS, FPDT, IORT, 20 - Optional: BGRT, CPEP, CSRT, DBG2, DRTM, ECDT, FACS, FPDT, IORT,
19 MCHI, MPST, MSCT, NFIT, PMTT, RASF, SBST, SLIT, SPMI, SRAT, STAO, 21 MCHI, MPST, MSCT, NFIT, PMTT, RASF, SBST, SLIT, SPMI, SRAT, STAO,
20 TCPA, TPM2, UEFI, XENV 22 TCPA, TPM2, UEFI, XENV
21 23
22 -- Not supported: BOOT, DBGP, DMAR, ETDT, HPET, IBFT, IVRS, LPIT, 24 - Not supported: BOOT, DBGP, DMAR, ETDT, HPET, IBFT, IVRS, LPIT,
23 MSDM, OEMx, PSDT, RSDT, SLIC, WAET, WDAT, WDRT, WPBT 25 MSDM, OEMx, PSDT, RSDT, SLIC, WAET, WDAT, WDRT, WPBT
24 26
27====== ========================================================================
25Table Usage for ARMv8 Linux 28Table Usage for ARMv8 Linux
26----- ---------------------------------------------------------------- 29====== ========================================================================
27BERT Section 18.3 (signature == "BERT") 30BERT Section 18.3 (signature == "BERT")
28 == Boot Error Record Table == 31
32 **Boot Error Record Table**
33
29 Must be supplied if RAS support is provided by the platform. It 34 Must be supplied if RAS support is provided by the platform. It
30 is recommended this table be supplied. 35 is recommended this table be supplied.
31 36
32BOOT Signature Reserved (signature == "BOOT") 37BOOT Signature Reserved (signature == "BOOT")
33 == simple BOOT flag table == 38
39 **simple BOOT flag table**
40
34 Microsoft only table, will not be supported. 41 Microsoft only table, will not be supported.
35 42
36BGRT Section 5.2.22 (signature == "BGRT") 43BGRT Section 5.2.22 (signature == "BGRT")
37 == Boot Graphics Resource Table == 44
45 **Boot Graphics Resource Table**
46
38 Optional, not currently supported, with no real use-case for an 47 Optional, not currently supported, with no real use-case for an
39 ARM server. 48 ARM server.
40 49
41CPEP Section 5.2.18 (signature == "CPEP") 50CPEP Section 5.2.18 (signature == "CPEP")
42 == Corrected Platform Error Polling table == 51
52 **Corrected Platform Error Polling table**
53
43 Optional, not currently supported, and not recommended until such 54 Optional, not currently supported, and not recommended until such
44 time as ARM-compatible hardware is available, and the specification 55 time as ARM-compatible hardware is available, and the specification
45 suitably modified. 56 suitably modified.
46 57
47CSRT Signature Reserved (signature == "CSRT") 58CSRT Signature Reserved (signature == "CSRT")
48 == Core System Resources Table == 59
60 **Core System Resources Table**
61
49 Optional, not currently supported. 62 Optional, not currently supported.
50 63
51DBG2 Signature Reserved (signature == "DBG2") 64DBG2 Signature Reserved (signature == "DBG2")
52 == DeBuG port table 2 == 65
66 **DeBuG port table 2**
67
53 License has changed and should be usable. Optional if used instead 68 License has changed and should be usable. Optional if used instead
54 of earlycon=<device> on the command line. 69 of earlycon=<device> on the command line.
55 70
56DBGP Signature Reserved (signature == "DBGP") 71DBGP Signature Reserved (signature == "DBGP")
57 == DeBuG Port table == 72
73 **DeBuG Port table**
74
58 Microsoft only table, will not be supported. 75 Microsoft only table, will not be supported.
59 76
60DSDT Section 5.2.11.1 (signature == "DSDT") 77DSDT Section 5.2.11.1 (signature == "DSDT")
61 == Differentiated System Description Table == 78
79 **Differentiated System Description Table**
80
62 A DSDT is required; see also SSDT. 81 A DSDT is required; see also SSDT.
63 82
64 ACPI tables contain only one DSDT but can contain one or more SSDTs, 83 ACPI tables contain only one DSDT but can contain one or more SSDTs,
@@ -66,22 +85,30 @@ DSDT Section 5.2.11.1 (signature == "DSDT")
66 but cannot modify or replace anything in the DSDT. 85 but cannot modify or replace anything in the DSDT.
67 86
68DMAR Signature Reserved (signature == "DMAR") 87DMAR Signature Reserved (signature == "DMAR")
69 == DMA Remapping table == 88
89 **DMA Remapping table**
90
70 x86 only table, will not be supported. 91 x86 only table, will not be supported.
71 92
72DRTM Signature Reserved (signature == "DRTM") 93DRTM Signature Reserved (signature == "DRTM")
73 == Dynamic Root of Trust for Measurement table == 94
95 **Dynamic Root of Trust for Measurement table**
96
74 Optional, not currently supported. 97 Optional, not currently supported.
75 98
76ECDT Section 5.2.16 (signature == "ECDT") 99ECDT Section 5.2.16 (signature == "ECDT")
77 == Embedded Controller Description Table == 100
101 **Embedded Controller Description Table**
102
78 Optional, not currently supported, but could be used on ARM if and 103 Optional, not currently supported, but could be used on ARM if and
79 only if one uses the GPE_BIT field to represent an IRQ number, since 104 only if one uses the GPE_BIT field to represent an IRQ number, since
80 there are no GPE blocks defined in hardware reduced mode. This would 105 there are no GPE blocks defined in hardware reduced mode. This would
81 need to be modified in the ACPI specification. 106 need to be modified in the ACPI specification.
82 107
83EINJ Section 18.6 (signature == "EINJ") 108EINJ Section 18.6 (signature == "EINJ")
84 == Error Injection table == 109
110 **Error Injection table**
111
85 This table is very useful for testing platform response to error 112 This table is very useful for testing platform response to error
86 conditions; it allows one to inject an error into the system as 113 conditions; it allows one to inject an error into the system as
87 if it had actually occurred. However, this table should not be 114 if it had actually occurred. However, this table should not be
@@ -89,27 +116,35 @@ EINJ Section 18.6 (signature == "EINJ")
89 and executed with the ACPICA tools only during testing. 116 and executed with the ACPICA tools only during testing.
90 117
91ERST Section 18.5 (signature == "ERST") 118ERST Section 18.5 (signature == "ERST")
92 == Error Record Serialization Table == 119
120 **Error Record Serialization Table**
121
93 On a platform supports RAS, this table must be supplied if it is not 122 On a platform supports RAS, this table must be supplied if it is not
94 UEFI-based; if it is UEFI-based, this table may be supplied. When this 123 UEFI-based; if it is UEFI-based, this table may be supplied. When this
95 table is not present, UEFI run time service will be utilized to save 124 table is not present, UEFI run time service will be utilized to save
96 and retrieve hardware error information to and from a persistent store. 125 and retrieve hardware error information to and from a persistent store.
97 126
98ETDT Signature Reserved (signature == "ETDT") 127ETDT Signature Reserved (signature == "ETDT")
99 == Event Timer Description Table == 128
129 **Event Timer Description Table**
130
100 Obsolete table, will not be supported. 131 Obsolete table, will not be supported.
101 132
102FACS Section 5.2.10 (signature == "FACS") 133FACS Section 5.2.10 (signature == "FACS")
103 == Firmware ACPI Control Structure == 134
135 **Firmware ACPI Control Structure**
136
104 It is unlikely that this table will be terribly useful. If it is 137 It is unlikely that this table will be terribly useful. If it is
105 provided, the Global Lock will NOT be used since it is not part of 138 provided, the Global Lock will NOT be used since it is not part of
106 the hardware reduced profile, and only 64-bit address fields will 139 the hardware reduced profile, and only 64-bit address fields will
107 be considered valid. 140 be considered valid.
108 141
109FADT Section 5.2.9 (signature == "FACP") 142FADT Section 5.2.9 (signature == "FACP")
110 == Fixed ACPI Description Table == 143
144 **Fixed ACPI Description Table**
111 Required for arm64. 145 Required for arm64.
112 146
147
113 The HW_REDUCED_ACPI flag must be set. All of the fields that are 148 The HW_REDUCED_ACPI flag must be set. All of the fields that are
114 to be ignored when HW_REDUCED_ACPI is set are expected to be set to 149 to be ignored when HW_REDUCED_ACPI is set are expected to be set to
115 zero. 150 zero.
@@ -118,22 +153,28 @@ FADT Section 5.2.9 (signature == "FACP")
118 used, not FIRMWARE_CTRL. 153 used, not FIRMWARE_CTRL.
119 154
120 If PSCI is used (as is recommended), make sure that ARM_BOOT_ARCH is 155 If PSCI is used (as is recommended), make sure that ARM_BOOT_ARCH is
121 filled in properly -- that the PSCI_COMPLIANT flag is set and that 156 filled in properly - that the PSCI_COMPLIANT flag is set and that
122 PSCI_USE_HVC is set or unset as needed (see table 5-37). 157 PSCI_USE_HVC is set or unset as needed (see table 5-37).
123 158
124 For the DSDT that is also required, the X_DSDT field is to be used, 159 For the DSDT that is also required, the X_DSDT field is to be used,
125 not the DSDT field. 160 not the DSDT field.
126 161
127FPDT Section 5.2.23 (signature == "FPDT") 162FPDT Section 5.2.23 (signature == "FPDT")
128 == Firmware Performance Data Table == 163
164 **Firmware Performance Data Table**
165
129 Optional, not currently supported. 166 Optional, not currently supported.
130 167
131GTDT Section 5.2.24 (signature == "GTDT") 168GTDT Section 5.2.24 (signature == "GTDT")
132 == Generic Timer Description Table == 169
170 **Generic Timer Description Table**
171
133 Required for arm64. 172 Required for arm64.
134 173
135HEST Section 18.3.2 (signature == "HEST") 174HEST Section 18.3.2 (signature == "HEST")
136 == Hardware Error Source Table == 175
176 **Hardware Error Source Table**
177
137 ARM-specific error sources have been defined; please use those or the 178 ARM-specific error sources have been defined; please use those or the
138 PCI types such as type 6 (AER Root Port), 7 (AER Endpoint), or 8 (AER 179 PCI types such as type 6 (AER Root Port), 7 (AER Endpoint), or 8 (AER
139 Bridge), or use type 9 (Generic Hardware Error Source). Firmware first 180 Bridge), or use type 9 (Generic Hardware Error Source). Firmware first
@@ -144,122 +185,174 @@ HEST Section 18.3.2 (signature == "HEST")
144 is recommended this table be supplied. 185 is recommended this table be supplied.
145 186
146HPET Signature Reserved (signature == "HPET") 187HPET Signature Reserved (signature == "HPET")
147 == High Precision Event timer Table == 188
189 **High Precision Event timer Table**
190
148 x86 only table, will not be supported. 191 x86 only table, will not be supported.
149 192
150IBFT Signature Reserved (signature == "IBFT") 193IBFT Signature Reserved (signature == "IBFT")
151 == iSCSI Boot Firmware Table == 194
195 **iSCSI Boot Firmware Table**
196
152 Microsoft defined table, support TBD. 197 Microsoft defined table, support TBD.
153 198
154IORT Signature Reserved (signature == "IORT") 199IORT Signature Reserved (signature == "IORT")
155 == Input Output Remapping Table == 200
201 **Input Output Remapping Table**
202
156 arm64 only table, required in order to describe IO topology, SMMUs, 203 arm64 only table, required in order to describe IO topology, SMMUs,
157 and GIC ITSs, and how those various components are connected together, 204 and GIC ITSs, and how those various components are connected together,
158 such as identifying which components are behind which SMMUs/ITSs. 205 such as identifying which components are behind which SMMUs/ITSs.
159 This table will only be required on certain SBSA platforms (e.g., 206 This table will only be required on certain SBSA platforms (e.g.,
160 when using GICv3-ITS and an SMMU); on SBSA Level 0 platforms, it 207 when using GICv3-ITS and an SMMU); on SBSA Level 0 platforms, it
161 remains optional. 208 remains optional.
162 209
163IVRS Signature Reserved (signature == "IVRS") 210IVRS Signature Reserved (signature == "IVRS")
164 == I/O Virtualization Reporting Structure == 211
212 **I/O Virtualization Reporting Structure**
213
165 x86_64 (AMD) only table, will not be supported. 214 x86_64 (AMD) only table, will not be supported.
166 215
167LPIT Signature Reserved (signature == "LPIT") 216LPIT Signature Reserved (signature == "LPIT")
168 == Low Power Idle Table == 217
218 **Low Power Idle Table**
219
169 x86 only table as of ACPI 5.1; starting with ACPI 6.0, processor 220 x86 only table as of ACPI 5.1; starting with ACPI 6.0, processor
170 descriptions and power states on ARM platforms should use the DSDT 221 descriptions and power states on ARM platforms should use the DSDT
171 and define processor container devices (_HID ACPI0010, Section 8.4, 222 and define processor container devices (_HID ACPI0010, Section 8.4,
172 and more specifically 8.4.3 and and 8.4.4). 223 and more specifically 8.4.3 and and 8.4.4).
173 224
174MADT Section 5.2.12 (signature == "APIC") 225MADT Section 5.2.12 (signature == "APIC")
175 == Multiple APIC Description Table == 226
227 **Multiple APIC Description Table**
228
176 Required for arm64. Only the GIC interrupt controller structures 229 Required for arm64. Only the GIC interrupt controller structures
177 should be used (types 0xA - 0xF). 230 should be used (types 0xA - 0xF).
178 231
179MCFG Signature Reserved (signature == "MCFG") 232MCFG Signature Reserved (signature == "MCFG")
180 == Memory-mapped ConFiGuration space == 233
234 **Memory-mapped ConFiGuration space**
235
181 If the platform supports PCI/PCIe, an MCFG table is required. 236 If the platform supports PCI/PCIe, an MCFG table is required.
182 237
183MCHI Signature Reserved (signature == "MCHI") 238MCHI Signature Reserved (signature == "MCHI")
184 == Management Controller Host Interface table == 239
240 **Management Controller Host Interface table**
241
185 Optional, not currently supported. 242 Optional, not currently supported.
186 243
187MPST Section 5.2.21 (signature == "MPST") 244MPST Section 5.2.21 (signature == "MPST")
188 == Memory Power State Table == 245
246 **Memory Power State Table**
247
189 Optional, not currently supported. 248 Optional, not currently supported.
190 249
191MSCT Section 5.2.19 (signature == "MSCT") 250MSCT Section 5.2.19 (signature == "MSCT")
192 == Maximum System Characteristic Table == 251
252 **Maximum System Characteristic Table**
253
193 Optional, not currently supported. 254 Optional, not currently supported.
194 255
195MSDM Signature Reserved (signature == "MSDM") 256MSDM Signature Reserved (signature == "MSDM")
196 == Microsoft Data Management table == 257
258 **Microsoft Data Management table**
259
197 Microsoft only table, will not be supported. 260 Microsoft only table, will not be supported.
198 261
199NFIT Section 5.2.25 (signature == "NFIT") 262NFIT Section 5.2.25 (signature == "NFIT")
200 == NVDIMM Firmware Interface Table == 263
264 **NVDIMM Firmware Interface Table**
265
201 Optional, not currently supported. 266 Optional, not currently supported.
202 267
203OEMx Signature of "OEMx" only 268OEMx Signature of "OEMx" only
204 == OEM Specific Tables == 269
270 **OEM Specific Tables**
271
205 All tables starting with a signature of "OEM" are reserved for OEM 272 All tables starting with a signature of "OEM" are reserved for OEM
206 use. Since these are not meant to be of general use but are limited 273 use. Since these are not meant to be of general use but are limited
207 to very specific end users, they are not recommended for use and are 274 to very specific end users, they are not recommended for use and are
208 not supported by the kernel for arm64. 275 not supported by the kernel for arm64.
209 276
210PCCT Section 14.1 (signature == "PCCT) 277PCCT Section 14.1 (signature == "PCCT)
211 == Platform Communications Channel Table == 278
279 **Platform Communications Channel Table**
280
212 Recommend for use on arm64; use of PCC is recommended when using CPPC 281 Recommend for use on arm64; use of PCC is recommended when using CPPC
213 to control performance and power for platform processors. 282 to control performance and power for platform processors.
214 283
215PMTT Section 5.2.21.12 (signature == "PMTT") 284PMTT Section 5.2.21.12 (signature == "PMTT")
216 == Platform Memory Topology Table == 285
286 **Platform Memory Topology Table**
287
217 Optional, not currently supported. 288 Optional, not currently supported.
218 289
219PSDT Section 5.2.11.3 (signature == "PSDT") 290PSDT Section 5.2.11.3 (signature == "PSDT")
220 == Persistent System Description Table == 291
292 **Persistent System Description Table**
293
221 Obsolete table, will not be supported. 294 Obsolete table, will not be supported.
222 295
223RASF Section 5.2.20 (signature == "RASF") 296RASF Section 5.2.20 (signature == "RASF")
224 == RAS Feature table == 297
298 **RAS Feature table**
299
225 Optional, not currently supported. 300 Optional, not currently supported.
226 301
227RSDP Section 5.2.5 (signature == "RSD PTR") 302RSDP Section 5.2.5 (signature == "RSD PTR")
228 == Root System Description PoinTeR == 303
304 **Root System Description PoinTeR**
305
229 Required for arm64. 306 Required for arm64.
230 307
231RSDT Section 5.2.7 (signature == "RSDT") 308RSDT Section 5.2.7 (signature == "RSDT")
232 == Root System Description Table == 309
310 **Root System Description Table**
311
233 Since this table can only provide 32-bit addresses, it is deprecated 312 Since this table can only provide 32-bit addresses, it is deprecated
234 on arm64, and will not be used. If provided, it will be ignored. 313 on arm64, and will not be used. If provided, it will be ignored.
235 314
236SBST Section 5.2.14 (signature == "SBST") 315SBST Section 5.2.14 (signature == "SBST")
237 == Smart Battery Subsystem Table == 316
317 **Smart Battery Subsystem Table**
318
238 Optional, not currently supported. 319 Optional, not currently supported.
239 320
240SLIC Signature Reserved (signature == "SLIC") 321SLIC Signature Reserved (signature == "SLIC")
241 == Software LIcensing table == 322
323 **Software LIcensing table**
324
242 Microsoft only table, will not be supported. 325 Microsoft only table, will not be supported.
243 326
244SLIT Section 5.2.17 (signature == "SLIT") 327SLIT Section 5.2.17 (signature == "SLIT")
245 == System Locality distance Information Table == 328
329 **System Locality distance Information Table**
330
246 Optional in general, but required for NUMA systems. 331 Optional in general, but required for NUMA systems.
247 332
248SPCR Signature Reserved (signature == "SPCR") 333SPCR Signature Reserved (signature == "SPCR")
249 == Serial Port Console Redirection table == 334
335 **Serial Port Console Redirection table**
336
250 Required for arm64. 337 Required for arm64.
251 338
252SPMI Signature Reserved (signature == "SPMI") 339SPMI Signature Reserved (signature == "SPMI")
253 == Server Platform Management Interface table == 340
341 **Server Platform Management Interface table**
342
254 Optional, not currently supported. 343 Optional, not currently supported.
255 344
256SRAT Section 5.2.16 (signature == "SRAT") 345SRAT Section 5.2.16 (signature == "SRAT")
257 == System Resource Affinity Table == 346
347 **System Resource Affinity Table**
348
258 Optional, but if used, only the GICC Affinity structures are read. 349 Optional, but if used, only the GICC Affinity structures are read.
259 To support arm64 NUMA, this table is required. 350 To support arm64 NUMA, this table is required.
260 351
261SSDT Section 5.2.11.2 (signature == "SSDT") 352SSDT Section 5.2.11.2 (signature == "SSDT")
262 == Secondary System Description Table == 353
354 **Secondary System Description Table**
355
263 These tables are a continuation of the DSDT; these are recommended 356 These tables are a continuation of the DSDT; these are recommended
264 for use with devices that can be added to a running system, but can 357 for use with devices that can be added to a running system, but can
265 also serve the purpose of dividing up device descriptions into more 358 also serve the purpose of dividing up device descriptions into more
@@ -272,49 +365,69 @@ SSDT Section 5.2.11.2 (signature == "SSDT")
272 one DSDT but can contain many SSDTs. 365 one DSDT but can contain many SSDTs.
273 366
274STAO Signature Reserved (signature == "STAO") 367STAO Signature Reserved (signature == "STAO")
275 == _STA Override table == 368
369 **_STA Override table**
370
276 Optional, but only necessary in virtualized environments in order to 371 Optional, but only necessary in virtualized environments in order to
277 hide devices from guest OSs. 372 hide devices from guest OSs.
278 373
279TCPA Signature Reserved (signature == "TCPA") 374TCPA Signature Reserved (signature == "TCPA")
280 == Trusted Computing Platform Alliance table == 375
376 **Trusted Computing Platform Alliance table**
377
281 Optional, not currently supported, and may need changes to fully 378 Optional, not currently supported, and may need changes to fully
282 interoperate with arm64. 379 interoperate with arm64.
283 380
284TPM2 Signature Reserved (signature == "TPM2") 381TPM2 Signature Reserved (signature == "TPM2")
285 == Trusted Platform Module 2 table == 382
383 **Trusted Platform Module 2 table**
384
286 Optional, not currently supported, and may need changes to fully 385 Optional, not currently supported, and may need changes to fully
287 interoperate with arm64. 386 interoperate with arm64.
288 387
289UEFI Signature Reserved (signature == "UEFI") 388UEFI Signature Reserved (signature == "UEFI")
290 == UEFI ACPI data table == 389
390 **UEFI ACPI data table**
391
291 Optional, not currently supported. No known use case for arm64, 392 Optional, not currently supported. No known use case for arm64,
292 at present. 393 at present.
293 394
294WAET Signature Reserved (signature == "WAET") 395WAET Signature Reserved (signature == "WAET")
295 == Windows ACPI Emulated devices Table == 396
397 **Windows ACPI Emulated devices Table**
398
296 Microsoft only table, will not be supported. 399 Microsoft only table, will not be supported.
297 400
298WDAT Signature Reserved (signature == "WDAT") 401WDAT Signature Reserved (signature == "WDAT")
299 == Watch Dog Action Table == 402
403 **Watch Dog Action Table**
404
300 Microsoft only table, will not be supported. 405 Microsoft only table, will not be supported.
301 406
302WDRT Signature Reserved (signature == "WDRT") 407WDRT Signature Reserved (signature == "WDRT")
303 == Watch Dog Resource Table == 408
409 **Watch Dog Resource Table**
410
304 Microsoft only table, will not be supported. 411 Microsoft only table, will not be supported.
305 412
306WPBT Signature Reserved (signature == "WPBT") 413WPBT Signature Reserved (signature == "WPBT")
307 == Windows Platform Binary Table == 414
415 **Windows Platform Binary Table**
416
308 Microsoft only table, will not be supported. 417 Microsoft only table, will not be supported.
309 418
310XENV Signature Reserved (signature == "XENV") 419XENV Signature Reserved (signature == "XENV")
311 == Xen project table == 420
421 **Xen project table**
422
312 Optional, used only by Xen at present. 423 Optional, used only by Xen at present.
313 424
314XSDT Section 5.2.8 (signature == "XSDT") 425XSDT Section 5.2.8 (signature == "XSDT")
315 == eXtended System Description Table ==
316 Required for arm64.
317 426
427 **eXtended System Description Table**
428
429 Required for arm64.
430====== ========================================================================
318 431
319ACPI Objects 432ACPI Objects
320------------ 433------------
@@ -323,10 +436,11 @@ shown in the list that follows; any object not explicitly mentioned below
323should be used as needed for a particular platform or particular subsystem, 436should be used as needed for a particular platform or particular subsystem,
324such as power management or PCI. 437such as power management or PCI.
325 438
439===== ================ ========================================================
326Name Section Usage for ARMv8 Linux 440Name Section Usage for ARMv8 Linux
327---- ------------ ------------------------------------------------- 441===== ================ ========================================================
328_CCA 6.2.17 This method must be defined for all bus masters 442_CCA 6.2.17 This method must be defined for all bus masters
329 on arm64 -- there are no assumptions made about 443 on arm64 - there are no assumptions made about
330 whether such devices are cache coherent or not. 444 whether such devices are cache coherent or not.
331 The _CCA value is inherited by all descendants of 445 The _CCA value is inherited by all descendants of
332 these devices so it does not need to be repeated. 446 these devices so it does not need to be repeated.
@@ -422,8 +536,8 @@ _OSC 6.2.11 This method can be a global method in ACPI (i.e.,
422 by the kernel community, then register it with the 536 by the kernel community, then register it with the
423 UEFI Forum. 537 UEFI Forum.
424 538
425\_OSI 5.7.2 Deprecated on ARM64. As far as ACPI firmware is 539\_OSI 5.7.2 Deprecated on ARM64. As far as ACPI firmware is
426 concerned, _OSI is not to be used to determine what 540 concerned, _OSI is not to be used to determine what
427 sort of system is being used or what functionality 541 sort of system is being used or what functionality
428 is provided. The _OSC method is to be used instead. 542 is provided. The _OSC method is to be used instead.
429 543
@@ -447,7 +561,7 @@ _PSx 7.3.2-5 Use as needed; power management specific. If _PS0 is
447 usage, change them in these methods. 561 usage, change them in these methods.
448 562
449_RDI 8.4.4.4 Recommended for use with processor definitions (_HID 563_RDI 8.4.4.4 Recommended for use with processor definitions (_HID
450 ACPI0010) on arm64. This should only be used in 564 ACPI0010) on arm64. This should only be used in
451 conjunction with _LPI. 565 conjunction with _LPI.
452 566
453\_REV 5.7.4 Always returns the latest version of ACPI supported. 567\_REV 5.7.4 Always returns the latest version of ACPI supported.
@@ -476,6 +590,7 @@ _SWS 7.4.3 Use as needed; power management specific; this may
476 590
477_UID 6.1.12 Recommended for distinguishing devices of the same 591_UID 6.1.12 Recommended for distinguishing devices of the same
478 class; define it if at all possible. 592 class; define it if at all possible.
593===== ================ ========================================================
479 594
480 595
481 596
@@ -488,7 +603,7 @@ platforms, ACPI events must be signaled differently.
488 603
489There are two options: GPIO-signaled interrupts (Section 5.6.5), and 604There are two options: GPIO-signaled interrupts (Section 5.6.5), and
490interrupt-signaled events (Section 5.6.9). Interrupt-signaled events are a 605interrupt-signaled events (Section 5.6.9). Interrupt-signaled events are a
491new feature in the ACPI 6.1 specification. Either -- or both -- can be used 606new feature in the ACPI 6.1 specification. Either - or both - can be used
492on a given platform, and which to use may be dependent of limitations in any 607on a given platform, and which to use may be dependent of limitations in any
493given SoC. If possible, interrupt-signaled events are recommended. 608given SoC. If possible, interrupt-signaled events are recommended.
494 609
@@ -564,39 +679,40 @@ supported.
564 679
565The following classes of objects are not supported: 680The following classes of objects are not supported:
566 681
567 -- Section 9.2: ambient light sensor devices 682 - Section 9.2: ambient light sensor devices
568 683
569 -- Section 9.3: battery devices 684 - Section 9.3: battery devices
570 685
571 -- Section 9.4: lids (e.g., laptop lids) 686 - Section 9.4: lids (e.g., laptop lids)
572 687
573 -- Section 9.8.2: IDE controllers 688 - Section 9.8.2: IDE controllers
574 689
575 -- Section 9.9: floppy controllers 690 - Section 9.9: floppy controllers
576 691
577 -- Section 9.10: GPE block devices 692 - Section 9.10: GPE block devices
578 693
579 -- Section 9.15: PC/AT RTC/CMOS devices 694 - Section 9.15: PC/AT RTC/CMOS devices
580 695
581 -- Section 9.16: user presence detection devices 696 - Section 9.16: user presence detection devices
582 697
583 -- Section 9.17: I/O APIC devices; all GICs must be enumerable via MADT 698 - Section 9.17: I/O APIC devices; all GICs must be enumerable via MADT
584 699
585 -- Section 9.18: time and alarm devices (see 9.15) 700 - Section 9.18: time and alarm devices (see 9.15)
586 701
587 -- Section 10: power source and power meter devices 702 - Section 10: power source and power meter devices
588 703
589 -- Section 11: thermal management 704 - Section 11: thermal management
590 705
591 -- Section 12: embedded controllers interface 706 - Section 12: embedded controllers interface
592 707
593 -- Section 13: SMBus interfaces 708 - Section 13: SMBus interfaces
594 709
595 710
596This also means that there is no support for the following objects: 711This also means that there is no support for the following objects:
597 712
713==== =========================== ==== ==========
598Name Section Name Section 714Name Section Name Section
599---- ------------ ---- ------------ 715==== =========================== ==== ==========
600_ALC 9.3.4 _FDM 9.10.3 716_ALC 9.3.4 _FDM 9.10.3
601_ALI 9.3.2 _FIX 6.2.7 717_ALI 9.3.2 _FIX 6.2.7
602_ALP 9.3.6 _GAI 10.4.5 718_ALP 9.3.6 _GAI 10.4.5
@@ -619,4 +735,4 @@ _DCK 6.5.2 _UPD 9.16.1
619_EC 12.12 _UPP 9.16.2 735_EC 12.12 _UPP 9.16.2
620_FDE 9.10.1 _WPC 10.5.2 736_FDE 9.10.1 _WPC 10.5.2
621_FDI 9.10.2 _WPP 10.5.3 737_FDI 9.10.2 _WPP 10.5.3
622 738==== =========================== ==== ==========
diff --git a/Documentation/arm64/arm-acpi.txt b/Documentation/arm64/arm-acpi.rst
index 1a74a041a443..872dbbc73d4a 100644
--- a/Documentation/arm64/arm-acpi.txt
+++ b/Documentation/arm64/arm-acpi.rst
@@ -1,5 +1,7 @@
1=====================
1ACPI on ARMv8 Servers 2ACPI on ARMv8 Servers
2--------------------- 3=====================
4
3ACPI can be used for ARMv8 general purpose servers designed to follow 5ACPI can be used for ARMv8 general purpose servers designed to follow
4the ARM SBSA (Server Base System Architecture) [0] and SBBR (Server 6the ARM SBSA (Server Base System Architecture) [0] and SBBR (Server
5Base Boot Requirements) [1] specifications. Please note that the SBBR 7Base Boot Requirements) [1] specifications. Please note that the SBBR
@@ -34,28 +36,28 @@ of the summary text almost directly, to be honest.
34 36
35The short form of the rationale for ACPI on ARM is: 37The short form of the rationale for ACPI on ARM is:
36 38
37-- ACPI’s byte code (AML) allows the platform to encode hardware behavior, 39- ACPI’s byte code (AML) allows the platform to encode hardware behavior,
38 while DT explicitly does not support this. For hardware vendors, being 40 while DT explicitly does not support this. For hardware vendors, being
39 able to encode behavior is a key tool used in supporting operating 41 able to encode behavior is a key tool used in supporting operating
40 system releases on new hardware. 42 system releases on new hardware.
41 43
42-- ACPI’s OSPM defines a power management model that constrains what the 44- ACPI’s OSPM defines a power management model that constrains what the
43 platform is allowed to do into a specific model, while still providing 45 platform is allowed to do into a specific model, while still providing
44 flexibility in hardware design. 46 flexibility in hardware design.
45 47
46-- In the enterprise server environment, ACPI has established bindings (such 48- In the enterprise server environment, ACPI has established bindings (such
47 as for RAS) which are currently used in production systems. DT does not. 49 as for RAS) which are currently used in production systems. DT does not.
48 Such bindings could be defined in DT at some point, but doing so means ARM 50 Such bindings could be defined in DT at some point, but doing so means ARM
49 and x86 would end up using completely different code paths in both firmware 51 and x86 would end up using completely different code paths in both firmware
50 and the kernel. 52 and the kernel.
51 53
52-- Choosing a single interface to describe the abstraction between a platform 54- Choosing a single interface to describe the abstraction between a platform
53 and an OS is important. Hardware vendors would not be required to implement 55 and an OS is important. Hardware vendors would not be required to implement
54 both DT and ACPI if they want to support multiple operating systems. And, 56 both DT and ACPI if they want to support multiple operating systems. And,
55 agreeing on a single interface instead of being fragmented into per OS 57 agreeing on a single interface instead of being fragmented into per OS
56 interfaces makes for better interoperability overall. 58 interfaces makes for better interoperability overall.
57 59
58-- The new ACPI governance process works well and Linux is now at the same 60- The new ACPI governance process works well and Linux is now at the same
59 table as hardware vendors and other OS vendors. In fact, there is no 61 table as hardware vendors and other OS vendors. In fact, there is no
60 longer any reason to feel that ACPI only belongs to Windows or that 62 longer any reason to feel that ACPI only belongs to Windows or that
61 Linux is in any way secondary to Microsoft in this arena. The move of 63 Linux is in any way secondary to Microsoft in this arena. The move of
@@ -169,31 +171,31 @@ For the ACPI core to operate properly, and in turn provide the information
169the kernel needs to configure devices, it expects to find the following 171the kernel needs to configure devices, it expects to find the following
170tables (all section numbers refer to the ACPI 6.1 specification): 172tables (all section numbers refer to the ACPI 6.1 specification):
171 173
172 -- RSDP (Root System Description Pointer), section 5.2.5 174 - RSDP (Root System Description Pointer), section 5.2.5
173 175
174 -- XSDT (eXtended System Description Table), section 5.2.8 176 - XSDT (eXtended System Description Table), section 5.2.8
175 177
176 -- FADT (Fixed ACPI Description Table), section 5.2.9 178 - FADT (Fixed ACPI Description Table), section 5.2.9
177 179
178 -- DSDT (Differentiated System Description Table), section 180 - DSDT (Differentiated System Description Table), section
179 5.2.11.1 181 5.2.11.1
180 182
181 -- MADT (Multiple APIC Description Table), section 5.2.12 183 - MADT (Multiple APIC Description Table), section 5.2.12
182 184
183 -- GTDT (Generic Timer Description Table), section 5.2.24 185 - GTDT (Generic Timer Description Table), section 5.2.24
184 186
185 -- If PCI is supported, the MCFG (Memory mapped ConFiGuration 187 - If PCI is supported, the MCFG (Memory mapped ConFiGuration
186 Table), section 5.2.6, specifically Table 5-31. 188 Table), section 5.2.6, specifically Table 5-31.
187 189
188 -- If booting without a console=<device> kernel parameter is 190 - If booting without a console=<device> kernel parameter is
189 supported, the SPCR (Serial Port Console Redirection table), 191 supported, the SPCR (Serial Port Console Redirection table),
190 section 5.2.6, specifically Table 5-31. 192 section 5.2.6, specifically Table 5-31.
191 193
192 -- If necessary to describe the I/O topology, SMMUs and GIC ITSs, 194 - If necessary to describe the I/O topology, SMMUs and GIC ITSs,
193 the IORT (Input Output Remapping Table, section 5.2.6, specifically 195 the IORT (Input Output Remapping Table, section 5.2.6, specifically
194 Table 5-31). 196 Table 5-31).
195 197
196 -- If NUMA is supported, the SRAT (System Resource Affinity Table) 198 - If NUMA is supported, the SRAT (System Resource Affinity Table)
197 and SLIT (System Locality distance Information Table), sections 199 and SLIT (System Locality distance Information Table), sections
198 5.2.16 and 5.2.17, respectively. 200 5.2.16 and 5.2.17, respectively.
199 201
@@ -269,9 +271,9 @@ describes how to define the structure of an object returned via _DSD, and
269how specific data structures are defined by specific UUIDs. Linux should 271how specific data structures are defined by specific UUIDs. Linux should
270only use the _DSD Device Properties UUID [5]: 272only use the _DSD Device Properties UUID [5]:
271 273
272 -- UUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301 274 - UUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301
273 275
274 -- http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf 276 - http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf
275 277
276The UEFI Forum provides a mechanism for registering device properties [4] 278The UEFI Forum provides a mechanism for registering device properties [4]
277so that they may be used across all operating systems supporting ACPI. 279so that they may be used across all operating systems supporting ACPI.
@@ -327,10 +329,10 @@ turning a device full off.
327 329
328There are two options for using those Power Resources. They can: 330There are two options for using those Power Resources. They can:
329 331
330 -- be managed in a _PSx method which gets called on entry to power 332 - be managed in a _PSx method which gets called on entry to power
331 state Dx. 333 state Dx.
332 334
333 -- be declared separately as power resources with their own _ON and _OFF 335 - be declared separately as power resources with their own _ON and _OFF
334 methods. They are then tied back to D-states for a particular device 336 methods. They are then tied back to D-states for a particular device
335 via _PRx which specifies which power resources a device needs to be on 337 via _PRx which specifies which power resources a device needs to be on
336 while in Dx. Kernel then tracks number of devices using a power resource 338 while in Dx. Kernel then tracks number of devices using a power resource
@@ -339,16 +341,16 @@ There are two options for using those Power Resources. They can:
339The kernel ACPI code will also assume that the _PSx methods follow the normal 341The kernel ACPI code will also assume that the _PSx methods follow the normal
340ACPI rules for such methods: 342ACPI rules for such methods:
341 343
342 -- If either _PS0 or _PS3 is implemented, then the other method must also 344 - If either _PS0 or _PS3 is implemented, then the other method must also
343 be implemented. 345 be implemented.
344 346
345 -- If a device requires usage or setup of a power resource when on, the ASL 347 - If a device requires usage or setup of a power resource when on, the ASL
346 should organize that it is allocated/enabled using the _PS0 method. 348 should organize that it is allocated/enabled using the _PS0 method.
347 349
348 -- Resources allocated or enabled in the _PS0 method should be disabled 350 - Resources allocated or enabled in the _PS0 method should be disabled
349 or de-allocated in the _PS3 method. 351 or de-allocated in the _PS3 method.
350 352
351 -- Firmware will leave the resources in a reasonable state before handing 353 - Firmware will leave the resources in a reasonable state before handing
352 over control to the kernel. 354 over control to the kernel.
353 355
354Such code in _PSx methods will of course be very platform specific. But, 356Such code in _PSx methods will of course be very platform specific. But,
@@ -394,52 +396,52 @@ else must be discovered by the driver probe function. Then, have the rest
394of the driver operate off of the contents of that struct. Doing so should 396of the driver operate off of the contents of that struct. Doing so should
395allow most divergence between ACPI and DT functionality to be kept local to 397allow most divergence between ACPI and DT functionality to be kept local to
396the probe function instead of being scattered throughout the driver. For 398the probe function instead of being scattered throughout the driver. For
397example: 399example::
398 400
399static int device_probe_dt(struct platform_device *pdev) 401 static int device_probe_dt(struct platform_device *pdev)
400{ 402 {
401 /* DT specific functionality */ 403 /* DT specific functionality */
402 ... 404 ...
403} 405 }
404 406
405static int device_probe_acpi(struct platform_device *pdev) 407 static int device_probe_acpi(struct platform_device *pdev)
406{ 408 {
407 /* ACPI specific functionality */ 409 /* ACPI specific functionality */
408 ... 410 ...
409} 411 }
410 412
411static int device_probe(struct platform_device *pdev) 413 static int device_probe(struct platform_device *pdev)
412{ 414 {
413 ... 415 ...
414 struct device_node node = pdev->dev.of_node; 416 struct device_node node = pdev->dev.of_node;
415 ... 417 ...
416 418
417 if (node) 419 if (node)
418 ret = device_probe_dt(pdev); 420 ret = device_probe_dt(pdev);
419 else if (ACPI_HANDLE(&pdev->dev)) 421 else if (ACPI_HANDLE(&pdev->dev))
420 ret = device_probe_acpi(pdev); 422 ret = device_probe_acpi(pdev);
421 else 423 else
422 /* other initialization */ 424 /* other initialization */
423 ... 425 ...
424 /* Continue with any generic probe operations */ 426 /* Continue with any generic probe operations */
425 ... 427 ...
426} 428 }
427 429
428DO keep the MODULE_DEVICE_TABLE entries together in the driver to make it 430DO keep the MODULE_DEVICE_TABLE entries together in the driver to make it
429clear the different names the driver is probed for, both from DT and from 431clear the different names the driver is probed for, both from DT and from
430ACPI: 432ACPI::
431 433
432static struct of_device_id virtio_mmio_match[] = { 434 static struct of_device_id virtio_mmio_match[] = {
433 { .compatible = "virtio,mmio", }, 435 { .compatible = "virtio,mmio", },
434 { } 436 { }
435}; 437 };
436MODULE_DEVICE_TABLE(of, virtio_mmio_match); 438 MODULE_DEVICE_TABLE(of, virtio_mmio_match);
437 439
438static const struct acpi_device_id virtio_mmio_acpi_match[] = { 440 static const struct acpi_device_id virtio_mmio_acpi_match[] = {
439 { "LNRO0005", }, 441 { "LNRO0005", },
440 { } 442 { }
441}; 443 };
442MODULE_DEVICE_TABLE(acpi, virtio_mmio_acpi_match); 444 MODULE_DEVICE_TABLE(acpi, virtio_mmio_acpi_match);
443 445
444 446
445ASWG 447ASWG
@@ -471,7 +473,8 @@ Linux Code
471Individual items specific to Linux on ARM, contained in the the Linux 473Individual items specific to Linux on ARM, contained in the the Linux
472source code, are in the list that follows: 474source code, are in the list that follows:
473 475
474ACPI_OS_NAME This macro defines the string to be returned when 476ACPI_OS_NAME
477 This macro defines the string to be returned when
475 an ACPI method invokes the _OS method. On ARM64 478 an ACPI method invokes the _OS method. On ARM64
476 systems, this macro will be "Linux" by default. 479 systems, this macro will be "Linux" by default.
477 The command line parameter acpi_os=<string> 480 The command line parameter acpi_os=<string>
@@ -482,38 +485,44 @@ ACPI_OS_NAME This macro defines the string to be returned when
482ACPI Objects 485ACPI Objects
483------------ 486------------
484Detailed expectations for ACPI tables and object are listed in the file 487Detailed expectations for ACPI tables and object are listed in the file
485Documentation/arm64/acpi_object_usage.txt. 488Documentation/arm64/acpi_object_usage.rst.
486 489
487 490
488References 491References
489---------- 492----------
490[0] http://silver.arm.com -- document ARM-DEN-0029, or newer 493[0] http://silver.arm.com
494 document ARM-DEN-0029, or newer:
491 "Server Base System Architecture", version 2.3, dated 27 Mar 2014 495 "Server Base System Architecture", version 2.3, dated 27 Mar 2014
492 496
493[1] http://infocenter.arm.com/help/topic/com.arm.doc.den0044a/Server_Base_Boot_Requirements.pdf 497[1] http://infocenter.arm.com/help/topic/com.arm.doc.den0044a/Server_Base_Boot_Requirements.pdf
494 Document ARM-DEN-0044A, or newer: "Server Base Boot Requirements, System 498 Document ARM-DEN-0044A, or newer: "Server Base Boot Requirements, System
495 Software on ARM Platforms", dated 16 Aug 2014 499 Software on ARM Platforms", dated 16 Aug 2014
496 500
497[2] http://www.secretlab.ca/archives/151, 10 Jan 2015, Copyright (c) 2015, 501[2] http://www.secretlab.ca/archives/151,
502 10 Jan 2015, Copyright (c) 2015,
498 Linaro Ltd., written by Grant Likely. 503 Linaro Ltd., written by Grant Likely.
499 504
500[3] AMD ACPI for Seattle platform documentation: 505[3] AMD ACPI for Seattle platform documentation
501 http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Seattle_ACPI_Guide.pdf 506 http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/Seattle_ACPI_Guide.pdf
502 507
503[4] http://www.uefi.org/acpi -- please see the link for the "ACPI _DSD Device 508
509[4] http://www.uefi.org/acpi
510 please see the link for the "ACPI _DSD Device
504 Property Registry Instructions" 511 Property Registry Instructions"
505 512
506[5] http://www.uefi.org/acpi -- please see the link for the "_DSD (Device 513[5] http://www.uefi.org/acpi
514 please see the link for the "_DSD (Device
507 Specific Data) Implementation Guide" 515 Specific Data) Implementation Guide"
508 516
509[6] Kernel code for the unified device property interface can be found in 517[6] Kernel code for the unified device
518 property interface can be found in
510 include/linux/property.h and drivers/base/property.c. 519 include/linux/property.h and drivers/base/property.c.
511 520
512 521
513Authors 522Authors
514------- 523-------
515Al Stone <al.stone@linaro.org> 524- Al Stone <al.stone@linaro.org>
516Graeme Gregory <graeme.gregory@linaro.org> 525- Graeme Gregory <graeme.gregory@linaro.org>
517Hanjun Guo <hanjun.guo@linaro.org> 526- Hanjun Guo <hanjun.guo@linaro.org>
518 527
519Grant Likely <grant.likely@linaro.org>, for the "Why ACPI on ARM?" section 528- Grant Likely <grant.likely@linaro.org>, for the "Why ACPI on ARM?" section
diff --git a/Documentation/arm64/booting.txt b/Documentation/arm64/booting.rst
index fbab7e21d116..3d041d0d16e8 100644
--- a/Documentation/arm64/booting.txt
+++ b/Documentation/arm64/booting.rst
@@ -1,7 +1,9 @@
1 Booting AArch64 Linux 1=====================
2 ===================== 2Booting AArch64 Linux
3=====================
3 4
4Author: Will Deacon <will.deacon@arm.com> 5Author: Will Deacon <will.deacon@arm.com>
6
5Date : 07 September 2012 7Date : 07 September 2012
6 8
7This document is based on the ARM booting document by Russell King and 9This document is based on the ARM booting document by Russell King and
@@ -12,7 +14,7 @@ The AArch64 exception model is made up of a number of exception levels
12counterpart. EL2 is the hypervisor level and exists only in non-secure 14counterpart. EL2 is the hypervisor level and exists only in non-secure
13mode. EL3 is the highest priority level and exists only in secure mode. 15mode. EL3 is the highest priority level and exists only in secure mode.
14 16
15For the purposes of this document, we will use the term `boot loader' 17For the purposes of this document, we will use the term `boot loader`
16simply to define all software that executes on the CPU(s) before control 18simply to define all software that executes on the CPU(s) before control
17is passed to the Linux kernel. This may include secure monitor and 19is passed to the Linux kernel. This may include secure monitor and
18hypervisor code, or it may just be a handful of instructions for 20hypervisor code, or it may just be a handful of instructions for
@@ -70,7 +72,7 @@ Image target is available instead.
70 72
71Requirement: MANDATORY 73Requirement: MANDATORY
72 74
73The decompressed kernel image contains a 64-byte header as follows: 75The decompressed kernel image contains a 64-byte header as follows::
74 76
75 u32 code0; /* Executable code */ 77 u32 code0; /* Executable code */
76 u32 code1; /* Executable code */ 78 u32 code1; /* Executable code */
@@ -103,19 +105,26 @@ Header notes:
103 105
104- The flags field (introduced in v3.17) is a little-endian 64-bit field 106- The flags field (introduced in v3.17) is a little-endian 64-bit field
105 composed as follows: 107 composed as follows:
106 Bit 0: Kernel endianness. 1 if BE, 0 if LE. 108
107 Bit 1-2: Kernel Page size. 109 ============= ===============================================================
108 0 - Unspecified. 110 Bit 0 Kernel endianness. 1 if BE, 0 if LE.
109 1 - 4K 111 Bit 1-2 Kernel Page size.
110 2 - 16K 112
111 3 - 64K 113 * 0 - Unspecified.
112 Bit 3: Kernel physical placement 114 * 1 - 4K
113 0 - 2MB aligned base should be as close as possible 115 * 2 - 16K
114 to the base of DRAM, since memory below it is not 116 * 3 - 64K
115 accessible via the linear mapping 117 Bit 3 Kernel physical placement
116 1 - 2MB aligned base may be anywhere in physical 118
117 memory 119 0
118 Bits 4-63: Reserved. 120 2MB aligned base should be as close as possible
121 to the base of DRAM, since memory below it is not
122 accessible via the linear mapping
123 1
124 2MB aligned base may be anywhere in physical
125 memory
126 Bits 4-63 Reserved.
127 ============= ===============================================================
119 128
120- When image_size is zero, a bootloader should attempt to keep as much 129- When image_size is zero, a bootloader should attempt to keep as much
121 memory as possible free for use by the kernel immediately after the 130 memory as possible free for use by the kernel immediately after the
@@ -147,19 +156,22 @@ Before jumping into the kernel, the following conditions must be met:
147 corrupted by bogus network packets or disk data. This will save 156 corrupted by bogus network packets or disk data. This will save
148 you many hours of debug. 157 you many hours of debug.
149 158
150- Primary CPU general-purpose register settings 159- Primary CPU general-purpose register settings:
151 x0 = physical address of device tree blob (dtb) in system RAM. 160
152 x1 = 0 (reserved for future use) 161 - x0 = physical address of device tree blob (dtb) in system RAM.
153 x2 = 0 (reserved for future use) 162 - x1 = 0 (reserved for future use)
154 x3 = 0 (reserved for future use) 163 - x2 = 0 (reserved for future use)
164 - x3 = 0 (reserved for future use)
155 165
156- CPU mode 166- CPU mode
167
157 All forms of interrupts must be masked in PSTATE.DAIF (Debug, SError, 168 All forms of interrupts must be masked in PSTATE.DAIF (Debug, SError,
158 IRQ and FIQ). 169 IRQ and FIQ).
159 The CPU must be in either EL2 (RECOMMENDED in order to have access to 170 The CPU must be in either EL2 (RECOMMENDED in order to have access to
160 the virtualisation extensions) or non-secure EL1. 171 the virtualisation extensions) or non-secure EL1.
161 172
162- Caches, MMUs 173- Caches, MMUs
174
163 The MMU must be off. 175 The MMU must be off.
164 Instruction cache may be on or off. 176 Instruction cache may be on or off.
165 The address range corresponding to the loaded kernel image must be 177 The address range corresponding to the loaded kernel image must be
@@ -172,18 +184,21 @@ Before jumping into the kernel, the following conditions must be met:
172 operations (not recommended) must be configured and disabled. 184 operations (not recommended) must be configured and disabled.
173 185
174- Architected timers 186- Architected timers
187
175 CNTFRQ must be programmed with the timer frequency and CNTVOFF must 188 CNTFRQ must be programmed with the timer frequency and CNTVOFF must
176 be programmed with a consistent value on all CPUs. If entering the 189 be programmed with a consistent value on all CPUs. If entering the
177 kernel at EL1, CNTHCTL_EL2 must have EL1PCTEN (bit 0) set where 190 kernel at EL1, CNTHCTL_EL2 must have EL1PCTEN (bit 0) set where
178 available. 191 available.
179 192
180- Coherency 193- Coherency
194
181 All CPUs to be booted by the kernel must be part of the same coherency 195 All CPUs to be booted by the kernel must be part of the same coherency
182 domain on entry to the kernel. This may require IMPLEMENTATION DEFINED 196 domain on entry to the kernel. This may require IMPLEMENTATION DEFINED
183 initialisation to enable the receiving of maintenance operations on 197 initialisation to enable the receiving of maintenance operations on
184 each CPU. 198 each CPU.
185 199
186- System registers 200- System registers
201
187 All writable architected system registers at the exception level where 202 All writable architected system registers at the exception level where
188 the kernel image will be entered must be initialised by software at a 203 the kernel image will be entered must be initialised by software at a
189 higher exception level to prevent execution in an UNKNOWN state. 204 higher exception level to prevent execution in an UNKNOWN state.
@@ -195,28 +210,40 @@ Before jumping into the kernel, the following conditions must be met:
195 210
196 For systems with a GICv3 interrupt controller to be used in v3 mode: 211 For systems with a GICv3 interrupt controller to be used in v3 mode:
197 - If EL3 is present: 212 - If EL3 is present:
198 ICC_SRE_EL3.Enable (bit 3) must be initialiased to 0b1. 213
199 ICC_SRE_EL3.SRE (bit 0) must be initialised to 0b1. 214 - ICC_SRE_EL3.Enable (bit 3) must be initialiased to 0b1.
215 - ICC_SRE_EL3.SRE (bit 0) must be initialised to 0b1.
216
200 - If the kernel is entered at EL1: 217 - If the kernel is entered at EL1:
201 ICC.SRE_EL2.Enable (bit 3) must be initialised to 0b1 218
202 ICC_SRE_EL2.SRE (bit 0) must be initialised to 0b1. 219 - ICC.SRE_EL2.Enable (bit 3) must be initialised to 0b1
220 - ICC_SRE_EL2.SRE (bit 0) must be initialised to 0b1.
221
203 - The DT or ACPI tables must describe a GICv3 interrupt controller. 222 - The DT or ACPI tables must describe a GICv3 interrupt controller.
204 223
205 For systems with a GICv3 interrupt controller to be used in 224 For systems with a GICv3 interrupt controller to be used in
206 compatibility (v2) mode: 225 compatibility (v2) mode:
226
207 - If EL3 is present: 227 - If EL3 is present:
208 ICC_SRE_EL3.SRE (bit 0) must be initialised to 0b0. 228
229 ICC_SRE_EL3.SRE (bit 0) must be initialised to 0b0.
230
209 - If the kernel is entered at EL1: 231 - If the kernel is entered at EL1:
210 ICC_SRE_EL2.SRE (bit 0) must be initialised to 0b0. 232
233 ICC_SRE_EL2.SRE (bit 0) must be initialised to 0b0.
234
211 - The DT or ACPI tables must describe a GICv2 interrupt controller. 235 - The DT or ACPI tables must describe a GICv2 interrupt controller.
212 236
213 For CPUs with pointer authentication functionality: 237 For CPUs with pointer authentication functionality:
214 - If EL3 is present: 238 - If EL3 is present:
215 SCR_EL3.APK (bit 16) must be initialised to 0b1 239
216 SCR_EL3.API (bit 17) must be initialised to 0b1 240 - SCR_EL3.APK (bit 16) must be initialised to 0b1
241 - SCR_EL3.API (bit 17) must be initialised to 0b1
242
217 - If the kernel is entered at EL1: 243 - If the kernel is entered at EL1:
218 HCR_EL2.APK (bit 40) must be initialised to 0b1 244
219 HCR_EL2.API (bit 41) must be initialised to 0b1 245 - HCR_EL2.APK (bit 40) must be initialised to 0b1
246 - HCR_EL2.API (bit 41) must be initialised to 0b1
220 247
221The requirements described above for CPU mode, caches, MMUs, architected 248The requirements described above for CPU mode, caches, MMUs, architected
222timers, coherency and system registers apply to all CPUs. All CPUs must 249timers, coherency and system registers apply to all CPUs. All CPUs must
diff --git a/Documentation/arm64/cpu-feature-registers.txt b/Documentation/arm64/cpu-feature-registers.rst
index 684a0da39378..2955287e9acc 100644
--- a/Documentation/arm64/cpu-feature-registers.txt
+++ b/Documentation/arm64/cpu-feature-registers.rst
@@ -1,5 +1,6 @@
1 ARM64 CPU Feature Registers 1===========================
2 =========================== 2ARM64 CPU Feature Registers
3===========================
3 4
4Author: Suzuki K Poulose <suzuki.poulose@arm.com> 5Author: Suzuki K Poulose <suzuki.poulose@arm.com>
5 6
@@ -9,7 +10,7 @@ registers to userspace. The availability of this ABI is advertised
9via the HWCAP_CPUID in HWCAPs. 10via the HWCAP_CPUID in HWCAPs.
10 11
111. Motivation 121. Motivation
12--------------- 13-------------
13 14
14The ARM architecture defines a set of feature registers, which describe 15The ARM architecture defines a set of feature registers, which describe
15the capabilities of the CPU/system. Access to these system registers is 16the capabilities of the CPU/system. Access to these system registers is
@@ -33,9 +34,10 @@ there are some issues with their usage.
33 34
34 35
352. Requirements 362. Requirements
36----------------- 37---------------
38
39 a) Safety:
37 40
38 a) Safety :
39 Applications should be able to use the information provided by the 41 Applications should be able to use the information provided by the
40 infrastructure to run safely across the system. This has greater 42 infrastructure to run safely across the system. This has greater
41 implications on a system with heterogeneous CPUs. 43 implications on a system with heterogeneous CPUs.
@@ -47,7 +49,8 @@ there are some issues with their usage.
47 Otherwise an application could crash when scheduled on the CPU 49 Otherwise an application could crash when scheduled on the CPU
48 which doesn't support CRC32. 50 which doesn't support CRC32.
49 51
50 b) Security : 52 b) Security:
53
51 Applications should only be able to receive information that is 54 Applications should only be able to receive information that is
52 relevant to the normal operation in userspace. Hence, some of the 55 relevant to the normal operation in userspace. Hence, some of the
53 fields are masked out(i.e, made invisible) and their values are set to 56 fields are masked out(i.e, made invisible) and their values are set to
@@ -58,10 +61,12 @@ there are some issues with their usage.
58 (even when the CPU provides it). 61 (even when the CPU provides it).
59 62
60 c) Implementation Defined Features 63 c) Implementation Defined Features
64
61 The infrastructure doesn't expose any register which is 65 The infrastructure doesn't expose any register which is
62 IMPLEMENTATION DEFINED as per ARMv8-A Architecture. 66 IMPLEMENTATION DEFINED as per ARMv8-A Architecture.
63 67
64 d) CPU Identification : 68 d) CPU Identification:
69
65 MIDR_EL1 is exposed to help identify the processor. On a 70 MIDR_EL1 is exposed to help identify the processor. On a
66 heterogeneous system, this could be racy (just like getcpu()). The 71 heterogeneous system, this could be racy (just like getcpu()). The
67 process could be migrated to another CPU by the time it uses the 72 process could be migrated to another CPU by the time it uses the
@@ -70,7 +75,7 @@ there are some issues with their usage.
70 currently executing on. The REVIDR is not exposed due to this 75 currently executing on. The REVIDR is not exposed due to this
71 constraint, as REVIDR makes sense only in conjunction with the 76 constraint, as REVIDR makes sense only in conjunction with the
72 MIDR. Alternately, MIDR_EL1 and REVIDR_EL1 are exposed via sysfs 77 MIDR. Alternately, MIDR_EL1 and REVIDR_EL1 are exposed via sysfs
73 at: 78 at::
74 79
75 /sys/devices/system/cpu/cpu$ID/regs/identification/ 80 /sys/devices/system/cpu/cpu$ID/regs/identification/
76 \- midr 81 \- midr
@@ -85,7 +90,8 @@ exception and ends up in SIGILL being delivered to the process.
85The infrastructure hooks into the exception handler and emulates the 90The infrastructure hooks into the exception handler and emulates the
86operation if the source belongs to the supported system register space. 91operation if the source belongs to the supported system register space.
87 92
88The infrastructure emulates only the following system register space: 93The infrastructure emulates only the following system register space::
94
89 Op0=3, Op1=0, CRn=0, CRm=0,4,5,6,7 95 Op0=3, Op1=0, CRn=0, CRm=0,4,5,6,7
90 96
91(See Table C5-6 'System instruction encodings for non-Debug System 97(See Table C5-6 'System instruction encodings for non-Debug System
@@ -107,73 +113,76 @@ infrastructure:
107------------------------------------------- 113-------------------------------------------
108 114
109 1) ID_AA64ISAR0_EL1 - Instruction Set Attribute Register 0 115 1) ID_AA64ISAR0_EL1 - Instruction Set Attribute Register 0
110 x--------------------------------------------------x 116
117 +------------------------------+---------+---------+
111 | Name | bits | visible | 118 | Name | bits | visible |
112 |--------------------------------------------------| 119 +------------------------------+---------+---------+
113 | TS | [55-52] | y | 120 | TS | [55-52] | y |
114 |--------------------------------------------------| 121 +------------------------------+---------+---------+
115 | FHM | [51-48] | y | 122 | FHM | [51-48] | y |
116 |--------------------------------------------------| 123 +------------------------------+---------+---------+
117 | DP | [47-44] | y | 124 | DP | [47-44] | y |
118 |--------------------------------------------------| 125 +------------------------------+---------+---------+
119 | SM4 | [43-40] | y | 126 | SM4 | [43-40] | y |
120 |--------------------------------------------------| 127 +------------------------------+---------+---------+
121 | SM3 | [39-36] | y | 128 | SM3 | [39-36] | y |
122 |--------------------------------------------------| 129 +------------------------------+---------+---------+
123 | SHA3 | [35-32] | y | 130 | SHA3 | [35-32] | y |
124 |--------------------------------------------------| 131 +------------------------------+---------+---------+
125 | RDM | [31-28] | y | 132 | RDM | [31-28] | y |
126 |--------------------------------------------------| 133 +------------------------------+---------+---------+
127 | ATOMICS | [23-20] | y | 134 | ATOMICS | [23-20] | y |
128 |--------------------------------------------------| 135 +------------------------------+---------+---------+
129 | CRC32 | [19-16] | y | 136 | CRC32 | [19-16] | y |
130 |--------------------------------------------------| 137 +------------------------------+---------+---------+
131 | SHA2 | [15-12] | y | 138 | SHA2 | [15-12] | y |
132 |--------------------------------------------------| 139 +------------------------------+---------+---------+
133 | SHA1 | [11-8] | y | 140 | SHA1 | [11-8] | y |
134 |--------------------------------------------------| 141 +------------------------------+---------+---------+
135 | AES | [7-4] | y | 142 | AES | [7-4] | y |
136 x--------------------------------------------------x 143 +------------------------------+---------+---------+
137 144
138 145
139 2) ID_AA64PFR0_EL1 - Processor Feature Register 0 146 2) ID_AA64PFR0_EL1 - Processor Feature Register 0
140 x--------------------------------------------------x 147
148 +------------------------------+---------+---------+
141 | Name | bits | visible | 149 | Name | bits | visible |
142 |--------------------------------------------------| 150 +------------------------------+---------+---------+
143 | DIT | [51-48] | y | 151 | DIT | [51-48] | y |
144 |--------------------------------------------------| 152 +------------------------------+---------+---------+
145 | SVE | [35-32] | y | 153 | SVE | [35-32] | y |
146 |--------------------------------------------------| 154 +------------------------------+---------+---------+
147 | GIC | [27-24] | n | 155 | GIC | [27-24] | n |
148 |--------------------------------------------------| 156 +------------------------------+---------+---------+
149 | AdvSIMD | [23-20] | y | 157 | AdvSIMD | [23-20] | y |
150 |--------------------------------------------------| 158 +------------------------------+---------+---------+
151 | FP | [19-16] | y | 159 | FP | [19-16] | y |
152 |--------------------------------------------------| 160 +------------------------------+---------+---------+
153 | EL3 | [15-12] | n | 161 | EL3 | [15-12] | n |
154 |--------------------------------------------------| 162 +------------------------------+---------+---------+
155 | EL2 | [11-8] | n | 163 | EL2 | [11-8] | n |
156 |--------------------------------------------------| 164 +------------------------------+---------+---------+
157 | EL1 | [7-4] | n | 165 | EL1 | [7-4] | n |
158 |--------------------------------------------------| 166 +------------------------------+---------+---------+
159 | EL0 | [3-0] | n | 167 | EL0 | [3-0] | n |
160 x--------------------------------------------------x 168 +------------------------------+---------+---------+
161 169
162 170
163 3) MIDR_EL1 - Main ID Register 171 3) MIDR_EL1 - Main ID Register
164 x--------------------------------------------------x 172
173 +------------------------------+---------+---------+
165 | Name | bits | visible | 174 | Name | bits | visible |
166 |--------------------------------------------------| 175 +------------------------------+---------+---------+
167 | Implementer | [31-24] | y | 176 | Implementer | [31-24] | y |
168 |--------------------------------------------------| 177 +------------------------------+---------+---------+
169 | Variant | [23-20] | y | 178 | Variant | [23-20] | y |
170 |--------------------------------------------------| 179 +------------------------------+---------+---------+
171 | Architecture | [19-16] | y | 180 | Architecture | [19-16] | y |
172 |--------------------------------------------------| 181 +------------------------------+---------+---------+
173 | PartNum | [15-4] | y | 182 | PartNum | [15-4] | y |
174 |--------------------------------------------------| 183 +------------------------------+---------+---------+
175 | Revision | [3-0] | y | 184 | Revision | [3-0] | y |
176 x--------------------------------------------------x 185 +------------------------------+---------+---------+
177 186
178 NOTE: The 'visible' fields of MIDR_EL1 will contain the value 187 NOTE: The 'visible' fields of MIDR_EL1 will contain the value
179 as available on the CPU where it is fetched and is not a system 188 as available on the CPU where it is fetched and is not a system
@@ -181,90 +190,92 @@ infrastructure:
181 190
182 4) ID_AA64ISAR1_EL1 - Instruction set attribute register 1 191 4) ID_AA64ISAR1_EL1 - Instruction set attribute register 1
183 192
184 x--------------------------------------------------x 193 +------------------------------+---------+---------+
185 | Name | bits | visible | 194 | Name | bits | visible |
186 |--------------------------------------------------| 195 +------------------------------+---------+---------+
187 | GPI | [31-28] | y | 196 | GPI | [31-28] | y |
188 |--------------------------------------------------| 197 +------------------------------+---------+---------+
189 | GPA | [27-24] | y | 198 | GPA | [27-24] | y |
190 |--------------------------------------------------| 199 +------------------------------+---------+---------+
191 | LRCPC | [23-20] | y | 200 | LRCPC | [23-20] | y |
192 |--------------------------------------------------| 201 +------------------------------+---------+---------+
193 | FCMA | [19-16] | y | 202 | FCMA | [19-16] | y |
194 |--------------------------------------------------| 203 +------------------------------+---------+---------+
195 | JSCVT | [15-12] | y | 204 | JSCVT | [15-12] | y |
196 |--------------------------------------------------| 205 +------------------------------+---------+---------+
197 | API | [11-8] | y | 206 | API | [11-8] | y |
198 |--------------------------------------------------| 207 +------------------------------+---------+---------+
199 | APA | [7-4] | y | 208 | APA | [7-4] | y |
200 |--------------------------------------------------| 209 +------------------------------+---------+---------+
201 | DPB | [3-0] | y | 210 | DPB | [3-0] | y |
202 x--------------------------------------------------x 211 +------------------------------+---------+---------+
203 212
204 5) ID_AA64MMFR2_EL1 - Memory model feature register 2 213 5) ID_AA64MMFR2_EL1 - Memory model feature register 2
205 214
206 x--------------------------------------------------x 215 +------------------------------+---------+---------+
207 | Name | bits | visible | 216 | Name | bits | visible |
208 |--------------------------------------------------| 217 +------------------------------+---------+---------+
209 | AT | [35-32] | y | 218 | AT | [35-32] | y |
210 x--------------------------------------------------x 219 +------------------------------+---------+---------+
211 220
212 6) ID_AA64ZFR0_EL1 - SVE feature ID register 0 221 6) ID_AA64ZFR0_EL1 - SVE feature ID register 0
213 222
214 x--------------------------------------------------x 223 +------------------------------+---------+---------+
215 | Name | bits | visible | 224 | Name | bits | visible |
216 |--------------------------------------------------| 225 +------------------------------+---------+---------+
217 | SM4 | [43-40] | y | 226 | SM4 | [43-40] | y |
218 |--------------------------------------------------| 227 +------------------------------+---------+---------+
219 | SHA3 | [35-32] | y | 228 | SHA3 | [35-32] | y |
220 |--------------------------------------------------| 229 +------------------------------+---------+---------+
221 | BitPerm | [19-16] | y | 230 | BitPerm | [19-16] | y |
222 |--------------------------------------------------| 231 +------------------------------+---------+---------+
223 | AES | [7-4] | y | 232 | AES | [7-4] | y |
224 |--------------------------------------------------| 233 +------------------------------+---------+---------+
225 | SVEVer | [3-0] | y | 234 | SVEVer | [3-0] | y |
226 x--------------------------------------------------x 235 +------------------------------+---------+---------+
227 236
228Appendix I: Example 237Appendix I: Example
229--------------------------- 238-------------------
230 239
231/* 240::
232 * Sample program to demonstrate the MRS emulation ABI. 241
233 * 242 /*
234 * Copyright (C) 2015-2016, ARM Ltd 243 * Sample program to demonstrate the MRS emulation ABI.
235 * 244 *
236 * Author: Suzuki K Poulose <suzuki.poulose@arm.com> 245 * Copyright (C) 2015-2016, ARM Ltd
237 * 246 *
238 * This program is free software; you can redistribute it and/or modify 247 * Author: Suzuki K Poulose <suzuki.poulose@arm.com>
239 * it under the terms of the GNU General Public License version 2 as 248 *
240 * published by the Free Software Foundation. 249 * This program is free software; you can redistribute it and/or modify
241 * 250 * it under the terms of the GNU General Public License version 2 as
242 * This program is distributed in the hope that it will be useful, 251 * published by the Free Software Foundation.
243 * but WITHOUT ANY WARRANTY; without even the implied warranty of 252 *
244 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 253 * This program is distributed in the hope that it will be useful,
245 * GNU General Public License for more details. 254 * but WITHOUT ANY WARRANTY; without even the implied warranty of
246 * This program is free software; you can redistribute it and/or modify 255 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
247 * it under the terms of the GNU General Public License version 2 as 256 * GNU General Public License for more details.
248 * published by the Free Software Foundation. 257 * This program is free software; you can redistribute it and/or modify
249 * 258 * it under the terms of the GNU General Public License version 2 as
250 * This program is distributed in the hope that it will be useful, 259 * published by the Free Software Foundation.
251 * but WITHOUT ANY WARRANTY; without even the implied warranty of 260 *
252 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 261 * This program is distributed in the hope that it will be useful,
253 * GNU General Public License for more details. 262 * but WITHOUT ANY WARRANTY; without even the implied warranty of
254 */ 263 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
255 264 * GNU General Public License for more details.
256#include <asm/hwcap.h> 265 */
257#include <stdio.h> 266
258#include <sys/auxv.h> 267 #include <asm/hwcap.h>
259 268 #include <stdio.h>
260#define get_cpu_ftr(id) ({ \ 269 #include <sys/auxv.h>
270
271 #define get_cpu_ftr(id) ({ \
261 unsigned long __val; \ 272 unsigned long __val; \
262 asm("mrs %0, "#id : "=r" (__val)); \ 273 asm("mrs %0, "#id : "=r" (__val)); \
263 printf("%-20s: 0x%016lx\n", #id, __val); \ 274 printf("%-20s: 0x%016lx\n", #id, __val); \
264 }) 275 })
265 276
266int main(void) 277 int main(void)
267{ 278 {
268 279
269 if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) { 280 if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) {
270 fputs("CPUID registers unavailable\n", stderr); 281 fputs("CPUID registers unavailable\n", stderr);
@@ -284,13 +295,10 @@ int main(void)
284 get_cpu_ftr(MPIDR_EL1); 295 get_cpu_ftr(MPIDR_EL1);
285 get_cpu_ftr(REVIDR_EL1); 296 get_cpu_ftr(REVIDR_EL1);
286 297
287#if 0 298 #if 0
288 /* Unexposed register access causes SIGILL */ 299 /* Unexposed register access causes SIGILL */
289 get_cpu_ftr(ID_MMFR0_EL1); 300 get_cpu_ftr(ID_MMFR0_EL1);
290#endif 301 #endif
291 302
292 return 0; 303 return 0;
293} 304 }
294
295
296
diff --git a/Documentation/arm64/elf_hwcaps.txt b/Documentation/arm64/elf_hwcaps.rst
index 5ae2ef2c12f3..91f79529c58c 100644
--- a/Documentation/arm64/elf_hwcaps.txt
+++ b/Documentation/arm64/elf_hwcaps.rst
@@ -1,3 +1,4 @@
1================
1ARM64 ELF hwcaps 2ARM64 ELF hwcaps
2================ 3================
3 4
@@ -15,16 +16,16 @@ of flags called hwcaps, exposed in the auxilliary vector.
15 16
16Userspace software can test for features by acquiring the AT_HWCAP or 17Userspace software can test for features by acquiring the AT_HWCAP or
17AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant 18AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant
18flags are set, e.g. 19flags are set, e.g.::
19 20
20bool floating_point_is_present(void) 21 bool floating_point_is_present(void)
21{ 22 {
22 unsigned long hwcaps = getauxval(AT_HWCAP); 23 unsigned long hwcaps = getauxval(AT_HWCAP);
23 if (hwcaps & HWCAP_FP) 24 if (hwcaps & HWCAP_FP)
24 return true; 25 return true;
25 26
26 return false; 27 return false;
27} 28 }
28 29
29Where software relies on a feature described by a hwcap, it should check 30Where software relies on a feature described by a hwcap, it should check
30the relevant hwcap flag to verify that the feature is present before 31the relevant hwcap flag to verify that the feature is present before
@@ -45,7 +46,7 @@ userspace code at EL0. These hwcaps are defined in terms of ID register
45fields, and should be interpreted with reference to the definition of 46fields, and should be interpreted with reference to the definition of
46these fields in the ARM Architecture Reference Manual (ARM ARM). 47these fields in the ARM Architecture Reference Manual (ARM ARM).
47 48
48Such hwcaps are described below in the form: 49Such hwcaps are described below in the form::
49 50
50 Functionality implied by idreg.field == val. 51 Functionality implied by idreg.field == val.
51 52
@@ -64,75 +65,58 @@ reference to ID registers, and may refer to other documentation.
64--------------------------------- 65---------------------------------
65 66
66HWCAP_FP 67HWCAP_FP
67
68 Functionality implied by ID_AA64PFR0_EL1.FP == 0b0000. 68 Functionality implied by ID_AA64PFR0_EL1.FP == 0b0000.
69 69
70HWCAP_ASIMD 70HWCAP_ASIMD
71
72 Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0000. 71 Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0000.
73 72
74HWCAP_EVTSTRM 73HWCAP_EVTSTRM
75
76 The generic timer is configured to generate events at a frequency of 74 The generic timer is configured to generate events at a frequency of
77 approximately 100KHz. 75 approximately 100KHz.
78 76
79HWCAP_AES 77HWCAP_AES
80
81 Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0001. 78 Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0001.
82 79
83HWCAP_PMULL 80HWCAP_PMULL
84
85 Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0010. 81 Functionality implied by ID_AA64ISAR0_EL1.AES == 0b0010.
86 82
87HWCAP_SHA1 83HWCAP_SHA1
88
89 Functionality implied by ID_AA64ISAR0_EL1.SHA1 == 0b0001. 84 Functionality implied by ID_AA64ISAR0_EL1.SHA1 == 0b0001.
90 85
91HWCAP_SHA2 86HWCAP_SHA2
92
93 Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0001. 87 Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0001.
94 88
95HWCAP_CRC32 89HWCAP_CRC32
96
97 Functionality implied by ID_AA64ISAR0_EL1.CRC32 == 0b0001. 90 Functionality implied by ID_AA64ISAR0_EL1.CRC32 == 0b0001.
98 91
99HWCAP_ATOMICS 92HWCAP_ATOMICS
100
101 Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0010. 93 Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0010.
102 94
103HWCAP_FPHP 95HWCAP_FPHP
104
105 Functionality implied by ID_AA64PFR0_EL1.FP == 0b0001. 96 Functionality implied by ID_AA64PFR0_EL1.FP == 0b0001.
106 97
107HWCAP_ASIMDHP 98HWCAP_ASIMDHP
108
109 Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0001. 99 Functionality implied by ID_AA64PFR0_EL1.AdvSIMD == 0b0001.
110 100
111HWCAP_CPUID 101HWCAP_CPUID
112
113 EL0 access to certain ID registers is available, to the extent 102 EL0 access to certain ID registers is available, to the extent
114 described by Documentation/arm64/cpu-feature-registers.txt. 103 described by Documentation/arm64/cpu-feature-registers.rst.
115 104
116 These ID registers may imply the availability of features. 105 These ID registers may imply the availability of features.
117 106
118HWCAP_ASIMDRDM 107HWCAP_ASIMDRDM
119
120 Functionality implied by ID_AA64ISAR0_EL1.RDM == 0b0001. 108 Functionality implied by ID_AA64ISAR0_EL1.RDM == 0b0001.
121 109
122HWCAP_JSCVT 110HWCAP_JSCVT
123
124 Functionality implied by ID_AA64ISAR1_EL1.JSCVT == 0b0001. 111 Functionality implied by ID_AA64ISAR1_EL1.JSCVT == 0b0001.
125 112
126HWCAP_FCMA 113HWCAP_FCMA
127
128 Functionality implied by ID_AA64ISAR1_EL1.FCMA == 0b0001. 114 Functionality implied by ID_AA64ISAR1_EL1.FCMA == 0b0001.
129 115
130HWCAP_LRCPC 116HWCAP_LRCPC
131
132 Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0001. 117 Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0001.
133 118
134HWCAP_DCPOP 119HWCAP_DCPOP
135
136 Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0001. 120 Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0001.
137 121
138HWCAP2_DCPODP 122HWCAP2_DCPODP
@@ -140,27 +124,21 @@ HWCAP2_DCPODP
140 Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0010. 124 Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0010.
141 125
142HWCAP_SHA3 126HWCAP_SHA3
143
144 Functionality implied by ID_AA64ISAR0_EL1.SHA3 == 0b0001. 127 Functionality implied by ID_AA64ISAR0_EL1.SHA3 == 0b0001.
145 128
146HWCAP_SM3 129HWCAP_SM3
147
148 Functionality implied by ID_AA64ISAR0_EL1.SM3 == 0b0001. 130 Functionality implied by ID_AA64ISAR0_EL1.SM3 == 0b0001.
149 131
150HWCAP_SM4 132HWCAP_SM4
151
152 Functionality implied by ID_AA64ISAR0_EL1.SM4 == 0b0001. 133 Functionality implied by ID_AA64ISAR0_EL1.SM4 == 0b0001.
153 134
154HWCAP_ASIMDDP 135HWCAP_ASIMDDP
155
156 Functionality implied by ID_AA64ISAR0_EL1.DP == 0b0001. 136 Functionality implied by ID_AA64ISAR0_EL1.DP == 0b0001.
157 137
158HWCAP_SHA512 138HWCAP_SHA512
159
160 Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0010. 139 Functionality implied by ID_AA64ISAR0_EL1.SHA2 == 0b0010.
161 140
162HWCAP_SVE 141HWCAP_SVE
163
164 Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001. 142 Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001.
165 143
166HWCAP2_SVE2 144HWCAP2_SVE2
@@ -188,23 +166,18 @@ HWCAP2_SVESM4
188 Functionality implied by ID_AA64ZFR0_EL1.SM4 == 0b0001. 166 Functionality implied by ID_AA64ZFR0_EL1.SM4 == 0b0001.
189 167
190HWCAP_ASIMDFHM 168HWCAP_ASIMDFHM
191
192 Functionality implied by ID_AA64ISAR0_EL1.FHM == 0b0001. 169 Functionality implied by ID_AA64ISAR0_EL1.FHM == 0b0001.
193 170
194HWCAP_DIT 171HWCAP_DIT
195
196 Functionality implied by ID_AA64PFR0_EL1.DIT == 0b0001. 172 Functionality implied by ID_AA64PFR0_EL1.DIT == 0b0001.
197 173
198HWCAP_USCAT 174HWCAP_USCAT
199
200 Functionality implied by ID_AA64MMFR2_EL1.AT == 0b0001. 175 Functionality implied by ID_AA64MMFR2_EL1.AT == 0b0001.
201 176
202HWCAP_ILRCPC 177HWCAP_ILRCPC
203
204 Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0010. 178 Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0010.
205 179
206HWCAP_FLAGM 180HWCAP_FLAGM
207
208 Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0001. 181 Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0001.
209 182
210HWCAP2_FLAGM2 183HWCAP2_FLAGM2
@@ -212,20 +185,17 @@ HWCAP2_FLAGM2
212 Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0010. 185 Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0010.
213 186
214HWCAP_SSBS 187HWCAP_SSBS
215
216 Functionality implied by ID_AA64PFR1_EL1.SSBS == 0b0010. 188 Functionality implied by ID_AA64PFR1_EL1.SSBS == 0b0010.
217 189
218HWCAP_PACA 190HWCAP_PACA
219
220 Functionality implied by ID_AA64ISAR1_EL1.APA == 0b0001 or 191 Functionality implied by ID_AA64ISAR1_EL1.APA == 0b0001 or
221 ID_AA64ISAR1_EL1.API == 0b0001, as described by 192 ID_AA64ISAR1_EL1.API == 0b0001, as described by
222 Documentation/arm64/pointer-authentication.txt. 193 Documentation/arm64/pointer-authentication.rst.
223 194
224HWCAP_PACG 195HWCAP_PACG
225
226 Functionality implied by ID_AA64ISAR1_EL1.GPA == 0b0001 or 196 Functionality implied by ID_AA64ISAR1_EL1.GPA == 0b0001 or
227 ID_AA64ISAR1_EL1.GPI == 0b0001, as described by 197 ID_AA64ISAR1_EL1.GPI == 0b0001, as described by
228 Documentation/arm64/pointer-authentication.txt. 198 Documentation/arm64/pointer-authentication.rst.
229 199
230HWCAP2_FRINT 200HWCAP2_FRINT
231 201
diff --git a/Documentation/arm64/hugetlbpage.txt b/Documentation/arm64/hugetlbpage.rst
index cfae87dc653b..b44f939e5210 100644
--- a/Documentation/arm64/hugetlbpage.txt
+++ b/Documentation/arm64/hugetlbpage.rst
@@ -1,3 +1,4 @@
1====================
1HugeTLBpage on ARM64 2HugeTLBpage on ARM64
2==================== 3====================
3 4
@@ -31,8 +32,10 @@ and level of the page table.
31 32
32The following hugepage sizes are supported - 33The following hugepage sizes are supported -
33 34
34 CONT PTE PMD CONT PMD PUD 35 ====== ======== ==== ======== ===
35 -------- --- -------- --- 36 - CONT PTE PMD CONT PMD PUD
37 ====== ======== ==== ======== ===
36 4K: 64K 2M 32M 1G 38 4K: 64K 2M 32M 1G
37 16K: 2M 32M 1G 39 16K: 2M 32M 1G
38 64K: 2M 512M 16G 40 64K: 2M 512M 16G
41 ====== ======== ==== ======== ===
diff --git a/Documentation/arm64/index.rst b/Documentation/arm64/index.rst
new file mode 100644
index 000000000000..018b7836ecb7
--- /dev/null
+++ b/Documentation/arm64/index.rst
@@ -0,0 +1,28 @@
1:orphan:
2
3==================
4ARM64 Architecture
5==================
6
7.. toctree::
8 :maxdepth: 1
9
10 acpi_object_usage
11 arm-acpi
12 booting
13 cpu-feature-registers
14 elf_hwcaps
15 hugetlbpage
16 legacy_instructions
17 memory
18 pointer-authentication
19 silicon-errata
20 sve
21 tagged-pointers
22
23.. only:: subproject and html
24
25 Indices
26 =======
27
28 * :ref:`genindex`
diff --git a/Documentation/arm64/legacy_instructions.txt b/Documentation/arm64/legacy_instructions.rst
index 01bf3d9fac85..54401b22cb8f 100644
--- a/Documentation/arm64/legacy_instructions.txt
+++ b/Documentation/arm64/legacy_instructions.rst
@@ -1,3 +1,7 @@
1===================
2Legacy instructions
3===================
4
1The arm64 port of the Linux kernel provides infrastructure to support 5The arm64 port of the Linux kernel provides infrastructure to support
2emulation of instructions which have been deprecated, or obsoleted in 6emulation of instructions which have been deprecated, or obsoleted in
3the architecture. The infrastructure code uses undefined instruction 7the architecture. The infrastructure code uses undefined instruction
@@ -9,19 +13,22 @@ The emulation mode can be controlled by writing to sysctl nodes
9behaviours and the corresponding values of the sysctl nodes - 13behaviours and the corresponding values of the sysctl nodes -
10 14
11* Undef 15* Undef
12 Value: 0 16 Value: 0
17
13 Generates undefined instruction abort. Default for instructions that 18 Generates undefined instruction abort. Default for instructions that
14 have been obsoleted in the architecture, e.g., SWP 19 have been obsoleted in the architecture, e.g., SWP
15 20
16* Emulate 21* Emulate
17 Value: 1 22 Value: 1
23
18 Uses software emulation. To aid migration of software, in this mode 24 Uses software emulation. To aid migration of software, in this mode
19 usage of emulated instruction is traced as well as rate limited 25 usage of emulated instruction is traced as well as rate limited
20 warnings are issued. This is the default for deprecated 26 warnings are issued. This is the default for deprecated
21 instructions, .e.g., CP15 barriers 27 instructions, .e.g., CP15 barriers
22 28
23* Hardware Execution 29* Hardware Execution
24 Value: 2 30 Value: 2
31
25 Although marked as deprecated, some implementations may support the 32 Although marked as deprecated, some implementations may support the
26 enabling/disabling of hardware support for the execution of these 33 enabling/disabling of hardware support for the execution of these
27 instructions. Using hardware execution generally provides better 34 instructions. Using hardware execution generally provides better
@@ -38,20 +45,24 @@ individual instruction notes for further information.
38Supported legacy instructions 45Supported legacy instructions
39----------------------------- 46-----------------------------
40* SWP{B} 47* SWP{B}
41Node: /proc/sys/abi/swp 48
42Status: Obsolete 49:Node: /proc/sys/abi/swp
43Default: Undef (0) 50:Status: Obsolete
51:Default: Undef (0)
44 52
45* CP15 Barriers 53* CP15 Barriers
46Node: /proc/sys/abi/cp15_barrier 54
47Status: Deprecated 55:Node: /proc/sys/abi/cp15_barrier
48Default: Emulate (1) 56:Status: Deprecated
57:Default: Emulate (1)
49 58
50* SETEND 59* SETEND
51Node: /proc/sys/abi/setend 60
52Status: Deprecated 61:Node: /proc/sys/abi/setend
53Default: Emulate (1)* 62:Status: Deprecated
54Note: All the cpus on the system must have mixed endian support at EL0 63:Default: Emulate (1)*
55for this feature to be enabled. If a new CPU - which doesn't support mixed 64
56endian - is hotplugged in after this feature has been enabled, there could 65 Note: All the cpus on the system must have mixed endian support at EL0
57be unexpected results in the application. 66 for this feature to be enabled. If a new CPU - which doesn't support mixed
67 endian - is hotplugged in after this feature has been enabled, there could
68 be unexpected results in the application.
diff --git a/Documentation/arm64/memory.rst b/Documentation/arm64/memory.rst
new file mode 100644
index 000000000000..464b880fc4b7
--- /dev/null
+++ b/Documentation/arm64/memory.rst
@@ -0,0 +1,98 @@
1==============================
2Memory Layout on AArch64 Linux
3==============================
4
5Author: Catalin Marinas <catalin.marinas@arm.com>
6
7This document describes the virtual memory layout used by the AArch64
8Linux kernel. The architecture allows up to 4 levels of translation
9tables with a 4KB page size and up to 3 levels with a 64KB page size.
10
11AArch64 Linux uses either 3 levels or 4 levels of translation tables
12with the 4KB page configuration, allowing 39-bit (512GB) or 48-bit
13(256TB) virtual addresses, respectively, for both user and kernel. With
1464KB pages, only 2 levels of translation tables, allowing 42-bit (4TB)
15virtual address, are used but the memory layout is the same.
16
17User addresses have bits 63:48 set to 0 while the kernel addresses have
18the same bits set to 1. TTBRx selection is given by bit 63 of the
19virtual address. The swapper_pg_dir contains only kernel (global)
20mappings while the user pgd contains only user (non-global) mappings.
21The swapper_pg_dir address is written to TTBR1 and never written to
22TTBR0.
23
24
25AArch64 Linux memory layout with 4KB pages + 3 levels::
26
27 Start End Size Use
28 -----------------------------------------------------------------------
29 0000000000000000 0000007fffffffff 512GB user
30 ffffff8000000000 ffffffffffffffff 512GB kernel
31
32
33AArch64 Linux memory layout with 4KB pages + 4 levels::
34
35 Start End Size Use
36 -----------------------------------------------------------------------
37 0000000000000000 0000ffffffffffff 256TB user
38 ffff000000000000 ffffffffffffffff 256TB kernel
39
40
41AArch64 Linux memory layout with 64KB pages + 2 levels::
42
43 Start End Size Use
44 -----------------------------------------------------------------------
45 0000000000000000 000003ffffffffff 4TB user
46 fffffc0000000000 ffffffffffffffff 4TB kernel
47
48
49AArch64 Linux memory layout with 64KB pages + 3 levels::
50
51 Start End Size Use
52 -----------------------------------------------------------------------
53 0000000000000000 0000ffffffffffff 256TB user
54 ffff000000000000 ffffffffffffffff 256TB kernel
55
56
57For details of the virtual kernel memory layout please see the kernel
58booting log.
59
60
61Translation table lookup with 4KB pages::
62
63 +--------+--------+--------+--------+--------+--------+--------+--------+
64 |63 56|55 48|47 40|39 32|31 24|23 16|15 8|7 0|
65 +--------+--------+--------+--------+--------+--------+--------+--------+
66 | | | | | |
67 | | | | | v
68 | | | | | [11:0] in-page offset
69 | | | | +-> [20:12] L3 index
70 | | | +-----------> [29:21] L2 index
71 | | +---------------------> [38:30] L1 index
72 | +-------------------------------> [47:39] L0 index
73 +-------------------------------------------------> [63] TTBR0/1
74
75
76Translation table lookup with 64KB pages::
77
78 +--------+--------+--------+--------+--------+--------+--------+--------+
79 |63 56|55 48|47 40|39 32|31 24|23 16|15 8|7 0|
80 +--------+--------+--------+--------+--------+--------+--------+--------+
81 | | | | |
82 | | | | v
83 | | | | [15:0] in-page offset
84 | | | +----------> [28:16] L3 index
85 | | +--------------------------> [41:29] L2 index
86 | +-------------------------------> [47:42] L1 index
87 +-------------------------------------------------> [63] TTBR0/1
88
89
90When using KVM without the Virtualization Host Extensions, the
91hypervisor maps kernel pages in EL2 at a fixed (and potentially
92random) offset from the linear mapping. See the kern_hyp_va macro and
93kvm_update_va_mask function for more details. MMIO devices such as
94GICv2 gets mapped next to the HYP idmap page, as do vectors when
95ARM64_HARDEN_EL2_VECTORS is selected for particular CPUs.
96
97When using KVM with the Virtualization Host Extensions, no additional
98mappings are created, since the host kernel runs directly in EL2.
diff --git a/Documentation/arm64/memory.txt b/Documentation/arm64/memory.txt
deleted file mode 100644
index c5dab30d3389..000000000000
--- a/Documentation/arm64/memory.txt
+++ /dev/null
@@ -1,97 +0,0 @@
1 Memory Layout on AArch64 Linux
2 ==============================
3
4Author: Catalin Marinas <catalin.marinas@arm.com>
5
6This document describes the virtual memory layout used by the AArch64
7Linux kernel. The architecture allows up to 4 levels of translation
8tables with a 4KB page size and up to 3 levels with a 64KB page size.
9
10AArch64 Linux uses either 3 levels or 4 levels of translation tables
11with the 4KB page configuration, allowing 39-bit (512GB) or 48-bit
12(256TB) virtual addresses, respectively, for both user and kernel. With
1364KB pages, only 2 levels of translation tables, allowing 42-bit (4TB)
14virtual address, are used but the memory layout is the same.
15
16User addresses have bits 63:48 set to 0 while the kernel addresses have
17the same bits set to 1. TTBRx selection is given by bit 63 of the
18virtual address. The swapper_pg_dir contains only kernel (global)
19mappings while the user pgd contains only user (non-global) mappings.
20The swapper_pg_dir address is written to TTBR1 and never written to
21TTBR0.
22
23
24AArch64 Linux memory layout with 4KB pages + 3 levels:
25
26Start End Size Use
27-----------------------------------------------------------------------
280000000000000000 0000007fffffffff 512GB user
29ffffff8000000000 ffffffffffffffff 512GB kernel
30
31
32AArch64 Linux memory layout with 4KB pages + 4 levels:
33
34Start End Size Use
35-----------------------------------------------------------------------
360000000000000000 0000ffffffffffff 256TB user
37ffff000000000000 ffffffffffffffff 256TB kernel
38
39
40AArch64 Linux memory layout with 64KB pages + 2 levels:
41
42Start End Size Use
43-----------------------------------------------------------------------
440000000000000000 000003ffffffffff 4TB user
45fffffc0000000000 ffffffffffffffff 4TB kernel
46
47
48AArch64 Linux memory layout with 64KB pages + 3 levels:
49
50Start End Size Use
51-----------------------------------------------------------------------
520000000000000000 0000ffffffffffff 256TB user
53ffff000000000000 ffffffffffffffff 256TB kernel
54
55
56For details of the virtual kernel memory layout please see the kernel
57booting log.
58
59
60Translation table lookup with 4KB pages:
61
62+--------+--------+--------+--------+--------+--------+--------+--------+
63|63 56|55 48|47 40|39 32|31 24|23 16|15 8|7 0|
64+--------+--------+--------+--------+--------+--------+--------+--------+
65 | | | | | |
66 | | | | | v
67 | | | | | [11:0] in-page offset
68 | | | | +-> [20:12] L3 index
69 | | | +-----------> [29:21] L2 index
70 | | +---------------------> [38:30] L1 index
71 | +-------------------------------> [47:39] L0 index
72 +-------------------------------------------------> [63] TTBR0/1
73
74
75Translation table lookup with 64KB pages:
76
77+--------+--------+--------+--------+--------+--------+--------+--------+
78|63 56|55 48|47 40|39 32|31 24|23 16|15 8|7 0|
79+--------+--------+--------+--------+--------+--------+--------+--------+
80 | | | | |
81 | | | | v
82 | | | | [15:0] in-page offset
83 | | | +----------> [28:16] L3 index
84 | | +--------------------------> [41:29] L2 index
85 | +-------------------------------> [47:42] L1 index
86 +-------------------------------------------------> [63] TTBR0/1
87
88
89When using KVM without the Virtualization Host Extensions, the
90hypervisor maps kernel pages in EL2 at a fixed (and potentially
91random) offset from the linear mapping. See the kern_hyp_va macro and
92kvm_update_va_mask function for more details. MMIO devices such as
93GICv2 gets mapped next to the HYP idmap page, as do vectors when
94ARM64_HARDEN_EL2_VECTORS is selected for particular CPUs.
95
96When using KVM with the Virtualization Host Extensions, no additional
97mappings are created, since the host kernel runs directly in EL2.
diff --git a/Documentation/arm64/pointer-authentication.txt b/Documentation/arm64/pointer-authentication.rst
index fc71b33de87e..30b2ab06526b 100644
--- a/Documentation/arm64/pointer-authentication.txt
+++ b/Documentation/arm64/pointer-authentication.rst
@@ -1,7 +1,9 @@
1=======================================
1Pointer authentication in AArch64 Linux 2Pointer authentication in AArch64 Linux
2======================================= 3=======================================
3 4
4Author: Mark Rutland <mark.rutland@arm.com> 5Author: Mark Rutland <mark.rutland@arm.com>
6
5Date: 2017-07-19 7Date: 2017-07-19
6 8
7This document briefly describes the provision of pointer authentication 9This document briefly describes the provision of pointer authentication
diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.rst
index 2735462d5958..c792774be59e 100644
--- a/Documentation/arm64/silicon-errata.txt
+++ b/Documentation/arm64/silicon-errata.rst
@@ -1,7 +1,9 @@
1 Silicon Errata and Software Workarounds 1=======================================
2 ======================================= 2Silicon Errata and Software Workarounds
3=======================================
3 4
4Author: Will Deacon <will.deacon@arm.com> 5Author: Will Deacon <will.deacon@arm.com>
6
5Date : 27 November 2015 7Date : 27 November 2015
6 8
7It is an unfortunate fact of life that hardware is often produced with 9It is an unfortunate fact of life that hardware is often produced with
@@ -9,11 +11,13 @@ so-called "errata", which can cause it to deviate from the architecture
9under specific circumstances. For hardware produced by ARM, these 11under specific circumstances. For hardware produced by ARM, these
10errata are broadly classified into the following categories: 12errata are broadly classified into the following categories:
11 13
12 Category A: A critical error without a viable workaround. 14 ========== ========================================================
13 Category B: A significant or critical error with an acceptable 15 Category A A critical error without a viable workaround.
16 Category B A significant or critical error with an acceptable
14 workaround. 17 workaround.
15 Category C: A minor error that is not expected to occur under normal 18 Category C A minor error that is not expected to occur under normal
16 operation. 19 operation.
20 ========== ========================================================
17 21
18For more information, consult one of the "Software Developers Errata 22For more information, consult one of the "Software Developers Errata
19Notice" documents available on infocenter.arm.com (registration 23Notice" documents available on infocenter.arm.com (registration
@@ -42,47 +46,86 @@ file acts as a registry of software workarounds in the Linux Kernel and
42will be updated when new workarounds are committed and backported to 46will be updated when new workarounds are committed and backported to
43stable kernels. 47stable kernels.
44 48
45| Implementor | Component | Erratum ID | Kconfig |
46+----------------+-----------------+-----------------+-----------------------------+ 49+----------------+-----------------+-----------------+-----------------------------+
50| Implementor | Component | Erratum ID | Kconfig |
51+================+=================+=================+=============================+
47| Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKNOWN1 | 52| Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKNOWN1 |
48| | | | | 53+----------------+-----------------+-----------------+-----------------------------+
54+----------------+-----------------+-----------------+-----------------------------+
49| ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | 55| ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 |
56+----------------+-----------------+-----------------+-----------------------------+
50| ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 | 57| ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
58+----------------+-----------------+-----------------+-----------------------------+
51| ARM | Cortex-A53 | #824069 | ARM64_ERRATUM_824069 | 59| ARM | Cortex-A53 | #824069 | ARM64_ERRATUM_824069 |
60+----------------+-----------------+-----------------+-----------------------------+
52| ARM | Cortex-A53 | #819472 | ARM64_ERRATUM_819472 | 61| ARM | Cortex-A53 | #819472 | ARM64_ERRATUM_819472 |
62+----------------+-----------------+-----------------+-----------------------------+
53| ARM | Cortex-A53 | #845719 | ARM64_ERRATUM_845719 | 63| ARM | Cortex-A53 | #845719 | ARM64_ERRATUM_845719 |
64+----------------+-----------------+-----------------+-----------------------------+
54| ARM | Cortex-A53 | #843419 | ARM64_ERRATUM_843419 | 65| ARM | Cortex-A53 | #843419 | ARM64_ERRATUM_843419 |
66+----------------+-----------------+-----------------+-----------------------------+
55| ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | 67| ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 |
68+----------------+-----------------+-----------------+-----------------------------+
56| ARM | Cortex-A57 | #852523 | N/A | 69| ARM | Cortex-A57 | #852523 | N/A |
70+----------------+-----------------+-----------------+-----------------------------+
57| ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 | 71| ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 |
72+----------------+-----------------+-----------------+-----------------------------+
58| ARM | Cortex-A72 | #853709 | N/A | 73| ARM | Cortex-A72 | #853709 | N/A |
74+----------------+-----------------+-----------------+-----------------------------+
59| ARM | Cortex-A73 | #858921 | ARM64_ERRATUM_858921 | 75| ARM | Cortex-A73 | #858921 | ARM64_ERRATUM_858921 |
76+----------------+-----------------+-----------------+-----------------------------+
60| ARM | Cortex-A55 | #1024718 | ARM64_ERRATUM_1024718 | 77| ARM | Cortex-A55 | #1024718 | ARM64_ERRATUM_1024718 |
78+----------------+-----------------+-----------------+-----------------------------+
61| ARM | Cortex-A76 | #1188873,1418040| ARM64_ERRATUM_1418040 | 79| ARM | Cortex-A76 | #1188873,1418040| ARM64_ERRATUM_1418040 |
80+----------------+-----------------+-----------------+-----------------------------+
62| ARM | Cortex-A76 | #1165522 | ARM64_ERRATUM_1165522 | 81| ARM | Cortex-A76 | #1165522 | ARM64_ERRATUM_1165522 |
82+----------------+-----------------+-----------------+-----------------------------+
63| ARM | Cortex-A76 | #1286807 | ARM64_ERRATUM_1286807 | 83| ARM | Cortex-A76 | #1286807 | ARM64_ERRATUM_1286807 |
84+----------------+-----------------+-----------------+-----------------------------+
64| ARM | Cortex-A76 | #1463225 | ARM64_ERRATUM_1463225 | 85| ARM | Cortex-A76 | #1463225 | ARM64_ERRATUM_1463225 |
86+----------------+-----------------+-----------------+-----------------------------+
65| ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_1418040 | 87| ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_1418040 |
88+----------------+-----------------+-----------------+-----------------------------+
66| ARM | MMU-500 | #841119,826419 | N/A | 89| ARM | MMU-500 | #841119,826419 | N/A |
67| | | | | 90+----------------+-----------------+-----------------+-----------------------------+
91+----------------+-----------------+-----------------+-----------------------------+
68| Cavium | ThunderX ITS | #22375,24313 | CAVIUM_ERRATUM_22375 | 92| Cavium | ThunderX ITS | #22375,24313 | CAVIUM_ERRATUM_22375 |
93+----------------+-----------------+-----------------+-----------------------------+
69| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 | 94| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 |
95+----------------+-----------------+-----------------+-----------------------------+
70| Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | 96| Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 |
97+----------------+-----------------+-----------------+-----------------------------+
71| Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | 98| Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 |
99+----------------+-----------------+-----------------+-----------------------------+
72| Cavium | ThunderX Core | #30115 | CAVIUM_ERRATUM_30115 | 100| Cavium | ThunderX Core | #30115 | CAVIUM_ERRATUM_30115 |
101+----------------+-----------------+-----------------+-----------------------------+
73| Cavium | ThunderX SMMUv2 | #27704 | N/A | 102| Cavium | ThunderX SMMUv2 | #27704 | N/A |
103+----------------+-----------------+-----------------+-----------------------------+
74| Cavium | ThunderX2 SMMUv3| #74 | N/A | 104| Cavium | ThunderX2 SMMUv3| #74 | N/A |
105+----------------+-----------------+-----------------+-----------------------------+
75| Cavium | ThunderX2 SMMUv3| #126 | N/A | 106| Cavium | ThunderX2 SMMUv3| #126 | N/A |
76| | | | | 107+----------------+-----------------+-----------------+-----------------------------+
108+----------------+-----------------+-----------------+-----------------------------+
77| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | 109| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
78| | | | | 110+----------------+-----------------+-----------------+-----------------------------+
111+----------------+-----------------+-----------------+-----------------------------+
79| Hisilicon | Hip0{5,6,7} | #161010101 | HISILICON_ERRATUM_161010101 | 112| Hisilicon | Hip0{5,6,7} | #161010101 | HISILICON_ERRATUM_161010101 |
113+----------------+-----------------+-----------------+-----------------------------+
80| Hisilicon | Hip0{6,7} | #161010701 | N/A | 114| Hisilicon | Hip0{6,7} | #161010701 | N/A |
115+----------------+-----------------+-----------------+-----------------------------+
81| Hisilicon | Hip07 | #161600802 | HISILICON_ERRATUM_161600802 | 116| Hisilicon | Hip07 | #161600802 | HISILICON_ERRATUM_161600802 |
117+----------------+-----------------+-----------------+-----------------------------+
82| Hisilicon | Hip08 SMMU PMCG | #162001800 | N/A | 118| Hisilicon | Hip08 SMMU PMCG | #162001800 | N/A |
83| | | | | 119+----------------+-----------------+-----------------+-----------------------------+
120+----------------+-----------------+-----------------+-----------------------------+
84| Qualcomm Tech. | Kryo/Falkor v1 | E1003 | QCOM_FALKOR_ERRATUM_1003 | 121| Qualcomm Tech. | Kryo/Falkor v1 | E1003 | QCOM_FALKOR_ERRATUM_1003 |
122+----------------+-----------------+-----------------+-----------------------------+
85| Qualcomm Tech. | Falkor v1 | E1009 | QCOM_FALKOR_ERRATUM_1009 | 123| Qualcomm Tech. | Falkor v1 | E1009 | QCOM_FALKOR_ERRATUM_1009 |
124+----------------+-----------------+-----------------+-----------------------------+
86| Qualcomm Tech. | QDF2400 ITS | E0065 | QCOM_QDF2400_ERRATUM_0065 | 125| Qualcomm Tech. | QDF2400 ITS | E0065 | QCOM_QDF2400_ERRATUM_0065 |
126+----------------+-----------------+-----------------+-----------------------------+
87| Qualcomm Tech. | Falkor v{1,2} | E1041 | QCOM_FALKOR_ERRATUM_1041 | 127| Qualcomm Tech. | Falkor v{1,2} | E1041 | QCOM_FALKOR_ERRATUM_1041 |
128+----------------+-----------------+-----------------+-----------------------------+
129+----------------+-----------------+-----------------+-----------------------------+
88| Fujitsu | A64FX | E#010001 | FUJITSU_ERRATUM_010001 | 130| Fujitsu | A64FX | E#010001 | FUJITSU_ERRATUM_010001 |
131+----------------+-----------------+-----------------+-----------------------------+
diff --git a/Documentation/arm64/sve.txt b/Documentation/arm64/sve.rst
index 5689fc9a976a..5689c74c8082 100644
--- a/Documentation/arm64/sve.txt
+++ b/Documentation/arm64/sve.rst
@@ -1,7 +1,9 @@
1 Scalable Vector Extension support for AArch64 Linux 1===================================================
2 =================================================== 2Scalable Vector Extension support for AArch64 Linux
3===================================================
3 4
4Author: Dave Martin <Dave.Martin@arm.com> 5Author: Dave Martin <Dave.Martin@arm.com>
6
5Date: 4 August 2017 7Date: 4 August 2017
6 8
7This document outlines briefly the interface provided to userspace by Linux in 9This document outlines briefly the interface provided to userspace by Linux in
@@ -442,7 +444,7 @@ In A64 state, SVE adds the following:
442 444
443* FPSR and FPCR are retained from ARMv8-A, and interact with SVE floating-point 445* FPSR and FPCR are retained from ARMv8-A, and interact with SVE floating-point
444 operations in a similar way to the way in which they interact with ARMv8 446 operations in a similar way to the way in which they interact with ARMv8
445 floating-point operations. 447 floating-point operations::
446 448
447 8VL-1 128 0 bit index 449 8VL-1 128 0 bit index
448 +---- //// -----------------+ 450 +---- //// -----------------+
@@ -499,6 +501,8 @@ ARMv8-A defines the following floating-point / SIMD register state:
499* 32 128-bit vector registers V0..V31 501* 32 128-bit vector registers V0..V31
500* 2 32-bit status/control registers FPSR, FPCR 502* 2 32-bit status/control registers FPSR, FPCR
501 503
504::
505
502 127 0 bit index 506 127 0 bit index
503 +---------------+ 507 +---------------+
504 V0 | | 508 V0 | |
@@ -533,7 +537,7 @@ References
533[2] arch/arm64/include/uapi/asm/ptrace.h 537[2] arch/arm64/include/uapi/asm/ptrace.h
534 AArch64 Linux ptrace ABI definitions 538 AArch64 Linux ptrace ABI definitions
535 539
536[3] Documentation/arm64/cpu-feature-registers.txt 540[3] Documentation/arm64/cpu-feature-registers.rst
537 541
538[4] ARM IHI0055C 542[4] ARM IHI0055C
539 http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055c/IHI0055C_beta_aapcs64.pdf 543 http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055c/IHI0055C_beta_aapcs64.pdf
diff --git a/Documentation/arm64/tagged-pointers.txt b/Documentation/arm64/tagged-pointers.rst
index a25a99e82bb1..2acdec3ebbeb 100644
--- a/Documentation/arm64/tagged-pointers.txt
+++ b/Documentation/arm64/tagged-pointers.rst
@@ -1,7 +1,9 @@
1 Tagged virtual addresses in AArch64 Linux 1=========================================
2 ========================================= 2Tagged virtual addresses in AArch64 Linux
3=========================================
3 4
4Author: Will Deacon <will.deacon@arm.com> 5Author: Will Deacon <will.deacon@arm.com>
6
5Date : 12 June 2013 7Date : 12 June 2013
6 8
7This document briefly describes the provision of tagged virtual 9This document briefly describes the provision of tagged virtual
diff --git a/Documentation/bpf/btf.rst b/Documentation/bpf/btf.rst
index 35d83e24dbdb..4d565d202ce3 100644
--- a/Documentation/bpf/btf.rst
+++ b/Documentation/bpf/btf.rst
@@ -151,6 +151,7 @@ for the type. The maximum value of ``BTF_INT_BITS()`` is 128.
151 151
152The ``BTF_INT_OFFSET()`` specifies the starting bit offset to calculate values 152The ``BTF_INT_OFFSET()`` specifies the starting bit offset to calculate values
153for this int. For example, a bitfield struct member has: 153for this int. For example, a bitfield struct member has:
154
154 * btf member bit offset 100 from the start of the structure, 155 * btf member bit offset 100 from the start of the structure,
155 * btf member pointing to an int type, 156 * btf member pointing to an int type,
156 * the int type has ``BTF_INT_OFFSET() = 2`` and ``BTF_INT_BITS() = 4`` 157 * the int type has ``BTF_INT_OFFSET() = 2`` and ``BTF_INT_BITS() = 4``
@@ -160,6 +161,7 @@ from bits ``100 + 2 = 102``.
160 161
161Alternatively, the bitfield struct member can be the following to access the 162Alternatively, the bitfield struct member can be the following to access the
162same bits as the above: 163same bits as the above:
164
163 * btf member bit offset 102, 165 * btf member bit offset 102,
164 * btf member pointing to an int type, 166 * btf member pointing to an int type,
165 * the int type has ``BTF_INT_OFFSET() = 0`` and ``BTF_INT_BITS() = 4`` 167 * the int type has ``BTF_INT_OFFSET() = 0`` and ``BTF_INT_BITS() = 4``
diff --git a/Documentation/cdrom/Makefile b/Documentation/cdrom/Makefile
deleted file mode 100644
index a19e321928e1..000000000000
--- a/Documentation/cdrom/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
1LATEXFILE = cdrom-standard
2
3all:
4 make clean
5 latex $(LATEXFILE)
6 latex $(LATEXFILE)
7 @if [ -x `which gv` ]; then \
8 `dvips -q -t letter -o $(LATEXFILE).ps $(LATEXFILE).dvi` ;\
9 `gv -antialias -media letter -nocenter $(LATEXFILE).ps` ;\
10 else \
11 `xdvi $(LATEXFILE).dvi &` ;\
12 fi
13 make sortofclean
14
15clean:
16 rm -f $(LATEXFILE).ps $(LATEXFILE).dvi $(LATEXFILE).aux $(LATEXFILE).log
17
18sortofclean:
19 rm -f $(LATEXFILE).aux $(LATEXFILE).log
20
21
diff --git a/Documentation/cdrom/cdrom-standard.rst b/Documentation/cdrom/cdrom-standard.rst
new file mode 100644
index 000000000000..dde4f7f7fdbf
--- /dev/null
+++ b/Documentation/cdrom/cdrom-standard.rst
@@ -0,0 +1,1063 @@
1=======================
2A Linux CD-ROM standard
3=======================
4
5:Author: David van Leeuwen <david@ElseWare.cistron.nl>
6:Date: 12 March 1999
7:Updated by: Erik Andersen (andersee@debian.org)
8:Updated by: Jens Axboe (axboe@image.dk)
9
10
11Introduction
12============
13
14Linux is probably the Unix-like operating system that supports
15the widest variety of hardware devices. The reasons for this are
16presumably
17
18- The large list of hardware devices available for the many platforms
19 that Linux now supports (i.e., i386-PCs, Sparc Suns, etc.)
20- The open design of the operating system, such that anybody can write a
21 driver for Linux.
22- There is plenty of source code around as examples of how to write a driver.
23
24The openness of Linux, and the many different types of available
25hardware has allowed Linux to support many different hardware devices.
26Unfortunately, the very openness that has allowed Linux to support
27all these different devices has also allowed the behavior of each
28device driver to differ significantly from one device to another.
29This divergence of behavior has been very significant for CD-ROM
30devices; the way a particular drive reacts to a `standard` *ioctl()*
31call varies greatly from one device driver to another. To avoid making
32their drivers totally inconsistent, the writers of Linux CD-ROM
33drivers generally created new device drivers by understanding, copying,
34and then changing an existing one. Unfortunately, this practice did not
35maintain uniform behavior across all the Linux CD-ROM drivers.
36
37This document describes an effort to establish Uniform behavior across
38all the different CD-ROM device drivers for Linux. This document also
39defines the various *ioctl()'s*, and how the low-level CD-ROM device
40drivers should implement them. Currently (as of the Linux 2.1.\ *x*
41development kernels) several low-level CD-ROM device drivers, including
42both IDE/ATAPI and SCSI, now use this Uniform interface.
43
44When the CD-ROM was developed, the interface between the CD-ROM drive
45and the computer was not specified in the standards. As a result, many
46different CD-ROM interfaces were developed. Some of them had their
47own proprietary design (Sony, Mitsumi, Panasonic, Philips), other
48manufacturers adopted an existing electrical interface and changed
49the functionality (CreativeLabs/SoundBlaster, Teac, Funai) or simply
50adapted their drives to one or more of the already existing electrical
51interfaces (Aztech, Sanyo, Funai, Vertos, Longshine, Optics Storage and
52most of the `NoName` manufacturers). In cases where a new drive really
53brought its own interface or used its own command set and flow control
54scheme, either a separate driver had to be written, or an existing
55driver had to be enhanced. History has delivered us CD-ROM support for
56many of these different interfaces. Nowadays, almost all new CD-ROM
57drives are either IDE/ATAPI or SCSI, and it is very unlikely that any
58manufacturer will create a new interface. Even finding drives for the
59old proprietary interfaces is getting difficult.
60
61When (in the 1.3.70's) I looked at the existing software interface,
62which was expressed through `cdrom.h`, it appeared to be a rather wild
63set of commands and data formats [#f1]_. It seemed that many
64features of the software interface had been added to accommodate the
65capabilities of a particular drive, in an *ad hoc* manner. More
66importantly, it appeared that the behavior of the `standard` commands
67was different for most of the different drivers: e. g., some drivers
68close the tray if an *open()* call occurs when the tray is open, while
69others do not. Some drivers lock the door upon opening the device, to
70prevent an incoherent file system, but others don't, to allow software
71ejection. Undoubtedly, the capabilities of the different drives vary,
72but even when two drives have the same capability their drivers'
73behavior was usually different.
74
75.. [#f1]
76 I cannot recollect what kernel version I looked at, then,
77 presumably 1.2.13 and 1.3.34 --- the latest kernel that I was
78 indirectly involved in.
79
80I decided to start a discussion on how to make all the Linux CD-ROM
81drivers behave more uniformly. I began by contacting the developers of
82the many CD-ROM drivers found in the Linux kernel. Their reactions
83encouraged me to write the Uniform CD-ROM Driver which this document is
84intended to describe. The implementation of the Uniform CD-ROM Driver is
85in the file `cdrom.c`. This driver is intended to be an additional software
86layer that sits on top of the low-level device drivers for each CD-ROM drive.
87By adding this additional layer, it is possible to have all the different
88CD-ROM devices behave **exactly** the same (insofar as the underlying
89hardware will allow).
90
91The goal of the Uniform CD-ROM Driver is **not** to alienate driver developers
92whohave not yet taken steps to support this effort. The goal of Uniform CD-ROM
93Driver is simply to give people writing application programs for CD-ROM drives
94**one** Linux CD-ROM interface with consistent behavior for all
95CD-ROM devices. In addition, this also provides a consistent interface
96between the low-level device driver code and the Linux kernel. Care
97is taken that 100% compatibility exists with the data structures and
98programmer's interface defined in `cdrom.h`. This guide was written to
99help CD-ROM driver developers adapt their code to use the Uniform CD-ROM
100Driver code defined in `cdrom.c`.
101
102Personally, I think that the most important hardware interfaces are
103the IDE/ATAPI drives and, of course, the SCSI drives, but as prices
104of hardware drop continuously, it is also likely that people may have
105more than one CD-ROM drive, possibly of mixed types. It is important
106that these drives behave in the same way. In December 1994, one of the
107cheapest CD-ROM drives was a Philips cm206, a double-speed proprietary
108drive. In the months that I was busy writing a Linux driver for it,
109proprietary drives became obsolete and IDE/ATAPI drives became the
110standard. At the time of the last update to this document (November
1111997) it is becoming difficult to even **find** anything less than a
11216 speed CD-ROM drive, and 24 speed drives are common.
113
114.. _cdrom_api:
115
116Standardizing through another software level
117============================================
118
119At the time this document was conceived, all drivers directly
120implemented the CD-ROM *ioctl()* calls through their own routines. This
121led to the danger of different drivers forgetting to do important things
122like checking that the user was giving the driver valid data. More
123importantly, this led to the divergence of behavior, which has already
124been discussed.
125
126For this reason, the Uniform CD-ROM Driver was created to enforce consistent
127CD-ROM drive behavior, and to provide a common set of services to the various
128low-level CD-ROM device drivers. The Uniform CD-ROM Driver now provides another
129software-level, that separates the *ioctl()* and *open()* implementation
130from the actual hardware implementation. Note that this effort has
131made few changes which will affect a user's application programs. The
132greatest change involved moving the contents of the various low-level
133CD-ROM drivers\' header files to the kernel's cdrom directory. This was
134done to help ensure that the user is only presented with only one cdrom
135interface, the interface defined in `cdrom.h`.
136
137CD-ROM drives are specific enough (i. e., different from other
138block-devices such as floppy or hard disc drives), to define a set
139of common **CD-ROM device operations**, *<cdrom-device>_dops*.
140These operations are different from the classical block-device file
141operations, *<block-device>_fops*.
142
143The routines for the Uniform CD-ROM Driver interface level are implemented
144in the file `cdrom.c`. In this file, the Uniform CD-ROM Driver interfaces
145with the kernel as a block device by registering the following general
146*struct file_operations*::
147
148 struct file_operations cdrom_fops = {
149 NULL, /∗ lseek ∗/
150 block _read , /∗ read—general block-dev read ∗/
151 block _write, /∗ write—general block-dev write ∗/
152 NULL, /∗ readdir ∗/
153 NULL, /∗ select ∗/
154 cdrom_ioctl, /∗ ioctl ∗/
155 NULL, /∗ mmap ∗/
156 cdrom_open, /∗ open ∗/
157 cdrom_release, /∗ release ∗/
158 NULL, /∗ fsync ∗/
159 NULL, /∗ fasync ∗/
160 cdrom_media_changed, /∗ media change ∗/
161 NULL /∗ revalidate ∗/
162 };
163
164Every active CD-ROM device shares this *struct*. The routines
165declared above are all implemented in `cdrom.c`, since this file is the
166place where the behavior of all CD-ROM-devices is defined and
167standardized. The actual interface to the various types of CD-ROM
168hardware is still performed by various low-level CD-ROM-device
169drivers. These routines simply implement certain **capabilities**
170that are common to all CD-ROM (and really, all removable-media
171devices).
172
173Registration of a low-level CD-ROM device driver is now done through
174the general routines in `cdrom.c`, not through the Virtual File System
175(VFS) any more. The interface implemented in `cdrom.c` is carried out
176through two general structures that contain information about the
177capabilities of the driver, and the specific drives on which the
178driver operates. The structures are:
179
180cdrom_device_ops
181 This structure contains information about the low-level driver for a
182 CD-ROM device. This structure is conceptually connected to the major
183 number of the device (although some drivers may have different
184 major numbers, as is the case for the IDE driver).
185
186cdrom_device_info
187 This structure contains information about a particular CD-ROM drive,
188 such as its device name, speed, etc. This structure is conceptually
189 connected to the minor number of the device.
190
191Registering a particular CD-ROM drive with the Uniform CD-ROM Driver
192is done by the low-level device driver though a call to::
193
194 register_cdrom(struct cdrom_device_info * <device>_info)
195
196The device information structure, *<device>_info*, contains all the
197information needed for the kernel to interface with the low-level
198CD-ROM device driver. One of the most important entries in this
199structure is a pointer to the *cdrom_device_ops* structure of the
200low-level driver.
201
202The device operations structure, *cdrom_device_ops*, contains a list
203of pointers to the functions which are implemented in the low-level
204device driver. When `cdrom.c` accesses a CD-ROM device, it does it
205through the functions in this structure. It is impossible to know all
206the capabilities of future CD-ROM drives, so it is expected that this
207list may need to be expanded from time to time as new technologies are
208developed. For example, CD-R and CD-R/W drives are beginning to become
209popular, and support will soon need to be added for them. For now, the
210current *struct* is::
211
212 struct cdrom_device_ops {
213 int (*open)(struct cdrom_device_info *, int)
214 void (*release)(struct cdrom_device_info *);
215 int (*drive_status)(struct cdrom_device_info *, int);
216 unsigned int (*check_events)(struct cdrom_device_info *,
217 unsigned int, int);
218 int (*media_changed)(struct cdrom_device_info *, int);
219 int (*tray_move)(struct cdrom_device_info *, int);
220 int (*lock_door)(struct cdrom_device_info *, int);
221 int (*select_speed)(struct cdrom_device_info *, int);
222 int (*select_disc)(struct cdrom_device_info *, int);
223 int (*get_last_session) (struct cdrom_device_info *,
224 struct cdrom_multisession *);
225 int (*get_mcn)(struct cdrom_device_info *, struct cdrom_mcn *);
226 int (*reset)(struct cdrom_device_info *);
227 int (*audio_ioctl)(struct cdrom_device_info *,
228 unsigned int, void *);
229 const int capability; /* capability flags */
230 int (*generic_packet)(struct cdrom_device_info *,
231 struct packet_command *);
232 };
233
234When a low-level device driver implements one of these capabilities,
235it should add a function pointer to this *struct*. When a particular
236function is not implemented, however, this *struct* should contain a
237NULL instead. The *capability* flags specify the capabilities of the
238CD-ROM hardware and/or low-level CD-ROM driver when a CD-ROM drive
239is registered with the Uniform CD-ROM Driver.
240
241Note that most functions have fewer parameters than their
242*blkdev_fops* counterparts. This is because very little of the
243information in the structures *inode* and *file* is used. For most
244drivers, the main parameter is the *struct* *cdrom_device_info*, from
245which the major and minor number can be extracted. (Most low-level
246CD-ROM drivers don't even look at the major and minor number though,
247since many of them only support one device.) This will be available
248through *dev* in *cdrom_device_info* described below.
249
250The drive-specific, minor-like information that is registered with
251`cdrom.c`, currently contains the following fields::
252
253 struct cdrom_device_info {
254 const struct cdrom_device_ops * ops; /* device operations for this major */
255 struct list_head list; /* linked list of all device_info */
256 struct gendisk * disk; /* matching block layer disk */
257 void * handle; /* driver-dependent data */
258
259 int mask; /* mask of capability: disables them */
260 int speed; /* maximum speed for reading data */
261 int capacity; /* number of discs in a jukebox */
262
263 unsigned int options:30; /* options flags */
264 unsigned mc_flags:2; /* media-change buffer flags */
265 unsigned int vfs_events; /* cached events for vfs path */
266 unsigned int ioctl_events; /* cached events for ioctl path */
267 int use_count; /* number of times device is opened */
268 char name[20]; /* name of the device type */
269
270 __u8 sanyo_slot : 2; /* Sanyo 3-CD changer support */
271 __u8 keeplocked : 1; /* CDROM_LOCKDOOR status */
272 __u8 reserved : 5; /* not used yet */
273 int cdda_method; /* see CDDA_* flags */
274 __u8 last_sense; /* saves last sense key */
275 __u8 media_written; /* dirty flag, DVD+RW bookkeeping */
276 unsigned short mmc3_profile; /* current MMC3 profile */
277 int for_data; /* unknown:TBD */
278 int (*exit)(struct cdrom_device_info *);/* unknown:TBD */
279 int mrw_mode_page; /* which MRW mode page is in use */
280 };
281
282Using this *struct*, a linked list of the registered minor devices is
283built, using the *next* field. The device number, the device operations
284struct and specifications of properties of the drive are stored in this
285structure.
286
287The *mask* flags can be used to mask out some of the capabilities listed
288in *ops->capability*, if a specific drive doesn't support a feature
289of the driver. The value *speed* specifies the maximum head-rate of the
290drive, measured in units of normal audio speed (176kB/sec raw data or
291150kB/sec file system data). The parameters are declared *const*
292because they describe properties of the drive, which don't change after
293registration.
294
295A few registers contain variables local to the CD-ROM drive. The
296flags *options* are used to specify how the general CD-ROM routines
297should behave. These various flags registers should provide enough
298flexibility to adapt to the different users' wishes (and **not** the
299`arbitrary` wishes of the author of the low-level device driver, as is
300the case in the old scheme). The register *mc_flags* is used to buffer
301the information from *media_changed()* to two separate queues. Other
302data that is specific to a minor drive, can be accessed through *handle*,
303which can point to a data structure specific to the low-level driver.
304The fields *use_count*, *next*, *options* and *mc_flags* need not be
305initialized.
306
307The intermediate software layer that `cdrom.c` forms will perform some
308additional bookkeeping. The use count of the device (the number of
309processes that have the device opened) is registered in *use_count*. The
310function *cdrom_ioctl()* will verify the appropriate user-memory regions
311for read and write, and in case a location on the CD is transferred,
312it will `sanitize` the format by making requests to the low-level
313drivers in a standard format, and translating all formats between the
314user-software and low level drivers. This relieves much of the drivers'
315memory checking and format checking and translation. Also, the necessary
316structures will be declared on the program stack.
317
318The implementation of the functions should be as defined in the
319following sections. Two functions **must** be implemented, namely
320*open()* and *release()*. Other functions may be omitted, their
321corresponding capability flags will be cleared upon registration.
322Generally, a function returns zero on success and negative on error. A
323function call should return only after the command has completed, but of
324course waiting for the device should not use processor time.
325
326::
327
328 int open(struct cdrom_device_info *cdi, int purpose)
329
330*Open()* should try to open the device for a specific *purpose*, which
331can be either:
332
333- Open for reading data, as done by `mount()` (2), or the
334 user commands `dd` or `cat`.
335- Open for *ioctl* commands, as done by audio-CD playing programs.
336
337Notice that any strategic code (closing tray upon *open()*, etc.) is
338done by the calling routine in `cdrom.c`, so the low-level routine
339should only be concerned with proper initialization, such as spinning
340up the disc, etc.
341
342::
343
344 void release(struct cdrom_device_info *cdi)
345
346Device-specific actions should be taken such as spinning down the device.
347However, strategic actions such as ejection of the tray, or unlocking
348the door, should be left over to the general routine *cdrom_release()*.
349This is the only function returning type *void*.
350
351.. _cdrom_drive_status:
352
353::
354
355 int drive_status(struct cdrom_device_info *cdi, int slot_nr)
356
357The function *drive_status*, if implemented, should provide
358information on the status of the drive (not the status of the disc,
359which may or may not be in the drive). If the drive is not a changer,
360*slot_nr* should be ignored. In `cdrom.h` the possibilities are listed::
361
362
363 CDS_NO_INFO /* no information available */
364 CDS_NO_DISC /* no disc is inserted, tray is closed */
365 CDS_TRAY_OPEN /* tray is opened */
366 CDS_DRIVE_NOT_READY /* something is wrong, tray is moving? */
367 CDS_DISC_OK /* a disc is loaded and everything is fine */
368
369::
370
371 int media_changed(struct cdrom_device_info *cdi, int disc_nr)
372
373This function is very similar to the original function in $struct
374file_operations*. It returns 1 if the medium of the device *cdi->dev*
375has changed since the last call, and 0 otherwise. The parameter
376*disc_nr* identifies a specific slot in a juke-box, it should be
377ignored for single-disc drives. Note that by `re-routing` this
378function through *cdrom_media_changed()*, we can implement separate
379queues for the VFS and a new *ioctl()* function that can report device
380changes to software (e. g., an auto-mounting daemon).
381
382::
383
384 int tray_move(struct cdrom_device_info *cdi, int position)
385
386This function, if implemented, should control the tray movement. (No
387other function should control this.) The parameter *position* controls
388the desired direction of movement:
389
390- 0 Close tray
391- 1 Open tray
392
393This function returns 0 upon success, and a non-zero value upon
394error. Note that if the tray is already in the desired position, no
395action need be taken, and the return value should be 0.
396
397::
398
399 int lock_door(struct cdrom_device_info *cdi, int lock)
400
401This function (and no other code) controls locking of the door, if the
402drive allows this. The value of *lock* controls the desired locking
403state:
404
405- 0 Unlock door, manual opening is allowed
406- 1 Lock door, tray cannot be ejected manually
407
408This function returns 0 upon success, and a non-zero value upon
409error. Note that if the door is already in the requested state, no
410action need be taken, and the return value should be 0.
411
412::
413
414 int select_speed(struct cdrom_device_info *cdi, int speed)
415
416Some CD-ROM drives are capable of changing their head-speed. There
417are several reasons for changing the speed of a CD-ROM drive. Badly
418pressed CD-ROM s may benefit from less-than-maximum head rate. Modern
419CD-ROM drives can obtain very high head rates (up to *24x* is
420common). It has been reported that these drives can make reading
421errors at these high speeds, reducing the speed can prevent data loss
422in these circumstances. Finally, some of these drives can
423make an annoyingly loud noise, which a lower speed may reduce.
424
425This function specifies the speed at which data is read or audio is
426played back. The value of *speed* specifies the head-speed of the
427drive, measured in units of standard cdrom speed (176kB/sec raw data
428or 150kB/sec file system data). So to request that a CD-ROM drive
429operate at 300kB/sec you would call the CDROM_SELECT_SPEED *ioctl*
430with *speed=2*. The special value `0` means `auto-selection`, i. e.,
431maximum data-rate or real-time audio rate. If the drive doesn't have
432this `auto-selection` capability, the decision should be made on the
433current disc loaded and the return value should be positive. A negative
434return value indicates an error.
435
436::
437
438 int select_disc(struct cdrom_device_info *cdi, int number)
439
440If the drive can store multiple discs (a juke-box) this function
441will perform disc selection. It should return the number of the
442selected disc on success, a negative value on error. Currently, only
443the ide-cd driver supports this functionality.
444
445::
446
447 int get_last_session(struct cdrom_device_info *cdi,
448 struct cdrom_multisession *ms_info)
449
450This function should implement the old corresponding *ioctl()*. For
451device *cdi->dev*, the start of the last session of the current disc
452should be returned in the pointer argument *ms_info*. Note that
453routines in `cdrom.c` have sanitized this argument: its requested
454format will **always** be of the type *CDROM_LBA* (linear block
455addressing mode), whatever the calling software requested. But
456sanitization goes even further: the low-level implementation may
457return the requested information in *CDROM_MSF* format if it wishes so
458(setting the *ms_info->addr_format* field appropriately, of
459course) and the routines in `cdrom.c` will make the transformation if
460necessary. The return value is 0 upon success.
461
462::
463
464 int get_mcn(struct cdrom_device_info *cdi,
465 struct cdrom_mcn *mcn)
466
467Some discs carry a `Media Catalog Number` (MCN), also called
468`Universal Product Code` (UPC). This number should reflect the number
469that is generally found in the bar-code on the product. Unfortunately,
470the few discs that carry such a number on the disc don't even use the
471same format. The return argument to this function is a pointer to a
472pre-declared memory region of type *struct cdrom_mcn*. The MCN is
473expected as a 13-character string, terminated by a null-character.
474
475::
476
477 int reset(struct cdrom_device_info *cdi)
478
479This call should perform a hard-reset on the drive (although in
480circumstances that a hard-reset is necessary, a drive may very well not
481listen to commands anymore). Preferably, control is returned to the
482caller only after the drive has finished resetting. If the drive is no
483longer listening, it may be wise for the underlying low-level cdrom
484driver to time out.
485
486::
487
488 int audio_ioctl(struct cdrom_device_info *cdi,
489 unsigned int cmd, void *arg)
490
491Some of the CD-ROM-\ *ioctl()*\ 's defined in `cdrom.h` can be
492implemented by the routines described above, and hence the function
493*cdrom_ioctl* will use those. However, most *ioctl()*\ 's deal with
494audio-control. We have decided to leave these to be accessed through a
495single function, repeating the arguments *cmd* and *arg*. Note that
496the latter is of type *void*, rather than *unsigned long int*.
497The routine *cdrom_ioctl()* does do some useful things,
498though. It sanitizes the address format type to *CDROM_MSF* (Minutes,
499Seconds, Frames) for all audio calls. It also verifies the memory
500location of *arg*, and reserves stack-memory for the argument. This
501makes implementation of the *audio_ioctl()* much simpler than in the
502old driver scheme. For example, you may look up the function
503*cm206_audio_ioctl()* `cm206.c` that should be updated with
504this documentation.
505
506An unimplemented ioctl should return *-ENOSYS*, but a harmless request
507(e. g., *CDROMSTART*) may be ignored by returning 0 (success). Other
508errors should be according to the standards, whatever they are. When
509an error is returned by the low-level driver, the Uniform CD-ROM Driver
510tries whenever possible to return the error code to the calling program.
511(We may decide to sanitize the return value in *cdrom_ioctl()* though, in
512order to guarantee a uniform interface to the audio-player software.)
513
514::
515
516 int dev_ioctl(struct cdrom_device_info *cdi,
517 unsigned int cmd, unsigned long arg)
518
519Some *ioctl()'s* seem to be specific to certain CD-ROM drives. That is,
520they are introduced to service some capabilities of certain drives. In
521fact, there are 6 different *ioctl()'s* for reading data, either in some
522particular kind of format, or audio data. Not many drives support
523reading audio tracks as data, I believe this is because of protection
524of copyrights of artists. Moreover, I think that if audio-tracks are
525supported, it should be done through the VFS and not via *ioctl()'s*. A
526problem here could be the fact that audio-frames are 2352 bytes long,
527so either the audio-file-system should ask for 75264 bytes at once
528(the least common multiple of 512 and 2352), or the drivers should
529bend their backs to cope with this incoherence (to which I would be
530opposed). Furthermore, it is very difficult for the hardware to find
531the exact frame boundaries, since there are no synchronization headers
532in audio frames. Once these issues are resolved, this code should be
533standardized in `cdrom.c`.
534
535Because there are so many *ioctl()'s* that seem to be introduced to
536satisfy certain drivers [#f2]_, any non-standard *ioctl()*\ s
537are routed through the call *dev_ioctl()*. In principle, `private`
538*ioctl()*\ 's should be numbered after the device's major number, and not
539the general CD-ROM *ioctl* number, `0x53`. Currently the
540non-supported *ioctl()'s* are:
541
542 CDROMREADMODE1, CDROMREADMODE2, CDROMREADAUDIO, CDROMREADRAW,
543 CDROMREADCOOKED, CDROMSEEK, CDROMPLAY-BLK and CDROM-READALL
544
545.. [#f2]
546
547 Is there software around that actually uses these? I'd be interested!
548
549.. _cdrom_capabilities:
550
551CD-ROM capabilities
552-------------------
553
554Instead of just implementing some *ioctl* calls, the interface in
555`cdrom.c` supplies the possibility to indicate the **capabilities**
556of a CD-ROM drive. This can be done by ORing any number of
557capability-constants that are defined in `cdrom.h` at the registration
558phase. Currently, the capabilities are any of::
559
560 CDC_CLOSE_TRAY /* can close tray by software control */
561 CDC_OPEN_TRAY /* can open tray */
562 CDC_LOCK /* can lock and unlock the door */
563 CDC_SELECT_SPEED /* can select speed, in units of * sim*150 ,kB/s */
564 CDC_SELECT_DISC /* drive is juke-box */
565 CDC_MULTI_SESSION /* can read sessions *> rm1* */
566 CDC_MCN /* can read Media Catalog Number */
567 CDC_MEDIA_CHANGED /* can report if disc has changed */
568 CDC_PLAY_AUDIO /* can perform audio-functions (play, pause, etc) */
569 CDC_RESET /* hard reset device */
570 CDC_IOCTLS /* driver has non-standard ioctls */
571 CDC_DRIVE_STATUS /* driver implements drive status */
572
573The capability flag is declared *const*, to prevent drivers from
574accidentally tampering with the contents. The capability fags actually
575inform `cdrom.c` of what the driver can do. If the drive found
576by the driver does not have the capability, is can be masked out by
577the *cdrom_device_info* variable *mask*. For instance, the SCSI CD-ROM
578driver has implemented the code for loading and ejecting CD-ROM's, and
579hence its corresponding flags in *capability* will be set. But a SCSI
580CD-ROM drive might be a caddy system, which can't load the tray, and
581hence for this drive the *cdrom_device_info* struct will have set
582the *CDC_CLOSE_TRAY* bit in *mask*.
583
584In the file `cdrom.c` you will encounter many constructions of the type::
585
586 if (cdo->capability & ∼cdi->mask & CDC _⟨capability⟩) ...
587
588There is no *ioctl* to set the mask... The reason is that
589I think it is better to control the **behavior** rather than the
590**capabilities**.
591
592Options
593-------
594
595A final flag register controls the **behavior** of the CD-ROM
596drives, in order to satisfy different users' wishes, hopefully
597independently of the ideas of the respective author who happened to
598have made the drive's support available to the Linux community. The
599current behavior options are::
600
601 CDO_AUTO_CLOSE /* try to close tray upon device open() */
602 CDO_AUTO_EJECT /* try to open tray on last device close() */
603 CDO_USE_FFLAGS /* use file_pointer->f_flags to indicate purpose for open() */
604 CDO_LOCK /* try to lock door if device is opened */
605 CDO_CHECK_TYPE /* ensure disc type is data if opened for data */
606
607The initial value of this register is
608`CDO_AUTO_CLOSE | CDO_USE_FFLAGS | CDO_LOCK`, reflecting my own view on user
609interface and software standards. Before you protest, there are two
610new *ioctl()'s* implemented in `cdrom.c`, that allow you to control the
611behavior by software. These are::
612
613 CDROM_SET_OPTIONS /* set options specified in (int)arg */
614 CDROM_CLEAR_OPTIONS /* clear options specified in (int)arg */
615
616One option needs some more explanation: *CDO_USE_FFLAGS*. In the next
617newsection we explain what the need for this option is.
618
619A software package `setcd`, available from the Debian distribution
620and `sunsite.unc.edu`, allows user level control of these flags.
621
622
623The need to know the purpose of opening the CD-ROM device
624=========================================================
625
626Traditionally, Unix devices can be used in two different `modes`,
627either by reading/writing to the device file, or by issuing
628controlling commands to the device, by the device's *ioctl()*
629call. The problem with CD-ROM drives, is that they can be used for
630two entirely different purposes. One is to mount removable
631file systems, CD-ROM's, the other is to play audio CD's. Audio commands
632are implemented entirely through *ioctl()\'s*, presumably because the
633first implementation (SUN?) has been such. In principle there is
634nothing wrong with this, but a good control of the `CD player` demands
635that the device can **always** be opened in order to give the
636*ioctl* commands, regardless of the state the drive is in.
637
638On the other hand, when used as a removable-media disc drive (what the
639original purpose of CD-ROM s is) we would like to make sure that the
640disc drive is ready for operation upon opening the device. In the old
641scheme, some CD-ROM drivers don't do any integrity checking, resulting
642in a number of i/o errors reported by the VFS to the kernel when an
643attempt for mounting a CD-ROM on an empty drive occurs. This is not a
644particularly elegant way to find out that there is no CD-ROM inserted;
645it more-or-less looks like the old IBM-PC trying to read an empty floppy
646drive for a couple of seconds, after which the system complains it
647can't read from it. Nowadays we can **sense** the existence of a
648removable medium in a drive, and we believe we should exploit that
649fact. An integrity check on opening of the device, that verifies the
650availability of a CD-ROM and its correct type (data), would be
651desirable.
652
653These two ways of using a CD-ROM drive, principally for data and
654secondarily for playing audio discs, have different demands for the
655behavior of the *open()* call. Audio use simply wants to open the
656device in order to get a file handle which is needed for issuing
657*ioctl* commands, while data use wants to open for correct and
658reliable data transfer. The only way user programs can indicate what
659their *purpose* of opening the device is, is through the *flags*
660parameter (see `open(2)`). For CD-ROM devices, these flags aren't
661implemented (some drivers implement checking for write-related flags,
662but this is not strictly necessary if the device file has correct
663permission flags). Most option flags simply don't make sense to
664CD-ROM devices: *O_CREAT*, *O_NOCTTY*, *O_TRUNC*, *O_APPEND*, and
665*O_SYNC* have no meaning to a CD-ROM.
666
667We therefore propose to use the flag *O_NONBLOCK* to indicate
668that the device is opened just for issuing *ioctl*
669commands. Strictly, the meaning of *O_NONBLOCK* is that opening and
670subsequent calls to the device don't cause the calling process to
671wait. We could interpret this as don't wait until someone has
672inserted some valid data-CD-ROM. Thus, our proposal of the
673implementation for the *open()* call for CD-ROM s is:
674
675- If no other flags are set than *O_RDONLY*, the device is opened
676 for data transfer, and the return value will be 0 only upon successful
677 initialization of the transfer. The call may even induce some actions
678 on the CD-ROM, such as closing the tray.
679- If the option flag *O_NONBLOCK* is set, opening will always be
680 successful, unless the whole device doesn't exist. The drive will take
681 no actions whatsoever.
682
683And what about standards?
684-------------------------
685
686You might hesitate to accept this proposal as it comes from the
687Linux community, and not from some standardizing institute. What
688about SUN, SGI, HP and all those other Unix and hardware vendors?
689Well, these companies are in the lucky position that they generally
690control both the hardware and software of their supported products,
691and are large enough to set their own standard. They do not have to
692deal with a dozen or more different, competing hardware
693configurations\ [#f3]_.
694
695.. [#f3]
696
697 Incidentally, I think that SUN's approach to mounting CD-ROM s is very
698 good in origin: under Solaris a volume-daemon automatically mounts a
699 newly inserted CD-ROM under `/cdrom/*<volume-name>*`.
700
701 In my opinion they should have pushed this
702 further and have **every** CD-ROM on the local area network be
703 mounted at the similar location, i. e., no matter in which particular
704 machine you insert a CD-ROM, it will always appear at the same
705 position in the directory tree, on every system. When I wanted to
706 implement such a user-program for Linux, I came across the
707 differences in behavior of the various drivers, and the need for an
708 *ioctl* informing about media changes.
709
710We believe that using *O_NONBLOCK* to indicate that a device is being opened
711for *ioctl* commands only can be easily introduced in the Linux
712community. All the CD-player authors will have to be informed, we can
713even send in our own patches to the programs. The use of *O_NONBLOCK*
714has most likely no influence on the behavior of the CD-players on
715other operating systems than Linux. Finally, a user can always revert
716to old behavior by a call to
717*ioctl(file_descriptor, CDROM_CLEAR_OPTIONS, CDO_USE_FFLAGS)*.
718
719The preferred strategy of *open()*
720----------------------------------
721
722The routines in `cdrom.c` are designed in such a way that run-time
723configuration of the behavior of CD-ROM devices (of **any** type)
724can be carried out, by the *CDROM_SET/CLEAR_OPTIONS* *ioctls*. Thus, various
725modes of operation can be set:
726
727`CDO_AUTO_CLOSE | CDO_USE_FFLAGS | CDO_LOCK`
728 This is the default setting. (With *CDO_CHECK_TYPE* it will be better, in
729 the future.) If the device is not yet opened by any other process, and if
730 the device is being opened for data (*O_NONBLOCK* is not set) and the
731 tray is found to be open, an attempt to close the tray is made. Then,
732 it is verified that a disc is in the drive and, if *CDO_CHECK_TYPE* is
733 set, that it contains tracks of type `data mode 1`. Only if all tests
734 are passed is the return value zero. The door is locked to prevent file
735 system corruption. If the drive is opened for audio (*O_NONBLOCK* is
736 set), no actions are taken and a value of 0 will be returned.
737
738`CDO_AUTO_CLOSE | CDO_AUTO_EJECT | CDO_LOCK`
739 This mimics the behavior of the current sbpcd-driver. The option flags are
740 ignored, the tray is closed on the first open, if necessary. Similarly,
741 the tray is opened on the last release, i. e., if a CD-ROM is unmounted,
742 it is automatically ejected, such that the user can replace it.
743
744We hope that these option can convince everybody (both driver
745maintainers and user program developers) to adopt the new CD-ROM
746driver scheme and option flag interpretation.
747
748Description of routines in `cdrom.c`
749====================================
750
751Only a few routines in `cdrom.c` are exported to the drivers. In this
752new section we will discuss these, as well as the functions that `take
753over' the CD-ROM interface to the kernel. The header file belonging
754to `cdrom.c` is called `cdrom.h`. Formerly, some of the contents of this
755file were placed in the file `ucdrom.h`, but this file has now been
756merged back into `cdrom.h`.
757
758::
759
760 struct file_operations cdrom_fops
761
762The contents of this structure were described in cdrom_api_.
763A pointer to this structure is assigned to the *fops* field
764of the *struct gendisk*.
765
766::
767
768 int register_cdrom(struct cdrom_device_info *cdi)
769
770This function is used in about the same way one registers *cdrom_fops*
771with the kernel, the device operations and information structures,
772as described in cdrom_api_, should be registered with the
773Uniform CD-ROM Driver::
774
775 register_cdrom(&<device>_info);
776
777
778This function returns zero upon success, and non-zero upon
779failure. The structure *<device>_info* should have a pointer to the
780driver's *<device>_dops*, as in::
781
782 struct cdrom_device_info <device>_info = {
783 <device>_dops;
784 ...
785 }
786
787Note that a driver must have one static structure, *<device>_dops*, while
788it may have as many structures *<device>_info* as there are minor devices
789active. *Register_cdrom()* builds a linked list from these.
790
791
792::
793
794 void unregister_cdrom(struct cdrom_device_info *cdi)
795
796Unregistering device *cdi* with minor number *MINOR(cdi->dev)* removes
797the minor device from the list. If it was the last registered minor for
798the low-level driver, this disconnects the registered device-operation
799routines from the CD-ROM interface. This function returns zero upon
800success, and non-zero upon failure.
801
802::
803
804 int cdrom_open(struct inode * ip, struct file * fp)
805
806This function is not called directly by the low-level drivers, it is
807listed in the standard *cdrom_fops*. If the VFS opens a file, this
808function becomes active. A strategy is implemented in this routine,
809taking care of all capabilities and options that are set in the
810*cdrom_device_ops* connected to the device. Then, the program flow is
811transferred to the device_dependent *open()* call.
812
813::
814
815 void cdrom_release(struct inode *ip, struct file *fp)
816
817This function implements the reverse-logic of *cdrom_open()*, and then
818calls the device-dependent *release()* routine. When the use-count has
819reached 0, the allocated buffers are flushed by calls to *sync_dev(dev)*
820and *invalidate_buffers(dev)*.
821
822
823.. _cdrom_ioctl:
824
825::
826
827 int cdrom_ioctl(struct inode *ip, struct file *fp,
828 unsigned int cmd, unsigned long arg)
829
830This function handles all the standard *ioctl* requests for CD-ROM
831devices in a uniform way. The different calls fall into three
832categories: *ioctl()'s* that can be directly implemented by device
833operations, ones that are routed through the call *audio_ioctl()*, and
834the remaining ones, that are presumable device-dependent. Generally, a
835negative return value indicates an error.
836
837Directly implemented *ioctl()'s*
838--------------------------------
839
840The following `old` CD-ROM *ioctl()*\ 's are implemented by directly
841calling device-operations in *cdrom_device_ops*, if implemented and
842not masked:
843
844`CDROMMULTISESSION`
845 Requests the last session on a CD-ROM.
846`CDROMEJECT`
847 Open tray.
848`CDROMCLOSETRAY`
849 Close tray.
850`CDROMEJECT_SW`
851 If *arg\not=0*, set behavior to auto-close (close
852 tray on first open) and auto-eject (eject on last release), otherwise
853 set behavior to non-moving on *open()* and *release()* calls.
854`CDROM_GET_MCN`
855 Get the Media Catalog Number from a CD.
856
857*Ioctl*s routed through *audio_ioctl()*
858---------------------------------------
859
860The following set of *ioctl()'s* are all implemented through a call to
861the *cdrom_fops* function *audio_ioctl()*. Memory checks and
862allocation are performed in *cdrom_ioctl()*, and also sanitization of
863address format (*CDROM_LBA*/*CDROM_MSF*) is done.
864
865`CDROMSUBCHNL`
866 Get sub-channel data in argument *arg* of type
867 `struct cdrom_subchnl *`.
868`CDROMREADTOCHDR`
869 Read Table of Contents header, in *arg* of type
870 `struct cdrom_tochdr *`.
871`CDROMREADTOCENTRY`
872 Read a Table of Contents entry in *arg* and specified by *arg*
873 of type `struct cdrom_tocentry *`.
874`CDROMPLAYMSF`
875 Play audio fragment specified in Minute, Second, Frame format,
876 delimited by *arg* of type `struct cdrom_msf *`.
877`CDROMPLAYTRKIND`
878 Play audio fragment in track-index format delimited by *arg*
879 of type `struct cdrom_ti *`.
880`CDROMVOLCTRL`
881 Set volume specified by *arg* of type `struct cdrom_volctrl *`.
882`CDROMVOLREAD`
883 Read volume into by *arg* of type `struct cdrom_volctrl *`.
884`CDROMSTART`
885 Spin up disc.
886`CDROMSTOP`
887 Stop playback of audio fragment.
888`CDROMPAUSE`
889 Pause playback of audio fragment.
890`CDROMRESUME`
891 Resume playing.
892
893New *ioctl()'s* in `cdrom.c`
894----------------------------
895
896The following *ioctl()'s* have been introduced to allow user programs to
897control the behavior of individual CD-ROM devices. New *ioctl*
898commands can be identified by the underscores in their names.
899
900`CDROM_SET_OPTIONS`
901 Set options specified by *arg*. Returns the option flag register
902 after modification. Use *arg = \rm0* for reading the current flags.
903`CDROM_CLEAR_OPTIONS`
904 Clear options specified by *arg*. Returns the option flag register
905 after modification.
906`CDROM_SELECT_SPEED`
907 Select head-rate speed of disc specified as by *arg* in units
908 of standard cdrom speed (176\,kB/sec raw data or
909 150kB/sec file system data). The value 0 means `auto-select`,
910 i. e., play audio discs at real time and data discs at maximum speed.
911 The value *arg* is checked against the maximum head rate of the
912 drive found in the *cdrom_dops*.
913`CDROM_SELECT_DISC`
914 Select disc numbered *arg* from a juke-box.
915
916 First disc is numbered 0. The number *arg* is checked against the
917 maximum number of discs in the juke-box found in the *cdrom_dops*.
918`CDROM_MEDIA_CHANGED`
919 Returns 1 if a disc has been changed since the last call.
920 Note that calls to *cdrom_media_changed* by the VFS are treated
921 by an independent queue, so both mechanisms will detect a
922 media change once. For juke-boxes, an extra argument *arg*
923 specifies the slot for which the information is given. The special
924 value *CDSL_CURRENT* requests that information about the currently
925 selected slot be returned.
926`CDROM_DRIVE_STATUS`
927 Returns the status of the drive by a call to
928 *drive_status()*. Return values are defined in cdrom_drive_status_.
929 Note that this call doesn't return information on the
930 current playing activity of the drive; this can be polled through
931 an *ioctl* call to *CDROMSUBCHNL*. For juke-boxes, an extra argument
932 *arg* specifies the slot for which (possibly limited) information is
933 given. The special value *CDSL_CURRENT* requests that information
934 about the currently selected slot be returned.
935`CDROM_DISC_STATUS`
936 Returns the type of the disc currently in the drive.
937 It should be viewed as a complement to *CDROM_DRIVE_STATUS*.
938 This *ioctl* can provide *some* information about the current
939 disc that is inserted in the drive. This functionality used to be
940 implemented in the low level drivers, but is now carried out
941 entirely in Uniform CD-ROM Driver.
942
943 The history of development of the CD's use as a carrier medium for
944 various digital information has lead to many different disc types.
945 This *ioctl* is useful only in the case that CDs have \emph {only
946 one} type of data on them. While this is often the case, it is
947 also very common for CDs to have some tracks with data, and some
948 tracks with audio. Because this is an existing interface, rather
949 than fixing this interface by changing the assumptions it was made
950 under, thereby breaking all user applications that use this
951 function, the Uniform CD-ROM Driver implements this *ioctl* as
952 follows: If the CD in question has audio tracks on it, and it has
953 absolutely no CD-I, XA, or data tracks on it, it will be reported
954 as *CDS_AUDIO*. If it has both audio and data tracks, it will
955 return *CDS_MIXED*. If there are no audio tracks on the disc, and
956 if the CD in question has any CD-I tracks on it, it will be
957 reported as *CDS_XA_2_2*. Failing that, if the CD in question
958 has any XA tracks on it, it will be reported as *CDS_XA_2_1*.
959 Finally, if the CD in question has any data tracks on it,
960 it will be reported as a data CD (*CDS_DATA_1*).
961
962 This *ioctl* can return::
963
964 CDS_NO_INFO /* no information available */
965 CDS_NO_DISC /* no disc is inserted, or tray is opened */
966 CDS_AUDIO /* Audio disc (2352 audio bytes/frame) */
967 CDS_DATA_1 /* data disc, mode 1 (2048 user bytes/frame) */
968 CDS_XA_2_1 /* mixed data (XA), mode 2, form 1 (2048 user bytes) */
969 CDS_XA_2_2 /* mixed data (XA), mode 2, form 1 (2324 user bytes) */
970 CDS_MIXED /* mixed audio/data disc */
971
972 For some information concerning frame layout of the various disc
973 types, see a recent version of `cdrom.h`.
974
975`CDROM_CHANGER_NSLOTS`
976 Returns the number of slots in a juke-box.
977`CDROMRESET`
978 Reset the drive.
979`CDROM_GET_CAPABILITY`
980 Returns the *capability* flags for the drive. Refer to section
981 cdrom_capabilities_ for more information on these flags.
982`CDROM_LOCKDOOR`
983 Locks the door of the drive. `arg == 0` unlocks the door,
984 any other value locks it.
985`CDROM_DEBUG`
986 Turns on debugging info. Only root is allowed to do this.
987 Same semantics as CDROM_LOCKDOOR.
988
989
990Device dependent *ioctl()'s*
991----------------------------
992
993Finally, all other *ioctl()'s* are passed to the function *dev_ioctl()*,
994if implemented. No memory allocation or verification is carried out.
995
996How to update your driver
997=========================
998
999- Make a backup of your current driver.
1000- Get hold of the files `cdrom.c` and `cdrom.h`, they should be in
1001 the directory tree that came with this documentation.
1002- Make sure you include `cdrom.h`.
1003- Change the 3rd argument of *register_blkdev* from `&<your-drive>_fops`
1004 to `&cdrom_fops`.
1005- Just after that line, add the following to register with the Uniform
1006 CD-ROM Driver::
1007
1008 register_cdrom(&<your-drive>_info);*
1009
1010 Similarly, add a call to *unregister_cdrom()* at the appropriate place.
1011- Copy an example of the device-operations *struct* to your
1012 source, e. g., from `cm206.c` *cm206_dops*, and change all
1013 entries to names corresponding to your driver, or names you just
1014 happen to like. If your driver doesn't support a certain function,
1015 make the entry *NULL*. At the entry *capability* you should list all
1016 capabilities your driver currently supports. If your driver
1017 has a capability that is not listed, please send me a message.
1018- Copy the *cdrom_device_info* declaration from the same example
1019 driver, and modify the entries according to your needs. If your
1020 driver dynamically determines the capabilities of the hardware, this
1021 structure should also be declared dynamically.
1022- Implement all functions in your `<device>_dops` structure,
1023 according to prototypes listed in `cdrom.h`, and specifications given
1024 in cdrom_api_. Most likely you have already implemented
1025 the code in a large part, and you will almost certainly need to adapt the
1026 prototype and return values.
1027- Rename your `<device>_ioctl()` function to *audio_ioctl* and
1028 change the prototype a little. Remove entries listed in the first
1029 part in cdrom_ioctl_, if your code was OK, these are
1030 just calls to the routines you adapted in the previous step.
1031- You may remove all remaining memory checking code in the
1032 *audio_ioctl()* function that deals with audio commands (these are
1033 listed in the second part of cdrom_ioctl_. There is no
1034 need for memory allocation either, so most *case*s in the *switch*
1035 statement look similar to::
1036
1037 case CDROMREADTOCENTRY:
1038 get_toc_entry\bigl((struct cdrom_tocentry *) arg);
1039
1040- All remaining *ioctl* cases must be moved to a separate
1041 function, *<device>_ioctl*, the device-dependent *ioctl()'s*. Note that
1042 memory checking and allocation must be kept in this code!
1043- Change the prototypes of *<device>_open()* and
1044 *<device>_release()*, and remove any strategic code (i. e., tray
1045 movement, door locking, etc.).
1046- Try to recompile the drivers. We advise you to use modules, both
1047 for `cdrom.o` and your driver, as debugging is much easier this
1048 way.
1049
1050Thanks
1051======
1052
1053Thanks to all the people involved. First, Erik Andersen, who has
1054taken over the torch in maintaining `cdrom.c` and integrating much
1055CD-ROM-related code in the 2.1-kernel. Thanks to Scott Snyder and
1056Gerd Knorr, who were the first to implement this interface for SCSI
1057and IDE-CD drivers and added many ideas for extension of the data
1058structures relative to kernel~2.0. Further thanks to Heiko Eißfeldt,
1059Thomas Quinot, Jon Tombs, Ken Pizzini, Eberhard Mönkeberg and Andrew Kroll,
1060the Linux CD-ROM device driver developers who were kind
1061enough to give suggestions and criticisms during the writing. Finally
1062of course, I want to thank Linus Torvalds for making this possible in
1063the first place.
diff --git a/Documentation/cdrom/cdrom-standard.tex b/Documentation/cdrom/cdrom-standard.tex
deleted file mode 100644
index f7cd455973f7..000000000000
--- a/Documentation/cdrom/cdrom-standard.tex
+++ /dev/null
@@ -1,1026 +0,0 @@
1\documentclass{article}
2\def\version{$Id: cdrom-standard.tex,v 1.9 1997/12/28 15:42:49 david Exp $}
3\newcommand{\newsection}[1]{\newpage\section{#1}}
4
5\evensidemargin=0pt
6\oddsidemargin=0pt
7\topmargin=-\headheight \advance\topmargin by -\headsep
8\textwidth=15.99cm \textheight=24.62cm % normal A4, 1'' margin
9
10\def\linux{{\sc Linux}}
11\def\cdrom{{\sc cd-rom}}
12\def\UCD{{\sc Uniform cd-rom Driver}}
13\def\cdromc{{\tt {cdrom.c}}}
14\def\cdromh{{\tt {cdrom.h}}}
15\def\fo{\sl} % foreign words
16\def\ie{{\fo i.e.}}
17\def\eg{{\fo e.g.}}
18
19\everymath{\it} \everydisplay{\it}
20\catcode `\_=\active \def_{\_\penalty100 }
21\catcode`\<=\active \def<#1>{{\langle\hbox{\rm#1}\rangle}}
22
23\begin{document}
24\title{A \linux\ \cdrom\ standard}
25\author{David van Leeuwen\\{\normalsize\tt david@ElseWare.cistron.nl}
26\\{\footnotesize updated by Erik Andersen {\tt(andersee@debian.org)}}
27\\{\footnotesize updated by Jens Axboe {\tt(axboe@image.dk)}}}
28\date{12 March 1999}
29
30\maketitle
31
32\newsection{Introduction}
33
34\linux\ is probably the Unix-like operating system that supports
35the widest variety of hardware devices. The reasons for this are
36presumably
37\begin{itemize}
38\item
39 The large list of hardware devices available for the many platforms
40 that \linux\ now supports (\ie, i386-PCs, Sparc Suns, etc.)
41\item
42 The open design of the operating system, such that anybody can write a
43 driver for \linux.
44\item
45 There is plenty of source code around as examples of how to write a driver.
46\end{itemize}
47The openness of \linux, and the many different types of available
48hardware has allowed \linux\ to support many different hardware devices.
49Unfortunately, the very openness that has allowed \linux\ to support
50all these different devices has also allowed the behavior of each
51device driver to differ significantly from one device to another.
52This divergence of behavior has been very significant for \cdrom\
53devices; the way a particular drive reacts to a `standard' $ioctl()$
54call varies greatly from one device driver to another. To avoid making
55their drivers totally inconsistent, the writers of \linux\ \cdrom\
56drivers generally created new device drivers by understanding, copying,
57and then changing an existing one. Unfortunately, this practice did not
58maintain uniform behavior across all the \linux\ \cdrom\ drivers.
59
60This document describes an effort to establish Uniform behavior across
61all the different \cdrom\ device drivers for \linux. This document also
62defines the various $ioctl$s, and how the low-level \cdrom\ device
63drivers should implement them. Currently (as of the \linux\ 2.1.$x$
64development kernels) several low-level \cdrom\ device drivers, including
65both IDE/ATAPI and SCSI, now use this Uniform interface.
66
67When the \cdrom\ was developed, the interface between the \cdrom\ drive
68and the computer was not specified in the standards. As a result, many
69different \cdrom\ interfaces were developed. Some of them had their
70own proprietary design (Sony, Mitsumi, Panasonic, Philips), other
71manufacturers adopted an existing electrical interface and changed
72the functionality (CreativeLabs/SoundBlaster, Teac, Funai) or simply
73adapted their drives to one or more of the already existing electrical
74interfaces (Aztech, Sanyo, Funai, Vertos, Longshine, Optics Storage and
75most of the `NoName' manufacturers). In cases where a new drive really
76brought its own interface or used its own command set and flow control
77scheme, either a separate driver had to be written, or an existing
78driver had to be enhanced. History has delivered us \cdrom\ support for
79many of these different interfaces. Nowadays, almost all new \cdrom\
80drives are either IDE/ATAPI or SCSI, and it is very unlikely that any
81manufacturer will create a new interface. Even finding drives for the
82old proprietary interfaces is getting difficult.
83
84When (in the 1.3.70's) I looked at the existing software interface,
85which was expressed through \cdromh, it appeared to be a rather wild
86set of commands and data formats.\footnote{I cannot recollect what
87kernel version I looked at, then, presumably 1.2.13 and 1.3.34---the
88latest kernel that I was indirectly involved in.} It seemed that many
89features of the software interface had been added to accommodate the
90capabilities of a particular drive, in an {\fo ad hoc\/} manner. More
91importantly, it appeared that the behavior of the `standard' commands
92was different for most of the different drivers: \eg, some drivers
93close the tray if an $open()$ call occurs when the tray is open, while
94others do not. Some drivers lock the door upon opening the device, to
95prevent an incoherent file system, but others don't, to allow software
96ejection. Undoubtedly, the capabilities of the different drives vary,
97but even when two drives have the same capability their drivers'
98behavior was usually different.
99
100I decided to start a discussion on how to make all the \linux\ \cdrom\
101drivers behave more uniformly. I began by contacting the developers of
102the many \cdrom\ drivers found in the \linux\ kernel. Their reactions
103encouraged me to write the \UCD\ which this document is intended to
104describe. The implementation of the \UCD\ is in the file \cdromc. This
105driver is intended to be an additional software layer that sits on top
106of the low-level device drivers for each \cdrom\ drive. By adding this
107additional layer, it is possible to have all the different \cdrom\
108devices behave {\em exactly\/} the same (insofar as the underlying
109hardware will allow).
110
111The goal of the \UCD\ is {\em not\/} to alienate driver developers who
112have not yet taken steps to support this effort. The goal of \UCD\ is
113simply to give people writing application programs for \cdrom\ drives
114{\em one\/} \linux\ \cdrom\ interface with consistent behavior for all
115\cdrom\ devices. In addition, this also provides a consistent interface
116between the low-level device driver code and the \linux\ kernel. Care
117is taken that 100\,\% compatibility exists with the data structures and
118programmer's interface defined in \cdromh. This guide was written to
119help \cdrom\ driver developers adapt their code to use the \UCD\ code
120defined in \cdromc.
121
122Personally, I think that the most important hardware interfaces are
123the IDE/ATAPI drives and, of course, the SCSI drives, but as prices
124of hardware drop continuously, it is also likely that people may have
125more than one \cdrom\ drive, possibly of mixed types. It is important
126that these drives behave in the same way. In December 1994, one of the
127cheapest \cdrom\ drives was a Philips cm206, a double-speed proprietary
128drive. In the months that I was busy writing a \linux\ driver for it,
129proprietary drives became obsolete and IDE/ATAPI drives became the
130standard. At the time of the last update to this document (November
1311997) it is becoming difficult to even {\em find} anything less than a
13216 speed \cdrom\ drive, and 24 speed drives are common.
133
134\newsection{Standardizing through another software level}
135\label{cdrom.c}
136
137At the time this document was conceived, all drivers directly
138implemented the \cdrom\ $ioctl()$ calls through their own routines. This
139led to the danger of different drivers forgetting to do important things
140like checking that the user was giving the driver valid data. More
141importantly, this led to the divergence of behavior, which has already
142been discussed.
143
144For this reason, the \UCD\ was created to enforce consistent \cdrom\
145drive behavior, and to provide a common set of services to the various
146low-level \cdrom\ device drivers. The \UCD\ now provides another
147software-level, that separates the $ioctl()$ and $open()$ implementation
148from the actual hardware implementation. Note that this effort has
149made few changes which will affect a user's application programs. The
150greatest change involved moving the contents of the various low-level
151\cdrom\ drivers' header files to the kernel's cdrom directory. This was
152done to help ensure that the user is only presented with only one cdrom
153interface, the interface defined in \cdromh.
154
155\cdrom\ drives are specific enough (\ie, different from other
156block-devices such as floppy or hard disc drives), to define a set
157of common {\em \cdrom\ device operations}, $<cdrom-device>_dops$.
158These operations are different from the classical block-device file
159operations, $<block-device>_fops$.
160
161The routines for the \UCD\ interface level are implemented in the file
162\cdromc. In this file, the \UCD\ interfaces with the kernel as a block
163device by registering the following general $struct\ file_operations$:
164$$
165\halign{$#$\ \hfil&$#$\ \hfil&$/*$ \rm# $*/$\hfil\cr
166struct& file_operations\ cdrom_fops = \{\hidewidth\cr
167 &NULL, & lseek \cr
168 &block_read, & read---general block-dev read \cr
169 &block_write, & write---general block-dev write \cr
170 &NULL, & readdir \cr
171 &NULL, & select \cr
172 &cdrom_ioctl, & ioctl \cr
173 &NULL, & mmap \cr
174 &cdrom_open, & open \cr
175 &cdrom_release, & release \cr
176 &NULL, & fsync \cr
177 &NULL, & fasync \cr
178 &cdrom_media_changed, & media change \cr
179 &NULL & revalidate \cr
180\};\cr
181}
182$$
183
184Every active \cdrom\ device shares this $struct$. The routines
185declared above are all implemented in \cdromc, since this file is the
186place where the behavior of all \cdrom-devices is defined and
187standardized. The actual interface to the various types of \cdrom\
188hardware is still performed by various low-level \cdrom-device
189drivers. These routines simply implement certain {\em capabilities\/}
190that are common to all \cdrom\ (and really, all removable-media
191devices).
192
193Registration of a low-level \cdrom\ device driver is now done through
194the general routines in \cdromc, not through the Virtual File System
195(VFS) any more. The interface implemented in \cdromc\ is carried out
196through two general structures that contain information about the
197capabilities of the driver, and the specific drives on which the
198driver operates. The structures are:
199\begin{description}
200\item[$cdrom_device_ops$]
201 This structure contains information about the low-level driver for a
202 \cdrom\ device. This structure is conceptually connected to the major
203 number of the device (although some drivers may have different
204 major numbers, as is the case for the IDE driver).
205\item[$cdrom_device_info$]
206 This structure contains information about a particular \cdrom\ drive,
207 such as its device name, speed, etc. This structure is conceptually
208 connected to the minor number of the device.
209\end{description}
210
211Registering a particular \cdrom\ drive with the \UCD\ is done by the
212low-level device driver though a call to:
213$$register_cdrom(struct\ cdrom_device_info * <device>_info)
214$$
215The device information structure, $<device>_info$, contains all the
216information needed for the kernel to interface with the low-level
217\cdrom\ device driver. One of the most important entries in this
218structure is a pointer to the $cdrom_device_ops$ structure of the
219low-level driver.
220
221The device operations structure, $cdrom_device_ops$, contains a list
222of pointers to the functions which are implemented in the low-level
223device driver. When \cdromc\ accesses a \cdrom\ device, it does it
224through the functions in this structure. It is impossible to know all
225the capabilities of future \cdrom\ drives, so it is expected that this
226list may need to be expanded from time to time as new technologies are
227developed. For example, CD-R and CD-R/W drives are beginning to become
228popular, and support will soon need to be added for them. For now, the
229current $struct$ is:
230$$
231\halign{$#$\ \hfil&$#$\ \hfil&\hbox to 10em{$#$\hss}&
232 $/*$ \rm# $*/$\hfil\cr
233struct& cdrom_device_ops\ \{ \hidewidth\cr
234 &int& (* open)(struct\ cdrom_device_info *, int)\cr
235 &void& (* release)(struct\ cdrom_device_info *);\cr
236 &int& (* drive_status)(struct\ cdrom_device_info *, int);\cr
237 &unsigned\ int& (* check_events)(struct\ cdrom_device_info *, unsigned\ int, int);\cr
238 &int& (* media_changed)(struct\ cdrom_device_info *, int);\cr
239 &int& (* tray_move)(struct\ cdrom_device_info *, int);\cr
240 &int& (* lock_door)(struct\ cdrom_device_info *, int);\cr
241 &int& (* select_speed)(struct\ cdrom_device_info *, int);\cr
242 &int& (* select_disc)(struct\ cdrom_device_info *, int);\cr
243 &int& (* get_last_session) (struct\ cdrom_device_info *,
244 struct\ cdrom_multisession *{});\cr
245 &int& (* get_mcn)(struct\ cdrom_device_info *, struct\ cdrom_mcn *{});\cr
246 &int& (* reset)(struct\ cdrom_device_info *);\cr
247 &int& (* audio_ioctl)(struct\ cdrom_device_info *, unsigned\ int,
248 void *{});\cr
249\noalign{\medskip}
250 &const\ int& capability;& capability flags \cr
251 &int& (* generic_packet)(struct\ cdrom_device_info *, struct\ packet_command *{});\cr
252\};\cr
253}
254$$
255When a low-level device driver implements one of these capabilities,
256it should add a function pointer to this $struct$. When a particular
257function is not implemented, however, this $struct$ should contain a
258NULL instead. The $capability$ flags specify the capabilities of the
259\cdrom\ hardware and/or low-level \cdrom\ driver when a \cdrom\ drive
260is registered with the \UCD.
261
262Note that most functions have fewer parameters than their
263$blkdev_fops$ counterparts. This is because very little of the
264information in the structures $inode$ and $file$ is used. For most
265drivers, the main parameter is the $struct$ $cdrom_device_info$, from
266which the major and minor number can be extracted. (Most low-level
267\cdrom\ drivers don't even look at the major and minor number though,
268since many of them only support one device.) This will be available
269through $dev$ in $cdrom_device_info$ described below.
270
271The drive-specific, minor-like information that is registered with
272\cdromc, currently contains the following fields:
273$$
274\halign{$#$\ \hfil&$#$\ \hfil&\hbox to 10em{$#$\hss}&
275 $/*$ \rm# $*/$\hfil\cr
276struct& cdrom_device_info\ \{ \hidewidth\cr
277 & const\ struct\ cdrom_device_ops *& ops;& device operations for this major\cr
278 & struct\ list_head& list;& linked list of all device_info\cr
279 & struct\ gendisk *& disk;& matching block layer disk\cr
280 & void *& handle;& driver-dependent data\cr
281\noalign{\medskip}
282 & int& mask;& mask of capability: disables them \cr
283 & int& speed;& maximum speed for reading data \cr
284 & int& capacity;& number of discs in a jukebox \cr
285\noalign{\medskip}
286 &unsigned\ int& options : 30;& options flags \cr
287 &unsigned& mc_flags : 2;& media-change buffer flags \cr
288 &unsigned\ int& vfs_events;& cached events for vfs path\cr
289 &unsigned\ int& ioctl_events;& cached events for ioctl path\cr
290 & int& use_count;& number of times device is opened\cr
291 & char& name[20];& name of the device type\cr
292\noalign{\medskip}
293 &__u8& sanyo_slot : 2;& Sanyo 3-CD changer support\cr
294 &__u8& keeplocked : 1;& CDROM_LOCKDOOR status\cr
295 &__u8& reserved : 5;& not used yet\cr
296 & int& cdda_method;& see CDDA_* flags\cr
297 &__u8& last_sense;& saves last sense key\cr
298 &__u8& media_written;& dirty flag, DVD+RW bookkeeping\cr
299 &unsigned\ short& mmc3_profile;& current MMC3 profile\cr
300 & int& for_data;& unknown:TBD\cr
301 & int\ (* exit)\ (struct\ cdrom_device_info *);&& unknown:TBD\cr
302 & int& mrw_mode_page;& which MRW mode page is in use\cr
303\}\cr
304}$$
305Using this $struct$, a linked list of the registered minor devices is
306built, using the $next$ field. The device number, the device operations
307struct and specifications of properties of the drive are stored in this
308structure.
309
310The $mask$ flags can be used to mask out some of the capabilities listed
311in $ops\to capability$, if a specific drive doesn't support a feature
312of the driver. The value $speed$ specifies the maximum head-rate of the
313drive, measured in units of normal audio speed (176\,kB/sec raw data or
314150\,kB/sec file system data). The parameters are declared $const$
315because they describe properties of the drive, which don't change after
316registration.
317
318A few registers contain variables local to the \cdrom\ drive. The
319flags $options$ are used to specify how the general \cdrom\ routines
320should behave. These various flags registers should provide enough
321flexibility to adapt to the different users' wishes (and {\em not\/} the
322`arbitrary' wishes of the author of the low-level device driver, as is
323the case in the old scheme). The register $mc_flags$ is used to buffer
324the information from $media_changed()$ to two separate queues. Other
325data that is specific to a minor drive, can be accessed through $handle$,
326which can point to a data structure specific to the low-level driver.
327The fields $use_count$, $next$, $options$ and $mc_flags$ need not be
328initialized.
329
330The intermediate software layer that \cdromc\ forms will perform some
331additional bookkeeping. The use count of the device (the number of
332processes that have the device opened) is registered in $use_count$. The
333function $cdrom_ioctl()$ will verify the appropriate user-memory regions
334for read and write, and in case a location on the CD is transferred,
335it will `sanitize' the format by making requests to the low-level
336drivers in a standard format, and translating all formats between the
337user-software and low level drivers. This relieves much of the drivers'
338memory checking and format checking and translation. Also, the necessary
339structures will be declared on the program stack.
340
341The implementation of the functions should be as defined in the
342following sections. Two functions {\em must\/} be implemented, namely
343$open()$ and $release()$. Other functions may be omitted, their
344corresponding capability flags will be cleared upon registration.
345Generally, a function returns zero on success and negative on error. A
346function call should return only after the command has completed, but of
347course waiting for the device should not use processor time.
348
349\subsection{$Int\ open(struct\ cdrom_device_info * cdi, int\ purpose)$}
350
351$Open()$ should try to open the device for a specific $purpose$, which
352can be either:
353\begin{itemize}
354\item[0] Open for reading data, as done by {\tt {mount()}} (2), or the
355user commands {\tt {dd}} or {\tt {cat}}.
356\item[1] Open for $ioctl$ commands, as done by audio-CD playing
357programs.
358\end{itemize}
359Notice that any strategic code (closing tray upon $open()$, etc.)\ is
360done by the calling routine in \cdromc, so the low-level routine
361should only be concerned with proper initialization, such as spinning
362up the disc, etc. % and device-use count
363
364
365\subsection{$Void\ release(struct\ cdrom_device_info * cdi)$}
366
367
368Device-specific actions should be taken such as spinning down the device.
369However, strategic actions such as ejection of the tray, or unlocking
370the door, should be left over to the general routine $cdrom_release()$.
371This is the only function returning type $void$.
372
373\subsection{$Int\ drive_status(struct\ cdrom_device_info * cdi, int\ slot_nr)$}
374\label{drive status}
375
376The function $drive_status$, if implemented, should provide
377information on the status of the drive (not the status of the disc,
378which may or may not be in the drive). If the drive is not a changer,
379$slot_nr$ should be ignored. In \cdromh\ the possibilities are listed:
380$$
381\halign{$#$\ \hfil&$/*$ \rm# $*/$\hfil\cr
382CDS_NO_INFO& no information available\cr
383CDS_NO_DISC& no disc is inserted, tray is closed\cr
384CDS_TRAY_OPEN& tray is opened\cr
385CDS_DRIVE_NOT_READY& something is wrong, tray is moving?\cr
386CDS_DISC_OK& a disc is loaded and everything is fine\cr
387}
388$$
389
390\subsection{$Int\ media_changed(struct\ cdrom_device_info * cdi, int\ disc_nr)$}
391
392This function is very similar to the original function in $struct\
393file_operations$. It returns 1 if the medium of the device $cdi\to
394dev$ has changed since the last call, and 0 otherwise. The parameter
395$disc_nr$ identifies a specific slot in a juke-box, it should be
396ignored for single-disc drives. Note that by `re-routing' this
397function through $cdrom_media_changed()$, we can implement separate
398queues for the VFS and a new $ioctl()$ function that can report device
399changes to software (\eg, an auto-mounting daemon).
400
401\subsection{$Int\ tray_move(struct\ cdrom_device_info * cdi, int\ position)$}
402
403This function, if implemented, should control the tray movement. (No
404other function should control this.) The parameter $position$ controls
405the desired direction of movement:
406\begin{itemize}
407\item[0] Close tray
408\item[1] Open tray
409\end{itemize}
410This function returns 0 upon success, and a non-zero value upon
411error. Note that if the tray is already in the desired position, no
412action need be taken, and the return value should be 0.
413
414\subsection{$Int\ lock_door(struct\ cdrom_device_info * cdi, int\ lock)$}
415
416This function (and no other code) controls locking of the door, if the
417drive allows this. The value of $lock$ controls the desired locking
418state:
419\begin{itemize}
420\item[0] Unlock door, manual opening is allowed
421\item[1] Lock door, tray cannot be ejected manually
422\end{itemize}
423This function returns 0 upon success, and a non-zero value upon
424error. Note that if the door is already in the requested state, no
425action need be taken, and the return value should be 0.
426
427\subsection{$Int\ select_speed(struct\ cdrom_device_info * cdi, int\ speed)$}
428
429Some \cdrom\ drives are capable of changing their head-speed. There
430are several reasons for changing the speed of a \cdrom\ drive. Badly
431pressed \cdrom s may benefit from less-than-maximum head rate. Modern
432\cdrom\ drives can obtain very high head rates (up to $24\times$ is
433common). It has been reported that these drives can make reading
434errors at these high speeds, reducing the speed can prevent data loss
435in these circumstances. Finally, some of these drives can
436make an annoyingly loud noise, which a lower speed may reduce. %Finally,
437%although the audio-low-pass filters probably aren't designed for it,
438%more than real-time playback of audio might be used for high-speed
439%copying of audio tracks.
440
441This function specifies the speed at which data is read or audio is
442played back. The value of $speed$ specifies the head-speed of the
443drive, measured in units of standard cdrom speed (176\,kB/sec raw data
444or 150\,kB/sec file system data). So to request that a \cdrom\ drive
445operate at 300\,kB/sec you would call the CDROM_SELECT_SPEED $ioctl$
446with $speed=2$. The special value `0' means `auto-selection', \ie,
447maximum data-rate or real-time audio rate. If the drive doesn't have
448this `auto-selection' capability, the decision should be made on the
449current disc loaded and the return value should be positive. A negative
450return value indicates an error.
451
452\subsection{$Int\ select_disc(struct\ cdrom_device_info * cdi, int\ number)$}
453
454If the drive can store multiple discs (a juke-box) this function
455will perform disc selection. It should return the number of the
456selected disc on success, a negative value on error. Currently, only
457the ide-cd driver supports this functionality.
458
459\subsection{$Int\ get_last_session(struct\ cdrom_device_info * cdi, struct\
460 cdrom_multisession * ms_info)$}
461
462This function should implement the old corresponding $ioctl()$. For
463device $cdi\to dev$, the start of the last session of the current disc
464should be returned in the pointer argument $ms_info$. Note that
465routines in \cdromc\ have sanitized this argument: its requested
466format will {\em always\/} be of the type $CDROM_LBA$ (linear block
467addressing mode), whatever the calling software requested. But
468sanitization goes even further: the low-level implementation may
469return the requested information in $CDROM_MSF$ format if it wishes so
470(setting the $ms_info\rightarrow addr_format$ field appropriately, of
471course) and the routines in \cdromc\ will make the transformation if
472necessary. The return value is 0 upon success.
473
474\subsection{$Int\ get_mcn(struct\ cdrom_device_info * cdi, struct\
475 cdrom_mcn * mcn)$}
476
477Some discs carry a `Media Catalog Number' (MCN), also called
478`Universal Product Code' (UPC). This number should reflect the number
479that is generally found in the bar-code on the product. Unfortunately,
480the few discs that carry such a number on the disc don't even use the
481same format. The return argument to this function is a pointer to a
482pre-declared memory region of type $struct\ cdrom_mcn$. The MCN is
483expected as a 13-character string, terminated by a null-character.
484
485\subsection{$Int\ reset(struct\ cdrom_device_info * cdi)$}
486
487This call should perform a hard-reset on the drive (although in
488circumstances that a hard-reset is necessary, a drive may very well not
489listen to commands anymore). Preferably, control is returned to the
490caller only after the drive has finished resetting. If the drive is no
491longer listening, it may be wise for the underlying low-level cdrom
492driver to time out.
493
494\subsection{$Int\ audio_ioctl(struct\ cdrom_device_info * cdi, unsigned\
495 int\ cmd, void * arg)$}
496
497Some of the \cdrom-$ioctl$s defined in \cdromh\ can be
498implemented by the routines described above, and hence the function
499$cdrom_ioctl$ will use those. However, most $ioctl$s deal with
500audio-control. We have decided to leave these to be accessed through a
501single function, repeating the arguments $cmd$ and $arg$. Note that
502the latter is of type $void*{}$, rather than $unsigned\ long\
503int$. The routine $cdrom_ioctl()$ does do some useful things,
504though. It sanitizes the address format type to $CDROM_MSF$ (Minutes,
505Seconds, Frames) for all audio calls. It also verifies the memory
506location of $arg$, and reserves stack-memory for the argument. This
507makes implementation of the $audio_ioctl()$ much simpler than in the
508old driver scheme. For example, you may look up the function
509$cm206_audio_ioctl()$ in {\tt {cm206.c}} that should be updated with
510this documentation.
511
512An unimplemented ioctl should return $-ENOSYS$, but a harmless request
513(\eg, $CDROMSTART$) may be ignored by returning 0 (success). Other
514errors should be according to the standards, whatever they are. When
515an error is returned by the low-level driver, the \UCD\ tries whenever
516possible to return the error code to the calling program. (We may decide
517to sanitize the return value in $cdrom_ioctl()$ though, in order to
518guarantee a uniform interface to the audio-player software.)
519
520\subsection{$Int\ dev_ioctl(struct\ cdrom_device_info * cdi, unsigned\ int\
521 cmd, unsigned\ long\ arg)$}
522
523Some $ioctl$s seem to be specific to certain \cdrom\ drives. That is,
524they are introduced to service some capabilities of certain drives. In
525fact, there are 6 different $ioctl$s for reading data, either in some
526particular kind of format, or audio data. Not many drives support
527reading audio tracks as data, I believe this is because of protection
528of copyrights of artists. Moreover, I think that if audio-tracks are
529supported, it should be done through the VFS and not via $ioctl$s. A
530problem here could be the fact that audio-frames are 2352 bytes long,
531so either the audio-file-system should ask for 75264 bytes at once
532(the least common multiple of 512 and 2352), or the drivers should
533bend their backs to cope with this incoherence (to which I would be
534opposed). Furthermore, it is very difficult for the hardware to find
535the exact frame boundaries, since there are no synchronization headers
536in audio frames. Once these issues are resolved, this code should be
537standardized in \cdromc.
538
539Because there are so many $ioctl$s that seem to be introduced to
540satisfy certain drivers,\footnote{Is there software around that
541 actually uses these? I'd be interested!} any `non-standard' $ioctl$s
542are routed through the call $dev_ioctl()$. In principle, `private'
543$ioctl$s should be numbered after the device's major number, and not
544the general \cdrom\ $ioctl$ number, {\tt {0x53}}. Currently the
545non-supported $ioctl$s are: {\it CDROMREADMODE1, CDROMREADMODE2,
546 CDROMREADAUDIO, CDROMREADRAW, CDROMREADCOOKED, CDROMSEEK,
547 CDROMPLAY\-BLK and CDROM\-READALL}.
548
549
550\subsection{\cdrom\ capabilities}
551\label{capability}
552
553Instead of just implementing some $ioctl$ calls, the interface in
554\cdromc\ supplies the possibility to indicate the {\em capabilities\/}
555of a \cdrom\ drive. This can be done by ORing any number of
556capability-constants that are defined in \cdromh\ at the registration
557phase. Currently, the capabilities are any of:
558$$
559\halign{$#$\ \hfil&$/*$ \rm# $*/$\hfil\cr
560CDC_CLOSE_TRAY& can close tray by software control\cr
561CDC_OPEN_TRAY& can open tray\cr
562CDC_LOCK& can lock and unlock the door\cr
563CDC_SELECT_SPEED& can select speed, in units of $\sim$150\,kB/s\cr
564CDC_SELECT_DISC& drive is juke-box\cr
565CDC_MULTI_SESSION& can read sessions $>\rm1$\cr
566CDC_MCN& can read Media Catalog Number\cr
567CDC_MEDIA_CHANGED& can report if disc has changed\cr
568CDC_PLAY_AUDIO& can perform audio-functions (play, pause, etc)\cr
569CDC_RESET& hard reset device\cr
570CDC_IOCTLS& driver has non-standard ioctls\cr
571CDC_DRIVE_STATUS& driver implements drive status\cr
572}
573$$
574The capability flag is declared $const$, to prevent drivers from
575accidentally tampering with the contents. The capability fags actually
576inform \cdromc\ of what the driver can do. If the drive found
577by the driver does not have the capability, is can be masked out by
578the $cdrom_device_info$ variable $mask$. For instance, the SCSI \cdrom\
579driver has implemented the code for loading and ejecting \cdrom's, and
580hence its corresponding flags in $capability$ will be set. But a SCSI
581\cdrom\ drive might be a caddy system, which can't load the tray, and
582hence for this drive the $cdrom_device_info$ struct will have set
583the $CDC_CLOSE_TRAY$ bit in $mask$.
584
585In the file \cdromc\ you will encounter many constructions of the type
586$$\it
587if\ (cdo\rightarrow capability \mathrel\& \mathord{\sim} cdi\rightarrow mask
588 \mathrel{\&} CDC_<capability>) \ldots
589$$
590There is no $ioctl$ to set the mask\dots The reason is that
591I think it is better to control the {\em behavior\/} rather than the
592{\em capabilities}.
593
594\subsection{Options}
595
596A final flag register controls the {\em behavior\/} of the \cdrom\
597drives, in order to satisfy different users' wishes, hopefully
598independently of the ideas of the respective author who happened to
599have made the drive's support available to the \linux\ community. The
600current behavior options are:
601$$
602\halign{$#$\ \hfil&$/*$ \rm# $*/$\hfil\cr
603CDO_AUTO_CLOSE& try to close tray upon device $open()$\cr
604CDO_AUTO_EJECT& try to open tray on last device $close()$\cr
605CDO_USE_FFLAGS& use $file_pointer\rightarrow f_flags$ to indicate
606 purpose for $open()$\cr
607CDO_LOCK& try to lock door if device is opened\cr
608CDO_CHECK_TYPE& ensure disc type is data if opened for data\cr
609}
610$$
611
612The initial value of this register is $CDO_AUTO_CLOSE \mathrel|
613CDO_USE_FFLAGS \mathrel| CDO_LOCK$, reflecting my own view on user
614interface and software standards. Before you protest, there are two
615new $ioctl$s implemented in \cdromc, that allow you to control the
616behavior by software. These are:
617$$
618\halign{$#$\ \hfil&$/*$ \rm# $*/$\hfil\cr
619CDROM_SET_OPTIONS& set options specified in $(int)\ arg$\cr
620CDROM_CLEAR_OPTIONS& clear options specified in $(int)\ arg$\cr
621}
622$$
623One option needs some more explanation: $CDO_USE_FFLAGS$. In the next
624newsection we explain what the need for this option is.
625
626A software package {\tt setcd}, available from the Debian distribution
627and {\tt sunsite.unc.edu}, allows user level control of these flags.
628
629\newsection{The need to know the purpose of opening the \cdrom\ device}
630
631Traditionally, Unix devices can be used in two different `modes',
632either by reading/writing to the device file, or by issuing
633controlling commands to the device, by the device's $ioctl()$
634call. The problem with \cdrom\ drives, is that they can be used for
635two entirely different purposes. One is to mount removable
636file systems, \cdrom s, the other is to play audio CD's. Audio commands
637are implemented entirely through $ioctl$s, presumably because the
638first implementation (SUN?) has been such. In principle there is
639nothing wrong with this, but a good control of the `CD player' demands
640that the device can {\em always\/} be opened in order to give the
641$ioctl$ commands, regardless of the state the drive is in.
642
643On the other hand, when used as a removable-media disc drive (what the
644original purpose of \cdrom s is) we would like to make sure that the
645disc drive is ready for operation upon opening the device. In the old
646scheme, some \cdrom\ drivers don't do any integrity checking, resulting
647in a number of i/o errors reported by the VFS to the kernel when an
648attempt for mounting a \cdrom\ on an empty drive occurs. This is not a
649particularly elegant way to find out that there is no \cdrom\ inserted;
650it more-or-less looks like the old IBM-PC trying to read an empty floppy
651drive for a couple of seconds, after which the system complains it
652can't read from it. Nowadays we can {\em sense\/} the existence of a
653removable medium in a drive, and we believe we should exploit that
654fact. An integrity check on opening of the device, that verifies the
655availability of a \cdrom\ and its correct type (data), would be
656desirable.
657
658These two ways of using a \cdrom\ drive, principally for data and
659secondarily for playing audio discs, have different demands for the
660behavior of the $open()$ call. Audio use simply wants to open the
661device in order to get a file handle which is needed for issuing
662$ioctl$ commands, while data use wants to open for correct and
663reliable data transfer. The only way user programs can indicate what
664their {\em purpose\/} of opening the device is, is through the $flags$
665parameter (see {\tt {open(2)}}). For \cdrom\ devices, these flags aren't
666implemented (some drivers implement checking for write-related flags,
667but this is not strictly necessary if the device file has correct
668permission flags). Most option flags simply don't make sense to
669\cdrom\ devices: $O_CREAT$, $O_NOCTTY$, $O_TRUNC$, $O_APPEND$, and
670$O_SYNC$ have no meaning to a \cdrom.
671
672We therefore propose to use the flag $O_NONBLOCK$ to indicate
673that the device is opened just for issuing $ioctl$
674commands. Strictly, the meaning of $O_NONBLOCK$ is that opening and
675subsequent calls to the device don't cause the calling process to
676wait. We could interpret this as ``don't wait until someone has
677inserted some valid data-\cdrom.'' Thus, our proposal of the
678implementation for the $open()$ call for \cdrom s is:
679\begin{itemize}
680\item If no other flags are set than $O_RDONLY$, the device is opened
681for data transfer, and the return value will be 0 only upon successful
682initialization of the transfer. The call may even induce some actions
683on the \cdrom, such as closing the tray.
684\item If the option flag $O_NONBLOCK$ is set, opening will always be
685successful, unless the whole device doesn't exist. The drive will take
686no actions whatsoever.
687\end{itemize}
688
689\subsection{And what about standards?}
690
691You might hesitate to accept this proposal as it comes from the
692\linux\ community, and not from some standardizing institute. What
693about SUN, SGI, HP and all those other Unix and hardware vendors?
694Well, these companies are in the lucky position that they generally
695control both the hardware and software of their supported products,
696and are large enough to set their own standard. They do not have to
697deal with a dozen or more different, competing hardware
698configurations.\footnote{Incidentally, I think that SUN's approach to
699mounting \cdrom s is very good in origin: under Solaris a
700volume-daemon automatically mounts a newly inserted \cdrom\ under {\tt
701{/cdrom/$<volume-name>$/}}. In my opinion they should have pushed this
702further and have {\em every\/} \cdrom\ on the local area network be
703mounted at the similar location, \ie, no matter in which particular
704machine you insert a \cdrom, it will always appear at the same
705position in the directory tree, on every system. When I wanted to
706implement such a user-program for \linux, I came across the
707differences in behavior of the various drivers, and the need for an
708$ioctl$ informing about media changes.}
709
710We believe that using $O_NONBLOCK$ to indicate that a device is being opened
711for $ioctl$ commands only can be easily introduced in the \linux\
712community. All the CD-player authors will have to be informed, we can
713even send in our own patches to the programs. The use of $O_NONBLOCK$
714has most likely no influence on the behavior of the CD-players on
715other operating systems than \linux. Finally, a user can always revert
716to old behavior by a call to $ioctl(file_descriptor, CDROM_CLEAR_OPTIONS,
717CDO_USE_FFLAGS)$.
718
719\subsection{The preferred strategy of $open()$}
720
721The routines in \cdromc\ are designed in such a way that run-time
722configuration of the behavior of \cdrom\ devices (of {\em any\/} type)
723can be carried out, by the $CDROM_SET/CLEAR_OPTIONS$ $ioctls$. Thus, various
724modes of operation can be set:
725\begin{description}
726\item[$CDO_AUTO_CLOSE \mathrel| CDO_USE_FFLAGS \mathrel| CDO_LOCK$] This
727is the default setting. (With $CDO_CHECK_TYPE$ it will be better, in the
728future.) If the device is not yet opened by any other process, and if
729the device is being opened for data ($O_NONBLOCK$ is not set) and the
730tray is found to be open, an attempt to close the tray is made. Then,
731it is verified that a disc is in the drive and, if $CDO_CHECK_TYPE$ is
732set, that it contains tracks of type `data mode 1.' Only if all tests
733are passed is the return value zero. The door is locked to prevent file
734system corruption. If the drive is opened for audio ($O_NONBLOCK$ is
735set), no actions are taken and a value of 0 will be returned.
736\item[$CDO_AUTO_CLOSE \mathrel| CDO_AUTO_EJECT \mathrel| CDO_LOCK$] This
737mimics the behavior of the current sbpcd-driver. The option flags are
738ignored, the tray is closed on the first open, if necessary. Similarly,
739the tray is opened on the last release, \ie, if a \cdrom\ is unmounted,
740it is automatically ejected, such that the user can replace it.
741\end{description}
742We hope that these option can convince everybody (both driver
743maintainers and user program developers) to adopt the new \cdrom\
744driver scheme and option flag interpretation.
745
746\newsection{Description of routines in \cdromc}
747
748Only a few routines in \cdromc\ are exported to the drivers. In this
749new section we will discuss these, as well as the functions that `take
750over' the \cdrom\ interface to the kernel. The header file belonging
751to \cdromc\ is called \cdromh. Formerly, some of the contents of this
752file were placed in the file {\tt {ucdrom.h}}, but this file has now been
753merged back into \cdromh.
754
755\subsection{$Struct\ file_operations\ cdrom_fops$}
756
757The contents of this structure were described in section~\ref{cdrom.c}.
758A pointer to this structure is assigned to the $fops$ field
759of the $struct gendisk$.
760
761\subsection{$Int\ register_cdrom( struct\ cdrom_device_info\ * cdi)$}
762
763This function is used in about the same way one registers $cdrom_fops$
764with the kernel, the device operations and information structures,
765as described in section~\ref{cdrom.c}, should be registered with the
766\UCD:
767$$
768register_cdrom(\&<device>_info));
769$$
770This function returns zero upon success, and non-zero upon
771failure. The structure $<device>_info$ should have a pointer to the
772driver's $<device>_dops$, as in
773$$
774\vbox{\halign{&$#$\hfil\cr
775struct\ &cdrom_device_info\ <device>_info = \{\cr
776& <device>_dops;\cr
777&\ldots\cr
778\}\cr
779}}$$
780Note that a driver must have one static structure, $<device>_dops$, while
781it may have as many structures $<device>_info$ as there are minor devices
782active. $Register_cdrom()$ builds a linked list from these.
783
784\subsection{$Void\ unregister_cdrom(struct\ cdrom_device_info * cdi)$}
785
786Unregistering device $cdi$ with minor number $MINOR(cdi\to dev)$ removes
787the minor device from the list. If it was the last registered minor for
788the low-level driver, this disconnects the registered device-operation
789routines from the \cdrom\ interface. This function returns zero upon
790success, and non-zero upon failure.
791
792\subsection{$Int\ cdrom_open(struct\ inode * ip, struct\ file * fp)$}
793
794This function is not called directly by the low-level drivers, it is
795listed in the standard $cdrom_fops$. If the VFS opens a file, this
796function becomes active. A strategy is implemented in this routine,
797taking care of all capabilities and options that are set in the
798$cdrom_device_ops$ connected to the device. Then, the program flow is
799transferred to the device_dependent $open()$ call.
800
801\subsection{$Void\ cdrom_release(struct\ inode *ip, struct\ file
802*fp)$}
803
804This function implements the reverse-logic of $cdrom_open()$, and then
805calls the device-dependent $release()$ routine. When the use-count has
806reached 0, the allocated buffers are flushed by calls to $sync_dev(dev)$
807and $invalidate_buffers(dev)$.
808
809
810\subsection{$Int\ cdrom_ioctl(struct\ inode *ip, struct\ file *fp,
811unsigned\ int\ cmd, unsigned\ long\ arg)$}
812\label{cdrom-ioctl}
813
814This function handles all the standard $ioctl$ requests for \cdrom\
815devices in a uniform way. The different calls fall into three
816categories: $ioctl$s that can be directly implemented by device
817operations, ones that are routed through the call $audio_ioctl()$, and
818the remaining ones, that are presumable device-dependent. Generally, a
819negative return value indicates an error.
820
821\subsubsection{Directly implemented $ioctl$s}
822\label{ioctl-direct}
823
824The following `old' \cdrom-$ioctl$s are implemented by directly
825calling device-operations in $cdrom_device_ops$, if implemented and
826not masked:
827\begin{description}
828\item[CDROMMULTISESSION] Requests the last session on a \cdrom.
829\item[CDROMEJECT] Open tray.
830\item[CDROMCLOSETRAY] Close tray.
831\item[CDROMEJECT_SW] If $arg\not=0$, set behavior to auto-close (close
832tray on first open) and auto-eject (eject on last release), otherwise
833set behavior to non-moving on $open()$ and $release()$ calls.
834\item[CDROM_GET_MCN] Get the Media Catalog Number from a CD.
835\end{description}
836
837\subsubsection{$Ioctl$s routed through $audio_ioctl()$}
838\label{ioctl-audio}
839
840The following set of $ioctl$s are all implemented through a call to
841the $cdrom_fops$ function $audio_ioctl()$. Memory checks and
842allocation are performed in $cdrom_ioctl()$, and also sanitization of
843address format ($CDROM_LBA$/$CDROM_MSF$) is done.
844\begin{description}
845\item[CDROMSUBCHNL] Get sub-channel data in argument $arg$ of type $struct\
846cdrom_subchnl *{}$.
847\item[CDROMREADTOCHDR] Read Table of Contents header, in $arg$ of type
848$struct\ cdrom_tochdr *{}$.
849\item[CDROMREADTOCENTRY] Read a Table of Contents entry in $arg$ and
850specified by $arg$ of type $struct\ cdrom_tocentry *{}$.
851\item[CDROMPLAYMSF] Play audio fragment specified in Minute, Second,
852Frame format, delimited by $arg$ of type $struct\ cdrom_msf *{}$.
853\item[CDROMPLAYTRKIND] Play audio fragment in track-index format
854delimited by $arg$ of type $struct\ \penalty-1000 cdrom_ti *{}$.
855\item[CDROMVOLCTRL] Set volume specified by $arg$ of type $struct\
856cdrom_volctrl *{}$.
857\item[CDROMVOLREAD] Read volume into by $arg$ of type $struct\
858cdrom_volctrl *{}$.
859\item[CDROMSTART] Spin up disc.
860\item[CDROMSTOP] Stop playback of audio fragment.
861\item[CDROMPAUSE] Pause playback of audio fragment.
862\item[CDROMRESUME] Resume playing.
863\end{description}
864
865\subsubsection{New $ioctl$s in \cdromc}
866
867The following $ioctl$s have been introduced to allow user programs to
868control the behavior of individual \cdrom\ devices. New $ioctl$
869commands can be identified by the underscores in their names.
870\begin{description}
871\item[CDROM_SET_OPTIONS] Set options specified by $arg$. Returns the
872option flag register after modification. Use $arg = \rm0$ for reading
873the current flags.
874\item[CDROM_CLEAR_OPTIONS] Clear options specified by $arg$. Returns
875 the option flag register after modification.
876\item[CDROM_SELECT_SPEED] Select head-rate speed of disc specified as
877 by $arg$ in units of standard cdrom speed (176\,kB/sec raw data or
878 150\,kB/sec file system data). The value 0 means `auto-select', \ie,
879 play audio discs at real time and data discs at maximum speed. The value
880 $arg$ is checked against the maximum head rate of the drive found in the
881 $cdrom_dops$.
882\item[CDROM_SELECT_DISC] Select disc numbered $arg$ from a juke-box.
883 First disc is numbered 0. The number $arg$ is checked against the
884 maximum number of discs in the juke-box found in the $cdrom_dops$.
885\item[CDROM_MEDIA_CHANGED] Returns 1 if a disc has been changed since
886 the last call. Note that calls to $cdrom_media_changed$ by the VFS
887 are treated by an independent queue, so both mechanisms will detect
888 a media change once. For juke-boxes, an extra argument $arg$
889 specifies the slot for which the information is given. The special
890 value $CDSL_CURRENT$ requests that information about the currently
891 selected slot be returned.
892\item[CDROM_DRIVE_STATUS] Returns the status of the drive by a call to
893 $drive_status()$. Return values are defined in section~\ref{drive
894 status}. Note that this call doesn't return information on the
895 current playing activity of the drive; this can be polled through an
896 $ioctl$ call to $CDROMSUBCHNL$. For juke-boxes, an extra argument
897 $arg$ specifies the slot for which (possibly limited) information is
898 given. The special value $CDSL_CURRENT$ requests that information
899 about the currently selected slot be returned.
900\item[CDROM_DISC_STATUS] Returns the type of the disc currently in the
901 drive. It should be viewed as a complement to $CDROM_DRIVE_STATUS$.
902 This $ioctl$ can provide \emph {some} information about the current
903 disc that is inserted in the drive. This functionality used to be
904 implemented in the low level drivers, but is now carried out
905 entirely in \UCD.
906
907 The history of development of the CD's use as a carrier medium for
908 various digital information has lead to many different disc types.
909 This $ioctl$ is useful only in the case that CDs have \emph {only
910 one} type of data on them. While this is often the case, it is
911 also very common for CDs to have some tracks with data, and some
912 tracks with audio. Because this is an existing interface, rather
913 than fixing this interface by changing the assumptions it was made
914 under, thereby breaking all user applications that use this
915 function, the \UCD\ implements this $ioctl$ as follows: If the CD in
916 question has audio tracks on it, and it has absolutely no CD-I, XA,
917 or data tracks on it, it will be reported as $CDS_AUDIO$. If it has
918 both audio and data tracks, it will return $CDS_MIXED$. If there
919 are no audio tracks on the disc, and if the CD in question has any
920 CD-I tracks on it, it will be reported as $CDS_XA_2_2$. Failing
921 that, if the CD in question has any XA tracks on it, it will be
922 reported as $CDS_XA_2_1$. Finally, if the CD in question has any
923 data tracks on it, it will be reported as a data CD ($CDS_DATA_1$).
924
925 This $ioctl$ can return:
926 $$
927 \halign{$#$\ \hfil&$/*$ \rm# $*/$\hfil\cr
928 CDS_NO_INFO& no information available\cr
929 CDS_NO_DISC& no disc is inserted, or tray is opened\cr
930 CDS_AUDIO& Audio disc (2352 audio bytes/frame)\cr
931 CDS_DATA_1& data disc, mode 1 (2048 user bytes/frame)\cr
932 CDS_XA_2_1& mixed data (XA), mode 2, form 1 (2048 user bytes)\cr
933 CDS_XA_2_2& mixed data (XA), mode 2, form 1 (2324 user bytes)\cr
934 CDS_MIXED& mixed audio/data disc\cr
935 }
936 $$
937 For some information concerning frame layout of the various disc
938 types, see a recent version of \cdromh.
939
940\item[CDROM_CHANGER_NSLOTS] Returns the number of slots in a
941 juke-box.
942\item[CDROMRESET] Reset the drive.
943\item[CDROM_GET_CAPABILITY] Returns the $capability$ flags for the
944 drive. Refer to section \ref{capability} for more information on
945 these flags.
946\item[CDROM_LOCKDOOR] Locks the door of the drive. $arg == \rm0$
947 unlocks the door, any other value locks it.
948\item[CDROM_DEBUG] Turns on debugging info. Only root is allowed
949 to do this. Same semantics as CDROM_LOCKDOOR.
950\end{description}
951
952\subsubsection{Device dependent $ioctl$s}
953
954Finally, all other $ioctl$s are passed to the function $dev_ioctl()$,
955if implemented. No memory allocation or verification is carried out.
956
957\newsection{How to update your driver}
958
959\begin{enumerate}
960\item Make a backup of your current driver.
961\item Get hold of the files \cdromc\ and \cdromh, they should be in
962 the directory tree that came with this documentation.
963\item Make sure you include \cdromh.
964\item Change the 3rd argument of $register_blkdev$ from
965$\&<your-drive>_fops$ to $\&cdrom_fops$.
966\item Just after that line, add the following to register with the \UCD:
967 $$register_cdrom(\&<your-drive>_info);$$
968 Similarly, add a call to $unregister_cdrom()$ at the appropriate place.
969\item Copy an example of the device-operations $struct$ to your
970 source, \eg, from {\tt {cm206.c}} $cm206_dops$, and change all
971 entries to names corresponding to your driver, or names you just
972 happen to like. If your driver doesn't support a certain function,
973 make the entry $NULL$. At the entry $capability$ you should list all
974 capabilities your driver currently supports. If your driver
975 has a capability that is not listed, please send me a message.
976\item Copy the $cdrom_device_info$ declaration from the same example
977 driver, and modify the entries according to your needs. If your
978 driver dynamically determines the capabilities of the hardware, this
979 structure should also be declared dynamically.
980\item Implement all functions in your $<device>_dops$ structure,
981 according to prototypes listed in \cdromh, and specifications given
982 in section~\ref{cdrom.c}. Most likely you have already implemented
983 the code in a large part, and you will almost certainly need to adapt the
984 prototype and return values.
985\item Rename your $<device>_ioctl()$ function to $audio_ioctl$ and
986 change the prototype a little. Remove entries listed in the first
987 part in section~\ref{cdrom-ioctl}, if your code was OK, these are
988 just calls to the routines you adapted in the previous step.
989\item You may remove all remaining memory checking code in the
990 $audio_ioctl()$ function that deals with audio commands (these are
991 listed in the second part of section~\ref{cdrom-ioctl}). There is no
992 need for memory allocation either, so most $case$s in the $switch$
993 statement look similar to:
994 $$
995 case\ CDROMREADTOCENTRY\colon get_toc_entry\bigl((struct\
996 cdrom_tocentry *{})\ arg\bigr);
997 $$
998\item All remaining $ioctl$ cases must be moved to a separate
999 function, $<device>_ioctl$, the device-dependent $ioctl$s. Note that
1000 memory checking and allocation must be kept in this code!
1001\item Change the prototypes of $<device>_open()$ and
1002 $<device>_release()$, and remove any strategic code (\ie, tray
1003 movement, door locking, etc.).
1004\item Try to recompile the drivers. We advise you to use modules, both
1005 for {\tt {cdrom.o}} and your driver, as debugging is much easier this
1006 way.
1007\end{enumerate}
1008
1009\newsection{Thanks}
1010
1011Thanks to all the people involved. First, Erik Andersen, who has
1012taken over the torch in maintaining \cdromc\ and integrating much
1013\cdrom-related code in the 2.1-kernel. Thanks to Scott Snyder and
1014Gerd Knorr, who were the first to implement this interface for SCSI
1015and IDE-CD drivers and added many ideas for extension of the data
1016structures relative to kernel~2.0. Further thanks to Heiko Ei{\ss}feldt,
1017Thomas Quinot, Jon Tombs, Ken Pizzini, Eberhard M\"onkeberg and Andrew
1018Kroll, the \linux\ \cdrom\ device driver developers who were kind
1019enough to give suggestions and criticisms during the writing. Finally
1020of course, I want to thank Linus Torvalds for making this possible in
1021the first place.
1022
1023\vfill
1024$ \version\ $
1025\eject
1026\end{document}
diff --git a/Documentation/cdrom/ide-cd b/Documentation/cdrom/ide-cd.rst
index a5f2a7f1ff46..bdccb74fc92d 100644
--- a/Documentation/cdrom/ide-cd
+++ b/Documentation/cdrom/ide-cd.rst
@@ -1,18 +1,20 @@
1IDE-CD driver documentation 1IDE-CD driver documentation
2Originally by scott snyder <snyder@fnald0.fnal.gov> (19 May 1996) 2===========================
3Carrying on the torch is: Erik Andersen <andersee@debian.org> 3
4New maintainers (19 Oct 1998): Jens Axboe <axboe@image.dk> 4:Originally by: scott snyder <snyder@fnald0.fnal.gov> (19 May 1996)
5:Carrying on the torch is: Erik Andersen <andersee@debian.org>
6:New maintainers (19 Oct 1998): Jens Axboe <axboe@image.dk>
5 7
61. Introduction 81. Introduction
7--------------- 9---------------
8 10
9The ide-cd driver should work with all ATAPI ver 1.2 to ATAPI 2.6 compliant 11The ide-cd driver should work with all ATAPI ver 1.2 to ATAPI 2.6 compliant
10CDROM drives which attach to an IDE interface. Note that some CDROM vendors 12CDROM drives which attach to an IDE interface. Note that some CDROM vendors
11(including Mitsumi, Sony, Creative, Aztech, and Goldstar) have made 13(including Mitsumi, Sony, Creative, Aztech, and Goldstar) have made
12both ATAPI-compliant drives and drives which use a proprietary 14both ATAPI-compliant drives and drives which use a proprietary
13interface. If your drive uses one of those proprietary interfaces, 15interface. If your drive uses one of those proprietary interfaces,
14this driver will not work with it (but one of the other CDROM drivers 16this driver will not work with it (but one of the other CDROM drivers
15probably will). This driver will not work with `ATAPI' drives which 17probably will). This driver will not work with `ATAPI` drives which
16attach to the parallel port. In addition, there is at least one drive 18attach to the parallel port. In addition, there is at least one drive
17(CyCDROM CR520ie) which attaches to the IDE port but is not ATAPI; 19(CyCDROM CR520ie) which attaches to the IDE port but is not ATAPI;
18this driver will not work with drives like that either (but see the 20this driver will not work with drives like that either (but see the
@@ -31,7 +33,7 @@ This driver provides the following features:
31 from audio tracks. The program cdda2wav can be used for this. 33 from audio tracks. The program cdda2wav can be used for this.
32 Note, however, that only some drives actually support this. 34 Note, however, that only some drives actually support this.
33 35
34 - There is now support for CDROM changers which comply with the 36 - There is now support for CDROM changers which comply with the
35 ATAPI 2.6 draft standard (such as the NEC CDR-251). This additional 37 ATAPI 2.6 draft standard (such as the NEC CDR-251). This additional
36 functionality includes a function call to query which slot is the 38 functionality includes a function call to query which slot is the
37 currently selected slot, a function call to query which slots contain 39 currently selected slot, a function call to query which slots contain
@@ -45,22 +47,22 @@ This driver provides the following features:
45--------------- 47---------------
46 48
470. The ide-cd relies on the ide disk driver. See 490. The ide-cd relies on the ide disk driver. See
48 Documentation/ide/ide.txt for up-to-date information on the ide 50 Documentation/ide/ide.rst for up-to-date information on the ide
49 driver. 51 driver.
50 52
511. Make sure that the ide and ide-cd drivers are compiled into the 531. Make sure that the ide and ide-cd drivers are compiled into the
52 kernel you're using. When configuring the kernel, in the section 54 kernel you're using. When configuring the kernel, in the section
53 entitled "Floppy, IDE, and other block devices", say either `Y' 55 entitled "Floppy, IDE, and other block devices", say either `Y`
54 (which will compile the support directly into the kernel) or `M' 56 (which will compile the support directly into the kernel) or `M`
55 (to compile support as a module which can be loaded and unloaded) 57 (to compile support as a module which can be loaded and unloaded)
56 to the options: 58 to the options::
57 59
58 ATA/ATAPI/MFM/RLL support 60 ATA/ATAPI/MFM/RLL support
59 Include IDE/ATAPI CDROM support 61 Include IDE/ATAPI CDROM support
60 62
61 Depending on what type of IDE interface you have, you may need to 63 Depending on what type of IDE interface you have, you may need to
62 specify additional configuration options. See 64 specify additional configuration options. See
63 Documentation/ide/ide.txt. 65 Documentation/ide/ide.rst.
64 66
652. You should also ensure that the iso9660 filesystem is either 672. You should also ensure that the iso9660 filesystem is either
66 compiled into the kernel or available as a loadable module. You 68 compiled into the kernel or available as a loadable module. You
@@ -72,35 +74,35 @@ This driver provides the following features:
72 address and an IRQ number, the standard assignments being 74 address and an IRQ number, the standard assignments being
73 0x1f0 and 14 for the primary interface and 0x170 and 15 for the 75 0x1f0 and 14 for the primary interface and 0x170 and 15 for the
74 secondary interface. Each interface can control up to two devices, 76 secondary interface. Each interface can control up to two devices,
75 where each device can be a hard drive, a CDROM drive, a floppy drive, 77 where each device can be a hard drive, a CDROM drive, a floppy drive,
76 or a tape drive. The two devices on an interface are called `master' 78 or a tape drive. The two devices on an interface are called `master`
77 and `slave'; this is usually selectable via a jumper on the drive. 79 and `slave`; this is usually selectable via a jumper on the drive.
78 80
79 Linux names these devices as follows. The master and slave devices 81 Linux names these devices as follows. The master and slave devices
80 on the primary IDE interface are called `hda' and `hdb', 82 on the primary IDE interface are called `hda` and `hdb`,
81 respectively. The drives on the secondary interface are called 83 respectively. The drives on the secondary interface are called
82 `hdc' and `hdd'. (Interfaces at other locations get other letters 84 `hdc` and `hdd`. (Interfaces at other locations get other letters
83 in the third position; see Documentation/ide/ide.txt.) 85 in the third position; see Documentation/ide/ide.rst.)
84 86
85 If you want your CDROM drive to be found automatically by the 87 If you want your CDROM drive to be found automatically by the
86 driver, you should make sure your IDE interface uses either the 88 driver, you should make sure your IDE interface uses either the
87 primary or secondary addresses mentioned above. In addition, if 89 primary or secondary addresses mentioned above. In addition, if
88 the CDROM drive is the only device on the IDE interface, it should 90 the CDROM drive is the only device on the IDE interface, it should
89 be jumpered as `master'. (If for some reason you cannot configure 91 be jumpered as `master`. (If for some reason you cannot configure
90 your system in this manner, you can probably still use the driver. 92 your system in this manner, you can probably still use the driver.
91 You may have to pass extra configuration information to the kernel 93 You may have to pass extra configuration information to the kernel
92 when you boot, however. See Documentation/ide/ide.txt for more 94 when you boot, however. See Documentation/ide/ide.rst for more
93 information.) 95 information.)
94 96
954. Boot the system. If the drive is recognized, you should see a 974. Boot the system. If the drive is recognized, you should see a
96 message which looks like 98 message which looks like::
97 99
98 hdb: NEC CD-ROM DRIVE:260, ATAPI CDROM drive 100 hdb: NEC CD-ROM DRIVE:260, ATAPI CDROM drive
99 101
100 If you do not see this, see section 5 below. 102 If you do not see this, see section 5 below.
101 103
1025. You may want to create a symbolic link /dev/cdrom pointing to the 1045. You may want to create a symbolic link /dev/cdrom pointing to the
103 actual device. You can do this with the command 105 actual device. You can do this with the command::
104 106
105 ln -s /dev/hdX /dev/cdrom 107 ln -s /dev/hdX /dev/cdrom
106 108
@@ -108,14 +110,14 @@ This driver provides the following features:
108 drive is installed. 110 drive is installed.
109 111
1106. You should be able to see any error messages from the driver with 1126. You should be able to see any error messages from the driver with
111 the `dmesg' command. 113 the `dmesg` command.
112 114
113 115
1143. Basic usage 1163. Basic usage
115-------------- 117--------------
116 118
117An ISO 9660 CDROM can be mounted by putting the disc in the drive and 119An ISO 9660 CDROM can be mounted by putting the disc in the drive and
118typing (as root) 120typing (as root)::
119 121
120 mount -t iso9660 /dev/cdrom /mnt/cdrom 122 mount -t iso9660 /dev/cdrom /mnt/cdrom
121 123
@@ -123,7 +125,7 @@ where it is assumed that /dev/cdrom is a link pointing to the actual
123device (as described in step 5 of the last section) and /mnt/cdrom is 125device (as described in step 5 of the last section) and /mnt/cdrom is
124an empty directory. You should now be able to see the contents of the 126an empty directory. You should now be able to see the contents of the
125CDROM under the /mnt/cdrom directory. If you want to eject the CDROM, 127CDROM under the /mnt/cdrom directory. If you want to eject the CDROM,
126you must first dismount it with a command like 128you must first dismount it with a command like::
127 129
128 umount /mnt/cdrom 130 umount /mnt/cdrom
129 131
@@ -148,7 +150,7 @@ such as cdda2wav. The only types of drive which I've heard support
148this are Sony and Toshiba drives. You will get errors if you try to 150this are Sony and Toshiba drives. You will get errors if you try to
149use this function on a drive which does not support it. 151use this function on a drive which does not support it.
150 152
151For supported changers, you can use the `cdchange' program (appended to 153For supported changers, you can use the `cdchange` program (appended to
152the end of this file) to switch between changer slots. Note that the 154the end of this file) to switch between changer slots. Note that the
153drive should be unmounted before attempting this. The program takes 155drive should be unmounted before attempting this. The program takes
154two arguments: the CDROM device, and the slot number to which you wish 156two arguments: the CDROM device, and the slot number to which you wish
@@ -161,17 +163,17 @@ to change. If the slot number is -1, the drive is unloaded.
161This section discusses some common problems encountered when trying to 163This section discusses some common problems encountered when trying to
162use the driver, and some possible solutions. Note that if you are 164use the driver, and some possible solutions. Note that if you are
163experiencing problems, you should probably also review 165experiencing problems, you should probably also review
164Documentation/ide/ide.txt for current information about the underlying 166Documentation/ide/ide.rst for current information about the underlying
165IDE support code. Some of these items apply only to earlier versions 167IDE support code. Some of these items apply only to earlier versions
166of the driver, but are mentioned here for completeness. 168of the driver, but are mentioned here for completeness.
167 169
168In most cases, you should probably check with `dmesg' for any errors 170In most cases, you should probably check with `dmesg` for any errors
169from the driver. 171from the driver.
170 172
171a. Drive is not detected during booting. 173a. Drive is not detected during booting.
172 174
173 - Review the configuration instructions above and in 175 - Review the configuration instructions above and in
174 Documentation/ide/ide.txt, and check how your hardware is 176 Documentation/ide/ide.rst, and check how your hardware is
175 configured. 177 configured.
176 178
177 - If your drive is the only device on an IDE interface, it should 179 - If your drive is the only device on an IDE interface, it should
@@ -179,14 +181,14 @@ a. Drive is not detected during booting.
179 181
180 - If your IDE interface is not at the standard addresses of 0x170 182 - If your IDE interface is not at the standard addresses of 0x170
181 or 0x1f0, you'll need to explicitly inform the driver using a 183 or 0x1f0, you'll need to explicitly inform the driver using a
182 lilo option. See Documentation/ide/ide.txt. (This feature was 184 lilo option. See Documentation/ide/ide.rst. (This feature was
183 added around kernel version 1.3.30.) 185 added around kernel version 1.3.30.)
184 186
185 - If the autoprobing is not finding your drive, you can tell the 187 - If the autoprobing is not finding your drive, you can tell the
186 driver to assume that one exists by using a lilo option of the 188 driver to assume that one exists by using a lilo option of the
187 form `hdX=cdrom', where X is the drive letter corresponding to 189 form `hdX=cdrom`, where X is the drive letter corresponding to
188 where your drive is installed. Note that if you do this and you 190 where your drive is installed. Note that if you do this and you
189 see a boot message like 191 see a boot message like::
190 192
191 hdX: ATAPI cdrom (?) 193 hdX: ATAPI cdrom (?)
192 194
@@ -205,7 +207,7 @@ a. Drive is not detected during booting.
205 Support for some interfaces needing extra initialization is 207 Support for some interfaces needing extra initialization is
206 provided in later 1.3.x kernels. You may need to turn on 208 provided in later 1.3.x kernels. You may need to turn on
207 additional kernel configuration options to get them to work; 209 additional kernel configuration options to get them to work;
208 see Documentation/ide/ide.txt. 210 see Documentation/ide/ide.rst.
209 211
210 Even if support is not available for your interface, you may be 212 Even if support is not available for your interface, you may be
211 able to get it to work with the following procedure. First boot 213 able to get it to work with the following procedure. First boot
@@ -220,7 +222,7 @@ b. Timeout/IRQ errors.
220 probably not making it to the host. 222 probably not making it to the host.
221 223
222 - IRQ problems may also be indicated by the message 224 - IRQ problems may also be indicated by the message
223 `IRQ probe failed (<n>)' while booting. If <n> is zero, that 225 `IRQ probe failed (<n>)` while booting. If <n> is zero, that
224 means that the system did not see an interrupt from the drive when 226 means that the system did not see an interrupt from the drive when
225 it was expecting one (on any feasible IRQ). If <n> is negative, 227 it was expecting one (on any feasible IRQ). If <n> is negative,
226 that means the system saw interrupts on multiple IRQ lines, when 228 that means the system saw interrupts on multiple IRQ lines, when
@@ -240,27 +242,27 @@ b. Timeout/IRQ errors.
240 there are hardware problems with the interrupt setup; they 242 there are hardware problems with the interrupt setup; they
241 apparently don't use interrupts. 243 apparently don't use interrupts.
242 244
243 - If you own a Pioneer DR-A24X, you _will_ get nasty error messages 245 - If you own a Pioneer DR-A24X, you _will_ get nasty error messages
244 on boot such as "irq timeout: status=0x50 { DriveReady SeekComplete }" 246 on boot such as "irq timeout: status=0x50 { DriveReady SeekComplete }"
245 The Pioneer DR-A24X CDROM drives are fairly popular these days. 247 The Pioneer DR-A24X CDROM drives are fairly popular these days.
246 Unfortunately, these drives seem to become very confused when we perform 248 Unfortunately, these drives seem to become very confused when we perform
247 the standard Linux ATA disk drive probe. If you own one of these drives, 249 the standard Linux ATA disk drive probe. If you own one of these drives,
248 you can bypass the ATA probing which confuses these CDROM drives, by 250 you can bypass the ATA probing which confuses these CDROM drives, by
249 adding `append="hdX=noprobe hdX=cdrom"' to your lilo.conf file and running 251 adding `append="hdX=noprobe hdX=cdrom"` to your lilo.conf file and running
250 lilo (again where X is the drive letter corresponding to where your drive 252 lilo (again where X is the drive letter corresponding to where your drive
251 is installed.) 253 is installed.)
252 254
253c. System hangups. 255c. System hangups.
254 256
255 - If the system locks up when you try to access the CDROM, the most 257 - If the system locks up when you try to access the CDROM, the most
256 likely cause is that you have a buggy IDE adapter which doesn't 258 likely cause is that you have a buggy IDE adapter which doesn't
257 properly handle simultaneous transactions on multiple interfaces. 259 properly handle simultaneous transactions on multiple interfaces.
258 The most notorious of these is the CMD640B chip. This problem can 260 The most notorious of these is the CMD640B chip. This problem can
259 be worked around by specifying the `serialize' option when 261 be worked around by specifying the `serialize` option when
260 booting. Recent kernels should be able to detect the need for 262 booting. Recent kernels should be able to detect the need for
261 this automatically in most cases, but the detection is not 263 this automatically in most cases, but the detection is not
262 foolproof. See Documentation/ide/ide.txt for more information 264 foolproof. See Documentation/ide/ide.rst for more information
263 about the `serialize' option and the CMD640B. 265 about the `serialize` option and the CMD640B.
264 266
265 - Note that many MS-DOS CDROM drivers will work with such buggy 267 - Note that many MS-DOS CDROM drivers will work with such buggy
266 hardware, apparently because they never attempt to overlap CDROM 268 hardware, apparently because they never attempt to overlap CDROM
@@ -269,14 +271,14 @@ c. System hangups.
269 271
270d. Can't mount a CDROM. 272d. Can't mount a CDROM.
271 273
272 - If you get errors from mount, it may help to check `dmesg' to see 274 - If you get errors from mount, it may help to check `dmesg` to see
273 if there are any more specific errors from the driver or from the 275 if there are any more specific errors from the driver or from the
274 filesystem. 276 filesystem.
275 277
276 - Make sure there's a CDROM loaded in the drive, and that's it's an 278 - Make sure there's a CDROM loaded in the drive, and that's it's an
277 ISO 9660 disc. You can't mount an audio CD. 279 ISO 9660 disc. You can't mount an audio CD.
278 280
279 - With the CDROM in the drive and unmounted, try something like 281 - With the CDROM in the drive and unmounted, try something like::
280 282
281 cat /dev/cdrom | od | more 283 cat /dev/cdrom | od | more
282 284
@@ -284,9 +286,9 @@ d. Can't mount a CDROM.
284 OK, and the problem is at the filesystem level (i.e., the CDROM is 286 OK, and the problem is at the filesystem level (i.e., the CDROM is
285 not ISO 9660 or has errors in the filesystem structure). 287 not ISO 9660 or has errors in the filesystem structure).
286 288
287 - If you see `not a block device' errors, check that the definitions 289 - If you see `not a block device` errors, check that the definitions
288 of the device special files are correct. They should be as 290 of the device special files are correct. They should be as
289 follows: 291 follows::
290 292
291 brw-rw---- 1 root disk 3, 0 Nov 11 18:48 /dev/hda 293 brw-rw---- 1 root disk 3, 0 Nov 11 18:48 /dev/hda
292 brw-rw---- 1 root disk 3, 64 Nov 11 18:48 /dev/hdb 294 brw-rw---- 1 root disk 3, 64 Nov 11 18:48 /dev/hdb
@@ -301,7 +303,7 @@ d. Can't mount a CDROM.
301 If you have a /dev/cdrom symbolic link, check that it is pointing 303 If you have a /dev/cdrom symbolic link, check that it is pointing
302 to the correct device file. 304 to the correct device file.
303 305
304 If you hear people talking of the devices `hd1a' and `hd1b', these 306 If you hear people talking of the devices `hd1a` and `hd1b`, these
305 were old names for what are now called hdc and hdd. Those names 307 were old names for what are now called hdc and hdd. Those names
306 should be considered obsolete. 308 should be considered obsolete.
307 309
@@ -311,8 +313,8 @@ d. Can't mount a CDROM.
311 always give meaningful error messages. 313 always give meaningful error messages.
312 314
313 315
314e. Directory listings are unpredictably truncated, and `dmesg' shows 316e. Directory listings are unpredictably truncated, and `dmesg` shows
315 `buffer botch' error messages from the driver. 317 `buffer botch` error messages from the driver.
316 318
317 - There was a bug in the version of the driver in 1.2.x kernels 319 - There was a bug in the version of the driver in 1.2.x kernels
318 which could cause this. It was fixed in 1.3.0. If you can't 320 which could cause this. It was fixed in 1.3.0. If you can't
@@ -335,34 +337,36 @@ f. Data corruption.
3355. cdchange.c 3375. cdchange.c
336------------- 338-------------
337 339
338/* 340::
339 * cdchange.c [-v] <device> [<slot>] 341
340 * 342 /*
341 * This loads a CDROM from a specified slot in a changer, and displays 343 * cdchange.c [-v] <device> [<slot>]
342 * information about the changer status. The drive should be unmounted before 344 *
343 * using this program. 345 * This loads a CDROM from a specified slot in a changer, and displays
344 * 346 * information about the changer status. The drive should be unmounted before
345 * Changer information is displayed if either the -v flag is specified 347 * using this program.
346 * or no slot was specified. 348 *
347 * 349 * Changer information is displayed if either the -v flag is specified
348 * Based on code originally from Gerhard Zuber <zuber@berlin.snafu.de>. 350 * or no slot was specified.
349 * Changer status information, and rewrite for the new Uniform CDROM driver 351 *
350 * interface by Erik Andersen <andersee@debian.org>. 352 * Based on code originally from Gerhard Zuber <zuber@berlin.snafu.de>.
351 */ 353 * Changer status information, and rewrite for the new Uniform CDROM driver
352 354 * interface by Erik Andersen <andersee@debian.org>.
353#include <stdio.h> 355 */
354#include <stdlib.h> 356
355#include <errno.h> 357 #include <stdio.h>
356#include <string.h> 358 #include <stdlib.h>
357#include <unistd.h> 359 #include <errno.h>
358#include <fcntl.h> 360 #include <string.h>
359#include <sys/ioctl.h> 361 #include <unistd.h>
360#include <linux/cdrom.h> 362 #include <fcntl.h>
361 363 #include <sys/ioctl.h>
362 364 #include <linux/cdrom.h>
363int 365
364main (int argc, char **argv) 366
365{ 367 int
368 main (int argc, char **argv)
369 {
366 char *program; 370 char *program;
367 char *device; 371 char *device;
368 int fd; /* file descriptor for CD-ROM device */ 372 int fd; /* file descriptor for CD-ROM device */
@@ -382,30 +386,30 @@ main (int argc, char **argv)
382 fprintf (stderr, " Slots are numbered 1 -- n.\n"); 386 fprintf (stderr, " Slots are numbered 1 -- n.\n");
383 exit (1); 387 exit (1);
384 } 388 }
385 389
386 if (strcmp (argv[0], "-v") == 0) { 390 if (strcmp (argv[0], "-v") == 0) {
387 verbose = 1; 391 verbose = 1;
388 ++argv; 392 ++argv;
389 --argc; 393 --argc;
390 } 394 }
391 395
392 device = argv[0]; 396 device = argv[0];
393 397
394 if (argc == 2) 398 if (argc == 2)
395 slot = atoi (argv[1]) - 1; 399 slot = atoi (argv[1]) - 1;
396 400
397 /* open device */ 401 /* open device */
398 fd = open(device, O_RDONLY | O_NONBLOCK); 402 fd = open(device, O_RDONLY | O_NONBLOCK);
399 if (fd < 0) { 403 if (fd < 0) {
400 fprintf (stderr, "%s: open failed for `%s': %s\n", 404 fprintf (stderr, "%s: open failed for `%s`: %s\n",
401 program, device, strerror (errno)); 405 program, device, strerror (errno));
402 exit (1); 406 exit (1);
403 } 407 }
404 408
405 /* Check CD player status */ 409 /* Check CD player status */
406 total_slots_available = ioctl (fd, CDROM_CHANGER_NSLOTS); 410 total_slots_available = ioctl (fd, CDROM_CHANGER_NSLOTS);
407 if (total_slots_available <= 1 ) { 411 if (total_slots_available <= 1 ) {
408 fprintf (stderr, "%s: Device `%s' is not an ATAPI " 412 fprintf (stderr, "%s: Device `%s` is not an ATAPI "
409 "compliant CD changer.\n", program, device); 413 "compliant CD changer.\n", program, device);
410 exit (1); 414 exit (1);
411 } 415 }
@@ -418,7 +422,7 @@ main (int argc, char **argv)
418 exit (1); 422 exit (1);
419 } 423 }
420 424
421 /* load */ 425 /* load */
422 slot=ioctl (fd, CDROM_SELECT_DISC, slot); 426 slot=ioctl (fd, CDROM_SELECT_DISC, slot);
423 if (slot<0) { 427 if (slot<0) {
424 fflush(stdout); 428 fflush(stdout);
@@ -462,14 +466,14 @@ main (int argc, char **argv)
462 466
463 for (x_slot=0; x_slot<total_slots_available; x_slot++) { 467 for (x_slot=0; x_slot<total_slots_available; x_slot++) {
464 printf ("Slot %2d: ", x_slot+1); 468 printf ("Slot %2d: ", x_slot+1);
465 status = ioctl (fd, CDROM_DRIVE_STATUS, x_slot); 469 status = ioctl (fd, CDROM_DRIVE_STATUS, x_slot);
466 if (status<0) { 470 if (status<0) {
467 perror(" CDROM_DRIVE_STATUS"); 471 perror(" CDROM_DRIVE_STATUS");
468 } else switch(status) { 472 } else switch(status) {
469 case CDS_DISC_OK: 473 case CDS_DISC_OK:
470 printf ("Disc present."); 474 printf ("Disc present.");
471 break; 475 break;
472 case CDS_NO_DISC: 476 case CDS_NO_DISC:
473 printf ("Empty slot."); 477 printf ("Empty slot.");
474 break; 478 break;
475 case CDS_TRAY_OPEN: 479 case CDS_TRAY_OPEN:
@@ -507,11 +511,11 @@ main (int argc, char **argv)
507 break; 511 break;
508 } 512 }
509 } 513 }
510 status = ioctl (fd, CDROM_MEDIA_CHANGED, x_slot); 514 status = ioctl (fd, CDROM_MEDIA_CHANGED, x_slot);
511 if (status<0) { 515 if (status<0) {
512 perror(" CDROM_MEDIA_CHANGED"); 516 perror(" CDROM_MEDIA_CHANGED");
513 } 517 }
514 switch (status) { 518 switch (status) {
515 case 1: 519 case 1:
516 printf ("Changed.\n"); 520 printf ("Changed.\n");
517 break; 521 break;
@@ -525,10 +529,10 @@ main (int argc, char **argv)
525 /* close device */ 529 /* close device */
526 status = close (fd); 530 status = close (fd);
527 if (status != 0) { 531 if (status != 0) {
528 fprintf (stderr, "%s: close failed for `%s': %s\n", 532 fprintf (stderr, "%s: close failed for `%s`: %s\n",
529 program, device, strerror (errno)); 533 program, device, strerror (errno));
530 exit (1); 534 exit (1);
531 } 535 }
532 536
533 exit (0); 537 exit (0);
534} 538 }
diff --git a/Documentation/cdrom/index.rst b/Documentation/cdrom/index.rst
new file mode 100644
index 000000000000..efbd5d111825
--- /dev/null
+++ b/Documentation/cdrom/index.rst
@@ -0,0 +1,19 @@
1:orphan:
2
3=====
4cdrom
5=====
6
7.. toctree::
8 :maxdepth: 1
9
10 cdrom-standard
11 ide-cd
12 packet-writing
13
14.. only:: subproject and html
15
16 Indices
17 =======
18
19 * :ref:`genindex`
diff --git a/Documentation/cdrom/packet-writing.txt b/Documentation/cdrom/packet-writing.rst
index 2834170d821e..c5c957195a5a 100644
--- a/Documentation/cdrom/packet-writing.txt
+++ b/Documentation/cdrom/packet-writing.rst
@@ -1,3 +1,7 @@
1==============
2Packet writing
3==============
4
1Getting started quick 5Getting started quick
2--------------------- 6---------------------
3 7
@@ -10,13 +14,16 @@ Getting started quick
10 Download from http://sourceforge.net/projects/linux-udf/ 14 Download from http://sourceforge.net/projects/linux-udf/
11 15
12- Grab a new CD-RW disc and format it (assuming CD-RW is hdc, substitute 16- Grab a new CD-RW disc and format it (assuming CD-RW is hdc, substitute
13 as appropriate): 17 as appropriate)::
18
14 # cdrwtool -d /dev/hdc -q 19 # cdrwtool -d /dev/hdc -q
15 20
16- Setup your writer 21- Setup your writer::
22
17 # pktsetup dev_name /dev/hdc 23 # pktsetup dev_name /dev/hdc
18 24
19- Now you can mount /dev/pktcdvd/dev_name and copy files to it. Enjoy! 25- Now you can mount /dev/pktcdvd/dev_name and copy files to it. Enjoy::
26
20 # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime 27 # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime
21 28
22 29
@@ -25,11 +32,11 @@ Packet writing for DVD-RW media
25 32
26DVD-RW discs can be written to much like CD-RW discs if they are in 33DVD-RW discs can be written to much like CD-RW discs if they are in
27the so called "restricted overwrite" mode. To put a disc in restricted 34the so called "restricted overwrite" mode. To put a disc in restricted
28overwrite mode, run: 35overwrite mode, run::
29 36
30 # dvd+rw-format /dev/hdc 37 # dvd+rw-format /dev/hdc
31 38
32You can then use the disc the same way you would use a CD-RW disc: 39You can then use the disc the same way you would use a CD-RW disc::
33 40
34 # pktsetup dev_name /dev/hdc 41 # pktsetup dev_name /dev/hdc
35 # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime 42 # mount /dev/pktcdvd/dev_name /cdrom -t udf -o rw,noatime
@@ -41,7 +48,7 @@ Packet writing for DVD+RW media
41According to the DVD+RW specification, a drive supporting DVD+RW discs 48According to the DVD+RW specification, a drive supporting DVD+RW discs
42shall implement "true random writes with 2KB granularity", which means 49shall implement "true random writes with 2KB granularity", which means
43that it should be possible to put any filesystem with a block size >= 50that it should be possible to put any filesystem with a block size >=
442KB on such a disc. For example, it should be possible to do: 512KB on such a disc. For example, it should be possible to do::
45 52
46 # dvd+rw-format /dev/hdc (only needed if the disc has never 53 # dvd+rw-format /dev/hdc (only needed if the disc has never
47 been formatted) 54 been formatted)
@@ -54,7 +61,7 @@ follow the specification, but suffer bad performance problems if the
54writes are not 32KB aligned. 61writes are not 32KB aligned.
55 62
56Both problems can be solved by using the pktcdvd driver, which always 63Both problems can be solved by using the pktcdvd driver, which always
57generates aligned writes. 64generates aligned writes::
58 65
59 # dvd+rw-format /dev/hdc 66 # dvd+rw-format /dev/hdc
60 # pktsetup dev_name /dev/hdc 67 # pktsetup dev_name /dev/hdc
@@ -83,7 +90,7 @@ Notes
83 90
84- Since the pktcdvd driver makes the disc appear as a regular block 91- Since the pktcdvd driver makes the disc appear as a regular block
85 device with a 2KB block size, you can put any filesystem you like on 92 device with a 2KB block size, you can put any filesystem you like on
86 the disc. For example, run: 93 the disc. For example, run::
87 94
88 # /sbin/mke2fs /dev/pktcdvd/dev_name 95 # /sbin/mke2fs /dev/pktcdvd/dev_name
89 96
@@ -97,7 +104,7 @@ Since Linux 2.6.20, the pktcdvd module has a sysfs interface
97and can be controlled by it. For example the "pktcdvd" tool uses 104and can be controlled by it. For example the "pktcdvd" tool uses
98this interface. (see http://tom.ist-im-web.de/download/pktcdvd ) 105this interface. (see http://tom.ist-im-web.de/download/pktcdvd )
99 106
100"pktcdvd" works similar to "pktsetup", e.g.: 107"pktcdvd" works similar to "pktsetup", e.g.::
101 108
102 # pktcdvd -a dev_name /dev/hdc 109 # pktcdvd -a dev_name /dev/hdc
103 # mkudffs /dev/pktcdvd/dev_name 110 # mkudffs /dev/pktcdvd/dev_name
@@ -115,7 +122,7 @@ For a description of the sysfs interface look into the file:
115Using the pktcdvd debugfs interface 122Using the pktcdvd debugfs interface
116----------------------------------- 123-----------------------------------
117 124
118To read pktcdvd device infos in human readable form, do: 125To read pktcdvd device infos in human readable form, do::
119 126
120 # cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info 127 # cat /sys/kernel/debug/pktcdvd/pktcdvd[0-7]/info
121 128
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 7ace3f8852bd..3b2397bcb565 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -34,7 +34,8 @@ needs_sphinx = '1.3'
34# Add any Sphinx extension module names here, as strings. They can be 34# Add any Sphinx extension module names here, as strings. They can be
35# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 35# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
36# ones. 36# ones.
37extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure', 'sphinx.ext.ifconfig'] 37extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain',
38 'kfigure', 'sphinx.ext.ifconfig', 'automarkup']
38 39
39# The name of the math extension changed on Sphinx 1.4 40# The name of the math extension changed on Sphinx 1.4
40if (major == 1 and minor > 3) or (major > 1): 41if (major == 1 and minor > 3) or (major > 1):
@@ -200,7 +201,7 @@ html_context = {
200 201
201# If true, SmartyPants will be used to convert quotes and dashes to 202# If true, SmartyPants will be used to convert quotes and dashes to
202# typographically correct entities. 203# typographically correct entities.
203#html_use_smartypants = True 204html_use_smartypants = False
204 205
205# Custom sidebar templates, maps document names to template names. 206# Custom sidebar templates, maps document names to template names.
206#html_sidebars = {} 207#html_sidebars = {}
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index ee1bb8983a88..322ac954b390 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -34,6 +34,8 @@ Core utilities
34 timekeeping 34 timekeeping
35 boot-time-mm 35 boot-time-mm
36 memory-hotplug 36 memory-hotplug
37 protection-keys
38 ../RCU/index
37 39
38 40
39Interfaces for kernel debugging 41Interfaces for kernel debugging
diff --git a/Documentation/core-api/kernel-api.rst b/Documentation/core-api/kernel-api.rst
index a29c99d13331..824f24ccf401 100644
--- a/Documentation/core-api/kernel-api.rst
+++ b/Documentation/core-api/kernel-api.rst
@@ -33,6 +33,9 @@ String Conversions
33.. kernel-doc:: lib/kstrtox.c 33.. kernel-doc:: lib/kstrtox.c
34 :export: 34 :export:
35 35
36.. kernel-doc:: lib/string_helpers.c
37 :export:
38
36String Manipulation 39String Manipulation
37------------------- 40-------------------
38 41
@@ -138,6 +141,15 @@ Base 2 log and power Functions
138.. kernel-doc:: include/linux/log2.h 141.. kernel-doc:: include/linux/log2.h
139 :internal: 142 :internal:
140 143
144Integer power Functions
145-----------------------
146
147.. kernel-doc:: lib/math/int_pow.c
148 :export:
149
150.. kernel-doc:: lib/math/int_sqrt.c
151 :export:
152
141Division Functions 153Division Functions
142------------------ 154------------------
143 155
@@ -358,8 +370,6 @@ Read-Copy Update (RCU)
358 370
359.. kernel-doc:: kernel/rcu/tree.c 371.. kernel-doc:: kernel/rcu/tree.c
360 372
361.. kernel-doc:: kernel/rcu/tree_plugin.h
362
363.. kernel-doc:: kernel/rcu/tree_exp.h 373.. kernel-doc:: kernel/rcu/tree_exp.h
364 374
365.. kernel-doc:: kernel/rcu/update.c 375.. kernel-doc:: kernel/rcu/update.c
diff --git a/Documentation/x86/protection-keys.rst b/Documentation/core-api/protection-keys.rst
index 49d9833af871..49d9833af871 100644
--- a/Documentation/x86/protection-keys.rst
+++ b/Documentation/core-api/protection-keys.rst
diff --git a/Documentation/core-api/timekeeping.rst b/Documentation/core-api/timekeeping.rst
index 20ee447a50f3..c0ffa30c7c37 100644
--- a/Documentation/core-api/timekeeping.rst
+++ b/Documentation/core-api/timekeeping.rst
@@ -115,7 +115,7 @@ Some additional variants exist for more specialized cases:
115 void ktime_get_coarse_clocktai_ts64( struct timespec64 * ) 115 void ktime_get_coarse_clocktai_ts64( struct timespec64 * )
116 116
117 These are quicker than the non-coarse versions, but less accurate, 117 These are quicker than the non-coarse versions, but less accurate,
118 corresponding to CLOCK_MONONOTNIC_COARSE and CLOCK_REALTIME_COARSE 118 corresponding to CLOCK_MONOTONIC_COARSE and CLOCK_REALTIME_COARSE
119 in user space, along with the equivalent boottime/tai/raw 119 in user space, along with the equivalent boottime/tai/raw
120 timebase not available in user space. 120 timebase not available in user space.
121 121
diff --git a/Documentation/core-api/xarray.rst b/Documentation/core-api/xarray.rst
index ef6f9f98f595..fcedc5349ace 100644
--- a/Documentation/core-api/xarray.rst
+++ b/Documentation/core-api/xarray.rst
@@ -30,27 +30,27 @@ it called marks. Each mark may be set or cleared independently of
30the others. You can iterate over entries which are marked. 30the others. You can iterate over entries which are marked.
31 31
32Normal pointers may be stored in the XArray directly. They must be 4-byte 32Normal pointers may be stored in the XArray directly. They must be 4-byte
33aligned, which is true for any pointer returned from :c:func:`kmalloc` and 33aligned, which is true for any pointer returned from kmalloc() and
34:c:func:`alloc_page`. It isn't true for arbitrary user-space pointers, 34alloc_page(). It isn't true for arbitrary user-space pointers,
35nor for function pointers. You can store pointers to statically allocated 35nor for function pointers. You can store pointers to statically allocated
36objects, as long as those objects have an alignment of at least 4. 36objects, as long as those objects have an alignment of at least 4.
37 37
38You can also store integers between 0 and ``LONG_MAX`` in the XArray. 38You can also store integers between 0 and ``LONG_MAX`` in the XArray.
39You must first convert it into an entry using :c:func:`xa_mk_value`. 39You must first convert it into an entry using xa_mk_value().
40When you retrieve an entry from the XArray, you can check whether it is 40When you retrieve an entry from the XArray, you can check whether it is
41a value entry by calling :c:func:`xa_is_value`, and convert it back to 41a value entry by calling xa_is_value(), and convert it back to
42an integer by calling :c:func:`xa_to_value`. 42an integer by calling xa_to_value().
43 43
44Some users want to store tagged pointers instead of using the marks 44Some users want to store tagged pointers instead of using the marks
45described above. They can call :c:func:`xa_tag_pointer` to create an 45described above. They can call xa_tag_pointer() to create an
46entry with a tag, :c:func:`xa_untag_pointer` to turn a tagged entry 46entry with a tag, xa_untag_pointer() to turn a tagged entry
47back into an untagged pointer and :c:func:`xa_pointer_tag` to retrieve 47back into an untagged pointer and xa_pointer_tag() to retrieve
48the tag of an entry. Tagged pointers use the same bits that are used 48the tag of an entry. Tagged pointers use the same bits that are used
49to distinguish value entries from normal pointers, so each user must 49to distinguish value entries from normal pointers, so each user must
50decide whether they want to store value entries or tagged pointers in 50decide whether they want to store value entries or tagged pointers in
51any particular XArray. 51any particular XArray.
52 52
53The XArray does not support storing :c:func:`IS_ERR` pointers as some 53The XArray does not support storing IS_ERR() pointers as some
54conflict with value entries or internal entries. 54conflict with value entries or internal entries.
55 55
56An unusual feature of the XArray is the ability to create entries which 56An unusual feature of the XArray is the ability to create entries which
@@ -64,89 +64,89 @@ entry will cause the XArray to forget about the range.
64Normal API 64Normal API
65========== 65==========
66 66
67Start by initialising an XArray, either with :c:func:`DEFINE_XARRAY` 67Start by initialising an XArray, either with DEFINE_XARRAY()
68for statically allocated XArrays or :c:func:`xa_init` for dynamically 68for statically allocated XArrays or xa_init() for dynamically
69allocated ones. A freshly-initialised XArray contains a ``NULL`` 69allocated ones. A freshly-initialised XArray contains a ``NULL``
70pointer at every index. 70pointer at every index.
71 71
72You can then set entries using :c:func:`xa_store` and get entries 72You can then set entries using xa_store() and get entries
73using :c:func:`xa_load`. xa_store will overwrite any entry with the 73using xa_load(). xa_store will overwrite any entry with the
74new entry and return the previous entry stored at that index. You can 74new entry and return the previous entry stored at that index. You can
75use :c:func:`xa_erase` instead of calling :c:func:`xa_store` with a 75use xa_erase() instead of calling xa_store() with a
76``NULL`` entry. There is no difference between an entry that has never 76``NULL`` entry. There is no difference between an entry that has never
77been stored to, one that has been erased and one that has most recently 77been stored to, one that has been erased and one that has most recently
78had ``NULL`` stored to it. 78had ``NULL`` stored to it.
79 79
80You can conditionally replace an entry at an index by using 80You can conditionally replace an entry at an index by using
81:c:func:`xa_cmpxchg`. Like :c:func:`cmpxchg`, it will only succeed if 81xa_cmpxchg(). Like cmpxchg(), it will only succeed if
82the entry at that index has the 'old' value. It also returns the entry 82the entry at that index has the 'old' value. It also returns the entry
83which was at that index; if it returns the same entry which was passed as 83which was at that index; if it returns the same entry which was passed as
84'old', then :c:func:`xa_cmpxchg` succeeded. 84'old', then xa_cmpxchg() succeeded.
85 85
86If you want to only store a new entry to an index if the current entry 86If you want to only store a new entry to an index if the current entry
87at that index is ``NULL``, you can use :c:func:`xa_insert` which 87at that index is ``NULL``, you can use xa_insert() which
88returns ``-EBUSY`` if the entry is not empty. 88returns ``-EBUSY`` if the entry is not empty.
89 89
90You can enquire whether a mark is set on an entry by using 90You can enquire whether a mark is set on an entry by using
91:c:func:`xa_get_mark`. If the entry is not ``NULL``, you can set a mark 91xa_get_mark(). If the entry is not ``NULL``, you can set a mark
92on it by using :c:func:`xa_set_mark` and remove the mark from an entry by 92on it by using xa_set_mark() and remove the mark from an entry by
93calling :c:func:`xa_clear_mark`. You can ask whether any entry in the 93calling xa_clear_mark(). You can ask whether any entry in the
94XArray has a particular mark set by calling :c:func:`xa_marked`. 94XArray has a particular mark set by calling xa_marked().
95 95
96You can copy entries out of the XArray into a plain array by calling 96You can copy entries out of the XArray into a plain array by calling
97:c:func:`xa_extract`. Or you can iterate over the present entries in 97xa_extract(). Or you can iterate over the present entries in
98the XArray by calling :c:func:`xa_for_each`. You may prefer to use 98the XArray by calling xa_for_each(). You may prefer to use
99:c:func:`xa_find` or :c:func:`xa_find_after` to move to the next present 99xa_find() or xa_find_after() to move to the next present
100entry in the XArray. 100entry in the XArray.
101 101
102Calling :c:func:`xa_store_range` stores the same entry in a range 102Calling xa_store_range() stores the same entry in a range
103of indices. If you do this, some of the other operations will behave 103of indices. If you do this, some of the other operations will behave
104in a slightly odd way. For example, marking the entry at one index 104in a slightly odd way. For example, marking the entry at one index
105may result in the entry being marked at some, but not all of the other 105may result in the entry being marked at some, but not all of the other
106indices. Storing into one index may result in the entry retrieved by 106indices. Storing into one index may result in the entry retrieved by
107some, but not all of the other indices changing. 107some, but not all of the other indices changing.
108 108
109Sometimes you need to ensure that a subsequent call to :c:func:`xa_store` 109Sometimes you need to ensure that a subsequent call to xa_store()
110will not need to allocate memory. The :c:func:`xa_reserve` function 110will not need to allocate memory. The xa_reserve() function
111will store a reserved entry at the indicated index. Users of the 111will store a reserved entry at the indicated index. Users of the
112normal API will see this entry as containing ``NULL``. If you do 112normal API will see this entry as containing ``NULL``. If you do
113not need to use the reserved entry, you can call :c:func:`xa_release` 113not need to use the reserved entry, you can call xa_release()
114to remove the unused entry. If another user has stored to the entry 114to remove the unused entry. If another user has stored to the entry
115in the meantime, :c:func:`xa_release` will do nothing; if instead you 115in the meantime, xa_release() will do nothing; if instead you
116want the entry to become ``NULL``, you should use :c:func:`xa_erase`. 116want the entry to become ``NULL``, you should use xa_erase().
117Using :c:func:`xa_insert` on a reserved entry will fail. 117Using xa_insert() on a reserved entry will fail.
118 118
119If all entries in the array are ``NULL``, the :c:func:`xa_empty` function 119If all entries in the array are ``NULL``, the xa_empty() function
120will return ``true``. 120will return ``true``.
121 121
122Finally, you can remove all entries from an XArray by calling 122Finally, you can remove all entries from an XArray by calling
123:c:func:`xa_destroy`. If the XArray entries are pointers, you may wish 123xa_destroy(). If the XArray entries are pointers, you may wish
124to free the entries first. You can do this by iterating over all present 124to free the entries first. You can do this by iterating over all present
125entries in the XArray using the :c:func:`xa_for_each` iterator. 125entries in the XArray using the xa_for_each() iterator.
126 126
127Allocating XArrays 127Allocating XArrays
128------------------ 128------------------
129 129
130If you use :c:func:`DEFINE_XARRAY_ALLOC` to define the XArray, or 130If you use DEFINE_XARRAY_ALLOC() to define the XArray, or
131initialise it by passing ``XA_FLAGS_ALLOC`` to :c:func:`xa_init_flags`, 131initialise it by passing ``XA_FLAGS_ALLOC`` to xa_init_flags(),
132the XArray changes to track whether entries are in use or not. 132the XArray changes to track whether entries are in use or not.
133 133
134You can call :c:func:`xa_alloc` to store the entry at an unused index 134You can call xa_alloc() to store the entry at an unused index
135in the XArray. If you need to modify the array from interrupt context, 135in the XArray. If you need to modify the array from interrupt context,
136you can use :c:func:`xa_alloc_bh` or :c:func:`xa_alloc_irq` to disable 136you can use xa_alloc_bh() or xa_alloc_irq() to disable
137interrupts while allocating the ID. 137interrupts while allocating the ID.
138 138
139Using :c:func:`xa_store`, :c:func:`xa_cmpxchg` or :c:func:`xa_insert` will 139Using xa_store(), xa_cmpxchg() or xa_insert() will
140also mark the entry as being allocated. Unlike a normal XArray, storing 140also mark the entry as being allocated. Unlike a normal XArray, storing
141``NULL`` will mark the entry as being in use, like :c:func:`xa_reserve`. 141``NULL`` will mark the entry as being in use, like xa_reserve().
142To free an entry, use :c:func:`xa_erase` (or :c:func:`xa_release` if 142To free an entry, use xa_erase() (or xa_release() if
143you only want to free the entry if it's ``NULL``). 143you only want to free the entry if it's ``NULL``).
144 144
145By default, the lowest free entry is allocated starting from 0. If you 145By default, the lowest free entry is allocated starting from 0. If you
146want to allocate entries starting at 1, it is more efficient to use 146want to allocate entries starting at 1, it is more efficient to use
147:c:func:`DEFINE_XARRAY_ALLOC1` or ``XA_FLAGS_ALLOC1``. If you want to 147DEFINE_XARRAY_ALLOC1() or ``XA_FLAGS_ALLOC1``. If you want to
148allocate IDs up to a maximum, then wrap back around to the lowest free 148allocate IDs up to a maximum, then wrap back around to the lowest free
149ID, you can use :c:func:`xa_alloc_cyclic`. 149ID, you can use xa_alloc_cyclic().
150 150
151You cannot use ``XA_MARK_0`` with an allocating XArray as this mark 151You cannot use ``XA_MARK_0`` with an allocating XArray as this mark
152is used to track whether an entry is free or not. The other marks are 152is used to track whether an entry is free or not. The other marks are
@@ -155,17 +155,17 @@ available for your use.
155Memory allocation 155Memory allocation
156----------------- 156-----------------
157 157
158The :c:func:`xa_store`, :c:func:`xa_cmpxchg`, :c:func:`xa_alloc`, 158The xa_store(), xa_cmpxchg(), xa_alloc(),
159:c:func:`xa_reserve` and :c:func:`xa_insert` functions take a gfp_t 159xa_reserve() and xa_insert() functions take a gfp_t
160parameter in case the XArray needs to allocate memory to store this entry. 160parameter in case the XArray needs to allocate memory to store this entry.
161If the entry is being deleted, no memory allocation needs to be performed, 161If the entry is being deleted, no memory allocation needs to be performed,
162and the GFP flags specified will be ignored. 162and the GFP flags specified will be ignored.
163 163
164It is possible for no memory to be allocatable, particularly if you pass 164It is possible for no memory to be allocatable, particularly if you pass
165a restrictive set of GFP flags. In that case, the functions return a 165a restrictive set of GFP flags. In that case, the functions return a
166special value which can be turned into an errno using :c:func:`xa_err`. 166special value which can be turned into an errno using xa_err().
167If you don't need to know exactly which error occurred, using 167If you don't need to know exactly which error occurred, using
168:c:func:`xa_is_err` is slightly more efficient. 168xa_is_err() is slightly more efficient.
169 169
170Locking 170Locking
171------- 171-------
@@ -174,54 +174,54 @@ When using the Normal API, you do not have to worry about locking.
174The XArray uses RCU and an internal spinlock to synchronise access: 174The XArray uses RCU and an internal spinlock to synchronise access:
175 175
176No lock needed: 176No lock needed:
177 * :c:func:`xa_empty` 177 * xa_empty()
178 * :c:func:`xa_marked` 178 * xa_marked()
179 179
180Takes RCU read lock: 180Takes RCU read lock:
181 * :c:func:`xa_load` 181 * xa_load()
182 * :c:func:`xa_for_each` 182 * xa_for_each()
183 * :c:func:`xa_find` 183 * xa_find()
184 * :c:func:`xa_find_after` 184 * xa_find_after()
185 * :c:func:`xa_extract` 185 * xa_extract()
186 * :c:func:`xa_get_mark` 186 * xa_get_mark()
187 187
188Takes xa_lock internally: 188Takes xa_lock internally:
189 * :c:func:`xa_store` 189 * xa_store()
190 * :c:func:`xa_store_bh` 190 * xa_store_bh()
191 * :c:func:`xa_store_irq` 191 * xa_store_irq()
192 * :c:func:`xa_insert` 192 * xa_insert()
193 * :c:func:`xa_insert_bh` 193 * xa_insert_bh()
194 * :c:func:`xa_insert_irq` 194 * xa_insert_irq()
195 * :c:func:`xa_erase` 195 * xa_erase()
196 * :c:func:`xa_erase_bh` 196 * xa_erase_bh()
197 * :c:func:`xa_erase_irq` 197 * xa_erase_irq()
198 * :c:func:`xa_cmpxchg` 198 * xa_cmpxchg()
199 * :c:func:`xa_cmpxchg_bh` 199 * xa_cmpxchg_bh()
200 * :c:func:`xa_cmpxchg_irq` 200 * xa_cmpxchg_irq()
201 * :c:func:`xa_store_range` 201 * xa_store_range()
202 * :c:func:`xa_alloc` 202 * xa_alloc()
203 * :c:func:`xa_alloc_bh` 203 * xa_alloc_bh()
204 * :c:func:`xa_alloc_irq` 204 * xa_alloc_irq()
205 * :c:func:`xa_reserve` 205 * xa_reserve()
206 * :c:func:`xa_reserve_bh` 206 * xa_reserve_bh()
207 * :c:func:`xa_reserve_irq` 207 * xa_reserve_irq()
208 * :c:func:`xa_destroy` 208 * xa_destroy()
209 * :c:func:`xa_set_mark` 209 * xa_set_mark()
210 * :c:func:`xa_clear_mark` 210 * xa_clear_mark()
211 211
212Assumes xa_lock held on entry: 212Assumes xa_lock held on entry:
213 * :c:func:`__xa_store` 213 * __xa_store()
214 * :c:func:`__xa_insert` 214 * __xa_insert()
215 * :c:func:`__xa_erase` 215 * __xa_erase()
216 * :c:func:`__xa_cmpxchg` 216 * __xa_cmpxchg()
217 * :c:func:`__xa_alloc` 217 * __xa_alloc()
218 * :c:func:`__xa_set_mark` 218 * __xa_set_mark()
219 * :c:func:`__xa_clear_mark` 219 * __xa_clear_mark()
220 220
221If you want to take advantage of the lock to protect the data structures 221If you want to take advantage of the lock to protect the data structures
222that you are storing in the XArray, you can call :c:func:`xa_lock` 222that you are storing in the XArray, you can call xa_lock()
223before calling :c:func:`xa_load`, then take a reference count on the 223before calling xa_load(), then take a reference count on the
224object you have found before calling :c:func:`xa_unlock`. This will 224object you have found before calling xa_unlock(). This will
225prevent stores from removing the object from the array between looking 225prevent stores from removing the object from the array between looking
226up the object and incrementing the refcount. You can also use RCU to 226up the object and incrementing the refcount. You can also use RCU to
227avoid dereferencing freed memory, but an explanation of that is beyond 227avoid dereferencing freed memory, but an explanation of that is beyond
@@ -261,7 +261,7 @@ context and then erase them in softirq context, you can do that this way::
261 } 261 }
262 262
263If you are going to modify the XArray from interrupt or softirq context, 263If you are going to modify the XArray from interrupt or softirq context,
264you need to initialise the array using :c:func:`xa_init_flags`, passing 264you need to initialise the array using xa_init_flags(), passing
265``XA_FLAGS_LOCK_IRQ`` or ``XA_FLAGS_LOCK_BH``. 265``XA_FLAGS_LOCK_IRQ`` or ``XA_FLAGS_LOCK_BH``.
266 266
267The above example also shows a common pattern of wanting to extend the 267The above example also shows a common pattern of wanting to extend the
@@ -269,20 +269,20 @@ coverage of the xa_lock on the store side to protect some statistics
269associated with the array. 269associated with the array.
270 270
271Sharing the XArray with interrupt context is also possible, either 271Sharing the XArray with interrupt context is also possible, either
272using :c:func:`xa_lock_irqsave` in both the interrupt handler and process 272using xa_lock_irqsave() in both the interrupt handler and process
273context, or :c:func:`xa_lock_irq` in process context and :c:func:`xa_lock` 273context, or xa_lock_irq() in process context and xa_lock()
274in the interrupt handler. Some of the more common patterns have helper 274in the interrupt handler. Some of the more common patterns have helper
275functions such as :c:func:`xa_store_bh`, :c:func:`xa_store_irq`, 275functions such as xa_store_bh(), xa_store_irq(),
276:c:func:`xa_erase_bh`, :c:func:`xa_erase_irq`, :c:func:`xa_cmpxchg_bh` 276xa_erase_bh(), xa_erase_irq(), xa_cmpxchg_bh()
277and :c:func:`xa_cmpxchg_irq`. 277and xa_cmpxchg_irq().
278 278
279Sometimes you need to protect access to the XArray with a mutex because 279Sometimes you need to protect access to the XArray with a mutex because
280that lock sits above another mutex in the locking hierarchy. That does 280that lock sits above another mutex in the locking hierarchy. That does
281not entitle you to use functions like :c:func:`__xa_erase` without taking 281not entitle you to use functions like __xa_erase() without taking
282the xa_lock; the xa_lock is used for lockdep validation and will be used 282the xa_lock; the xa_lock is used for lockdep validation and will be used
283for other purposes in the future. 283for other purposes in the future.
284 284
285The :c:func:`__xa_set_mark` and :c:func:`__xa_clear_mark` functions are also 285The __xa_set_mark() and __xa_clear_mark() functions are also
286available for situations where you look up an entry and want to atomically 286available for situations where you look up an entry and want to atomically
287set or clear a mark. It may be more efficient to use the advanced API 287set or clear a mark. It may be more efficient to use the advanced API
288in this case, as it will save you from walking the tree twice. 288in this case, as it will save you from walking the tree twice.
@@ -300,27 +300,27 @@ indeed the normal API is implemented in terms of the advanced API. The
300advanced API is only available to modules with a GPL-compatible license. 300advanced API is only available to modules with a GPL-compatible license.
301 301
302The advanced API is based around the xa_state. This is an opaque data 302The advanced API is based around the xa_state. This is an opaque data
303structure which you declare on the stack using the :c:func:`XA_STATE` 303structure which you declare on the stack using the XA_STATE()
304macro. This macro initialises the xa_state ready to start walking 304macro. This macro initialises the xa_state ready to start walking
305around the XArray. It is used as a cursor to maintain the position 305around the XArray. It is used as a cursor to maintain the position
306in the XArray and let you compose various operations together without 306in the XArray and let you compose various operations together without
307having to restart from the top every time. 307having to restart from the top every time.
308 308
309The xa_state is also used to store errors. You can call 309The xa_state is also used to store errors. You can call
310:c:func:`xas_error` to retrieve the error. All operations check whether 310xas_error() to retrieve the error. All operations check whether
311the xa_state is in an error state before proceeding, so there's no need 311the xa_state is in an error state before proceeding, so there's no need
312for you to check for an error after each call; you can make multiple 312for you to check for an error after each call; you can make multiple
313calls in succession and only check at a convenient point. The only 313calls in succession and only check at a convenient point. The only
314errors currently generated by the XArray code itself are ``ENOMEM`` and 314errors currently generated by the XArray code itself are ``ENOMEM`` and
315``EINVAL``, but it supports arbitrary errors in case you want to call 315``EINVAL``, but it supports arbitrary errors in case you want to call
316:c:func:`xas_set_err` yourself. 316xas_set_err() yourself.
317 317
318If the xa_state is holding an ``ENOMEM`` error, calling :c:func:`xas_nomem` 318If the xa_state is holding an ``ENOMEM`` error, calling xas_nomem()
319will attempt to allocate more memory using the specified gfp flags and 319will attempt to allocate more memory using the specified gfp flags and
320cache it in the xa_state for the next attempt. The idea is that you take 320cache it in the xa_state for the next attempt. The idea is that you take
321the xa_lock, attempt the operation and drop the lock. The operation 321the xa_lock, attempt the operation and drop the lock. The operation
322attempts to allocate memory while holding the lock, but it is more 322attempts to allocate memory while holding the lock, but it is more
323likely to fail. Once you have dropped the lock, :c:func:`xas_nomem` 323likely to fail. Once you have dropped the lock, xas_nomem()
324can try harder to allocate more memory. It will return ``true`` if it 324can try harder to allocate more memory. It will return ``true`` if it
325is worth retrying the operation (i.e. that there was a memory error *and* 325is worth retrying the operation (i.e. that there was a memory error *and*
326more memory was allocated). If it has previously allocated memory, and 326more memory was allocated). If it has previously allocated memory, and
@@ -333,7 +333,7 @@ Internal Entries
333The XArray reserves some entries for its own purposes. These are never 333The XArray reserves some entries for its own purposes. These are never
334exposed through the normal API, but when using the advanced API, it's 334exposed through the normal API, but when using the advanced API, it's
335possible to see them. Usually the best way to handle them is to pass them 335possible to see them. Usually the best way to handle them is to pass them
336to :c:func:`xas_retry`, and retry the operation if it returns ``true``. 336to xas_retry(), and retry the operation if it returns ``true``.
337 337
338.. flat-table:: 338.. flat-table::
339 :widths: 1 1 6 339 :widths: 1 1 6
@@ -343,89 +343,89 @@ to :c:func:`xas_retry`, and retry the operation if it returns ``true``.
343 - Usage 343 - Usage
344 344
345 * - Node 345 * - Node
346 - :c:func:`xa_is_node` 346 - xa_is_node()
347 - An XArray node. May be visible when using a multi-index xa_state. 347 - An XArray node. May be visible when using a multi-index xa_state.
348 348
349 * - Sibling 349 * - Sibling
350 - :c:func:`xa_is_sibling` 350 - xa_is_sibling()
351 - A non-canonical entry for a multi-index entry. The value indicates 351 - A non-canonical entry for a multi-index entry. The value indicates
352 which slot in this node has the canonical entry. 352 which slot in this node has the canonical entry.
353 353
354 * - Retry 354 * - Retry
355 - :c:func:`xa_is_retry` 355 - xa_is_retry()
356 - This entry is currently being modified by a thread which has the 356 - This entry is currently being modified by a thread which has the
357 xa_lock. The node containing this entry may be freed at the end 357 xa_lock. The node containing this entry may be freed at the end
358 of this RCU period. You should restart the lookup from the head 358 of this RCU period. You should restart the lookup from the head
359 of the array. 359 of the array.
360 360
361 * - Zero 361 * - Zero
362 - :c:func:`xa_is_zero` 362 - xa_is_zero()
363 - Zero entries appear as ``NULL`` through the Normal API, but occupy 363 - Zero entries appear as ``NULL`` through the Normal API, but occupy
364 an entry in the XArray which can be used to reserve the index for 364 an entry in the XArray which can be used to reserve the index for
365 future use. This is used by allocating XArrays for allocated entries 365 future use. This is used by allocating XArrays for allocated entries
366 which are ``NULL``. 366 which are ``NULL``.
367 367
368Other internal entries may be added in the future. As far as possible, they 368Other internal entries may be added in the future. As far as possible, they
369will be handled by :c:func:`xas_retry`. 369will be handled by xas_retry().
370 370
371Additional functionality 371Additional functionality
372------------------------ 372------------------------
373 373
374The :c:func:`xas_create_range` function allocates all the necessary memory 374The xas_create_range() function allocates all the necessary memory
375to store every entry in a range. It will set ENOMEM in the xa_state if 375to store every entry in a range. It will set ENOMEM in the xa_state if
376it cannot allocate memory. 376it cannot allocate memory.
377 377
378You can use :c:func:`xas_init_marks` to reset the marks on an entry 378You can use xas_init_marks() to reset the marks on an entry
379to their default state. This is usually all marks clear, unless the 379to their default state. This is usually all marks clear, unless the
380XArray is marked with ``XA_FLAGS_TRACK_FREE``, in which case mark 0 is set 380XArray is marked with ``XA_FLAGS_TRACK_FREE``, in which case mark 0 is set
381and all other marks are clear. Replacing one entry with another using 381and all other marks are clear. Replacing one entry with another using
382:c:func:`xas_store` will not reset the marks on that entry; if you want 382xas_store() will not reset the marks on that entry; if you want
383the marks reset, you should do that explicitly. 383the marks reset, you should do that explicitly.
384 384
385The :c:func:`xas_load` will walk the xa_state as close to the entry 385The xas_load() will walk the xa_state as close to the entry
386as it can. If you know the xa_state has already been walked to the 386as it can. If you know the xa_state has already been walked to the
387entry and need to check that the entry hasn't changed, you can use 387entry and need to check that the entry hasn't changed, you can use
388:c:func:`xas_reload` to save a function call. 388xas_reload() to save a function call.
389 389
390If you need to move to a different index in the XArray, call 390If you need to move to a different index in the XArray, call
391:c:func:`xas_set`. This resets the cursor to the top of the tree, which 391xas_set(). This resets the cursor to the top of the tree, which
392will generally make the next operation walk the cursor to the desired 392will generally make the next operation walk the cursor to the desired
393spot in the tree. If you want to move to the next or previous index, 393spot in the tree. If you want to move to the next or previous index,
394call :c:func:`xas_next` or :c:func:`xas_prev`. Setting the index does 394call xas_next() or xas_prev(). Setting the index does
395not walk the cursor around the array so does not require a lock to be 395not walk the cursor around the array so does not require a lock to be
396held, while moving to the next or previous index does. 396held, while moving to the next or previous index does.
397 397
398You can search for the next present entry using :c:func:`xas_find`. This 398You can search for the next present entry using xas_find(). This
399is the equivalent of both :c:func:`xa_find` and :c:func:`xa_find_after`; 399is the equivalent of both xa_find() and xa_find_after();
400if the cursor has been walked to an entry, then it will find the next 400if the cursor has been walked to an entry, then it will find the next
401entry after the one currently referenced. If not, it will return the 401entry after the one currently referenced. If not, it will return the
402entry at the index of the xa_state. Using :c:func:`xas_next_entry` to 402entry at the index of the xa_state. Using xas_next_entry() to
403move to the next present entry instead of :c:func:`xas_find` will save 403move to the next present entry instead of xas_find() will save
404a function call in the majority of cases at the expense of emitting more 404a function call in the majority of cases at the expense of emitting more
405inline code. 405inline code.
406 406
407The :c:func:`xas_find_marked` function is similar. If the xa_state has 407The xas_find_marked() function is similar. If the xa_state has
408not been walked, it will return the entry at the index of the xa_state, 408not been walked, it will return the entry at the index of the xa_state,
409if it is marked. Otherwise, it will return the first marked entry after 409if it is marked. Otherwise, it will return the first marked entry after
410the entry referenced by the xa_state. The :c:func:`xas_next_marked` 410the entry referenced by the xa_state. The xas_next_marked()
411function is the equivalent of :c:func:`xas_next_entry`. 411function is the equivalent of xas_next_entry().
412 412
413When iterating over a range of the XArray using :c:func:`xas_for_each` 413When iterating over a range of the XArray using xas_for_each()
414or :c:func:`xas_for_each_marked`, it may be necessary to temporarily stop 414or xas_for_each_marked(), it may be necessary to temporarily stop
415the iteration. The :c:func:`xas_pause` function exists for this purpose. 415the iteration. The xas_pause() function exists for this purpose.
416After you have done the necessary work and wish to resume, the xa_state 416After you have done the necessary work and wish to resume, the xa_state
417is in an appropriate state to continue the iteration after the entry 417is in an appropriate state to continue the iteration after the entry
418you last processed. If you have interrupts disabled while iterating, 418you last processed. If you have interrupts disabled while iterating,
419then it is good manners to pause the iteration and reenable interrupts 419then it is good manners to pause the iteration and reenable interrupts
420every ``XA_CHECK_SCHED`` entries. 420every ``XA_CHECK_SCHED`` entries.
421 421
422The :c:func:`xas_get_mark`, :c:func:`xas_set_mark` and 422The xas_get_mark(), xas_set_mark() and
423:c:func:`xas_clear_mark` functions require the xa_state cursor to have 423xas_clear_mark() functions require the xa_state cursor to have
424been moved to the appropriate location in the xarray; they will do 424been moved to the appropriate location in the xarray; they will do
425nothing if you have called :c:func:`xas_pause` or :c:func:`xas_set` 425nothing if you have called xas_pause() or xas_set()
426immediately before. 426immediately before.
427 427
428You can call :c:func:`xas_set_update` to have a callback function 428You can call xas_set_update() to have a callback function
429called each time the XArray updates a node. This is used by the page 429called each time the XArray updates a node. This is used by the page
430cache workingset code to maintain its list of nodes which contain only 430cache workingset code to maintain its list of nodes which contain only
431shadow entries. 431shadow entries.
@@ -443,25 +443,25 @@ eg indices 64-127 may be tied together, but 2-6 may not be. This may
443save substantial quantities of memory; for example tying 512 entries 443save substantial quantities of memory; for example tying 512 entries
444together will save over 4kB. 444together will save over 4kB.
445 445
446You can create a multi-index entry by using :c:func:`XA_STATE_ORDER` 446You can create a multi-index entry by using XA_STATE_ORDER()
447or :c:func:`xas_set_order` followed by a call to :c:func:`xas_store`. 447or xas_set_order() followed by a call to xas_store().
448Calling :c:func:`xas_load` with a multi-index xa_state will walk the 448Calling xas_load() with a multi-index xa_state will walk the
449xa_state to the right location in the tree, but the return value is not 449xa_state to the right location in the tree, but the return value is not
450meaningful, potentially being an internal entry or ``NULL`` even when there 450meaningful, potentially being an internal entry or ``NULL`` even when there
451is an entry stored within the range. Calling :c:func:`xas_find_conflict` 451is an entry stored within the range. Calling xas_find_conflict()
452will return the first entry within the range or ``NULL`` if there are no 452will return the first entry within the range or ``NULL`` if there are no
453entries in the range. The :c:func:`xas_for_each_conflict` iterator will 453entries in the range. The xas_for_each_conflict() iterator will
454iterate over every entry which overlaps the specified range. 454iterate over every entry which overlaps the specified range.
455 455
456If :c:func:`xas_load` encounters a multi-index entry, the xa_index 456If xas_load() encounters a multi-index entry, the xa_index
457in the xa_state will not be changed. When iterating over an XArray 457in the xa_state will not be changed. When iterating over an XArray
458or calling :c:func:`xas_find`, if the initial index is in the middle 458or calling xas_find(), if the initial index is in the middle
459of a multi-index entry, it will not be altered. Subsequent calls 459of a multi-index entry, it will not be altered. Subsequent calls
460or iterations will move the index to the first index in the range. 460or iterations will move the index to the first index in the range.
461Each entry will only be returned once, no matter how many indices it 461Each entry will only be returned once, no matter how many indices it
462occupies. 462occupies.
463 463
464Using :c:func:`xas_next` or :c:func:`xas_prev` with a multi-index xa_state 464Using xas_next() or xas_prev() with a multi-index xa_state
465is not supported. Using either of these functions on a multi-index entry 465is not supported. Using either of these functions on a multi-index entry
466will reveal sibling entries; these should be skipped over by the caller. 466will reveal sibling entries; these should be skipped over by the caller.
467 467
diff --git a/Documentation/device-mapper/cache-policies.txt b/Documentation/device-mapper/cache-policies.rst
index 86786d87d9a8..b17fe352fc41 100644
--- a/Documentation/device-mapper/cache-policies.txt
+++ b/Documentation/device-mapper/cache-policies.rst
@@ -1,3 +1,4 @@
1=============================
1Guidance for writing policies 2Guidance for writing policies
2============================= 3=============================
3 4
@@ -30,7 +31,7 @@ multiqueue (mq)
30 31
31This policy is now an alias for smq (see below). 32This policy is now an alias for smq (see below).
32 33
33The following tunables are accepted, but have no effect: 34The following tunables are accepted, but have no effect::
34 35
35 'sequential_threshold <#nr_sequential_ios>' 36 'sequential_threshold <#nr_sequential_ios>'
36 'random_threshold <#nr_random_ios>' 37 'random_threshold <#nr_random_ios>'
@@ -56,7 +57,9 @@ mq policy's hints to be dropped. Also, performance of the cache may
56degrade slightly until smq recalculates the origin device's hotspots 57degrade slightly until smq recalculates the origin device's hotspots
57that should be cached. 58that should be cached.
58 59
59Memory usage: 60Memory usage
61^^^^^^^^^^^^
62
60The mq policy used a lot of memory; 88 bytes per cache block on a 64 63The mq policy used a lot of memory; 88 bytes per cache block on a 64
61bit machine. 64bit machine.
62 65
@@ -69,7 +72,9 @@ cache block).
69All this means smq uses ~25bytes per cache block. Still a lot of 72All this means smq uses ~25bytes per cache block. Still a lot of
70memory, but a substantial improvement nontheless. 73memory, but a substantial improvement nontheless.
71 74
72Level balancing: 75Level balancing
76^^^^^^^^^^^^^^^
77
73mq placed entries in different levels of the multiqueue structures 78mq placed entries in different levels of the multiqueue structures
74based on their hit count (~ln(hit count)). This meant the bottom 79based on their hit count (~ln(hit count)). This meant the bottom
75levels generally had the most entries, and the top ones had very 80levels generally had the most entries, and the top ones had very
@@ -94,7 +99,9 @@ is used to decide which blocks to promote. If the hotspot queue is
94performing badly then it starts moving entries more quickly between 99performing badly then it starts moving entries more quickly between
95levels. This lets it adapt to new IO patterns very quickly. 100levels. This lets it adapt to new IO patterns very quickly.
96 101
97Performance: 102Performance
103^^^^^^^^^^^
104
98Testing smq shows substantially better performance than mq. 105Testing smq shows substantially better performance than mq.
99 106
100cleaner 107cleaner
@@ -105,16 +112,19 @@ The cleaner writes back all dirty blocks in a cache to decommission it.
105Examples 112Examples
106======== 113========
107 114
108The syntax for a table is: 115The syntax for a table is::
116
109 cache <metadata dev> <cache dev> <origin dev> <block size> 117 cache <metadata dev> <cache dev> <origin dev> <block size>
110 <#feature_args> [<feature arg>]* 118 <#feature_args> [<feature arg>]*
111 <policy> <#policy_args> [<policy arg>]* 119 <policy> <#policy_args> [<policy arg>]*
112 120
113The syntax to send a message using the dmsetup command is: 121The syntax to send a message using the dmsetup command is::
122
114 dmsetup message <mapped device> 0 sequential_threshold 1024 123 dmsetup message <mapped device> 0 sequential_threshold 1024
115 dmsetup message <mapped device> 0 random_threshold 8 124 dmsetup message <mapped device> 0 random_threshold 8
116 125
117Using dmsetup: 126Using dmsetup::
127
118 dmsetup create blah --table "0 268435456 cache /dev/sdb /dev/sdc \ 128 dmsetup create blah --table "0 268435456 cache /dev/sdb /dev/sdc \
119 /dev/sdd 512 0 mq 4 sequential_threshold 1024 random_threshold 8" 129 /dev/sdd 512 0 mq 4 sequential_threshold 1024 random_threshold 8"
120 creates a 128GB large mapped device named 'blah' with the 130 creates a 128GB large mapped device named 'blah' with the
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.rst
index 8ae1cf8e94da..f15e5254d05b 100644
--- a/Documentation/device-mapper/cache.txt
+++ b/Documentation/device-mapper/cache.rst
@@ -1,3 +1,7 @@
1=====
2Cache
3=====
4
1Introduction 5Introduction
2============ 6============
3 7
@@ -24,10 +28,13 @@ scenarios (eg. a vm image server).
24Glossary 28Glossary
25======== 29========
26 30
27 Migration - Movement of the primary copy of a logical block from one 31 Migration
32 Movement of the primary copy of a logical block from one
28 device to the other. 33 device to the other.
29 Promotion - Migration from slow device to fast device. 34 Promotion
30 Demotion - Migration from fast device to slow device. 35 Migration from slow device to fast device.
36 Demotion
37 Migration from fast device to slow device.
31 38
32The origin device always contains a copy of the logical block, which 39The origin device always contains a copy of the logical block, which
33may be out of date or kept in sync with the copy on the cache device 40may be out of date or kept in sync with the copy on the cache device
@@ -169,45 +176,53 @@ Target interface
169Constructor 176Constructor
170----------- 177-----------
171 178
172 cache <metadata dev> <cache dev> <origin dev> <block size> 179 ::
173 <#feature args> [<feature arg>]* 180
174 <policy> <#policy args> [policy args]* 181 cache <metadata dev> <cache dev> <origin dev> <block size>
182 <#feature args> [<feature arg>]*
183 <policy> <#policy args> [policy args]*
175 184
176 metadata dev : fast device holding the persistent metadata 185 ================ =======================================================
177 cache dev : fast device holding cached data blocks 186 metadata dev fast device holding the persistent metadata
178 origin dev : slow device holding original data blocks 187 cache dev fast device holding cached data blocks
179 block size : cache unit size in sectors 188 origin dev slow device holding original data blocks
189 block size cache unit size in sectors
180 190
181 #feature args : number of feature arguments passed 191 #feature args number of feature arguments passed
182 feature args : writethrough or passthrough (The default is writeback.) 192 feature args writethrough or passthrough (The default is writeback.)
183 193
184 policy : the replacement policy to use 194 policy the replacement policy to use
185 #policy args : an even number of arguments corresponding to 195 #policy args an even number of arguments corresponding to
186 key/value pairs passed to the policy 196 key/value pairs passed to the policy
187 policy args : key/value pairs passed to the policy 197 policy args key/value pairs passed to the policy
188 E.g. 'sequential_threshold 1024' 198 E.g. 'sequential_threshold 1024'
189 See cache-policies.txt for details. 199 See cache-policies.txt for details.
200 ================ =======================================================
190 201
191Optional feature arguments are: 202Optional feature arguments are:
192 writethrough : write through caching that prohibits cache block 203
193 content from being different from origin block content. 204
194 Without this argument, the default behaviour is to write 205 ==================== ========================================================
195 back cache block contents later for performance reasons, 206 writethrough write through caching that prohibits cache block
196 so they may differ from the corresponding origin blocks. 207 content from being different from origin block content.
197 208 Without this argument, the default behaviour is to write
198 passthrough : a degraded mode useful for various cache coherency 209 back cache block contents later for performance reasons,
199 situations (e.g., rolling back snapshots of 210 so they may differ from the corresponding origin blocks.
200 underlying storage). Reads and writes always go to 211
201 the origin. If a write goes to a cached origin 212 passthrough a degraded mode useful for various cache coherency
202 block, then the cache block is invalidated. 213 situations (e.g., rolling back snapshots of
203 To enable passthrough mode the cache must be clean. 214 underlying storage). Reads and writes always go to
204 215 the origin. If a write goes to a cached origin
205 metadata2 : use version 2 of the metadata. This stores the dirty bits 216 block, then the cache block is invalidated.
206 in a separate btree, which improves speed of shutting 217 To enable passthrough mode the cache must be clean.
207 down the cache. 218
208 219 metadata2 use version 2 of the metadata. This stores the dirty
209 no_discard_passdown : disable passing down discards from the cache 220 bits in a separate btree, which improves speed of
210 to the origin's data device. 221 shutting down the cache.
222
223 no_discard_passdown disable passing down discards from the cache
224 to the origin's data device.
225 ==================== ========================================================
211 226
212A policy called 'default' is always registered. This is an alias for 227A policy called 'default' is always registered. This is an alias for
213the policy we currently think is giving best all round performance. 228the policy we currently think is giving best all round performance.
@@ -218,54 +233,61 @@ the characteristics of a specific policy, always request it by name.
218Status 233Status
219------ 234------
220 235
221<metadata block size> <#used metadata blocks>/<#total metadata blocks> 236::
222<cache block size> <#used cache blocks>/<#total cache blocks> 237
223<#read hits> <#read misses> <#write hits> <#write misses> 238 <metadata block size> <#used metadata blocks>/<#total metadata blocks>
224<#demotions> <#promotions> <#dirty> <#features> <features>* 239 <cache block size> <#used cache blocks>/<#total cache blocks>
225<#core args> <core args>* <policy name> <#policy args> <policy args>* 240 <#read hits> <#read misses> <#write hits> <#write misses>
226<cache metadata mode> 241 <#demotions> <#promotions> <#dirty> <#features> <features>*
227 242 <#core args> <core args>* <policy name> <#policy args> <policy args>*
228metadata block size : Fixed block size for each metadata block in 243 <cache metadata mode>
229 sectors 244
230#used metadata blocks : Number of metadata blocks used 245
231#total metadata blocks : Total number of metadata blocks 246========================= =====================================================
232cache block size : Configurable block size for the cache device 247metadata block size Fixed block size for each metadata block in
233 in sectors 248 sectors
234#used cache blocks : Number of blocks resident in the cache 249#used metadata blocks Number of metadata blocks used
235#total cache blocks : Total number of cache blocks 250#total metadata blocks Total number of metadata blocks
236#read hits : Number of times a READ bio has been mapped 251cache block size Configurable block size for the cache device
237 to the cache 252 in sectors
238#read misses : Number of times a READ bio has been mapped 253#used cache blocks Number of blocks resident in the cache
239 to the origin 254#total cache blocks Total number of cache blocks
240#write hits : Number of times a WRITE bio has been mapped 255#read hits Number of times a READ bio has been mapped
241 to the cache 256 to the cache
242#write misses : Number of times a WRITE bio has been 257#read misses Number of times a READ bio has been mapped
243 mapped to the origin 258 to the origin
244#demotions : Number of times a block has been removed 259#write hits Number of times a WRITE bio has been mapped
245 from the cache 260 to the cache
246#promotions : Number of times a block has been moved to 261#write misses Number of times a WRITE bio has been
247 the cache 262 mapped to the origin
248#dirty : Number of blocks in the cache that differ 263#demotions Number of times a block has been removed
249 from the origin 264 from the cache
250#feature args : Number of feature args to follow 265#promotions Number of times a block has been moved to
251feature args : 'writethrough' (optional) 266 the cache
252#core args : Number of core arguments (must be even) 267#dirty Number of blocks in the cache that differ
253core args : Key/value pairs for tuning the core 268 from the origin
254 e.g. migration_threshold 269#feature args Number of feature args to follow
255policy name : Name of the policy 270feature args 'writethrough' (optional)
256#policy args : Number of policy arguments to follow (must be even) 271#core args Number of core arguments (must be even)
257policy args : Key/value pairs e.g. sequential_threshold 272core args Key/value pairs for tuning the core
258cache metadata mode : ro if read-only, rw if read-write 273 e.g. migration_threshold
259 In serious cases where even a read-only mode is deemed unsafe 274policy name Name of the policy
260 no further I/O will be permitted and the status will just 275#policy args Number of policy arguments to follow (must be even)
261 contain the string 'Fail'. The userspace recovery tools 276policy args Key/value pairs e.g. sequential_threshold
262 should then be used. 277cache metadata mode ro if read-only, rw if read-write
263needs_check : 'needs_check' if set, '-' if not set 278
264 A metadata operation has failed, resulting in the needs_check 279 In serious cases where even a read-only mode is
265 flag being set in the metadata's superblock. The metadata 280 deemed unsafe no further I/O will be permitted and
266 device must be deactivated and checked/repaired before the 281 the status will just contain the string 'Fail'.
267 cache can be made fully operational again. '-' indicates 282 The userspace recovery tools should then be used.
268 needs_check is not set. 283needs_check 'needs_check' if set, '-' if not set
284 A metadata operation has failed, resulting in the
285 needs_check flag being set in the metadata's
286 superblock. The metadata device must be
287 deactivated and checked/repaired before the
288 cache can be made fully operational again.
289 '-' indicates needs_check is not set.
290========================= =====================================================
269 291
270Messages 292Messages
271-------- 293--------
@@ -274,11 +296,12 @@ Policies will have different tunables, specific to each one, so we
274need a generic way of getting and setting these. Device-mapper 296need a generic way of getting and setting these. Device-mapper
275messages are used. (A sysfs interface would also be possible.) 297messages are used. (A sysfs interface would also be possible.)
276 298
277The message format is: 299The message format is::
278 300
279 <key> <value> 301 <key> <value>
280 302
281E.g. 303E.g.::
304
282 dmsetup message my_cache 0 sequential_threshold 1024 305 dmsetup message my_cache 0 sequential_threshold 1024
283 306
284 307
@@ -290,11 +313,12 @@ of values from 5 to 9. Each cblock must be expressed as a decimal
290value, in the future a variant message that takes cblock ranges 313value, in the future a variant message that takes cblock ranges
291expressed in hexadecimal may be needed to better support efficient 314expressed in hexadecimal may be needed to better support efficient
292invalidation of larger caches. The cache must be in passthrough mode 315invalidation of larger caches. The cache must be in passthrough mode
293when invalidate_cblocks is used. 316when invalidate_cblocks is used::
294 317
295 invalidate_cblocks [<cblock>|<cblock begin>-<cblock end>]* 318 invalidate_cblocks [<cblock>|<cblock begin>-<cblock end>]*
296 319
297E.g. 320E.g.::
321
298 dmsetup message my_cache 0 invalidate_cblocks 2345 3456-4567 5678-6789 322 dmsetup message my_cache 0 invalidate_cblocks 2345 3456-4567 5678-6789
299 323
300Examples 324Examples
@@ -304,8 +328,10 @@ The test suite can be found here:
304 328
305https://github.com/jthornber/device-mapper-test-suite 329https://github.com/jthornber/device-mapper-test-suite
306 330
307dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \ 331::
308 /dev/mapper/ssd /dev/mapper/origin 512 1 writeback default 0' 332
309dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \ 333 dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \
310 /dev/mapper/ssd /dev/mapper/origin 1024 1 writeback \ 334 /dev/mapper/ssd /dev/mapper/origin 512 1 writeback default 0'
311 mq 4 sequential_threshold 1024 random_threshold 8' 335 dmsetup create my_cache --table '0 41943040 cache /dev/mapper/metadata \
336 /dev/mapper/ssd /dev/mapper/origin 1024 1 writeback \
337 mq 4 sequential_threshold 1024 random_threshold 8'
diff --git a/Documentation/device-mapper/delay.txt b/Documentation/device-mapper/delay.rst
index 6426c45273cb..917ba8c33359 100644
--- a/Documentation/device-mapper/delay.txt
+++ b/Documentation/device-mapper/delay.rst
@@ -1,10 +1,12 @@
1========
1dm-delay 2dm-delay
2======== 3========
3 4
4Device-Mapper's "delay" target delays reads and/or writes 5Device-Mapper's "delay" target delays reads and/or writes
5and maps them to different devices. 6and maps them to different devices.
6 7
7Parameters: 8Parameters::
9
8 <device> <offset> <delay> [<write_device> <write_offset> <write_delay> 10 <device> <offset> <delay> [<write_device> <write_offset> <write_delay>
9 [<flush_device> <flush_offset> <flush_delay>]] 11 [<flush_device> <flush_offset> <flush_delay>]]
10 12
@@ -14,15 +16,16 @@ Delays are specified in milliseconds.
14 16
15Example scripts 17Example scripts
16=============== 18===============
17[[ 19
18#!/bin/sh 20::
19# Create device delaying rw operation for 500ms 21
20echo "0 `blockdev --getsz $1` delay $1 0 500" | dmsetup create delayed 22 #!/bin/sh
21]] 23 # Create device delaying rw operation for 500ms
22 24 echo "0 `blockdev --getsz $1` delay $1 0 500" | dmsetup create delayed
23[[ 25
24#!/bin/sh 26::
25# Create device delaying only write operation for 500ms and 27
26# splitting reads and writes to different devices $1 $2 28 #!/bin/sh
27echo "0 `blockdev --getsz $1` delay $1 0 0 $2 0 500" | dmsetup create delayed 29 # Create device delaying only write operation for 500ms and
28]] 30 # splitting reads and writes to different devices $1 $2
31 echo "0 `blockdev --getsz $1` delay $1 0 0 $2 0 500" | dmsetup create delayed
diff --git a/Documentation/device-mapper/dm-crypt.txt b/Documentation/device-mapper/dm-crypt.rst
index 3b3e1de21c9c..8f4a3f889d43 100644
--- a/Documentation/device-mapper/dm-crypt.txt
+++ b/Documentation/device-mapper/dm-crypt.rst
@@ -1,5 +1,6 @@
1========
1dm-crypt 2dm-crypt
2========= 3========
3 4
4Device-Mapper's "crypt" target provides transparent encryption of block devices 5Device-Mapper's "crypt" target provides transparent encryption of block devices
5using the kernel crypto API. 6using the kernel crypto API.
@@ -7,15 +8,20 @@ using the kernel crypto API.
7For a more detailed description of supported parameters see: 8For a more detailed description of supported parameters see:
8https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt 9https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt
9 10
10Parameters: <cipher> <key> <iv_offset> <device path> \ 11Parameters::
12
13 <cipher> <key> <iv_offset> <device path> \
11 <offset> [<#opt_params> <opt_params>] 14 <offset> [<#opt_params> <opt_params>]
12 15
13<cipher> 16<cipher>
14 Encryption cipher, encryption mode and Initial Vector (IV) generator. 17 Encryption cipher, encryption mode and Initial Vector (IV) generator.
15 18
16 The cipher specifications format is: 19 The cipher specifications format is::
20
17 cipher[:keycount]-chainmode-ivmode[:ivopts] 21 cipher[:keycount]-chainmode-ivmode[:ivopts]
18 Examples: 22
23 Examples::
24
19 aes-cbc-essiv:sha256 25 aes-cbc-essiv:sha256
20 aes-xts-plain64 26 aes-xts-plain64
21 serpent-xts-plain64 27 serpent-xts-plain64
@@ -25,12 +31,17 @@ Parameters: <cipher> <key> <iv_offset> <device path> \
25 as for the first format type. 31 as for the first format type.
26 This format is mainly used for specification of authenticated modes. 32 This format is mainly used for specification of authenticated modes.
27 33
28 The crypto API cipher specifications format is: 34 The crypto API cipher specifications format is::
35
29 capi:cipher_api_spec-ivmode[:ivopts] 36 capi:cipher_api_spec-ivmode[:ivopts]
30 Examples: 37
38 Examples::
39
31 capi:cbc(aes)-essiv:sha256 40 capi:cbc(aes)-essiv:sha256
32 capi:xts(aes)-plain64 41 capi:xts(aes)-plain64
33 Examples of authenticated modes: 42
43 Examples of authenticated modes::
44
34 capi:gcm(aes)-random 45 capi:gcm(aes)-random
35 capi:authenc(hmac(sha256),xts(aes))-random 46 capi:authenc(hmac(sha256),xts(aes))-random
36 capi:rfc7539(chacha20,poly1305)-random 47 capi:rfc7539(chacha20,poly1305)-random
@@ -142,21 +153,21 @@ LUKS (Linux Unified Key Setup) is now the preferred way to set up disk
142encryption with dm-crypt using the 'cryptsetup' utility, see 153encryption with dm-crypt using the 'cryptsetup' utility, see
143https://gitlab.com/cryptsetup/cryptsetup 154https://gitlab.com/cryptsetup/cryptsetup
144 155
145[[ 156::
146#!/bin/sh 157
147# Create a crypt device using dmsetup 158 #!/bin/sh
148dmsetup create crypt1 --table "0 `blockdev --getsz $1` crypt aes-cbc-essiv:sha256 babebabebabebabebabebabebabebabe 0 $1 0" 159 # Create a crypt device using dmsetup
149]] 160 dmsetup create crypt1 --table "0 `blockdev --getsz $1` crypt aes-cbc-essiv:sha256 babebabebabebabebabebabebabebabe 0 $1 0"
150 161
151[[ 162::
152#!/bin/sh 163
153# Create a crypt device using dmsetup when encryption key is stored in keyring service 164 #!/bin/sh
154dmsetup create crypt2 --table "0 `blockdev --getsize $1` crypt aes-cbc-essiv:sha256 :32:logon:my_prefix:my_key 0 $1 0" 165 # Create a crypt device using dmsetup when encryption key is stored in keyring service
155]] 166 dmsetup create crypt2 --table "0 `blockdev --getsize $1` crypt aes-cbc-essiv:sha256 :32:logon:my_prefix:my_key 0 $1 0"
156 167
157[[ 168::
158#!/bin/sh 169
159# Create a crypt device using cryptsetup and LUKS header with default cipher 170 #!/bin/sh
160cryptsetup luksFormat $1 171 # Create a crypt device using cryptsetup and LUKS header with default cipher
161cryptsetup luksOpen $1 crypt1 172 cryptsetup luksFormat $1
162]] 173 cryptsetup luksOpen $1 crypt1
diff --git a/Documentation/device-mapper/dm-flakey.txt b/Documentation/device-mapper/dm-flakey.rst
index 9f0e247d0877..86138735879d 100644
--- a/Documentation/device-mapper/dm-flakey.txt
+++ b/Documentation/device-mapper/dm-flakey.rst
@@ -1,3 +1,4 @@
1=========
1dm-flakey 2dm-flakey
2========= 3=========
3 4
@@ -15,17 +16,26 @@ underlying devices.
15 16
16Table parameters 17Table parameters
17---------------- 18----------------
19
20::
21
18 <dev path> <offset> <up interval> <down interval> \ 22 <dev path> <offset> <up interval> <down interval> \
19 [<num_features> [<feature arguments>]] 23 [<num_features> [<feature arguments>]]
20 24
21Mandatory parameters: 25Mandatory parameters:
22 <dev path>: Full pathname to the underlying block-device, or a 26
23 "major:minor" device-number. 27 <dev path>:
24 <offset>: Starting sector within the device. 28 Full pathname to the underlying block-device, or a
25 <up interval>: Number of seconds device is available. 29 "major:minor" device-number.
26 <down interval>: Number of seconds device returns errors. 30 <offset>:
31 Starting sector within the device.
32 <up interval>:
33 Number of seconds device is available.
34 <down interval>:
35 Number of seconds device returns errors.
27 36
28Optional feature parameters: 37Optional feature parameters:
38
29 If no feature parameters are present, during the periods of 39 If no feature parameters are present, during the periods of
30 unreliability, all I/O returns errors. 40 unreliability, all I/O returns errors.
31 41
@@ -41,17 +51,24 @@ Optional feature parameters:
41 During <down interval>, replace <Nth_byte> of the data of 51 During <down interval>, replace <Nth_byte> of the data of
42 each matching bio with <value>. 52 each matching bio with <value>.
43 53
44 <Nth_byte>: The offset of the byte to replace. 54 <Nth_byte>:
45 Counting starts at 1, to replace the first byte. 55 The offset of the byte to replace.
46 <direction>: Either 'r' to corrupt reads or 'w' to corrupt writes. 56 Counting starts at 1, to replace the first byte.
47 'w' is incompatible with drop_writes. 57 <direction>:
48 <value>: The value (from 0-255) to write. 58 Either 'r' to corrupt reads or 'w' to corrupt writes.
49 <flags>: Perform the replacement only if bio->bi_opf has all the 59 'w' is incompatible with drop_writes.
50 selected flags set. 60 <value>:
61 The value (from 0-255) to write.
62 <flags>:
63 Perform the replacement only if bio->bi_opf has all the
64 selected flags set.
51 65
52Examples: 66Examples:
67
68Replaces the 32nd byte of READ bios with the value 1::
69
53 corrupt_bio_byte 32 r 1 0 70 corrupt_bio_byte 32 r 1 0
54 - replaces the 32nd byte of READ bios with the value 1 71
72Replaces the 224th byte of REQ_META (=32) bios with the value 0::
55 73
56 corrupt_bio_byte 224 w 0 32 74 corrupt_bio_byte 224 w 0 32
57 - replaces the 224th byte of REQ_META (=32) bios with the value 0
diff --git a/Documentation/device-mapper/dm-init.txt b/Documentation/device-mapper/dm-init.rst
index 8464ee7c01b8..e5242ff17e9b 100644
--- a/Documentation/device-mapper/dm-init.txt
+++ b/Documentation/device-mapper/dm-init.rst
@@ -1,5 +1,6 @@
1================================
1Early creation of mapped devices 2Early creation of mapped devices
2==================================== 3================================
3 4
4It is possible to configure a device-mapper device to act as the root device for 5It is possible to configure a device-mapper device to act as the root device for
5your system in two ways. 6your system in two ways.
@@ -12,15 +13,17 @@ The second is to create one or more device-mappers using the module parameter
12 13
13The format is specified as a string of data separated by commas and optionally 14The format is specified as a string of data separated by commas and optionally
14semi-colons, where: 15semi-colons, where:
16
15 - a comma is used to separate fields like name, uuid, flags and table 17 - a comma is used to separate fields like name, uuid, flags and table
16 (specifies one device) 18 (specifies one device)
17 - a semi-colon is used to separate devices. 19 - a semi-colon is used to separate devices.
18 20
19So the format will look like this: 21So the format will look like this::
20 22
21 dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+] 23 dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
22 24
23Where, 25Where::
26
24 <name> ::= The device name. 27 <name> ::= The device name.
25 <uuid> ::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | "" 28 <uuid> ::= xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ""
26 <minor> ::= The device minor number | "" 29 <minor> ::= The device minor number | ""
@@ -29,7 +32,7 @@ Where,
29 <target_type> ::= "verity" | "linear" | ... (see list below) 32 <target_type> ::= "verity" | "linear" | ... (see list below)
30 33
31The dm line should be equivalent to the one used by the dmsetup tool with the 34The dm line should be equivalent to the one used by the dmsetup tool with the
32--concise argument. 35`--concise` argument.
33 36
34Target types 37Target types
35============ 38============
@@ -38,32 +41,34 @@ Not all target types are available as there are serious risks in allowing
38activation of certain DM targets without first using userspace tools to check 41activation of certain DM targets without first using userspace tools to check
39the validity of associated metadata. 42the validity of associated metadata.
40 43
41 "cache": constrained, userspace should verify cache device 44======================= =======================================================
42 "crypt": allowed 45`cache` constrained, userspace should verify cache device
43 "delay": allowed 46`crypt` allowed
44 "era": constrained, userspace should verify metadata device 47`delay` allowed
45 "flakey": constrained, meant for test 48`era` constrained, userspace should verify metadata device
46 "linear": allowed 49`flakey` constrained, meant for test
47 "log-writes": constrained, userspace should verify metadata device 50`linear` allowed
48 "mirror": constrained, userspace should verify main/mirror device 51`log-writes` constrained, userspace should verify metadata device
49 "raid": constrained, userspace should verify metadata device 52`mirror` constrained, userspace should verify main/mirror device
50 "snapshot": constrained, userspace should verify src/dst device 53`raid` constrained, userspace should verify metadata device
51 "snapshot-origin": allowed 54`snapshot` constrained, userspace should verify src/dst device
52 "snapshot-merge": constrained, userspace should verify src/dst device 55`snapshot-origin` allowed
53 "striped": allowed 56`snapshot-merge` constrained, userspace should verify src/dst device
54 "switch": constrained, userspace should verify dev path 57`striped` allowed
55 "thin": constrained, requires dm target message from userspace 58`switch` constrained, userspace should verify dev path
56 "thin-pool": constrained, requires dm target message from userspace 59`thin` constrained, requires dm target message from userspace
57 "verity": allowed 60`thin-pool` constrained, requires dm target message from userspace
58 "writecache": constrained, userspace should verify cache device 61`verity` allowed
59 "zero": constrained, not meant for rootfs 62`writecache` constrained, userspace should verify cache device
63`zero` constrained, not meant for rootfs
64======================= =======================================================
60 65
61If the target is not listed above, it is constrained by default (not tested). 66If the target is not listed above, it is constrained by default (not tested).
62 67
63Examples 68Examples
64======== 69========
65An example of booting to a linear array made up of user-mode linux block 70An example of booting to a linear array made up of user-mode linux block
66devices: 71devices::
67 72
68 dm-mod.create="lroot,,,rw, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" root=/dev/dm-0 73 dm-mod.create="lroot,,,rw, 0 4096 linear 98:16 0, 4096 4096 linear 98:32 0" root=/dev/dm-0
69 74
@@ -71,43 +76,49 @@ This will boot to a rw dm-linear target of 8192 sectors split across two block
71devices identified by their major:minor numbers. After boot, udev will rename 76devices identified by their major:minor numbers. After boot, udev will rename
72this target to /dev/mapper/lroot (depending on the rules). No uuid was assigned. 77this target to /dev/mapper/lroot (depending on the rules). No uuid was assigned.
73 78
74An example of multiple device-mappers, with the dm-mod.create="..." contents is shown here 79An example of multiple device-mappers, with the dm-mod.create="..." contents
75split on multiple lines for readability: 80is shown here split on multiple lines for readability::
76 81
77 vroot,,,ro, 82 dm-linear,,1,rw,
78 0 1740800 verity 254:0 254:0 1740800 sha1 83 0 32768 linear 8:1 0,
79 76e9be054b15884a9fa85973e9cb274c93afadb6 84 32768 1024000 linear 8:2 0;
80 5b3549d54d6c7a3837b9b81ed72e49463a64c03680c47835bef94d768e5646fe; 85 dm-verity,,3,ro,
81 vram,,,rw, 86 0 1638400 verity 1 /dev/sdc1 /dev/sdc2 4096 4096 204800 1 sha256
82 0 32768 linear 1:0 0, 87 ac87db56303c9c1da433d7209b5a6ef3e4779df141200cbd7c157dcb8dd89c42
83 32768 32768 linear 1:1 0 88 5ebfe87f7df3235b80a117ebc4078e44f55045487ad4a96581d1adb564615b51
84 89
85Other examples (per target): 90Other examples (per target):
86 91
87"crypt": 92"crypt"::
93
88 dm-crypt,,8,ro, 94 dm-crypt,,8,ro,
89 0 1048576 crypt aes-xts-plain64 95 0 1048576 crypt aes-xts-plain64
90 babebabebabebabebabebabebabebabebabebabebabebabebabebabebabebabe 0 96 babebabebabebabebabebabebabebabebabebabebabebabebabebabebabebabe 0
91 /dev/sda 0 1 allow_discards 97 /dev/sda 0 1 allow_discards
92 98
93"delay": 99"delay"::
100
94 dm-delay,,4,ro,0 409600 delay /dev/sda1 0 500 101 dm-delay,,4,ro,0 409600 delay /dev/sda1 0 500
95 102
96"linear": 103"linear"::
104
97 dm-linear,,,rw, 105 dm-linear,,,rw,
98 0 32768 linear /dev/sda1 0, 106 0 32768 linear /dev/sda1 0,
99 32768 1024000 linear /dev/sda2 0, 107 32768 1024000 linear /dev/sda2 0,
100 1056768 204800 linear /dev/sda3 0, 108 1056768 204800 linear /dev/sda3 0,
101 1261568 512000 linear /dev/sda4 0 109 1261568 512000 linear /dev/sda4 0
102 110
103"snapshot-origin": 111"snapshot-origin"::
112
104 dm-snap-orig,,4,ro,0 409600 snapshot-origin 8:2 113 dm-snap-orig,,4,ro,0 409600 snapshot-origin 8:2
105 114
106"striped": 115"striped"::
116
107 dm-striped,,4,ro,0 1638400 striped 4 4096 117 dm-striped,,4,ro,0 1638400 striped 4 4096
108 /dev/sda1 0 /dev/sda2 0 /dev/sda3 0 /dev/sda4 0 118 /dev/sda1 0 /dev/sda2 0 /dev/sda3 0 /dev/sda4 0
109 119
110"verity": 120"verity"::
121
111 dm-verity,,4,ro, 122 dm-verity,,4,ro,
112 0 1638400 verity 1 8:1 8:2 4096 4096 204800 1 sha256 123 0 1638400 verity 1 8:1 8:2 4096 4096 204800 1 sha256
113 fb1a5a0f00deb908d8b53cb270858975e76cf64105d412ce764225d53b8f3cfd 124 fb1a5a0f00deb908d8b53cb270858975e76cf64105d412ce764225d53b8f3cfd
diff --git a/Documentation/device-mapper/dm-integrity.txt b/Documentation/device-mapper/dm-integrity.rst
index d63d78ffeb73..a30aa91b5fbe 100644
--- a/Documentation/device-mapper/dm-integrity.txt
+++ b/Documentation/device-mapper/dm-integrity.rst
@@ -1,3 +1,7 @@
1============
2dm-integrity
3============
4
1The dm-integrity target emulates a block device that has additional 5The dm-integrity target emulates a block device that has additional
2per-sector tags that can be used for storing integrity information. 6per-sector tags that can be used for storing integrity information.
3 7
@@ -35,15 +39,16 @@ zeroes. If the superblock is neither valid nor zeroed, the dm-integrity
35target can't be loaded. 39target can't be loaded.
36 40
37To use the target for the first time: 41To use the target for the first time:
42
381. overwrite the superblock with zeroes 431. overwrite the superblock with zeroes
392. load the dm-integrity target with one-sector size, the kernel driver 442. load the dm-integrity target with one-sector size, the kernel driver
40 will format the device 45 will format the device
413. unload the dm-integrity target 463. unload the dm-integrity target
424. read the "provided_data_sectors" value from the superblock 474. read the "provided_data_sectors" value from the superblock
435. load the dm-integrity target with the the target size 485. load the dm-integrity target with the the target size
44 "provided_data_sectors" 49 "provided_data_sectors"
456. if you want to use dm-integrity with dm-crypt, load the dm-crypt target 506. if you want to use dm-integrity with dm-crypt, load the dm-crypt target
46 with the size "provided_data_sectors" 51 with the size "provided_data_sectors"
47 52
48 53
49Target arguments: 54Target arguments:
@@ -51,17 +56,20 @@ Target arguments:
511. the underlying block device 561. the underlying block device
52 57
532. the number of reserved sector at the beginning of the device - the 582. the number of reserved sector at the beginning of the device - the
54 dm-integrity won't read of write these sectors 59 dm-integrity won't read of write these sectors
55 60
563. the size of the integrity tag (if "-" is used, the size is taken from 613. the size of the integrity tag (if "-" is used, the size is taken from
57 the internal-hash algorithm) 62 the internal-hash algorithm)
58 63
594. mode: 644. mode:
60 D - direct writes (without journal) - in this mode, journaling is 65
66 D - direct writes (without journal)
67 in this mode, journaling is
61 not used and data sectors and integrity tags are written 68 not used and data sectors and integrity tags are written
62 separately. In case of crash, it is possible that the data 69 separately. In case of crash, it is possible that the data
63 and integrity tag doesn't match. 70 and integrity tag doesn't match.
64 J - journaled writes - data and integrity tags are written to the 71 J - journaled writes
72 data and integrity tags are written to the
65 journal and atomicity is guaranteed. In case of crash, 73 journal and atomicity is guaranteed. In case of crash,
66 either both data and tag or none of them are written. The 74 either both data and tag or none of them are written. The
67 journaled mode degrades write throughput twice because the 75 journaled mode degrades write throughput twice because the
@@ -178,9 +186,12 @@ and the reloaded target would be non-functional.
178 186
179 187
180The layout of the formatted block device: 188The layout of the formatted block device:
181* reserved sectors (they are not used by this target, they can be used for 189
182 storing LUKS metadata or for other purpose), the size of the reserved 190* reserved sectors
183 area is specified in the target arguments 191 (they are not used by this target, they can be used for
192 storing LUKS metadata or for other purpose), the size of the reserved
193 area is specified in the target arguments
194
184* superblock (4kiB) 195* superblock (4kiB)
185 * magic string - identifies that the device was formatted 196 * magic string - identifies that the device was formatted
186 * version 197 * version
@@ -192,40 +203,55 @@ The layout of the formatted block device:
192 metadata and padding). The user of this target should not send 203 metadata and padding). The user of this target should not send
193 bios that access data beyond the "provided data sectors" limit. 204 bios that access data beyond the "provided data sectors" limit.
194 * flags 205 * flags
195 SB_FLAG_HAVE_JOURNAL_MAC - a flag is set if journal_mac is used 206 SB_FLAG_HAVE_JOURNAL_MAC
196 SB_FLAG_RECALCULATING - recalculating is in progress 207 - a flag is set if journal_mac is used
197 SB_FLAG_DIRTY_BITMAP - journal area contains the bitmap of dirty 208 SB_FLAG_RECALCULATING
198 blocks 209 - recalculating is in progress
210 SB_FLAG_DIRTY_BITMAP
211 - journal area contains the bitmap of dirty
212 blocks
199 * log2(sectors per block) 213 * log2(sectors per block)
200 * a position where recalculating finished 214 * a position where recalculating finished
201* journal 215* journal
202 The journal is divided into sections, each section contains: 216 The journal is divided into sections, each section contains:
217
203 * metadata area (4kiB), it contains journal entries 218 * metadata area (4kiB), it contains journal entries
204 every journal entry contains: 219
220 - every journal entry contains:
221
205 * logical sector (specifies where the data and tag should 222 * logical sector (specifies where the data and tag should
206 be written) 223 be written)
207 * last 8 bytes of data 224 * last 8 bytes of data
208 * integrity tag (the size is specified in the superblock) 225 * integrity tag (the size is specified in the superblock)
209 every metadata sector ends with 226
227 - every metadata sector ends with
228
210 * mac (8-bytes), all the macs in 8 metadata sectors form a 229 * mac (8-bytes), all the macs in 8 metadata sectors form a
211 64-byte value. It is used to store hmac of sector 230 64-byte value. It is used to store hmac of sector
212 numbers in the journal section, to protect against a 231 numbers in the journal section, to protect against a
213 possibility that the attacker tampers with sector 232 possibility that the attacker tampers with sector
214 numbers in the journal. 233 numbers in the journal.
215 * commit id 234 * commit id
235
216 * data area (the size is variable; it depends on how many journal 236 * data area (the size is variable; it depends on how many journal
217 entries fit into the metadata area) 237 entries fit into the metadata area)
218 every sector in the data area contains: 238
239 - every sector in the data area contains:
240
219 * data (504 bytes of data, the last 8 bytes are stored in 241 * data (504 bytes of data, the last 8 bytes are stored in
220 the journal entry) 242 the journal entry)
221 * commit id 243 * commit id
244
222 To test if the whole journal section was written correctly, every 245 To test if the whole journal section was written correctly, every
223 512-byte sector of the journal ends with 8-byte commit id. If the 246 512-byte sector of the journal ends with 8-byte commit id. If the
224 commit id matches on all sectors in a journal section, then it is 247 commit id matches on all sectors in a journal section, then it is
225 assumed that the section was written correctly. If the commit id 248 assumed that the section was written correctly. If the commit id
226 doesn't match, the section was written partially and it should not 249 doesn't match, the section was written partially and it should not
227 be replayed. 250 be replayed.
228* one or more runs of interleaved tags and data. Each run contains: 251
252* one or more runs of interleaved tags and data.
253 Each run contains:
254
229 * tag area - it contains integrity tags. There is one tag for each 255 * tag area - it contains integrity tags. There is one tag for each
230 sector in the data area 256 sector in the data area
231 * data area - it contains data sectors. The number of data sectors 257 * data area - it contains data sectors. The number of data sectors
diff --git a/Documentation/device-mapper/dm-io.txt b/Documentation/device-mapper/dm-io.rst
index 3b5d9a52cdcf..d2492917a1f5 100644
--- a/Documentation/device-mapper/dm-io.txt
+++ b/Documentation/device-mapper/dm-io.rst
@@ -1,3 +1,4 @@
1=====
1dm-io 2dm-io
2===== 3=====
3 4
@@ -7,7 +8,7 @@ version.
7 8
8The user must set up an io_region structure to describe the desired location 9The user must set up an io_region structure to describe the desired location
9of the I/O. Each io_region indicates a block-device along with the starting 10of the I/O. Each io_region indicates a block-device along with the starting
10sector and size of the region. 11sector and size of the region::
11 12
12 struct io_region { 13 struct io_region {
13 struct block_device *bdev; 14 struct block_device *bdev;
@@ -19,7 +20,7 @@ Dm-io can read from one io_region or write to one or more io_regions. Writes
19to multiple regions are specified by an array of io_region structures. 20to multiple regions are specified by an array of io_region structures.
20 21
21The first I/O service type takes a list of memory pages as the data buffer for 22The first I/O service type takes a list of memory pages as the data buffer for
22the I/O, along with an offset into the first page. 23the I/O, along with an offset into the first page::
23 24
24 struct page_list { 25 struct page_list {
25 struct page_list *next; 26 struct page_list *next;
@@ -35,7 +36,7 @@ the I/O, along with an offset into the first page.
35 36
36The second I/O service type takes an array of bio vectors as the data buffer 37The second I/O service type takes an array of bio vectors as the data buffer
37for the I/O. This service can be handy if the caller has a pre-assembled bio, 38for the I/O. This service can be handy if the caller has a pre-assembled bio,
38but wants to direct different portions of the bio to different devices. 39but wants to direct different portions of the bio to different devices::
39 40
40 int dm_io_sync_bvec(unsigned int num_regions, struct io_region *where, 41 int dm_io_sync_bvec(unsigned int num_regions, struct io_region *where,
41 int rw, struct bio_vec *bvec, 42 int rw, struct bio_vec *bvec,
@@ -47,7 +48,7 @@ but wants to direct different portions of the bio to different devices.
47The third I/O service type takes a pointer to a vmalloc'd memory buffer as the 48The third I/O service type takes a pointer to a vmalloc'd memory buffer as the
48data buffer for the I/O. This service can be handy if the caller needs to do 49data buffer for the I/O. This service can be handy if the caller needs to do
49I/O to a large region but doesn't want to allocate a large number of individual 50I/O to a large region but doesn't want to allocate a large number of individual
50memory pages. 51memory pages::
51 52
52 int dm_io_sync_vm(unsigned int num_regions, struct io_region *where, int rw, 53 int dm_io_sync_vm(unsigned int num_regions, struct io_region *where, int rw,
53 void *data, unsigned long *error_bits); 54 void *data, unsigned long *error_bits);
@@ -55,11 +56,11 @@ memory pages.
55 void *data, io_notify_fn fn, void *context); 56 void *data, io_notify_fn fn, void *context);
56 57
57Callers of the asynchronous I/O services must include the name of a completion 58Callers of the asynchronous I/O services must include the name of a completion
58callback routine and a pointer to some context data for the I/O. 59callback routine and a pointer to some context data for the I/O::
59 60
60 typedef void (*io_notify_fn)(unsigned long error, void *context); 61 typedef void (*io_notify_fn)(unsigned long error, void *context);
61 62
62The "error" parameter in this callback, as well as the "*error" parameter in 63The "error" parameter in this callback, as well as the `*error` parameter in
63all of the synchronous versions, is a bitset (instead of a simple error value). 64all of the synchronous versions, is a bitset (instead of a simple error value).
64In the case of an write-I/O to multiple regions, this bitset allows dm-io to 65In the case of an write-I/O to multiple regions, this bitset allows dm-io to
65indicate success or failure on each individual region. 66indicate success or failure on each individual region.
@@ -72,4 +73,3 @@ always available in order to avoid unnecessary waiting while performing I/O.
72When the user is finished using the dm-io services, they should call 73When the user is finished using the dm-io services, they should call
73dm_io_put() and specify the same number of pages that were given on the 74dm_io_put() and specify the same number of pages that were given on the
74dm_io_get() call. 75dm_io_get() call.
75
diff --git a/Documentation/device-mapper/dm-log.txt b/Documentation/device-mapper/dm-log.rst
index c155ac569c44..ba4fce39bc27 100644
--- a/Documentation/device-mapper/dm-log.txt
+++ b/Documentation/device-mapper/dm-log.rst
@@ -1,3 +1,4 @@
1=====================
1Device-Mapper Logging 2Device-Mapper Logging
2===================== 3=====================
3The device-mapper logging code is used by some of the device-mapper 4The device-mapper logging code is used by some of the device-mapper
@@ -16,11 +17,13 @@ dm_dirty_log_type in include/linux/dm-dirty-log.h). Various different
16logging implementations are available and provide different 17logging implementations are available and provide different
17capabilities. The list includes: 18capabilities. The list includes:
18 19
20============== ==============================================================
19Type Files 21Type Files
20==== ===== 22============== ==============================================================
21disk drivers/md/dm-log.c 23disk drivers/md/dm-log.c
22core drivers/md/dm-log.c 24core drivers/md/dm-log.c
23userspace drivers/md/dm-log-userspace* include/linux/dm-log-userspace.h 25userspace drivers/md/dm-log-userspace* include/linux/dm-log-userspace.h
26============== ==============================================================
24 27
25The "disk" log type 28The "disk" log type
26------------------- 29-------------------
diff --git a/Documentation/device-mapper/dm-queue-length.txt b/Documentation/device-mapper/dm-queue-length.rst
index f4db2562175c..d8e381c1cb02 100644
--- a/Documentation/device-mapper/dm-queue-length.txt
+++ b/Documentation/device-mapper/dm-queue-length.rst
@@ -1,3 +1,4 @@
1===============
1dm-queue-length 2dm-queue-length
2=============== 3===============
3 4
@@ -6,12 +7,18 @@ which selects a path with the least number of in-flight I/Os.
6The path selector name is 'queue-length'. 7The path selector name is 'queue-length'.
7 8
8Table parameters for each path: [<repeat_count>] 9Table parameters for each path: [<repeat_count>]
10
11::
12
9 <repeat_count>: The number of I/Os to dispatch using the selected 13 <repeat_count>: The number of I/Os to dispatch using the selected
10 path before switching to the next path. 14 path before switching to the next path.
11 If not given, internal default is used. To check 15 If not given, internal default is used. To check
12 the default value, see the activated table. 16 the default value, see the activated table.
13 17
14Status for each path: <status> <fail-count> <in-flight> 18Status for each path: <status> <fail-count> <in-flight>
19
20::
21
15 <status>: 'A' if the path is active, 'F' if the path is failed. 22 <status>: 'A' if the path is active, 'F' if the path is failed.
16 <fail-count>: The number of path failures. 23 <fail-count>: The number of path failures.
17 <in-flight>: The number of in-flight I/Os on the path. 24 <in-flight>: The number of in-flight I/Os on the path.
@@ -29,11 +36,13 @@ Examples
29======== 36========
30In case that 2 paths (sda and sdb) are used with repeat_count == 128. 37In case that 2 paths (sda and sdb) are used with repeat_count == 128.
31 38
32# echo "0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128" \ 39::
33 dmsetup create test 40
34# 41 # echo "0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128" \
35# dmsetup table 42 dmsetup create test
36test: 0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128 43 #
37# 44 # dmsetup table
38# dmsetup status 45 test: 0 10 multipath 0 0 1 1 queue-length 0 2 1 8:0 128 8:16 128
39test: 0 10 multipath 2 0 0 0 1 1 E 0 2 1 8:0 A 0 0 8:16 A 0 0 46 #
47 # dmsetup status
48 test: 0 10 multipath 2 0 0 0 1 1 E 0 2 1 8:0 A 0 0 8:16 A 0 0
diff --git a/Documentation/device-mapper/dm-raid.txt b/Documentation/device-mapper/dm-raid.rst
index 2355bef14653..2fe255b130fb 100644
--- a/Documentation/device-mapper/dm-raid.txt
+++ b/Documentation/device-mapper/dm-raid.rst
@@ -1,3 +1,4 @@
1=======
1dm-raid 2dm-raid
2======= 3=======
3 4
@@ -8,49 +9,66 @@ interface.
8 9
9Mapping Table Interface 10Mapping Table Interface
10----------------------- 11-----------------------
11The target is named "raid" and it accepts the following parameters: 12The target is named "raid" and it accepts the following parameters::
12 13
13 <raid_type> <#raid_params> <raid_params> \ 14 <raid_type> <#raid_params> <raid_params> \
14 <#raid_devs> <metadata_dev0> <dev0> [.. <metadata_devN> <devN>] 15 <#raid_devs> <metadata_dev0> <dev0> [.. <metadata_devN> <devN>]
15 16
16<raid_type>: 17<raid_type>:
18
19 ============= ===============================================================
17 raid0 RAID0 striping (no resilience) 20 raid0 RAID0 striping (no resilience)
18 raid1 RAID1 mirroring 21 raid1 RAID1 mirroring
19 raid4 RAID4 with dedicated last parity disk 22 raid4 RAID4 with dedicated last parity disk
20 raid5_n RAID5 with dedicated last parity disk supporting takeover 23 raid5_n RAID5 with dedicated last parity disk supporting takeover
21 Same as raid4 24 Same as raid4
22 -Transitory layout 25
26 - Transitory layout
23 raid5_la RAID5 left asymmetric 27 raid5_la RAID5 left asymmetric
28
24 - rotating parity 0 with data continuation 29 - rotating parity 0 with data continuation
25 raid5_ra RAID5 right asymmetric 30 raid5_ra RAID5 right asymmetric
31
26 - rotating parity N with data continuation 32 - rotating parity N with data continuation
27 raid5_ls RAID5 left symmetric 33 raid5_ls RAID5 left symmetric
34
28 - rotating parity 0 with data restart 35 - rotating parity 0 with data restart
29 raid5_rs RAID5 right symmetric 36 raid5_rs RAID5 right symmetric
37
30 - rotating parity N with data restart 38 - rotating parity N with data restart
31 raid6_zr RAID6 zero restart 39 raid6_zr RAID6 zero restart
40
32 - rotating parity zero (left-to-right) with data restart 41 - rotating parity zero (left-to-right) with data restart
33 raid6_nr RAID6 N restart 42 raid6_nr RAID6 N restart
43
34 - rotating parity N (right-to-left) with data restart 44 - rotating parity N (right-to-left) with data restart
35 raid6_nc RAID6 N continue 45 raid6_nc RAID6 N continue
46
36 - rotating parity N (right-to-left) with data continuation 47 - rotating parity N (right-to-left) with data continuation
37 raid6_n_6 RAID6 with dedicate parity disks 48 raid6_n_6 RAID6 with dedicate parity disks
49
38 - parity and Q-syndrome on the last 2 disks; 50 - parity and Q-syndrome on the last 2 disks;
39 layout for takeover from/to raid4/raid5_n 51 layout for takeover from/to raid4/raid5_n
40 raid6_la_6 Same as "raid_la" plus dedicated last Q-syndrome disk 52 raid6_la_6 Same as "raid_la" plus dedicated last Q-syndrome disk
53
41 - layout for takeover from raid5_la from/to raid6 54 - layout for takeover from raid5_la from/to raid6
42 raid6_ra_6 Same as "raid5_ra" dedicated last Q-syndrome disk 55 raid6_ra_6 Same as "raid5_ra" dedicated last Q-syndrome disk
56
43 - layout for takeover from raid5_ra from/to raid6 57 - layout for takeover from raid5_ra from/to raid6
44 raid6_ls_6 Same as "raid5_ls" dedicated last Q-syndrome disk 58 raid6_ls_6 Same as "raid5_ls" dedicated last Q-syndrome disk
59
45 - layout for takeover from raid5_ls from/to raid6 60 - layout for takeover from raid5_ls from/to raid6
46 raid6_rs_6 Same as "raid5_rs" dedicated last Q-syndrome disk 61 raid6_rs_6 Same as "raid5_rs" dedicated last Q-syndrome disk
62
47 - layout for takeover from raid5_rs from/to raid6 63 - layout for takeover from raid5_rs from/to raid6
48 raid10 Various RAID10 inspired algorithms chosen by additional params 64 raid10 Various RAID10 inspired algorithms chosen by additional params
49 (see raid10_format and raid10_copies below) 65 (see raid10_format and raid10_copies below)
66
50 - RAID10: Striped Mirrors (aka 'Striping on top of mirrors') 67 - RAID10: Striped Mirrors (aka 'Striping on top of mirrors')
51 - RAID1E: Integrated Adjacent Stripe Mirroring 68 - RAID1E: Integrated Adjacent Stripe Mirroring
52 - RAID1E: Integrated Offset Stripe Mirroring 69 - RAID1E: Integrated Offset Stripe Mirroring
53 - and other similar RAID10 variants 70 - and other similar RAID10 variants
71 ============= ===============================================================
54 72
55 Reference: Chapter 4 of 73 Reference: Chapter 4 of
56 http://www.snia.org/sites/default/files/SNIA_DDF_Technical_Position_v2.0.pdf 74 http://www.snia.org/sites/default/files/SNIA_DDF_Technical_Position_v2.0.pdf
@@ -58,33 +76,41 @@ The target is named "raid" and it accepts the following parameters:
58<#raid_params>: The number of parameters that follow. 76<#raid_params>: The number of parameters that follow.
59 77
60<raid_params> consists of 78<raid_params> consists of
79
61 Mandatory parameters: 80 Mandatory parameters:
62 <chunk_size>: Chunk size in sectors. This parameter is often known as 81 <chunk_size>:
82 Chunk size in sectors. This parameter is often known as
63 "stripe size". It is the only mandatory parameter and 83 "stripe size". It is the only mandatory parameter and
64 is placed first. 84 is placed first.
65 85
66 followed by optional parameters (in any order): 86 followed by optional parameters (in any order):
67 [sync|nosync] Force or prevent RAID initialization. 87 [sync|nosync]
88 Force or prevent RAID initialization.
68 89
69 [rebuild <idx>] Rebuild drive number 'idx' (first drive is 0). 90 [rebuild <idx>]
91 Rebuild drive number 'idx' (first drive is 0).
70 92
71 [daemon_sleep <ms>] 93 [daemon_sleep <ms>]
72 Interval between runs of the bitmap daemon that 94 Interval between runs of the bitmap daemon that
73 clear bits. A longer interval means less bitmap I/O but 95 clear bits. A longer interval means less bitmap I/O but
74 resyncing after a failure is likely to take longer. 96 resyncing after a failure is likely to take longer.
75 97
76 [min_recovery_rate <kB/sec/disk>] Throttle RAID initialization 98 [min_recovery_rate <kB/sec/disk>]
77 [max_recovery_rate <kB/sec/disk>] Throttle RAID initialization 99 Throttle RAID initialization
78 [write_mostly <idx>] Mark drive index 'idx' write-mostly. 100 [max_recovery_rate <kB/sec/disk>]
79 [max_write_behind <sectors>] See '--write-behind=' (man mdadm) 101 Throttle RAID initialization
80 [stripe_cache <sectors>] Stripe cache size (RAID 4/5/6 only) 102 [write_mostly <idx>]
103 Mark drive index 'idx' write-mostly.
104 [max_write_behind <sectors>]
105 See '--write-behind=' (man mdadm)
106 [stripe_cache <sectors>]
107 Stripe cache size (RAID 4/5/6 only)
81 [region_size <sectors>] 108 [region_size <sectors>]
82 The region_size multiplied by the number of regions is the 109 The region_size multiplied by the number of regions is the
83 logical size of the array. The bitmap records the device 110 logical size of the array. The bitmap records the device
84 synchronisation state for each region. 111 synchronisation state for each region.
85 112
86 [raid10_copies <# copies>] 113 [raid10_copies <# copies>], [raid10_format <near|far|offset>]
87 [raid10_format <near|far|offset>]
88 These two options are used to alter the default layout of 114 These two options are used to alter the default layout of
89 a RAID10 configuration. The number of copies is can be 115 a RAID10 configuration. The number of copies is can be
90 specified, but the default is 2. There are also three 116 specified, but the default is 2. There are also three
@@ -93,13 +119,17 @@ The target is named "raid" and it accepts the following parameters:
93 respect to mirroring. If these options are left unspecified, 119 respect to mirroring. If these options are left unspecified,
94 or 'raid10_copies 2' and/or 'raid10_format near' are given, 120 or 'raid10_copies 2' and/or 'raid10_format near' are given,
95 then the layouts for 2, 3 and 4 devices are: 121 then the layouts for 2, 3 and 4 devices are:
122
123 ======== ========== ==============
96 2 drives 3 drives 4 drives 124 2 drives 3 drives 4 drives
97 -------- ---------- -------------- 125 ======== ========== ==============
98 A1 A1 A1 A1 A2 A1 A1 A2 A2 126 A1 A1 A1 A1 A2 A1 A1 A2 A2
99 A2 A2 A2 A3 A3 A3 A3 A4 A4 127 A2 A2 A2 A3 A3 A3 A3 A4 A4
100 A3 A3 A4 A4 A5 A5 A5 A6 A6 128 A3 A3 A4 A4 A5 A5 A5 A6 A6
101 A4 A4 A5 A6 A6 A7 A7 A8 A8 129 A4 A4 A5 A6 A6 A7 A7 A8 A8
102 .. .. .. .. .. .. .. .. .. 130 .. .. .. .. .. .. .. .. ..
131 ======== ========== ==============
132
103 The 2-device layout is equivalent 2-way RAID1. The 4-device 133 The 2-device layout is equivalent 2-way RAID1. The 4-device
104 layout is what a traditional RAID10 would look like. The 134 layout is what a traditional RAID10 would look like. The
105 3-device layout is what might be called a 'RAID1E - Integrated 135 3-device layout is what might be called a 'RAID1E - Integrated
@@ -107,8 +137,10 @@ The target is named "raid" and it accepts the following parameters:
107 137
108 If 'raid10_copies 2' and 'raid10_format far', then the layouts 138 If 'raid10_copies 2' and 'raid10_format far', then the layouts
109 for 2, 3 and 4 devices are: 139 for 2, 3 and 4 devices are:
140
141 ======== ============ ===================
110 2 drives 3 drives 4 drives 142 2 drives 3 drives 4 drives
111 -------- -------------- -------------------- 143 ======== ============ ===================
112 A1 A2 A1 A2 A3 A1 A2 A3 A4 144 A1 A2 A1 A2 A3 A1 A2 A3 A4
113 A3 A4 A4 A5 A6 A5 A6 A7 A8 145 A3 A4 A4 A5 A6 A5 A6 A7 A8
114 A5 A6 A7 A8 A9 A9 A10 A11 A12 146 A5 A6 A7 A8 A9 A9 A10 A11 A12
@@ -117,11 +149,14 @@ The target is named "raid" and it accepts the following parameters:
117 A4 A3 A6 A4 A5 A6 A5 A8 A7 149 A4 A3 A6 A4 A5 A6 A5 A8 A7
118 A6 A5 A9 A7 A8 A10 A9 A12 A11 150 A6 A5 A9 A7 A8 A10 A9 A12 A11
119 .. .. .. .. .. .. .. .. .. 151 .. .. .. .. .. .. .. .. ..
152 ======== ============ ===================
120 153
121 If 'raid10_copies 2' and 'raid10_format offset', then the 154 If 'raid10_copies 2' and 'raid10_format offset', then the
122 layouts for 2, 3 and 4 devices are: 155 layouts for 2, 3 and 4 devices are:
156
157 ======== ========== ================
123 2 drives 3 drives 4 drives 158 2 drives 3 drives 4 drives
124 -------- ------------ ----------------- 159 ======== ========== ================
125 A1 A2 A1 A2 A3 A1 A2 A3 A4 160 A1 A2 A1 A2 A3 A1 A2 A3 A4
126 A2 A1 A3 A1 A2 A2 A1 A4 A3 161 A2 A1 A3 A1 A2 A2 A1 A4 A3
127 A3 A4 A4 A5 A6 A5 A6 A7 A8 162 A3 A4 A4 A5 A6 A5 A6 A7 A8
@@ -129,6 +164,8 @@ The target is named "raid" and it accepts the following parameters:
129 A5 A6 A7 A8 A9 A9 A10 A11 A12 164 A5 A6 A7 A8 A9 A9 A10 A11 A12
130 A6 A5 A9 A7 A8 A10 A9 A12 A11 165 A6 A5 A9 A7 A8 A10 A9 A12 A11
131 .. .. .. .. .. .. .. .. .. 166 .. .. .. .. .. .. .. .. ..
167 ======== ========== ================
168
132 Here we see layouts closely akin to 'RAID1E - Integrated 169 Here we see layouts closely akin to 'RAID1E - Integrated
133 Offset Stripe Mirroring'. 170 Offset Stripe Mirroring'.
134 171
@@ -190,22 +227,25 @@ The target is named "raid" and it accepts the following parameters:
190 227
191Example Tables 228Example Tables
192-------------- 229--------------
193# RAID4 - 4 data drives, 1 parity (no metadata devices)
194# No metadata devices specified to hold superblock/bitmap info
195# Chunk size of 1MiB
196# (Lines separated for easy reading)
197 230
1980 1960893648 raid \ 231::
199 raid4 1 2048 \
200 5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81
201 232
202# RAID4 - 4 data drives, 1 parity (with metadata devices) 233 # RAID4 - 4 data drives, 1 parity (no metadata devices)
203# Chunk size of 1MiB, force RAID initialization, 234 # No metadata devices specified to hold superblock/bitmap info
204# min recovery rate at 20 kiB/sec/disk 235 # Chunk size of 1MiB
236 # (Lines separated for easy reading)
205 237
2060 1960893648 raid \ 238 0 1960893648 raid \
207 raid4 4 2048 sync min_recovery_rate 20 \ 239 raid4 1 2048 \
208 5 8:17 8:18 8:33 8:34 8:49 8:50 8:65 8:66 8:81 8:82 240 5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81
241
242 # RAID4 - 4 data drives, 1 parity (with metadata devices)
243 # Chunk size of 1MiB, force RAID initialization,
244 # min recovery rate at 20 kiB/sec/disk
245
246 0 1960893648 raid \
247 raid4 4 2048 sync min_recovery_rate 20 \
248 5 8:17 8:18 8:33 8:34 8:49 8:50 8:65 8:66 8:81 8:82
209 249
210 250
211Status Output 251Status Output
@@ -219,41 +259,58 @@ Arguments that can be repeated are ordered by value.
219 259
220'dmsetup status' yields information on the state and health of the array. 260'dmsetup status' yields information on the state and health of the array.
221The output is as follows (normally a single line, but expanded here for 261The output is as follows (normally a single line, but expanded here for
222clarity): 262clarity)::
2231: <s> <l> raid \ 263
2242: <raid_type> <#devices> <health_chars> \ 264 1: <s> <l> raid \
2253: <sync_ratio> <sync_action> <mismatch_cnt> 265 2: <raid_type> <#devices> <health_chars> \
266 3: <sync_ratio> <sync_action> <mismatch_cnt>
226 267
227Line 1 is the standard output produced by device-mapper. 268Line 1 is the standard output produced by device-mapper.
228Line 2 & 3 are produced by the raid target and are best explained by example: 269
270Line 2 & 3 are produced by the raid target and are best explained by example::
271
229 0 1960893648 raid raid4 5 AAAAA 2/490221568 init 0 272 0 1960893648 raid raid4 5 AAAAA 2/490221568 init 0
273
230Here we can see the RAID type is raid4, there are 5 devices - all of 274Here we can see the RAID type is raid4, there are 5 devices - all of
231which are 'A'live, and the array is 2/490221568 complete with its initial 275which are 'A'live, and the array is 2/490221568 complete with its initial
232recovery. Here is a fuller description of the individual fields: 276recovery. Here is a fuller description of the individual fields:
277
278 =============== =========================================================
233 <raid_type> Same as the <raid_type> used to create the array. 279 <raid_type> Same as the <raid_type> used to create the array.
234 <health_chars> One char for each device, indicating: 'A' = alive and 280 <health_chars> One char for each device, indicating:
235 in-sync, 'a' = alive but not in-sync, 'D' = dead/failed. 281
282 - 'A' = alive and in-sync
283 - 'a' = alive but not in-sync
284 - 'D' = dead/failed.
236 <sync_ratio> The ratio indicating how much of the array has undergone 285 <sync_ratio> The ratio indicating how much of the array has undergone
237 the process described by 'sync_action'. If the 286 the process described by 'sync_action'. If the
238 'sync_action' is "check" or "repair", then the process 287 'sync_action' is "check" or "repair", then the process
239 of "resync" or "recover" can be considered complete. 288 of "resync" or "recover" can be considered complete.
240 <sync_action> One of the following possible states: 289 <sync_action> One of the following possible states:
241 idle - No synchronization action is being performed. 290
242 frozen - The current action has been halted. 291 idle
243 resync - Array is undergoing its initial synchronization 292 - No synchronization action is being performed.
293 frozen
294 - The current action has been halted.
295 resync
296 - Array is undergoing its initial synchronization
244 or is resynchronizing after an unclean shutdown 297 or is resynchronizing after an unclean shutdown
245 (possibly aided by a bitmap). 298 (possibly aided by a bitmap).
246 recover - A device in the array is being rebuilt or 299 recover
300 - A device in the array is being rebuilt or
247 replaced. 301 replaced.
248 check - A user-initiated full check of the array is 302 check
303 - A user-initiated full check of the array is
249 being performed. All blocks are read and 304 being performed. All blocks are read and
250 checked for consistency. The number of 305 checked for consistency. The number of
251 discrepancies found are recorded in 306 discrepancies found are recorded in
252 <mismatch_cnt>. No changes are made to the 307 <mismatch_cnt>. No changes are made to the
253 array by this action. 308 array by this action.
254 repair - The same as "check", but discrepancies are 309 repair
310 - The same as "check", but discrepancies are
255 corrected. 311 corrected.
256 reshape - The array is undergoing a reshape. 312 reshape
313 - The array is undergoing a reshape.
257 <mismatch_cnt> The number of discrepancies found between mirror copies 314 <mismatch_cnt> The number of discrepancies found between mirror copies
258 in RAID1/10 or wrong parity values found in RAID4/5/6. 315 in RAID1/10 or wrong parity values found in RAID4/5/6.
259 This value is valid only after a "check" of the array 316 This value is valid only after a "check" of the array
@@ -261,10 +318,11 @@ recovery. Here is a fuller description of the individual fields:
261 <data_offset> The current data offset to the start of the user data on 318 <data_offset> The current data offset to the start of the user data on
262 each component device of a raid set (see the respective 319 each component device of a raid set (see the respective
263 raid parameter to support out-of-place reshaping). 320 raid parameter to support out-of-place reshaping).
264 <journal_char> 'A' - active write-through journal device. 321 <journal_char> - 'A' - active write-through journal device.
265 'a' - active write-back journal device. 322 - 'a' - active write-back journal device.
266 'D' - dead journal device. 323 - 'D' - dead journal device.
267 '-' - no journal device. 324 - '-' - no journal device.
325 =============== =========================================================
268 326
269 327
270Message Interface 328Message Interface
@@ -272,12 +330,15 @@ Message Interface
272The dm-raid target will accept certain actions through the 'message' interface. 330The dm-raid target will accept certain actions through the 'message' interface.
273('man dmsetup' for more information on the message interface.) These actions 331('man dmsetup' for more information on the message interface.) These actions
274include: 332include:
275 "idle" - Halt the current sync action. 333
276 "frozen" - Freeze the current sync action. 334 ========= ================================================
277 "resync" - Initiate/continue a resync. 335 "idle" Halt the current sync action.
278 "recover"- Initiate/continue a recover process. 336 "frozen" Freeze the current sync action.
279 "check" - Initiate a check (i.e. a "scrub") of the array. 337 "resync" Initiate/continue a resync.
280 "repair" - Initiate a repair of the array. 338 "recover" Initiate/continue a recover process.
339 "check" Initiate a check (i.e. a "scrub") of the array.
340 "repair" Initiate a repair of the array.
341 ========= ================================================
281 342
282 343
283Discard Support 344Discard Support
@@ -307,48 +368,52 @@ increasingly whitelisted in the kernel and can thus be trusted.
307 368
308For trusted devices, the following dm-raid module parameter can be set 369For trusted devices, the following dm-raid module parameter can be set
309to safely enable discard support for RAID 4/5/6: 370to safely enable discard support for RAID 4/5/6:
371
310 'devices_handle_discards_safely' 372 'devices_handle_discards_safely'
311 373
312 374
313Version History 375Version History
314--------------- 376---------------
3151.0.0 Initial version. Support for RAID 4/5/6 377
3161.1.0 Added support for RAID 1 378::
3171.2.0 Handle creation of arrays that contain failed devices. 379
3181.3.0 Added support for RAID 10 380 1.0.0 Initial version. Support for RAID 4/5/6
3191.3.1 Allow device replacement/rebuild for RAID 10 381 1.1.0 Added support for RAID 1
3201.3.2 Fix/improve redundancy checking for RAID10 382 1.2.0 Handle creation of arrays that contain failed devices.
3211.4.0 Non-functional change. Removes arg from mapping function. 383 1.3.0 Added support for RAID 10
3221.4.1 RAID10 fix redundancy validation checks (commit 55ebbb5). 384 1.3.1 Allow device replacement/rebuild for RAID 10
3231.4.2 Add RAID10 "far" and "offset" algorithm support. 385 1.3.2 Fix/improve redundancy checking for RAID10
3241.5.0 Add message interface to allow manipulation of the sync_action. 386 1.4.0 Non-functional change. Removes arg from mapping function.
387 1.4.1 RAID10 fix redundancy validation checks (commit 55ebbb5).
388 1.4.2 Add RAID10 "far" and "offset" algorithm support.
389 1.5.0 Add message interface to allow manipulation of the sync_action.
325 New status (STATUSTYPE_INFO) fields: sync_action and mismatch_cnt. 390 New status (STATUSTYPE_INFO) fields: sync_action and mismatch_cnt.
3261.5.1 Add ability to restore transiently failed devices on resume. 391 1.5.1 Add ability to restore transiently failed devices on resume.
3271.5.2 'mismatch_cnt' is zero unless [last_]sync_action is "check". 392 1.5.2 'mismatch_cnt' is zero unless [last_]sync_action is "check".
3281.6.0 Add discard support (and devices_handle_discard_safely module param). 393 1.6.0 Add discard support (and devices_handle_discard_safely module param).
3291.7.0 Add support for MD RAID0 mappings. 394 1.7.0 Add support for MD RAID0 mappings.
3301.8.0 Explicitly check for compatible flags in the superblock metadata 395 1.8.0 Explicitly check for compatible flags in the superblock metadata
331 and reject to start the raid set if any are set by a newer 396 and reject to start the raid set if any are set by a newer
332 target version, thus avoiding data corruption on a raid set 397 target version, thus avoiding data corruption on a raid set
333 with a reshape in progress. 398 with a reshape in progress.
3341.9.0 Add support for RAID level takeover/reshape/region size 399 1.9.0 Add support for RAID level takeover/reshape/region size
335 and set size reduction. 400 and set size reduction.
3361.9.1 Fix activation of existing RAID 4/10 mapped devices 401 1.9.1 Fix activation of existing RAID 4/10 mapped devices
3371.9.2 Don't emit '- -' on the status table line in case the constructor 402 1.9.2 Don't emit '- -' on the status table line in case the constructor
338 fails reading a superblock. Correctly emit 'maj:min1 maj:min2' and 403 fails reading a superblock. Correctly emit 'maj:min1 maj:min2' and
339 'D' on the status line. If '- -' is passed into the constructor, emit 404 'D' on the status line. If '- -' is passed into the constructor, emit
340 '- -' on the table line and '-' as the status line health character. 405 '- -' on the table line and '-' as the status line health character.
3411.10.0 Add support for raid4/5/6 journal device 406 1.10.0 Add support for raid4/5/6 journal device
3421.10.1 Fix data corruption on reshape request 407 1.10.1 Fix data corruption on reshape request
3431.11.0 Fix table line argument order 408 1.11.0 Fix table line argument order
344 (wrong raid10_copies/raid10_format sequence) 409 (wrong raid10_copies/raid10_format sequence)
3451.11.1 Add raid4/5/6 journal write-back support via journal_mode option 410 1.11.1 Add raid4/5/6 journal write-back support via journal_mode option
3461.12.1 Fix for MD deadlock between mddev_suspend() and md_write_start() available 411 1.12.1 Fix for MD deadlock between mddev_suspend() and md_write_start() available
3471.13.0 Fix dev_health status at end of "recover" (was 'a', now 'A') 412 1.13.0 Fix dev_health status at end of "recover" (was 'a', now 'A')
3481.13.1 Fix deadlock caused by early md_stop_writes(). Also fix size an 413 1.13.1 Fix deadlock caused by early md_stop_writes(). Also fix size an
349 state races. 414 state races.
3501.13.2 Fix raid redundancy validation and avoid keeping raid set frozen 415 1.13.2 Fix raid redundancy validation and avoid keeping raid set frozen
3511.14.0 Fix reshape race on small devices. Fix stripe adding reshape 416 1.14.0 Fix reshape race on small devices. Fix stripe adding reshape
352 deadlock/potential data corruption. Update superblock when 417 deadlock/potential data corruption. Update superblock when
353 specific devices are requested via rebuild. Fix RAID leg 418 specific devices are requested via rebuild. Fix RAID leg
354 rebuild errors. 419 rebuild errors.
diff --git a/Documentation/device-mapper/dm-service-time.txt b/Documentation/device-mapper/dm-service-time.rst
index fb1d4a0cf122..facf277fc13c 100644
--- a/Documentation/device-mapper/dm-service-time.txt
+++ b/Documentation/device-mapper/dm-service-time.rst
@@ -1,3 +1,4 @@
1===============
1dm-service-time 2dm-service-time
2=============== 3===============
3 4
@@ -12,25 +13,34 @@ in a path-group, and it can be specified as a table argument.
12 13
13The path selector name is 'service-time'. 14The path selector name is 'service-time'.
14 15
15Table parameters for each path: [<repeat_count> [<relative_throughput>]] 16Table parameters for each path:
16 <repeat_count>: The number of I/Os to dispatch using the selected 17
18 [<repeat_count> [<relative_throughput>]]
19 <repeat_count>:
20 The number of I/Os to dispatch using the selected
17 path before switching to the next path. 21 path before switching to the next path.
18 If not given, internal default is used. To check 22 If not given, internal default is used. To check
19 the default value, see the activated table. 23 the default value, see the activated table.
20 <relative_throughput>: The relative throughput value of the path 24 <relative_throughput>:
25 The relative throughput value of the path
21 among all paths in the path-group. 26 among all paths in the path-group.
22 The valid range is 0-100. 27 The valid range is 0-100.
23 If not given, minimum value '1' is used. 28 If not given, minimum value '1' is used.
24 If '0' is given, the path isn't selected while 29 If '0' is given, the path isn't selected while
25 other paths having a positive value are available. 30 other paths having a positive value are available.
26 31
27Status for each path: <status> <fail-count> <in-flight-size> \ 32Status for each path:
28 <relative_throughput> 33
29 <status>: 'A' if the path is active, 'F' if the path is failed. 34 <status> <fail-count> <in-flight-size> <relative_throughput>
30 <fail-count>: The number of path failures. 35 <status>:
31 <in-flight-size>: The size of in-flight I/Os on the path. 36 'A' if the path is active, 'F' if the path is failed.
32 <relative_throughput>: The relative throughput value of the path 37 <fail-count>:
33 among all paths in the path-group. 38 The number of path failures.
39 <in-flight-size>:
40 The size of in-flight I/Os on the path.
41 <relative_throughput>:
42 The relative throughput value of the path
43 among all paths in the path-group.
34 44
35 45
36Algorithm 46Algorithm
@@ -39,7 +49,7 @@ Algorithm
39dm-service-time adds the I/O size to 'in-flight-size' when the I/O is 49dm-service-time adds the I/O size to 'in-flight-size' when the I/O is
40dispatched and subtracts when completed. 50dispatched and subtracts when completed.
41Basically, dm-service-time selects a path having minimum service time 51Basically, dm-service-time selects a path having minimum service time
42which is calculated by: 52which is calculated by::
43 53
44 ('in-flight-size' + 'size-of-incoming-io') / 'relative_throughput' 54 ('in-flight-size' + 'size-of-incoming-io') / 'relative_throughput'
45 55
@@ -67,25 +77,25 @@ Examples
67======== 77========
68In case that 2 paths (sda and sdb) are used with repeat_count == 128 78In case that 2 paths (sda and sdb) are used with repeat_count == 128
69and sda has an average throughput 1GB/s and sdb has 4GB/s, 79and sda has an average throughput 1GB/s and sdb has 4GB/s,
70'relative_throughput' value may be '1' for sda and '4' for sdb. 80'relative_throughput' value may be '1' for sda and '4' for sdb::
71 81
72# echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4" \ 82 # echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4" \
73 dmsetup create test 83 dmsetup create test
74# 84 #
75# dmsetup table 85 # dmsetup table
76test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4 86 test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 1 8:16 128 4
77# 87 #
78# dmsetup status 88 # dmsetup status
79test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 1 8:16 A 0 0 4 89 test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 1 8:16 A 0 0 4
80 90
81 91
82Or '2' for sda and '8' for sdb would be also true. 92Or '2' for sda and '8' for sdb would be also true::
83 93
84# echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8" \ 94 # echo "0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8" \
85 dmsetup create test 95 dmsetup create test
86# 96 #
87# dmsetup table 97 # dmsetup table
88test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8 98 test: 0 10 multipath 0 0 1 1 service-time 0 2 2 8:0 128 2 8:16 128 8
89# 99 #
90# dmsetup status 100 # dmsetup status
91test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 2 8:16 A 0 0 8 101 test: 0 10 multipath 2 0 0 0 1 1 E 0 2 2 8:0 A 0 0 2 8:16 A 0 0 8
diff --git a/Documentation/device-mapper/dm-uevent.rst b/Documentation/device-mapper/dm-uevent.rst
new file mode 100644
index 000000000000..4a8ee8d069c9
--- /dev/null
+++ b/Documentation/device-mapper/dm-uevent.rst
@@ -0,0 +1,110 @@
1====================
2device-mapper uevent
3====================
4
5The device-mapper uevent code adds the capability to device-mapper to create
6and send kobject uevents (uevents). Previously device-mapper events were only
7available through the ioctl interface. The advantage of the uevents interface
8is the event contains environment attributes providing increased context for
9the event avoiding the need to query the state of the device-mapper device after
10the event is received.
11
12There are two functions currently for device-mapper events. The first function
13listed creates the event and the second function sends the event(s)::
14
15 void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
16 const char *path, unsigned nr_valid_paths)
17
18 void dm_send_uevents(struct list_head *events, struct kobject *kobj)
19
20
21The variables added to the uevent environment are:
22
23Variable Name: DM_TARGET
24------------------------
25:Uevent Action(s): KOBJ_CHANGE
26:Type: string
27:Description:
28:Value: Name of device-mapper target that generated the event.
29
30Variable Name: DM_ACTION
31------------------------
32:Uevent Action(s): KOBJ_CHANGE
33:Type: string
34:Description:
35:Value: Device-mapper specific action that caused the uevent action.
36 PATH_FAILED - A path has failed;
37 PATH_REINSTATED - A path has been reinstated.
38
39Variable Name: DM_SEQNUM
40------------------------
41:Uevent Action(s): KOBJ_CHANGE
42:Type: unsigned integer
43:Description: A sequence number for this specific device-mapper device.
44:Value: Valid unsigned integer range.
45
46Variable Name: DM_PATH
47----------------------
48:Uevent Action(s): KOBJ_CHANGE
49:Type: string
50:Description: Major and minor number of the path device pertaining to this
51 event.
52:Value: Path name in the form of "Major:Minor"
53
54Variable Name: DM_NR_VALID_PATHS
55--------------------------------
56:Uevent Action(s): KOBJ_CHANGE
57:Type: unsigned integer
58:Description:
59:Value: Valid unsigned integer range.
60
61Variable Name: DM_NAME
62----------------------
63:Uevent Action(s): KOBJ_CHANGE
64:Type: string
65:Description: Name of the device-mapper device.
66:Value: Name
67
68Variable Name: DM_UUID
69----------------------
70:Uevent Action(s): KOBJ_CHANGE
71:Type: string
72:Description: UUID of the device-mapper device.
73:Value: UUID. (Empty string if there isn't one.)
74
75An example of the uevents generated as captured by udevmonitor is shown
76below
77
781.) Path failure::
79
80 UEVENT[1192521009.711215] change@/block/dm-3
81 ACTION=change
82 DEVPATH=/block/dm-3
83 SUBSYSTEM=block
84 DM_TARGET=multipath
85 DM_ACTION=PATH_FAILED
86 DM_SEQNUM=1
87 DM_PATH=8:32
88 DM_NR_VALID_PATHS=0
89 DM_NAME=mpath2
90 DM_UUID=mpath-35333333000002328
91 MINOR=3
92 MAJOR=253
93 SEQNUM=1130
94
952.) Path reinstate::
96
97 UEVENT[1192521132.989927] change@/block/dm-3
98 ACTION=change
99 DEVPATH=/block/dm-3
100 SUBSYSTEM=block
101 DM_TARGET=multipath
102 DM_ACTION=PATH_REINSTATED
103 DM_SEQNUM=2
104 DM_PATH=8:32
105 DM_NR_VALID_PATHS=1
106 DM_NAME=mpath2
107 DM_UUID=mpath-35333333000002328
108 MINOR=3
109 MAJOR=253
110 SEQNUM=1131
diff --git a/Documentation/device-mapper/dm-uevent.txt b/Documentation/device-mapper/dm-uevent.txt
deleted file mode 100644
index 07edbd85c714..000000000000
--- a/Documentation/device-mapper/dm-uevent.txt
+++ /dev/null
@@ -1,97 +0,0 @@
1The device-mapper uevent code adds the capability to device-mapper to create
2and send kobject uevents (uevents). Previously device-mapper events were only
3available through the ioctl interface. The advantage of the uevents interface
4is the event contains environment attributes providing increased context for
5the event avoiding the need to query the state of the device-mapper device after
6the event is received.
7
8There are two functions currently for device-mapper events. The first function
9listed creates the event and the second function sends the event(s).
10
11void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
12 const char *path, unsigned nr_valid_paths)
13
14void dm_send_uevents(struct list_head *events, struct kobject *kobj)
15
16
17The variables added to the uevent environment are:
18
19Variable Name: DM_TARGET
20Uevent Action(s): KOBJ_CHANGE
21Type: string
22Description:
23Value: Name of device-mapper target that generated the event.
24
25Variable Name: DM_ACTION
26Uevent Action(s): KOBJ_CHANGE
27Type: string
28Description:
29Value: Device-mapper specific action that caused the uevent action.
30 PATH_FAILED - A path has failed.
31 PATH_REINSTATED - A path has been reinstated.
32
33Variable Name: DM_SEQNUM
34Uevent Action(s): KOBJ_CHANGE
35Type: unsigned integer
36Description: A sequence number for this specific device-mapper device.
37Value: Valid unsigned integer range.
38
39Variable Name: DM_PATH
40Uevent Action(s): KOBJ_CHANGE
41Type: string
42Description: Major and minor number of the path device pertaining to this
43event.
44Value: Path name in the form of "Major:Minor"
45
46Variable Name: DM_NR_VALID_PATHS
47Uevent Action(s): KOBJ_CHANGE
48Type: unsigned integer
49Description:
50Value: Valid unsigned integer range.
51
52Variable Name: DM_NAME
53Uevent Action(s): KOBJ_CHANGE
54Type: string
55Description: Name of the device-mapper device.
56Value: Name
57
58Variable Name: DM_UUID
59Uevent Action(s): KOBJ_CHANGE
60Type: string
61Description: UUID of the device-mapper device.
62Value: UUID. (Empty string if there isn't one.)
63
64An example of the uevents generated as captured by udevmonitor is shown
65below.
66
671.) Path failure.
68UEVENT[1192521009.711215] change@/block/dm-3
69ACTION=change
70DEVPATH=/block/dm-3
71SUBSYSTEM=block
72DM_TARGET=multipath
73DM_ACTION=PATH_FAILED
74DM_SEQNUM=1
75DM_PATH=8:32
76DM_NR_VALID_PATHS=0
77DM_NAME=mpath2
78DM_UUID=mpath-35333333000002328
79MINOR=3
80MAJOR=253
81SEQNUM=1130
82
832.) Path reinstate.
84UEVENT[1192521132.989927] change@/block/dm-3
85ACTION=change
86DEVPATH=/block/dm-3
87SUBSYSTEM=block
88DM_TARGET=multipath
89DM_ACTION=PATH_REINSTATED
90DM_SEQNUM=2
91DM_PATH=8:32
92DM_NR_VALID_PATHS=1
93DM_NAME=mpath2
94DM_UUID=mpath-35333333000002328
95MINOR=3
96MAJOR=253
97SEQNUM=1131
diff --git a/Documentation/device-mapper/dm-zoned.txt b/Documentation/device-mapper/dm-zoned.rst
index 736fcc78d193..07f56ebc1730 100644
--- a/Documentation/device-mapper/dm-zoned.txt
+++ b/Documentation/device-mapper/dm-zoned.rst
@@ -1,3 +1,4 @@
1========
1dm-zoned 2dm-zoned
2======== 3========
3 4
@@ -133,12 +134,13 @@ A zoned block device must first be formatted using the dmzadm tool. This
133will analyze the device zone configuration, determine where to place the 134will analyze the device zone configuration, determine where to place the
134metadata sets on the device and initialize the metadata sets. 135metadata sets on the device and initialize the metadata sets.
135 136
136Ex: 137Ex::
137 138
138dmzadm --format /dev/sdxx 139 dmzadm --format /dev/sdxx
139 140
140For a formatted device, the target can be created normally with the 141For a formatted device, the target can be created normally with the
141dmsetup utility. The only parameter that dm-zoned requires is the 142dmsetup utility. The only parameter that dm-zoned requires is the
142underlying zoned block device name. Ex: 143underlying zoned block device name. Ex::
143 144
144echo "0 `blockdev --getsize ${dev}` zoned ${dev}" | dmsetup create dmz-`basename ${dev}` 145 echo "0 `blockdev --getsize ${dev}` zoned ${dev}" | \
146 dmsetup create dmz-`basename ${dev}`
diff --git a/Documentation/device-mapper/era.txt b/Documentation/device-mapper/era.rst
index 3c6d01be3560..90dd5c670b9f 100644
--- a/Documentation/device-mapper/era.txt
+++ b/Documentation/device-mapper/era.rst
@@ -1,3 +1,7 @@
1======
2dm-era
3======
4
1Introduction 5Introduction
2============ 6============
3 7
@@ -14,12 +18,14 @@ coherency after rolling back a vendor snapshot.
14Constructor 18Constructor
15=========== 19===========
16 20
17 era <metadata dev> <origin dev> <block size> 21era <metadata dev> <origin dev> <block size>
18 22
19 metadata dev : fast device holding the persistent metadata 23 ================ ======================================================
20 origin dev : device holding data blocks that may change 24 metadata dev fast device holding the persistent metadata
21 block size : block size of origin data device, granularity that is 25 origin dev device holding data blocks that may change
22 tracked by the target 26 block size block size of origin data device, granularity that is
27 tracked by the target
28 ================ ======================================================
23 29
24Messages 30Messages
25======== 31========
@@ -49,14 +55,16 @@ Status
49<metadata block size> <#used metadata blocks>/<#total metadata blocks> 55<metadata block size> <#used metadata blocks>/<#total metadata blocks>
50<current era> <held metadata root | '-'> 56<current era> <held metadata root | '-'>
51 57
52metadata block size : Fixed block size for each metadata block in 58========================= ==============================================
53 sectors 59metadata block size Fixed block size for each metadata block in
54#used metadata blocks : Number of metadata blocks used 60 sectors
55#total metadata blocks : Total number of metadata blocks 61#used metadata blocks Number of metadata blocks used
56current era : The current era 62#total metadata blocks Total number of metadata blocks
57held metadata root : The location, in blocks, of the metadata root 63current era The current era
58 that has been 'held' for userspace read 64held metadata root The location, in blocks, of the metadata root
59 access. '-' indicates there is no held root 65 that has been 'held' for userspace read
66 access. '-' indicates there is no held root
67========================= ==============================================
60 68
61Detailed use case 69Detailed use case
62================= 70=================
@@ -88,7 +96,7 @@ Memory usage
88 96
89The target uses a bitset to record writes in the current era. It also 97The target uses a bitset to record writes in the current era. It also
90has a spare bitset ready for switching over to a new era. Other than 98has a spare bitset ready for switching over to a new era. Other than
91that it uses a few 4k blocks for updating metadata. 99that it uses a few 4k blocks for updating metadata::
92 100
93 (4 * nr_blocks) bytes + buffers 101 (4 * nr_blocks) bytes + buffers
94 102
diff --git a/Documentation/device-mapper/index.rst b/Documentation/device-mapper/index.rst
new file mode 100644
index 000000000000..105e253bc231
--- /dev/null
+++ b/Documentation/device-mapper/index.rst
@@ -0,0 +1,44 @@
1:orphan:
2
3=============
4Device Mapper
5=============
6
7.. toctree::
8 :maxdepth: 1
9
10 cache-policies
11 cache
12 delay
13 dm-crypt
14 dm-flakey
15 dm-init
16 dm-integrity
17 dm-io
18 dm-log
19 dm-queue-length
20 dm-raid
21 dm-service-time
22 dm-uevent
23 dm-zoned
24 era
25 kcopyd
26 linear
27 log-writes
28 persistent-data
29 snapshot
30 statistics
31 striped
32 switch
33 thin-provisioning
34 unstriped
35 verity
36 writecache
37 zero
38
39.. only:: subproject and html
40
41 Indices
42 =======
43
44 * :ref:`genindex`
diff --git a/Documentation/device-mapper/kcopyd.txt b/Documentation/device-mapper/kcopyd.rst
index 820382c4cecf..7651d395127f 100644
--- a/Documentation/device-mapper/kcopyd.txt
+++ b/Documentation/device-mapper/kcopyd.rst
@@ -1,3 +1,4 @@
1======
1kcopyd 2kcopyd
2====== 3======
3 4
@@ -7,7 +8,7 @@ notification. It is used by dm-snapshot and dm-mirror.
7 8
8Users of kcopyd must first create a client and indicate how many memory pages 9Users of kcopyd must first create a client and indicate how many memory pages
9to set aside for their copy jobs. This is done with a call to 10to set aside for their copy jobs. This is done with a call to
10kcopyd_client_create(). 11kcopyd_client_create()::
11 12
12 int kcopyd_client_create(unsigned int num_pages, 13 int kcopyd_client_create(unsigned int num_pages,
13 struct kcopyd_client **result); 14 struct kcopyd_client **result);
@@ -16,7 +17,7 @@ To start a copy job, the user must set up io_region structures to describe
16the source and destinations of the copy. Each io_region indicates a 17the source and destinations of the copy. Each io_region indicates a
17block-device along with the starting sector and size of the region. The source 18block-device along with the starting sector and size of the region. The source
18of the copy is given as one io_region structure, and the destinations of the 19of the copy is given as one io_region structure, and the destinations of the
19copy are given as an array of io_region structures. 20copy are given as an array of io_region structures::
20 21
21 struct io_region { 22 struct io_region {
22 struct block_device *bdev; 23 struct block_device *bdev;
@@ -26,7 +27,7 @@ copy are given as an array of io_region structures.
26 27
27To start the copy, the user calls kcopyd_copy(), passing in the client 28To start the copy, the user calls kcopyd_copy(), passing in the client
28pointer, pointers to the source and destination io_regions, the name of a 29pointer, pointers to the source and destination io_regions, the name of a
29completion callback routine, and a pointer to some context data for the copy. 30completion callback routine, and a pointer to some context data for the copy::
30 31
31 int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from, 32 int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from,
32 unsigned int num_dests, struct io_region *dests, 33 unsigned int num_dests, struct io_region *dests,
@@ -41,7 +42,6 @@ write error occurred during the copy.
41 42
42When a user is done with all their copy jobs, they should call 43When a user is done with all their copy jobs, they should call
43kcopyd_client_destroy() to delete the kcopyd client, which will release the 44kcopyd_client_destroy() to delete the kcopyd client, which will release the
44associated memory pages. 45associated memory pages::
45 46
46 void kcopyd_client_destroy(struct kcopyd_client *kc); 47 void kcopyd_client_destroy(struct kcopyd_client *kc);
47
diff --git a/Documentation/device-mapper/linear.rst b/Documentation/device-mapper/linear.rst
new file mode 100644
index 000000000000..9d17fc6e64a9
--- /dev/null
+++ b/Documentation/device-mapper/linear.rst
@@ -0,0 +1,63 @@
1=========
2dm-linear
3=========
4
5Device-Mapper's "linear" target maps a linear range of the Device-Mapper
6device onto a linear range of another device. This is the basic building
7block of logical volume managers.
8
9Parameters: <dev path> <offset>
10 <dev path>:
11 Full pathname to the underlying block-device, or a
12 "major:minor" device-number.
13 <offset>:
14 Starting sector within the device.
15
16
17Example scripts
18===============
19
20::
21
22 #!/bin/sh
23 # Create an identity mapping for a device
24 echo "0 `blockdev --getsz $1` linear $1 0" | dmsetup create identity
25
26::
27
28 #!/bin/sh
29 # Join 2 devices together
30 size1=`blockdev --getsz $1`
31 size2=`blockdev --getsz $2`
32 echo "0 $size1 linear $1 0
33 $size1 $size2 linear $2 0" | dmsetup create joined
34
35::
36
37 #!/usr/bin/perl -w
38 # Split a device into 4M chunks and then join them together in reverse order.
39
40 my $name = "reverse";
41 my $extent_size = 4 * 1024 * 2;
42 my $dev = $ARGV[0];
43 my $table = "";
44 my $count = 0;
45
46 if (!defined($dev)) {
47 die("Please specify a device.\n");
48 }
49
50 my $dev_size = `blockdev --getsz $dev`;
51 my $extents = int($dev_size / $extent_size) -
52 (($dev_size % $extent_size) ? 1 : 0);
53
54 while ($extents > 0) {
55 my $this_start = $count * $extent_size;
56 $extents--;
57 $count++;
58 my $this_offset = $extents * $extent_size;
59
60 $table .= "$this_start $extent_size linear $dev $this_offset\n";
61 }
62
63 `echo \"$table\" | dmsetup create $name`;
diff --git a/Documentation/device-mapper/linear.txt b/Documentation/device-mapper/linear.txt
deleted file mode 100644
index 7cb98d89d3f8..000000000000
--- a/Documentation/device-mapper/linear.txt
+++ /dev/null
@@ -1,61 +0,0 @@
1dm-linear
2=========
3
4Device-Mapper's "linear" target maps a linear range of the Device-Mapper
5device onto a linear range of another device. This is the basic building
6block of logical volume managers.
7
8Parameters: <dev path> <offset>
9 <dev path>: Full pathname to the underlying block-device, or a
10 "major:minor" device-number.
11 <offset>: Starting sector within the device.
12
13
14Example scripts
15===============
16[[
17#!/bin/sh
18# Create an identity mapping for a device
19echo "0 `blockdev --getsz $1` linear $1 0" | dmsetup create identity
20]]
21
22
23[[
24#!/bin/sh
25# Join 2 devices together
26size1=`blockdev --getsz $1`
27size2=`blockdev --getsz $2`
28echo "0 $size1 linear $1 0
29$size1 $size2 linear $2 0" | dmsetup create joined
30]]
31
32
33[[
34#!/usr/bin/perl -w
35# Split a device into 4M chunks and then join them together in reverse order.
36
37my $name = "reverse";
38my $extent_size = 4 * 1024 * 2;
39my $dev = $ARGV[0];
40my $table = "";
41my $count = 0;
42
43if (!defined($dev)) {
44 die("Please specify a device.\n");
45}
46
47my $dev_size = `blockdev --getsz $dev`;
48my $extents = int($dev_size / $extent_size) -
49 (($dev_size % $extent_size) ? 1 : 0);
50
51while ($extents > 0) {
52 my $this_start = $count * $extent_size;
53 $extents--;
54 $count++;
55 my $this_offset = $extents * $extent_size;
56
57 $table .= "$this_start $extent_size linear $dev $this_offset\n";
58}
59
60`echo \"$table\" | dmsetup create $name`;
61]]
diff --git a/Documentation/device-mapper/log-writes.txt b/Documentation/device-mapper/log-writes.rst
index b638d124be6a..23141f2ffb7c 100644
--- a/Documentation/device-mapper/log-writes.txt
+++ b/Documentation/device-mapper/log-writes.rst
@@ -1,3 +1,4 @@
1=============
1dm-log-writes 2dm-log-writes
2============= 3=============
3 4
@@ -25,11 +26,11 @@ completed WRITEs, at the time the REQ_PREFLUSH is issued, are added in order to
25simulate the worst case scenario with regard to power failures. Consider the 26simulate the worst case scenario with regard to power failures. Consider the
26following example (W means write, C means complete): 27following example (W means write, C means complete):
27 28
28W1,W2,W3,C3,C2,Wflush,C1,Cflush 29 W1,W2,W3,C3,C2,Wflush,C1,Cflush
29 30
30The log would show the following 31The log would show the following:
31 32
32W3,W2,flush,W1.... 33 W3,W2,flush,W1....
33 34
34Again this is to simulate what is actually on disk, this allows us to detect 35Again this is to simulate what is actually on disk, this allows us to detect
35cases where a power failure at a particular point in time would create an 36cases where a power failure at a particular point in time would create an
@@ -42,11 +43,11 @@ Any REQ_OP_DISCARD requests are treated like WRITE requests. Otherwise we would
42have all the DISCARD requests, and then the WRITE requests and then the FLUSH 43have all the DISCARD requests, and then the WRITE requests and then the FLUSH
43request. Consider the following example: 44request. Consider the following example:
44 45
45WRITE block 1, DISCARD block 1, FLUSH 46 WRITE block 1, DISCARD block 1, FLUSH
46 47
47If we logged DISCARD when it completed, the replay would look like this 48If we logged DISCARD when it completed, the replay would look like this:
48 49
49DISCARD 1, WRITE 1, FLUSH 50 DISCARD 1, WRITE 1, FLUSH
50 51
51which isn't quite what happened and wouldn't be caught during the log replay. 52which isn't quite what happened and wouldn't be caught during the log replay.
52 53
@@ -57,15 +58,19 @@ i) Constructor
57 58
58 log-writes <dev_path> <log_dev_path> 59 log-writes <dev_path> <log_dev_path>
59 60
60 dev_path : Device that all of the IO will go to normally. 61 ============= ==============================================
61 log_dev_path : Device where the log entries are written to. 62 dev_path Device that all of the IO will go to normally.
63 log_dev_path Device where the log entries are written to.
64 ============= ==============================================
62 65
63ii) Status 66ii) Status
64 67
65 <#logged entries> <highest allocated sector> 68 <#logged entries> <highest allocated sector>
66 69
67 #logged entries : Number of logged entries 70 =========================== ========================
68 highest allocated sector : Highest allocated sector 71 #logged entries Number of logged entries
72 highest allocated sector Highest allocated sector
73 =========================== ========================
69 74
70iii) Messages 75iii) Messages
71 76
@@ -75,15 +80,15 @@ iii) Messages
75 For example say you want to fsck a file system after every 80 For example say you want to fsck a file system after every
76 write, but first you need to replay up to the mkfs to make sure 81 write, but first you need to replay up to the mkfs to make sure
77 we're fsck'ing something reasonable, you would do something like 82 we're fsck'ing something reasonable, you would do something like
78 this: 83 this::
79 84
80 mkfs.btrfs -f /dev/mapper/log 85 mkfs.btrfs -f /dev/mapper/log
81 dmsetup message log 0 mark mkfs 86 dmsetup message log 0 mark mkfs
82 <run test> 87 <run test>
83 88
84 This would allow you to replay the log up to the mkfs mark and 89 This would allow you to replay the log up to the mkfs mark and
85 then replay from that point on doing the fsck check in the 90 then replay from that point on doing the fsck check in the
86 interval that you want. 91 interval that you want.
87 92
88 Every log has a mark at the end labeled "dm-log-writes-end". 93 Every log has a mark at the end labeled "dm-log-writes-end".
89 94
@@ -97,42 +102,42 @@ Example usage
97============= 102=============
98 103
99Say you want to test fsync on your file system. You would do something like 104Say you want to test fsync on your file system. You would do something like
100this: 105this::
101 106
102TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc" 107 TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc"
103dmsetup create log --table "$TABLE" 108 dmsetup create log --table "$TABLE"
104mkfs.btrfs -f /dev/mapper/log 109 mkfs.btrfs -f /dev/mapper/log
105dmsetup message log 0 mark mkfs 110 dmsetup message log 0 mark mkfs
106 111
107mount /dev/mapper/log /mnt/btrfs-test 112 mount /dev/mapper/log /mnt/btrfs-test
108<some test that does fsync at the end> 113 <some test that does fsync at the end>
109dmsetup message log 0 mark fsync 114 dmsetup message log 0 mark fsync
110md5sum /mnt/btrfs-test/foo 115 md5sum /mnt/btrfs-test/foo
111umount /mnt/btrfs-test 116 umount /mnt/btrfs-test
112 117
113dmsetup remove log 118 dmsetup remove log
114replay-log --log /dev/sdc --replay /dev/sdb --end-mark fsync 119 replay-log --log /dev/sdc --replay /dev/sdb --end-mark fsync
115mount /dev/sdb /mnt/btrfs-test 120 mount /dev/sdb /mnt/btrfs-test
116md5sum /mnt/btrfs-test/foo 121 md5sum /mnt/btrfs-test/foo
117<verify md5sum's are correct> 122 <verify md5sum's are correct>
118 123
119Another option is to do a complicated file system operation and verify the file 124 Another option is to do a complicated file system operation and verify the file
120system is consistent during the entire operation. You could do this with: 125 system is consistent during the entire operation. You could do this with:
121 126
122TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc" 127 TABLE="0 $(blockdev --getsz /dev/sdb) log-writes /dev/sdb /dev/sdc"
123dmsetup create log --table "$TABLE" 128 dmsetup create log --table "$TABLE"
124mkfs.btrfs -f /dev/mapper/log 129 mkfs.btrfs -f /dev/mapper/log
125dmsetup message log 0 mark mkfs 130 dmsetup message log 0 mark mkfs
126 131
127mount /dev/mapper/log /mnt/btrfs-test 132 mount /dev/mapper/log /mnt/btrfs-test
128<fsstress to dirty the fs> 133 <fsstress to dirty the fs>
129btrfs filesystem balance /mnt/btrfs-test 134 btrfs filesystem balance /mnt/btrfs-test
130umount /mnt/btrfs-test 135 umount /mnt/btrfs-test
131dmsetup remove log 136 dmsetup remove log
132 137
133replay-log --log /dev/sdc --replay /dev/sdb --end-mark mkfs 138 replay-log --log /dev/sdc --replay /dev/sdb --end-mark mkfs
134btrfsck /dev/sdb 139 btrfsck /dev/sdb
135replay-log --log /dev/sdc --replay /dev/sdb --start-mark mkfs \ 140 replay-log --log /dev/sdc --replay /dev/sdb --start-mark mkfs \
136 --fsck "btrfsck /dev/sdb" --check fua 141 --fsck "btrfsck /dev/sdb" --check fua
137 142
138And that will replay the log until it sees a FUA request, run the fsck command 143And that will replay the log until it sees a FUA request, run the fsck command
diff --git a/Documentation/device-mapper/persistent-data.txt b/Documentation/device-mapper/persistent-data.rst
index a333bcb3a6c2..2065c3c5a091 100644
--- a/Documentation/device-mapper/persistent-data.txt
+++ b/Documentation/device-mapper/persistent-data.rst
@@ -1,3 +1,7 @@
1===============
2Persistent data
3===============
4
1Introduction 5Introduction
2============ 6============
3 7
diff --git a/Documentation/device-mapper/snapshot.txt b/Documentation/device-mapper/snapshot.rst
index b8bbb516f989..4c53304e72f1 100644
--- a/Documentation/device-mapper/snapshot.txt
+++ b/Documentation/device-mapper/snapshot.rst
@@ -1,15 +1,16 @@
1==============================
1Device-mapper snapshot support 2Device-mapper snapshot support
2============================== 3==============================
3 4
4Device-mapper allows you, without massive data copying: 5Device-mapper allows you, without massive data copying:
5 6
6*) To create snapshots of any block device i.e. mountable, saved states of 7- To create snapshots of any block device i.e. mountable, saved states of
7the block device which are also writable without interfering with the 8 the block device which are also writable without interfering with the
8original content; 9 original content;
9*) To create device "forks", i.e. multiple different versions of the 10- To create device "forks", i.e. multiple different versions of the
10same data stream. 11 same data stream.
11*) To merge a snapshot of a block device back into the snapshot's origin 12- To merge a snapshot of a block device back into the snapshot's origin
12device. 13 device.
13 14
14In the first two cases, dm copies only the chunks of data that get 15In the first two cases, dm copies only the chunks of data that get
15changed and uses a separate copy-on-write (COW) block device for 16changed and uses a separate copy-on-write (COW) block device for
@@ -22,7 +23,7 @@ the origin device.
22There are three dm targets available: 23There are three dm targets available:
23snapshot, snapshot-origin, and snapshot-merge. 24snapshot, snapshot-origin, and snapshot-merge.
24 25
25*) snapshot-origin <origin> 26- snapshot-origin <origin>
26 27
27which will normally have one or more snapshots based on it. 28which will normally have one or more snapshots based on it.
28Reads will be mapped directly to the backing device. For each write, the 29Reads will be mapped directly to the backing device. For each write, the
@@ -30,7 +31,7 @@ original data will be saved in the <COW device> of each snapshot to keep
30its visible content unchanged, at least until the <COW device> fills up. 31its visible content unchanged, at least until the <COW device> fills up.
31 32
32 33
33*) snapshot <origin> <COW device> <persistent?> <chunksize> 34- snapshot <origin> <COW device> <persistent?> <chunksize>
34 35
35A snapshot of the <origin> block device is created. Changed chunks of 36A snapshot of the <origin> block device is created. Changed chunks of
36<chunksize> sectors will be stored on the <COW device>. Writes will 37<chunksize> sectors will be stored on the <COW device>. Writes will
@@ -83,25 +84,25 @@ When you create the first LVM2 snapshot of a volume, four dm devices are used:
83 source volume), whose table is replaced by a "snapshot-origin" mapping 84 source volume), whose table is replaced by a "snapshot-origin" mapping
84 from device #1. 85 from device #1.
85 86
86A fixed naming scheme is used, so with the following commands: 87A fixed naming scheme is used, so with the following commands::
87 88
88lvcreate -L 1G -n base volumeGroup 89 lvcreate -L 1G -n base volumeGroup
89lvcreate -L 100M --snapshot -n snap volumeGroup/base 90 lvcreate -L 100M --snapshot -n snap volumeGroup/base
90 91
91we'll have this situation (with volumes in above order): 92we'll have this situation (with volumes in above order)::
92 93
93# dmsetup table|grep volumeGroup 94 # dmsetup table|grep volumeGroup
94 95
95volumeGroup-base-real: 0 2097152 linear 8:19 384 96 volumeGroup-base-real: 0 2097152 linear 8:19 384
96volumeGroup-snap-cow: 0 204800 linear 8:19 2097536 97 volumeGroup-snap-cow: 0 204800 linear 8:19 2097536
97volumeGroup-snap: 0 2097152 snapshot 254:11 254:12 P 16 98 volumeGroup-snap: 0 2097152 snapshot 254:11 254:12 P 16
98volumeGroup-base: 0 2097152 snapshot-origin 254:11 99 volumeGroup-base: 0 2097152 snapshot-origin 254:11
99 100
100# ls -lL /dev/mapper/volumeGroup-* 101 # ls -lL /dev/mapper/volumeGroup-*
101brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real 102 brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real
102brw------- 1 root root 254, 12 29 ago 18:15 /dev/mapper/volumeGroup-snap-cow 103 brw------- 1 root root 254, 12 29 ago 18:15 /dev/mapper/volumeGroup-snap-cow
103brw------- 1 root root 254, 13 29 ago 18:15 /dev/mapper/volumeGroup-snap 104 brw------- 1 root root 254, 13 29 ago 18:15 /dev/mapper/volumeGroup-snap
104brw------- 1 root root 254, 10 29 ago 18:14 /dev/mapper/volumeGroup-base 105 brw------- 1 root root 254, 10 29 ago 18:14 /dev/mapper/volumeGroup-base
105 106
106 107
107How snapshot-merge is used by LVM2 108How snapshot-merge is used by LVM2
@@ -114,27 +115,28 @@ merging snapshot after it completes. The "snapshot" that hands over its
114COW device to the "snapshot-merge" is deactivated (unless using lvchange 115COW device to the "snapshot-merge" is deactivated (unless using lvchange
115--refresh); but if it is left active it will simply return I/O errors. 116--refresh); but if it is left active it will simply return I/O errors.
116 117
117A snapshot will merge into its origin with the following command: 118A snapshot will merge into its origin with the following command::
118 119
119lvconvert --merge volumeGroup/snap 120 lvconvert --merge volumeGroup/snap
120 121
121we'll now have this situation: 122we'll now have this situation::
122 123
123# dmsetup table|grep volumeGroup 124 # dmsetup table|grep volumeGroup
124 125
125volumeGroup-base-real: 0 2097152 linear 8:19 384 126 volumeGroup-base-real: 0 2097152 linear 8:19 384
126volumeGroup-base-cow: 0 204800 linear 8:19 2097536 127 volumeGroup-base-cow: 0 204800 linear 8:19 2097536
127volumeGroup-base: 0 2097152 snapshot-merge 254:11 254:12 P 16 128 volumeGroup-base: 0 2097152 snapshot-merge 254:11 254:12 P 16
128 129
129# ls -lL /dev/mapper/volumeGroup-* 130 # ls -lL /dev/mapper/volumeGroup-*
130brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real 131 brw------- 1 root root 254, 11 29 ago 18:15 /dev/mapper/volumeGroup-base-real
131brw------- 1 root root 254, 12 29 ago 18:16 /dev/mapper/volumeGroup-base-cow 132 brw------- 1 root root 254, 12 29 ago 18:16 /dev/mapper/volumeGroup-base-cow
132brw------- 1 root root 254, 10 29 ago 18:16 /dev/mapper/volumeGroup-base 133 brw------- 1 root root 254, 10 29 ago 18:16 /dev/mapper/volumeGroup-base
133 134
134 135
135How to determine when a merging is complete 136How to determine when a merging is complete
136=========================================== 137===========================================
137The snapshot-merge and snapshot status lines end with: 138The snapshot-merge and snapshot status lines end with:
139
138 <sectors_allocated>/<total_sectors> <metadata_sectors> 140 <sectors_allocated>/<total_sectors> <metadata_sectors>
139 141
140Both <sectors_allocated> and <total_sectors> include both data and metadata. 142Both <sectors_allocated> and <total_sectors> include both data and metadata.
@@ -142,35 +144,37 @@ During merging, the number of sectors allocated gets smaller and
142smaller. Merging has finished when the number of sectors holding data 144smaller. Merging has finished when the number of sectors holding data
143is zero, in other words <sectors_allocated> == <metadata_sectors>. 145is zero, in other words <sectors_allocated> == <metadata_sectors>.
144 146
145Here is a practical example (using a hybrid of lvm and dmsetup commands): 147Here is a practical example (using a hybrid of lvm and dmsetup commands)::
146 148
147# lvs 149 # lvs
148 LV VG Attr LSize Origin Snap% Move Log Copy% Convert 150 LV VG Attr LSize Origin Snap% Move Log Copy% Convert
149 base volumeGroup owi-a- 4.00g 151 base volumeGroup owi-a- 4.00g
150 snap volumeGroup swi-a- 1.00g base 18.97 152 snap volumeGroup swi-a- 1.00g base 18.97
151 153
152# dmsetup status volumeGroup-snap 154 # dmsetup status volumeGroup-snap
1530 8388608 snapshot 397896/2097152 1560 155 0 8388608 snapshot 397896/2097152 1560
154 ^^^^ metadata sectors 156 ^^^^ metadata sectors
155 157
156# lvconvert --merge -b volumeGroup/snap 158 # lvconvert --merge -b volumeGroup/snap
157 Merging of volume snap started. 159 Merging of volume snap started.
158 160
159# lvs volumeGroup/snap 161 # lvs volumeGroup/snap
160 LV VG Attr LSize Origin Snap% Move Log Copy% Convert 162 LV VG Attr LSize Origin Snap% Move Log Copy% Convert
161 base volumeGroup Owi-a- 4.00g 17.23 163 base volumeGroup Owi-a- 4.00g 17.23
162 164
163# dmsetup status volumeGroup-base 165 # dmsetup status volumeGroup-base
1640 8388608 snapshot-merge 281688/2097152 1104 166 0 8388608 snapshot-merge 281688/2097152 1104
165 167
166# dmsetup status volumeGroup-base 168 # dmsetup status volumeGroup-base
1670 8388608 snapshot-merge 180480/2097152 712 169 0 8388608 snapshot-merge 180480/2097152 712
168 170
169# dmsetup status volumeGroup-base 171 # dmsetup status volumeGroup-base
1700 8388608 snapshot-merge 16/2097152 16 172 0 8388608 snapshot-merge 16/2097152 16
171 173
172Merging has finished. 174Merging has finished.
173 175
174# lvs 176::
175 LV VG Attr LSize Origin Snap% Move Log Copy% Convert 177
176 base volumeGroup owi-a- 4.00g 178 # lvs
179 LV VG Attr LSize Origin Snap% Move Log Copy% Convert
180 base volumeGroup owi-a- 4.00g
diff --git a/Documentation/device-mapper/statistics.txt b/Documentation/device-mapper/statistics.rst
index 170ac02a1f50..3d80a9f850cc 100644
--- a/Documentation/device-mapper/statistics.txt
+++ b/Documentation/device-mapper/statistics.rst
@@ -1,3 +1,4 @@
1=============
1DM statistics 2DM statistics
2============= 3=============
3 4
@@ -11,7 +12,7 @@ Individual statistics will be collected for each step-sized area within
11the range specified. 12the range specified.
12 13
13The I/O statistics counters for each step-sized area of a region are 14The I/O statistics counters for each step-sized area of a region are
14in the same format as /sys/block/*/stat or /proc/diskstats (see: 15in the same format as `/sys/block/*/stat` or `/proc/diskstats` (see:
15Documentation/iostats.txt). But two extra counters (12 and 13) are 16Documentation/iostats.txt). But two extra counters (12 and 13) are
16provided: total time spent reading and writing. When the histogram 17provided: total time spent reading and writing. When the histogram
17argument is used, the 14th parameter is reported that represents the 18argument is used, the 14th parameter is reported that represents the
@@ -32,40 +33,45 @@ on each other's data.
32The creation of DM statistics will allocate memory via kmalloc or 33The creation of DM statistics will allocate memory via kmalloc or
33fallback to using vmalloc space. At most, 1/4 of the overall system 34fallback to using vmalloc space. At most, 1/4 of the overall system
34memory may be allocated by DM statistics. The admin can see how much 35memory may be allocated by DM statistics. The admin can see how much
35memory is used by reading 36memory is used by reading:
36/sys/module/dm_mod/parameters/stats_current_allocated_bytes 37
38 /sys/module/dm_mod/parameters/stats_current_allocated_bytes
37 39
38Messages 40Messages
39======== 41========
40 42
41 @stats_create <range> <step> 43 @stats_create <range> <step> [<number_of_optional_arguments> <optional_arguments>...] [<program_id> [<aux_data>]]
42 [<number_of_optional_arguments> <optional_arguments>...]
43 [<program_id> [<aux_data>]]
44
45 Create a new region and return the region_id. 44 Create a new region and return the region_id.
46 45
47 <range> 46 <range>
48 "-" - whole device 47 "-"
49 "<start_sector>+<length>" - a range of <length> 512-byte sectors 48 whole device
50 starting with <start_sector>. 49 "<start_sector>+<length>"
50 a range of <length> 512-byte sectors
51 starting with <start_sector>.
51 52
52 <step> 53 <step>
53 "<area_size>" - the range is subdivided into areas each containing 54 "<area_size>"
54 <area_size> sectors. 55 the range is subdivided into areas each containing
55 "/<number_of_areas>" - the range is subdivided into the specified 56 <area_size> sectors.
56 number of areas. 57 "/<number_of_areas>"
58 the range is subdivided into the specified
59 number of areas.
57 60
58 <number_of_optional_arguments> 61 <number_of_optional_arguments>
59 The number of optional arguments 62 The number of optional arguments
60 63
61 <optional_arguments> 64 <optional_arguments>
62 The following optional arguments are supported 65 The following optional arguments are supported:
63 precise_timestamps - use precise timer with nanosecond resolution 66
67 precise_timestamps
68 use precise timer with nanosecond resolution
64 instead of the "jiffies" variable. When this argument is 69 instead of the "jiffies" variable. When this argument is
65 used, the resulting times are in nanoseconds instead of 70 used, the resulting times are in nanoseconds instead of
66 milliseconds. Precise timestamps are a little bit slower 71 milliseconds. Precise timestamps are a little bit slower
67 to obtain than jiffies-based timestamps. 72 to obtain than jiffies-based timestamps.
68 histogram:n1,n2,n3,n4,... - collect histogram of latencies. The 73 histogram:n1,n2,n3,n4,...
74 collect histogram of latencies. The
69 numbers n1, n2, etc are times that represent the boundaries 75 numbers n1, n2, etc are times that represent the boundaries
70 of the histogram. If precise_timestamps is not used, the 76 of the histogram. If precise_timestamps is not used, the
71 times are in milliseconds, otherwise they are in 77 times are in milliseconds, otherwise they are in
@@ -96,21 +102,18 @@ Messages
96 @stats_list message, but it doesn't use this value for anything. 102 @stats_list message, but it doesn't use this value for anything.
97 103
98 @stats_delete <region_id> 104 @stats_delete <region_id>
99
100 Delete the region with the specified id. 105 Delete the region with the specified id.
101 106
102 <region_id> 107 <region_id>
103 region_id returned from @stats_create 108 region_id returned from @stats_create
104 109
105 @stats_clear <region_id> 110 @stats_clear <region_id>
106
107 Clear all the counters except the in-flight i/o counters. 111 Clear all the counters except the in-flight i/o counters.
108 112
109 <region_id> 113 <region_id>
110 region_id returned from @stats_create 114 region_id returned from @stats_create
111 115
112 @stats_list [<program_id>] 116 @stats_list [<program_id>]
113
114 List all regions registered with @stats_create. 117 List all regions registered with @stats_create.
115 118
116 <program_id> 119 <program_id>
@@ -127,7 +130,6 @@ Messages
127 if they were specified when creating the region. 130 if they were specified when creating the region.
128 131
129 @stats_print <region_id> [<starting_line> <number_of_lines>] 132 @stats_print <region_id> [<starting_line> <number_of_lines>]
130
131 Print counters for each step-sized area of a region. 133 Print counters for each step-sized area of a region.
132 134
133 <region_id> 135 <region_id>
@@ -143,10 +145,11 @@ Messages
143 145
144 Output format for each step-sized area of a region: 146 Output format for each step-sized area of a region:
145 147
146 <start_sector>+<length> counters 148 <start_sector>+<length>
149 counters
147 150
148 The first 11 counters have the same meaning as 151 The first 11 counters have the same meaning as
149 /sys/block/*/stat or /proc/diskstats. 152 `/sys/block/*/stat or /proc/diskstats`.
150 153
151 Please refer to Documentation/iostats.txt for details. 154 Please refer to Documentation/iostats.txt for details.
152 155
@@ -163,11 +166,11 @@ Messages
163 11. the weighted number of milliseconds spent doing I/Os 166 11. the weighted number of milliseconds spent doing I/Os
164 167
165 Additional counters: 168 Additional counters:
169
166 12. the total time spent reading in milliseconds 170 12. the total time spent reading in milliseconds
167 13. the total time spent writing in milliseconds 171 13. the total time spent writing in milliseconds
168 172
169 @stats_print_clear <region_id> [<starting_line> <number_of_lines>] 173 @stats_print_clear <region_id> [<starting_line> <number_of_lines>]
170
171 Atomically print and then clear all the counters except the 174 Atomically print and then clear all the counters except the
172 in-flight i/o counters. Useful when the client consuming the 175 in-flight i/o counters. Useful when the client consuming the
173 statistics does not want to lose any statistics (those updated 176 statistics does not want to lose any statistics (those updated
@@ -185,7 +188,6 @@ Messages
185 If omitted, all lines are printed and then cleared. 188 If omitted, all lines are printed and then cleared.
186 189
187 @stats_set_aux <region_id> <aux_data> 190 @stats_set_aux <region_id> <aux_data>
188
189 Store auxiliary data aux_data for the specified region. 191 Store auxiliary data aux_data for the specified region.
190 192
191 <region_id> 193 <region_id>
@@ -201,23 +203,23 @@ Examples
201======== 203========
202 204
203Subdivide the DM device 'vol' into 100 pieces and start collecting 205Subdivide the DM device 'vol' into 100 pieces and start collecting
204statistics on them: 206statistics on them::
205 207
206 dmsetup message vol 0 @stats_create - /100 208 dmsetup message vol 0 @stats_create - /100
207 209
208Set the auxiliary data string to "foo bar baz" (the escape for each 210Set the auxiliary data string to "foo bar baz" (the escape for each
209space must also be escaped, otherwise the shell will consume them): 211space must also be escaped, otherwise the shell will consume them)::
210 212
211 dmsetup message vol 0 @stats_set_aux 0 foo\\ bar\\ baz 213 dmsetup message vol 0 @stats_set_aux 0 foo\\ bar\\ baz
212 214
213List the statistics: 215List the statistics::
214 216
215 dmsetup message vol 0 @stats_list 217 dmsetup message vol 0 @stats_list
216 218
217Print the statistics: 219Print the statistics::
218 220
219 dmsetup message vol 0 @stats_print 0 221 dmsetup message vol 0 @stats_print 0
220 222
221Delete the statistics: 223Delete the statistics::
222 224
223 dmsetup message vol 0 @stats_delete 0 225 dmsetup message vol 0 @stats_delete 0
diff --git a/Documentation/device-mapper/striped.rst b/Documentation/device-mapper/striped.rst
new file mode 100644
index 000000000000..e9a8da192ae1
--- /dev/null
+++ b/Documentation/device-mapper/striped.rst
@@ -0,0 +1,61 @@
1=========
2dm-stripe
3=========
4
5Device-Mapper's "striped" target is used to create a striped (i.e. RAID-0)
6device across one or more underlying devices. Data is written in "chunks",
7with consecutive chunks rotating among the underlying devices. This can
8potentially provide improved I/O throughput by utilizing several physical
9devices in parallel.
10
11Parameters: <num devs> <chunk size> [<dev path> <offset>]+
12 <num devs>:
13 Number of underlying devices.
14 <chunk size>:
15 Size of each chunk of data. Must be at least as
16 large as the system's PAGE_SIZE.
17 <dev path>:
18 Full pathname to the underlying block-device, or a
19 "major:minor" device-number.
20 <offset>:
21 Starting sector within the device.
22
23One or more underlying devices can be specified. The striped device size must
24be a multiple of the chunk size multiplied by the number of underlying devices.
25
26
27Example scripts
28===============
29
30::
31
32 #!/usr/bin/perl -w
33 # Create a striped device across any number of underlying devices. The device
34 # will be called "stripe_dev" and have a chunk-size of 128k.
35
36 my $chunk_size = 128 * 2;
37 my $dev_name = "stripe_dev";
38 my $num_devs = @ARGV;
39 my @devs = @ARGV;
40 my ($min_dev_size, $stripe_dev_size, $i);
41
42 if (!$num_devs) {
43 die("Specify at least one device\n");
44 }
45
46 $min_dev_size = `blockdev --getsz $devs[0]`;
47 for ($i = 1; $i < $num_devs; $i++) {
48 my $this_size = `blockdev --getsz $devs[$i]`;
49 $min_dev_size = ($min_dev_size < $this_size) ?
50 $min_dev_size : $this_size;
51 }
52
53 $stripe_dev_size = $min_dev_size * $num_devs;
54 $stripe_dev_size -= $stripe_dev_size % ($chunk_size * $num_devs);
55
56 $table = "0 $stripe_dev_size striped $num_devs $chunk_size";
57 for ($i = 0; $i < $num_devs; $i++) {
58 $table .= " $devs[$i] 0";
59 }
60
61 `echo $table | dmsetup create $dev_name`;
diff --git a/Documentation/device-mapper/striped.txt b/Documentation/device-mapper/striped.txt
deleted file mode 100644
index 07ec492cceee..000000000000
--- a/Documentation/device-mapper/striped.txt
+++ /dev/null
@@ -1,57 +0,0 @@
1dm-stripe
2=========
3
4Device-Mapper's "striped" target is used to create a striped (i.e. RAID-0)
5device across one or more underlying devices. Data is written in "chunks",
6with consecutive chunks rotating among the underlying devices. This can
7potentially provide improved I/O throughput by utilizing several physical
8devices in parallel.
9
10Parameters: <num devs> <chunk size> [<dev path> <offset>]+
11 <num devs>: Number of underlying devices.
12 <chunk size>: Size of each chunk of data. Must be at least as
13 large as the system's PAGE_SIZE.
14 <dev path>: Full pathname to the underlying block-device, or a
15 "major:minor" device-number.
16 <offset>: Starting sector within the device.
17
18One or more underlying devices can be specified. The striped device size must
19be a multiple of the chunk size multiplied by the number of underlying devices.
20
21
22Example scripts
23===============
24
25[[
26#!/usr/bin/perl -w
27# Create a striped device across any number of underlying devices. The device
28# will be called "stripe_dev" and have a chunk-size of 128k.
29
30my $chunk_size = 128 * 2;
31my $dev_name = "stripe_dev";
32my $num_devs = @ARGV;
33my @devs = @ARGV;
34my ($min_dev_size, $stripe_dev_size, $i);
35
36if (!$num_devs) {
37 die("Specify at least one device\n");
38}
39
40$min_dev_size = `blockdev --getsz $devs[0]`;
41for ($i = 1; $i < $num_devs; $i++) {
42 my $this_size = `blockdev --getsz $devs[$i]`;
43 $min_dev_size = ($min_dev_size < $this_size) ?
44 $min_dev_size : $this_size;
45}
46
47$stripe_dev_size = $min_dev_size * $num_devs;
48$stripe_dev_size -= $stripe_dev_size % ($chunk_size * $num_devs);
49
50$table = "0 $stripe_dev_size striped $num_devs $chunk_size";
51for ($i = 0; $i < $num_devs; $i++) {
52 $table .= " $devs[$i] 0";
53}
54
55`echo $table | dmsetup create $dev_name`;
56]]
57
diff --git a/Documentation/device-mapper/switch.txt b/Documentation/device-mapper/switch.rst
index 5bd4831db4a8..7dde06be1a4f 100644
--- a/Documentation/device-mapper/switch.txt
+++ b/Documentation/device-mapper/switch.rst
@@ -1,3 +1,4 @@
1=========
1dm-switch 2dm-switch
2========= 3=========
3 4
@@ -67,27 +68,25 @@ b-tree can achieve.
67Construction Parameters 68Construction Parameters
68======================= 69=======================
69 70
70 <num_paths> <region_size> <num_optional_args> [<optional_args>...] 71 <num_paths> <region_size> <num_optional_args> [<optional_args>...] [<dev_path> <offset>]+
71 [<dev_path> <offset>]+ 72 <num_paths>
72 73 The number of paths across which to distribute the I/O.
73<num_paths>
74 The number of paths across which to distribute the I/O.
75 74
76<region_size> 75 <region_size>
77 The number of 512-byte sectors in a region. Each region can be redirected 76 The number of 512-byte sectors in a region. Each region can be redirected
78 to any of the available paths. 77 to any of the available paths.
79 78
80<num_optional_args> 79 <num_optional_args>
81 The number of optional arguments. Currently, no optional arguments 80 The number of optional arguments. Currently, no optional arguments
82 are supported and so this must be zero. 81 are supported and so this must be zero.
83 82
84<dev_path> 83 <dev_path>
85 The block device that represents a specific path to the device. 84 The block device that represents a specific path to the device.
86 85
87<offset> 86 <offset>
88 The offset of the start of data on the specific <dev_path> (in units 87 The offset of the start of data on the specific <dev_path> (in units
89 of 512-byte sectors). This number is added to the sector number when 88 of 512-byte sectors). This number is added to the sector number when
90 forwarding the request to the specific path. Typically it is zero. 89 forwarding the request to the specific path. Typically it is zero.
91 90
92Messages 91Messages
93======== 92========
@@ -122,17 +121,21 @@ Example
122Assume that you have volumes vg1/switch0 vg1/switch1 vg1/switch2 with 121Assume that you have volumes vg1/switch0 vg1/switch1 vg1/switch2 with
123the same size. 122the same size.
124 123
125Create a switch device with 64kB region size: 124Create a switch device with 64kB region size::
125
126 dmsetup create switch --table "0 `blockdev --getsz /dev/vg1/switch0` 126 dmsetup create switch --table "0 `blockdev --getsz /dev/vg1/switch0`
127 switch 3 128 0 /dev/vg1/switch0 0 /dev/vg1/switch1 0 /dev/vg1/switch2 0" 127 switch 3 128 0 /dev/vg1/switch0 0 /dev/vg1/switch1 0 /dev/vg1/switch2 0"
128 128
129Set mappings for the first 7 entries to point to devices switch0, switch1, 129Set mappings for the first 7 entries to point to devices switch0, switch1,
130switch2, switch0, switch1, switch2, switch1: 130switch2, switch0, switch1, switch2, switch1::
131
131 dmsetup message switch 0 set_region_mappings 0:0 :1 :2 :0 :1 :2 :1 132 dmsetup message switch 0 set_region_mappings 0:0 :1 :2 :0 :1 :2 :1
132 133
133Set repetitive mapping. This command: 134Set repetitive mapping. This command::
135
134 dmsetup message switch 0 set_region_mappings 1000:1 :2 R2,10 136 dmsetup message switch 0 set_region_mappings 1000:1 :2 R2,10
135is equivalent to: 137
138is equivalent to::
139
136 dmsetup message switch 0 set_region_mappings 1000:1 :2 :1 :2 :1 :2 :1 :2 \ 140 dmsetup message switch 0 set_region_mappings 1000:1 :2 :1 :2 :1 :2 :1 :2 \
137 :1 :2 :1 :2 :1 :2 :1 :2 :1 :2 141 :1 :2 :1 :2 :1 :2 :1 :2 :1 :2
138
diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.rst
index 883e7ca5f745..bafebf79da4b 100644
--- a/Documentation/device-mapper/thin-provisioning.txt
+++ b/Documentation/device-mapper/thin-provisioning.rst
@@ -1,3 +1,7 @@
1=================
2Thin provisioning
3=================
4
1Introduction 5Introduction
2============ 6============
3 7
@@ -95,6 +99,8 @@ previously.)
95Using an existing pool device 99Using an existing pool device
96----------------------------- 100-----------------------------
97 101
102::
103
98 dmsetup create pool \ 104 dmsetup create pool \
99 --table "0 20971520 thin-pool $metadata_dev $data_dev \ 105 --table "0 20971520 thin-pool $metadata_dev $data_dev \
100 $data_block_size $low_water_mark" 106 $data_block_size $low_water_mark"
@@ -154,7 +160,7 @@ Thin provisioning
154i) Creating a new thinly-provisioned volume. 160i) Creating a new thinly-provisioned volume.
155 161
156 To create a new thinly- provisioned volume you must send a message to an 162 To create a new thinly- provisioned volume you must send a message to an
157 active pool device, /dev/mapper/pool in this example. 163 active pool device, /dev/mapper/pool in this example::
158 164
159 dmsetup message /dev/mapper/pool 0 "create_thin 0" 165 dmsetup message /dev/mapper/pool 0 "create_thin 0"
160 166
@@ -164,7 +170,7 @@ i) Creating a new thinly-provisioned volume.
164 170
165ii) Using a thinly-provisioned volume. 171ii) Using a thinly-provisioned volume.
166 172
167 Thinly-provisioned volumes are activated using the 'thin' target: 173 Thinly-provisioned volumes are activated using the 'thin' target::
168 174
169 dmsetup create thin --table "0 2097152 thin /dev/mapper/pool 0" 175 dmsetup create thin --table "0 2097152 thin /dev/mapper/pool 0"
170 176
@@ -181,6 +187,8 @@ i) Creating an internal snapshot.
181 must suspend it before creating the snapshot to avoid corruption. 187 must suspend it before creating the snapshot to avoid corruption.
182 This is NOT enforced at the moment, so please be careful! 188 This is NOT enforced at the moment, so please be careful!
183 189
190 ::
191
184 dmsetup suspend /dev/mapper/thin 192 dmsetup suspend /dev/mapper/thin
185 dmsetup message /dev/mapper/pool 0 "create_snap 1 0" 193 dmsetup message /dev/mapper/pool 0 "create_snap 1 0"
186 dmsetup resume /dev/mapper/thin 194 dmsetup resume /dev/mapper/thin
@@ -198,14 +206,14 @@ ii) Using an internal snapshot.
198 activating or removing them both. (This differs from conventional 206 activating or removing them both. (This differs from conventional
199 device-mapper snapshots.) 207 device-mapper snapshots.)
200 208
201 Activate it exactly the same way as any other thinly-provisioned volume: 209 Activate it exactly the same way as any other thinly-provisioned volume::
202 210
203 dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 1" 211 dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 1"
204 212
205External snapshots 213External snapshots
206------------------ 214------------------
207 215
208You can use an external _read only_ device as an origin for a 216You can use an external **read only** device as an origin for a
209thinly-provisioned volume. Any read to an unprovisioned area of the 217thinly-provisioned volume. Any read to an unprovisioned area of the
210thin device will be passed through to the origin. Writes trigger 218thin device will be passed through to the origin. Writes trigger
211the allocation of new blocks as usual. 219the allocation of new blocks as usual.
@@ -223,11 +231,13 @@ i) Creating a snapshot of an external device
223 This is the same as creating a thin device. 231 This is the same as creating a thin device.
224 You don't mention the origin at this stage. 232 You don't mention the origin at this stage.
225 233
234 ::
235
226 dmsetup message /dev/mapper/pool 0 "create_thin 0" 236 dmsetup message /dev/mapper/pool 0 "create_thin 0"
227 237
228ii) Using a snapshot of an external device. 238ii) Using a snapshot of an external device.
229 239
230 Append an extra parameter to the thin target specifying the origin: 240 Append an extra parameter to the thin target specifying the origin::
231 241
232 dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 0 /dev/image" 242 dmsetup create snap --table "0 2097152 thin /dev/mapper/pool 0 /dev/image"
233 243
@@ -240,6 +250,8 @@ Deactivation
240All devices using a pool must be deactivated before the pool itself 250All devices using a pool must be deactivated before the pool itself
241can be. 251can be.
242 252
253::
254
243 dmsetup remove thin 255 dmsetup remove thin
244 dmsetup remove snap 256 dmsetup remove snap
245 dmsetup remove pool 257 dmsetup remove pool
@@ -252,25 +264,32 @@ Reference
252 264
253i) Constructor 265i) Constructor
254 266
255 thin-pool <metadata dev> <data dev> <data block size (sectors)> \ 267 ::
256 <low water mark (blocks)> [<number of feature args> [<arg>]*] 268
269 thin-pool <metadata dev> <data dev> <data block size (sectors)> \
270 <low water mark (blocks)> [<number of feature args> [<arg>]*]
257 271
258 Optional feature arguments: 272 Optional feature arguments:
259 273
260 skip_block_zeroing: Skip the zeroing of newly-provisioned blocks. 274 skip_block_zeroing:
275 Skip the zeroing of newly-provisioned blocks.
261 276
262 ignore_discard: Disable discard support. 277 ignore_discard:
278 Disable discard support.
263 279
264 no_discard_passdown: Don't pass discards down to the underlying 280 no_discard_passdown:
265 data device, but just remove the mapping. 281 Don't pass discards down to the underlying
282 data device, but just remove the mapping.
266 283
267 read_only: Don't allow any changes to be made to the pool 284 read_only:
285 Don't allow any changes to be made to the pool
268 metadata. This mode is only available after the 286 metadata. This mode is only available after the
269 thin-pool has been created and first used in full 287 thin-pool has been created and first used in full
270 read/write mode. It cannot be specified on initial 288 read/write mode. It cannot be specified on initial
271 thin-pool creation. 289 thin-pool creation.
272 290
273 error_if_no_space: Error IOs, instead of queueing, if no space. 291 error_if_no_space:
292 Error IOs, instead of queueing, if no space.
274 293
275 Data block size must be between 64KB (128 sectors) and 1GB 294 Data block size must be between 64KB (128 sectors) and 1GB
276 (2097152 sectors) inclusive. 295 (2097152 sectors) inclusive.
@@ -278,10 +297,12 @@ i) Constructor
278 297
279ii) Status 298ii) Status
280 299
281 <transaction id> <used metadata blocks>/<total metadata blocks> 300 ::
282 <used data blocks>/<total data blocks> <held metadata root> 301
283 ro|rw|out_of_data_space [no_]discard_passdown [error|queue]_if_no_space 302 <transaction id> <used metadata blocks>/<total metadata blocks>
284 needs_check|- metadata_low_watermark 303 <used data blocks>/<total data blocks> <held metadata root>
304 ro|rw|out_of_data_space [no_]discard_passdown [error|queue]_if_no_space
305 needs_check|- metadata_low_watermark
285 306
286 transaction id: 307 transaction id:
287 A 64-bit number used by userspace to help synchronise with metadata 308 A 64-bit number used by userspace to help synchronise with metadata
@@ -336,13 +357,11 @@ ii) Status
336iii) Messages 357iii) Messages
337 358
338 create_thin <dev id> 359 create_thin <dev id>
339
340 Create a new thinly-provisioned device. 360 Create a new thinly-provisioned device.
341 <dev id> is an arbitrary unique 24-bit identifier chosen by 361 <dev id> is an arbitrary unique 24-bit identifier chosen by
342 the caller. 362 the caller.
343 363
344 create_snap <dev id> <origin id> 364 create_snap <dev id> <origin id>
345
346 Create a new snapshot of another thinly-provisioned device. 365 Create a new snapshot of another thinly-provisioned device.
347 <dev id> is an arbitrary unique 24-bit identifier chosen by 366 <dev id> is an arbitrary unique 24-bit identifier chosen by
348 the caller. 367 the caller.
@@ -350,11 +369,9 @@ iii) Messages
350 of which the new device will be a snapshot. 369 of which the new device will be a snapshot.
351 370
352 delete <dev id> 371 delete <dev id>
353
354 Deletes a thin device. Irreversible. 372 Deletes a thin device. Irreversible.
355 373
356 set_transaction_id <current id> <new id> 374 set_transaction_id <current id> <new id>
357
358 Userland volume managers, such as LVM, need a way to 375 Userland volume managers, such as LVM, need a way to
359 synchronise their external metadata with the internal metadata of the 376 synchronise their external metadata with the internal metadata of the
360 pool target. The thin-pool target offers to store an 377 pool target. The thin-pool target offers to store an
@@ -364,14 +381,12 @@ iii) Messages
364 compare-and-swap message. 381 compare-and-swap message.
365 382
366 reserve_metadata_snap 383 reserve_metadata_snap
367
368 Reserve a copy of the data mapping btree for use by userland. 384 Reserve a copy of the data mapping btree for use by userland.
369 This allows userland to inspect the mappings as they were when 385 This allows userland to inspect the mappings as they were when
370 this message was executed. Use the pool's status command to 386 this message was executed. Use the pool's status command to
371 get the root block associated with the metadata snapshot. 387 get the root block associated with the metadata snapshot.
372 388
373 release_metadata_snap 389 release_metadata_snap
374
375 Release a previously reserved copy of the data mapping btree. 390 Release a previously reserved copy of the data mapping btree.
376 391
377'thin' target 392'thin' target
@@ -379,7 +394,9 @@ iii) Messages
379 394
380i) Constructor 395i) Constructor
381 396
382 thin <pool dev> <dev id> [<external origin dev>] 397 ::
398
399 thin <pool dev> <dev id> [<external origin dev>]
383 400
384 pool dev: 401 pool dev:
385 the thin-pool device, e.g. /dev/mapper/my_pool or 253:0 402 the thin-pool device, e.g. /dev/mapper/my_pool or 253:0
@@ -401,8 +418,7 @@ provisioned as and when needed.
401 418
402ii) Status 419ii) Status
403 420
404 <nr mapped sectors> <highest mapped sector> 421 <nr mapped sectors> <highest mapped sector>
405
406 If the pool has encountered device errors and failed, the status 422 If the pool has encountered device errors and failed, the status
407 will just contain the string 'Fail'. The userspace recovery 423 will just contain the string 'Fail'. The userspace recovery
408 tools should then be used. 424 tools should then be used.
diff --git a/Documentation/device-mapper/unstriped.txt b/Documentation/device-mapper/unstriped.rst
index 0b2a306c54ee..0a8d3eb3f072 100644
--- a/Documentation/device-mapper/unstriped.txt
+++ b/Documentation/device-mapper/unstriped.rst
@@ -1,3 +1,7 @@
1================================
2Device-mapper "unstriped" target
3================================
4
1Introduction 5Introduction
2============ 6============
3 7
@@ -34,46 +38,46 @@ striped target to combine the 4 devices into one. It then will use
34the unstriped target ontop of the striped device to access the 38the unstriped target ontop of the striped device to access the
35individual backing loop devices. We write data to the newly exposed 39individual backing loop devices. We write data to the newly exposed
36unstriped devices and verify the data written matches the correct 40unstriped devices and verify the data written matches the correct
37underlying device on the striped array. 41underlying device on the striped array::
38 42
39#!/bin/bash 43 #!/bin/bash
40 44
41MEMBER_SIZE=$((128 * 1024 * 1024)) 45 MEMBER_SIZE=$((128 * 1024 * 1024))
42NUM=4 46 NUM=4
43SEQ_END=$((${NUM}-1)) 47 SEQ_END=$((${NUM}-1))
44CHUNK=256 48 CHUNK=256
45BS=4096 49 BS=4096
46 50
47RAID_SIZE=$((${MEMBER_SIZE}*${NUM}/512)) 51 RAID_SIZE=$((${MEMBER_SIZE}*${NUM}/512))
48DM_PARMS="0 ${RAID_SIZE} striped ${NUM} ${CHUNK}" 52 DM_PARMS="0 ${RAID_SIZE} striped ${NUM} ${CHUNK}"
49COUNT=$((${MEMBER_SIZE} / ${BS})) 53 COUNT=$((${MEMBER_SIZE} / ${BS}))
50 54
51for i in $(seq 0 ${SEQ_END}); do 55 for i in $(seq 0 ${SEQ_END}); do
52 dd if=/dev/zero of=member-${i} bs=${MEMBER_SIZE} count=1 oflag=direct 56 dd if=/dev/zero of=member-${i} bs=${MEMBER_SIZE} count=1 oflag=direct
53 losetup /dev/loop${i} member-${i} 57 losetup /dev/loop${i} member-${i}
54 DM_PARMS+=" /dev/loop${i} 0" 58 DM_PARMS+=" /dev/loop${i} 0"
55done 59 done
56 60
57echo $DM_PARMS | dmsetup create raid0 61 echo $DM_PARMS | dmsetup create raid0
58for i in $(seq 0 ${SEQ_END}); do 62 for i in $(seq 0 ${SEQ_END}); do
59 echo "0 1 unstriped ${NUM} ${CHUNK} ${i} /dev/mapper/raid0 0" | dmsetup create set-${i} 63 echo "0 1 unstriped ${NUM} ${CHUNK} ${i} /dev/mapper/raid0 0" | dmsetup create set-${i}
60done; 64 done;
61 65
62for i in $(seq 0 ${SEQ_END}); do 66 for i in $(seq 0 ${SEQ_END}); do
63 dd if=/dev/urandom of=/dev/mapper/set-${i} bs=${BS} count=${COUNT} oflag=direct 67 dd if=/dev/urandom of=/dev/mapper/set-${i} bs=${BS} count=${COUNT} oflag=direct
64 diff /dev/mapper/set-${i} member-${i} 68 diff /dev/mapper/set-${i} member-${i}
65done; 69 done;
66 70
67for i in $(seq 0 ${SEQ_END}); do 71 for i in $(seq 0 ${SEQ_END}); do
68 dmsetup remove set-${i} 72 dmsetup remove set-${i}
69done 73 done
70 74
71dmsetup remove raid0 75 dmsetup remove raid0
72 76
73for i in $(seq 0 ${SEQ_END}); do 77 for i in $(seq 0 ${SEQ_END}); do
74 losetup -d /dev/loop${i} 78 losetup -d /dev/loop${i}
75 rm -f member-${i} 79 rm -f member-${i}
76done 80 done
77 81
78Another example 82Another example
79--------------- 83---------------
@@ -81,7 +85,7 @@ Another example
81Intel NVMe drives contain two cores on the physical device. 85Intel NVMe drives contain two cores on the physical device.
82Each core of the drive has segregated access to its LBA range. 86Each core of the drive has segregated access to its LBA range.
83The current LBA model has a RAID 0 128k chunk on each core, resulting 87The current LBA model has a RAID 0 128k chunk on each core, resulting
84in a 256k stripe across the two cores: 88in a 256k stripe across the two cores::
85 89
86 Core 0: Core 1: 90 Core 0: Core 1:
87 __________ __________ 91 __________ __________
@@ -108,17 +112,24 @@ Example dmsetup usage
108 112
109unstriped ontop of Intel NVMe device that has 2 cores 113unstriped ontop of Intel NVMe device that has 2 cores
110----------------------------------------------------- 114-----------------------------------------------------
111dmsetup create nvmset0 --table '0 512 unstriped 2 256 0 /dev/nvme0n1 0' 115
112dmsetup create nvmset1 --table '0 512 unstriped 2 256 1 /dev/nvme0n1 0' 116::
117
118 dmsetup create nvmset0 --table '0 512 unstriped 2 256 0 /dev/nvme0n1 0'
119 dmsetup create nvmset1 --table '0 512 unstriped 2 256 1 /dev/nvme0n1 0'
113 120
114There will now be two devices that expose Intel NVMe core 0 and 1 121There will now be two devices that expose Intel NVMe core 0 and 1
115respectively: 122respectively::
116/dev/mapper/nvmset0 123
117/dev/mapper/nvmset1 124 /dev/mapper/nvmset0
125 /dev/mapper/nvmset1
118 126
119unstriped ontop of striped with 4 drives using 128K chunk size 127unstriped ontop of striped with 4 drives using 128K chunk size
120-------------------------------------------------------------- 128--------------------------------------------------------------
121dmsetup create raid_disk0 --table '0 512 unstriped 4 256 0 /dev/mapper/striped 0' 129
122dmsetup create raid_disk1 --table '0 512 unstriped 4 256 1 /dev/mapper/striped 0' 130::
123dmsetup create raid_disk2 --table '0 512 unstriped 4 256 2 /dev/mapper/striped 0' 131
124dmsetup create raid_disk3 --table '0 512 unstriped 4 256 3 /dev/mapper/striped 0' 132 dmsetup create raid_disk0 --table '0 512 unstriped 4 256 0 /dev/mapper/striped 0'
133 dmsetup create raid_disk1 --table '0 512 unstriped 4 256 1 /dev/mapper/striped 0'
134 dmsetup create raid_disk2 --table '0 512 unstriped 4 256 2 /dev/mapper/striped 0'
135 dmsetup create raid_disk3 --table '0 512 unstriped 4 256 3 /dev/mapper/striped 0'
diff --git a/Documentation/device-mapper/verity.txt b/Documentation/device-mapper/verity.rst
index b3d2e4a42255..a4d1c1476d72 100644
--- a/Documentation/device-mapper/verity.txt
+++ b/Documentation/device-mapper/verity.rst
@@ -1,5 +1,6 @@
1=========
1dm-verity 2dm-verity
2========== 3=========
3 4
4Device-Mapper's "verity" target provides transparent integrity checking of 5Device-Mapper's "verity" target provides transparent integrity checking of
5block devices using a cryptographic digest provided by the kernel crypto API. 6block devices using a cryptographic digest provided by the kernel crypto API.
@@ -7,6 +8,9 @@ This target is read-only.
7 8
8Construction Parameters 9Construction Parameters
9======================= 10=======================
11
12::
13
10 <version> <dev> <hash_dev> 14 <version> <dev> <hash_dev>
11 <data_block_size> <hash_block_size> 15 <data_block_size> <hash_block_size>
12 <num_data_blocks> <hash_start_block> 16 <num_data_blocks> <hash_start_block>
@@ -160,7 +164,9 @@ calculating the parent node.
160 164
161The tree looks something like: 165The tree looks something like:
162 166
163alg = sha256, num_blocks = 32768, block_size = 4096 167 alg = sha256, num_blocks = 32768, block_size = 4096
168
169::
164 170
165 [ root ] 171 [ root ]
166 / . . . \ 172 / . . . \
@@ -189,6 +195,7 @@ block boundary) are the hash blocks which are stored a depth at a time
189 195
190The full specification of kernel parameters and on-disk metadata format 196The full specification of kernel parameters and on-disk metadata format
191is available at the cryptsetup project's wiki page 197is available at the cryptsetup project's wiki page
198
192 https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity 199 https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity
193 200
194Status 201Status
@@ -198,7 +205,8 @@ If any check failed, C (for Corruption) is returned.
198 205
199Example 206Example
200======= 207=======
201Set up a device: 208Set up a device::
209
202 # dmsetup create vroot --readonly --table \ 210 # dmsetup create vroot --readonly --table \
203 "0 2097152 verity 1 /dev/sda1 /dev/sda2 4096 4096 262144 1 sha256 "\ 211 "0 2097152 verity 1 /dev/sda1 /dev/sda2 4096 4096 262144 1 sha256 "\
204 "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\ 212 "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\
@@ -209,11 +217,13 @@ the hash tree or activate the kernel device. This is available from
209the cryptsetup upstream repository https://gitlab.com/cryptsetup/cryptsetup/ 217the cryptsetup upstream repository https://gitlab.com/cryptsetup/cryptsetup/
210(as a libcryptsetup extension). 218(as a libcryptsetup extension).
211 219
212Create hash on the device: 220Create hash on the device::
221
213 # veritysetup format /dev/sda1 /dev/sda2 222 # veritysetup format /dev/sda1 /dev/sda2
214 ... 223 ...
215 Root hash: 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 224 Root hash: 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076
216 225
217Activate the device: 226Activate the device::
227
218 # veritysetup create vroot /dev/sda1 /dev/sda2 \ 228 # veritysetup create vroot /dev/sda1 /dev/sda2 \
219 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 229 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076
diff --git a/Documentation/device-mapper/writecache.txt b/Documentation/device-mapper/writecache.rst
index 01532b3008ae..d3d7690f5e8d 100644
--- a/Documentation/device-mapper/writecache.txt
+++ b/Documentation/device-mapper/writecache.rst
@@ -1,3 +1,7 @@
1=================
2Writecache target
3=================
4
1The writecache target caches writes on persistent memory or on SSD. It 5The writecache target caches writes on persistent memory or on SSD. It
2doesn't cache reads because reads are supposed to be cached in page cache 6doesn't cache reads because reads are supposed to be cached in page cache
3in normal RAM. 7in normal RAM.
@@ -6,15 +10,18 @@ When the device is constructed, the first sector should be zeroed or the
6first sector should contain valid superblock from previous invocation. 10first sector should contain valid superblock from previous invocation.
7 11
8Constructor parameters: 12Constructor parameters:
13
91. type of the cache device - "p" or "s" 141. type of the cache device - "p" or "s"
10 p - persistent memory 15
11 s - SSD 16 - p - persistent memory
17 - s - SSD
122. the underlying device that will be cached 182. the underlying device that will be cached
133. the cache device 193. the cache device
144. block size (4096 is recommended; the maximum block size is the page 204. block size (4096 is recommended; the maximum block size is the page
15 size) 21 size)
165. the number of optional parameters (the parameters with an argument 225. the number of optional parameters (the parameters with an argument
17 count as two) 23 count as two)
24
18 start_sector n (default: 0) 25 start_sector n (default: 0)
19 offset from the start of cache device in 512-byte sectors 26 offset from the start of cache device in 512-byte sectors
20 high_watermark n (default: 50) 27 high_watermark n (default: 50)
@@ -43,6 +50,7 @@ Constructor parameters:
43 applicable only to persistent memory - don't use the FUA 50 applicable only to persistent memory - don't use the FUA
44 flag when writing back data and send the FLUSH request 51 flag when writing back data and send the FLUSH request
45 afterwards 52 afterwards
53
46 - some underlying devices perform better with fua, some 54 - some underlying devices perform better with fua, some
47 with nofua. The user should test it 55 with nofua. The user should test it
48 56
@@ -60,6 +68,7 @@ Messages:
60 flush the cache device on next suspend. Use this message 68 flush the cache device on next suspend. Use this message
61 when you are going to remove the cache device. The proper 69 when you are going to remove the cache device. The proper
62 sequence for removing the cache device is: 70 sequence for removing the cache device is:
71
63 1. send the "flush_on_suspend" message 72 1. send the "flush_on_suspend" message
64 2. load an inactive table with a linear target that maps 73 2. load an inactive table with a linear target that maps
65 to the underlying device 74 to the underlying device
diff --git a/Documentation/device-mapper/zero.txt b/Documentation/device-mapper/zero.rst
index 20fb38e7fa7e..11fb5cf4597c 100644
--- a/Documentation/device-mapper/zero.txt
+++ b/Documentation/device-mapper/zero.rst
@@ -1,3 +1,4 @@
1=======
1dm-zero 2dm-zero
2======= 3=======
3 4
@@ -18,20 +19,19 @@ filesystem limitations.
18 19
19To create a sparse device, start by creating a dm-zero device that's the 20To create a sparse device, start by creating a dm-zero device that's the
20desired size of the sparse device. For this example, we'll assume a 10TB 21desired size of the sparse device. For this example, we'll assume a 10TB
21sparse device. 22sparse device::
22 23
23TEN_TERABYTES=`expr 10 \* 1024 \* 1024 \* 1024 \* 2` # 10 TB in sectors 24 TEN_TERABYTES=`expr 10 \* 1024 \* 1024 \* 1024 \* 2` # 10 TB in sectors
24echo "0 $TEN_TERABYTES zero" | dmsetup create zero1 25 echo "0 $TEN_TERABYTES zero" | dmsetup create zero1
25 26
26Then create a snapshot of the zero device, using any available block-device as 27Then create a snapshot of the zero device, using any available block-device as
27the COW device. The size of the COW device will determine the amount of real 28the COW device. The size of the COW device will determine the amount of real
28space available to the sparse device. For this example, we'll assume /dev/sdb1 29space available to the sparse device. For this example, we'll assume /dev/sdb1
29is an available 10GB partition. 30is an available 10GB partition::
30 31
31echo "0 $TEN_TERABYTES snapshot /dev/mapper/zero1 /dev/sdb1 p 128" | \ 32 echo "0 $TEN_TERABYTES snapshot /dev/mapper/zero1 /dev/sdb1 p 128" | \
32 dmsetup create sparse1 33 dmsetup create sparse1
33 34
34This will create a 10TB sparse device called /dev/mapper/sparse1 that has 35This will create a 10TB sparse device called /dev/mapper/sparse1 that has
3510GB of actual storage space available. If more than 10GB of data is written 3610GB of actual storage space available. If more than 10GB of data is written
36to this device, it will start returning I/O errors. 37to this device, it will start returning I/O errors.
37
diff --git a/Documentation/devicetree/bindings/net/fsl-enetc.txt b/Documentation/devicetree/bindings/net/fsl-enetc.txt
index c812e25ae90f..25fc687419db 100644
--- a/Documentation/devicetree/bindings/net/fsl-enetc.txt
+++ b/Documentation/devicetree/bindings/net/fsl-enetc.txt
@@ -16,8 +16,8 @@ Required properties:
16In this case, the ENETC node should include a "mdio" sub-node 16In this case, the ENETC node should include a "mdio" sub-node
17that in turn should contain the "ethernet-phy" node describing the 17that in turn should contain the "ethernet-phy" node describing the
18external phy. Below properties are required, their bindings 18external phy. Below properties are required, their bindings
19already defined in ethernet.txt or phy.txt, under 19already defined in Documentation/devicetree/bindings/net/ethernet.txt or
20Documentation/devicetree/bindings/net/*. 20Documentation/devicetree/bindings/net/phy.txt.
21 21
22Required: 22Required:
23 23
@@ -51,8 +51,7 @@ Example:
51connection: 51connection:
52 52
53In this case, the ENETC port node defines a fixed link connection, 53In this case, the ENETC port node defines a fixed link connection,
54as specified by "fixed-link.txt", under 54as specified by Documentation/devicetree/bindings/net/fixed-link.txt.
55Documentation/devicetree/bindings/net/*.
56 55
57Required: 56Required:
58 57
diff --git a/Documentation/devicetree/bindings/pci/amlogic,meson-pcie.txt b/Documentation/devicetree/bindings/pci/amlogic,meson-pcie.txt
index 12b18f82d441..efa2c8b9b85a 100644
--- a/Documentation/devicetree/bindings/pci/amlogic,meson-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/amlogic,meson-pcie.txt
@@ -3,7 +3,7 @@ Amlogic Meson AXG DWC PCIE SoC controller
3Amlogic Meson PCIe host controller is based on the Synopsys DesignWare PCI core. 3Amlogic Meson PCIe host controller is based on the Synopsys DesignWare PCI core.
4It shares common functions with the PCIe DesignWare core driver and 4It shares common functions with the PCIe DesignWare core driver and
5inherits common properties defined in 5inherits common properties defined in
6Documentation/devicetree/bindings/pci/designware-pci.txt. 6Documentation/devicetree/bindings/pci/designware-pcie.txt.
7 7
8Additional properties are described here: 8Additional properties are described here:
9 9
diff --git a/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt b/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt
index 7ef2dbe48e8a..14d2eee96b3d 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.txt
@@ -97,7 +97,7 @@ Second Level Nodes - Regulators
97 sent for this regulator including those which are for a 97 sent for this regulator including those which are for a
98 strictly lower power state. 98 strictly lower power state.
99 99
100Other properties defined in Documentation/devicetree/bindings/regulator.txt 100Other properties defined in Documentation/devicetree/bindings/regulator/regulator.txt
101may also be used. regulator-initial-mode and regulator-allowed-modes may be 101may also be used. regulator-initial-mode and regulator-allowed-modes may be
102specified for VRM regulators using mode values from 102specified for VRM regulators using mode values from
103include/dt-bindings/regulator/qcom,rpmh-regulator.h. regulator-allow-bypass 103include/dt-bindings/regulator/qcom,rpmh-regulator.h. regulator-allow-bypass
diff --git a/Documentation/devicetree/booting-without-of.txt b/Documentation/devicetree/booting-without-of.txt
index e86bd2f64117..60f8640f2b2f 100644
--- a/Documentation/devicetree/booting-without-of.txt
+++ b/Documentation/devicetree/booting-without-of.txt
@@ -277,7 +277,7 @@ it with special cases.
277 the decompressor (the real mode entry point goes to the same 32bit 277 the decompressor (the real mode entry point goes to the same 32bit
278 entry point once it switched into protected mode). That entry point 278 entry point once it switched into protected mode). That entry point
279 supports one calling convention which is documented in 279 supports one calling convention which is documented in
280 Documentation/x86/boot.txt 280 Documentation/x86/boot.rst
281 The physical pointer to the device-tree block (defined in chapter II) 281 The physical pointer to the device-tree block (defined in chapter II)
282 is passed via setup_data which requires at least boot protocol 2.09. 282 is passed via setup_data which requires at least boot protocol 2.09.
283 The type filed is defined as 283 The type filed is defined as
diff --git a/Documentation/doc-guide/kernel-doc.rst b/Documentation/doc-guide/kernel-doc.rst
index f96059767c8c..192c36af39e2 100644
--- a/Documentation/doc-guide/kernel-doc.rst
+++ b/Documentation/doc-guide/kernel-doc.rst
@@ -359,7 +359,7 @@ Domain`_ references.
359 ``monospaced font``. 359 ``monospaced font``.
360 360
361 Useful if you need to use special characters that would otherwise have some 361 Useful if you need to use special characters that would otherwise have some
362 meaning either by kernel-doc script of by reStructuredText. 362 meaning either by kernel-doc script or by reStructuredText.
363 363
364 This is particularly useful if you need to use things like ``%ph`` inside 364 This is particularly useful if you need to use things like ``%ph`` inside
365 a function description. 365 a function description.
diff --git a/Documentation/doc-guide/sphinx.rst b/Documentation/doc-guide/sphinx.rst
index c039224b404e..f71ddd592aaa 100644
--- a/Documentation/doc-guide/sphinx.rst
+++ b/Documentation/doc-guide/sphinx.rst
@@ -27,8 +27,7 @@ Sphinx Install
27============== 27==============
28 28
29The ReST markups currently used by the Documentation/ files are meant to be 29The ReST markups currently used by the Documentation/ files are meant to be
30built with ``Sphinx`` version 1.3 or higher. If you desire to build 30built with ``Sphinx`` version 1.3 or higher.
31PDF output, it is recommended to use version 1.4.6 or higher.
32 31
33There's a script that checks for the Sphinx requirements. Please see 32There's a script that checks for the Sphinx requirements. Please see
34:ref:`sphinx-pre-install` for further details. 33:ref:`sphinx-pre-install` for further details.
@@ -56,13 +55,13 @@ or ``virtualenv``, depending on how your distribution packaged Python 3.
56 those expressions are written using LaTeX notation. It needs texlive 55 those expressions are written using LaTeX notation. It needs texlive
57 installed with amdfonts and amsmath in order to evaluate them. 56 installed with amdfonts and amsmath in order to evaluate them.
58 57
59In summary, if you want to install Sphinx version 1.4.9, you should do:: 58In summary, if you want to install Sphinx version 1.7.9, you should do::
60 59
61 $ virtualenv sphinx_1.4 60 $ virtualenv sphinx_1.7.9
62 $ . sphinx_1.4/bin/activate 61 $ . sphinx_1.7.9/bin/activate
63 (sphinx_1.4) $ pip install -r Documentation/sphinx/requirements.txt 62 (sphinx_1.7.9) $ pip install -r Documentation/sphinx/requirements.txt
64 63
65After running ``. sphinx_1.4/bin/activate``, the prompt will change, 64After running ``. sphinx_1.7.9/bin/activate``, the prompt will change,
66in order to indicate that you're using the new environment. If you 65in order to indicate that you're using the new environment. If you
67open a new shell, you need to rerun this command to enter again at 66open a new shell, you need to rerun this command to enter again at
68the virtual environment before building the documentation. 67the virtual environment before building the documentation.
@@ -105,8 +104,8 @@ command line options for your distro::
105 You should run: 104 You should run:
106 105
107 sudo dnf install -y texlive-luatex85 106 sudo dnf install -y texlive-luatex85
108 /usr/bin/virtualenv sphinx_1.4 107 /usr/bin/virtualenv sphinx_1.7.9
109 . sphinx_1.4/bin/activate 108 . sphinx_1.7.9/bin/activate
110 pip install -r Documentation/sphinx/requirements.txt 109 pip install -r Documentation/sphinx/requirements.txt
111 110
112 Can't build as 1 mandatory dependency is missing at ./scripts/sphinx-pre-install line 468. 111 Can't build as 1 mandatory dependency is missing at ./scripts/sphinx-pre-install line 468.
@@ -218,7 +217,7 @@ Here are some specific guidelines for the kernel documentation:
218 examples, etc.), use ``::`` for anything that doesn't really benefit 217 examples, etc.), use ``::`` for anything that doesn't really benefit
219 from syntax highlighting, especially short snippets. Use 218 from syntax highlighting, especially short snippets. Use
220 ``.. code-block:: <language>`` for longer code blocks that benefit 219 ``.. code-block:: <language>`` for longer code blocks that benefit
221 from highlighting. 220 from highlighting. For a short snippet of code embedded in the text, use \`\`.
222 221
223 222
224the C domain 223the C domain
@@ -242,11 +241,14 @@ The C domain of the kernel-doc has some additional features. E.g. you can
242 241
243The func-name (e.g. ioctl) remains in the output but the ref-name changed from 242The func-name (e.g. ioctl) remains in the output but the ref-name changed from
244``ioctl`` to ``VIDIOC_LOG_STATUS``. The index entry for this function is also 243``ioctl`` to ``VIDIOC_LOG_STATUS``. The index entry for this function is also
245changed to ``VIDIOC_LOG_STATUS`` and the function can now referenced by: 244changed to ``VIDIOC_LOG_STATUS``.
246 245
247.. code-block:: rst 246Please note that there is no need to use ``c:func:`` to generate cross
248 247references to function documentation. Due to some Sphinx extension magic,
249 :c:func:`VIDIOC_LOG_STATUS` 248the documentation build system will automatically turn a reference to
249``function()`` into a cross reference if an index entry for the given
250function name exists. If you see ``c:func:`` use in a kernel document,
251please feel free to remove it.
250 252
251 253
252list tables 254list tables
diff --git a/Documentation/docutils.conf b/Documentation/docutils.conf
index 2830772264c8..f1a180b97dec 100644
--- a/Documentation/docutils.conf
+++ b/Documentation/docutils.conf
@@ -4,4 +4,4 @@
4# http://docutils.sourceforge.net/docs/user/config.html 4# http://docutils.sourceforge.net/docs/user/config.html
5 5
6[general] 6[general]
7halt_level: severe \ No newline at end of file 7halt_level: severe
diff --git a/Documentation/driver-api/basics.rst b/Documentation/driver-api/basics.rst
index e970fadf4d1a..1ba88c7b3984 100644
--- a/Documentation/driver-api/basics.rst
+++ b/Documentation/driver-api/basics.rst
@@ -115,9 +115,6 @@ Kernel utility functions
115.. kernel-doc:: kernel/rcu/tree.c 115.. kernel-doc:: kernel/rcu/tree.c
116 :export: 116 :export:
117 117
118.. kernel-doc:: kernel/rcu/tree_plugin.h
119 :export:
120
121.. kernel-doc:: kernel/rcu/update.c 118.. kernel-doc:: kernel/rcu/update.c
122 :export: 119 :export:
123 120
diff --git a/Documentation/driver-api/clk.rst b/Documentation/driver-api/clk.rst
index 593cca5058b1..3cad45d14187 100644
--- a/Documentation/driver-api/clk.rst
+++ b/Documentation/driver-api/clk.rst
@@ -175,9 +175,9 @@ the following::
175To take advantage of your data you'll need to support valid operations 175To take advantage of your data you'll need to support valid operations
176for your clk:: 176for your clk::
177 177
178 struct clk_ops clk_foo_ops { 178 struct clk_ops clk_foo_ops = {
179 .enable = &clk_foo_enable; 179 .enable = &clk_foo_enable,
180 .disable = &clk_foo_disable; 180 .disable = &clk_foo_disable,
181 }; 181 };
182 182
183Implement the above functions using container_of:: 183Implement the above functions using container_of::
diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Documentation/driver-api/firmware/other_interfaces.rst
index a4ac54b5fd79..b81794e0cfbb 100644
--- a/Documentation/driver-api/firmware/other_interfaces.rst
+++ b/Documentation/driver-api/firmware/other_interfaces.rst
@@ -33,7 +33,7 @@ of the requests on to a secure monitor (EL3).
33 :functions: stratix10_svc_client_msg 33 :functions: stratix10_svc_client_msg
34 34
35.. kernel-doc:: include/linux/firmware/intel/stratix10-svc-client.h 35.. kernel-doc:: include/linux/firmware/intel/stratix10-svc-client.h
36 :functions: stratix10_svc_command_reconfig_payload 36 :functions: stratix10_svc_command_config_type
37 37
38.. kernel-doc:: include/linux/firmware/intel/stratix10-svc-client.h 38.. kernel-doc:: include/linux/firmware/intel/stratix10-svc-client.h
39 :functions: stratix10_svc_cb_data 39 :functions: stratix10_svc_cb_data
diff --git a/Documentation/driver-api/gpio/board.rst b/Documentation/driver-api/gpio/board.rst
index b37f3f7b8926..ce91518bf9f4 100644
--- a/Documentation/driver-api/gpio/board.rst
+++ b/Documentation/driver-api/gpio/board.rst
@@ -101,7 +101,7 @@ with the help of _DSD (Device Specific Data), introduced in ACPI 5.1::
101 } 101 }
102 102
103For more information about the ACPI GPIO bindings see 103For more information about the ACPI GPIO bindings see
104Documentation/acpi/gpio-properties.txt. 104Documentation/firmware-guide/acpi/gpio-properties.rst.
105 105
106Platform Data 106Platform Data
107------------- 107-------------
diff --git a/Documentation/driver-api/gpio/consumer.rst b/Documentation/driver-api/gpio/consumer.rst
index 9559aa3cbcef..423492d125b9 100644
--- a/Documentation/driver-api/gpio/consumer.rst
+++ b/Documentation/driver-api/gpio/consumer.rst
@@ -435,7 +435,7 @@ case, it will be handled by the GPIO subsystem automatically. However, if the
435_DSD is not present, the mappings between GpioIo()/GpioInt() resources and GPIO 435_DSD is not present, the mappings between GpioIo()/GpioInt() resources and GPIO
436connection IDs need to be provided by device drivers. 436connection IDs need to be provided by device drivers.
437 437
438For details refer to Documentation/acpi/gpio-properties.txt 438For details refer to Documentation/firmware-guide/acpi/gpio-properties.rst
439 439
440 440
441Interacting With the Legacy GPIO Subsystem 441Interacting With the Legacy GPIO Subsystem
diff --git a/Documentation/driver-api/iio/hw-consumer.rst b/Documentation/driver-api/iio/hw-consumer.rst
index e0fe0b98230e..819fb9edc005 100644
--- a/Documentation/driver-api/iio/hw-consumer.rst
+++ b/Documentation/driver-api/iio/hw-consumer.rst
@@ -45,7 +45,6 @@ A typical IIO HW consumer setup looks like this::
45 45
46More details 46More details
47============ 47============
48.. kernel-doc:: include/linux/iio/hw-consumer.h
49.. kernel-doc:: drivers/iio/buffer/industrialio-hw-consumer.c 48.. kernel-doc:: drivers/iio/buffer/industrialio-hw-consumer.c
50 :export: 49 :export:
51 50
diff --git a/Documentation/pps/pps.txt b/Documentation/driver-api/pps.rst
index 99f5d8c4c652..1456d2c32ebd 100644
--- a/Documentation/pps/pps.txt
+++ b/Documentation/driver-api/pps.rst
@@ -1,8 +1,10 @@
1:orphan:
1 2
2 PPS - Pulse Per Second 3======================
3 ---------------------- 4PPS - Pulse Per Second
5======================
4 6
5(C) Copyright 2007 Rodolfo Giometti <giometti@enneenne.com> 7Copyright (C) 2007 Rodolfo Giometti <giometti@enneenne.com>
6 8
7This program is free software; you can redistribute it and/or modify 9This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by 10it under the terms of the GNU General Public License as published by
@@ -88,7 +90,7 @@ Coding example
88-------------- 90--------------
89 91
90To register a PPS source into the kernel you should define a struct 92To register a PPS source into the kernel you should define a struct
91pps_source_info as follows: 93pps_source_info as follows::
92 94
93 static struct pps_source_info pps_ktimer_info = { 95 static struct pps_source_info pps_ktimer_info = {
94 .name = "ktimer", 96 .name = "ktimer",
@@ -101,12 +103,12 @@ pps_source_info as follows:
101 }; 103 };
102 104
103and then calling the function pps_register_source() in your 105and then calling the function pps_register_source() in your
104initialization routine as follows: 106initialization routine as follows::
105 107
106 source = pps_register_source(&pps_ktimer_info, 108 source = pps_register_source(&pps_ktimer_info,
107 PPS_CAPTUREASSERT | PPS_OFFSETASSERT); 109 PPS_CAPTUREASSERT | PPS_OFFSETASSERT);
108 110
109The pps_register_source() prototype is: 111The pps_register_source() prototype is::
110 112
111 int pps_register_source(struct pps_source_info *info, int default_params) 113 int pps_register_source(struct pps_source_info *info, int default_params)
112 114
@@ -118,7 +120,7 @@ pps_source_info which describe the capabilities of the driver).
118 120
119Once you have registered a new PPS source into the system you can 121Once you have registered a new PPS source into the system you can
120signal an assert event (for example in the interrupt handler routine) 122signal an assert event (for example in the interrupt handler routine)
121just using: 123just using::
122 124
123 pps_event(source, &ts, PPS_CAPTUREASSERT, ptr) 125 pps_event(source, &ts, PPS_CAPTUREASSERT, ptr)
124 126
@@ -134,13 +136,13 @@ Please see the file drivers/pps/clients/pps-ktimer.c for example code.
134SYSFS support 136SYSFS support
135------------- 137-------------
136 138
137If the SYSFS filesystem is enabled in the kernel it provides a new class: 139If the SYSFS filesystem is enabled in the kernel it provides a new class::
138 140
139 $ ls /sys/class/pps/ 141 $ ls /sys/class/pps/
140 pps0/ pps1/ pps2/ 142 pps0/ pps1/ pps2/
141 143
142Every directory is the ID of a PPS sources defined in the system and 144Every directory is the ID of a PPS sources defined in the system and
143inside you find several files: 145inside you find several files::
144 146
145 $ ls -F /sys/class/pps/pps0/ 147 $ ls -F /sys/class/pps/pps0/
146 assert dev mode path subsystem@ 148 assert dev mode path subsystem@
@@ -148,7 +150,7 @@ inside you find several files:
148 150
149 151
150Inside each "assert" and "clear" file you can find the timestamp and a 152Inside each "assert" and "clear" file you can find the timestamp and a
151sequence number: 153sequence number::
152 154
153 $ cat /sys/class/pps/pps0/assert 155 $ cat /sys/class/pps/pps0/assert
154 1170026870.983207967#8 156 1170026870.983207967#8
@@ -175,11 +177,11 @@ and the userland tools available in your distribution's pps-tools package,
175http://linuxpps.org , or https://github.com/redlab-i/pps-tools. 177http://linuxpps.org , or https://github.com/redlab-i/pps-tools.
176 178
177Once you have enabled the compilation of pps-ktimer just modprobe it (if 179Once you have enabled the compilation of pps-ktimer just modprobe it (if
178not statically compiled): 180not statically compiled)::
179 181
180 # modprobe pps-ktimer 182 # modprobe pps-ktimer
181 183
182and the run ppstest as follow: 184and the run ppstest as follow::
183 185
184 $ ./ppstest /dev/pps1 186 $ ./ppstest /dev/pps1
185 trying PPS source "/dev/pps1" 187 trying PPS source "/dev/pps1"
@@ -204,26 +206,27 @@ nor affordable. The cheap way is to load a PPS generator on one of the
204computers (master) and PPS clients on others (slaves), and use very simple 206computers (master) and PPS clients on others (slaves), and use very simple
205cables to deliver signals using parallel ports, for example. 207cables to deliver signals using parallel ports, for example.
206 208
207Parallel port cable pinout: 209Parallel port cable pinout::
208pin name master slave 210
2091 STROBE *------ * 211 pin name master slave
2102 D0 * | * 212 1 STROBE *------ *
2113 D1 * | * 213 2 D0 * | *
2124 D2 * | * 214 3 D1 * | *
2135 D3 * | * 215 4 D2 * | *
2146 D4 * | * 216 5 D3 * | *
2157 D5 * | * 217 6 D4 * | *
2168 D6 * | * 218 7 D5 * | *
2179 D7 * | * 219 8 D6 * | *
21810 ACK * ------* 220 9 D7 * | *
21911 BUSY * * 221 10 ACK * ------*
22012 PE * * 222 11 BUSY * *
22113 SEL * * 223 12 PE * *
22214 AUTOFD * * 224 13 SEL * *
22315 ERROR * * 225 14 AUTOFD * *
22416 INIT * * 226 15 ERROR * *
22517 SELIN * * 227 16 INIT * *
22618-25 GND *-----------* 228 17 SELIN * *
229 18-25 GND *-----------*
227 230
228Please note that parallel port interrupt occurs only on high->low transition, 231Please note that parallel port interrupt occurs only on high->low transition,
229so it is used for PPS assert edge. PPS clear edge can be determined only 232so it is used for PPS assert edge. PPS clear edge can be determined only
diff --git a/Documentation/ptp/ptp.txt b/Documentation/driver-api/ptp.rst
index 11e904ee073f..b6e65d66d37a 100644
--- a/Documentation/ptp/ptp.txt
+++ b/Documentation/driver-api/ptp.rst
@@ -1,5 +1,8 @@
1:orphan:
1 2
2* PTP hardware clock infrastructure for Linux 3===========================================
4PTP hardware clock infrastructure for Linux
5===========================================
3 6
4 This patch set introduces support for IEEE 1588 PTP clocks in 7 This patch set introduces support for IEEE 1588 PTP clocks in
5 Linux. Together with the SO_TIMESTAMPING socket options, this 8 Linux. Together with the SO_TIMESTAMPING socket options, this
@@ -22,7 +25,8 @@
22 - Period output signals configurable from user space 25 - Period output signals configurable from user space
23 - Synchronization of the Linux system time via the PPS subsystem 26 - Synchronization of the Linux system time via the PPS subsystem
24 27
25** PTP hardware clock kernel API 28PTP hardware clock kernel API
29=============================
26 30
27 A PTP clock driver registers itself with the class driver. The 31 A PTP clock driver registers itself with the class driver. The
28 class driver handles all of the dealings with user space. The 32 class driver handles all of the dealings with user space. The
@@ -36,7 +40,8 @@
36 development, it can be useful to have more than one clock in a 40 development, it can be useful to have more than one clock in a
37 single system, in order to allow performance comparisons. 41 single system, in order to allow performance comparisons.
38 42
39** PTP hardware clock user space API 43PTP hardware clock user space API
44=================================
40 45
41 The class driver also creates a character device for each 46 The class driver also creates a character device for each
42 registered clock. User space can use an open file descriptor from 47 registered clock. User space can use an open file descriptor from
@@ -49,7 +54,8 @@
49 ancillary clock features. User space can receive time stamped 54 ancillary clock features. User space can receive time stamped
50 events via blocking read() and poll(). 55 events via blocking read() and poll().
51 56
52** Writing clock drivers 57Writing clock drivers
58=====================
53 59
54 Clock drivers include include/linux/ptp_clock_kernel.h and register 60 Clock drivers include include/linux/ptp_clock_kernel.h and register
55 themselves by presenting a 'struct ptp_clock_info' to the 61 themselves by presenting a 'struct ptp_clock_info' to the
@@ -66,14 +72,17 @@
66 class driver, since the lock may also be needed by the clock 72 class driver, since the lock may also be needed by the clock
67 driver's interrupt service routine. 73 driver's interrupt service routine.
68 74
69** Supported hardware 75Supported hardware
76==================
77
78 * Freescale eTSEC gianfar
70 79
71 + Freescale eTSEC gianfar
72 - 2 Time stamp external triggers, programmable polarity (opt. interrupt) 80 - 2 Time stamp external triggers, programmable polarity (opt. interrupt)
73 - 2 Alarm registers (optional interrupt) 81 - 2 Alarm registers (optional interrupt)
74 - 3 Periodic signals (optional interrupt) 82 - 3 Periodic signals (optional interrupt)
75 83
76 + National DP83640 84 * National DP83640
85
77 - 6 GPIOs programmable as inputs or outputs 86 - 6 GPIOs programmable as inputs or outputs
78 - 6 GPIOs with dedicated functions (LED/JTAG/clock) can also be 87 - 6 GPIOs with dedicated functions (LED/JTAG/clock) can also be
79 used as general inputs or outputs 88 used as general inputs or outputs
@@ -81,6 +90,7 @@
81 - GPIO outputs can produce periodic signals 90 - GPIO outputs can produce periodic signals
82 - 1 interrupt pin 91 - 1 interrupt pin
83 92
84 + Intel IXP465 93 * Intel IXP465
94
85 - Auxiliary Slave/Master Mode Snapshot (optional interrupt) 95 - Auxiliary Slave/Master Mode Snapshot (optional interrupt)
86 - Target Time (optional interrupt) 96 - Target Time (optional interrupt)
diff --git a/Documentation/driver-api/target.rst b/Documentation/driver-api/target.rst
index 4363611dd86d..620ec6173a93 100644
--- a/Documentation/driver-api/target.rst
+++ b/Documentation/driver-api/target.rst
@@ -10,8 +10,8 @@ TBD
10Target core device interfaces 10Target core device interfaces
11============================= 11=============================
12 12
13.. kernel-doc:: drivers/target/target_core_device.c 13This section is blank because no kerneldoc comments have been added to
14 :export: 14drivers/target/target_core_device.c.
15 15
16Target core transport interfaces 16Target core transport interfaces
17================================ 17================================
diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.rst
index a17517a083c3..f51bb21d20e4 100644
--- a/Documentation/fault-injection/fault-injection.txt
+++ b/Documentation/fault-injection/fault-injection.rst
@@ -1,3 +1,4 @@
1===========================================
1Fault injection capabilities infrastructure 2Fault injection capabilities infrastructure
2=========================================== 3===========================================
3 4
@@ -7,36 +8,36 @@ See also drivers/md/md-faulty.c and "every_nth" module option for scsi_debug.
7Available fault injection capabilities 8Available fault injection capabilities
8-------------------------------------- 9--------------------------------------
9 10
10o failslab 11- failslab
11 12
12 injects slab allocation failures. (kmalloc(), kmem_cache_alloc(), ...) 13 injects slab allocation failures. (kmalloc(), kmem_cache_alloc(), ...)
13 14
14o fail_page_alloc 15- fail_page_alloc
15 16
16 injects page allocation failures. (alloc_pages(), get_free_pages(), ...) 17 injects page allocation failures. (alloc_pages(), get_free_pages(), ...)
17 18
18o fail_futex 19- fail_futex
19 20
20 injects futex deadlock and uaddr fault errors. 21 injects futex deadlock and uaddr fault errors.
21 22
22o fail_make_request 23- fail_make_request
23 24
24 injects disk IO errors on devices permitted by setting 25 injects disk IO errors on devices permitted by setting
25 /sys/block/<device>/make-it-fail or 26 /sys/block/<device>/make-it-fail or
26 /sys/block/<device>/<partition>/make-it-fail. (generic_make_request()) 27 /sys/block/<device>/<partition>/make-it-fail. (generic_make_request())
27 28
28o fail_mmc_request 29- fail_mmc_request
29 30
30 injects MMC data errors on devices permitted by setting 31 injects MMC data errors on devices permitted by setting
31 debugfs entries under /sys/kernel/debug/mmc0/fail_mmc_request 32 debugfs entries under /sys/kernel/debug/mmc0/fail_mmc_request
32 33
33o fail_function 34- fail_function
34 35
35 injects error return on specific functions, which are marked by 36 injects error return on specific functions, which are marked by
36 ALLOW_ERROR_INJECTION() macro, by setting debugfs entries 37 ALLOW_ERROR_INJECTION() macro, by setting debugfs entries
37 under /sys/kernel/debug/fail_function. No boot option supported. 38 under /sys/kernel/debug/fail_function. No boot option supported.
38 39
39o NVMe fault injection 40- NVMe fault injection
40 41
41 inject NVMe status code and retry flag on devices permitted by setting 42 inject NVMe status code and retry flag on devices permitted by setting
42 debugfs entries under /sys/kernel/debug/nvme*/fault_inject. The default 43 debugfs entries under /sys/kernel/debug/nvme*/fault_inject. The default
@@ -47,7 +48,8 @@ o NVMe fault injection
47Configure fault-injection capabilities behavior 48Configure fault-injection capabilities behavior
48----------------------------------------------- 49-----------------------------------------------
49 50
50o debugfs entries 51debugfs entries
52^^^^^^^^^^^^^^^
51 53
52fault-inject-debugfs kernel module provides some debugfs entries for runtime 54fault-inject-debugfs kernel module provides some debugfs entries for runtime
53configuration of fault-injection capabilities. 55configuration of fault-injection capabilities.
@@ -55,6 +57,7 @@ configuration of fault-injection capabilities.
55- /sys/kernel/debug/fail*/probability: 57- /sys/kernel/debug/fail*/probability:
56 58
57 likelihood of failure injection, in percent. 59 likelihood of failure injection, in percent.
60
58 Format: <percent> 61 Format: <percent>
59 62
60 Note that one-failure-per-hundred is a very high error rate 63 Note that one-failure-per-hundred is a very high error rate
@@ -83,6 +86,7 @@ configuration of fault-injection capabilities.
83- /sys/kernel/debug/fail*/verbose 86- /sys/kernel/debug/fail*/verbose
84 87
85 Format: { 0 | 1 | 2 } 88 Format: { 0 | 1 | 2 }
89
86 specifies the verbosity of the messages when failure is 90 specifies the verbosity of the messages when failure is
87 injected. '0' means no messages; '1' will print only a single 91 injected. '0' means no messages; '1' will print only a single
88 log line per failure; '2' will print a call trace too -- useful 92 log line per failure; '2' will print a call trace too -- useful
@@ -91,14 +95,15 @@ configuration of fault-injection capabilities.
91- /sys/kernel/debug/fail*/task-filter: 95- /sys/kernel/debug/fail*/task-filter:
92 96
93 Format: { 'Y' | 'N' } 97 Format: { 'Y' | 'N' }
98
94 A value of 'N' disables filtering by process (default). 99 A value of 'N' disables filtering by process (default).
95 Any positive value limits failures to only processes indicated by 100 Any positive value limits failures to only processes indicated by
96 /proc/<pid>/make-it-fail==1. 101 /proc/<pid>/make-it-fail==1.
97 102
98- /sys/kernel/debug/fail*/require-start: 103- /sys/kernel/debug/fail*/require-start,
99- /sys/kernel/debug/fail*/require-end: 104 /sys/kernel/debug/fail*/require-end,
100- /sys/kernel/debug/fail*/reject-start: 105 /sys/kernel/debug/fail*/reject-start,
101- /sys/kernel/debug/fail*/reject-end: 106 /sys/kernel/debug/fail*/reject-end:
102 107
103 specifies the range of virtual addresses tested during 108 specifies the range of virtual addresses tested during
104 stacktrace walking. Failure is injected only if some caller 109 stacktrace walking. Failure is injected only if some caller
@@ -116,6 +121,7 @@ configuration of fault-injection capabilities.
116- /sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem: 121- /sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem:
117 122
118 Format: { 'Y' | 'N' } 123 Format: { 'Y' | 'N' }
124
119 default is 'N', setting it to 'Y' won't inject failures into 125 default is 'N', setting it to 'Y' won't inject failures into
120 highmem/user allocations. 126 highmem/user allocations.
121 127
@@ -123,6 +129,7 @@ configuration of fault-injection capabilities.
123- /sys/kernel/debug/fail_page_alloc/ignore-gfp-wait: 129- /sys/kernel/debug/fail_page_alloc/ignore-gfp-wait:
124 130
125 Format: { 'Y' | 'N' } 131 Format: { 'Y' | 'N' }
132
126 default is 'N', setting it to 'Y' will inject failures 133 default is 'N', setting it to 'Y' will inject failures
127 only into non-sleep allocations (GFP_ATOMIC allocations). 134 only into non-sleep allocations (GFP_ATOMIC allocations).
128 135
@@ -134,12 +141,14 @@ configuration of fault-injection capabilities.
134- /sys/kernel/debug/fail_futex/ignore-private: 141- /sys/kernel/debug/fail_futex/ignore-private:
135 142
136 Format: { 'Y' | 'N' } 143 Format: { 'Y' | 'N' }
144
137 default is 'N', setting it to 'Y' will disable failure injections 145 default is 'N', setting it to 'Y' will disable failure injections
138 when dealing with private (address space) futexes. 146 when dealing with private (address space) futexes.
139 147
140- /sys/kernel/debug/fail_function/inject: 148- /sys/kernel/debug/fail_function/inject:
141 149
142 Format: { 'function-name' | '!function-name' | '' } 150 Format: { 'function-name' | '!function-name' | '' }
151
143 specifies the target function of error injection by name. 152 specifies the target function of error injection by name.
144 If the function name leads '!' prefix, given function is 153 If the function name leads '!' prefix, given function is
145 removed from injection list. If nothing specified ('') 154 removed from injection list. If nothing specified ('')
@@ -160,10 +169,11 @@ configuration of fault-injection capabilities.
160 function for given function. This will be created when 169 function for given function. This will be created when
161 user specifies new injection entry. 170 user specifies new injection entry.
162 171
163o Boot option 172Boot option
173^^^^^^^^^^^
164 174
165In order to inject faults while debugfs is not available (early boot time), 175In order to inject faults while debugfs is not available (early boot time),
166use the boot option: 176use the boot option::
167 177
168 failslab= 178 failslab=
169 fail_page_alloc= 179 fail_page_alloc=
@@ -171,10 +181,11 @@ use the boot option:
171 fail_futex= 181 fail_futex=
172 mmc_core.fail_request=<interval>,<probability>,<space>,<times> 182 mmc_core.fail_request=<interval>,<probability>,<space>,<times>
173 183
174o proc entries 184proc entries
185^^^^^^^^^^^^
175 186
176- /proc/<pid>/fail-nth: 187- /proc/<pid>/fail-nth,
177- /proc/self/task/<tid>/fail-nth: 188 /proc/self/task/<tid>/fail-nth:
178 189
179 Write to this file of integer N makes N-th call in the task fail. 190 Write to this file of integer N makes N-th call in the task fail.
180 Read from this file returns a integer value. A value of '0' indicates 191 Read from this file returns a integer value. A value of '0' indicates
@@ -191,16 +202,16 @@ o proc entries
191How to add new fault injection capability 202How to add new fault injection capability
192----------------------------------------- 203-----------------------------------------
193 204
194o #include <linux/fault-inject.h> 205- #include <linux/fault-inject.h>
195 206
196o define the fault attributes 207- define the fault attributes
197 208
198 DECLARE_FAULT_ATTR(name); 209 DECLARE_FAULT_ATTR(name);
199 210
200 Please see the definition of struct fault_attr in fault-inject.h 211 Please see the definition of struct fault_attr in fault-inject.h
201 for details. 212 for details.
202 213
203o provide a way to configure fault attributes 214- provide a way to configure fault attributes
204 215
205- boot option 216- boot option
206 217
@@ -222,126 +233,126 @@ o provide a way to configure fault attributes
222 single kernel module, it is better to provide module parameters to 233 single kernel module, it is better to provide module parameters to
223 configure the fault attributes. 234 configure the fault attributes.
224 235
225o add a hook to insert failures 236- add a hook to insert failures
226 237
227 Upon should_fail() returning true, client code should inject a failure. 238 Upon should_fail() returning true, client code should inject a failure:
228 239
229 should_fail(attr, size); 240 should_fail(attr, size);
230 241
231Application Examples 242Application Examples
232-------------------- 243--------------------
233 244
234o Inject slab allocation failures into module init/exit code 245- Inject slab allocation failures into module init/exit code::
235 246
236#!/bin/bash 247 #!/bin/bash
237 248
238FAILTYPE=failslab 249 FAILTYPE=failslab
239echo Y > /sys/kernel/debug/$FAILTYPE/task-filter 250 echo Y > /sys/kernel/debug/$FAILTYPE/task-filter
240echo 10 > /sys/kernel/debug/$FAILTYPE/probability 251 echo 10 > /sys/kernel/debug/$FAILTYPE/probability
241echo 100 > /sys/kernel/debug/$FAILTYPE/interval 252 echo 100 > /sys/kernel/debug/$FAILTYPE/interval
242echo -1 > /sys/kernel/debug/$FAILTYPE/times 253 echo -1 > /sys/kernel/debug/$FAILTYPE/times
243echo 0 > /sys/kernel/debug/$FAILTYPE/space 254 echo 0 > /sys/kernel/debug/$FAILTYPE/space
244echo 2 > /sys/kernel/debug/$FAILTYPE/verbose 255 echo 2 > /sys/kernel/debug/$FAILTYPE/verbose
245echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait 256 echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait
246 257
247faulty_system() 258 faulty_system()
248{ 259 {
249 bash -c "echo 1 > /proc/self/make-it-fail && exec $*" 260 bash -c "echo 1 > /proc/self/make-it-fail && exec $*"
250} 261 }
251 262
252if [ $# -eq 0 ] 263 if [ $# -eq 0 ]
253then 264 then
254 echo "Usage: $0 modulename [ modulename ... ]" 265 echo "Usage: $0 modulename [ modulename ... ]"
255 exit 1 266 exit 1
256fi 267 fi
257 268
258for m in $* 269 for m in $*
259do 270 do
260 echo inserting $m... 271 echo inserting $m...
261 faulty_system modprobe $m 272 faulty_system modprobe $m
262 273
263 echo removing $m... 274 echo removing $m...
264 faulty_system modprobe -r $m 275 faulty_system modprobe -r $m
265done 276 done
266 277
267------------------------------------------------------------------------------ 278------------------------------------------------------------------------------
268 279
269o Inject page allocation failures only for a specific module 280- Inject page allocation failures only for a specific module::
270 281
271#!/bin/bash 282 #!/bin/bash
272 283
273FAILTYPE=fail_page_alloc 284 FAILTYPE=fail_page_alloc
274module=$1 285 module=$1
275 286
276if [ -z $module ] 287 if [ -z $module ]
277then 288 then
278 echo "Usage: $0 <modulename>" 289 echo "Usage: $0 <modulename>"
279 exit 1 290 exit 1
280fi 291 fi
281 292
282modprobe $module 293 modprobe $module
283 294
284if [ ! -d /sys/module/$module/sections ] 295 if [ ! -d /sys/module/$module/sections ]
285then 296 then
286 echo Module $module is not loaded 297 echo Module $module is not loaded
287 exit 1 298 exit 1
288fi 299 fi
289 300
290cat /sys/module/$module/sections/.text > /sys/kernel/debug/$FAILTYPE/require-start 301 cat /sys/module/$module/sections/.text > /sys/kernel/debug/$FAILTYPE/require-start
291cat /sys/module/$module/sections/.data > /sys/kernel/debug/$FAILTYPE/require-end 302 cat /sys/module/$module/sections/.data > /sys/kernel/debug/$FAILTYPE/require-end
292 303
293echo N > /sys/kernel/debug/$FAILTYPE/task-filter 304 echo N > /sys/kernel/debug/$FAILTYPE/task-filter
294echo 10 > /sys/kernel/debug/$FAILTYPE/probability 305 echo 10 > /sys/kernel/debug/$FAILTYPE/probability
295echo 100 > /sys/kernel/debug/$FAILTYPE/interval 306 echo 100 > /sys/kernel/debug/$FAILTYPE/interval
296echo -1 > /sys/kernel/debug/$FAILTYPE/times 307 echo -1 > /sys/kernel/debug/$FAILTYPE/times
297echo 0 > /sys/kernel/debug/$FAILTYPE/space 308 echo 0 > /sys/kernel/debug/$FAILTYPE/space
298echo 2 > /sys/kernel/debug/$FAILTYPE/verbose 309 echo 2 > /sys/kernel/debug/$FAILTYPE/verbose
299echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait 310 echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait
300echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-highmem 311 echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-highmem
301echo 10 > /sys/kernel/debug/$FAILTYPE/stacktrace-depth 312 echo 10 > /sys/kernel/debug/$FAILTYPE/stacktrace-depth
302 313
303trap "echo 0 > /sys/kernel/debug/$FAILTYPE/probability" SIGINT SIGTERM EXIT 314 trap "echo 0 > /sys/kernel/debug/$FAILTYPE/probability" SIGINT SIGTERM EXIT
304 315
305echo "Injecting errors into the module $module... (interrupt to stop)" 316 echo "Injecting errors into the module $module... (interrupt to stop)"
306sleep 1000000 317 sleep 1000000
307 318
308------------------------------------------------------------------------------ 319------------------------------------------------------------------------------
309 320
310o Inject open_ctree error while btrfs mount 321- Inject open_ctree error while btrfs mount::
311 322
312#!/bin/bash 323 #!/bin/bash
313 324
314rm -f testfile.img 325 rm -f testfile.img
315dd if=/dev/zero of=testfile.img bs=1M seek=1000 count=1 326 dd if=/dev/zero of=testfile.img bs=1M seek=1000 count=1
316DEVICE=$(losetup --show -f testfile.img) 327 DEVICE=$(losetup --show -f testfile.img)
317mkfs.btrfs -f $DEVICE 328 mkfs.btrfs -f $DEVICE
318mkdir -p tmpmnt 329 mkdir -p tmpmnt
319 330
320FAILTYPE=fail_function 331 FAILTYPE=fail_function
321FAILFUNC=open_ctree 332 FAILFUNC=open_ctree
322echo $FAILFUNC > /sys/kernel/debug/$FAILTYPE/inject 333 echo $FAILFUNC > /sys/kernel/debug/$FAILTYPE/inject
323echo -12 > /sys/kernel/debug/$FAILTYPE/$FAILFUNC/retval 334 echo -12 > /sys/kernel/debug/$FAILTYPE/$FAILFUNC/retval
324echo N > /sys/kernel/debug/$FAILTYPE/task-filter 335 echo N > /sys/kernel/debug/$FAILTYPE/task-filter
325echo 100 > /sys/kernel/debug/$FAILTYPE/probability 336 echo 100 > /sys/kernel/debug/$FAILTYPE/probability
326echo 0 > /sys/kernel/debug/$FAILTYPE/interval 337 echo 0 > /sys/kernel/debug/$FAILTYPE/interval
327echo -1 > /sys/kernel/debug/$FAILTYPE/times 338 echo -1 > /sys/kernel/debug/$FAILTYPE/times
328echo 0 > /sys/kernel/debug/$FAILTYPE/space 339 echo 0 > /sys/kernel/debug/$FAILTYPE/space
329echo 1 > /sys/kernel/debug/$FAILTYPE/verbose 340 echo 1 > /sys/kernel/debug/$FAILTYPE/verbose
330 341
331mount -t btrfs $DEVICE tmpmnt 342 mount -t btrfs $DEVICE tmpmnt
332if [ $? -ne 0 ] 343 if [ $? -ne 0 ]
333then 344 then
334 echo "SUCCESS!" 345 echo "SUCCESS!"
335else 346 else
336 echo "FAILED!" 347 echo "FAILED!"
337 umount tmpmnt 348 umount tmpmnt
338fi 349 fi
339 350
340echo > /sys/kernel/debug/$FAILTYPE/inject 351 echo > /sys/kernel/debug/$FAILTYPE/inject
341 352
342rmdir tmpmnt 353 rmdir tmpmnt
343losetup -d $DEVICE 354 losetup -d $DEVICE
344rm testfile.img 355 rm testfile.img
345 356
346 357
347Tool to run command with failslab or fail_page_alloc 358Tool to run command with failslab or fail_page_alloc
@@ -354,43 +365,43 @@ see the following examples.
354Examples: 365Examples:
355 366
356Run a command "make -C tools/testing/selftests/ run_tests" with injecting slab 367Run a command "make -C tools/testing/selftests/ run_tests" with injecting slab
357allocation failure. 368allocation failure::
358 369
359 # ./tools/testing/fault-injection/failcmd.sh \ 370 # ./tools/testing/fault-injection/failcmd.sh \
360 -- make -C tools/testing/selftests/ run_tests 371 -- make -C tools/testing/selftests/ run_tests
361 372
362Same as above except to specify 100 times failures at most instead of one time 373Same as above except to specify 100 times failures at most instead of one time
363at most by default. 374at most by default::
364 375
365 # ./tools/testing/fault-injection/failcmd.sh --times=100 \ 376 # ./tools/testing/fault-injection/failcmd.sh --times=100 \
366 -- make -C tools/testing/selftests/ run_tests 377 -- make -C tools/testing/selftests/ run_tests
367 378
368Same as above except to inject page allocation failure instead of slab 379Same as above except to inject page allocation failure instead of slab
369allocation failure. 380allocation failure::
370 381
371 # env FAILCMD_TYPE=fail_page_alloc \ 382 # env FAILCMD_TYPE=fail_page_alloc \
372 ./tools/testing/fault-injection/failcmd.sh --times=100 \ 383 ./tools/testing/fault-injection/failcmd.sh --times=100 \
373 -- make -C tools/testing/selftests/ run_tests 384 -- make -C tools/testing/selftests/ run_tests
374 385
375Systematic faults using fail-nth 386Systematic faults using fail-nth
376--------------------------------- 387---------------------------------
377 388
378The following code systematically faults 0-th, 1-st, 2-nd and so on 389The following code systematically faults 0-th, 1-st, 2-nd and so on
379capabilities in the socketpair() system call. 390capabilities in the socketpair() system call::
380 391
381#include <sys/types.h> 392 #include <sys/types.h>
382#include <sys/stat.h> 393 #include <sys/stat.h>
383#include <sys/socket.h> 394 #include <sys/socket.h>
384#include <sys/syscall.h> 395 #include <sys/syscall.h>
385#include <fcntl.h> 396 #include <fcntl.h>
386#include <unistd.h> 397 #include <unistd.h>
387#include <string.h> 398 #include <string.h>
388#include <stdlib.h> 399 #include <stdlib.h>
389#include <stdio.h> 400 #include <stdio.h>
390#include <errno.h> 401 #include <errno.h>
391 402
392int main() 403 int main()
393{ 404 {
394 int i, err, res, fail_nth, fds[2]; 405 int i, err, res, fail_nth, fds[2];
395 char buf[128]; 406 char buf[128];
396 407
@@ -413,23 +424,23 @@ int main()
413 break; 424 break;
414 } 425 }
415 return 0; 426 return 0;
416} 427 }
417 428
418An example output: 429An example output::
419 430
4201-th fault Y: res=-1/23 431 1-th fault Y: res=-1/23
4212-th fault Y: res=-1/23 432 2-th fault Y: res=-1/23
4223-th fault Y: res=-1/12 433 3-th fault Y: res=-1/12
4234-th fault Y: res=-1/12 434 4-th fault Y: res=-1/12
4245-th fault Y: res=-1/23 435 5-th fault Y: res=-1/23
4256-th fault Y: res=-1/23 436 6-th fault Y: res=-1/23
4267-th fault Y: res=-1/23 437 7-th fault Y: res=-1/23
4278-th fault Y: res=-1/12 438 8-th fault Y: res=-1/12
4289-th fault Y: res=-1/12 439 9-th fault Y: res=-1/12
42910-th fault Y: res=-1/12 440 10-th fault Y: res=-1/12
43011-th fault Y: res=-1/12 441 11-th fault Y: res=-1/12
43112-th fault Y: res=-1/12 442 12-th fault Y: res=-1/12
43213-th fault Y: res=-1/12 443 13-th fault Y: res=-1/12
43314-th fault Y: res=-1/12 444 14-th fault Y: res=-1/12
43415-th fault Y: res=-1/12 445 15-th fault Y: res=-1/12
43516-th fault N: res=0/12 446 16-th fault N: res=0/12
diff --git a/Documentation/fault-injection/index.rst b/Documentation/fault-injection/index.rst
new file mode 100644
index 000000000000..92b5639ed07a
--- /dev/null
+++ b/Documentation/fault-injection/index.rst
@@ -0,0 +1,20 @@
1:orphan:
2
3===============
4fault-injection
5===============
6
7.. toctree::
8 :maxdepth: 1
9
10 fault-injection
11 notifier-error-inject
12 nvme-fault-injection
13 provoke-crashes
14
15.. only:: subproject and html
16
17 Indices
18 =======
19
20 * :ref:`genindex`
diff --git a/Documentation/fault-injection/notifier-error-inject.txt b/Documentation/fault-injection/notifier-error-inject.rst
index e861d761de24..1668b6e48d3a 100644
--- a/Documentation/fault-injection/notifier-error-inject.txt
+++ b/Documentation/fault-injection/notifier-error-inject.rst
@@ -14,7 +14,8 @@ modules that can be used to test the following notifiers.
14PM notifier error injection module 14PM notifier error injection module
15---------------------------------- 15----------------------------------
16This feature is controlled through debugfs interface 16This feature is controlled through debugfs interface
17/sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error 17
18 /sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
18 19
19Possible PM notifier events to be failed are: 20Possible PM notifier events to be failed are:
20 21
@@ -22,7 +23,7 @@ Possible PM notifier events to be failed are:
22 * PM_SUSPEND_PREPARE 23 * PM_SUSPEND_PREPARE
23 * PM_RESTORE_PREPARE 24 * PM_RESTORE_PREPARE
24 25
25Example: Inject PM suspend error (-12 = -ENOMEM) 26Example: Inject PM suspend error (-12 = -ENOMEM)::
26 27
27 # cd /sys/kernel/debug/notifier-error-inject/pm/ 28 # cd /sys/kernel/debug/notifier-error-inject/pm/
28 # echo -12 > actions/PM_SUSPEND_PREPARE/error 29 # echo -12 > actions/PM_SUSPEND_PREPARE/error
@@ -32,14 +33,15 @@ Example: Inject PM suspend error (-12 = -ENOMEM)
32Memory hotplug notifier error injection module 33Memory hotplug notifier error injection module
33---------------------------------------------- 34----------------------------------------------
34This feature is controlled through debugfs interface 35This feature is controlled through debugfs interface
35/sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error 36
37 /sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
36 38
37Possible memory notifier events to be failed are: 39Possible memory notifier events to be failed are:
38 40
39 * MEM_GOING_ONLINE 41 * MEM_GOING_ONLINE
40 * MEM_GOING_OFFLINE 42 * MEM_GOING_OFFLINE
41 43
42Example: Inject memory hotplug offline error (-12 == -ENOMEM) 44Example: Inject memory hotplug offline error (-12 == -ENOMEM)::
43 45
44 # cd /sys/kernel/debug/notifier-error-inject/memory 46 # cd /sys/kernel/debug/notifier-error-inject/memory
45 # echo -12 > actions/MEM_GOING_OFFLINE/error 47 # echo -12 > actions/MEM_GOING_OFFLINE/error
@@ -49,7 +51,8 @@ Example: Inject memory hotplug offline error (-12 == -ENOMEM)
49powerpc pSeries reconfig notifier error injection module 51powerpc pSeries reconfig notifier error injection module
50-------------------------------------------------------- 52--------------------------------------------------------
51This feature is controlled through debugfs interface 53This feature is controlled through debugfs interface
52/sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error 54
55 /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
53 56
54Possible pSeries reconfig notifier events to be failed are: 57Possible pSeries reconfig notifier events to be failed are:
55 58
@@ -61,7 +64,8 @@ Possible pSeries reconfig notifier events to be failed are:
61Netdevice notifier error injection module 64Netdevice notifier error injection module
62---------------------------------------------- 65----------------------------------------------
63This feature is controlled through debugfs interface 66This feature is controlled through debugfs interface
64/sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error 67
68 /sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
65 69
66Netdevice notifier events which can be failed are: 70Netdevice notifier events which can be failed are:
67 71
@@ -75,7 +79,7 @@ Netdevice notifier events which can be failed are:
75 * NETDEV_PRECHANGEUPPER 79 * NETDEV_PRECHANGEUPPER
76 * NETDEV_CHANGEUPPER 80 * NETDEV_CHANGEUPPER
77 81
78Example: Inject netdevice mtu change error (-22 == -EINVAL) 82Example: Inject netdevice mtu change error (-22 == -EINVAL)::
79 83
80 # cd /sys/kernel/debug/notifier-error-inject/netdev 84 # cd /sys/kernel/debug/notifier-error-inject/netdev
81 # echo -22 > actions/NETDEV_CHANGEMTU/error 85 # echo -22 > actions/NETDEV_CHANGEMTU/error
diff --git a/Documentation/fault-injection/nvme-fault-injection.rst b/Documentation/fault-injection/nvme-fault-injection.rst
new file mode 100644
index 000000000000..cdb2e829228e
--- /dev/null
+++ b/Documentation/fault-injection/nvme-fault-injection.rst
@@ -0,0 +1,178 @@
1NVMe Fault Injection
2====================
3Linux's fault injection framework provides a systematic way to support
4error injection via debugfs in the /sys/kernel/debug directory. When
5enabled, the default NVME_SC_INVALID_OPCODE with no retry will be
6injected into the nvme_end_request. Users can change the default status
7code and no retry flag via the debugfs. The list of Generic Command
8Status can be found in include/linux/nvme.h
9
10Following examples show how to inject an error into the nvme.
11
12First, enable CONFIG_FAULT_INJECTION_DEBUG_FS kernel config,
13recompile the kernel. After booting up the kernel, do the
14following.
15
16Example 1: Inject default status code with no retry
17---------------------------------------------------
18
19::
20
21 mount /dev/nvme0n1 /mnt
22 echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/times
23 echo 100 > /sys/kernel/debug/nvme0n1/fault_inject/probability
24 cp a.file /mnt
25
26Expected Result::
27
28 cp: cannot stat ‘/mnt/a.file’: Input/output error
29
30Message from dmesg::
31
32 FAULT_INJECTION: forcing a failure.
33 name fault_inject, interval 1, probability 100, space 0, times 1
34 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.15.0-rc8+ #2
35 Hardware name: innotek GmbH VirtualBox/VirtualBox,
36 BIOS VirtualBox 12/01/2006
37 Call Trace:
38 <IRQ>
39 dump_stack+0x5c/0x7d
40 should_fail+0x148/0x170
41 nvme_should_fail+0x2f/0x50 [nvme_core]
42 nvme_process_cq+0xe7/0x1d0 [nvme]
43 nvme_irq+0x1e/0x40 [nvme]
44 __handle_irq_event_percpu+0x3a/0x190
45 handle_irq_event_percpu+0x30/0x70
46 handle_irq_event+0x36/0x60
47 handle_fasteoi_irq+0x78/0x120
48 handle_irq+0xa7/0x130
49 ? tick_irq_enter+0xa8/0xc0
50 do_IRQ+0x43/0xc0
51 common_interrupt+0xa2/0xa2
52 </IRQ>
53 RIP: 0010:native_safe_halt+0x2/0x10
54 RSP: 0018:ffffffff82003e90 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffdd
55 RAX: ffffffff817a10c0 RBX: ffffffff82012480 RCX: 0000000000000000
56 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
57 RBP: 0000000000000000 R08: 000000008e38ce64 R09: 0000000000000000
58 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff82012480
59 R13: ffffffff82012480 R14: 0000000000000000 R15: 0000000000000000
60 ? __sched_text_end+0x4/0x4
61 default_idle+0x18/0xf0
62 do_idle+0x150/0x1d0
63 cpu_startup_entry+0x6f/0x80
64 start_kernel+0x4c4/0x4e4
65 ? set_init_arg+0x55/0x55
66 secondary_startup_64+0xa5/0xb0
67 print_req_error: I/O error, dev nvme0n1, sector 9240
68 EXT4-fs error (device nvme0n1): ext4_find_entry:1436:
69 inode #2: comm cp: reading directory lblock 0
70
71Example 2: Inject default status code with retry
72------------------------------------------------
73
74::
75
76 mount /dev/nvme0n1 /mnt
77 echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/times
78 echo 100 > /sys/kernel/debug/nvme0n1/fault_inject/probability
79 echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/status
80 echo 0 > /sys/kernel/debug/nvme0n1/fault_inject/dont_retry
81
82 cp a.file /mnt
83
84Expected Result::
85
86 command success without error
87
88Message from dmesg::
89
90 FAULT_INJECTION: forcing a failure.
91 name fault_inject, interval 1, probability 100, space 0, times 1
92 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.15.0-rc8+ #4
93 Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
94 Call Trace:
95 <IRQ>
96 dump_stack+0x5c/0x7d
97 should_fail+0x148/0x170
98 nvme_should_fail+0x30/0x60 [nvme_core]
99 nvme_loop_queue_response+0x84/0x110 [nvme_loop]
100 nvmet_req_complete+0x11/0x40 [nvmet]
101 nvmet_bio_done+0x28/0x40 [nvmet]
102 blk_update_request+0xb0/0x310
103 blk_mq_end_request+0x18/0x60
104 flush_smp_call_function_queue+0x3d/0xf0
105 smp_call_function_single_interrupt+0x2c/0xc0
106 call_function_single_interrupt+0xa2/0xb0
107 </IRQ>
108 RIP: 0010:native_safe_halt+0x2/0x10
109 RSP: 0018:ffffc9000068bec0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff04
110 RAX: ffffffff817a10c0 RBX: ffff88011a3c9680 RCX: 0000000000000000
111 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
112 RBP: 0000000000000001 R08: 000000008e38c131 R09: 0000000000000000
113 R10: 0000000000000000 R11: 0000000000000000 R12: ffff88011a3c9680
114 R13: ffff88011a3c9680 R14: 0000000000000000 R15: 0000000000000000
115 ? __sched_text_end+0x4/0x4
116 default_idle+0x18/0xf0
117 do_idle+0x150/0x1d0
118 cpu_startup_entry+0x6f/0x80
119 start_secondary+0x187/0x1e0
120 secondary_startup_64+0xa5/0xb0
121
122Example 3: Inject an error into the 10th admin command
123------------------------------------------------------
124
125::
126
127 echo 100 > /sys/kernel/debug/nvme0/fault_inject/probability
128 echo 10 > /sys/kernel/debug/nvme0/fault_inject/space
129 echo 1 > /sys/kernel/debug/nvme0/fault_inject/times
130 nvme reset /dev/nvme0
131
132Expected Result::
133
134 After NVMe controller reset, the reinitialization may or may not succeed.
135 It depends on which admin command is actually forced to fail.
136
137Message from dmesg::
138
139 nvme nvme0: resetting controller
140 FAULT_INJECTION: forcing a failure.
141 name fault_inject, interval 1, probability 100, space 1, times 1
142 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0-rc2+ #2
143 Hardware name: MSI MS-7A45/B150M MORTAR ARCTIC (MS-7A45), BIOS 1.50 04/25/2017
144 Call Trace:
145 <IRQ>
146 dump_stack+0x63/0x85
147 should_fail+0x14a/0x170
148 nvme_should_fail+0x38/0x80 [nvme_core]
149 nvme_irq+0x129/0x280 [nvme]
150 ? blk_mq_end_request+0xb3/0x120
151 __handle_irq_event_percpu+0x84/0x1a0
152 handle_irq_event_percpu+0x32/0x80
153 handle_irq_event+0x3b/0x60
154 handle_edge_irq+0x7f/0x1a0
155 handle_irq+0x20/0x30
156 do_IRQ+0x4e/0xe0
157 common_interrupt+0xf/0xf
158 </IRQ>
159 RIP: 0010:cpuidle_enter_state+0xc5/0x460
160 Code: ff e8 8f 5f 86 ff 80 7d c7 00 74 17 9c 58 0f 1f 44 00 00 f6 c4 02 0f 85 69 03 00 00 31 ff e8 62 aa 8c ff fb 66 0f 1f 44 00 00 <45> 85 ed 0f 88 37 03 00 00 4c 8b 45 d0 4c 2b 45 b8 48 ba cf f7 53
161 RSP: 0018:ffffffff88c03dd0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffdc
162 RAX: ffff9dac25a2ac80 RBX: ffffffff88d53760 RCX: 000000000000001f
163 RDX: 0000000000000000 RSI: 000000002d958403 RDI: 0000000000000000
164 RBP: ffffffff88c03e18 R08: fffffff75e35ffb7 R09: 00000a49a56c0b48
165 R10: ffffffff88c03da0 R11: 0000000000001b0c R12: ffff9dac25a34d00
166 R13: 0000000000000006 R14: 0000000000000006 R15: ffffffff88d53760
167 cpuidle_enter+0x2e/0x40
168 call_cpuidle+0x23/0x40
169 do_idle+0x201/0x280
170 cpu_startup_entry+0x1d/0x20
171 rest_init+0xaa/0xb0
172 arch_call_rest_init+0xe/0x1b
173 start_kernel+0x51c/0x53b
174 x86_64_start_reservations+0x24/0x26
175 x86_64_start_kernel+0x74/0x77
176 secondary_startup_64+0xa4/0xb0
177 nvme nvme0: Could not set queue count (16385)
178 nvme nvme0: IO queues not created
diff --git a/Documentation/fault-injection/nvme-fault-injection.txt b/Documentation/fault-injection/nvme-fault-injection.txt
deleted file mode 100644
index efcb339a3add..000000000000
--- a/Documentation/fault-injection/nvme-fault-injection.txt
+++ /dev/null
@@ -1,172 +0,0 @@
1NVMe Fault Injection
2====================
3Linux's fault injection framework provides a systematic way to support
4error injection via debugfs in the /sys/kernel/debug directory. When
5enabled, the default NVME_SC_INVALID_OPCODE with no retry will be
6injected into the nvme_end_request. Users can change the default status
7code and no retry flag via the debugfs. The list of Generic Command
8Status can be found in include/linux/nvme.h
9
10Following examples show how to inject an error into the nvme.
11
12First, enable CONFIG_FAULT_INJECTION_DEBUG_FS kernel config,
13recompile the kernel. After booting up the kernel, do the
14following.
15
16Example 1: Inject default status code with no retry
17---------------------------------------------------
18
19mount /dev/nvme0n1 /mnt
20echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/times
21echo 100 > /sys/kernel/debug/nvme0n1/fault_inject/probability
22cp a.file /mnt
23
24Expected Result:
25
26cp: cannot stat ‘/mnt/a.file’: Input/output error
27
28Message from dmesg:
29
30FAULT_INJECTION: forcing a failure.
31name fault_inject, interval 1, probability 100, space 0, times 1
32CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.15.0-rc8+ #2
33Hardware name: innotek GmbH VirtualBox/VirtualBox,
34BIOS VirtualBox 12/01/2006
35Call Trace:
36 <IRQ>
37 dump_stack+0x5c/0x7d
38 should_fail+0x148/0x170
39 nvme_should_fail+0x2f/0x50 [nvme_core]
40 nvme_process_cq+0xe7/0x1d0 [nvme]
41 nvme_irq+0x1e/0x40 [nvme]
42 __handle_irq_event_percpu+0x3a/0x190
43 handle_irq_event_percpu+0x30/0x70
44 handle_irq_event+0x36/0x60
45 handle_fasteoi_irq+0x78/0x120
46 handle_irq+0xa7/0x130
47 ? tick_irq_enter+0xa8/0xc0
48 do_IRQ+0x43/0xc0
49 common_interrupt+0xa2/0xa2
50 </IRQ>
51RIP: 0010:native_safe_halt+0x2/0x10
52RSP: 0018:ffffffff82003e90 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffdd
53RAX: ffffffff817a10c0 RBX: ffffffff82012480 RCX: 0000000000000000
54RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
55RBP: 0000000000000000 R08: 000000008e38ce64 R09: 0000000000000000
56R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff82012480
57R13: ffffffff82012480 R14: 0000000000000000 R15: 0000000000000000
58 ? __sched_text_end+0x4/0x4
59 default_idle+0x18/0xf0
60 do_idle+0x150/0x1d0
61 cpu_startup_entry+0x6f/0x80
62 start_kernel+0x4c4/0x4e4
63 ? set_init_arg+0x55/0x55
64 secondary_startup_64+0xa5/0xb0
65 print_req_error: I/O error, dev nvme0n1, sector 9240
66EXT4-fs error (device nvme0n1): ext4_find_entry:1436:
67inode #2: comm cp: reading directory lblock 0
68
69Example 2: Inject default status code with retry
70------------------------------------------------
71
72mount /dev/nvme0n1 /mnt
73echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/times
74echo 100 > /sys/kernel/debug/nvme0n1/fault_inject/probability
75echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/status
76echo 0 > /sys/kernel/debug/nvme0n1/fault_inject/dont_retry
77
78cp a.file /mnt
79
80Expected Result:
81
82command success without error
83
84Message from dmesg:
85
86FAULT_INJECTION: forcing a failure.
87name fault_inject, interval 1, probability 100, space 0, times 1
88CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.15.0-rc8+ #4
89Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
90Call Trace:
91 <IRQ>
92 dump_stack+0x5c/0x7d
93 should_fail+0x148/0x170
94 nvme_should_fail+0x30/0x60 [nvme_core]
95 nvme_loop_queue_response+0x84/0x110 [nvme_loop]
96 nvmet_req_complete+0x11/0x40 [nvmet]
97 nvmet_bio_done+0x28/0x40 [nvmet]
98 blk_update_request+0xb0/0x310
99 blk_mq_end_request+0x18/0x60
100 flush_smp_call_function_queue+0x3d/0xf0
101 smp_call_function_single_interrupt+0x2c/0xc0
102 call_function_single_interrupt+0xa2/0xb0
103 </IRQ>
104RIP: 0010:native_safe_halt+0x2/0x10
105RSP: 0018:ffffc9000068bec0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff04
106RAX: ffffffff817a10c0 RBX: ffff88011a3c9680 RCX: 0000000000000000
107RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
108RBP: 0000000000000001 R08: 000000008e38c131 R09: 0000000000000000
109R10: 0000000000000000 R11: 0000000000000000 R12: ffff88011a3c9680
110R13: ffff88011a3c9680 R14: 0000000000000000 R15: 0000000000000000
111 ? __sched_text_end+0x4/0x4
112 default_idle+0x18/0xf0
113 do_idle+0x150/0x1d0
114 cpu_startup_entry+0x6f/0x80
115 start_secondary+0x187/0x1e0
116 secondary_startup_64+0xa5/0xb0
117
118Example 3: Inject an error into the 10th admin command
119------------------------------------------------------
120
121echo 100 > /sys/kernel/debug/nvme0/fault_inject/probability
122echo 10 > /sys/kernel/debug/nvme0/fault_inject/space
123echo 1 > /sys/kernel/debug/nvme0/fault_inject/times
124nvme reset /dev/nvme0
125
126Expected Result:
127
128After NVMe controller reset, the reinitialization may or may not succeed.
129It depends on which admin command is actually forced to fail.
130
131Message from dmesg:
132
133nvme nvme0: resetting controller
134FAULT_INJECTION: forcing a failure.
135name fault_inject, interval 1, probability 100, space 1, times 1
136CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0-rc2+ #2
137Hardware name: MSI MS-7A45/B150M MORTAR ARCTIC (MS-7A45), BIOS 1.50 04/25/2017
138Call Trace:
139 <IRQ>
140 dump_stack+0x63/0x85
141 should_fail+0x14a/0x170
142 nvme_should_fail+0x38/0x80 [nvme_core]
143 nvme_irq+0x129/0x280 [nvme]
144 ? blk_mq_end_request+0xb3/0x120
145 __handle_irq_event_percpu+0x84/0x1a0
146 handle_irq_event_percpu+0x32/0x80
147 handle_irq_event+0x3b/0x60
148 handle_edge_irq+0x7f/0x1a0
149 handle_irq+0x20/0x30
150 do_IRQ+0x4e/0xe0
151 common_interrupt+0xf/0xf
152 </IRQ>
153RIP: 0010:cpuidle_enter_state+0xc5/0x460
154Code: ff e8 8f 5f 86 ff 80 7d c7 00 74 17 9c 58 0f 1f 44 00 00 f6 c4 02 0f 85 69 03 00 00 31 ff e8 62 aa 8c ff fb 66 0f 1f 44 00 00 <45> 85 ed 0f 88 37 03 00 00 4c 8b 45 d0 4c 2b 45 b8 48 ba cf f7 53
155RSP: 0018:ffffffff88c03dd0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffdc
156RAX: ffff9dac25a2ac80 RBX: ffffffff88d53760 RCX: 000000000000001f
157RDX: 0000000000000000 RSI: 000000002d958403 RDI: 0000000000000000
158RBP: ffffffff88c03e18 R08: fffffff75e35ffb7 R09: 00000a49a56c0b48
159R10: ffffffff88c03da0 R11: 0000000000001b0c R12: ffff9dac25a34d00
160R13: 0000000000000006 R14: 0000000000000006 R15: ffffffff88d53760
161 cpuidle_enter+0x2e/0x40
162 call_cpuidle+0x23/0x40
163 do_idle+0x201/0x280
164 cpu_startup_entry+0x1d/0x20
165 rest_init+0xaa/0xb0
166 arch_call_rest_init+0xe/0x1b
167 start_kernel+0x51c/0x53b
168 x86_64_start_reservations+0x24/0x26
169 x86_64_start_kernel+0x74/0x77
170 secondary_startup_64+0xa4/0xb0
171nvme nvme0: Could not set queue count (16385)
172nvme nvme0: IO queues not created
diff --git a/Documentation/fault-injection/provoke-crashes.rst b/Documentation/fault-injection/provoke-crashes.rst
new file mode 100644
index 000000000000..9279a3e12278
--- /dev/null
+++ b/Documentation/fault-injection/provoke-crashes.rst
@@ -0,0 +1,48 @@
1===============
2Provoke crashes
3===============
4
5The lkdtm module provides an interface to crash or injure the kernel at
6predefined crashpoints to evaluate the reliability of crash dumps obtained
7using different dumping solutions. The module uses KPROBEs to instrument
8crashing points, but can also crash the kernel directly without KRPOBE
9support.
10
11
12You can provide the way either through module arguments when inserting
13the module, or through a debugfs interface.
14
15Usage::
16
17 insmod lkdtm.ko [recur_count={>0}] cpoint_name=<> cpoint_type=<>
18 [cpoint_count={>0}]
19
20recur_count
21 Recursion level for the stack overflow test. Default is 10.
22
23cpoint_name
24 Crash point where the kernel is to be crashed. It can be
25 one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY,
26 FS_DEVRW, MEM_SWAPOUT, TIMERADD, SCSI_DISPATCH_CMD,
27 IDE_CORE_CP, DIRECT
28
29cpoint_type
30 Indicates the action to be taken on hitting the crash point.
31 It can be one of PANIC, BUG, EXCEPTION, LOOP, OVERFLOW,
32 CORRUPT_STACK, UNALIGNED_LOAD_STORE_WRITE, OVERWRITE_ALLOCATION,
33 WRITE_AFTER_FREE,
34
35cpoint_count
36 Indicates the number of times the crash point is to be hit
37 to trigger an action. The default is 10.
38
39You can also induce failures by mounting debugfs and writing the type to
40<mountpoint>/provoke-crash/<crashpoint>. E.g.::
41
42 mount -t debugfs debugfs /mnt
43 echo EXCEPTION > /mnt/provoke-crash/INT_HARDWARE_ENTRY
44
45
46A special file is `DIRECT` which will induce the crash directly without
47KPROBE instrumentation. This mode is the only one available when the module
48is built on a kernel without KPROBEs support.
diff --git a/Documentation/fault-injection/provoke-crashes.txt b/Documentation/fault-injection/provoke-crashes.txt
deleted file mode 100644
index 7a9d3d81525b..000000000000
--- a/Documentation/fault-injection/provoke-crashes.txt
+++ /dev/null
@@ -1,38 +0,0 @@
1The lkdtm module provides an interface to crash or injure the kernel at
2predefined crashpoints to evaluate the reliability of crash dumps obtained
3using different dumping solutions. The module uses KPROBEs to instrument
4crashing points, but can also crash the kernel directly without KRPOBE
5support.
6
7
8You can provide the way either through module arguments when inserting
9the module, or through a debugfs interface.
10
11Usage: insmod lkdtm.ko [recur_count={>0}] cpoint_name=<> cpoint_type=<>
12 [cpoint_count={>0}]
13
14 recur_count : Recursion level for the stack overflow test. Default is 10.
15
16 cpoint_name : Crash point where the kernel is to be crashed. It can be
17 one of INT_HARDWARE_ENTRY, INT_HW_IRQ_EN, INT_TASKLET_ENTRY,
18 FS_DEVRW, MEM_SWAPOUT, TIMERADD, SCSI_DISPATCH_CMD,
19 IDE_CORE_CP, DIRECT
20
21 cpoint_type : Indicates the action to be taken on hitting the crash point.
22 It can be one of PANIC, BUG, EXCEPTION, LOOP, OVERFLOW,
23 CORRUPT_STACK, UNALIGNED_LOAD_STORE_WRITE, OVERWRITE_ALLOCATION,
24 WRITE_AFTER_FREE,
25
26 cpoint_count : Indicates the number of times the crash point is to be hit
27 to trigger an action. The default is 10.
28
29You can also induce failures by mounting debugfs and writing the type to
30<mountpoint>/provoke-crash/<crashpoint>. E.g.,
31
32 mount -t debugfs debugfs /mnt
33 echo EXCEPTION > /mnt/provoke-crash/INT_HARDWARE_ENTRY
34
35
36A special file is `DIRECT' which will induce the crash directly without
37KPROBE instrumentation. This mode is the only one available when the module
38is built on a kernel without KPROBEs support.
diff --git a/Documentation/fb/api.txt b/Documentation/fb/api.rst
index d52cf1e3b975..79ec33dded74 100644
--- a/Documentation/fb/api.txt
+++ b/Documentation/fb/api.rst
@@ -1,5 +1,6 @@
1 The Frame Buffer Device API 1===========================
2 --------------------------- 2The Frame Buffer Device API
3===========================
3 4
4Last revised: June 21, 2011 5Last revised: June 21, 2011
5 6
@@ -21,13 +22,13 @@ deal with different behaviours.
21--------------- 22---------------
22 23
23Device and driver capabilities are reported in the fixed screen information 24Device and driver capabilities are reported in the fixed screen information
24capabilities field. 25capabilities field::
25 26
26struct fb_fix_screeninfo { 27 struct fb_fix_screeninfo {
27 ... 28 ...
28 __u16 capabilities; /* see FB_CAP_* */ 29 __u16 capabilities; /* see FB_CAP_* */
29 ... 30 ...
30}; 31 };
31 32
32Application should use those capabilities to find out what features they can 33Application should use those capabilities to find out what features they can
33expect from the device and driver. 34expect from the device and driver.
@@ -151,9 +152,9 @@ fb_fix_screeninfo and fb_var_screeninfo structure respectively.
151struct fb_fix_screeninfo stores device independent unchangeable information 152struct fb_fix_screeninfo stores device independent unchangeable information
152about the frame buffer device and the current format. Those information can't 153about the frame buffer device and the current format. Those information can't
153be directly modified by applications, but can be changed by the driver when an 154be directly modified by applications, but can be changed by the driver when an
154application modifies the format. 155application modifies the format::
155 156
156struct fb_fix_screeninfo { 157 struct fb_fix_screeninfo {
157 char id[16]; /* identification string eg "TT Builtin" */ 158 char id[16]; /* identification string eg "TT Builtin" */
158 unsigned long smem_start; /* Start of frame buffer mem */ 159 unsigned long smem_start; /* Start of frame buffer mem */
159 /* (physical address) */ 160 /* (physical address) */
@@ -172,13 +173,13 @@ struct fb_fix_screeninfo {
172 /* specific chip/card we have */ 173 /* specific chip/card we have */
173 __u16 capabilities; /* see FB_CAP_* */ 174 __u16 capabilities; /* see FB_CAP_* */
174 __u16 reserved[2]; /* Reserved for future compatibility */ 175 __u16 reserved[2]; /* Reserved for future compatibility */
175}; 176 };
176 177
177struct fb_var_screeninfo stores device independent changeable information 178struct fb_var_screeninfo stores device independent changeable information
178about a frame buffer device, its current format and video mode, as well as 179about a frame buffer device, its current format and video mode, as well as
179other miscellaneous parameters. 180other miscellaneous parameters::
180 181
181struct fb_var_screeninfo { 182 struct fb_var_screeninfo {
182 __u32 xres; /* visible resolution */ 183 __u32 xres; /* visible resolution */
183 __u32 yres; 184 __u32 yres;
184 __u32 xres_virtual; /* virtual resolution */ 185 __u32 xres_virtual; /* virtual resolution */
@@ -216,7 +217,7 @@ struct fb_var_screeninfo {
216 __u32 rotate; /* angle we rotate counter clockwise */ 217 __u32 rotate; /* angle we rotate counter clockwise */
217 __u32 colorspace; /* colorspace for FOURCC-based modes */ 218 __u32 colorspace; /* colorspace for FOURCC-based modes */
218 __u32 reserved[4]; /* Reserved for future compatibility */ 219 __u32 reserved[4]; /* Reserved for future compatibility */
219}; 220 };
220 221
221To modify variable information, applications call the FBIOPUT_VSCREENINFO 222To modify variable information, applications call the FBIOPUT_VSCREENINFO
222ioctl with a pointer to a fb_var_screeninfo structure. If the call is 223ioctl with a pointer to a fb_var_screeninfo structure. If the call is
@@ -255,14 +256,14 @@ monochrome, grayscale or pseudocolor visuals, although this is not required.
255 256
256- For truecolor and directcolor formats, applications set the grayscale field 257- For truecolor and directcolor formats, applications set the grayscale field
257 to zero, and the red, blue, green and transp fields to describe the layout of 258 to zero, and the red, blue, green and transp fields to describe the layout of
258 color components in memory. 259 color components in memory::
259 260
260struct fb_bitfield { 261 struct fb_bitfield {
261 __u32 offset; /* beginning of bitfield */ 262 __u32 offset; /* beginning of bitfield */
262 __u32 length; /* length of bitfield */ 263 __u32 length; /* length of bitfield */
263 __u32 msb_right; /* != 0 : Most significant bit is */ 264 __u32 msb_right; /* != 0 : Most significant bit is */
264 /* right */ 265 /* right */
265}; 266 };
266 267
267 Pixel values are bits_per_pixel wide and are split in non-overlapping red, 268 Pixel values are bits_per_pixel wide and are split in non-overlapping red,
268 green, blue and alpha (transparency) components. Location and size of each 269 green, blue and alpha (transparency) components. Location and size of each
diff --git a/Documentation/fb/arkfb.txt b/Documentation/fb/arkfb.rst
index e8487a9d6a05..aeca8773dd7e 100644
--- a/Documentation/fb/arkfb.txt
+++ b/Documentation/fb/arkfb.rst
@@ -1,6 +1,6 @@
1 1========================================
2 arkfb - fbdev driver for ARK Logic chips 2arkfb - fbdev driver for ARK Logic chips
3 ======================================== 3========================================
4 4
5 5
6Supported Hardware 6Supported Hardware
@@ -47,7 +47,7 @@ Missing Features
47(alias TODO list) 47(alias TODO list)
48 48
49 * secondary (not initialized by BIOS) device support 49 * secondary (not initialized by BIOS) device support
50 * big endian support 50 * big endian support
51 * DPMS support 51 * DPMS support
52 * MMIO support 52 * MMIO support
53 * interlaced mode variant 53 * interlaced mode variant
diff --git a/Documentation/fb/aty128fb.txt b/Documentation/fb/aty128fb.rst
index b605204fcfe1..3f107718f933 100644
--- a/Documentation/fb/aty128fb.txt
+++ b/Documentation/fb/aty128fb.rst
@@ -1,8 +1,9 @@
1[This file is cloned from VesaFB/matroxfb] 1=================
2
3What is aty128fb? 2What is aty128fb?
4================= 3=================
5 4
5.. [This file is cloned from VesaFB/matroxfb]
6
6This is a driver for a graphic framebuffer for ATI Rage128 based devices 7This is a driver for a graphic framebuffer for ATI Rage128 based devices
7on Intel and PPC boxes. 8on Intel and PPC boxes.
8 9
@@ -24,15 +25,15 @@ How to use it?
24============== 25==============
25 26
26Switching modes is done using the video=aty128fb:<resolution>... modedb 27Switching modes is done using the video=aty128fb:<resolution>... modedb
27boot parameter or using `fbset' program. 28boot parameter or using `fbset` program.
28 29
29See Documentation/fb/modedb.txt for more information on modedb 30See Documentation/fb/modedb.rst for more information on modedb
30resolutions. 31resolutions.
31 32
32You should compile in both vgacon (to boot if you remove your Rage128 from 33You should compile in both vgacon (to boot if you remove your Rage128 from
33box) and aty128fb (for graphics mode). You should not compile-in vesafb 34box) and aty128fb (for graphics mode). You should not compile-in vesafb
34unless you have primary display on non-Rage128 VBE2.0 device (see 35unless you have primary display on non-Rage128 VBE2.0 device (see
35Documentation/fb/vesafb.txt for details). 36Documentation/fb/vesafb.rst for details).
36 37
37 38
38X11 39X11
@@ -48,16 +49,18 @@ Configuration
48============= 49=============
49 50
50You can pass kernel command line options to vesafb with 51You can pass kernel command line options to vesafb with
51`video=aty128fb:option1,option2:value2,option3' (multiple options should 52`video=aty128fb:option1,option2:value2,option3` (multiple options should
52be separated by comma, values are separated from options by `:'). 53be separated by comma, values are separated from options by `:`).
53Accepted options: 54Accepted options:
54 55
55noaccel - do not use acceleration engine. It is default. 56========= =======================================================
56accel - use acceleration engine. Not finished. 57noaccel do not use acceleration engine. It is default.
57vmode:x - chooses PowerMacintosh video mode <x>. Deprecated. 58accel use acceleration engine. Not finished.
58cmode:x - chooses PowerMacintosh colour mode <x>. Deprecated. 59vmode:x chooses PowerMacintosh video mode <x>. Deprecated.
59<XxX@X> - selects startup videomode. See modedb.txt for detailed 60cmode:x chooses PowerMacintosh colour mode <x>. Deprecated.
60 explanation. Default is 640x480x8bpp. 61<XxX@X> selects startup videomode. See modedb.txt for detailed
62 explanation. Default is 640x480x8bpp.
63========= =======================================================
61 64
62 65
63Limitations 66Limitations
@@ -65,8 +68,8 @@ Limitations
65 68
66There are known and unknown bugs, features and misfeatures. 69There are known and unknown bugs, features and misfeatures.
67Currently there are following known bugs: 70Currently there are following known bugs:
68 + This driver is still experimental and is not finished. Too many 71
72 - This driver is still experimental and is not finished. Too many
69 bugs/errata to list here. 73 bugs/errata to list here.
70 74
71--
72Brad Douglas <brad@neruo.com> 75Brad Douglas <brad@neruo.com>
diff --git a/Documentation/fb/cirrusfb.txt b/Documentation/fb/cirrusfb.rst
index f75950d330a4..8c3e6c6cb114 100644
--- a/Documentation/fb/cirrusfb.txt
+++ b/Documentation/fb/cirrusfb.rst
@@ -1,32 +1,32 @@
1============================================
2Framebuffer driver for Cirrus Logic chipsets
3============================================
1 4
2 Framebuffer driver for Cirrus Logic chipsets 5Copyright 1999 Jeff Garzik <jgarzik@pobox.com>
3 Copyright 1999 Jeff Garzik <jgarzik@pobox.com>
4 6
5 7
6 8.. just a little something to get people going; contributors welcome!
7{ just a little something to get people going; contributors welcome! }
8
9 9
10 10
11Chip families supported: 11Chip families supported:
12 SD64 12 - SD64
13 Piccolo 13 - Piccolo
14 Picasso 14 - Picasso
15 Spectrum 15 - Spectrum
16 Alpine (GD-543x/4x) 16 - Alpine (GD-543x/4x)
17 Picasso4 (GD-5446) 17 - Picasso4 (GD-5446)
18 GD-5480 18 - GD-5480
19 Laguna (GD-546x) 19 - Laguna (GD-546x)
20 20
21Bus's supported: 21Bus's supported:
22 PCI 22 - PCI
23 Zorro 23 - Zorro
24 24
25Architectures supported: 25Architectures supported:
26 i386 26 - i386
27 Alpha 27 - Alpha
28 PPC (Motorola Powerstack) 28 - PPC (Motorola Powerstack)
29 m68k (Amiga) 29 - m68k (Amiga)
30 30
31 31
32 32
@@ -34,10 +34,9 @@ Default video modes
34------------------- 34-------------------
35At the moment, there are two kernel command line arguments supported: 35At the moment, there are two kernel command line arguments supported:
36 36
37mode:640x480 37- mode:640x480
38mode:800x600 38- mode:800x600
39 or 39- mode:1024x768
40mode:1024x768
41 40
42Full support for startup video modes (modedb) will be integrated soon. 41Full support for startup video modes (modedb) will be integrated soon.
43 42
@@ -93,5 +92,3 @@ Version 1.9.4
93Version 1.9.3 92Version 1.9.3
94------------- 93-------------
95* Bundled with kernel 2.3.14-pre1 or later. 94* Bundled with kernel 2.3.14-pre1 or later.
96
97
diff --git a/Documentation/fb/cmap_xfbdev.txt b/Documentation/fb/cmap_xfbdev.rst
index 55e1f0a3d2b4..5db5e9787361 100644
--- a/Documentation/fb/cmap_xfbdev.txt
+++ b/Documentation/fb/cmap_xfbdev.rst
@@ -1,26 +1,29 @@
1==========================
1Understanding fbdev's cmap 2Understanding fbdev's cmap
2-------------------------- 3==========================
3 4
4These notes explain how X's dix layer uses fbdev's cmap structures. 5These notes explain how X's dix layer uses fbdev's cmap structures.
5 6
6*. example of relevant structures in fbdev as used for a 3-bit grayscale cmap 7- example of relevant structures in fbdev as used for a 3-bit grayscale cmap::
7struct fb_var_screeninfo { 8
8 .bits_per_pixel = 8, 9 struct fb_var_screeninfo {
9 .grayscale = 1, 10 .bits_per_pixel = 8,
10 .red = { 4, 3, 0 }, 11 .grayscale = 1,
11 .green = { 0, 0, 0 }, 12 .red = { 4, 3, 0 },
12 .blue = { 0, 0, 0 }, 13 .green = { 0, 0, 0 },
13} 14 .blue = { 0, 0, 0 },
14struct fb_fix_screeninfo { 15 }
15 .visual = FB_VISUAL_STATIC_PSEUDOCOLOR, 16 struct fb_fix_screeninfo {
16} 17 .visual = FB_VISUAL_STATIC_PSEUDOCOLOR,
17for (i = 0; i < 8; i++) 18 }
19 for (i = 0; i < 8; i++)
18 info->cmap.red[i] = (((2*i)+1)*(0xFFFF))/16; 20 info->cmap.red[i] = (((2*i)+1)*(0xFFFF))/16;
19memcpy(info->cmap.green, info->cmap.red, sizeof(u16)*8); 21 memcpy(info->cmap.green, info->cmap.red, sizeof(u16)*8);
20memcpy(info->cmap.blue, info->cmap.red, sizeof(u16)*8); 22 memcpy(info->cmap.blue, info->cmap.red, sizeof(u16)*8);
21 23
22*. X11 apps do something like the following when trying to use grayscale. 24- X11 apps do something like the following when trying to use grayscale::
23for (i=0; i < 8; i++) { 25
26 for (i=0; i < 8; i++) {
24 char colorspec[64]; 27 char colorspec[64];
25 memset(colorspec,0,64); 28 memset(colorspec,0,64);
26 sprintf(colorspec, "rgb:%x/%x/%x", i*36,i*36,i*36); 29 sprintf(colorspec, "rgb:%x/%x/%x", i*36,i*36,i*36);
@@ -28,26 +31,26 @@ for (i=0; i < 8; i++) {
28 printf("Can't get color %s\n",colorspec); 31 printf("Can't get color %s\n",colorspec);
29 XAllocColor(outputDisplay, testColormap, &wantedColor); 32 XAllocColor(outputDisplay, testColormap, &wantedColor);
30 grays[i] = wantedColor; 33 grays[i] = wantedColor;
31} 34 }
35
32There's also named equivalents like gray1..x provided you have an rgb.txt. 36There's also named equivalents like gray1..x provided you have an rgb.txt.
33 37
34Somewhere in X's callchain, this results in a call to X code that handles the 38Somewhere in X's callchain, this results in a call to X code that handles the
35colormap. For example, Xfbdev hits the following: 39colormap. For example, Xfbdev hits the following:
36 40
37xc-011010/programs/Xserver/dix/colormap.c: 41xc-011010/programs/Xserver/dix/colormap.c::
38 42
39FindBestPixel(pentFirst, size, prgb, channel) 43 FindBestPixel(pentFirst, size, prgb, channel)
40 44
41dr = (long) pent->co.local.red - prgb->red; 45 dr = (long) pent->co.local.red - prgb->red;
42dg = (long) pent->co.local.green - prgb->green; 46 dg = (long) pent->co.local.green - prgb->green;
43db = (long) pent->co.local.blue - prgb->blue; 47 db = (long) pent->co.local.blue - prgb->blue;
44sq = dr * dr; 48 sq = dr * dr;
45UnsignedToBigNum (sq, &sum); 49 UnsignedToBigNum (sq, &sum);
46BigNumAdd (&sum, &temp, &sum); 50 BigNumAdd (&sum, &temp, &sum);
47 51
48co.local.red are entries that were brought in through FBIOGETCMAP which come 52co.local.red are entries that were brought in through FBIOGETCMAP which come
49directly from the info->cmap.red that was listed above. The prgb is the rgb 53directly from the info->cmap.red that was listed above. The prgb is the rgb
50that the app wants to match to. The above code is doing what looks like a least 54that the app wants to match to. The above code is doing what looks like a least
51squares matching function. That's why the cmap entries can't be set to the left 55squares matching function. That's why the cmap entries can't be set to the left
52hand side boundaries of a color range. 56hand side boundaries of a color range.
53
diff --git a/Documentation/fb/deferred_io.txt b/Documentation/fb/deferred_io.rst
index 748328370250..7300cff255a3 100644
--- a/Documentation/fb/deferred_io.txt
+++ b/Documentation/fb/deferred_io.rst
@@ -1,5 +1,6 @@
1===========
1Deferred IO 2Deferred IO
2----------- 3===========
3 4
4Deferred IO is a way to delay and repurpose IO. It uses host memory as a 5Deferred IO is a way to delay and repurpose IO. It uses host memory as a
5buffer and the MMU pagefault as a pretrigger for when to perform the device 6buffer and the MMU pagefault as a pretrigger for when to perform the device
@@ -16,7 +17,7 @@ works:
16- app continues writing to that page with no additional cost. this is 17- app continues writing to that page with no additional cost. this is
17 the key benefit. 18 the key benefit.
18- the workqueue task comes in and mkcleans the pages on the list, then 19- the workqueue task comes in and mkcleans the pages on the list, then
19 completes the work associated with updating the framebuffer. this is 20 completes the work associated with updating the framebuffer. this is
20 the real work talking to the device. 21 the real work talking to the device.
21- app tries to write to the address (that has now been mkcleaned) 22- app tries to write to the address (that has now been mkcleaned)
22- get pagefault and the above sequence occurs again 23- get pagefault and the above sequence occurs again
@@ -47,29 +48,32 @@ How to use it: (for fbdev drivers)
47---------------------------------- 48----------------------------------
48The following example may be helpful. 49The following example may be helpful.
49 50
501. Setup your structure. Eg: 511. Setup your structure. Eg::
51 52
52static struct fb_deferred_io hecubafb_defio = { 53 static struct fb_deferred_io hecubafb_defio = {
53 .delay = HZ, 54 .delay = HZ,
54 .deferred_io = hecubafb_dpy_deferred_io, 55 .deferred_io = hecubafb_dpy_deferred_io,
55}; 56 };
56 57
57The delay is the minimum delay between when the page_mkwrite trigger occurs 58The delay is the minimum delay between when the page_mkwrite trigger occurs
58and when the deferred_io callback is called. The deferred_io callback is 59and when the deferred_io callback is called. The deferred_io callback is
59explained below. 60explained below.
60 61
612. Setup your deferred IO callback. Eg: 622. Setup your deferred IO callback. Eg::
62static void hecubafb_dpy_deferred_io(struct fb_info *info, 63
63 struct list_head *pagelist) 64 static void hecubafb_dpy_deferred_io(struct fb_info *info,
65 struct list_head *pagelist)
64 66
65The deferred_io callback is where you would perform all your IO to the display 67The deferred_io callback is where you would perform all your IO to the display
66device. You receive the pagelist which is the list of pages that were written 68device. You receive the pagelist which is the list of pages that were written
67to during the delay. You must not modify this list. This callback is called 69to during the delay. You must not modify this list. This callback is called
68from a workqueue. 70from a workqueue.
69 71
703. Call init 723. Call init::
73
71 info->fbdefio = &hecubafb_defio; 74 info->fbdefio = &hecubafb_defio;
72 fb_deferred_io_init(info); 75 fb_deferred_io_init(info);
73 76
744. Call cleanup 774. Call cleanup::
78
75 fb_deferred_io_cleanup(info); 79 fb_deferred_io_cleanup(info);
diff --git a/Documentation/fb/efifb.txt b/Documentation/fb/efifb.rst
index 1a85c1bdaf38..04840331a00e 100644
--- a/Documentation/fb/efifb.txt
+++ b/Documentation/fb/efifb.rst
@@ -1,6 +1,6 @@
1 1==============
2What is efifb? 2What is efifb?
3=============== 3==============
4 4
5This is a generic EFI platform driver for Intel based Apple computers. 5This is a generic EFI platform driver for Intel based Apple computers.
6efifb is only for EFI booted Intel Macs. 6efifb is only for EFI booted Intel Macs.
@@ -8,16 +8,17 @@ efifb is only for EFI booted Intel Macs.
8Supported Hardware 8Supported Hardware
9================== 9==================
10 10
11iMac 17"/20" 11- iMac 17"/20"
12Macbook 12- Macbook
13Macbook Pro 15"/17" 13- Macbook Pro 15"/17"
14MacMini 14- MacMini
15 15
16How to use it? 16How to use it?
17============== 17==============
18 18
19efifb does not have any kind of autodetection of your machine. 19efifb does not have any kind of autodetection of your machine.
20You have to add the following kernel parameters in your elilo.conf: 20You have to add the following kernel parameters in your elilo.conf::
21
21 Macbook : 22 Macbook :
22 video=efifb:macbook 23 video=efifb:macbook
23 MacMini : 24 MacMini :
@@ -29,9 +30,10 @@ You have to add the following kernel parameters in your elilo.conf:
29 30
30Accepted options: 31Accepted options:
31 32
33======= ===========================================================
32nowc Don't map the framebuffer write combined. This can be used 34nowc Don't map the framebuffer write combined. This can be used
33 to workaround side-effects and slowdowns on other CPU cores 35 to workaround side-effects and slowdowns on other CPU cores
34 when large amounts of console data are written. 36 when large amounts of console data are written.
37======= ===========================================================
35 38
36--
37Edgar Hucek <gimli@dark-green.com> 39Edgar Hucek <gimli@dark-green.com>
diff --git a/Documentation/fb/ep93xx-fb.txt b/Documentation/fb/ep93xx-fb.rst
index 5af1bd9effae..6f7767926d1a 100644
--- a/Documentation/fb/ep93xx-fb.txt
+++ b/Documentation/fb/ep93xx-fb.rst
@@ -4,7 +4,7 @@ Driver for EP93xx LCD controller
4 4
5The EP93xx LCD controller can drive both standard desktop monitors and 5The EP93xx LCD controller can drive both standard desktop monitors and
6embedded LCD displays. If you have a standard desktop monitor then you 6embedded LCD displays. If you have a standard desktop monitor then you
7can use the standard Linux video mode database. In your board file: 7can use the standard Linux video mode database. In your board file::
8 8
9 static struct ep93xxfb_mach_info some_board_fb_info = { 9 static struct ep93xxfb_mach_info some_board_fb_info = {
10 .num_modes = EP93XXFB_USE_MODEDB, 10 .num_modes = EP93XXFB_USE_MODEDB,
@@ -12,7 +12,7 @@ can use the standard Linux video mode database. In your board file:
12 }; 12 };
13 13
14If you have an embedded LCD display then you need to define a video 14If you have an embedded LCD display then you need to define a video
15mode for it as follows: 15mode for it as follows::
16 16
17 static struct fb_videomode some_board_video_modes[] = { 17 static struct fb_videomode some_board_video_modes[] = {
18 { 18 {
@@ -23,11 +23,11 @@ mode for it as follows:
23 23
24Note that the pixel clock value is in pico-seconds. You can use the 24Note that the pixel clock value is in pico-seconds. You can use the
25KHZ2PICOS macro to convert the pixel clock value. Most other values 25KHZ2PICOS macro to convert the pixel clock value. Most other values
26are in pixel clocks. See Documentation/fb/framebuffer.txt for further 26are in pixel clocks. See Documentation/fb/framebuffer.rst for further
27details. 27details.
28 28
29The ep93xxfb_mach_info structure for your board should look like the 29The ep93xxfb_mach_info structure for your board should look like the
30following: 30following::
31 31
32 static struct ep93xxfb_mach_info some_board_fb_info = { 32 static struct ep93xxfb_mach_info some_board_fb_info = {
33 .num_modes = ARRAY_SIZE(some_board_video_modes), 33 .num_modes = ARRAY_SIZE(some_board_video_modes),
@@ -37,7 +37,7 @@ following:
37 }; 37 };
38 38
39The framebuffer device can be registered by adding the following to 39The framebuffer device can be registered by adding the following to
40your board initialisation function: 40your board initialisation function::
41 41
42 ep93xx_register_fb(&some_board_fb_info); 42 ep93xx_register_fb(&some_board_fb_info);
43 43
@@ -50,6 +50,7 @@ to configure the controller. The video attributes flags are fully
50documented in section 7 of the EP93xx users' guide. The following 50documented in section 7 of the EP93xx users' guide. The following
51flags are available: 51flags are available:
52 52
53=============================== ==========================================
53EP93XXFB_PCLK_FALLING Clock data on the falling edge of the 54EP93XXFB_PCLK_FALLING Clock data on the falling edge of the
54 pixel clock. The default is to clock 55 pixel clock. The default is to clock
55 data on the rising edge. 56 data on the rising edge.
@@ -62,10 +63,12 @@ EP93XXFB_SYNC_HORIZ_HIGH Horizontal sync is active high. By
62 63
63EP93XXFB_SYNC_VERT_HIGH Vertical sync is active high. By 64EP93XXFB_SYNC_VERT_HIGH Vertical sync is active high. By
64 default the vertical sync is active high. 65 default the vertical sync is active high.
66=============================== ==========================================
65 67
66The physical address of the framebuffer can be controlled using the 68The physical address of the framebuffer can be controlled using the
67following flags: 69following flags:
68 70
71=============================== ======================================
69EP93XXFB_USE_SDCSN0 Use SDCSn[0] for the framebuffer. This 72EP93XXFB_USE_SDCSN0 Use SDCSn[0] for the framebuffer. This
70 is the default setting. 73 is the default setting.
71 74
@@ -74,6 +77,7 @@ EP93XXFB_USE_SDCSN1 Use SDCSn[1] for the framebuffer.
74EP93XXFB_USE_SDCSN2 Use SDCSn[2] for the framebuffer. 77EP93XXFB_USE_SDCSN2 Use SDCSn[2] for the framebuffer.
75 78
76EP93XXFB_USE_SDCSN3 Use SDCSn[3] for the framebuffer. 79EP93XXFB_USE_SDCSN3 Use SDCSn[3] for the framebuffer.
80=============================== ======================================
77 81
78================== 82==================
79Platform callbacks 83Platform callbacks
@@ -87,7 +91,7 @@ blanked or unblanked.
87 91
88The setup and teardown devices pass the platform_device structure as 92The setup and teardown devices pass the platform_device structure as
89an argument. The fb_info and ep93xxfb_mach_info structures can be 93an argument. The fb_info and ep93xxfb_mach_info structures can be
90obtained as follows: 94obtained as follows::
91 95
92 static int some_board_fb_setup(struct platform_device *pdev) 96 static int some_board_fb_setup(struct platform_device *pdev)
93 { 97 {
@@ -101,17 +105,17 @@ obtained as follows:
101Setting the video mode 105Setting the video mode
102====================== 106======================
103 107
104The video mode is set using the following syntax: 108The video mode is set using the following syntax::
105 109
106 video=XRESxYRES[-BPP][@REFRESH] 110 video=XRESxYRES[-BPP][@REFRESH]
107 111
108If the EP93xx video driver is built-in then the video mode is set on 112If the EP93xx video driver is built-in then the video mode is set on
109the Linux kernel command line, for example: 113the Linux kernel command line, for example::
110 114
111 video=ep93xx-fb:800x600-16@60 115 video=ep93xx-fb:800x600-16@60
112 116
113If the EP93xx video driver is built as a module then the video mode is 117If the EP93xx video driver is built as a module then the video mode is
114set when the module is installed: 118set when the module is installed::
115 119
116 modprobe ep93xx-fb video=320x240 120 modprobe ep93xx-fb video=320x240
117 121
@@ -121,13 +125,14 @@ Screenpage bug
121 125
122At least on the EP9315 there is a silicon bug which causes bit 27 of 126At least on the EP9315 there is a silicon bug which causes bit 27 of
123the VIDSCRNPAGE (framebuffer physical offset) to be tied low. There is 127the VIDSCRNPAGE (framebuffer physical offset) to be tied low. There is
124an unofficial errata for this bug at: 128an unofficial errata for this bug at::
129
125 http://marc.info/?l=linux-arm-kernel&m=110061245502000&w=2 130 http://marc.info/?l=linux-arm-kernel&m=110061245502000&w=2
126 131
127By default the EP93xx framebuffer driver checks if the allocated physical 132By default the EP93xx framebuffer driver checks if the allocated physical
128address has bit 27 set. If it does, then the memory is freed and an 133address has bit 27 set. If it does, then the memory is freed and an
129error is returned. The check can be disabled by adding the following 134error is returned. The check can be disabled by adding the following
130option when loading the driver: 135option when loading the driver::
131 136
132 ep93xx-fb.check_screenpage_bug=0 137 ep93xx-fb.check_screenpage_bug=0
133 138
diff --git a/Documentation/fb/fbcon.txt b/Documentation/fb/fbcon.rst
index 5a865437b33f..1da65b9000de 100644
--- a/Documentation/fb/fbcon.txt
+++ b/Documentation/fb/fbcon.rst
@@ -1,39 +1,41 @@
1=======================
1The Framebuffer Console 2The Framebuffer Console
2======================= 3=======================
3 4
4 The framebuffer console (fbcon), as its name implies, is a text 5The framebuffer console (fbcon), as its name implies, is a text
5console running on top of the framebuffer device. It has the functionality of 6console running on top of the framebuffer device. It has the functionality of
6any standard text console driver, such as the VGA console, with the added 7any standard text console driver, such as the VGA console, with the added
7features that can be attributed to the graphical nature of the framebuffer. 8features that can be attributed to the graphical nature of the framebuffer.
8 9
9 In the x86 architecture, the framebuffer console is optional, and 10In the x86 architecture, the framebuffer console is optional, and
10some even treat it as a toy. For other architectures, it is the only available 11some even treat it as a toy. For other architectures, it is the only available
11display device, text or graphical. 12display device, text or graphical.
12 13
13 What are the features of fbcon? The framebuffer console supports 14What are the features of fbcon? The framebuffer console supports
14high resolutions, varying font types, display rotation, primitive multihead, 15high resolutions, varying font types, display rotation, primitive multihead,
15etc. Theoretically, multi-colored fonts, blending, aliasing, and any feature 16etc. Theoretically, multi-colored fonts, blending, aliasing, and any feature
16made available by the underlying graphics card are also possible. 17made available by the underlying graphics card are also possible.
17 18
18A. Configuration 19A. Configuration
20================
19 21
20 The framebuffer console can be enabled by using your favorite kernel 22The framebuffer console can be enabled by using your favorite kernel
21configuration tool. It is under Device Drivers->Graphics Support->Frame 23configuration tool. It is under Device Drivers->Graphics Support->Frame
22buffer Devices->Console display driver support->Framebuffer Console Support. 24buffer Devices->Console display driver support->Framebuffer Console Support.
23Select 'y' to compile support statically or 'm' for module support. The 25Select 'y' to compile support statically or 'm' for module support. The
24module will be fbcon. 26module will be fbcon.
25 27
26 In order for fbcon to activate, at least one framebuffer driver is 28In order for fbcon to activate, at least one framebuffer driver is
27required, so choose from any of the numerous drivers available. For x86 29required, so choose from any of the numerous drivers available. For x86
28systems, they almost universally have VGA cards, so vga16fb and vesafb will 30systems, they almost universally have VGA cards, so vga16fb and vesafb will
29always be available. However, using a chipset-specific driver will give you 31always be available. However, using a chipset-specific driver will give you
30more speed and features, such as the ability to change the video mode 32more speed and features, such as the ability to change the video mode
31dynamically. 33dynamically.
32 34
33 To display the penguin logo, choose any logo available in Graphics 35To display the penguin logo, choose any logo available in Graphics
34support->Bootup logo. 36support->Bootup logo.
35 37
36 Also, you will need to select at least one compiled-in font, but if 38Also, you will need to select at least one compiled-in font, but if
37you don't do anything, the kernel configuration tool will select one for you, 39you don't do anything, the kernel configuration tool will select one for you,
38usually an 8x16 font. 40usually an 8x16 font.
39 41
@@ -44,6 +46,7 @@ fortunate to have a driver that does not alter the graphics chip, then you
44will still get a VGA console. 46will still get a VGA console.
45 47
46B. Loading 48B. Loading
49==========
47 50
48Possible scenarios: 51Possible scenarios:
49 52
@@ -72,33 +75,33 @@ Possible scenarios:
72 75
73C. Boot options 76C. Boot options
74 77
75 The framebuffer console has several, largely unknown, boot options 78 The framebuffer console has several, largely unknown, boot options
76 that can change its behavior. 79 that can change its behavior.
77 80
781. fbcon=font:<name> 811. fbcon=font:<name>
79 82
80 Select the initial font to use. The value 'name' can be any of the 83 Select the initial font to use. The value 'name' can be any of the
81 compiled-in fonts: 10x18, 6x10, 7x14, Acorn8x8, MINI4x6, 84 compiled-in fonts: 10x18, 6x10, 7x14, Acorn8x8, MINI4x6,
82 PEARL8x8, ProFont6x11, SUN12x22, SUN8x16, TER16x32, VGA8x16, VGA8x8. 85 PEARL8x8, ProFont6x11, SUN12x22, SUN8x16, TER16x32, VGA8x16, VGA8x8.
83 86
84 Note, not all drivers can handle font with widths not divisible by 8, 87 Note, not all drivers can handle font with widths not divisible by 8,
85 such as vga16fb. 88 such as vga16fb.
86 89
872. fbcon=scrollback:<value>[k] 902. fbcon=scrollback:<value>[k]
88 91
89 The scrollback buffer is memory that is used to preserve display 92 The scrollback buffer is memory that is used to preserve display
90 contents that has already scrolled past your view. This is accessed 93 contents that has already scrolled past your view. This is accessed
91 by using the Shift-PageUp key combination. The value 'value' is any 94 by using the Shift-PageUp key combination. The value 'value' is any
92 integer. It defaults to 32KB. The 'k' suffix is optional, and will 95 integer. It defaults to 32KB. The 'k' suffix is optional, and will
93 multiply the 'value' by 1024. 96 multiply the 'value' by 1024.
94 97
953. fbcon=map:<0123> 983. fbcon=map:<0123>
96 99
97 This is an interesting option. It tells which driver gets mapped to 100 This is an interesting option. It tells which driver gets mapped to
98 which console. The value '0123' is a sequence that gets repeated until 101 which console. The value '0123' is a sequence that gets repeated until
99 the total length is 64 which is the number of consoles available. In 102 the total length is 64 which is the number of consoles available. In
100 the above example, it is expanded to 012301230123... and the mapping 103 the above example, it is expanded to 012301230123... and the mapping
101 will be: 104 will be::
102 105
103 tty | 1 2 3 4 5 6 7 8 9 ... 106 tty | 1 2 3 4 5 6 7 8 9 ...
104 fb | 0 1 2 3 0 1 2 3 0 ... 107 fb | 0 1 2 3 0 1 2 3 0 ...
@@ -126,20 +129,20 @@ C. Boot options
126 129
1274. fbcon=rotate:<n> 1304. fbcon=rotate:<n>
128 131
129 This option changes the orientation angle of the console display. The 132 This option changes the orientation angle of the console display. The
130 value 'n' accepts the following: 133 value 'n' accepts the following:
131 134
132 0 - normal orientation (0 degree) 135 - 0 - normal orientation (0 degree)
133 1 - clockwise orientation (90 degrees) 136 - 1 - clockwise orientation (90 degrees)
134 2 - upside down orientation (180 degrees) 137 - 2 - upside down orientation (180 degrees)
135 3 - counterclockwise orientation (270 degrees) 138 - 3 - counterclockwise orientation (270 degrees)
136 139
137 The angle can be changed anytime afterwards by 'echoing' the same 140 The angle can be changed anytime afterwards by 'echoing' the same
138 numbers to any one of the 2 attributes found in 141 numbers to any one of the 2 attributes found in
139 /sys/class/graphics/fbcon: 142 /sys/class/graphics/fbcon:
140 143
141 rotate - rotate the display of the active console 144 - rotate - rotate the display of the active console
142 rotate_all - rotate the display of all consoles 145 - rotate_all - rotate the display of all consoles
143 146
144 Console rotation will only become available if Framebuffer Console 147 Console rotation will only become available if Framebuffer Console
145 Rotation support is compiled in your kernel. 148 Rotation support is compiled in your kernel.
@@ -177,9 +180,9 @@ Before going on to how to attach, detach and unload the framebuffer console, an
177illustration of the dependencies may help. 180illustration of the dependencies may help.
178 181
179The console layer, as with most subsystems, needs a driver that interfaces with 182The console layer, as with most subsystems, needs a driver that interfaces with
180the hardware. Thus, in a VGA console: 183the hardware. Thus, in a VGA console::
181 184
182console ---> VGA driver ---> hardware. 185 console ---> VGA driver ---> hardware.
183 186
184Assuming the VGA driver can be unloaded, one must first unbind the VGA driver 187Assuming the VGA driver can be unloaded, one must first unbind the VGA driver
185from the console layer before unloading the driver. The VGA driver cannot be 188from the console layer before unloading the driver. The VGA driver cannot be
@@ -187,9 +190,9 @@ unloaded if it is still bound to the console layer. (See
187Documentation/console/console.txt for more information). 190Documentation/console/console.txt for more information).
188 191
189This is more complicated in the case of the framebuffer console (fbcon), 192This is more complicated in the case of the framebuffer console (fbcon),
190because fbcon is an intermediate layer between the console and the drivers: 193because fbcon is an intermediate layer between the console and the drivers::
191 194
192console ---> fbcon ---> fbdev drivers ---> hardware 195 console ---> fbcon ---> fbdev drivers ---> hardware
193 196
194The fbdev drivers cannot be unloaded if bound to fbcon, and fbcon cannot 197The fbdev drivers cannot be unloaded if bound to fbcon, and fbcon cannot
195be unloaded if it's bound to the console layer. 198be unloaded if it's bound to the console layer.
@@ -204,12 +207,12 @@ So, how do we unbind fbcon from the console? Part of the answer is in
204Documentation/console/console.txt. To summarize: 207Documentation/console/console.txt. To summarize:
205 208
206Echo a value to the bind file that represents the framebuffer console 209Echo a value to the bind file that represents the framebuffer console
207driver. So assuming vtcon1 represents fbcon, then: 210driver. So assuming vtcon1 represents fbcon, then::
208 211
209echo 1 > sys/class/vtconsole/vtcon1/bind - attach framebuffer console to 212 echo 1 > sys/class/vtconsole/vtcon1/bind - attach framebuffer console to
210 console layer 213 console layer
211echo 0 > sys/class/vtconsole/vtcon1/bind - detach framebuffer console from 214 echo 0 > sys/class/vtconsole/vtcon1/bind - detach framebuffer console from
212 console layer 215 console layer
213 216
214If fbcon is detached from the console layer, your boot console driver (which is 217If fbcon is detached from the console layer, your boot console driver (which is
215usually VGA text mode) will take over. A few drivers (rivafb and i810fb) will 218usually VGA text mode) will take over. A few drivers (rivafb and i810fb) will
@@ -223,19 +226,19 @@ restored properly. The following is one of the several methods that you can do:
2232. In your kernel configuration, ensure that CONFIG_FRAMEBUFFER_CONSOLE is set 2262. In your kernel configuration, ensure that CONFIG_FRAMEBUFFER_CONSOLE is set
224 to 'y' or 'm'. Enable one or more of your favorite framebuffer drivers. 227 to 'y' or 'm'. Enable one or more of your favorite framebuffer drivers.
225 228
2263. Boot into text mode and as root run: 2293. Boot into text mode and as root run::
227 230
228 vbetool vbestate save > <vga state file> 231 vbetool vbestate save > <vga state file>
229 232
230 The above command saves the register contents of your graphics 233 The above command saves the register contents of your graphics
231 hardware to <vga state file>. You need to do this step only once as 234 hardware to <vga state file>. You need to do this step only once as
232 the state file can be reused. 235 the state file can be reused.
233 236
2344. If fbcon is compiled as a module, load fbcon by doing: 2374. If fbcon is compiled as a module, load fbcon by doing::
235 238
236 modprobe fbcon 239 modprobe fbcon
237 240
2385. Now to detach fbcon: 2415. Now to detach fbcon::
239 242
240 vbetool vbestate restore < <vga state file> && \ 243 vbetool vbestate restore < <vga state file> && \
241 echo 0 > /sys/class/vtconsole/vtcon1/bind 244 echo 0 > /sys/class/vtconsole/vtcon1/bind
@@ -243,7 +246,7 @@ restored properly. The following is one of the several methods that you can do:
2436. That's it, you're back to VGA mode. And if you compiled fbcon as a module, 2466. That's it, you're back to VGA mode. And if you compiled fbcon as a module,
244 you can unload it by 'rmmod fbcon'. 247 you can unload it by 'rmmod fbcon'.
245 248
2467. To reattach fbcon: 2497. To reattach fbcon::
247 250
248 echo 1 > /sys/class/vtconsole/vtcon1/bind 251 echo 1 > /sys/class/vtconsole/vtcon1/bind
249 252
@@ -266,82 +269,82 @@ the following:
266 269
267Variation 1: 270Variation 1:
268 271
269 a. Before detaching fbcon, do 272 a. Before detaching fbcon, do::
270 273
271 vbetool vbemode save > <vesa state file> # do once for each vesafb mode, 274 vbetool vbemode save > <vesa state file> # do once for each vesafb mode,
272 # the file can be reused 275 # the file can be reused
273 276
274 b. Detach fbcon as in step 5. 277 b. Detach fbcon as in step 5.
275 278
276 c. Attach fbcon 279 c. Attach fbcon::
277 280
278 vbetool vbestate restore < <vesa state file> && \ 281 vbetool vbestate restore < <vesa state file> && \
279 echo 1 > /sys/class/vtconsole/vtcon1/bind 282 echo 1 > /sys/class/vtconsole/vtcon1/bind
280 283
281Variation 2: 284Variation 2:
282 285
283 a. Before detaching fbcon, do: 286 a. Before detaching fbcon, do::
284 echo <ID> > /sys/class/tty/console/bind
285 287
288 echo <ID> > /sys/class/tty/console/bind
286 289
287 vbetool vbemode get 290 vbetool vbemode get
288 291
289 b. Take note of the mode number 292 b. Take note of the mode number
290 293
291 b. Detach fbcon as in step 5. 294 b. Detach fbcon as in step 5.
292 295
293 c. Attach fbcon: 296 c. Attach fbcon::
294 297
295 vbetool vbemode set <mode number> && \ 298 vbetool vbemode set <mode number> && \
296 echo 1 > /sys/class/vtconsole/vtcon1/bind 299 echo 1 > /sys/class/vtconsole/vtcon1/bind
297 300
298Samples: 301Samples:
299======== 302========
300 303
301Here are 2 sample bash scripts that you can use to bind or unbind the 304Here are 2 sample bash scripts that you can use to bind or unbind the
302framebuffer console driver if you are on an X86 box: 305framebuffer console driver if you are on an X86 box::
303 306
304--------------------------------------------------------------------------- 307 #!/bin/bash
305#!/bin/bash 308 # Unbind fbcon
306# Unbind fbcon
307 309
308# Change this to where your actual vgastate file is located 310 # Change this to where your actual vgastate file is located
309# Or Use VGASTATE=$1 to indicate the state file at runtime 311 # Or Use VGASTATE=$1 to indicate the state file at runtime
310VGASTATE=/tmp/vgastate 312 VGASTATE=/tmp/vgastate
311 313
312# path to vbetool 314 # path to vbetool
313VBETOOL=/usr/local/bin 315 VBETOOL=/usr/local/bin
314 316
315 317
316for (( i = 0; i < 16; i++)) 318 for (( i = 0; i < 16; i++))
317do 319 do
318 if test -x /sys/class/vtconsole/vtcon$i; then 320 if test -x /sys/class/vtconsole/vtcon$i; then
319 if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \ 321 if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \
320 = 1 ]; then 322 = 1 ]; then
321 if test -x $VBETOOL/vbetool; then 323 if test -x $VBETOOL/vbetool; then
322 echo Unbinding vtcon$i 324 echo Unbinding vtcon$i
323 $VBETOOL/vbetool vbestate restore < $VGASTATE 325 $VBETOOL/vbetool vbestate restore < $VGASTATE
324 echo 0 > /sys/class/vtconsole/vtcon$i/bind 326 echo 0 > /sys/class/vtconsole/vtcon$i/bind
325 fi 327 fi
326 fi 328 fi
327 fi 329 fi
328done 330 done
329 331
330--------------------------------------------------------------------------- 332---------------------------------------------------------------------------
331#!/bin/bash 333
332# Bind fbcon 334::
333 335
334for (( i = 0; i < 16; i++)) 336 #!/bin/bash
335do 337 # Bind fbcon
336 if test -x /sys/class/vtconsole/vtcon$i; then 338
337 if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \ 339 for (( i = 0; i < 16; i++))
338 = 1 ]; then 340 do
341 if test -x /sys/class/vtconsole/vtcon$i; then
342 if [ `cat /sys/class/vtconsole/vtcon$i/name | grep -c "frame buffer"` \
343 = 1 ]; then
339 echo Unbinding vtcon$i 344 echo Unbinding vtcon$i
340 echo 1 > /sys/class/vtconsole/vtcon$i/bind 345 echo 1 > /sys/class/vtconsole/vtcon$i/bind
341 fi 346 fi
342 fi 347 fi
343done 348 done
344---------------------------------------------------------------------------
345 349
346--
347Antonino Daplas <adaplas@pol.net> 350Antonino Daplas <adaplas@pol.net>
diff --git a/Documentation/fb/framebuffer.txt b/Documentation/fb/framebuffer.rst
index 58c5ae2e9f59..7fe087310c82 100644
--- a/Documentation/fb/framebuffer.txt
+++ b/Documentation/fb/framebuffer.rst
@@ -1,7 +1,7 @@
1 The Frame Buffer Device 1=======================
2 ----------------------- 2The Frame Buffer Device
3=======================
3 4
4Maintained by Geert Uytterhoeven <geert@linux-m68k.org>
5Last revised: May 10, 2001 5Last revised: May 10, 2001
6 6
7 7
@@ -26,7 +26,7 @@ other device in /dev. It's a character device using major 29; the minor
26specifies the frame buffer number. 26specifies the frame buffer number.
27 27
28By convention, the following device nodes are used (numbers indicate the device 28By convention, the following device nodes are used (numbers indicate the device
29minor numbers): 29minor numbers)::
30 30
31 0 = /dev/fb0 First frame buffer 31 0 = /dev/fb0 First frame buffer
32 1 = /dev/fb1 Second frame buffer 32 1 = /dev/fb1 Second frame buffer
@@ -34,15 +34,15 @@ minor numbers):
34 31 = /dev/fb31 32nd frame buffer 34 31 = /dev/fb31 32nd frame buffer
35 35
36For backwards compatibility, you may want to create the following symbolic 36For backwards compatibility, you may want to create the following symbolic
37links: 37links::
38 38
39 /dev/fb0current -> fb0 39 /dev/fb0current -> fb0
40 /dev/fb1current -> fb1 40 /dev/fb1current -> fb1
41 41
42and so on... 42and so on...
43 43
44The frame buffer devices are also `normal' memory devices, this means, you can 44The frame buffer devices are also `normal` memory devices, this means, you can
45read and write their contents. You can, for example, make a screen snapshot by 45read and write their contents. You can, for example, make a screen snapshot by::
46 46
47 cp /dev/fb0 myfile 47 cp /dev/fb0 myfile
48 48
@@ -54,11 +54,11 @@ Application software that uses the frame buffer device (e.g. the X server) will
54use /dev/fb0 by default (older software uses /dev/fb0current). You can specify 54use /dev/fb0 by default (older software uses /dev/fb0current). You can specify
55an alternative frame buffer device by setting the environment variable 55an alternative frame buffer device by setting the environment variable
56$FRAMEBUFFER to the path name of a frame buffer device, e.g. (for sh/bash 56$FRAMEBUFFER to the path name of a frame buffer device, e.g. (for sh/bash
57users): 57users)::
58 58
59 export FRAMEBUFFER=/dev/fb1 59 export FRAMEBUFFER=/dev/fb1
60 60
61or (for csh users): 61or (for csh users)::
62 62
63 setenv FRAMEBUFFER /dev/fb1 63 setenv FRAMEBUFFER /dev/fb1
64 64
@@ -90,9 +90,9 @@ which data structures they work. Here's just a brief overview:
90 possible). 90 possible).
91 91
92 - You can get and set parts of the color map. Communication is done with 16 92 - You can get and set parts of the color map. Communication is done with 16
93 bits per color part (red, green, blue, transparency) to support all 93 bits per color part (red, green, blue, transparency) to support all
94 existing hardware. The driver does all the computations needed to apply 94 existing hardware. The driver does all the computations needed to apply
95 it to the hardware (round it down to less bits, maybe throw away 95 it to the hardware (round it down to less bits, maybe throw away
96 transparency). 96 transparency).
97 97
98All this hardware abstraction makes the implementation of application programs 98All this hardware abstraction makes the implementation of application programs
@@ -113,10 +113,10 @@ much trouble...
1133. Frame Buffer Resolution Maintenance 1133. Frame Buffer Resolution Maintenance
114-------------------------------------- 114--------------------------------------
115 115
116Frame buffer resolutions are maintained using the utility `fbset'. It can 116Frame buffer resolutions are maintained using the utility `fbset`. It can
117change the video mode properties of a frame buffer device. Its main usage is 117change the video mode properties of a frame buffer device. Its main usage is
118to change the current video mode, e.g. during boot up in one of your /etc/rc.* 118to change the current video mode, e.g. during boot up in one of your `/etc/rc.*`
119or /etc/init.d/* files. 119or `/etc/init.d/*` files.
120 120
121Fbset uses a video mode database stored in a configuration file, so you can 121Fbset uses a video mode database stored in a configuration file, so you can
122easily add your own modes and refer to them with a simple identifier. 122easily add your own modes and refer to them with a simple identifier.
@@ -129,8 +129,8 @@ The X server (XF68_FBDev) is the most notable application program for the frame
129buffer device. Starting with XFree86 release 3.2, the X server is part of 129buffer device. Starting with XFree86 release 3.2, the X server is part of
130XFree86 and has 2 modes: 130XFree86 and has 2 modes:
131 131
132 - If the `Display' subsection for the `fbdev' driver in the /etc/XF86Config 132 - If the `Display` subsection for the `fbdev` driver in the /etc/XF86Config
133 file contains a 133 file contains a::
134 134
135 Modes "default" 135 Modes "default"
136 136
@@ -146,7 +146,7 @@ XFree86 and has 2 modes:
146 same virtual desktop size. The frame buffer device that's used is still 146 same virtual desktop size. The frame buffer device that's used is still
147 /dev/fb0current (or $FRAMEBUFFER), but the available resolutions are 147 /dev/fb0current (or $FRAMEBUFFER), but the available resolutions are
148 defined by /etc/XF86Config now. The disadvantage is that you have to 148 defined by /etc/XF86Config now. The disadvantage is that you have to
149 specify the timings in a different format (but `fbset -x' may help). 149 specify the timings in a different format (but `fbset -x` may help).
150 150
151To tune a video mode, you can use fbset or xvidtune. Note that xvidtune doesn't 151To tune a video mode, you can use fbset or xvidtune. Note that xvidtune doesn't
152work 100% with XF68_FBDev: the reported clock values are always incorrect. 152work 100% with XF68_FBDev: the reported clock values are always incorrect.
@@ -172,29 +172,29 @@ retrace, the electron beam is turned off (blanked).
172 172
173The speed at which the electron beam paints the pixels is determined by the 173The speed at which the electron beam paints the pixels is determined by the
174dotclock in the graphics board. For a dotclock of e.g. 28.37516 MHz (millions 174dotclock in the graphics board. For a dotclock of e.g. 28.37516 MHz (millions
175of cycles per second), each pixel is 35242 ps (picoseconds) long: 175of cycles per second), each pixel is 35242 ps (picoseconds) long::
176 176
177 1/(28.37516E6 Hz) = 35.242E-9 s 177 1/(28.37516E6 Hz) = 35.242E-9 s
178 178
179If the screen resolution is 640x480, it will take 179If the screen resolution is 640x480, it will take::
180 180
181 640*35.242E-9 s = 22.555E-6 s 181 640*35.242E-9 s = 22.555E-6 s
182 182
183to paint the 640 (xres) pixels on one scanline. But the horizontal retrace 183to paint the 640 (xres) pixels on one scanline. But the horizontal retrace
184also takes time (e.g. 272 `pixels'), so a full scanline takes 184also takes time (e.g. 272 `pixels`), so a full scanline takes::
185 185
186 (640+272)*35.242E-9 s = 32.141E-6 s 186 (640+272)*35.242E-9 s = 32.141E-6 s
187 187
188We'll say that the horizontal scanrate is about 31 kHz: 188We'll say that the horizontal scanrate is about 31 kHz::
189 189
190 1/(32.141E-6 s) = 31.113E3 Hz 190 1/(32.141E-6 s) = 31.113E3 Hz
191 191
192A full screen counts 480 (yres) lines, but we have to consider the vertical 192A full screen counts 480 (yres) lines, but we have to consider the vertical
193retrace too (e.g. 49 `lines'). So a full screen will take 193retrace too (e.g. 49 `lines`). So a full screen will take::
194 194
195 (480+49)*32.141E-6 s = 17.002E-3 s 195 (480+49)*32.141E-6 s = 17.002E-3 s
196 196
197The vertical scanrate is about 59 Hz: 197The vertical scanrate is about 59 Hz::
198 198
199 1/(17.002E-3 s) = 58.815 Hz 199 1/(17.002E-3 s) = 58.815 Hz
200 200
@@ -212,7 +212,7 @@ influenced by the moments at which the synchronization pulses occur.
212The following picture summarizes all timings. The horizontal retrace time is 212The following picture summarizes all timings. The horizontal retrace time is
213the sum of the left margin, the right margin and the hsync length, while the 213the sum of the left margin, the right margin and the hsync length, while the
214vertical retrace time is the sum of the upper margin, the lower margin and the 214vertical retrace time is the sum of the upper margin, the lower margin and the
215vsync length. 215vsync length::
216 216
217 +----------+---------------------------------------------+----------+-------+ 217 +----------+---------------------------------------------+----------+-------+
218 | | ↑ | | | 218 | | ↑ | | |
@@ -256,7 +256,8 @@ The frame buffer device expects all horizontal timings in number of dotclocks
2566. Converting XFree86 timing values info frame buffer device timings 2566. Converting XFree86 timing values info frame buffer device timings
257-------------------------------------------------------------------- 257--------------------------------------------------------------------
258 258
259An XFree86 mode line consists of the following fields: 259An XFree86 mode line consists of the following fields::
260
260 "800x600" 50 800 856 976 1040 600 637 643 666 261 "800x600" 50 800 856 976 1040 600 637 643 666
261 < name > DCF HR SH1 SH2 HFL VR SV1 SV2 VFL 262 < name > DCF HR SH1 SH2 HFL VR SV1 SV2 VFL
262 263
@@ -271,19 +272,27 @@ The frame buffer device uses the following fields:
271 - vsync_len: length of vertical sync 272 - vsync_len: length of vertical sync
272 273
2731) Pixelclock: 2741) Pixelclock:
275
274 xfree: in MHz 276 xfree: in MHz
277
275 fb: in picoseconds (ps) 278 fb: in picoseconds (ps)
276 279
277 pixclock = 1000000 / DCF 280 pixclock = 1000000 / DCF
278 281
2792) horizontal timings: 2822) horizontal timings:
283
280 left_margin = HFL - SH2 284 left_margin = HFL - SH2
285
281 right_margin = SH1 - HR 286 right_margin = SH1 - HR
287
282 hsync_len = SH2 - SH1 288 hsync_len = SH2 - SH1
283 289
2843) vertical timings: 2903) vertical timings:
291
285 upper_margin = VFL - SV2 292 upper_margin = VFL - SV2
293
286 lower_margin = SV1 - VR 294 lower_margin = SV1 - VR
295
287 vsync_len = SV2 - SV1 296 vsync_len = SV2 - SV1
288 297
289Good examples for VESA timings can be found in the XFree86 source tree, 298Good examples for VESA timings can be found in the XFree86 source tree,
@@ -303,9 +312,10 @@ and to the following documentation:
303 - The manual pages for fbset: fbset(8), fb.modes(5) 312 - The manual pages for fbset: fbset(8), fb.modes(5)
304 - The manual pages for XFree86: XF68_FBDev(1), XF86Config(4/5) 313 - The manual pages for XFree86: XF68_FBDev(1), XF86Config(4/5)
305 - The mighty kernel sources: 314 - The mighty kernel sources:
306 o linux/drivers/video/ 315
307 o linux/include/linux/fb.h 316 - linux/drivers/video/
308 o linux/include/video/ 317 - linux/include/linux/fb.h
318 - linux/include/video/
309 319
310 320
311 321
@@ -330,14 +340,14 @@ and on its mirrors.
330 340
331The latest version of fbset can be found at 341The latest version of fbset can be found at
332 342
333 http://www.linux-fbdev.org/ 343 http://www.linux-fbdev.org/
344
345
34610. Credits
347-----------
334 348
335
33610. Credits
337----------
338
339This readme was written by Geert Uytterhoeven, partly based on the original 349This readme was written by Geert Uytterhoeven, partly based on the original
340`X-framebuffer.README' by Roman Hodek and Martin Schaller. Section 6 was 350`X-framebuffer.README` by Roman Hodek and Martin Schaller. Section 6 was
341provided by Frank Neumann. 351provided by Frank Neumann.
342 352
343The frame buffer device abstraction was designed by Martin Schaller. 353The frame buffer device abstraction was designed by Martin Schaller.
diff --git a/Documentation/fb/gxfb.txt b/Documentation/fb/gxfb.rst
index 2f640903bbb2..5738709bccbb 100644
--- a/Documentation/fb/gxfb.txt
+++ b/Documentation/fb/gxfb.rst
@@ -1,7 +1,8 @@
1[This file is cloned from VesaFB/aty128fb] 1=============
2
3What is gxfb? 2What is gxfb?
4================= 3=============
4
5.. [This file is cloned from VesaFB/aty128fb]
5 6
6This is a graphics framebuffer driver for AMD Geode GX2 based processors. 7This is a graphics framebuffer driver for AMD Geode GX2 based processors.
7 8
@@ -23,9 +24,9 @@ How to use it?
23============== 24==============
24 25
25Switching modes is done using gxfb.mode_option=<resolution>... boot 26Switching modes is done using gxfb.mode_option=<resolution>... boot
26parameter or using `fbset' program. 27parameter or using `fbset` program.
27 28
28See Documentation/fb/modedb.txt for more information on modedb 29See Documentation/fb/modedb.rst for more information on modedb
29resolutions. 30resolutions.
30 31
31 32
@@ -42,11 +43,12 @@ You can pass kernel command line options to gxfb with gxfb.<option>.
42For example, gxfb.mode_option=800x600@75. 43For example, gxfb.mode_option=800x600@75.
43Accepted options: 44Accepted options:
44 45
45mode_option - specify the video mode. Of the form 46================ ==================================================
46 <x>x<y>[-<bpp>][@<refresh>] 47mode_option specify the video mode. Of the form
47vram - size of video ram (normally auto-detected) 48 <x>x<y>[-<bpp>][@<refresh>]
48vt_switch - enable vt switching during suspend/resume. The vt 49vram size of video ram (normally auto-detected)
49 switch is slow, but harmless. 50vt_switch enable vt switching during suspend/resume. The vt
51 switch is slow, but harmless.
52================ ==================================================
50 53
51--
52Andres Salomon <dilinger@debian.org> 54Andres Salomon <dilinger@debian.org>
diff --git a/Documentation/fb/index.rst b/Documentation/fb/index.rst
new file mode 100644
index 000000000000..d47313714635
--- /dev/null
+++ b/Documentation/fb/index.rst
@@ -0,0 +1,50 @@
1:orphan:
2
3============
4Frame Buffer
5============
6
7.. toctree::
8 :maxdepth: 1
9
10 api
11 arkfb
12 aty128fb
13 cirrusfb
14 cmap_xfbdev
15 deferred_io
16 efifb
17 ep93xx-fb
18 fbcon
19 framebuffer
20 gxfb
21 intel810
22 intelfb
23 internals
24 lxfb
25 matroxfb
26 metronomefb
27 modedb
28 pvr2fb
29 pxafb
30 s3fb
31 sa1100fb
32 sh7760fb
33 sisfb
34 sm501
35 sm712fb
36 sstfb
37 tgafb
38 tridentfb
39 udlfb
40 uvesafb
41 vesafb
42 viafb
43 vt8623fb
44
45.. only:: subproject and html
46
47 Indices
48 =======
49
50 * :ref:`genindex`
diff --git a/Documentation/fb/intel810.txt b/Documentation/fb/intel810.rst
index a8e9f5bca6f3..eb86098db91f 100644
--- a/Documentation/fb/intel810.txt
+++ b/Documentation/fb/intel810.rst
@@ -1,26 +1,31 @@
1================================
1Intel 810/815 Framebuffer driver 2Intel 810/815 Framebuffer driver
2 Tony Daplas <adaplas@pol.net> 3================================
3 http://i810fb.sourceforge.net
4 4
5 March 17, 2002 5Tony Daplas <adaplas@pol.net>
6 6
7 First Released: July 2001 7http://i810fb.sourceforge.net
8 Last Update: September 12, 2005 8
9================================================================ 9March 17, 2002
10
11First Released: July 2001
12Last Update: September 12, 2005
10 13
11A. Introduction 14A. Introduction
15===============
12 16
13 This is a framebuffer driver for various Intel 810/815 compatible 17 This is a framebuffer driver for various Intel 810/815 compatible
14 graphics devices. These include: 18 graphics devices. These include:
15 19
16 Intel 810 20 - Intel 810
17 Intel 810E 21 - Intel 810E
18 Intel 810-DC100 22 - Intel 810-DC100
19 Intel 815 Internal graphics only, 100Mhz FSB 23 - Intel 815 Internal graphics only, 100Mhz FSB
20 Intel 815 Internal graphics only 24 - Intel 815 Internal graphics only
21 Intel 815 Internal graphics and AGP 25 - Intel 815 Internal graphics and AGP
22 26
23B. Features 27B. Features
28============
24 29
25 - Choice of using Discrete Video Timings, VESA Generalized Timing 30 - Choice of using Discrete Video Timings, VESA Generalized Timing
26 Formula, or a framebuffer specific database to set the video mode 31 Formula, or a framebuffer specific database to set the video mode
@@ -45,10 +50,11 @@ B. Features
45 - Can concurrently run with xfree86 running with native i810 drivers 50 - Can concurrently run with xfree86 running with native i810 drivers
46 51
47 - Hardware Cursor Support 52 - Hardware Cursor Support
48 53
49 - Supports EDID probing either by DDC/I2C or through the BIOS 54 - Supports EDID probing either by DDC/I2C or through the BIOS
50 55
51C. List of available options 56C. List of available options
57=============================
52 58
53 a. "video=i810fb" 59 a. "video=i810fb"
54 enables the i810 driver 60 enables the i810 driver
@@ -158,7 +164,7 @@ C. List of available options
158 (default = not set) 164 (default = not set)
159 165
160 n. "dcolor" 166 n. "dcolor"
161 Use directcolor visual instead of truecolor for pixel depths greater 167 Use directcolor visual instead of truecolor for pixel depths greater
162 than 8 bpp. Useful for color tuning, such as gamma control. 168 than 8 bpp. Useful for color tuning, such as gamma control.
163 169
164 Recommendation: do not set 170 Recommendation: do not set
@@ -167,35 +173,37 @@ C. List of available options
167 o. <xres>x<yres>[-<bpp>][@<refresh>] 173 o. <xres>x<yres>[-<bpp>][@<refresh>]
168 The driver will now accept specification of boot mode option. If this 174 The driver will now accept specification of boot mode option. If this
169 is specified, the options 'xres' and 'yres' will be ignored. See 175 is specified, the options 'xres' and 'yres' will be ignored. See
170 Documentation/fb/modedb.txt for usage. 176 Documentation/fb/modedb.rst for usage.
171 177
172D. Kernel booting 178D. Kernel booting
179=================
173 180
174Separate each option/option-pair by commas (,) and the option from its value 181Separate each option/option-pair by commas (,) and the option from its value
175with a colon (:) as in the following: 182with a colon (:) as in the following::
176 183
177video=i810fb:option1,option2:value2 184 video=i810fb:option1,option2:value2
178 185
179Sample Usage 186Sample Usage
180------------ 187------------
181 188
182In /etc/lilo.conf, add the line: 189In /etc/lilo.conf, add the line::
183 190
184append="video=i810fb:vram:2,xres:1024,yres:768,bpp:8,hsync1:30,hsync2:55, \ 191 append="video=i810fb:vram:2,xres:1024,yres:768,bpp:8,hsync1:30,hsync2:55, \
185 vsync1:50,vsync2:85,accel,mtrr" 192 vsync1:50,vsync2:85,accel,mtrr"
186 193
187This will initialize the framebuffer to 1024x768 at 8bpp. The framebuffer 194This will initialize the framebuffer to 1024x768 at 8bpp. The framebuffer
188will use 2 MB of System RAM. MTRR support will be enabled. The refresh rate 195will use 2 MB of System RAM. MTRR support will be enabled. The refresh rate
189will be computed based on the hsync1/hsync2 and vsync1/vsync2 values. 196will be computed based on the hsync1/hsync2 and vsync1/vsync2 values.
190 197
191IMPORTANT: 198IMPORTANT:
192You must include hsync1, hsync2, vsync1 and vsync2 to enable video modes 199 You must include hsync1, hsync2, vsync1 and vsync2 to enable video modes
193better than 640x480 at 60Hz. HOWEVER, if your chipset/display combination 200 better than 640x480 at 60Hz. HOWEVER, if your chipset/display combination
194supports I2C and has an EDID block, you can safely exclude hsync1, hsync2, 201 supports I2C and has an EDID block, you can safely exclude hsync1, hsync2,
195vsync1 and vsync2 parameters. These parameters will be taken from the EDID 202 vsync1 and vsync2 parameters. These parameters will be taken from the EDID
196block. 203 block.
197 204
198E. Module options 205E. Module options
206==================
199 207
200The module parameters are essentially similar to the kernel 208The module parameters are essentially similar to the kernel
201parameters. The main difference is that you need to include a Boolean value 209parameters. The main difference is that you need to include a Boolean value
@@ -206,31 +214,32 @@ Example, to enable MTRR, include "mtrr=1".
206Sample Usage 214Sample Usage
207------------ 215------------
208 216
209Using the same setup as described above, load the module like this: 217Using the same setup as described above, load the module like this::
210 218
211 modprobe i810fb vram=2 xres=1024 bpp=8 hsync1=30 hsync2=55 vsync1=50 \ 219 modprobe i810fb vram=2 xres=1024 bpp=8 hsync1=30 hsync2=55 vsync1=50 \
212 vsync2=85 accel=1 mtrr=1 220 vsync2=85 accel=1 mtrr=1
213 221
214Or just add the following to a configuration file in /etc/modprobe.d/ 222Or just add the following to a configuration file in /etc/modprobe.d/::
215 223
216 options i810fb vram=2 xres=1024 bpp=16 hsync1=30 hsync2=55 vsync1=50 \ 224 options i810fb vram=2 xres=1024 bpp=16 hsync1=30 hsync2=55 vsync1=50 \
217 vsync2=85 accel=1 mtrr=1 225 vsync2=85 accel=1 mtrr=1
218 226
219and just do a 227and just do a::
220 228
221 modprobe i810fb 229 modprobe i810fb
222 230
223 231
224F. Setup 232F. Setup
233=========
225 234
226 a. Do your usual method of configuring the kernel. 235 a. Do your usual method of configuring the kernel
227 236
228 make menuconfig/xconfig/config 237 make menuconfig/xconfig/config
229 238
230 b. Under "Code maturity level options" enable "Prompt for development 239 b. Under "Code maturity level options" enable "Prompt for development
231 and/or incomplete code/drivers". 240 and/or incomplete code/drivers".
232 241
233 c. Enable agpgart support for the Intel 810/815 on-board graphics. 242 c. Enable agpgart support for the Intel 810/815 on-board graphics.
234 This is required. The option is under "Character Devices". 243 This is required. The option is under "Character Devices".
235 244
236 d. Under "Graphics Support", select "Intel 810/815" either statically 245 d. Under "Graphics Support", select "Intel 810/815" either statically
@@ -242,7 +251,7 @@ F. Setup
242 set 'Enable DDC Support' to 'y'. To make this option appear, set 251 set 'Enable DDC Support' to 'y'. To make this option appear, set
243 'use VESA Generalized Timing Formula' to 'y'. 252 'use VESA Generalized Timing Formula' to 'y'.
244 253
245 f. If you want a framebuffer console, enable it under "Console 254 f. If you want a framebuffer console, enable it under "Console
246 Drivers". 255 Drivers".
247 256
248 g. Compile your kernel. 257 g. Compile your kernel.
@@ -253,6 +262,7 @@ F. Setup
253 patch to see the chipset in action (or inaction :-). 262 patch to see the chipset in action (or inaction :-).
254 263
255G. Acknowledgment: 264G. Acknowledgment:
265===================
256 266
257 1. Geert Uytterhoeven - his excellent howto and the virtual 267 1. Geert Uytterhoeven - his excellent howto and the virtual
258 framebuffer driver code made this possible. 268 framebuffer driver code made this possible.
@@ -269,10 +279,9 @@ G. Acknowledgment:
269 optimizations possible. 279 optimizations possible.
270 280
271H. Home Page: 281H. Home Page:
282==============
272 283
273 A more complete, and probably updated information is provided at 284 A more complete, and probably updated information is provided at
274 http://i810fb.sourceforge.net. 285 http://i810fb.sourceforge.net.
275 286
276###########################
277Tony 287Tony
278
diff --git a/Documentation/fb/intelfb.txt b/Documentation/fb/intelfb.rst
index feac4e4d6968..e2d0903f4efb 100644
--- a/Documentation/fb/intelfb.txt
+++ b/Documentation/fb/intelfb.rst
@@ -1,24 +1,28 @@
1=============================================================
1Intel 830M/845G/852GM/855GM/865G/915G/945G Framebuffer driver 2Intel 830M/845G/852GM/855GM/865G/915G/945G Framebuffer driver
2================================================================ 3=============================================================
3 4
4A. Introduction 5A. Introduction
5 This is a framebuffer driver for various Intel 8xx/9xx compatible 6===============
7
8This is a framebuffer driver for various Intel 8xx/9xx compatible
6graphics devices. These would include: 9graphics devices. These would include:
7 10
8 Intel 830M 11 - Intel 830M
9 Intel 845G 12 - Intel 845G
10 Intel 852GM 13 - Intel 852GM
11 Intel 855GM 14 - Intel 855GM
12 Intel 865G 15 - Intel 865G
13 Intel 915G 16 - Intel 915G
14 Intel 915GM 17 - Intel 915GM
15 Intel 945G 18 - Intel 945G
16 Intel 945GM 19 - Intel 945GM
17 Intel 945GME 20 - Intel 945GME
18 Intel 965G 21 - Intel 965G
19 Intel 965GM 22 - Intel 965GM
20 23
21B. List of available options 24B. List of available options
25=============================
22 26
23 a. "video=intelfb" 27 a. "video=intelfb"
24 enables the intelfb driver 28 enables the intelfb driver
@@ -39,12 +43,12 @@ B. List of available options
39 (default = 4 MB) 43 (default = 4 MB)
40 44
41 d. "voffset=<value>" 45 d. "voffset=<value>"
42 select at what offset in MB of the logical memory to allocate the 46 select at what offset in MB of the logical memory to allocate the
43 framebuffer memory. The intent is to avoid the memory blocks 47 framebuffer memory. The intent is to avoid the memory blocks
44 used by standard graphics applications (XFree86). Depending on your 48 used by standard graphics applications (XFree86). Depending on your
45 usage, adjust the value up or down, (0 for maximum usage, 63/127 MB 49 usage, adjust the value up or down, (0 for maximum usage, 63/127 MB
46 for the least amount). Note, an arbitrary setting may conflict 50 for the least amount). Note, an arbitrary setting may conflict
47 with XFree86. 51 with XFree86.
48 52
49 Recommendation: do not set 53 Recommendation: do not set
50 (default = 48 MB) 54 (default = 48 MB)
@@ -80,18 +84,19 @@ B. List of available options
80 The default parameter (not named) is the mode. 84 The default parameter (not named) is the mode.
81 85
82C. Kernel booting 86C. Kernel booting
87=================
83 88
84Separate each option/option-pair by commas (,) and the option from its value 89Separate each option/option-pair by commas (,) and the option from its value
85with an equals sign (=) as in the following: 90with an equals sign (=) as in the following::
86 91
87video=intelfb:option1,option2=value2 92 video=intelfb:option1,option2=value2
88 93
89Sample Usage 94Sample Usage
90------------ 95------------
91 96
92In /etc/lilo.conf, add the line: 97In /etc/lilo.conf, add the line::
93 98
94append="video=intelfb:mode=800x600-32@75,accel,hwcursor,vram=8" 99 append="video=intelfb:mode=800x600-32@75,accel,hwcursor,vram=8"
95 100
96This will initialize the framebuffer to 800x600 at 32bpp and 75Hz. The 101This will initialize the framebuffer to 800x600 at 32bpp and 75Hz. The
97framebuffer will use 8 MB of System RAM. hw acceleration of text and cursor 102framebuffer will use 8 MB of System RAM. hw acceleration of text and cursor
@@ -106,8 +111,9 @@ in this directory.
106 111
107 112
108D. Module options 113D. Module options
114==================
109 115
110 The module parameters are essentially similar to the kernel 116The module parameters are essentially similar to the kernel
111parameters. The main difference is that you need to include a Boolean value 117parameters. The main difference is that you need to include a Boolean value
112(1 for TRUE, and 0 for FALSE) for those options which don't need a value. 118(1 for TRUE, and 0 for FALSE) for those options which don't need a value.
113 119
@@ -116,23 +122,24 @@ Example, to enable MTRR, include "mtrr=1".
116Sample Usage 122Sample Usage
117------------ 123------------
118 124
119Using the same setup as described above, load the module like this: 125Using the same setup as described above, load the module like this::
120 126
121 modprobe intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1 127 modprobe intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1
122 128
123Or just add the following to a configuration file in /etc/modprobe.d/ 129Or just add the following to a configuration file in /etc/modprobe.d/::
124 130
125 options intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1 131 options intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1
126 132
127and just do a 133and just do a::
128 134
129 modprobe intelfb 135 modprobe intelfb
130 136
131 137
132E. Acknowledgment: 138E. Acknowledgment:
139===================
133 140
134 1. Geert Uytterhoeven - his excellent howto and the virtual 141 1. Geert Uytterhoeven - his excellent howto and the virtual
135 framebuffer driver code made this possible. 142 framebuffer driver code made this possible.
136 143
137 2. Jeff Hartmann for his agpgart code. 144 2. Jeff Hartmann for his agpgart code.
138 145
@@ -145,5 +152,4 @@ E. Acknowledgment:
145 152
146 6. Andrew Morton for his kernel patches maintenance. 153 6. Andrew Morton for his kernel patches maintenance.
147 154
148###########################
149Sylvain 155Sylvain
diff --git a/Documentation/fb/internals.txt b/Documentation/fb/internals.rst
index 9b2a2b2f3e57..696b50aa7c24 100644
--- a/Documentation/fb/internals.txt
+++ b/Documentation/fb/internals.rst
@@ -1,13 +1,19 @@
1=============================
2Frame Buffer device internals
3=============================
1 4
2This is a first start for some documentation about frame buffer device 5This is a first start for some documentation about frame buffer device
3internals. 6internals.
4 7
5Geert Uytterhoeven <geert@linux-m68k.org>, 21 July 1998 8Authors:
6James Simmons <jsimmons@user.sf.net>, Nov 26 2002 9
10- Geert Uytterhoeven <geert@linux-m68k.org>, 21 July 1998
11- James Simmons <jsimmons@user.sf.net>, Nov 26 2002
7 12
8-------------------------------------------------------------------------------- 13--------------------------------------------------------------------------------
9 14
10 *** STRUCTURES USED BY THE FRAME BUFFER DEVICE API *** 15Structures used by the frame buffer device API
16==============================================
11 17
12The following structures play a role in the game of frame buffer devices. They 18The following structures play a role in the game of frame buffer devices. They
13are defined in <linux/fb.h>. 19are defined in <linux/fb.h>.
@@ -40,19 +46,18 @@ are defined in <linux/fb.h>.
40 Generic information, API and low level information about a specific frame 46 Generic information, API and low level information about a specific frame
41 buffer device instance (slot number, board address, ...). 47 buffer device instance (slot number, board address, ...).
42 48
43 - struct `par' 49 - struct `par`
44 50
45 Device dependent information that uniquely defines the video mode for this 51 Device dependent information that uniquely defines the video mode for this
46 particular piece of hardware. 52 particular piece of hardware.
47 53
48 54
49-------------------------------------------------------------------------------- 55Visuals used by the frame buffer device API
50 56===========================================
51 *** VISUALS USED BY THE FRAME BUFFER DEVICE API ***
52 57
53 58
54Monochrome (FB_VISUAL_MONO01 and FB_VISUAL_MONO10) 59Monochrome (FB_VISUAL_MONO01 and FB_VISUAL_MONO10)
55------------------------------------------------- 60--------------------------------------------------
56Each pixel is either black or white. 61Each pixel is either black or white.
57 62
58 63
@@ -70,7 +75,7 @@ The pixel value is broken up into red, green, and blue fields.
70 75
71Direct color (FB_VISUAL_DIRECTCOLOR) 76Direct color (FB_VISUAL_DIRECTCOLOR)
72------------------------------------ 77------------------------------------
73The pixel value is broken up into red, green, and blue fields, each of which 78The pixel value is broken up into red, green, and blue fields, each of which
74are looked up in separate red, green, and blue lookup tables. 79are looked up in separate red, green, and blue lookup tables.
75 80
76 81
@@ -79,4 +84,3 @@ Grayscale displays
79Grayscale and static grayscale are special variants of pseudo color and static 84Grayscale and static grayscale are special variants of pseudo color and static
80pseudo color, where the red, green and blue components are always equal to 85pseudo color, where the red, green and blue components are always equal to
81each other. 86each other.
82
diff --git a/Documentation/fb/lxfb.txt b/Documentation/fb/lxfb.rst
index 38b3ca6f6ca7..863e6b98fbae 100644
--- a/Documentation/fb/lxfb.txt
+++ b/Documentation/fb/lxfb.rst
@@ -1,7 +1,9 @@
1[This file is cloned from VesaFB/aty128fb] 1=============
2
3What is lxfb? 2What is lxfb?
4================= 3=============
4
5.. [This file is cloned from VesaFB/aty128fb]
6
5 7
6This is a graphics framebuffer driver for AMD Geode LX based processors. 8This is a graphics framebuffer driver for AMD Geode LX based processors.
7 9
@@ -23,9 +25,9 @@ How to use it?
23============== 25==============
24 26
25Switching modes is done using lxfb.mode_option=<resolution>... boot 27Switching modes is done using lxfb.mode_option=<resolution>... boot
26parameter or using `fbset' program. 28parameter or using `fbset` program.
27 29
28See Documentation/fb/modedb.txt for more information on modedb 30See Documentation/fb/modedb.rst for more information on modedb
29resolutions. 31resolutions.
30 32
31 33
@@ -42,11 +44,12 @@ You can pass kernel command line options to lxfb with lxfb.<option>.
42For example, lxfb.mode_option=800x600@75. 44For example, lxfb.mode_option=800x600@75.
43Accepted options: 45Accepted options:
44 46
45mode_option - specify the video mode. Of the form 47================ ==================================================
46 <x>x<y>[-<bpp>][@<refresh>] 48mode_option specify the video mode. Of the form
47vram - size of video ram (normally auto-detected) 49 <x>x<y>[-<bpp>][@<refresh>]
48vt_switch - enable vt switching during suspend/resume. The vt 50vram size of video ram (normally auto-detected)
49 switch is slow, but harmless. 51vt_switch enable vt switching during suspend/resume. The vt
52 switch is slow, but harmless.
53================ ==================================================
50 54
51--
52Andres Salomon <dilinger@debian.org> 55Andres Salomon <dilinger@debian.org>
diff --git a/Documentation/fb/matroxfb.rst b/Documentation/fb/matroxfb.rst
new file mode 100644
index 000000000000..f1859d98606e
--- /dev/null
+++ b/Documentation/fb/matroxfb.rst
@@ -0,0 +1,443 @@
1=================
2What is matroxfb?
3=================
4
5.. [This file is cloned from VesaFB. Thanks go to Gerd Knorr]
6
7
8This is a driver for a graphic framebuffer for Matrox devices on
9Alpha, Intel and PPC boxes.
10
11Advantages:
12
13 * It provides a nice large console (128 cols + 48 lines with 1024x768)
14 without using tiny, unreadable fonts.
15 * You can run XF{68,86}_FBDev or XFree86 fbdev driver on top of /dev/fb0
16 * Most important: boot logo :-)
17
18Disadvantages:
19
20 * graphic mode is slower than text mode... but you should not notice
21 if you use same resolution as you used in textmode.
22
23
24How to use it?
25==============
26
27Switching modes is done using the video=matroxfb:vesa:... boot parameter
28or using `fbset` program.
29
30If you want, for example, enable a resolution of 1280x1024x24bpp you should
31pass to the kernel this command line: "video=matroxfb:vesa:0x1BB".
32
33You should compile in both vgacon (to boot if you remove you Matrox from
34box) and matroxfb (for graphics mode). You should not compile-in vesafb
35unless you have primary display on non-Matrox VBE2.0 device (see
36Documentation/fb/vesafb.rst for details).
37
38Currently supported video modes are (through vesa:... interface, PowerMac
39has [as addon] compatibility code):
40
41
42Graphic modes
43-------------
44
45=== ======= ======= ======= ======= =======
46bpp 640x400 640x480 768x576 800x600 960x720
47=== ======= ======= ======= ======= =======
48 4 0x12 0x102
49 8 0x100 0x101 0x180 0x103 0x188
50 15 0x110 0x181 0x113 0x189
51 16 0x111 0x182 0x114 0x18A
52 24 0x1B2 0x184 0x1B5 0x18C
53 32 0x112 0x183 0x115 0x18B
54=== ======= ======= ======= ======= =======
55
56
57Graphic modes (continued)
58-------------------------
59
60=== ======== ======== ========= ========= =========
61bpp 1024x768 1152x864 1280x1024 1408x1056 1600x1200
62=== ======== ======== ========= ========= =========
63 4 0x104 0x106
64 8 0x105 0x190 0x107 0x198 0x11C
65 15 0x116 0x191 0x119 0x199 0x11D
66 16 0x117 0x192 0x11A 0x19A 0x11E
67 24 0x1B8 0x194 0x1BB 0x19C 0x1BF
68 32 0x118 0x193 0x11B 0x19B
69=== ======== ======== ========= ========= =========
70
71
72Text modes
73----------
74
75==== ======= ======= ======== ======== ========
76text 640x400 640x480 1056x344 1056x400 1056x480
77==== ======= ======= ======== ======== ========
78 8x8 0x1C0 0x108 0x10A 0x10B 0x10C
798x16 2, 3, 7 0x109
80==== ======= ======= ======== ======== ========
81
82You can enter these number either hexadecimal (leading `0x`) or decimal
83(0x100 = 256). You can also use value + 512 to achieve compatibility
84with your old number passed to vesafb.
85
86Non-listed number can be achieved by more complicated command-line, for
87example 1600x1200x32bpp can be specified by `video=matroxfb:vesa:0x11C,depth:32`.
88
89
90X11
91===
92
93XF{68,86}_FBDev should work just fine, but it is non-accelerated. On non-intel
94architectures there are some glitches for 24bpp videomodes. 8, 16 and 32bpp
95works fine.
96
97Running another (accelerated) X-Server like XF86_SVGA works too. But (at least)
98XFree servers have big troubles in multihead configurations (even on first
99head, not even talking about second). Running XFree86 4.x accelerated mga
100driver is possible, but you must not enable DRI - if you do, resolution and
101color depth of your X desktop must match resolution and color depths of your
102virtual consoles, otherwise X will corrupt accelerator settings.
103
104
105SVGALib
106=======
107
108Driver contains SVGALib compatibility code. It is turned on by choosing textual
109mode for console. You can do it at boot time by using videomode
1102,3,7,0x108-0x10C or 0x1C0. At runtime, `fbset -depth 0` does this work.
111Unfortunately, after SVGALib application exits, screen contents is corrupted.
112Switching to another console and back fixes it. I hope that it is SVGALib's
113problem and not mine, but I'm not sure.
114
115
116Configuration
117=============
118
119You can pass kernel command line options to matroxfb with
120`video=matroxfb:option1,option2:value2,option3` (multiple options should be
121separated by comma, values are separated from options by `:`).
122Accepted options:
123
124============ ===================================================================
125mem:X size of memory (X can be in megabytes, kilobytes or bytes)
126 You can only decrease value determined by driver because of
127 it always probe for memory. Default is to use whole detected
128 memory usable for on-screen display (i.e. max. 8 MB).
129disabled do not load driver; you can use also `off`, but `disabled`
130 is here too.
131enabled load driver, if you have `video=matroxfb:disabled` in LILO
132 configuration, you can override it by this (you cannot override
133 `off`). It is default.
134noaccel do not use acceleration engine. It does not work on Alphas.
135accel use acceleration engine. It is default.
136nopan create initial consoles with vyres = yres, thus disabling virtual
137 scrolling.
138pan create initial consoles as tall as possible (vyres = memory/vxres).
139 It is default.
140nopciretry disable PCI retries. It is needed for some broken chipsets,
141 it is autodetected for intel's 82437. In this case device does
142 not comply to PCI 2.1 specs (it will not guarantee that every
143 transaction terminate with success or retry in 32 PCLK).
144pciretry enable PCI retries. It is default, except for intel's 82437.
145novga disables VGA I/O ports. It is default if BIOS did not enable
146 device. You should not use this option, some boards then do not
147 restart without power off.
148vga preserve state of VGA I/O ports. It is default. Driver does not
149 enable VGA I/O if BIOS did not it (it is not safe to enable it in
150 most cases).
151nobios disables BIOS ROM. It is default if BIOS did not enable BIOS
152 itself. You should not use this option, some boards then do not
153 restart without power off.
154bios preserve state of BIOS ROM. It is default. Driver does not enable
155 BIOS if BIOS was not enabled before.
156noinit tells driver, that devices were already initialized. You should use
157 it if you have G100 and/or if driver cannot detect memory, you see
158 strange pattern on screen and so on. Devices not enabled by BIOS
159 are still initialized. It is default.
160init driver initializes every device it knows about.
161memtype specifies memory type, implies 'init'. This is valid only for G200
162 and G400 and has following meaning:
163
164 G200:
165 - 0 -> 2x128Kx32 chips, 2MB onboard, probably sgram
166 - 1 -> 2x128Kx32 chips, 4MB onboard, probably sgram
167 - 2 -> 2x256Kx32 chips, 4MB onboard, probably sgram
168 - 3 -> 2x256Kx32 chips, 8MB onboard, probably sgram
169 - 4 -> 2x512Kx16 chips, 8/16MB onboard, probably sdram only
170 - 5 -> same as above
171 - 6 -> 4x128Kx32 chips, 4MB onboard, probably sgram
172 - 7 -> 4x128Kx32 chips, 8MB onboard, probably sgram
173 G400:
174 - 0 -> 2x512Kx16 SDRAM, 16/32MB
175 - 2x512Kx32 SGRAM, 16/32MB
176 - 1 -> 2x256Kx32 SGRAM, 8/16MB
177 - 2 -> 4x128Kx32 SGRAM, 8/16MB
178 - 3 -> 4x512Kx32 SDRAM, 32MB
179 - 4 -> 4x256Kx32 SGRAM, 16/32MB
180 - 5 -> 2x1Mx32 SDRAM, 32MB
181 - 6 -> reserved
182 - 7 -> reserved
183
184 You should use sdram or sgram parameter in addition to memtype
185 parameter.
186nomtrr disables write combining on frame buffer. This slows down driver
187 but there is reported minor incompatibility between GUS DMA and
188 XFree under high loads if write combining is enabled (sound
189 dropouts).
190mtrr enables write combining on frame buffer. It speeds up video
191 accesses much. It is default. You must have MTRR support enabled
192 in kernel and your CPU must have MTRR (f.e. Pentium II have them).
193sgram tells to driver that you have Gxx0 with SGRAM memory. It has no
194 effect without `init`.
195sdram tells to driver that you have Gxx0 with SDRAM memory.
196 It is a default.
197inv24 change timings parameters for 24bpp modes on Millennium and
198 Millennium II. Specify this if you see strange color shadows
199 around characters.
200noinv24 use standard timings. It is the default.
201inverse invert colors on screen (for LCD displays)
202noinverse show true colors on screen. It is default.
203dev:X bind driver to device X. Driver numbers device from 0 up to N,
204 where device 0 is first `known` device found, 1 second and so on.
205 lspci lists devices in this order.
206 Default is `every` known device.
207nohwcursor disables hardware cursor (use software cursor instead).
208hwcursor enables hardware cursor. It is default. If you are using
209 non-accelerated mode (`noaccel` or `fbset -accel false`), software
210 cursor is used (except for text mode).
211noblink disables cursor blinking. Cursor in text mode always blinks (hw
212 limitation).
213blink enables cursor blinking. It is default.
214nofastfont disables fastfont feature. It is default.
215fastfont:X enables fastfont feature. X specifies size of memory reserved for
216 font data, it must be >= (fontwidth*fontheight*chars_in_font)/8.
217 It is faster on Gx00 series, but slower on older cards.
218grayscale enable grayscale summing. It works in PSEUDOCOLOR modes (text,
219 4bpp, 8bpp). In DIRECTCOLOR modes it is limited to characters
220 displayed through putc/putcs. Direct accesses to framebuffer
221 can paint colors.
222nograyscale disable grayscale summing. It is default.
223cross4MB enables that pixel line can cross 4MB boundary. It is default for
224 non-Millennium.
225nocross4MB pixel line must not cross 4MB boundary. It is default for
226 Millennium I or II, because of these devices have hardware
227 limitations which do not allow this. But this option is
228 incompatible with some (if not all yet released) versions of
229 XF86_FBDev.
230dfp enables digital flat panel interface. This option is incompatible
231 with secondary (TV) output - if DFP is active, TV output must be
232 inactive and vice versa. DFP always uses same timing as primary
233 (monitor) output.
234dfp:X use settings X for digital flat panel interface. X is number from
235 0 to 0xFF, and meaning of each individual bit is described in
236 G400 manual, in description of DAC register 0x1F. For normal
237 operation you should set all bits to zero, except lowest bit. This
238 lowest bit selects who is source of display clocks, whether G400,
239 or panel. Default value is now read back from hardware - so you
240 should specify this value only if you are also using `init`
241 parameter.
242outputs:XYZ set mapping between CRTC and outputs. Each letter can have value
243 of 0 (for no CRTC), 1 (CRTC1) or 2 (CRTC2), and first letter
244 corresponds to primary analog output, second letter to the
245 secondary analog output and third letter to the DVI output.
246 Default setting is 100 for cards below G400 or G400 without DFP,
247 101 for G400 with DFP, and 111 for G450 and G550. You can set
248 mapping only on first card, use matroxset for setting up other
249 devices.
250vesa:X selects startup videomode. X is number from 0 to 0x1FF, see table
251 above for detailed explanation. Default is 640x480x8bpp if driver
252 has 8bpp support. Otherwise first available of 640x350x4bpp,
253 640x480x15bpp, 640x480x24bpp, 640x480x32bpp or 80x25 text
254 (80x25 text is always available).
255============ ===================================================================
256
257If you are not satisfied with videomode selected by `vesa` option, you
258can modify it with these options:
259
260============ ===================================================================
261xres:X horizontal resolution, in pixels. Default is derived from `vesa`
262 option.
263yres:X vertical resolution, in pixel lines. Default is derived from `vesa`
264 option.
265upper:X top boundary: lines between end of VSYNC pulse and start of first
266 pixel line of picture. Default is derived from `vesa` option.
267lower:X bottom boundary: lines between end of picture and start of VSYNC
268 pulse. Default is derived from `vesa` option.
269vslen:X length of VSYNC pulse, in lines. Default is derived from `vesa`
270 option.
271left:X left boundary: pixels between end of HSYNC pulse and first pixel.
272 Default is derived from `vesa` option.
273right:X right boundary: pixels between end of picture and start of HSYNC
274 pulse. Default is derived from `vesa` option.
275hslen:X length of HSYNC pulse, in pixels. Default is derived from `vesa`
276 option.
277pixclock:X dotclocks, in ps (picoseconds). Default is derived from `vesa`
278 option and from `fh` and `fv` options.
279sync:X sync. pulse - bit 0 inverts HSYNC polarity, bit 1 VSYNC polarity.
280 If bit 3 (value 0x08) is set, composite sync instead of HSYNC is
281 generated. If bit 5 (value 0x20) is set, sync on green is turned
282 on. Do not forget that if you want sync on green, you also probably
283 want composite sync.
284 Default depends on `vesa`.
285depth:X Bits per pixel: 0=text, 4,8,15,16,24 or 32. Default depends on
286 `vesa`.
287============ ===================================================================
288
289If you know capabilities of your monitor, you can specify some (or all) of
290`maxclk`, `fh` and `fv`. In this case, `pixclock` is computed so that
291pixclock <= maxclk, real_fh <= fh and real_fv <= fv.
292
293============ ==================================================================
294maxclk:X maximum dotclock. X can be specified in MHz, kHz or Hz. Default is
295 `don`t care`.
296fh:X maximum horizontal synchronization frequency. X can be specified
297 in kHz or Hz. Default is `don't care`.
298fv:X maximum vertical frequency. X must be specified in Hz. Default is
299 70 for modes derived from `vesa` with yres <= 400, 60Hz for
300 yres > 400.
301============ ==================================================================
302
303
304Limitations
305===========
306
307There are known and unknown bugs, features and misfeatures.
308Currently there are following known bugs:
309
310 - SVGALib does not restore screen on exit
311 - generic fbcon-cfbX procedures do not work on Alphas. Due to this,
312 `noaccel` (and cfb4 accel) driver does not work on Alpha. So everyone
313 with access to `/dev/fb*` on Alpha can hang machine (you should restrict
314 access to `/dev/fb*` - everyone with access to this device can destroy
315 your monitor, believe me...).
316 - 24bpp does not support correctly XF-FBDev on big-endian architectures.
317 - interlaced text mode is not supported; it looks like hardware limitation,
318 but I'm not sure.
319 - Gxx0 SGRAM/SDRAM is not autodetected.
320 - If you are using more than one framebuffer device, you must boot kernel
321 with 'video=scrollback:0'.
322 - maybe more...
323
324And following misfeatures:
325
326 - SVGALib does not restore screen on exit.
327 - pixclock for text modes is limited by hardware to
328
329 - 83 MHz on G200
330 - 66 MHz on Millennium I
331 - 60 MHz on Millennium II
332
333 Because I have no access to other devices, I do not know specific
334 frequencies for them. So driver does not check this and allows you to
335 set frequency higher that this. It causes sparks, black holes and other
336 pretty effects on screen. Device was not destroyed during tests. :-)
337 - my Millennium G200 oscillator has frequency range from 35 MHz to 380 MHz
338 (and it works with 8bpp on about 320 MHz dotclocks (and changed mclk)).
339 But Matrox says on product sheet that VCO limit is 50-250 MHz, so I believe
340 them (maybe that chip overheats, but it has a very big cooler (G100 has
341 none), so it should work).
342 - special mixed video/graphics videomodes of Mystique and Gx00 - 2G8V16 and
343 G16V16 are not supported
344 - color keying is not supported
345 - feature connector of Mystique and Gx00 is set to VGA mode (it is disabled
346 by BIOS)
347 - DDC (monitor detection) is supported through dualhead driver
348 - some check for input values are not so strict how it should be (you can
349 specify vslen=4000 and so on).
350 - maybe more...
351
352And following features:
353
354 - 4bpp is available only on Millennium I and Millennium II. It is hardware
355 limitation.
356 - selection between 1:5:5:5 and 5:6:5 16bpp videomode is done by -rgba
357 option of fbset: "fbset -depth 16 -rgba 5,5,5" selects 1:5:5:5, anything
358 else selects 5:6:5 mode.
359 - text mode uses 6 bit VGA palette instead of 8 bit (one of 262144 colors
360 instead of one of 16M colors). It is due to hardware limitation of
361 Millennium I/II and SVGALib compatibility.
362
363
364Benchmarks
365==========
366It is time to redraw whole screen 1000 times in 1024x768, 60Hz. It is
367time for draw 6144000 characters on screen through /dev/vcsa
368(for 32bpp it is about 3GB of data (exactly 3000 MB); for 8x16 font in
36916 seconds, i.e. 187 MBps).
370Times were obtained from one older version of driver, now they are about 3%
371faster, it is kernel-space only time on P-II/350 MHz, Millennium I in 33 MHz
372PCI slot, G200 in AGP 2x slot. I did not test vgacon::
373
374 NOACCEL
375 8x16 12x22
376 Millennium I G200 Millennium I G200
377 8bpp 16.42 9.54 12.33 9.13
378 16bpp 21.00 15.70 19.11 15.02
379 24bpp 36.66 36.66 35.00 35.00
380 32bpp 35.00 30.00 33.85 28.66
381
382 ACCEL, nofastfont
383 8x16 12x22 6x11
384 Millennium I G200 Millennium I G200 Millennium I G200
385 8bpp 7.79 7.24 13.55 7.78 30.00 21.01
386 16bpp 9.13 7.78 16.16 7.78 30.00 21.01
387 24bpp 14.17 10.72 18.69 10.24 34.99 21.01
388 32bpp 16.15 16.16 18.73 13.09 34.99 21.01
389
390 ACCEL, fastfont
391 8x16 12x22 6x11
392 Millennium I G200 Millennium I G200 Millennium I G200
393 8bpp 8.41 6.01 6.54 4.37 16.00 10.51
394 16bpp 9.54 9.12 8.76 6.17 17.52 14.01
395 24bpp 15.00 12.36 11.67 10.00 22.01 18.32
396 32bpp 16.18 18.29* 12.71 12.74 24.44 21.00
397
398 TEXT
399 8x16
400 Millennium I G200
401 TEXT 3.29 1.50
402
403 * Yes, it is slower than Millennium I.
404
405
406Dualhead G400
407=============
408Driver supports dualhead G400 with some limitations:
409 + secondary head shares videomemory with primary head. It is not problem
410 if you have 32MB of videoram, but if you have only 16MB, you may have
411 to think twice before choosing videomode (for example twice 1880x1440x32bpp
412 is not possible).
413 + due to hardware limitation, secondary head can use only 16 and 32bpp
414 videomodes.
415 + secondary head is not accelerated. There were bad problems with accelerated
416 XFree when secondary head used to use acceleration.
417 + secondary head always powerups in 640x480@60-32 videomode. You have to use
418 fbset to change this mode.
419 + secondary head always powerups in monitor mode. You have to use fbmatroxset
420 to change it to TV mode. Also, you must select at least 525 lines for
421 NTSC output and 625 lines for PAL output.
422 + kernel is not fully multihead ready. So some things are impossible to do.
423 + if you compiled it as module, you must insert i2c-matroxfb, matroxfb_maven
424 and matroxfb_crtc2 into kernel.
425
426
427Dualhead G450
428=============
429Driver supports dualhead G450 with some limitations:
430 + secondary head shares videomemory with primary head. It is not problem
431 if you have 32MB of videoram, but if you have only 16MB, you may have
432 to think twice before choosing videomode.
433 + due to hardware limitation, secondary head can use only 16 and 32bpp
434 videomodes.
435 + secondary head is not accelerated.
436 + secondary head always powerups in 640x480@60-32 videomode. You have to use
437 fbset to change this mode.
438 + TV output is not supported
439 + kernel is not fully multihead ready, so some things are impossible to do.
440 + if you compiled it as module, you must insert matroxfb_g450 and matroxfb_crtc2
441 into kernel.
442
443Petr Vandrovec <vandrove@vc.cvut.cz>
diff --git a/Documentation/fb/matroxfb.txt b/Documentation/fb/matroxfb.txt
deleted file mode 100644
index b95f5bb522f2..000000000000
--- a/Documentation/fb/matroxfb.txt
+++ /dev/null
@@ -1,413 +0,0 @@
1[This file is cloned from VesaFB. Thanks go to Gerd Knorr]
2
3What is matroxfb?
4=================
5
6This is a driver for a graphic framebuffer for Matrox devices on
7Alpha, Intel and PPC boxes.
8
9Advantages:
10
11 * It provides a nice large console (128 cols + 48 lines with 1024x768)
12 without using tiny, unreadable fonts.
13 * You can run XF{68,86}_FBDev or XFree86 fbdev driver on top of /dev/fb0
14 * Most important: boot logo :-)
15
16Disadvantages:
17
18 * graphic mode is slower than text mode... but you should not notice
19 if you use same resolution as you used in textmode.
20
21
22How to use it?
23==============
24
25Switching modes is done using the video=matroxfb:vesa:... boot parameter
26or using `fbset' program.
27
28If you want, for example, enable a resolution of 1280x1024x24bpp you should
29pass to the kernel this command line: "video=matroxfb:vesa:0x1BB".
30
31You should compile in both vgacon (to boot if you remove you Matrox from
32box) and matroxfb (for graphics mode). You should not compile-in vesafb
33unless you have primary display on non-Matrox VBE2.0 device (see
34Documentation/fb/vesafb.txt for details).
35
36Currently supported video modes are (through vesa:... interface, PowerMac
37has [as addon] compatibility code):
38
39
40[Graphic modes]
41
42bpp | 640x400 640x480 768x576 800x600 960x720
43----+--------------------------------------------
44 4 | 0x12 0x102
45 8 | 0x100 0x101 0x180 0x103 0x188
46 15 | 0x110 0x181 0x113 0x189
47 16 | 0x111 0x182 0x114 0x18A
48 24 | 0x1B2 0x184 0x1B5 0x18C
49 32 | 0x112 0x183 0x115 0x18B
50
51
52[Graphic modes (continued)]
53
54bpp | 1024x768 1152x864 1280x1024 1408x1056 1600x1200
55----+------------------------------------------------
56 4 | 0x104 0x106
57 8 | 0x105 0x190 0x107 0x198 0x11C
58 15 | 0x116 0x191 0x119 0x199 0x11D
59 16 | 0x117 0x192 0x11A 0x19A 0x11E
60 24 | 0x1B8 0x194 0x1BB 0x19C 0x1BF
61 32 | 0x118 0x193 0x11B 0x19B
62
63
64[Text modes]
65
66text | 640x400 640x480 1056x344 1056x400 1056x480
67-----+------------------------------------------------
68 8x8 | 0x1C0 0x108 0x10A 0x10B 0x10C
698x16 | 2, 3, 7 0x109
70
71You can enter these number either hexadecimal (leading `0x') or decimal
72(0x100 = 256). You can also use value + 512 to achieve compatibility
73with your old number passed to vesafb.
74
75Non-listed number can be achieved by more complicated command-line, for
76example 1600x1200x32bpp can be specified by `video=matroxfb:vesa:0x11C,depth:32'.
77
78
79X11
80===
81
82XF{68,86}_FBDev should work just fine, but it is non-accelerated. On non-intel
83architectures there are some glitches for 24bpp videomodes. 8, 16 and 32bpp
84works fine.
85
86Running another (accelerated) X-Server like XF86_SVGA works too. But (at least)
87XFree servers have big troubles in multihead configurations (even on first
88head, not even talking about second). Running XFree86 4.x accelerated mga
89driver is possible, but you must not enable DRI - if you do, resolution and
90color depth of your X desktop must match resolution and color depths of your
91virtual consoles, otherwise X will corrupt accelerator settings.
92
93
94SVGALib
95=======
96
97Driver contains SVGALib compatibility code. It is turned on by choosing textual
98mode for console. You can do it at boot time by using videomode
992,3,7,0x108-0x10C or 0x1C0. At runtime, `fbset -depth 0' does this work.
100Unfortunately, after SVGALib application exits, screen contents is corrupted.
101Switching to another console and back fixes it. I hope that it is SVGALib's
102problem and not mine, but I'm not sure.
103
104
105Configuration
106=============
107
108You can pass kernel command line options to matroxfb with
109`video=matroxfb:option1,option2:value2,option3' (multiple options should be
110separated by comma, values are separated from options by `:').
111Accepted options:
112
113mem:X - size of memory (X can be in megabytes, kilobytes or bytes)
114 You can only decrease value determined by driver because of
115 it always probe for memory. Default is to use whole detected
116 memory usable for on-screen display (i.e. max. 8 MB).
117disabled - do not load driver; you can use also `off', but `disabled'
118 is here too.
119enabled - load driver, if you have `video=matroxfb:disabled' in LILO
120 configuration, you can override it by this (you cannot override
121 `off'). It is default.
122noaccel - do not use acceleration engine. It does not work on Alphas.
123accel - use acceleration engine. It is default.
124nopan - create initial consoles with vyres = yres, thus disabling virtual
125 scrolling.
126pan - create initial consoles as tall as possible (vyres = memory/vxres).
127 It is default.
128nopciretry - disable PCI retries. It is needed for some broken chipsets,
129 it is autodetected for intel's 82437. In this case device does
130 not comply to PCI 2.1 specs (it will not guarantee that every
131 transaction terminate with success or retry in 32 PCLK).
132pciretry - enable PCI retries. It is default, except for intel's 82437.
133novga - disables VGA I/O ports. It is default if BIOS did not enable device.
134 You should not use this option, some boards then do not restart
135 without power off.
136vga - preserve state of VGA I/O ports. It is default. Driver does not
137 enable VGA I/O if BIOS did not it (it is not safe to enable it in
138 most cases).
139nobios - disables BIOS ROM. It is default if BIOS did not enable BIOS itself.
140 You should not use this option, some boards then do not restart
141 without power off.
142bios - preserve state of BIOS ROM. It is default. Driver does not enable
143 BIOS if BIOS was not enabled before.
144noinit - tells driver, that devices were already initialized. You should use
145 it if you have G100 and/or if driver cannot detect memory, you see
146 strange pattern on screen and so on. Devices not enabled by BIOS
147 are still initialized. It is default.
148init - driver initializes every device it knows about.
149memtype - specifies memory type, implies 'init'. This is valid only for G200
150 and G400 and has following meaning:
151 G200: 0 -> 2x128Kx32 chips, 2MB onboard, probably sgram
152 1 -> 2x128Kx32 chips, 4MB onboard, probably sgram
153 2 -> 2x256Kx32 chips, 4MB onboard, probably sgram
154 3 -> 2x256Kx32 chips, 8MB onboard, probably sgram
155 4 -> 2x512Kx16 chips, 8/16MB onboard, probably sdram only
156 5 -> same as above
157 6 -> 4x128Kx32 chips, 4MB onboard, probably sgram
158 7 -> 4x128Kx32 chips, 8MB onboard, probably sgram
159 G400: 0 -> 2x512Kx16 SDRAM, 16/32MB
160 2x512Kx32 SGRAM, 16/32MB
161 1 -> 2x256Kx32 SGRAM, 8/16MB
162 2 -> 4x128Kx32 SGRAM, 8/16MB
163 3 -> 4x512Kx32 SDRAM, 32MB
164 4 -> 4x256Kx32 SGRAM, 16/32MB
165 5 -> 2x1Mx32 SDRAM, 32MB
166 6 -> reserved
167 7 -> reserved
168 You should use sdram or sgram parameter in addition to memtype
169 parameter.
170nomtrr - disables write combining on frame buffer. This slows down driver but
171 there is reported minor incompatibility between GUS DMA and XFree
172 under high loads if write combining is enabled (sound dropouts).
173mtrr - enables write combining on frame buffer. It speeds up video accesses
174 much. It is default. You must have MTRR support enabled in kernel
175 and your CPU must have MTRR (f.e. Pentium II have them).
176sgram - tells to driver that you have Gxx0 with SGRAM memory. It has no
177 effect without `init'.
178sdram - tells to driver that you have Gxx0 with SDRAM memory.
179 It is a default.
180inv24 - change timings parameters for 24bpp modes on Millennium and
181 Millennium II. Specify this if you see strange color shadows around
182 characters.
183noinv24 - use standard timings. It is the default.
184inverse - invert colors on screen (for LCD displays)
185noinverse - show true colors on screen. It is default.
186dev:X - bind driver to device X. Driver numbers device from 0 up to N,
187 where device 0 is first `known' device found, 1 second and so on.
188 lspci lists devices in this order.
189 Default is `every' known device.
190nohwcursor - disables hardware cursor (use software cursor instead).
191hwcursor - enables hardware cursor. It is default. If you are using
192 non-accelerated mode (`noaccel' or `fbset -accel false'), software
193 cursor is used (except for text mode).
194noblink - disables cursor blinking. Cursor in text mode always blinks (hw
195 limitation).
196blink - enables cursor blinking. It is default.
197nofastfont - disables fastfont feature. It is default.
198fastfont:X - enables fastfont feature. X specifies size of memory reserved for
199 font data, it must be >= (fontwidth*fontheight*chars_in_font)/8.
200 It is faster on Gx00 series, but slower on older cards.
201grayscale - enable grayscale summing. It works in PSEUDOCOLOR modes (text,
202 4bpp, 8bpp). In DIRECTCOLOR modes it is limited to characters
203 displayed through putc/putcs. Direct accesses to framebuffer
204 can paint colors.
205nograyscale - disable grayscale summing. It is default.
206cross4MB - enables that pixel line can cross 4MB boundary. It is default for
207 non-Millennium.
208nocross4MB - pixel line must not cross 4MB boundary. It is default for
209 Millennium I or II, because of these devices have hardware
210 limitations which do not allow this. But this option is
211 incompatible with some (if not all yet released) versions of
212 XF86_FBDev.
213dfp - enables digital flat panel interface. This option is incompatible with
214 secondary (TV) output - if DFP is active, TV output must be
215 inactive and vice versa. DFP always uses same timing as primary
216 (monitor) output.
217dfp:X - use settings X for digital flat panel interface. X is number from
218 0 to 0xFF, and meaning of each individual bit is described in
219 G400 manual, in description of DAC register 0x1F. For normal operation
220 you should set all bits to zero, except lowest bit. This lowest bit
221 selects who is source of display clocks, whether G400, or panel.
222 Default value is now read back from hardware - so you should specify
223 this value only if you are also using `init' parameter.
224outputs:XYZ - set mapping between CRTC and outputs. Each letter can have value
225 of 0 (for no CRTC), 1 (CRTC1) or 2 (CRTC2), and first letter corresponds
226 to primary analog output, second letter to the secondary analog output
227 and third letter to the DVI output. Default setting is 100 for
228 cards below G400 or G400 without DFP, 101 for G400 with DFP, and
229 111 for G450 and G550. You can set mapping only on first card,
230 use matroxset for setting up other devices.
231vesa:X - selects startup videomode. X is number from 0 to 0x1FF, see table
232 above for detailed explanation. Default is 640x480x8bpp if driver
233 has 8bpp support. Otherwise first available of 640x350x4bpp,
234 640x480x15bpp, 640x480x24bpp, 640x480x32bpp or 80x25 text
235 (80x25 text is always available).
236
237If you are not satisfied with videomode selected by `vesa' option, you
238can modify it with these options:
239
240xres:X - horizontal resolution, in pixels. Default is derived from `vesa'
241 option.
242yres:X - vertical resolution, in pixel lines. Default is derived from `vesa'
243 option.
244upper:X - top boundary: lines between end of VSYNC pulse and start of first
245 pixel line of picture. Default is derived from `vesa' option.
246lower:X - bottom boundary: lines between end of picture and start of VSYNC
247 pulse. Default is derived from `vesa' option.
248vslen:X - length of VSYNC pulse, in lines. Default is derived from `vesa'
249 option.
250left:X - left boundary: pixels between end of HSYNC pulse and first pixel.
251 Default is derived from `vesa' option.
252right:X - right boundary: pixels between end of picture and start of HSYNC
253 pulse. Default is derived from `vesa' option.
254hslen:X - length of HSYNC pulse, in pixels. Default is derived from `vesa'
255 option.
256pixclock:X - dotclocks, in ps (picoseconds). Default is derived from `vesa'
257 option and from `fh' and `fv' options.
258sync:X - sync. pulse - bit 0 inverts HSYNC polarity, bit 1 VSYNC polarity.
259 If bit 3 (value 0x08) is set, composite sync instead of HSYNC is
260 generated. If bit 5 (value 0x20) is set, sync on green is turned on.
261 Do not forget that if you want sync on green, you also probably
262 want composite sync.
263 Default depends on `vesa'.
264depth:X - Bits per pixel: 0=text, 4,8,15,16,24 or 32. Default depends on
265 `vesa'.
266
267If you know capabilities of your monitor, you can specify some (or all) of
268`maxclk', `fh' and `fv'. In this case, `pixclock' is computed so that
269pixclock <= maxclk, real_fh <= fh and real_fv <= fv.
270
271maxclk:X - maximum dotclock. X can be specified in MHz, kHz or Hz. Default is
272 `don't care'.
273fh:X - maximum horizontal synchronization frequency. X can be specified
274 in kHz or Hz. Default is `don't care'.
275fv:X - maximum vertical frequency. X must be specified in Hz. Default is
276 70 for modes derived from `vesa' with yres <= 400, 60Hz for
277 yres > 400.
278
279
280Limitations
281===========
282
283There are known and unknown bugs, features and misfeatures.
284Currently there are following known bugs:
285 + SVGALib does not restore screen on exit
286 + generic fbcon-cfbX procedures do not work on Alphas. Due to this,
287 `noaccel' (and cfb4 accel) driver does not work on Alpha. So everyone
288 with access to /dev/fb* on Alpha can hang machine (you should restrict
289 access to /dev/fb* - everyone with access to this device can destroy
290 your monitor, believe me...).
291 + 24bpp does not support correctly XF-FBDev on big-endian architectures.
292 + interlaced text mode is not supported; it looks like hardware limitation,
293 but I'm not sure.
294 + Gxx0 SGRAM/SDRAM is not autodetected.
295 + If you are using more than one framebuffer device, you must boot kernel
296 with 'video=scrollback:0'.
297 + maybe more...
298And following misfeatures:
299 + SVGALib does not restore screen on exit.
300 + pixclock for text modes is limited by hardware to
301 83 MHz on G200
302 66 MHz on Millennium I
303 60 MHz on Millennium II
304 Because I have no access to other devices, I do not know specific
305 frequencies for them. So driver does not check this and allows you to
306 set frequency higher that this. It causes sparks, black holes and other
307 pretty effects on screen. Device was not destroyed during tests. :-)
308 + my Millennium G200 oscillator has frequency range from 35 MHz to 380 MHz
309 (and it works with 8bpp on about 320 MHz dotclocks (and changed mclk)).
310 But Matrox says on product sheet that VCO limit is 50-250 MHz, so I believe
311 them (maybe that chip overheats, but it has a very big cooler (G100 has
312 none), so it should work).
313 + special mixed video/graphics videomodes of Mystique and Gx00 - 2G8V16 and
314 G16V16 are not supported
315 + color keying is not supported
316 + feature connector of Mystique and Gx00 is set to VGA mode (it is disabled
317 by BIOS)
318 + DDC (monitor detection) is supported through dualhead driver
319 + some check for input values are not so strict how it should be (you can
320 specify vslen=4000 and so on).
321 + maybe more...
322And following features:
323 + 4bpp is available only on Millennium I and Millennium II. It is hardware
324 limitation.
325 + selection between 1:5:5:5 and 5:6:5 16bpp videomode is done by -rgba
326 option of fbset: "fbset -depth 16 -rgba 5,5,5" selects 1:5:5:5, anything
327 else selects 5:6:5 mode.
328 + text mode uses 6 bit VGA palette instead of 8 bit (one of 262144 colors
329 instead of one of 16M colors). It is due to hardware limitation of
330 Millennium I/II and SVGALib compatibility.
331
332
333Benchmarks
334==========
335It is time to redraw whole screen 1000 times in 1024x768, 60Hz. It is
336time for draw 6144000 characters on screen through /dev/vcsa
337(for 32bpp it is about 3GB of data (exactly 3000 MB); for 8x16 font in
33816 seconds, i.e. 187 MBps).
339Times were obtained from one older version of driver, now they are about 3%
340faster, it is kernel-space only time on P-II/350 MHz, Millennium I in 33 MHz
341PCI slot, G200 in AGP 2x slot. I did not test vgacon.
342
343NOACCEL
344 8x16 12x22
345 Millennium I G200 Millennium I G200
3468bpp 16.42 9.54 12.33 9.13
34716bpp 21.00 15.70 19.11 15.02
34824bpp 36.66 36.66 35.00 35.00
34932bpp 35.00 30.00 33.85 28.66
350
351ACCEL, nofastfont
352 8x16 12x22 6x11
353 Millennium I G200 Millennium I G200 Millennium I G200
3548bpp 7.79 7.24 13.55 7.78 30.00 21.01
35516bpp 9.13 7.78 16.16 7.78 30.00 21.01
35624bpp 14.17 10.72 18.69 10.24 34.99 21.01
35732bpp 16.15 16.16 18.73 13.09 34.99 21.01
358
359ACCEL, fastfont
360 8x16 12x22 6x11
361 Millennium I G200 Millennium I G200 Millennium I G200
3628bpp 8.41 6.01 6.54 4.37 16.00 10.51
36316bpp 9.54 9.12 8.76 6.17 17.52 14.01
36424bpp 15.00 12.36 11.67 10.00 22.01 18.32
36532bpp 16.18 18.29* 12.71 12.74 24.44 21.00
366
367TEXT
368 8x16
369 Millennium I G200
370TEXT 3.29 1.50
371
372* Yes, it is slower than Millennium I.
373
374
375Dualhead G400
376=============
377Driver supports dualhead G400 with some limitations:
378 + secondary head shares videomemory with primary head. It is not problem
379 if you have 32MB of videoram, but if you have only 16MB, you may have
380 to think twice before choosing videomode (for example twice 1880x1440x32bpp
381 is not possible).
382 + due to hardware limitation, secondary head can use only 16 and 32bpp
383 videomodes.
384 + secondary head is not accelerated. There were bad problems with accelerated
385 XFree when secondary head used to use acceleration.
386 + secondary head always powerups in 640x480@60-32 videomode. You have to use
387 fbset to change this mode.
388 + secondary head always powerups in monitor mode. You have to use fbmatroxset
389 to change it to TV mode. Also, you must select at least 525 lines for
390 NTSC output and 625 lines for PAL output.
391 + kernel is not fully multihead ready. So some things are impossible to do.
392 + if you compiled it as module, you must insert i2c-matroxfb, matroxfb_maven
393 and matroxfb_crtc2 into kernel.
394
395
396Dualhead G450
397=============
398Driver supports dualhead G450 with some limitations:
399 + secondary head shares videomemory with primary head. It is not problem
400 if you have 32MB of videoram, but if you have only 16MB, you may have
401 to think twice before choosing videomode.
402 + due to hardware limitation, secondary head can use only 16 and 32bpp
403 videomodes.
404 + secondary head is not accelerated.
405 + secondary head always powerups in 640x480@60-32 videomode. You have to use
406 fbset to change this mode.
407 + TV output is not supported
408 + kernel is not fully multihead ready, so some things are impossible to do.
409 + if you compiled it as module, you must insert matroxfb_g450 and matroxfb_crtc2
410 into kernel.
411
412--
413Petr Vandrovec <vandrove@vc.cvut.cz>
diff --git a/Documentation/fb/metronomefb.txt b/Documentation/fb/metronomefb.rst
index 237ca412582d..63e1d31a7e54 100644
--- a/Documentation/fb/metronomefb.txt
+++ b/Documentation/fb/metronomefb.rst
@@ -1,6 +1,9 @@
1 Metronomefb 1===========
2 ----------- 2Metronomefb
3===========
4
3Maintained by Jaya Kumar <jayakumar.lkml.gmail.com> 5Maintained by Jaya Kumar <jayakumar.lkml.gmail.com>
6
4Last revised: Mar 10, 2008 7Last revised: Mar 10, 2008
5 8
6Metronomefb is a driver for the Metronome display controller. The controller 9Metronomefb is a driver for the Metronome display controller. The controller
@@ -33,4 +36,3 @@ the physical media.
33Metronomefb uses the deferred IO interface so that it can provide a memory 36Metronomefb uses the deferred IO interface so that it can provide a memory
34mappable frame buffer. It has been tested with tinyx (Xfbdev). It is known 37mappable frame buffer. It has been tested with tinyx (Xfbdev). It is known
35to work at this time with xeyes, xclock, xloadimage, xpdf. 38to work at this time with xeyes, xclock, xloadimage, xpdf.
36
diff --git a/Documentation/fb/modedb.txt b/Documentation/fb/modedb.rst
index 16aa08453911..3c2397293977 100644
--- a/Documentation/fb/modedb.txt
+++ b/Documentation/fb/modedb.rst
@@ -1,6 +1,6 @@
1 1=================================
2 2modedb default video mode support
3 modedb default video mode support 3=================================
4 4
5 5
6Currently all frame buffer device drivers have their own video mode databases, 6Currently all frame buffer device drivers have their own video mode databases,
@@ -18,7 +18,7 @@ When a frame buffer device receives a video= option it doesn't know, it should
18consider that to be a video mode option. If no frame buffer device is specified 18consider that to be a video mode option. If no frame buffer device is specified
19in a video= option, fbmem considers that to be a global video mode option. 19in a video= option, fbmem considers that to be a global video mode option.
20 20
21Valid mode specifiers (mode_option argument): 21Valid mode specifiers (mode_option argument)::
22 22
23 <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd] 23 <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd]
24 <name>[-<bpp>][@<refresh>] 24 <name>[-<bpp>][@<refresh>]
@@ -45,15 +45,18 @@ signals (e.g. HDMI and DVI-I). For other outputs it behaves like 'e'. If 'd'
45is specified the output is disabled. 45is specified the output is disabled.
46 46
47You can additionally specify which output the options matches to. 47You can additionally specify which output the options matches to.
48To force the VGA output to be enabled and drive a specific mode say: 48To force the VGA output to be enabled and drive a specific mode say::
49
49 video=VGA-1:1280x1024@60me 50 video=VGA-1:1280x1024@60me
50 51
51Specifying the option multiple times for different ports is possible, e.g.: 52Specifying the option multiple times for different ports is possible, e.g.::
53
52 video=LVDS-1:d video=HDMI-1:D 54 video=LVDS-1:d video=HDMI-1:D
53 55
54***** oOo ***** oOo ***** oOo ***** oOo ***** oOo ***** oOo ***** oOo ***** 56-----------------------------------------------------------------------------
55 57
56What is the VESA(TM) Coordinated Video Timings (CVT)? 58What is the VESA(TM) Coordinated Video Timings (CVT)?
59=====================================================
57 60
58From the VESA(TM) Website: 61From the VESA(TM) Website:
59 62
@@ -90,14 +93,14 @@ determined from its EDID. The version 1.3 of the EDID has extra 128-byte
90blocks where additional timing information is placed. As of this time, there 93blocks where additional timing information is placed. As of this time, there
91is no support yet in the layer to parse this additional blocks.) 94is no support yet in the layer to parse this additional blocks.)
92 95
93CVT also introduced a new naming convention (should be seen from dmesg output): 96CVT also introduced a new naming convention (should be seen from dmesg output)::
94 97
95 <pix>M<a>[-R] 98 <pix>M<a>[-R]
96 99
97 where: pix = total amount of pixels in MB (xres x yres) 100 where: pix = total amount of pixels in MB (xres x yres)
98 M = always present 101 M = always present
99 a = aspect ratio (3 - 4:3; 4 - 5:4; 9 - 15:9, 16:9; A - 16:10) 102 a = aspect ratio (3 - 4:3; 4 - 5:4; 9 - 15:9, 16:9; A - 16:10)
100 -R = reduced blanking 103 -R = reduced blanking
101 104
102 example: .48M3-R - 800x600 with reduced blanking 105 example: .48M3-R - 800x600 with reduced blanking
103 106
@@ -110,15 +113,15 @@ Note: VESA(TM) has restrictions on what is a standard CVT timing:
110If one of the above are not satisfied, the kernel will print a warning but the 113If one of the above are not satisfied, the kernel will print a warning but the
111timings will still be calculated. 114timings will still be calculated.
112 115
113***** oOo ***** oOo ***** oOo ***** oOo ***** oOo ***** oOo ***** oOo ***** 116-----------------------------------------------------------------------------
114 117
115To find a suitable video mode, you just call 118To find a suitable video mode, you just call::
116 119
117int __init fb_find_mode(struct fb_var_screeninfo *var, 120 int __init fb_find_mode(struct fb_var_screeninfo *var,
118 struct fb_info *info, const char *mode_option, 121 struct fb_info *info, const char *mode_option,
119 const struct fb_videomode *db, unsigned int dbsize, 122 const struct fb_videomode *db, unsigned int dbsize,
120 const struct fb_videomode *default_mode, 123 const struct fb_videomode *default_mode,
121 unsigned int default_bpp) 124 unsigned int default_bpp)
122 125
123with db/dbsize your non-standard video mode database, or NULL to use the 126with db/dbsize your non-standard video mode database, or NULL to use the
124standard video mode database. 127standard video mode database.
@@ -127,12 +130,13 @@ fb_find_mode() first tries the specified video mode (or any mode that matches,
127e.g. there can be multiple 640x480 modes, each of them is tried). If that 130e.g. there can be multiple 640x480 modes, each of them is tried). If that
128fails, the default mode is tried. If that fails, it walks over all modes. 131fails, the default mode is tried. If that fails, it walks over all modes.
129 132
130To specify a video mode at bootup, use the following boot options: 133To specify a video mode at bootup, use the following boot options::
134
131 video=<driver>:<xres>x<yres>[-<bpp>][@refresh] 135 video=<driver>:<xres>x<yres>[-<bpp>][@refresh]
132 136
133where <driver> is a name from the table below. Valid default modes can be 137where <driver> is a name from the table below. Valid default modes can be
134found in linux/drivers/video/modedb.c. Check your driver's documentation. 138found in linux/drivers/video/modedb.c. Check your driver's documentation.
135There may be more modes. 139There may be more modes::
136 140
137 Drivers that support modedb boot options 141 Drivers that support modedb boot options
138 Boot Name Cards Supported 142 Boot Name Cards Supported
diff --git a/Documentation/fb/pvr2fb.rst b/Documentation/fb/pvr2fb.rst
new file mode 100644
index 000000000000..fcf2c21c8fcf
--- /dev/null
+++ b/Documentation/fb/pvr2fb.rst
@@ -0,0 +1,66 @@
1===============
2What is pvr2fb?
3===============
4
5This is a driver for PowerVR 2 based graphics frame buffers, such as the
6one found in the Dreamcast.
7
8Advantages:
9
10 * It provides a nice large console (128 cols + 48 lines with 1024x768)
11 without using tiny, unreadable fonts (NOT on the Dreamcast)
12 * You can run XF86_FBDev on top of /dev/fb0
13 * Most important: boot logo :-)
14
15Disadvantages:
16
17 * Driver is largely untested on non-Dreamcast systems.
18
19Configuration
20=============
21
22You can pass kernel command line options to pvr2fb with
23`video=pvr2fb:option1,option2:value2,option3` (multiple options should be
24separated by comma, values are separated from options by `:`).
25
26Accepted options:
27
28========== ==================================================================
29font:X default font to use. All fonts are supported, including the
30 SUN12x22 font which is very nice at high resolutions.
31
32
33mode:X default video mode with format [xres]x[yres]-<bpp>@<refresh rate>
34 The following video modes are supported:
35 640x640-16@60, 640x480-24@60, 640x480-32@60. The Dreamcast
36 defaults to 640x480-16@60. At the time of writing the
37 24bpp and 32bpp modes function poorly. Work to fix that is
38 ongoing
39
40 Note: the 640x240 mode is currently broken, and should not be
41 used for any reason. It is only mentioned here as a reference.
42
43inverse invert colors on screen (for LCD displays)
44
45nomtrr disables write combining on frame buffer. This slows down driver
46 but there is reported minor incompatibility between GUS DMA and
47 XFree under high loads if write combining is enabled (sound
48 dropouts). MTRR is enabled by default on systems that have it
49 configured and that support it.
50
51cable:X cable type. This can be any of the following: vga, rgb, and
52 composite. If none is specified, we guess.
53
54output:X output type. This can be any of the following: pal, ntsc, and
55 vga. If none is specified, we guess.
56========== ==================================================================
57
58X11
59===
60
61XF86_FBDev has been shown to work on the Dreamcast in the past - though not yet
62on any 2.6 series kernel.
63
64Paul Mundt <lethal@linuxdc.org>
65
66Updated by Adrian McMenamin <adrian@mcmen.demon.co.uk>
diff --git a/Documentation/fb/pvr2fb.txt b/Documentation/fb/pvr2fb.txt
deleted file mode 100644
index 36bdeff585e2..000000000000
--- a/Documentation/fb/pvr2fb.txt
+++ /dev/null
@@ -1,65 +0,0 @@
1$Id: pvr2fb.txt,v 1.1 2001/05/24 05:09:16 mrbrown Exp $
2
3What is pvr2fb?
4===============
5
6This is a driver for PowerVR 2 based graphics frame buffers, such as the
7one found in the Dreamcast.
8
9Advantages:
10
11 * It provides a nice large console (128 cols + 48 lines with 1024x768)
12 without using tiny, unreadable fonts (NOT on the Dreamcast)
13 * You can run XF86_FBDev on top of /dev/fb0
14 * Most important: boot logo :-)
15
16Disadvantages:
17
18 * Driver is largely untested on non-Dreamcast systems.
19
20Configuration
21=============
22
23You can pass kernel command line options to pvr2fb with
24`video=pvr2fb:option1,option2:value2,option3' (multiple options should be
25separated by comma, values are separated from options by `:').
26Accepted options:
27
28font:X - default font to use. All fonts are supported, including the
29 SUN12x22 font which is very nice at high resolutions.
30
31
32mode:X - default video mode with format [xres]x[yres]-<bpp>@<refresh rate>
33 The following video modes are supported:
34 640x640-16@60, 640x480-24@60, 640x480-32@60. The Dreamcast
35 defaults to 640x480-16@60. At the time of writing the
36 24bpp and 32bpp modes function poorly. Work to fix that is
37 ongoing
38
39 Note: the 640x240 mode is currently broken, and should not be
40 used for any reason. It is only mentioned here as a reference.
41
42inverse - invert colors on screen (for LCD displays)
43
44nomtrr - disables write combining on frame buffer. This slows down driver
45 but there is reported minor incompatibility between GUS DMA and
46 XFree under high loads if write combining is enabled (sound
47 dropouts). MTRR is enabled by default on systems that have it
48 configured and that support it.
49
50cable:X - cable type. This can be any of the following: vga, rgb, and
51 composite. If none is specified, we guess.
52
53output:X - output type. This can be any of the following: pal, ntsc, and
54 vga. If none is specified, we guess.
55
56X11
57===
58
59XF86_FBDev has been shown to work on the Dreamcast in the past - though not yet
60on any 2.6 series kernel.
61
62--
63Paul Mundt <lethal@linuxdc.org>
64Updated by Adrian McMenamin <adrian@mcmen.demon.co.uk>
65
diff --git a/Documentation/fb/pxafb.txt b/Documentation/fb/pxafb.rst
index d143a0a749f9..90177f5e7e76 100644
--- a/Documentation/fb/pxafb.txt
+++ b/Documentation/fb/pxafb.rst
@@ -1,59 +1,82 @@
1================================
1Driver for PXA25x LCD controller 2Driver for PXA25x LCD controller
2================================ 3================================
3 4
4The driver supports the following options, either via 5The driver supports the following options, either via
5options=<OPTIONS> when modular or video=pxafb:<OPTIONS> when built in. 6options=<OPTIONS> when modular or video=pxafb:<OPTIONS> when built in.
6 7
7For example: 8For example::
9
8 modprobe pxafb options=vmem:2M,mode:640x480-8,passive 10 modprobe pxafb options=vmem:2M,mode:640x480-8,passive
9or on the kernel command line 11
12or on the kernel command line::
13
10 video=pxafb:vmem:2M,mode:640x480-8,passive 14 video=pxafb:vmem:2M,mode:640x480-8,passive
11 15
12vmem: VIDEO_MEM_SIZE 16vmem: VIDEO_MEM_SIZE
17
13 Amount of video memory to allocate (can be suffixed with K or M 18 Amount of video memory to allocate (can be suffixed with K or M
14 for kilobytes or megabytes) 19 for kilobytes or megabytes)
15 20
16mode:XRESxYRES[-BPP] 21mode:XRESxYRES[-BPP]
22
17 XRES == LCCR1_PPL + 1 23 XRES == LCCR1_PPL + 1
24
18 YRES == LLCR2_LPP + 1 25 YRES == LLCR2_LPP + 1
26
19 The resolution of the display in pixels 27 The resolution of the display in pixels
28
20 BPP == The bit depth. Valid values are 1, 2, 4, 8 and 16. 29 BPP == The bit depth. Valid values are 1, 2, 4, 8 and 16.
21 30
22pixclock:PIXCLOCK 31pixclock:PIXCLOCK
32
23 Pixel clock in picoseconds 33 Pixel clock in picoseconds
24 34
25left:LEFT == LCCR1_BLW + 1 35left:LEFT == LCCR1_BLW + 1
36
26right:RIGHT == LCCR1_ELW + 1 37right:RIGHT == LCCR1_ELW + 1
38
27hsynclen:HSYNC == LCCR1_HSW + 1 39hsynclen:HSYNC == LCCR1_HSW + 1
40
28upper:UPPER == LCCR2_BFW 41upper:UPPER == LCCR2_BFW
42
29lower:LOWER == LCCR2_EFR 43lower:LOWER == LCCR2_EFR
44
30vsynclen:VSYNC == LCCR2_VSW + 1 45vsynclen:VSYNC == LCCR2_VSW + 1
46
31 Display margins and sync times 47 Display margins and sync times
32 48
33color | mono => LCCR0_CMS 49color | mono => LCCR0_CMS
50
34 umm... 51 umm...
35 52
36active | passive => LCCR0_PAS 53active | passive => LCCR0_PAS
54
37 Active (TFT) or Passive (STN) display 55 Active (TFT) or Passive (STN) display
38 56
39single | dual => LCCR0_SDS 57single | dual => LCCR0_SDS
58
40 Single or dual panel passive display 59 Single or dual panel passive display
41 60
424pix | 8pix => LCCR0_DPD 614pix | 8pix => LCCR0_DPD
62
43 4 or 8 pixel monochrome single panel data 63 4 or 8 pixel monochrome single panel data
44 64
45hsync:HSYNC 65hsync:HSYNC, vsync:VSYNC
46vsync:VSYNC 66
47 Horizontal and vertical sync. 0 => active low, 1 => active 67 Horizontal and vertical sync. 0 => active low, 1 => active
48 high. 68 high.
49 69
50dpc:DPC 70dpc:DPC
71
51 Double pixel clock. 1=>true, 0=>false 72 Double pixel clock. 1=>true, 0=>false
52 73
53outputen:POLARITY 74outputen:POLARITY
75
54 Output Enable Polarity. 0 => active low, 1 => active high 76 Output Enable Polarity. 0 => active low, 1 => active high
55 77
56pixclockpol:POLARITY 78pixclockpol:POLARITY
79
57 pixel clock polarity 80 pixel clock polarity
58 0 => falling edge, 1 => rising edge 81 0 => falling edge, 1 => rising edge
59 82
@@ -76,44 +99,50 @@ Overlay Support for PXA27x and later LCD controllers
76 not for such purpose). 99 not for such purpose).
77 100
78 2. overlay framebuffer is allocated dynamically according to specified 101 2. overlay framebuffer is allocated dynamically according to specified
79 'struct fb_var_screeninfo', the amount is decided by: 102 'struct fb_var_screeninfo', the amount is decided by::
80 103
81 var->xres_virtual * var->yres_virtual * bpp 104 var->xres_virtual * var->yres_virtual * bpp
82 105
83 bpp = 16 -- for RGB565 or RGBT555 106 bpp = 16 -- for RGB565 or RGBT555
84 = 24 -- for YUV444 packed 107
85 = 24 -- for YUV444 planar 108 bpp = 24 -- for YUV444 packed
86 = 16 -- for YUV422 planar (1 pixel = 1 Y + 1/2 Cb + 1/2 Cr) 109
87 = 12 -- for YUV420 planar (1 pixel = 1 Y + 1/4 Cb + 1/4 Cr) 110 bpp = 24 -- for YUV444 planar
111
112 bpp = 16 -- for YUV422 planar (1 pixel = 1 Y + 1/2 Cb + 1/2 Cr)
113
114 bpp = 12 -- for YUV420 planar (1 pixel = 1 Y + 1/4 Cb + 1/4 Cr)
88 115
89 NOTE: 116 NOTE:
90 117
91 a. overlay does not support panning in x-direction, thus 118 a. overlay does not support panning in x-direction, thus
92 var->xres_virtual will always be equal to var->xres 119 var->xres_virtual will always be equal to var->xres
93 120
94 b. line length of overlay(s) must be on a 32-bit word boundary, 121 b. line length of overlay(s) must be on a 32-bit word boundary,
95 for YUV planar modes, it is a requirement for the component 122 for YUV planar modes, it is a requirement for the component
96 with minimum bits per pixel, e.g. for YUV420, Cr component 123 with minimum bits per pixel, e.g. for YUV420, Cr component
97 for one pixel is actually 2-bits, it means the line length 124 for one pixel is actually 2-bits, it means the line length
98 should be a multiple of 16-pixels 125 should be a multiple of 16-pixels
99 126
100 c. starting horizontal position (XPOS) should start on a 32-bit 127 c. starting horizontal position (XPOS) should start on a 32-bit
101 word boundary, otherwise the fb_check_var() will just fail. 128 word boundary, otherwise the fb_check_var() will just fail.
102 129
103 d. the rectangle of the overlay should be within the base plane, 130 d. the rectangle of the overlay should be within the base plane,
104 otherwise fail 131 otherwise fail
105 132
106 Applications should follow the sequence below to operate an overlay 133 Applications should follow the sequence below to operate an overlay
107 framebuffer: 134 framebuffer:
108 135
109 a. open("/dev/fb[1-2]", ...) 136 a. open("/dev/fb[1-2]", ...)
110 b. ioctl(fd, FBIOGET_VSCREENINFO, ...) 137 b. ioctl(fd, FBIOGET_VSCREENINFO, ...)
111 c. modify 'var' with desired parameters: 138 c. modify 'var' with desired parameters:
139
112 1) var->xres and var->yres 140 1) var->xres and var->yres
113 2) larger var->yres_virtual if more memory is required, 141 2) larger var->yres_virtual if more memory is required,
114 usually for double-buffering 142 usually for double-buffering
115 3) var->nonstd for starting (x, y) and color format 143 3) var->nonstd for starting (x, y) and color format
116 4) var->{red, green, blue, transp} if RGB mode is to be used 144 4) var->{red, green, blue, transp} if RGB mode is to be used
145
117 d. ioctl(fd, FBIOPUT_VSCREENINFO, ...) 146 d. ioctl(fd, FBIOPUT_VSCREENINFO, ...)
118 e. ioctl(fd, FBIOGET_FSCREENINFO, ...) 147 e. ioctl(fd, FBIOGET_FSCREENINFO, ...)
119 f. mmap 148 f. mmap
@@ -124,19 +153,21 @@ Overlay Support for PXA27x and later LCD controllers
124 and lengths of each component within the framebuffer. 153 and lengths of each component within the framebuffer.
125 154
126 4. var->nonstd is used to pass starting (x, y) position and color format, 155 4. var->nonstd is used to pass starting (x, y) position and color format,
127 the detailed bit fields are shown below: 156 the detailed bit fields are shown below::
128 157
129 31 23 20 10 0 158 31 23 20 10 0
130 +-----------------+---+----------+----------+ 159 +-----------------+---+----------+----------+
131 | ... unused ... |FOR| XPOS | YPOS | 160 | ... unused ... |FOR| XPOS | YPOS |
132 +-----------------+---+----------+----------+ 161 +-----------------+---+----------+----------+
133 162
134 FOR - color format, as defined by OVERLAY_FORMAT_* in pxafb.h 163 FOR - color format, as defined by OVERLAY_FORMAT_* in pxafb.h
135 0 - RGB 164
136 1 - YUV444 PACKED 165 - 0 - RGB
137 2 - YUV444 PLANAR 166 - 1 - YUV444 PACKED
138 3 - YUV422 PLANAR 167 - 2 - YUV444 PLANAR
139 4 - YUR420 PLANAR 168 - 3 - YUV422 PLANAR
169 - 4 - YUR420 PLANAR
140 170
141 XPOS - starting horizontal position 171 XPOS - starting horizontal position
172
142 YPOS - starting vertical position 173 YPOS - starting vertical position
diff --git a/Documentation/fb/s3fb.txt b/Documentation/fb/s3fb.rst
index 2c97770bdbaa..e809d69c21a7 100644
--- a/Documentation/fb/s3fb.txt
+++ b/Documentation/fb/s3fb.rst
@@ -1,6 +1,6 @@
1 1===========================================
2 s3fb - fbdev driver for S3 Trio/Virge chips 2s3fb - fbdev driver for S3 Trio/Virge chips
3 =========================================== 3===========================================
4 4
5 5
6Supported Hardware 6Supported Hardware
@@ -56,7 +56,7 @@ Missing Features
56(alias TODO list) 56(alias TODO list)
57 57
58 * secondary (not initialized by BIOS) device support 58 * secondary (not initialized by BIOS) device support
59 * big endian support 59 * big endian support
60 * Zorro bus support 60 * Zorro bus support
61 * MMIO support 61 * MMIO support
62 * 24 bpp mode support on more cards 62 * 24 bpp mode support on more cards
diff --git a/Documentation/fb/sa1100fb.txt b/Documentation/fb/sa1100fb.rst
index f1b4220464df..67e2650e017d 100644
--- a/Documentation/fb/sa1100fb.txt
+++ b/Documentation/fb/sa1100fb.rst
@@ -1,17 +1,19 @@
1[This file is cloned from VesaFB/matroxfb] 1=================
2
3What is sa1100fb? 2What is sa1100fb?
4================= 3=================
5 4
5.. [This file is cloned from VesaFB/matroxfb]
6
7
6This is a driver for a graphic framebuffer for the SA-1100 LCD 8This is a driver for a graphic framebuffer for the SA-1100 LCD
7controller. 9controller.
8 10
9Configuration 11Configuration
10============== 12==============
11 13
12For most common passive displays, giving the option 14For most common passive displays, giving the option::
13 15
14video=sa1100fb:bpp:<value>,lccr0:<value>,lccr1:<value>,lccr2:<value>,lccr3:<value> 16 video=sa1100fb:bpp:<value>,lccr0:<value>,lccr1:<value>,lccr2:<value>,lccr3:<value>
15 17
16on the kernel command line should be enough to configure the 18on the kernel command line should be enough to configure the
17controller. The bits per pixel (bpp) value should be 4, 8, 12, or 19controller. The bits per pixel (bpp) value should be 4, 8, 12, or
@@ -27,13 +29,12 @@ sa1100fb_init_fbinfo(), sa1100fb_activate_var(),
27sa1100fb_disable_lcd_controller(), and sa1100fb_enable_lcd_controller() 29sa1100fb_disable_lcd_controller(), and sa1100fb_enable_lcd_controller()
28will probably be necessary. 30will probably be necessary.
29 31
30Accepted options: 32Accepted options::
31 33
32bpp:<value> Configure for <value> bits per pixel 34 bpp:<value> Configure for <value> bits per pixel
33lccr0:<value> Configure LCD control register 0 (11.7.3) 35 lccr0:<value> Configure LCD control register 0 (11.7.3)
34lccr1:<value> Configure LCD control register 1 (11.7.4) 36 lccr1:<value> Configure LCD control register 1 (11.7.4)
35lccr2:<value> Configure LCD control register 2 (11.7.5) 37 lccr2:<value> Configure LCD control register 2 (11.7.5)
36lccr3:<value> Configure LCD control register 3 (11.7.6) 38 lccr3:<value> Configure LCD control register 3 (11.7.6)
37 39
38--
39Mark Huang <mhuang@livetoy.com> 40Mark Huang <mhuang@livetoy.com>
diff --git a/Documentation/fb/sh7760fb.rst b/Documentation/fb/sh7760fb.rst
new file mode 100644
index 000000000000..c3266485f810
--- /dev/null
+++ b/Documentation/fb/sh7760fb.rst
@@ -0,0 +1,130 @@
1================================================
2SH7760/SH7763 integrated LCDC Framebuffer driver
3================================================
4
50. Overview
6-----------
7The SH7760/SH7763 have an integrated LCD Display controller (LCDC) which
8supports (in theory) resolutions ranging from 1x1 to 1024x1024,
9with color depths ranging from 1 to 16 bits, on STN, DSTN and TFT Panels.
10
11Caveats:
12
13* Framebuffer memory must be a large chunk allocated at the top
14 of Area3 (HW requirement). Because of this requirement you should NOT
15 make the driver a module since at runtime it may become impossible to
16 get a large enough contiguous chunk of memory.
17
18* The driver does not support changing resolution while loaded
19 (displays aren't hotpluggable anyway)
20
21* Heavy flickering may be observed
22 a) if you're using 15/16bit color modes at >= 640x480 px resolutions,
23 b) during PCMCIA (or any other slow bus) activity.
24
25* Rotation works only 90degress clockwise, and only if horizontal
26 resolution is <= 320 pixels.
27
28Files:
29 - drivers/video/sh7760fb.c
30 - include/asm-sh/sh7760fb.h
31 - Documentation/fb/sh7760fb.rst
32
331. Platform setup
34-----------------
35SH7760:
36 Video data is fetched via the DMABRG DMA engine, so you have to
37 configure the SH DMAC for DMABRG mode (write 0x94808080 to the
38 DMARSRA register somewhere at boot).
39
40 PFC registers PCCR and PCDR must be set to peripheral mode.
41 (write zeros to both).
42
43The driver does NOT do the above for you since board setup is, well, job
44of the board setup code.
45
462. Panel definitions
47--------------------
48The LCDC must explicitly be told about the type of LCD panel
49attached. Data must be wrapped in a "struct sh7760fb_platdata" and
50passed to the driver as platform_data.
51
52Suggest you take a closer look at the SH7760 Manual, Section 30.
53(http://documentation.renesas.com/eng/products/mpumcu/e602291_sh7760.pdf)
54
55The following code illustrates what needs to be done to
56get the framebuffer working on a 640x480 TFT::
57
58 #include <linux/fb.h>
59 #include <asm/sh7760fb.h>
60
61 /*
62 * NEC NL6440bc26-01 640x480 TFT
63 * dotclock 25175 kHz
64 * Xres 640 Yres 480
65 * Htotal 800 Vtotal 525
66 * HsynStart 656 VsynStart 490
67 * HsynLenn 30 VsynLenn 2
68 *
69 * The linux framebuffer layer does not use the syncstart/synclen
70 * values but right/left/upper/lower margin values. The comments
71 * for the x_margin explain how to calculate those from given
72 * panel sync timings.
73 */
74 static struct fb_videomode nl6448bc26 = {
75 .name = "NL6448BC26",
76 .refresh = 60,
77 .xres = 640,
78 .yres = 480,
79 .pixclock = 39683, /* in picoseconds! */
80 .hsync_len = 30,
81 .vsync_len = 2,
82 .left_margin = 114, /* HTOT - (HSYNSLEN + HSYNSTART) */
83 .right_margin = 16, /* HSYNSTART - XRES */
84 .upper_margin = 33, /* VTOT - (VSYNLEN + VSYNSTART) */
85 .lower_margin = 10, /* VSYNSTART - YRES */
86 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
87 .vmode = FB_VMODE_NONINTERLACED,
88 .flag = 0,
89 };
90
91 static struct sh7760fb_platdata sh7760fb_nl6448 = {
92 .def_mode = &nl6448bc26,
93 .ldmtr = LDMTR_TFT_COLOR_16, /* 16bit TFT panel */
94 .lddfr = LDDFR_8BPP, /* we want 8bit output */
95 .ldpmmr = 0x0070,
96 .ldpspr = 0x0500,
97 .ldaclnr = 0,
98 .ldickr = LDICKR_CLKSRC(LCDC_CLKSRC_EXTERNAL) |
99 LDICKR_CLKDIV(1),
100 .rotate = 0,
101 .novsync = 1,
102 .blank = NULL,
103 };
104
105 /* SH7760:
106 * 0xFE300800: 256 * 4byte xRGB palette ram
107 * 0xFE300C00: 42 bytes ctrl registers
108 */
109 static struct resource sh7760_lcdc_res[] = {
110 [0] = {
111 .start = 0xFE300800,
112 .end = 0xFE300CFF,
113 .flags = IORESOURCE_MEM,
114 },
115 [1] = {
116 .start = 65,
117 .end = 65,
118 .flags = IORESOURCE_IRQ,
119 },
120 };
121
122 static struct platform_device sh7760_lcdc_dev = {
123 .dev = {
124 .platform_data = &sh7760fb_nl6448,
125 },
126 .name = "sh7760-lcdc",
127 .id = -1,
128 .resource = sh7760_lcdc_res,
129 .num_resources = ARRAY_SIZE(sh7760_lcdc_res),
130 };
diff --git a/Documentation/fb/sh7760fb.txt b/Documentation/fb/sh7760fb.txt
deleted file mode 100644
index b994c3b10549..000000000000
--- a/Documentation/fb/sh7760fb.txt
+++ /dev/null
@@ -1,131 +0,0 @@
1SH7760/SH7763 integrated LCDC Framebuffer driver
2================================================
3
40. Overview
5-----------
6The SH7760/SH7763 have an integrated LCD Display controller (LCDC) which
7supports (in theory) resolutions ranging from 1x1 to 1024x1024,
8with color depths ranging from 1 to 16 bits, on STN, DSTN and TFT Panels.
9
10Caveats:
11* Framebuffer memory must be a large chunk allocated at the top
12 of Area3 (HW requirement). Because of this requirement you should NOT
13 make the driver a module since at runtime it may become impossible to
14 get a large enough contiguous chunk of memory.
15
16* The driver does not support changing resolution while loaded
17 (displays aren't hotpluggable anyway)
18
19* Heavy flickering may be observed
20 a) if you're using 15/16bit color modes at >= 640x480 px resolutions,
21 b) during PCMCIA (or any other slow bus) activity.
22
23* Rotation works only 90degress clockwise, and only if horizontal
24 resolution is <= 320 pixels.
25
26files: drivers/video/sh7760fb.c
27 include/asm-sh/sh7760fb.h
28 Documentation/fb/sh7760fb.txt
29
301. Platform setup
31-----------------
32SH7760:
33 Video data is fetched via the DMABRG DMA engine, so you have to
34 configure the SH DMAC for DMABRG mode (write 0x94808080 to the
35 DMARSRA register somewhere at boot).
36
37 PFC registers PCCR and PCDR must be set to peripheral mode.
38 (write zeros to both).
39
40The driver does NOT do the above for you since board setup is, well, job
41of the board setup code.
42
432. Panel definitions
44--------------------
45The LCDC must explicitly be told about the type of LCD panel
46attached. Data must be wrapped in a "struct sh7760fb_platdata" and
47passed to the driver as platform_data.
48
49Suggest you take a closer look at the SH7760 Manual, Section 30.
50(http://documentation.renesas.com/eng/products/mpumcu/e602291_sh7760.pdf)
51
52The following code illustrates what needs to be done to
53get the framebuffer working on a 640x480 TFT:
54
55====================== cut here ======================================
56
57#include <linux/fb.h>
58#include <asm/sh7760fb.h>
59
60/*
61 * NEC NL6440bc26-01 640x480 TFT
62 * dotclock 25175 kHz
63 * Xres 640 Yres 480
64 * Htotal 800 Vtotal 525
65 * HsynStart 656 VsynStart 490
66 * HsynLenn 30 VsynLenn 2
67 *
68 * The linux framebuffer layer does not use the syncstart/synclen
69 * values but right/left/upper/lower margin values. The comments
70 * for the x_margin explain how to calculate those from given
71 * panel sync timings.
72 */
73static struct fb_videomode nl6448bc26 = {
74 .name = "NL6448BC26",
75 .refresh = 60,
76 .xres = 640,
77 .yres = 480,
78 .pixclock = 39683, /* in picoseconds! */
79 .hsync_len = 30,
80 .vsync_len = 2,
81 .left_margin = 114, /* HTOT - (HSYNSLEN + HSYNSTART) */
82 .right_margin = 16, /* HSYNSTART - XRES */
83 .upper_margin = 33, /* VTOT - (VSYNLEN + VSYNSTART) */
84 .lower_margin = 10, /* VSYNSTART - YRES */
85 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
86 .vmode = FB_VMODE_NONINTERLACED,
87 .flag = 0,
88};
89
90static struct sh7760fb_platdata sh7760fb_nl6448 = {
91 .def_mode = &nl6448bc26,
92 .ldmtr = LDMTR_TFT_COLOR_16, /* 16bit TFT panel */
93 .lddfr = LDDFR_8BPP, /* we want 8bit output */
94 .ldpmmr = 0x0070,
95 .ldpspr = 0x0500,
96 .ldaclnr = 0,
97 .ldickr = LDICKR_CLKSRC(LCDC_CLKSRC_EXTERNAL) |
98 LDICKR_CLKDIV(1),
99 .rotate = 0,
100 .novsync = 1,
101 .blank = NULL,
102};
103
104/* SH7760:
105 * 0xFE300800: 256 * 4byte xRGB palette ram
106 * 0xFE300C00: 42 bytes ctrl registers
107 */
108static struct resource sh7760_lcdc_res[] = {
109 [0] = {
110 .start = 0xFE300800,
111 .end = 0xFE300CFF,
112 .flags = IORESOURCE_MEM,
113 },
114 [1] = {
115 .start = 65,
116 .end = 65,
117 .flags = IORESOURCE_IRQ,
118 },
119};
120
121static struct platform_device sh7760_lcdc_dev = {
122 .dev = {
123 .platform_data = &sh7760fb_nl6448,
124 },
125 .name = "sh7760-lcdc",
126 .id = -1,
127 .resource = sh7760_lcdc_res,
128 .num_resources = ARRAY_SIZE(sh7760_lcdc_res),
129};
130
131====================== cut here ======================================
diff --git a/Documentation/fb/sisfb.txt b/Documentation/fb/sisfb.rst
index 2e68e503e72f..8f4e502ea12e 100644
--- a/Documentation/fb/sisfb.txt
+++ b/Documentation/fb/sisfb.rst
@@ -1,4 +1,4 @@
1 1==============
2What is sisfb? 2What is sisfb?
3============== 3==============
4 4
@@ -41,11 +41,11 @@ statement to add the parameters to the kernel command line. Please see lilo's
41parameters are given with the modprobe (or insmod) command. 41parameters are given with the modprobe (or insmod) command.
42 42
43Example for sisfb as part of the static kernel: Add the following line to your 43Example for sisfb as part of the static kernel: Add the following line to your
44lilo.conf: 44lilo.conf::
45 45
46 append="video=sisfb:mode:1024x768x16,mem:12288,rate:75" 46 append="video=sisfb:mode:1024x768x16,mem:12288,rate:75"
47 47
48Example for sisfb as a module: Start sisfb by typing 48Example for sisfb as a module: Start sisfb by typing::
49 49
50 modprobe sisfb mode=1024x768x16 rate=75 mem=12288 50 modprobe sisfb mode=1024x768x16 rate=75 mem=12288
51 51
@@ -57,7 +57,7 @@ described above or the vesa keyword instead of mode). If compiled as a module,
57the parameter format reads mode=none or mode=1024x768x16 (or whatever mode you 57the parameter format reads mode=none or mode=1024x768x16 (or whatever mode you
58want to use). Using a "=" for a ":" (and vice versa) is a huge difference! 58want to use). Using a "=" for a ":" (and vice versa) is a huge difference!
59Additionally: If you give more than one argument to the in-kernel sisfb, the 59Additionally: If you give more than one argument to the in-kernel sisfb, the
60arguments are separated with ",". For example: 60arguments are separated with ",". For example::
61 61
62 video=sisfb:mode:1024x768x16,rate:75,mem:12288 62 video=sisfb:mode:1024x768x16,rate:75,mem:12288
63 63
@@ -73,6 +73,7 @@ supported options including some explanation.
73 73
74The desired display mode can be specified using the keyword "mode" with 74The desired display mode can be specified using the keyword "mode" with
75a parameter in one of the following formats: 75a parameter in one of the following formats:
76
76 - XxYxDepth or 77 - XxYxDepth or
77 - XxY-Depth or 78 - XxY-Depth or
78 - XxY-Depth@Rate or 79 - XxY-Depth@Rate or
@@ -130,29 +131,30 @@ Configuration
130 131
131(Some) accepted options: 132(Some) accepted options:
132 133
133off - Disable sisfb. This option is only understood if sisfb is 134========= ==================================================================
134 in-kernel, not a module. 135off Disable sisfb. This option is only understood if sisfb is
135mem:X - size of memory for the console, rest will be used for DRI/DRM. X 136 in-kernel, not a module.
136 is in kilobytes. On 300 series, the default is 4096, 8192 or 137mem:X size of memory for the console, rest will be used for DRI/DRM. X
138 is in kilobytes. On 300 series, the default is 4096, 8192 or
137 16384 (each in kilobyte) depending on how much video ram the card 139 16384 (each in kilobyte) depending on how much video ram the card
138 has. On 315/330 series, the default is the maximum available ram 140 has. On 315/330 series, the default is the maximum available ram
139 (since DRI/DRM is not supported for these chipsets). 141 (since DRI/DRM is not supported for these chipsets).
140noaccel - do not use 2D acceleration engine. (Default: use acceleration) 142noaccel do not use 2D acceleration engine. (Default: use acceleration)
141noypan - disable y-panning and scroll by redrawing the entire screen. 143noypan disable y-panning and scroll by redrawing the entire screen.
142 This is much slower than y-panning. (Default: use y-panning) 144 This is much slower than y-panning. (Default: use y-panning)
143vesa:X - selects startup videomode. X is number from 0 to 0x1FF and 145vesa:X selects startup videomode. X is number from 0 to 0x1FF and
144 represents the VESA mode number (can be given in decimal or 146 represents the VESA mode number (can be given in decimal or
145 hexadecimal form, the latter prefixed with "0x"). 147 hexadecimal form, the latter prefixed with "0x").
146mode:X - selects startup videomode. Please see above for the format of 148mode:X selects startup videomode. Please see above for the format of
147 "X". 149 "X".
150========= ==================================================================
148 151
149Boolean options such as "noaccel" or "noypan" are to be given without a 152Boolean options such as "noaccel" or "noypan" are to be given without a
150parameter if sisfb is in-kernel (for example "video=sisfb:noypan). If 153parameter if sisfb is in-kernel (for example "video=sisfb:noypan). If
151sisfb is a module, these are to be set to 1 (for example "modprobe sisfb 154sisfb is a module, these are to be set to 1 (for example "modprobe sisfb
152noypan=1"). 155noypan=1").
153 156
154--
155Thomas Winischhofer <thomas@winischhofer.net>
156May 27, 2004
157 157
158Thomas Winischhofer <thomas@winischhofer.net>
158 159
160May 27, 2004
diff --git a/Documentation/fb/sm501.txt b/Documentation/fb/sm501.rst
index 187f3b3ccb6c..03e02c8042a7 100644
--- a/Documentation/fb/sm501.txt
+++ b/Documentation/fb/sm501.rst
@@ -1,6 +1,11 @@
1=======
2sm501fb
3=======
4
1Configuration: 5Configuration:
2 6
3You can pass the following kernel command line options to sm501 videoframebuffer: 7You can pass the following kernel command line options to sm501
8videoframebuffer::
4 9
5 sm501fb.bpp= SM501 Display driver: 10 sm501fb.bpp= SM501 Display driver:
6 Specify bits-per-pixel if not specified by 'mode' 11 Specify bits-per-pixel if not specified by 'mode'
diff --git a/Documentation/fb/sm712fb.txt b/Documentation/fb/sm712fb.rst
index c388442edf51..994dad3b0238 100644
--- a/Documentation/fb/sm712fb.txt
+++ b/Documentation/fb/sm712fb.rst
@@ -1,5 +1,6 @@
1================
1What is sm712fb? 2What is sm712fb?
2================= 3================
3 4
4This is a graphics framebuffer driver for Silicon Motion SM712 based processors. 5This is a graphics framebuffer driver for Silicon Motion SM712 based processors.
5 6
@@ -15,13 +16,16 @@ You should not compile-in vesafb.
15 16
16Currently supported video modes are: 17Currently supported video modes are:
17 18
18[Graphic modes] 19Graphic modes
20-------------
19 21
20bpp | 640x480 800x600 1024x768 1280x1024 22=== ======= ======= ======== =========
21----+-------------------------------------------- 23bpp 640x480 800x600 1024x768 1280x1024
22 8 | 0x301 0x303 0x305 0x307 24=== ======= ======= ======== =========
23 16 | 0x311 0x314 0x317 0x31A 25 8 0x301 0x303 0x305 0x307
24 24 | 0x312 0x315 0x318 0x31B 26 16 0x311 0x314 0x317 0x31A
27 24 0x312 0x315 0x318 0x31B
28=== ======= ======= ======== =========
25 29
26Missing Features 30Missing Features
27================ 31================
diff --git a/Documentation/fb/sstfb.rst b/Documentation/fb/sstfb.rst
new file mode 100644
index 000000000000..8e8c1b940359
--- /dev/null
+++ b/Documentation/fb/sstfb.rst
@@ -0,0 +1,207 @@
1=====
2sstfb
3=====
4
5Introduction
6============
7
8This is a frame buffer device driver for 3dfx' Voodoo Graphics
9(aka voodoo 1, aka sst1) and Voodoo² (aka Voodoo 2, aka CVG) based
10video boards. It's highly experimental code, but is guaranteed to work
11on my computer, with my "Maxi Gamer 3D" and "Maxi Gamer 3d²" boards,
12and with me "between chair and keyboard". Some people tested other
13combinations and it seems that it works.
14The main page is located at <http://sstfb.sourceforge.net>, and if
15you want the latest version, check out the CVS, as the driver is a work
16in progress, I feel uncomfortable with releasing tarballs of something
17not completely working...Don't worry, it's still more than usable
18(I eat my own dog food)
19
20Please read the Bug section, and report any success or failure to me
21(Ghozlane Toumi <gtoumi@laposte.net>).
22BTW, If you have only one monitor , and you don't feel like playing
23with the vga passthrou cable, I can only suggest borrowing a screen
24somewhere...
25
26
27Installation
28============
29
30This driver (should) work on ix86, with "late" 2.2.x kernel (tested
31with x = 19) and "recent" 2.4.x kernel, as a module or compiled in.
32It has been included in mainstream kernel since the infamous 2.4.10.
33You can apply the patches found in `sstfb/kernel/*-2.{2|4}.x.patch`,
34and copy sstfb.c to linux/drivers/video/, or apply a single patch,
35`sstfb/patch-2.{2|4}.x-sstfb-yymmdd` to your linux source tree.
36
37Then configure your kernel as usual: choose "m" or "y" to 3Dfx Voodoo
38Graphics in section "console". Compile, install, have fun... and please
39drop me a report :)
40
41
42Module Usage
43============
44
45.. warning::
46
47 #. You should read completely this section before issuing any command.
48
49 #. If you have only one monitor to play with, once you insmod the
50 module, the 3dfx takes control of the output, so you'll have to
51 plug the monitor to the "normal" video board in order to issue
52 the commands, or you can blindly use sst_dbg_vgapass
53 in the tools directory (See Tools). The latest solution is pass the
54 parameter vgapass=1 when insmodding the driver. (See Kernel/Modules
55 Options)
56
57Module insertion
58----------------
59
60 #. insmod sstfb.o
61
62 you should see some strange output from the board:
63 a big blue square, a green and a red small squares and a vertical
64 white rectangle. why? the function's name is self-explanatory:
65 "sstfb_test()"...
66 (if you don't have a second monitor, you'll have to plug your monitor
67 directly to the 2D videocard to see what you're typing)
68
69 #. con2fb /dev/fbx /dev/ttyx
70
71 bind a tty to the new frame buffer. if you already have a frame
72 buffer driver, the voodoo fb will likely be /dev/fb1. if not,
73 the device will be /dev/fb0. You can check this by doing a
74 cat /proc/fb. You can find a copy of con2fb in tools/ directory.
75 if you don't have another fb device, this step is superfluous,
76 as the console subsystem automagicaly binds ttys to the fb.
77 #. switch to the virtual console you just mapped. "tadaaa" ...
78
79Module removal
80--------------
81
82 #. con2fb /dev/fbx /dev/ttyx
83
84 bind the tty to the old frame buffer so the module can be removed.
85 (how does it work with vgacon ? short answer : it doesn't work)
86
87 #. rmmod sstfb
88
89
90Kernel/Modules Options
91----------------------
92
93You can pass some options to the sstfb module, and via the kernel
94command line when the driver is compiled in:
95for module : insmod sstfb.o option1=value1 option2=value2 ...
96in kernel : video=sstfb:option1,option2:value2,option3 ...
97
98sstfb supports the following options:
99
100=============== =============== ===============================================
101Module Kernel Description
102=============== =============== ===============================================
103vgapass=0 vganopass Enable or disable VGA passthrou cable.
104vgapass=1 vgapass When enabled, the monitor will get the signal
105 from the VGA board and not from the voodoo.
106
107 Default: nopass
108
109mem=x mem:x Force frame buffer memory in MiB
110 allowed values: 0, 1, 2, 4.
111
112 Default: 0 (= autodetect)
113
114inverse=1 inverse Supposed to enable inverse console.
115 doesn't work yet...
116
117clipping=1 clipping Enable or disable clipping.
118clipping=0 noclipping With clipping enabled, all offscreen
119 reads and writes are discarded.
120
121 Default: enable clipping.
122
123gfxclk=x gfxclk:x Force graphic clock frequency (in MHz).
124 Be careful with this option, it may be
125 DANGEROUS.
126
127 Default: auto
128
129 - 50Mhz for Voodoo 1,
130 - 75MHz for Voodoo 2.
131
132slowpci=1 fastpci Enable or disable fast PCI read/writes.
133slowpci=1 slowpci Default : fastpci
134
135dev=x dev:x Attach the driver to device number x.
136 0 is the first compatible board (in
137 lspci order)
138=============== =============== ===============================================
139
140Tools
141=====
142
143These tools are mostly for debugging purposes, but you can
144find some of these interesting:
145
146- `con2fb`, maps a tty to a fbramebuffer::
147
148 con2fb /dev/fb1 /dev/tty5
149
150- `sst_dbg_vgapass`, changes vga passthrou. You have to recompile the
151 driver with SST_DEBUG and SST_DEBUG_IOCTL set to 1::
152
153 sst_dbg_vgapass /dev/fb1 1 (enables vga cable)
154 sst_dbg_vgapass /dev/fb1 0 (disables vga cable)
155
156- `glide_reset`, resets the voodoo using glide
157 use this after rmmoding sstfb, if the module refuses to
158 reinsert.
159
160Bugs
161====
162
163- DO NOT use glide while the sstfb module is in, you'll most likely
164 hang your computer.
165- If you see some artefacts (pixels not cleaning and stuff like that),
166 try turning off clipping (clipping=0), and/or using slowpci
167- the driver don't detect the 4Mb frame buffer voodoos, it seems that
168 the 2 last Mbs wrap around. looking into that .
169- The driver is 16 bpp only, 24/32 won't work.
170- The driver is not your_favorite_toy-safe. this includes SMP...
171
172 [Actually from inspection it seems to be safe - Alan]
173
174- When using XFree86 FBdev (X over fbdev) you may see strange color
175 patterns at the border of your windows (the pixels lose the lowest
176 byte -> basically the blue component and some of the green). I'm unable
177 to reproduce this with XFree86-3.3, but one of the testers has this
178 problem with XFree86-4. Apparently recent Xfree86-4.x solve this
179 problem.
180- I didn't really test changing the palette, so you may find some weird
181 things when playing with that.
182- Sometimes the driver will not recognise the DAC, and the
183 initialisation will fail. This is specifically true for
184 voodoo 2 boards, but it should be solved in recent versions. Please
185 contact me.
186- The 24/32 is not likely to work anytime soon, knowing that the
187 hardware does ... unusual things in 24/32 bpp.
188- When used with another video board, current limitations of the linux
189 console subsystem can cause some troubles, specifically, you should
190 disable software scrollback, as it can oops badly ...
191
192Todo
193====
194
195- Get rid of the previous paragraph.
196- Buy more coffee.
197- test/port to other arch.
198- try to add panning using tweeks with front and back buffer .
199- try to implement accel on voodoo2, this board can actually do a
200 lot in 2D even if it was sold as a 3D only board ...
201
202Ghozlane Toumi <gtoumi@laposte.net>
203
204
205Date: 2002/05/09 20:11:45
206
207http://sstfb.sourceforge.net/README
diff --git a/Documentation/fb/sstfb.txt b/Documentation/fb/sstfb.txt
deleted file mode 100644
index 13db1075e4a5..000000000000
--- a/Documentation/fb/sstfb.txt
+++ /dev/null
@@ -1,174 +0,0 @@
1
2Introduction
3
4 This is a frame buffer device driver for 3dfx' Voodoo Graphics
5 (aka voodoo 1, aka sst1) and Voodoo² (aka Voodoo 2, aka CVG) based
6 video boards. It's highly experimental code, but is guaranteed to work
7 on my computer, with my "Maxi Gamer 3D" and "Maxi Gamer 3d²" boards,
8 and with me "between chair and keyboard". Some people tested other
9 combinations and it seems that it works.
10 The main page is located at <http://sstfb.sourceforge.net>, and if
11 you want the latest version, check out the CVS, as the driver is a work
12 in progress, I feel uncomfortable with releasing tarballs of something
13 not completely working...Don't worry, it's still more than usable
14 (I eat my own dog food)
15
16 Please read the Bug section, and report any success or failure to me
17 (Ghozlane Toumi <gtoumi@laposte.net>).
18 BTW, If you have only one monitor , and you don't feel like playing
19 with the vga passthrou cable, I can only suggest borrowing a screen
20 somewhere...
21
22
23Installation
24
25 This driver (should) work on ix86, with "late" 2.2.x kernel (tested
26 with x = 19) and "recent" 2.4.x kernel, as a module or compiled in.
27 It has been included in mainstream kernel since the infamous 2.4.10.
28 You can apply the patches found in sstfb/kernel/*-2.{2|4}.x.patch,
29 and copy sstfb.c to linux/drivers/video/, or apply a single patch,
30 sstfb/patch-2.{2|4}.x-sstfb-yymmdd to your linux source tree.
31
32 Then configure your kernel as usual: choose "m" or "y" to 3Dfx Voodoo
33 Graphics in section "console". Compile, install, have fun... and please
34 drop me a report :)
35
36
37Module Usage
38
39 Warnings.
40 # You should read completely this section before issuing any command.
41 # If you have only one monitor to play with, once you insmod the
42 module, the 3dfx takes control of the output, so you'll have to
43 plug the monitor to the "normal" video board in order to issue
44 the commands, or you can blindly use sst_dbg_vgapass
45 in the tools directory (See Tools). The latest solution is pass the
46 parameter vgapass=1 when insmodding the driver. (See Kernel/Modules
47 Options)
48
49 Module insertion:
50 # insmod sstfb.o
51 you should see some strange output from the board:
52 a big blue square, a green and a red small squares and a vertical
53 white rectangle. why? the function's name is self-explanatory:
54 "sstfb_test()"...
55 (if you don't have a second monitor, you'll have to plug your monitor
56 directly to the 2D videocard to see what you're typing)
57 # con2fb /dev/fbx /dev/ttyx
58 bind a tty to the new frame buffer. if you already have a frame
59 buffer driver, the voodoo fb will likely be /dev/fb1. if not,
60 the device will be /dev/fb0. You can check this by doing a
61 cat /proc/fb. You can find a copy of con2fb in tools/ directory.
62 if you don't have another fb device, this step is superfluous,
63 as the console subsystem automagicaly binds ttys to the fb.
64 # switch to the virtual console you just mapped. "tadaaa" ...
65
66 Module removal:
67 # con2fb /dev/fbx /dev/ttyx
68 bind the tty to the old frame buffer so the module can be removed.
69 (how does it work with vgacon ? short answer : it doesn't work)
70 # rmmod sstfb
71
72
73Kernel/Modules Options
74
75 You can pass some options to the sstfb module, and via the kernel
76 command line when the driver is compiled in:
77 for module : insmod sstfb.o option1=value1 option2=value2 ...
78 in kernel : video=sstfb:option1,option2:value2,option3 ...
79
80 sstfb supports the following options :
81
82Module Kernel Description
83
84vgapass=0 vganopass Enable or disable VGA passthrou cable.
85vgapass=1 vgapass When enabled, the monitor will get the signal
86 from the VGA board and not from the voodoo.
87 Default: nopass
88
89mem=x mem:x Force frame buffer memory in MiB
90 allowed values: 0, 1, 2, 4.
91 Default: 0 (= autodetect)
92
93inverse=1 inverse Supposed to enable inverse console.
94 doesn't work yet...
95
96clipping=1 clipping Enable or disable clipping.
97clipping=0 noclipping With clipping enabled, all offscreen
98 reads and writes are discarded.
99 Default: enable clipping.
100
101gfxclk=x gfxclk:x Force graphic clock frequency (in MHz).
102 Be careful with this option, it may be
103 DANGEROUS.
104 Default: auto
105 50Mhz for Voodoo 1,
106 75MHz for Voodoo 2.
107
108slowpci=1 fastpci Enable or disable fast PCI read/writes.
109slowpci=1 slowpci Default : fastpci
110
111dev=x dev:x Attach the driver to device number x.
112 0 is the first compatible board (in
113 lspci order)
114
115Tools
116
117 These tools are mostly for debugging purposes, but you can
118 find some of these interesting :
119 - con2fb , maps a tty to a fbramebuffer .
120 con2fb /dev/fb1 /dev/tty5
121 - sst_dbg_vgapass , changes vga passthrou. You have to recompile the
122 driver with SST_DEBUG and SST_DEBUG_IOCTL set to 1
123 sst_dbg_vgapass /dev/fb1 1 (enables vga cable)
124 sst_dbg_vgapass /dev/fb1 0 (disables vga cable)
125 - glide_reset , resets the voodoo using glide
126 use this after rmmoding sstfb, if the module refuses to
127 reinsert .
128
129Bugs
130
131 - DO NOT use glide while the sstfb module is in, you'll most likely
132 hang your computer.
133 - If you see some artefacts (pixels not cleaning and stuff like that),
134 try turning off clipping (clipping=0), and/or using slowpci
135 - the driver don't detect the 4Mb frame buffer voodoos, it seems that
136 the 2 last Mbs wrap around. looking into that .
137 - The driver is 16 bpp only, 24/32 won't work.
138 - The driver is not your_favorite_toy-safe. this includes SMP...
139 [Actually from inspection it seems to be safe - Alan]
140 - When using XFree86 FBdev (X over fbdev) you may see strange color
141 patterns at the border of your windows (the pixels lose the lowest
142 byte -> basically the blue component and some of the green). I'm unable
143 to reproduce this with XFree86-3.3, but one of the testers has this
144 problem with XFree86-4. Apparently recent Xfree86-4.x solve this
145 problem.
146 - I didn't really test changing the palette, so you may find some weird
147 things when playing with that.
148 - Sometimes the driver will not recognise the DAC, and the
149 initialisation will fail. This is specifically true for
150 voodoo 2 boards, but it should be solved in recent versions. Please
151 contact me.
152 - The 24/32 is not likely to work anytime soon, knowing that the
153 hardware does ... unusual things in 24/32 bpp.
154 - When used with another video board, current limitations of the linux
155 console subsystem can cause some troubles, specifically, you should
156 disable software scrollback, as it can oops badly ...
157
158Todo
159
160 - Get rid of the previous paragraph.
161 - Buy more coffee.
162 - test/port to other arch.
163 - try to add panning using tweeks with front and back buffer .
164 - try to implement accel on voodoo2, this board can actually do a
165 lot in 2D even if it was sold as a 3D only board ...
166
167ghoz.
168
169--
170Ghozlane Toumi <gtoumi@laposte.net>
171
172
173$Date: 2002/05/09 20:11:45 $
174http://sstfb.sourceforge.net/README
diff --git a/Documentation/fb/tgafb.txt b/Documentation/fb/tgafb.rst
index 250083ada8fb..0c50d2134aa4 100644
--- a/Documentation/fb/tgafb.txt
+++ b/Documentation/fb/tgafb.rst
@@ -1,15 +1,14 @@
1$Id: tgafb.txt,v 1.1.2.2 2000/04/04 06:50:18 mato Exp $ 1==============
2
3What is tgafb? 2What is tgafb?
4=============== 3==============
5 4
6This is a driver for DECChip 21030 based graphics framebuffers, a.k.a. TGA 5This is a driver for DECChip 21030 based graphics framebuffers, a.k.a. TGA
7cards, which are usually found in older Digital Alpha systems. The 6cards, which are usually found in older Digital Alpha systems. The
8following models are supported: 7following models are supported:
9 8
10ZLxP-E1 (8bpp, 2 MB VRAM) 9- ZLxP-E1 (8bpp, 2 MB VRAM)
11ZLxP-E2 (32bpp, 8 MB VRAM) 10- ZLxP-E2 (32bpp, 8 MB VRAM)
12ZLxP-E3 (32bpp, 16 MB VRAM, Zbuffer) 11- ZLxP-E3 (32bpp, 16 MB VRAM, Zbuffer)
13 12
14This version is an almost complete rewrite of the code written by Geert 13This version is an almost complete rewrite of the code written by Geert
15Uytterhoeven, which was based on the original TGA console code written by 14Uytterhoeven, which was based on the original TGA console code written by
@@ -18,7 +17,7 @@ Jay Estabrook.
18Major new features since Linux 2.0.x: 17Major new features since Linux 2.0.x:
19 18
20 * Support for multiple resolutions 19 * Support for multiple resolutions
21 * Support for fixed-frequency and other oddball monitors 20 * Support for fixed-frequency and other oddball monitors
22 (by allowing the video mode to be set at boot time) 21 (by allowing the video mode to be set at boot time)
23 22
24User-visible changes since Linux 2.2.x: 23User-visible changes since Linux 2.2.x:
@@ -36,19 +35,22 @@ Configuration
36============= 35=============
37 36
38You can pass kernel command line options to tgafb with 37You can pass kernel command line options to tgafb with
39`video=tgafb:option1,option2:value2,option3' (multiple options should be 38`video=tgafb:option1,option2:value2,option3` (multiple options should be
40separated by comma, values are separated from options by `:'). 39separated by comma, values are separated from options by `:`).
40
41Accepted options: 41Accepted options:
42 42
43font:X - default font to use. All fonts are supported, including the 43========== ============================================================
44 SUN12x22 font which is very nice at high resolutions. 44font:X default font to use. All fonts are supported, including the
45 SUN12x22 font which is very nice at high resolutions.
45 46
46mode:X - default video mode. The following video modes are supported: 47mode:X default video mode. The following video modes are supported:
47 640x480-60, 800x600-56, 640x480-72, 800x600-60, 800x600-72, 48 640x480-60, 800x600-56, 640x480-72, 800x600-60, 800x600-72,
48 1024x768-60, 1152x864-60, 1024x768-70, 1024x768-76, 49 1024x768-60, 1152x864-60, 1024x768-70, 1024x768-76,
49 1152x864-70, 1280x1024-61, 1024x768-85, 1280x1024-70, 50 1152x864-70, 1280x1024-61, 1024x768-85, 1280x1024-70,
50 1152x864-84, 1280x1024-76, 1280x1024-85 51 1152x864-84, 1280x1024-76, 1280x1024-85
51 52========== ============================================================
53
52 54
53Known Issues 55Known Issues
54============ 56============
diff --git a/Documentation/fb/tridentfb.txt b/Documentation/fb/tridentfb.rst
index 45d9de5b13a3..7921c9dee78c 100644
--- a/Documentation/fb/tridentfb.txt
+++ b/Documentation/fb/tridentfb.rst
@@ -1,3 +1,7 @@
1=========
2Tridentfb
3=========
4
1Tridentfb is a framebuffer driver for some Trident chip based cards. 5Tridentfb is a framebuffer driver for some Trident chip based cards.
2 6
3The following list of chips is thought to be supported although not all are 7The following list of chips is thought to be supported although not all are
@@ -17,6 +21,7 @@ limited comparing to the range if acceleration is disabled (see list
17of parameters below). 21of parameters below).
18 22
19Known bugs: 23Known bugs:
24
201. The driver randomly locks up on 3DImage975 chip with acceleration 251. The driver randomly locks up on 3DImage975 chip with acceleration
21 enabled. The same happens in X11 (Xorg). 26 enabled. The same happens in X11 (Xorg).
222. The ramdac speeds require some more fine tuning. It is possible to 272. The ramdac speeds require some more fine tuning. It is possible to
@@ -26,28 +31,30 @@ Known bugs:
26How to use it? 31How to use it?
27============== 32==============
28 33
29When booting you can pass the video parameter. 34When booting you can pass the video parameter::
30video=tridentfb 35
36 video=tridentfb
31 37
32The parameters for tridentfb are concatenated with a ':' as in this example. 38The parameters for tridentfb are concatenated with a ':' as in this example::
33 39
34video=tridentfb:800x600-16@75,noaccel 40 video=tridentfb:800x600-16@75,noaccel
35 41
36The second level parameters that tridentfb understands are: 42The second level parameters that tridentfb understands are:
37 43
38noaccel - turns off acceleration (when it doesn't work for your card) 44======== =====================================================================
45noaccel turns off acceleration (when it doesn't work for your card)
39 46
40fp - use flat panel related stuff 47fp use flat panel related stuff
41crt - assume monitor is present instead of fp 48crt assume monitor is present instead of fp
42 49
43center - for flat panels and resolutions smaller than native size center the 50center for flat panels and resolutions smaller than native size center the
44 image, otherwise use 51 image, otherwise use
45stretch 52stretch
46 53
47memsize - integer value in KB, use if your card's memory size is misdetected. 54memsize integer value in KB, use if your card's memory size is misdetected.
48 look at the driver output to see what it says when initializing. 55 look at the driver output to see what it says when initializing.
49 56
50memdiff - integer value in KB, should be nonzero if your card reports 57memdiff integer value in KB, should be nonzero if your card reports
51 more memory than it actually has. For instance mine is 192K less than 58 more memory than it actually has. For instance mine is 192K less than
52 detection says in all three BIOS selectable situations 2M, 4M, 8M. 59 detection says in all three BIOS selectable situations 2M, 4M, 8M.
53 Only use if your video memory is taken from main memory hence of 60 Only use if your video memory is taken from main memory hence of
@@ -56,12 +63,13 @@ memdiff - integer value in KB, should be nonzero if your card reports
56 at the bottom this might help by not letting change to that mode 63 at the bottom this might help by not letting change to that mode
57 anymore. 64 anymore.
58 65
59nativex - the width in pixels of the flat panel.If you know it (usually 1024 66nativex the width in pixels of the flat panel.If you know it (usually 1024
60 800 or 1280) and it is not what the driver seems to detect use it. 67 800 or 1280) and it is not what the driver seems to detect use it.
61 68
62bpp - bits per pixel (8,16 or 32) 69bpp bits per pixel (8,16 or 32)
63mode - a mode name like 800x600-8@75 as described in 70mode a mode name like 800x600-8@75 as described in
64 Documentation/fb/modedb.txt 71 Documentation/fb/modedb.rst
72======== =====================================================================
65 73
66Using insane values for the above parameters will probably result in driver 74Using insane values for the above parameters will probably result in driver
67misbehaviour so take care(for instance memsize=12345678 or memdiff=23784 or 75misbehaviour so take care(for instance memsize=12345678 or memdiff=23784 or
diff --git a/Documentation/fb/udlfb.txt b/Documentation/fb/udlfb.rst
index c985cb65dd06..732b37db3504 100644
--- a/Documentation/fb/udlfb.txt
+++ b/Documentation/fb/udlfb.rst
@@ -1,6 +1,6 @@
1 1==============
2What is udlfb? 2What is udlfb?
3=============== 3==============
4 4
5This is a driver for DisplayLink USB 2.0 era graphics chips. 5This is a driver for DisplayLink USB 2.0 era graphics chips.
6 6
@@ -100,6 +100,7 @@ options udlfb fb_defio=0 console=1 shadow=1
100 100
101Accepted boolean options: 101Accepted boolean options:
102 102
103=============== ================================================================
103fb_defio Make use of the fb_defio (CONFIG_FB_DEFERRED_IO) kernel 104fb_defio Make use of the fb_defio (CONFIG_FB_DEFERRED_IO) kernel
104 module to track changed areas of the framebuffer by page faults. 105 module to track changed areas of the framebuffer by page faults.
105 Standard fbdev applications that use mmap but that do not 106 Standard fbdev applications that use mmap but that do not
@@ -109,7 +110,7 @@ fb_defio Make use of the fb_defio (CONFIG_FB_DEFERRED_IO) kernel
109 more stable, and higher performance. 110 more stable, and higher performance.
110 default: fb_defio=1 111 default: fb_defio=1
111 112
112console Allow fbcon to attach to udlfb provided framebuffers. 113console Allow fbcon to attach to udlfb provided framebuffers.
113 Can be disabled if fbcon and other clients 114 Can be disabled if fbcon and other clients
114 (e.g. X with --shared-vt) are in conflict. 115 (e.g. X with --shared-vt) are in conflict.
115 default: console=1 116 default: console=1
@@ -119,6 +120,7 @@ shadow Allocate a 2nd framebuffer to shadow what's currently across
119 do not transmit. Spends host memory to save USB transfers. 120 do not transmit. Spends host memory to save USB transfers.
120 Enabled by default. Only disable on very low memory systems. 121 Enabled by default. Only disable on very low memory systems.
121 default: shadow=1 122 default: shadow=1
123=============== ================================================================
122 124
123Sysfs Attributes 125Sysfs Attributes
124================ 126================
@@ -126,34 +128,35 @@ Sysfs Attributes
126Udlfb creates several files in /sys/class/graphics/fb? 128Udlfb creates several files in /sys/class/graphics/fb?
127Where ? is the sequential framebuffer id of the particular DisplayLink device 129Where ? is the sequential framebuffer id of the particular DisplayLink device
128 130
129edid If a valid EDID blob is written to this file (typically 131======================== ========================================================
130 by a udev rule), then udlfb will use this EDID as a 132edid If a valid EDID blob is written to this file (typically
131 backup in case reading the actual EDID of the monitor 133 by a udev rule), then udlfb will use this EDID as a
132 attached to the DisplayLink device fails. This is 134 backup in case reading the actual EDID of the monitor
133 especially useful for fixed panels, etc. that cannot 135 attached to the DisplayLink device fails. This is
134 communicate their capabilities via EDID. Reading 136 especially useful for fixed panels, etc. that cannot
135 this file returns the current EDID of the attached 137 communicate their capabilities via EDID. Reading
136 monitor (or last backup value written). This is 138 this file returns the current EDID of the attached
137 useful to get the EDID of the attached monitor, 139 monitor (or last backup value written). This is
138 which can be passed to utilities like parse-edid. 140 useful to get the EDID of the attached monitor,
141 which can be passed to utilities like parse-edid.
139 142
140metrics_bytes_rendered 32-bit count of pixel bytes rendered 143metrics_bytes_rendered 32-bit count of pixel bytes rendered
141 144
142metrics_bytes_identical 32-bit count of how many of those bytes were found to be 145metrics_bytes_identical 32-bit count of how many of those bytes were found to be
143 unchanged, based on a shadow framebuffer check 146 unchanged, based on a shadow framebuffer check
144 147
145metrics_bytes_sent 32-bit count of how many bytes were transferred over 148metrics_bytes_sent 32-bit count of how many bytes were transferred over
146 USB to communicate the resulting changed pixels to the 149 USB to communicate the resulting changed pixels to the
147 hardware. Includes compression and protocol overhead 150 hardware. Includes compression and protocol overhead
148 151
149metrics_cpu_kcycles_used 32-bit count of CPU cycles used in processing the 152metrics_cpu_kcycles_used 32-bit count of CPU cycles used in processing the
150 above pixels (in thousands of cycles). 153 above pixels (in thousands of cycles).
151 154
152metrics_reset Write-only. Any write to this file resets all metrics 155metrics_reset Write-only. Any write to this file resets all metrics
153 above to zero. Note that the 32-bit counters above 156 above to zero. Note that the 32-bit counters above
154 roll over very quickly. To get reliable results, design 157 roll over very quickly. To get reliable results, design
155 performance tests to start and finish in a very short 158 performance tests to start and finish in a very short
156 period of time (one minute or less is safe). 159 period of time (one minute or less is safe).
160======================== ========================================================
157 161
158--
159Bernie Thompson <bernie@plugable.com> 162Bernie Thompson <bernie@plugable.com>
diff --git a/Documentation/fb/uvesafb.txt b/Documentation/fb/uvesafb.rst
index aa924196c366..d1c2523fbb33 100644
--- a/Documentation/fb/uvesafb.txt
+++ b/Documentation/fb/uvesafb.rst
@@ -1,4 +1,4 @@
1 1==========================================================
2uvesafb - A Generic Driver for VBE2+ compliant video cards 2uvesafb - A Generic Driver for VBE2+ compliant video cards
3========================================================== 3==========================================================
4 4
@@ -49,7 +49,7 @@ The most important limitations are:
49 49
50uvesafb can be compiled either as a module, or directly into the kernel. 50uvesafb can be compiled either as a module, or directly into the kernel.
51In both cases it supports the same set of configuration options, which 51In both cases it supports the same set of configuration options, which
52are either given on the kernel command line or as module parameters, e.g.: 52are either given on the kernel command line or as module parameters, e.g.::
53 53
54 video=uvesafb:1024x768-32,mtrr:3,ywrap (compiled into the kernel) 54 video=uvesafb:1024x768-32,mtrr:3,ywrap (compiled into the kernel)
55 55
@@ -57,85 +57,90 @@ are either given on the kernel command line or as module parameters, e.g.:
57 57
58Accepted options: 58Accepted options:
59 59
60======= =========================================================
60ypan Enable display panning using the VESA protected mode 61ypan Enable display panning using the VESA protected mode
61 interface. The visible screen is just a window of the 62 interface. The visible screen is just a window of the
62 video memory, console scrolling is done by changing the 63 video memory, console scrolling is done by changing the
63 start of the window. This option is available on x86 64 start of the window. This option is available on x86
64 only and is the default option on that architecture. 65 only and is the default option on that architecture.
65 66
66ywrap Same as ypan, but assumes your gfx board can wrap-around 67ywrap Same as ypan, but assumes your gfx board can wrap-around
67 the video memory (i.e. starts reading from top if it 68 the video memory (i.e. starts reading from top if it
68 reaches the end of video memory). Faster than ypan. 69 reaches the end of video memory). Faster than ypan.
69 Available on x86 only. 70 Available on x86 only.
70 71
71redraw Scroll by redrawing the affected part of the screen, this 72redraw Scroll by redrawing the affected part of the screen, this
72 is the default on non-x86. 73 is the default on non-x86.
74======= =========================================================
73 75
74(If you're using uvesafb as a module, the above three options are 76(If you're using uvesafb as a module, the above three options are
75 used a parameter of the scroll option, e.g. scroll=ypan.) 77used a parameter of the scroll option, e.g. scroll=ypan.)
76 78
77vgapal Use the standard VGA registers for palette changes. 79=========== ====================================================================
80vgapal Use the standard VGA registers for palette changes.
78 81
79pmipal Use the protected mode interface for palette changes. 82pmipal Use the protected mode interface for palette changes.
80 This is the default if the protected mode interface is 83 This is the default if the protected mode interface is
81 available. Available on x86 only. 84 available. Available on x86 only.
82 85
83mtrr:n Setup memory type range registers for the framebuffer 86mtrr:n Setup memory type range registers for the framebuffer
84 where n: 87 where n:
85 0 - disabled (equivalent to nomtrr)
86 3 - write-combining (default)
87 88
88 Values other than 0 and 3 will result in a warning and will be 89 - 0 - disabled (equivalent to nomtrr)
89 treated just like 3. 90 - 3 - write-combining (default)
90 91
91nomtrr Do not use memory type range registers. 92 Values other than 0 and 3 will result in a warning and will be
93 treated just like 3.
94
95nomtrr Do not use memory type range registers.
92 96
93vremap:n 97vremap:n
94 Remap 'n' MiB of video RAM. If 0 or not specified, remap memory 98 Remap 'n' MiB of video RAM. If 0 or not specified, remap memory
95 according to video mode. 99 according to video mode.
96 100
97vtotal:n 101vtotal:n If the video BIOS of your card incorrectly determines the total
98 If the video BIOS of your card incorrectly determines the total 102 amount of video RAM, use this option to override the BIOS (in MiB).
99 amount of video RAM, use this option to override the BIOS (in MiB). 103
100 104<mode> The mode you want to set, in the standard modedb format. Refer to
101<mode> The mode you want to set, in the standard modedb format. Refer to 105 modedb.txt for a detailed description. When uvesafb is compiled as
102 modedb.txt for a detailed description. When uvesafb is compiled as 106 a module, the mode string should be provided as a value of the
103 a module, the mode string should be provided as a value of the 107 'mode_option' option.
104 'mode_option' option. 108
105 109vbemode:x Force the use of VBE mode x. The mode will only be set if it's
106vbemode:x 110 found in the VBE-provided list of supported modes.
107 Force the use of VBE mode x. The mode will only be set if it's 111 NOTE: The mode number 'x' should be specified in VESA mode number
108 found in the VBE-provided list of supported modes. 112 notation, not the Linux kernel one (eg. 257 instead of 769).
109 NOTE: The mode number 'x' should be specified in VESA mode number 113 HINT: If you use this option because normal <mode> parameter does
110 notation, not the Linux kernel one (eg. 257 instead of 769). 114 not work for you and you use a X server, you'll probably want to
111 HINT: If you use this option because normal <mode> parameter does 115 set the 'nocrtc' option to ensure that the video mode is properly
112 not work for you and you use a X server, you'll probably want to 116 restored after console <-> X switches.
113 set the 'nocrtc' option to ensure that the video mode is properly 117
114 restored after console <-> X switches. 118nocrtc Do not use CRTC timings while setting the video mode. This option
115 119 has any effect only if the Video BIOS is VBE 3.0 compliant. Use it
116nocrtc Do not use CRTC timings while setting the video mode. This option 120 if you have problems with modes set the standard way. Note that
117 has any effect only if the Video BIOS is VBE 3.0 compliant. Use it 121 using this option implies that any refresh rate adjustments will
118 if you have problems with modes set the standard way. Note that 122 be ignored and the refresh rate will stay at your BIOS default
119 using this option implies that any refresh rate adjustments will 123 (60 Hz).
120 be ignored and the refresh rate will stay at your BIOS default (60 Hz). 124
121 125noedid Do not try to fetch and use EDID-provided modes.
122noedid Do not try to fetch and use EDID-provided modes. 126
123 127noblank Disable hardware blanking.
124noblank Disable hardware blanking. 128
125 129v86d:path Set path to the v86d executable. This option is only available as
126v86d:path 130 a module parameter, and not as a part of the video= string. If you
127 Set path to the v86d executable. This option is only available as 131 need to use it and have uvesafb built into the kernel, use
128 a module parameter, and not as a part of the video= string. If you 132 uvesafb.v86d="path".
129 need to use it and have uvesafb built into the kernel, use 133=========== ====================================================================
130 uvesafb.v86d="path".
131 134
132Additionally, the following parameters may be provided. They all override the 135Additionally, the following parameters may be provided. They all override the
133EDID-provided values and BIOS defaults. Refer to your monitor's specs to get 136EDID-provided values and BIOS defaults. Refer to your monitor's specs to get
134the correct values for maxhf, maxvf and maxclk for your hardware. 137the correct values for maxhf, maxvf and maxclk for your hardware.
135 138
139=========== ======================================
136maxhf:n Maximum horizontal frequency (in kHz). 140maxhf:n Maximum horizontal frequency (in kHz).
137maxvf:n Maximum vertical frequency (in Hz). 141maxvf:n Maximum vertical frequency (in Hz).
138maxclk:n Maximum pixel clock (in MHz). 142maxclk:n Maximum pixel clock (in MHz).
143=========== ======================================
139 144
1404. The sysfs interface 1454. The sysfs interface
141---------------------- 146----------------------
@@ -146,27 +151,26 @@ additional information.
146Driver attributes: 151Driver attributes:
147 152
148/sys/bus/platform/drivers/uvesafb 153/sys/bus/platform/drivers/uvesafb
149 - v86d (default: /sbin/v86d) 154 v86d
155 (default: /sbin/v86d)
156
150 Path to the v86d executable. v86d is started by uvesafb 157 Path to the v86d executable. v86d is started by uvesafb
151 if an instance of the daemon isn't already running. 158 if an instance of the daemon isn't already running.
152 159
153Device attributes: 160Device attributes:
154 161
155/sys/bus/platform/drivers/uvesafb/uvesafb.0 162/sys/bus/platform/drivers/uvesafb/uvesafb.0
156 - nocrtc 163 nocrtc
157 Use the default refresh rate (60 Hz) if set to 1. 164 Use the default refresh rate (60 Hz) if set to 1.
158 165
159 - oem_product_name 166 oem_product_name, oem_product_rev, oem_string, oem_vendor
160 - oem_product_rev
161 - oem_string
162 - oem_vendor
163 Information about the card and its maker. 167 Information about the card and its maker.
164 168
165 - vbe_modes 169 vbe_modes
166 A list of video modes supported by the Video BIOS along with their 170 A list of video modes supported by the Video BIOS along with their
167 VBE mode numbers in hex. 171 VBE mode numbers in hex.
168 172
169 - vbe_version 173 vbe_version
170 A BCD value indicating the implemented VBE standard. 174 A BCD value indicating the implemented VBE standard.
171 175
1725. Miscellaneous 1765. Miscellaneous
@@ -176,9 +180,9 @@ Uvesafb will set a video mode with the default refresh rate and timings
176from the Video BIOS if you set pixclock to 0 in fb_var_screeninfo. 180from the Video BIOS if you set pixclock to 0 in fb_var_screeninfo.
177 181
178 182
179-- 183
180 Michal Januszewski <spock@gentoo.org> 184 Michal Januszewski <spock@gentoo.org>
185
181 Last updated: 2017-10-10 186 Last updated: 2017-10-10
182 187
183 Documentation of the uvesafb options is loosely based on vesafb.txt. 188 Documentation of the uvesafb options is loosely based on vesafb.txt.
184
diff --git a/Documentation/fb/vesafb.txt b/Documentation/fb/vesafb.rst
index 413bb73235be..2ed0dfb661cf 100644
--- a/Documentation/fb/vesafb.txt
+++ b/Documentation/fb/vesafb.rst
@@ -1,4 +1,4 @@
1 1===============
2What is vesafb? 2What is vesafb?
3=============== 3===============
4 4
@@ -40,30 +40,35 @@ The graphic modes are NOT in the list which you get if you boot with
40vga=ask and hit return. The mode you wish to use is derived from the 40vga=ask and hit return. The mode you wish to use is derived from the
41VESA mode number. Here are those VESA mode numbers: 41VESA mode number. Here are those VESA mode numbers:
42 42
43 | 640x480 800x600 1024x768 1280x1024 43====== ======= ======= ======== =========
44----+------------------------------------- 44colors 640x480 800x600 1024x768 1280x1024
45256 | 0x101 0x103 0x105 0x107 45====== ======= ======= ======== =========
4632k | 0x110 0x113 0x116 0x119 46256 0x101 0x103 0x105 0x107
4764k | 0x111 0x114 0x117 0x11A 4732k 0x110 0x113 0x116 0x119
4816M | 0x112 0x115 0x118 0x11B 4864k 0x111 0x114 0x117 0x11A
4916M 0x112 0x115 0x118 0x11B
50====== ======= ======= ======== =========
51
49 52
50The video mode number of the Linux kernel is the VESA mode number plus 53The video mode number of the Linux kernel is the VESA mode number plus
510x200. 540x200:
52 55
53 Linux_kernel_mode_number = VESA_mode_number + 0x200 56 Linux_kernel_mode_number = VESA_mode_number + 0x200
54 57
55So the table for the Kernel mode numbers are: 58So the table for the Kernel mode numbers are:
56 59
57 | 640x480 800x600 1024x768 1280x1024 60====== ======= ======= ======== =========
58----+------------------------------------- 61colors 640x480 800x600 1024x768 1280x1024
59256 | 0x301 0x303 0x305 0x307 62====== ======= ======= ======== =========
6032k | 0x310 0x313 0x316 0x319 63256 0x301 0x303 0x305 0x307
6164k | 0x311 0x314 0x317 0x31A 6432k 0x310 0x313 0x316 0x319
6216M | 0x312 0x315 0x318 0x31B 6564k 0x311 0x314 0x317 0x31A
6616M 0x312 0x315 0x318 0x31B
67====== ======= ======= ======== =========
63 68
64To enable one of those modes you have to specify "vga=ask" in the 69To enable one of those modes you have to specify "vga=ask" in the
65lilo.conf file and rerun LILO. Then you can type in the desired 70lilo.conf file and rerun LILO. Then you can type in the desired
66mode at the "vga=ask" prompt. For example if you like to use 71mode at the "vga=ask" prompt. For example if you like to use
671024x768x256 colors you have to say "305" at this prompt. 721024x768x256 colors you have to say "305" at this prompt.
68 73
69If this does not work, this might be because your BIOS does not support 74If this does not work, this might be because your BIOS does not support
@@ -72,10 +77,10 @@ Even if your board does, it might be the BIOS which does not. VESA BIOS
72Extensions v2.0 are required, 1.2 is NOT sufficient. You will get a 77Extensions v2.0 are required, 1.2 is NOT sufficient. You will get a
73"bad mode number" message if something goes wrong. 78"bad mode number" message if something goes wrong.
74 79
751. Note: LILO cannot handle hex, for booting directly with 801. Note: LILO cannot handle hex, for booting directly with
76 "vga=mode-number" you have to transform the numbers to decimal. 81 "vga=mode-number" you have to transform the numbers to decimal.
772. Note: Some newer versions of LILO appear to work with those hex values, 822. Note: Some newer versions of LILO appear to work with those hex values,
78 if you set the 0x in front of the numbers. 83 if you set the 0x in front of the numbers.
79 84
80X11 85X11
81=== 86===
@@ -120,62 +125,68 @@ Accepted options:
120 125
121inverse use inverse color map 126inverse use inverse color map
122 127
123ypan enable display panning using the VESA protected mode 128========= ======================================================================
124 interface. The visible screen is just a window of the 129ypan enable display panning using the VESA protected mode
125 video memory, console scrolling is done by changing the 130 interface. The visible screen is just a window of the
126 start of the window. 131 video memory, console scrolling is done by changing the
127 pro: * scrolling (fullscreen) is fast, because there is 132 start of the window.
133
134 pro:
135
136 * scrolling (fullscreen) is fast, because there is
128 no need to copy around data. 137 no need to copy around data.
129 * You'll get scrollback (the Shift-PgUp thing), 138 * You'll get scrollback (the Shift-PgUp thing),
130 the video memory can be used as scrollback buffer 139 the video memory can be used as scrollback buffer
131 kontra: * scrolling only parts of the screen causes some 140
141 kontra:
142
143 * scrolling only parts of the screen causes some
132 ugly flicker effects (boot logo flickers for 144 ugly flicker effects (boot logo flickers for
133 example). 145 example).
134 146
135ywrap Same as ypan, but assumes your gfx board can wrap-around 147ywrap Same as ypan, but assumes your gfx board can wrap-around
136 the video memory (i.e. starts reading from top if it 148 the video memory (i.e. starts reading from top if it
137 reaches the end of video memory). Faster than ypan. 149 reaches the end of video memory). Faster than ypan.
138 150
139redraw scroll by redrawing the affected part of the screen, this 151redraw Scroll by redrawing the affected part of the screen, this
140 is the safe (and slow) default. 152 is the safe (and slow) default.
141 153
142 154
143vgapal Use the standard vga registers for palette changes. 155vgapal Use the standard vga registers for palette changes.
144 This is the default. 156 This is the default.
145pmipal Use the protected mode interface for palette changes. 157pmipal Use the protected mode interface for palette changes.
146 158
147mtrr:n setup memory type range registers for the vesafb framebuffer 159mtrr:n Setup memory type range registers for the vesafb framebuffer
148 where n: 160 where n:
149 0 - disabled (equivalent to nomtrr) (default)
150 1 - uncachable
151 2 - write-back
152 3 - write-combining
153 4 - write-through
154 161
155 If you see the following in dmesg, choose the type that matches the 162 - 0 - disabled (equivalent to nomtrr) (default)
156 old one. In this example, use "mtrr:2". 163 - 1 - uncachable
164 - 2 - write-back
165 - 3 - write-combining
166 - 4 - write-through
167
168 If you see the following in dmesg, choose the type that matches the
169 old one. In this example, use "mtrr:2".
157... 170...
158mtrr: type mismatch for e0000000,8000000 old: write-back new: write-combining 171mtrr: type mismatch for e0000000,8000000 old: write-back new:
172 write-combining
159... 173...
160 174
161nomtrr disable mtrr 175nomtrr disable mtrr
162 176
163vremap:n 177vremap:n
164 remap 'n' MiB of video RAM. If 0 or not specified, remap memory 178 Remap 'n' MiB of video RAM. If 0 or not specified, remap memory
165 according to video mode. (2.5.66 patch/idea by Antonino Daplas 179 according to video mode. (2.5.66 patch/idea by Antonino Daplas
166 reversed to give override possibility (allocate more fb memory 180 reversed to give override possibility (allocate more fb memory
167 than the kernel would) to 2.4 by tmb@iki.fi) 181 than the kernel would) to 2.4 by tmb@iki.fi)
168 182
169vtotal:n 183vtotal:n If the video BIOS of your card incorrectly determines the total
170 if the video BIOS of your card incorrectly determines the total 184 amount of video RAM, use this option to override the BIOS (in MiB).
171 amount of video RAM, use this option to override the BIOS (in MiB). 185========= ======================================================================
172 186
173Have fun! 187Have fun!
174 188
175 Gerd
176
177--
178Gerd Knorr <kraxel@goldbach.in-berlin.de> 189Gerd Knorr <kraxel@goldbach.in-berlin.de>
179 190
180Minor (mostly typo) changes 191Minor (mostly typo) changes
181by Nico Schmoigl <schmoigl@rumms.uni-mannheim.de> 192by Nico Schmoigl <schmoigl@rumms.uni-mannheim.de>
diff --git a/Documentation/fb/viafb.rst b/Documentation/fb/viafb.rst
new file mode 100644
index 000000000000..8eb7a3bb068c
--- /dev/null
+++ b/Documentation/fb/viafb.rst
@@ -0,0 +1,297 @@
1=======================================================
2VIA Integration Graphic Chip Console Framebuffer Driver
3=======================================================
4
5Platform
6--------
7 The console framebuffer driver is for graphics chips of
8 VIA UniChrome Family
9 (CLE266, PM800 / CN400 / CN300,
10 P4M800CE / P4M800Pro / CN700 / VN800,
11 CX700 / VX700, K8M890, P4M890,
12 CN896 / P4M900, VX800, VX855)
13
14Driver features
15---------------
16 Device: CRT, LCD, DVI
17
18 Support viafb_mode::
19
20 CRT:
21 640x480(60, 75, 85, 100, 120 Hz), 720x480(60 Hz),
22 720x576(60 Hz), 800x600(60, 75, 85, 100, 120 Hz),
23 848x480(60 Hz), 856x480(60 Hz), 1024x512(60 Hz),
24 1024x768(60, 75, 85, 100 Hz), 1152x864(75 Hz),
25 1280x768(60 Hz), 1280x960(60 Hz), 1280x1024(60, 75, 85 Hz),
26 1440x1050(60 Hz), 1600x1200(60, 75 Hz), 1280x720(60 Hz),
27 1920x1080(60 Hz), 1400x1050(60 Hz), 800x480(60 Hz)
28
29 color depth: 8 bpp, 16 bpp, 32 bpp supports.
30
31 Support 2D hardware accelerator.
32
33Using the viafb module
34----------------------
35 Start viafb with default settings::
36
37 #modprobe viafb
38
39 Start viafb with user options::
40
41 #modprobe viafb viafb_mode=800x600 viafb_bpp=16 viafb_refresh=60
42 viafb_active_dev=CRT+DVI viafb_dvi_port=DVP1
43 viafb_mode1=1024x768 viafb_bpp=16 viafb_refresh1=60
44 viafb_SAMM_ON=1
45
46 viafb_mode:
47 - 640x480 (default)
48 - 720x480
49 - 800x600
50 - 1024x768
51
52 viafb_bpp:
53 - 8, 16, 32 (default:32)
54
55 viafb_refresh:
56 - 60, 75, 85, 100, 120 (default:60)
57
58 viafb_lcd_dsp_method:
59 - 0 : expansion (default)
60 - 1 : centering
61
62 viafb_lcd_mode:
63 0 : LCD panel with LSB data format input (default)
64 1 : LCD panel with MSB data format input
65
66 viafb_lcd_panel_id:
67 - 0 : Resolution: 640x480, Channel: single, Dithering: Enable
68 - 1 : Resolution: 800x600, Channel: single, Dithering: Enable
69 - 2 : Resolution: 1024x768, Channel: single, Dithering: Enable (default)
70 - 3 : Resolution: 1280x768, Channel: single, Dithering: Enable
71 - 4 : Resolution: 1280x1024, Channel: dual, Dithering: Enable
72 - 5 : Resolution: 1400x1050, Channel: dual, Dithering: Enable
73 - 6 : Resolution: 1600x1200, Channel: dual, Dithering: Enable
74
75 - 8 : Resolution: 800x480, Channel: single, Dithering: Enable
76 - 9 : Resolution: 1024x768, Channel: dual, Dithering: Enable
77 - 10: Resolution: 1024x768, Channel: single, Dithering: Disable
78 - 11: Resolution: 1024x768, Channel: dual, Dithering: Disable
79 - 12: Resolution: 1280x768, Channel: single, Dithering: Disable
80 - 13: Resolution: 1280x1024, Channel: dual, Dithering: Disable
81 - 14: Resolution: 1400x1050, Channel: dual, Dithering: Disable
82 - 15: Resolution: 1600x1200, Channel: dual, Dithering: Disable
83 - 16: Resolution: 1366x768, Channel: single, Dithering: Disable
84 - 17: Resolution: 1024x600, Channel: single, Dithering: Enable
85 - 18: Resolution: 1280x768, Channel: dual, Dithering: Enable
86 - 19: Resolution: 1280x800, Channel: single, Dithering: Enable
87
88 viafb_accel:
89 - 0 : No 2D Hardware Acceleration
90 - 1 : 2D Hardware Acceleration (default)
91
92 viafb_SAMM_ON:
93 - 0 : viafb_SAMM_ON disable (default)
94 - 1 : viafb_SAMM_ON enable
95
96 viafb_mode1: (secondary display device)
97 - 640x480 (default)
98 - 720x480
99 - 800x600
100 - 1024x768
101
102 viafb_bpp1: (secondary display device)
103 - 8, 16, 32 (default:32)
104
105 viafb_refresh1: (secondary display device)
106 - 60, 75, 85, 100, 120 (default:60)
107
108 viafb_active_dev:
109 This option is used to specify active devices.(CRT, DVI, CRT+LCD...)
110 DVI stands for DVI or HDMI, E.g., If you want to enable HDMI,
111 set viafb_active_dev=DVI. In SAMM case, the previous of
112 viafb_active_dev is primary device, and the following is
113 secondary device.
114
115 For example:
116
117 To enable one device, such as DVI only, we can use::
118
119 modprobe viafb viafb_active_dev=DVI
120
121 To enable two devices, such as CRT+DVI::
122
123 modprobe viafb viafb_active_dev=CRT+DVI;
124
125 For DuoView case, we can use::
126
127 modprobe viafb viafb_active_dev=CRT+DVI
128
129 OR::
130
131 modprobe viafb viafb_active_dev=DVI+CRT...
132
133 For SAMM case:
134
135 If CRT is primary and DVI is secondary, we should use::
136
137 modprobe viafb viafb_active_dev=CRT+DVI viafb_SAMM_ON=1...
138
139 If DVI is primary and CRT is secondary, we should use::
140
141 modprobe viafb viafb_active_dev=DVI+CRT viafb_SAMM_ON=1...
142
143 viafb_display_hardware_layout:
144 This option is used to specify display hardware layout for CX700 chip.
145
146 - 1 : LCD only
147 - 2 : DVI only
148 - 3 : LCD+DVI (default)
149 - 4 : LCD1+LCD2 (internal + internal)
150 - 16: LCD1+ExternalLCD2 (internal + external)
151
152 viafb_second_size:
153 This option is used to set second device memory size(MB) in SAMM case.
154 The minimal size is 16.
155
156 viafb_platform_epia_dvi:
157 This option is used to enable DVI on EPIA - M
158
159 - 0 : No DVI on EPIA - M (default)
160 - 1 : DVI on EPIA - M
161
162 viafb_bus_width:
163 When using 24 - Bit Bus Width Digital Interface,
164 this option should be set.
165
166 - 12: 12-Bit LVDS or 12-Bit TMDS (default)
167 - 24: 24-Bit LVDS or 24-Bit TMDS
168
169 viafb_device_lcd_dualedge:
170 When using Dual Edge Panel, this option should be set.
171
172 - 0 : No Dual Edge Panel (default)
173 - 1 : Dual Edge Panel
174
175 viafb_lcd_port:
176 This option is used to specify LCD output port,
177 available values are "DVP0" "DVP1" "DFP_HIGHLOW" "DFP_HIGH" "DFP_LOW".
178
179 for external LCD + external DVI on CX700(External LCD is on DVP0),
180 we should use::
181
182 modprobe viafb viafb_lcd_port=DVP0...
183
184Notes:
185 1. CRT may not display properly for DuoView CRT & DVI display at
186 the "640x480" PAL mode with DVI overscan enabled.
187 2. SAMM stands for single adapter multi monitors. It is different from
188 multi-head since SAMM support multi monitor at driver layers, thus fbcon
189 layer doesn't even know about it; SAMM's second screen doesn't have a
190 device node file, thus a user mode application can't access it directly.
191 When SAMM is enabled, viafb_mode and viafb_mode1, viafb_bpp and
192 viafb_bpp1, viafb_refresh and viafb_refresh1 can be different.
193 3. When console is depending on viafbinfo1, dynamically change resolution
194 and bpp, need to call VIAFB specified ioctl interface VIAFB_SET_DEVICE
195 instead of calling common ioctl function FBIOPUT_VSCREENINFO since
196 viafb doesn't support multi-head well, or it will cause screen crush.
197
198
199Configure viafb with "fbset" tool
200---------------------------------
201
202 "fbset" is an inbox utility of Linux.
203
204 1. Inquire current viafb information, type::
205
206 # fbset -i
207
208 2. Set various resolutions and viafb_refresh rates::
209
210 # fbset <resolution-vertical_sync>
211
212 example::
213
214 # fbset "1024x768-75"
215
216 or::
217
218 # fbset -g 1024 768 1024 768 32
219
220 Check the file "/etc/fb.modes" to find display modes available.
221
222 3. Set the color depth::
223
224 # fbset -depth <value>
225
226 example::
227
228 # fbset -depth 16
229
230
231Configure viafb via /proc
232-------------------------
233 The following files exist in /proc/viafb
234
235 supported_output_devices
236 This read-only file contains a full ',' separated list containing all
237 output devices that could be available on your platform. It is likely
238 that not all of those have a connector on your hardware but it should
239 provide a good starting point to figure out which of those names match
240 a real connector.
241
242 Example::
243
244 # cat /proc/viafb/supported_output_devices
245
246 iga1/output_devices, iga2/output_devices
247 These two files are readable and writable. iga1 and iga2 are the two
248 independent units that produce the screen image. Those images can be
249 forwarded to one or more output devices. Reading those files is a way
250 to query which output devices are currently used by an iga.
251
252 Example::
253
254 # cat /proc/viafb/iga1/output_devices
255
256 If there are no output devices printed the output of this iga is lost.
257 This can happen for example if only one (the other) iga is used.
258 Writing to these files allows adjusting the output devices during
259 runtime. One can add new devices, remove existing ones or switch
260 between igas. Essentially you can write a ',' separated list of device
261 names (or a single one) in the same format as the output to those
262 files. You can add a '+' or '-' as a prefix allowing simple addition
263 and removal of devices. So a prefix '+' adds the devices from your list
264 to the already existing ones, '-' removes the listed devices from the
265 existing ones and if no prefix is given it replaces all existing ones
266 with the listed ones. If you remove devices they are expected to turn
267 off. If you add devices that are already part of the other iga they are
268 removed there and added to the new one.
269
270 Examples:
271
272 Add CRT as output device to iga1::
273
274 # echo +CRT > /proc/viafb/iga1/output_devices
275
276 Remove (turn off) DVP1 and LVDS1 as output devices of iga2::
277
278 # echo -DVP1,LVDS1 > /proc/viafb/iga2/output_devices
279
280 Replace all iga1 output devices by CRT::
281
282 # echo CRT > /proc/viafb/iga1/output_devices
283
284
285Bootup with viafb
286-----------------
287
288Add the following line to your grub.conf::
289
290 append = "video=viafb:viafb_mode=1024x768,viafb_bpp=32,viafb_refresh=85"
291
292
293VIA Framebuffer modes
294=====================
295
296.. include:: viafb.modes
297 :literal:
diff --git a/Documentation/fb/viafb.txt b/Documentation/fb/viafb.txt
deleted file mode 100644
index 1cb2462a71ce..000000000000
--- a/Documentation/fb/viafb.txt
+++ /dev/null
@@ -1,252 +0,0 @@
1
2 VIA Integration Graphic Chip Console Framebuffer Driver
3
4[Platform]
5-----------------------
6 The console framebuffer driver is for graphics chips of
7 VIA UniChrome Family(CLE266, PM800 / CN400 / CN300,
8 P4M800CE / P4M800Pro / CN700 / VN800,
9 CX700 / VX700, K8M890, P4M890,
10 CN896 / P4M900, VX800, VX855)
11
12[Driver features]
13------------------------
14 Device: CRT, LCD, DVI
15
16 Support viafb_mode:
17 CRT:
18 640x480(60, 75, 85, 100, 120 Hz), 720x480(60 Hz),
19 720x576(60 Hz), 800x600(60, 75, 85, 100, 120 Hz),
20 848x480(60 Hz), 856x480(60 Hz), 1024x512(60 Hz),
21 1024x768(60, 75, 85, 100 Hz), 1152x864(75 Hz),
22 1280x768(60 Hz), 1280x960(60 Hz), 1280x1024(60, 75, 85 Hz),
23 1440x1050(60 Hz), 1600x1200(60, 75 Hz), 1280x720(60 Hz),
24 1920x1080(60 Hz), 1400x1050(60 Hz), 800x480(60 Hz)
25
26 color depth: 8 bpp, 16 bpp, 32 bpp supports.
27
28 Support 2D hardware accelerator.
29
30[Using the viafb module]
31-- -- --------------------
32 Start viafb with default settings:
33 #modprobe viafb
34
35 Start viafb with user options:
36 #modprobe viafb viafb_mode=800x600 viafb_bpp=16 viafb_refresh=60
37 viafb_active_dev=CRT+DVI viafb_dvi_port=DVP1
38 viafb_mode1=1024x768 viafb_bpp=16 viafb_refresh1=60
39 viafb_SAMM_ON=1
40
41 viafb_mode:
42 640x480 (default)
43 720x480
44 800x600
45 1024x768
46 ......
47
48 viafb_bpp:
49 8, 16, 32 (default:32)
50
51 viafb_refresh:
52 60, 75, 85, 100, 120 (default:60)
53
54 viafb_lcd_dsp_method:
55 0 : expansion (default)
56 1 : centering
57
58 viafb_lcd_mode:
59 0 : LCD panel with LSB data format input (default)
60 1 : LCD panel with MSB data format input
61
62 viafb_lcd_panel_id:
63 0 : Resolution: 640x480, Channel: single, Dithering: Enable
64 1 : Resolution: 800x600, Channel: single, Dithering: Enable
65 2 : Resolution: 1024x768, Channel: single, Dithering: Enable (default)
66 3 : Resolution: 1280x768, Channel: single, Dithering: Enable
67 4 : Resolution: 1280x1024, Channel: dual, Dithering: Enable
68 5 : Resolution: 1400x1050, Channel: dual, Dithering: Enable
69 6 : Resolution: 1600x1200, Channel: dual, Dithering: Enable
70
71 8 : Resolution: 800x480, Channel: single, Dithering: Enable
72 9 : Resolution: 1024x768, Channel: dual, Dithering: Enable
73 10: Resolution: 1024x768, Channel: single, Dithering: Disable
74 11: Resolution: 1024x768, Channel: dual, Dithering: Disable
75 12: Resolution: 1280x768, Channel: single, Dithering: Disable
76 13: Resolution: 1280x1024, Channel: dual, Dithering: Disable
77 14: Resolution: 1400x1050, Channel: dual, Dithering: Disable
78 15: Resolution: 1600x1200, Channel: dual, Dithering: Disable
79 16: Resolution: 1366x768, Channel: single, Dithering: Disable
80 17: Resolution: 1024x600, Channel: single, Dithering: Enable
81 18: Resolution: 1280x768, Channel: dual, Dithering: Enable
82 19: Resolution: 1280x800, Channel: single, Dithering: Enable
83
84 viafb_accel:
85 0 : No 2D Hardware Acceleration
86 1 : 2D Hardware Acceleration (default)
87
88 viafb_SAMM_ON:
89 0 : viafb_SAMM_ON disable (default)
90 1 : viafb_SAMM_ON enable
91
92 viafb_mode1: (secondary display device)
93 640x480 (default)
94 720x480
95 800x600
96 1024x768
97 ... ...
98
99 viafb_bpp1: (secondary display device)
100 8, 16, 32 (default:32)
101
102 viafb_refresh1: (secondary display device)
103 60, 75, 85, 100, 120 (default:60)
104
105 viafb_active_dev:
106 This option is used to specify active devices.(CRT, DVI, CRT+LCD...)
107 DVI stands for DVI or HDMI, E.g., If you want to enable HDMI,
108 set viafb_active_dev=DVI. In SAMM case, the previous of
109 viafb_active_dev is primary device, and the following is
110 secondary device.
111
112 For example:
113 To enable one device, such as DVI only, we can use:
114 modprobe viafb viafb_active_dev=DVI
115 To enable two devices, such as CRT+DVI:
116 modprobe viafb viafb_active_dev=CRT+DVI;
117
118 For DuoView case, we can use:
119 modprobe viafb viafb_active_dev=CRT+DVI
120 OR
121 modprobe viafb viafb_active_dev=DVI+CRT...
122
123 For SAMM case:
124 If CRT is primary and DVI is secondary, we should use:
125 modprobe viafb viafb_active_dev=CRT+DVI viafb_SAMM_ON=1...
126 If DVI is primary and CRT is secondary, we should use:
127 modprobe viafb viafb_active_dev=DVI+CRT viafb_SAMM_ON=1...
128
129 viafb_display_hardware_layout:
130 This option is used to specify display hardware layout for CX700 chip.
131 1 : LCD only
132 2 : DVI only
133 3 : LCD+DVI (default)
134 4 : LCD1+LCD2 (internal + internal)
135 16: LCD1+ExternalLCD2 (internal + external)
136
137 viafb_second_size:
138 This option is used to set second device memory size(MB) in SAMM case.
139 The minimal size is 16.
140
141 viafb_platform_epia_dvi:
142 This option is used to enable DVI on EPIA - M
143 0 : No DVI on EPIA - M (default)
144 1 : DVI on EPIA - M
145
146 viafb_bus_width:
147 When using 24 - Bit Bus Width Digital Interface,
148 this option should be set.
149 12: 12-Bit LVDS or 12-Bit TMDS (default)
150 24: 24-Bit LVDS or 24-Bit TMDS
151
152 viafb_device_lcd_dualedge:
153 When using Dual Edge Panel, this option should be set.
154 0 : No Dual Edge Panel (default)
155 1 : Dual Edge Panel
156
157 viafb_lcd_port:
158 This option is used to specify LCD output port,
159 available values are "DVP0" "DVP1" "DFP_HIGHLOW" "DFP_HIGH" "DFP_LOW".
160 for external LCD + external DVI on CX700(External LCD is on DVP0),
161 we should use:
162 modprobe viafb viafb_lcd_port=DVP0...
163
164Notes:
165 1. CRT may not display properly for DuoView CRT & DVI display at
166 the "640x480" PAL mode with DVI overscan enabled.
167 2. SAMM stands for single adapter multi monitors. It is different from
168 multi-head since SAMM support multi monitor at driver layers, thus fbcon
169 layer doesn't even know about it; SAMM's second screen doesn't have a
170 device node file, thus a user mode application can't access it directly.
171 When SAMM is enabled, viafb_mode and viafb_mode1, viafb_bpp and
172 viafb_bpp1, viafb_refresh and viafb_refresh1 can be different.
173 3. When console is depending on viafbinfo1, dynamically change resolution
174 and bpp, need to call VIAFB specified ioctl interface VIAFB_SET_DEVICE
175 instead of calling common ioctl function FBIOPUT_VSCREENINFO since
176 viafb doesn't support multi-head well, or it will cause screen crush.
177
178
179[Configure viafb with "fbset" tool]
180-----------------------------------
181 "fbset" is an inbox utility of Linux.
182 1. Inquire current viafb information, type,
183 # fbset -i
184
185 2. Set various resolutions and viafb_refresh rates,
186 # fbset <resolution-vertical_sync>
187
188 example,
189 # fbset "1024x768-75"
190 or
191 # fbset -g 1024 768 1024 768 32
192 Check the file "/etc/fb.modes" to find display modes available.
193
194 3. Set the color depth,
195 # fbset -depth <value>
196
197 example,
198 # fbset -depth 16
199
200
201[Configure viafb via /proc]
202---------------------------
203 The following files exist in /proc/viafb
204
205 supported_output_devices
206
207 This read-only file contains a full ',' separated list containing all
208 output devices that could be available on your platform. It is likely
209 that not all of those have a connector on your hardware but it should
210 provide a good starting point to figure out which of those names match
211 a real connector.
212 Example:
213 # cat /proc/viafb/supported_output_devices
214
215 iga1/output_devices
216 iga2/output_devices
217
218 These two files are readable and writable. iga1 and iga2 are the two
219 independent units that produce the screen image. Those images can be
220 forwarded to one or more output devices. Reading those files is a way
221 to query which output devices are currently used by an iga.
222 Example:
223 # cat /proc/viafb/iga1/output_devices
224 If there are no output devices printed the output of this iga is lost.
225 This can happen for example if only one (the other) iga is used.
226 Writing to these files allows adjusting the output devices during
227 runtime. One can add new devices, remove existing ones or switch
228 between igas. Essentially you can write a ',' separated list of device
229 names (or a single one) in the same format as the output to those
230 files. You can add a '+' or '-' as a prefix allowing simple addition
231 and removal of devices. So a prefix '+' adds the devices from your list
232 to the already existing ones, '-' removes the listed devices from the
233 existing ones and if no prefix is given it replaces all existing ones
234 with the listed ones. If you remove devices they are expected to turn
235 off. If you add devices that are already part of the other iga they are
236 removed there and added to the new one.
237 Examples:
238 Add CRT as output device to iga1
239 # echo +CRT > /proc/viafb/iga1/output_devices
240
241 Remove (turn off) DVP1 and LVDS1 as output devices of iga2
242 # echo -DVP1,LVDS1 > /proc/viafb/iga2/output_devices
243
244 Replace all iga1 output devices by CRT
245 # echo CRT > /proc/viafb/iga1/output_devices
246
247
248[Bootup with viafb]:
249--------------------
250 Add the following line to your grub.conf:
251 append = "video=viafb:viafb_mode=1024x768,viafb_bpp=32,viafb_refresh=85"
252
diff --git a/Documentation/fb/vt8623fb.txt b/Documentation/fb/vt8623fb.rst
index f654576c56b7..ba1730937dd8 100644
--- a/Documentation/fb/vt8623fb.txt
+++ b/Documentation/fb/vt8623fb.rst
@@ -1,13 +1,13 @@
1 1===============================================================
2 vt8623fb - fbdev driver for graphics core in VIA VT8623 chipset 2vt8623fb - fbdev driver for graphics core in VIA VT8623 chipset
3 =============================================================== 3===============================================================
4 4
5 5
6Supported Hardware 6Supported Hardware
7================== 7==================
8 8
9 VIA VT8623 [CLE266] chipset and its graphics core 9VIA VT8623 [CLE266] chipset and its graphics core
10 (known as CastleRock or Unichrome) 10(known as CastleRock or Unichrome)
11 11
12I tested vt8623fb on VIA EPIA ML-6000 12I tested vt8623fb on VIA EPIA ML-6000
13 13
diff --git a/Documentation/features/debug/stackprotector/arch-support.txt b/Documentation/features/debug/stackprotector/arch-support.txt
index 9999ea521f3e..32bbdfc64c32 100644
--- a/Documentation/features/debug/stackprotector/arch-support.txt
+++ b/Documentation/features/debug/stackprotector/arch-support.txt
@@ -22,7 +22,7 @@
22 | nios2: | TODO | 22 | nios2: | TODO |
23 | openrisc: | TODO | 23 | openrisc: | TODO |
24 | parisc: | TODO | 24 | parisc: | TODO |
25 | powerpc: | TODO | 25 | powerpc: | ok |
26 | riscv: | TODO | 26 | riscv: | TODO |
27 | s390: | TODO | 27 | s390: | TODO |
28 | sh: | ok | 28 | sh: | ok |
diff --git a/Documentation/filesystems/api-summary.rst b/Documentation/filesystems/api-summary.rst
index aa51ffcfa029..bbb0c1c0e5cf 100644
--- a/Documentation/filesystems/api-summary.rst
+++ b/Documentation/filesystems/api-summary.rst
@@ -89,9 +89,6 @@ Other Functions
89.. kernel-doc:: fs/direct-io.c 89.. kernel-doc:: fs/direct-io.c
90 :export: 90 :export:
91 91
92.. kernel-doc:: fs/file_table.c
93 :export:
94
95.. kernel-doc:: fs/libfs.c 92.. kernel-doc:: fs/libfs.c
96 :export: 93 :export:
97 94
diff --git a/Documentation/filesystems/ext4/index.rst b/Documentation/filesystems/ext4/index.rst
index 3be3e54d480d..705d813d558f 100644
--- a/Documentation/filesystems/ext4/index.rst
+++ b/Documentation/filesystems/ext4/index.rst
@@ -8,7 +8,7 @@ ext4 Data Structures and Algorithms
8 :maxdepth: 6 8 :maxdepth: 6
9 :numbered: 9 :numbered:
10 10
11 about.rst 11 about
12 overview.rst 12 overview
13 globals.rst 13 globals
14 dynamic.rst 14 dynamic
diff --git a/Documentation/filesystems/index.rst b/Documentation/filesystems/index.rst
index 1131c34d77f6..2de2fe2ab078 100644
--- a/Documentation/filesystems/index.rst
+++ b/Documentation/filesystems/index.rst
@@ -16,7 +16,8 @@ algorithms work.
16.. toctree:: 16.. toctree::
17 :maxdepth: 2 17 :maxdepth: 2
18 18
19 path-lookup.rst 19 vfs
20 path-lookup
20 api-summary 21 api-summary
21 splice 22 splice
22 23
@@ -31,13 +32,3 @@ filesystem implementations.
31 32
32 journalling 33 journalling
33 fscrypt 34 fscrypt
34
35Filesystem-specific documentation
36=================================
37
38Documentation for individual filesystem types can be found here.
39
40.. toctree::
41 :maxdepth: 2
42
43 binderfs.rst
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 3bd1148d8bb6..2813a19389fe 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -330,14 +330,14 @@ unreferenced dentries, and is now only called when the dentry refcount goes to
330[mandatory] 330[mandatory]
331 331
332 .d_compare() calling convention and locking rules are significantly 332 .d_compare() calling convention and locking rules are significantly
333changed. Read updated documentation in Documentation/filesystems/vfs.txt (and 333changed. Read updated documentation in Documentation/filesystems/vfs.rst (and
334look at examples of other filesystems) for guidance. 334look at examples of other filesystems) for guidance.
335 335
336--- 336---
337[mandatory] 337[mandatory]
338 338
339 .d_hash() calling convention and locking rules are significantly 339 .d_hash() calling convention and locking rules are significantly
340changed. Read updated documentation in Documentation/filesystems/vfs.txt (and 340changed. Read updated documentation in Documentation/filesystems/vfs.rst (and
341look at examples of other filesystems) for guidance. 341look at examples of other filesystems) for guidance.
342 342
343--- 343---
@@ -377,12 +377,12 @@ where possible.
377the filesystem provides it), which requires dropping out of rcu-walk mode. This 377the filesystem provides it), which requires dropping out of rcu-walk mode. This
378may now be called in rcu-walk mode (nd->flags & LOOKUP_RCU). -ECHILD should be 378may now be called in rcu-walk mode (nd->flags & LOOKUP_RCU). -ECHILD should be
379returned if the filesystem cannot handle rcu-walk. See 379returned if the filesystem cannot handle rcu-walk. See
380Documentation/filesystems/vfs.txt for more details. 380Documentation/filesystems/vfs.rst for more details.
381 381
382 permission is an inode permission check that is called on many or all 382 permission is an inode permission check that is called on many or all
383directory inodes on the way down a path walk (to check for exec permission). It 383directory inodes on the way down a path walk (to check for exec permission). It
384must now be rcu-walk aware (mask & MAY_NOT_BLOCK). See 384must now be rcu-walk aware (mask & MAY_NOT_BLOCK). See
385Documentation/filesystems/vfs.txt for more details. 385Documentation/filesystems/vfs.rst for more details.
386 386
387-- 387--
388[mandatory] 388[mandatory]
@@ -625,7 +625,7 @@ in your dentry operations instead.
625-- 625--
626[mandatory] 626[mandatory]
627 ->clone_file_range() and ->dedupe_file_range have been replaced with 627 ->clone_file_range() and ->dedupe_file_range have been replaced with
628 ->remap_file_range(). See Documentation/filesystems/vfs.txt for more 628 ->remap_file_range(). See Documentation/filesystems/vfs.rst for more
629 information. 629 information.
630-- 630--
631[recommended] 631[recommended]
diff --git a/Documentation/filesystems/ubifs-authentication.md b/Documentation/filesystems/ubifs-authentication.md
index 028b3e2e25f9..23e698167141 100644
--- a/Documentation/filesystems/ubifs-authentication.md
+++ b/Documentation/filesystems/ubifs-authentication.md
@@ -417,9 +417,9 @@ will then have to be provided beforehand in the normal way.
417 417
418[DMC-CBC-ATTACK] http://www.jakoblell.com/blog/2013/12/22/practical-malleability-attack-against-cbc-encrypted-luks-partitions/ 418[DMC-CBC-ATTACK] http://www.jakoblell.com/blog/2013/12/22/practical-malleability-attack-against-cbc-encrypted-luks-partitions/
419 419
420[DM-INTEGRITY] https://www.kernel.org/doc/Documentation/device-mapper/dm-integrity.txt 420[DM-INTEGRITY] https://www.kernel.org/doc/Documentation/device-mapper/dm-integrity.rst
421 421
422[DM-VERITY] https://www.kernel.org/doc/Documentation/device-mapper/verity.txt 422[DM-VERITY] https://www.kernel.org/doc/Documentation/device-mapper/verity.rst
423 423
424[FSCRYPT-POLICY2] https://www.spinics.net/lists/linux-ext4/msg58710.html 424[FSCRYPT-POLICY2] https://www.spinics.net/lists/linux-ext4/msg58710.html
425 425
diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
new file mode 100644
index 000000000000..0f85ab21c2ca
--- /dev/null
+++ b/Documentation/filesystems/vfs.rst
@@ -0,0 +1,1428 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3=========================================
4Overview of the Linux Virtual File System
5=========================================
6
7Original author: Richard Gooch <rgooch@atnf.csiro.au>
8
9- Copyright (C) 1999 Richard Gooch
10- Copyright (C) 2005 Pekka Enberg
11
12
13Introduction
14============
15
16The Virtual File System (also known as the Virtual Filesystem Switch) is
17the software layer in the kernel that provides the filesystem interface
18to userspace programs. It also provides an abstraction within the
19kernel which allows different filesystem implementations to coexist.
20
21VFS system calls open(2), stat(2), read(2), write(2), chmod(2) and so on
22are called from a process context. Filesystem locking is described in
23the document Documentation/filesystems/Locking.
24
25
26Directory Entry Cache (dcache)
27------------------------------
28
29The VFS implements the open(2), stat(2), chmod(2), and similar system
30calls. The pathname argument that is passed to them is used by the VFS
31to search through the directory entry cache (also known as the dentry
32cache or dcache). This provides a very fast look-up mechanism to
33translate a pathname (filename) into a specific dentry. Dentries live
34in RAM and are never saved to disc: they exist only for performance.
35
36The dentry cache is meant to be a view into your entire filespace. As
37most computers cannot fit all dentries in the RAM at the same time, some
38bits of the cache are missing. In order to resolve your pathname into a
39dentry, the VFS may have to resort to creating dentries along the way,
40and then loading the inode. This is done by looking up the inode.
41
42
43The Inode Object
44----------------
45
46An individual dentry usually has a pointer to an inode. Inodes are
47filesystem objects such as regular files, directories, FIFOs and other
48beasts. They live either on the disc (for block device filesystems) or
49in the memory (for pseudo filesystems). Inodes that live on the disc
50are copied into the memory when required and changes to the inode are
51written back to disc. A single inode can be pointed to by multiple
52dentries (hard links, for example, do this).
53
54To look up an inode requires that the VFS calls the lookup() method of
55the parent directory inode. This method is installed by the specific
56filesystem implementation that the inode lives in. Once the VFS has the
57required dentry (and hence the inode), we can do all those boring things
58like open(2) the file, or stat(2) it to peek at the inode data. The
59stat(2) operation is fairly simple: once the VFS has the dentry, it
60peeks at the inode data and passes some of it back to userspace.
61
62
63The File Object
64---------------
65
66Opening a file requires another operation: allocation of a file
67structure (this is the kernel-side implementation of file descriptors).
68The freshly allocated file structure is initialized with a pointer to
69the dentry and a set of file operation member functions. These are
70taken from the inode data. The open() file method is then called so the
71specific filesystem implementation can do its work. You can see that
72this is another switch performed by the VFS. The file structure is
73placed into the file descriptor table for the process.
74
75Reading, writing and closing files (and other assorted VFS operations)
76is done by using the userspace file descriptor to grab the appropriate
77file structure, and then calling the required file structure method to
78do whatever is required. For as long as the file is open, it keeps the
79dentry in use, which in turn means that the VFS inode is still in use.
80
81
82Registering and Mounting a Filesystem
83=====================================
84
85To register and unregister a filesystem, use the following API
86functions:
87
88.. code-block:: c
89
90 #include <linux/fs.h>
91
92 extern int register_filesystem(struct file_system_type *);
93 extern int unregister_filesystem(struct file_system_type *);
94
95The passed struct file_system_type describes your filesystem. When a
96request is made to mount a filesystem onto a directory in your
97namespace, the VFS will call the appropriate mount() method for the
98specific filesystem. New vfsmount referring to the tree returned by
99->mount() will be attached to the mountpoint, so that when pathname
100resolution reaches the mountpoint it will jump into the root of that
101vfsmount.
102
103You can see all filesystems that are registered to the kernel in the
104file /proc/filesystems.
105
106
107struct file_system_type
108-----------------------
109
110This describes the filesystem. As of kernel 2.6.39, the following
111members are defined:
112
113.. code-block:: c
114
115 struct file_system_operations {
116 const char *name;
117 int fs_flags;
118 struct dentry *(*mount) (struct file_system_type *, int,
119 const char *, void *);
120 void (*kill_sb) (struct super_block *);
121 struct module *owner;
122 struct file_system_type * next;
123 struct list_head fs_supers;
124 struct lock_class_key s_lock_key;
125 struct lock_class_key s_umount_key;
126 };
127
128``name``
129 the name of the filesystem type, such as "ext2", "iso9660",
130 "msdos" and so on
131
132``fs_flags``
133 various flags (i.e. FS_REQUIRES_DEV, FS_NO_DCACHE, etc.)
134
135``mount``
136 the method to call when a new instance of this filesystem should
137 be mounted
138
139``kill_sb``
140 the method to call when an instance of this filesystem should be
141 shut down
142
143
144``owner``
145 for internal VFS use: you should initialize this to THIS_MODULE
146 in most cases.
147
148``next``
149 for internal VFS use: you should initialize this to NULL
150
151 s_lock_key, s_umount_key: lockdep-specific
152
153The mount() method has the following arguments:
154
155``struct file_system_type *fs_type``
156 describes the filesystem, partly initialized by the specific
157 filesystem code
158
159``int flags``
160 mount flags
161
162``const char *dev_name``
163 the device name we are mounting.
164
165``void *data``
166 arbitrary mount options, usually comes as an ASCII string (see
167 "Mount Options" section)
168
169The mount() method must return the root dentry of the tree requested by
170caller. An active reference to its superblock must be grabbed and the
171superblock must be locked. On failure it should return ERR_PTR(error).
172
173The arguments match those of mount(2) and their interpretation depends
174on filesystem type. E.g. for block filesystems, dev_name is interpreted
175as block device name, that device is opened and if it contains a
176suitable filesystem image the method creates and initializes struct
177super_block accordingly, returning its root dentry to caller.
178
179->mount() may choose to return a subtree of existing filesystem - it
180doesn't have to create a new one. The main result from the caller's
181point of view is a reference to dentry at the root of (sub)tree to be
182attached; creation of new superblock is a common side effect.
183
184The most interesting member of the superblock structure that the mount()
185method fills in is the "s_op" field. This is a pointer to a "struct
186super_operations" which describes the next level of the filesystem
187implementation.
188
189Usually, a filesystem uses one of the generic mount() implementations
190and provides a fill_super() callback instead. The generic variants are:
191
192``mount_bdev``
193 mount a filesystem residing on a block device
194
195``mount_nodev``
196 mount a filesystem that is not backed by a device
197
198``mount_single``
199 mount a filesystem which shares the instance between all mounts
200
201A fill_super() callback implementation has the following arguments:
202
203``struct super_block *sb``
204 the superblock structure. The callback must initialize this
205 properly.
206
207``void *data``
208 arbitrary mount options, usually comes as an ASCII string (see
209 "Mount Options" section)
210
211``int silent``
212 whether or not to be silent on error
213
214
215The Superblock Object
216=====================
217
218A superblock object represents a mounted filesystem.
219
220
221struct super_operations
222-----------------------
223
224This describes how the VFS can manipulate the superblock of your
225filesystem. As of kernel 2.6.22, the following members are defined:
226
227.. code-block:: c
228
229 struct super_operations {
230 struct inode *(*alloc_inode)(struct super_block *sb);
231 void (*destroy_inode)(struct inode *);
232
233 void (*dirty_inode) (struct inode *, int flags);
234 int (*write_inode) (struct inode *, int);
235 void (*drop_inode) (struct inode *);
236 void (*delete_inode) (struct inode *);
237 void (*put_super) (struct super_block *);
238 int (*sync_fs)(struct super_block *sb, int wait);
239 int (*freeze_fs) (struct super_block *);
240 int (*unfreeze_fs) (struct super_block *);
241 int (*statfs) (struct dentry *, struct kstatfs *);
242 int (*remount_fs) (struct super_block *, int *, char *);
243 void (*clear_inode) (struct inode *);
244 void (*umount_begin) (struct super_block *);
245
246 int (*show_options)(struct seq_file *, struct dentry *);
247
248 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
249 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
250 int (*nr_cached_objects)(struct super_block *);
251 void (*free_cached_objects)(struct super_block *, int);
252 };
253
254All methods are called without any locks being held, unless otherwise
255noted. This means that most methods can block safely. All methods are
256only called from a process context (i.e. not from an interrupt handler
257or bottom half).
258
259``alloc_inode``
260 this method is called by alloc_inode() to allocate memory for
261 struct inode and initialize it. If this function is not
262 defined, a simple 'struct inode' is allocated. Normally
263 alloc_inode will be used to allocate a larger structure which
264 contains a 'struct inode' embedded within it.
265
266``destroy_inode``
267 this method is called by destroy_inode() to release resources
268 allocated for struct inode. It is only required if
269 ->alloc_inode was defined and simply undoes anything done by
270 ->alloc_inode.
271
272``dirty_inode``
273 this method is called by the VFS to mark an inode dirty.
274
275``write_inode``
276 this method is called when the VFS needs to write an inode to
277 disc. The second parameter indicates whether the write should
278 be synchronous or not, not all filesystems check this flag.
279
280``drop_inode``
281 called when the last access to the inode is dropped, with the
282 inode->i_lock spinlock held.
283
284 This method should be either NULL (normal UNIX filesystem
285 semantics) or "generic_delete_inode" (for filesystems that do
286 not want to cache inodes - causing "delete_inode" to always be
287 called regardless of the value of i_nlink)
288
289 The "generic_delete_inode()" behavior is equivalent to the old
290 practice of using "force_delete" in the put_inode() case, but
291 does not have the races that the "force_delete()" approach had.
292
293``delete_inode``
294 called when the VFS wants to delete an inode
295
296``put_super``
297 called when the VFS wishes to free the superblock
298 (i.e. unmount). This is called with the superblock lock held
299
300``sync_fs``
301 called when VFS is writing out all dirty data associated with a
302 superblock. The second parameter indicates whether the method
303 should wait until the write out has been completed. Optional.
304
305``freeze_fs``
306 called when VFS is locking a filesystem and forcing it into a
307 consistent state. This method is currently used by the Logical
308 Volume Manager (LVM).
309
310``unfreeze_fs``
311 called when VFS is unlocking a filesystem and making it writable
312 again.
313
314``statfs``
315 called when the VFS needs to get filesystem statistics.
316
317``remount_fs``
318 called when the filesystem is remounted. This is called with
319 the kernel lock held
320
321``clear_inode``
322 called then the VFS clears the inode. Optional
323
324``umount_begin``
325 called when the VFS is unmounting a filesystem.
326
327``show_options``
328 called by the VFS to show mount options for /proc/<pid>/mounts.
329 (see "Mount Options" section)
330
331``quota_read``
332 called by the VFS to read from filesystem quota file.
333
334``quota_write``
335 called by the VFS to write to filesystem quota file.
336
337``nr_cached_objects``
338 called by the sb cache shrinking function for the filesystem to
339 return the number of freeable cached objects it contains.
340 Optional.
341
342``free_cache_objects``
343 called by the sb cache shrinking function for the filesystem to
344 scan the number of objects indicated to try to free them.
345 Optional, but any filesystem implementing this method needs to
346 also implement ->nr_cached_objects for it to be called
347 correctly.
348
349 We can't do anything with any errors that the filesystem might
350 encountered, hence the void return type. This will never be
351 called if the VM is trying to reclaim under GFP_NOFS conditions,
352 hence this method does not need to handle that situation itself.
353
354 Implementations must include conditional reschedule calls inside
355 any scanning loop that is done. This allows the VFS to
356 determine appropriate scan batch sizes without having to worry
357 about whether implementations will cause holdoff problems due to
358 large scan batch sizes.
359
360Whoever sets up the inode is responsible for filling in the "i_op"
361field. This is a pointer to a "struct inode_operations" which describes
362the methods that can be performed on individual inodes.
363
364
365struct xattr_handlers
366---------------------
367
368On filesystems that support extended attributes (xattrs), the s_xattr
369superblock field points to a NULL-terminated array of xattr handlers.
370Extended attributes are name:value pairs.
371
372``name``
373 Indicates that the handler matches attributes with the specified
374 name (such as "system.posix_acl_access"); the prefix field must
375 be NULL.
376
377``prefix``
378 Indicates that the handler matches all attributes with the
379 specified name prefix (such as "user."); the name field must be
380 NULL.
381
382``list``
383 Determine if attributes matching this xattr handler should be
384 listed for a particular dentry. Used by some listxattr
385 implementations like generic_listxattr.
386
387``get``
388 Called by the VFS to get the value of a particular extended
389 attribute. This method is called by the getxattr(2) system
390 call.
391
392``set``
393 Called by the VFS to set the value of a particular extended
394 attribute. When the new value is NULL, called to remove a
395 particular extended attribute. This method is called by the the
396 setxattr(2) and removexattr(2) system calls.
397
398When none of the xattr handlers of a filesystem match the specified
399attribute name or when a filesystem doesn't support extended attributes,
400the various ``*xattr(2)`` system calls return -EOPNOTSUPP.
401
402
403The Inode Object
404================
405
406An inode object represents an object within the filesystem.
407
408
409struct inode_operations
410-----------------------
411
412This describes how the VFS can manipulate an inode in your filesystem.
413As of kernel 2.6.22, the following members are defined:
414
415.. code-block:: c
416
417 struct inode_operations {
418 int (*create) (struct inode *,struct dentry *, umode_t, bool);
419 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
420 int (*link) (struct dentry *,struct inode *,struct dentry *);
421 int (*unlink) (struct inode *,struct dentry *);
422 int (*symlink) (struct inode *,struct dentry *,const char *);
423 int (*mkdir) (struct inode *,struct dentry *,umode_t);
424 int (*rmdir) (struct inode *,struct dentry *);
425 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
426 int (*rename) (struct inode *, struct dentry *,
427 struct inode *, struct dentry *, unsigned int);
428 int (*readlink) (struct dentry *, char __user *,int);
429 const char *(*get_link) (struct dentry *, struct inode *,
430 struct delayed_call *);
431 int (*permission) (struct inode *, int);
432 int (*get_acl)(struct inode *, int);
433 int (*setattr) (struct dentry *, struct iattr *);
434 int (*getattr) (const struct path *, struct kstat *, u32, unsigned int);
435 ssize_t (*listxattr) (struct dentry *, char *, size_t);
436 void (*update_time)(struct inode *, struct timespec *, int);
437 int (*atomic_open)(struct inode *, struct dentry *, struct file *,
438 unsigned open_flag, umode_t create_mode);
439 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
440 };
441
442Again, all methods are called without any locks being held, unless
443otherwise noted.
444
445``create``
446 called by the open(2) and creat(2) system calls. Only required
447 if you want to support regular files. The dentry you get should
448 not have an inode (i.e. it should be a negative dentry). Here
449 you will probably call d_instantiate() with the dentry and the
450 newly created inode
451
452``lookup``
453 called when the VFS needs to look up an inode in a parent
454 directory. The name to look for is found in the dentry. This
455 method must call d_add() to insert the found inode into the
456 dentry. The "i_count" field in the inode structure should be
457 incremented. If the named inode does not exist a NULL inode
458 should be inserted into the dentry (this is called a negative
459 dentry). Returning an error code from this routine must only be
460 done on a real error, otherwise creating inodes with system
461 calls like create(2), mknod(2), mkdir(2) and so on will fail.
462 If you wish to overload the dentry methods then you should
463 initialise the "d_dop" field in the dentry; this is a pointer to
464 a struct "dentry_operations". This method is called with the
465 directory inode semaphore held
466
467``link``
468 called by the link(2) system call. Only required if you want to
469 support hard links. You will probably need to call
470 d_instantiate() just as you would in the create() method
471
472``unlink``
473 called by the unlink(2) system call. Only required if you want
474 to support deleting inodes
475
476``symlink``
477 called by the symlink(2) system call. Only required if you want
478 to support symlinks. You will probably need to call
479 d_instantiate() just as you would in the create() method
480
481``mkdir``
482 called by the mkdir(2) system call. Only required if you want
483 to support creating subdirectories. You will probably need to
484 call d_instantiate() just as you would in the create() method
485
486``rmdir``
487 called by the rmdir(2) system call. Only required if you want
488 to support deleting subdirectories
489
490``mknod``
491 called by the mknod(2) system call to create a device (char,
492 block) inode or a named pipe (FIFO) or socket. Only required if
493 you want to support creating these types of inodes. You will
494 probably need to call d_instantiate() just as you would in the
495 create() method
496
497``rename``
498 called by the rename(2) system call to rename the object to have
499 the parent and name given by the second inode and dentry.
500
501 The filesystem must return -EINVAL for any unsupported or
502 unknown flags. Currently the following flags are implemented:
503 (1) RENAME_NOREPLACE: this flag indicates that if the target of
504 the rename exists the rename should fail with -EEXIST instead of
505 replacing the target. The VFS already checks for existence, so
506 for local filesystems the RENAME_NOREPLACE implementation is
507 equivalent to plain rename.
508 (2) RENAME_EXCHANGE: exchange source and target. Both must
509 exist; this is checked by the VFS. Unlike plain rename, source
510 and target may be of different type.
511
512``get_link``
513 called by the VFS to follow a symbolic link to the inode it
514 points to. Only required if you want to support symbolic links.
515 This method returns the symlink body to traverse (and possibly
516 resets the current position with nd_jump_link()). If the body
517 won't go away until the inode is gone, nothing else is needed;
518 if it needs to be otherwise pinned, arrange for its release by
519 having get_link(..., ..., done) do set_delayed_call(done,
520 destructor, argument). In that case destructor(argument) will
521 be called once VFS is done with the body you've returned. May
522 be called in RCU mode; that is indicated by NULL dentry
523 argument. If request can't be handled without leaving RCU mode,
524 have it return ERR_PTR(-ECHILD).
525
526 If the filesystem stores the symlink target in ->i_link, the
527 VFS may use it directly without calling ->get_link(); however,
528 ->get_link() must still be provided. ->i_link must not be
529 freed until after an RCU grace period. Writing to ->i_link
530 post-iget() time requires a 'release' memory barrier.
531
532``readlink``
533 this is now just an override for use by readlink(2) for the
534 cases when ->get_link uses nd_jump_link() or object is not in
535 fact a symlink. Normally filesystems should only implement
536 ->get_link for symlinks and readlink(2) will automatically use
537 that.
538
539``permission``
540 called by the VFS to check for access rights on a POSIX-like
541 filesystem.
542
543 May be called in rcu-walk mode (mask & MAY_NOT_BLOCK). If in
544 rcu-walk mode, the filesystem must check the permission without
545 blocking or storing to the inode.
546
547 If a situation is encountered that rcu-walk cannot handle,
548 return
549 -ECHILD and it will be called again in ref-walk mode.
550
551``setattr``
552 called by the VFS to set attributes for a file. This method is
553 called by chmod(2) and related system calls.
554
555``getattr``
556 called by the VFS to get attributes of a file. This method is
557 called by stat(2) and related system calls.
558
559``listxattr``
560 called by the VFS to list all extended attributes for a given
561 file. This method is called by the listxattr(2) system call.
562
563``update_time``
564 called by the VFS to update a specific time or the i_version of
565 an inode. If this is not defined the VFS will update the inode
566 itself and call mark_inode_dirty_sync.
567
568``atomic_open``
569 called on the last component of an open. Using this optional
570 method the filesystem can look up, possibly create and open the
571 file in one atomic operation. If it wants to leave actual
572 opening to the caller (e.g. if the file turned out to be a
573 symlink, device, or just something filesystem won't do atomic
574 open for), it may signal this by returning finish_no_open(file,
575 dentry). This method is only called if the last component is
576 negative or needs lookup. Cached positive dentries are still
577 handled by f_op->open(). If the file was created, FMODE_CREATED
578 flag should be set in file->f_mode. In case of O_EXCL the
579 method must only succeed if the file didn't exist and hence
580 FMODE_CREATED shall always be set on success.
581
582``tmpfile``
583 called in the end of O_TMPFILE open(). Optional, equivalent to
584 atomically creating, opening and unlinking a file in given
585 directory.
586
587
588The Address Space Object
589========================
590
591The address space object is used to group and manage pages in the page
592cache. It can be used to keep track of the pages in a file (or anything
593else) and also track the mapping of sections of the file into process
594address spaces.
595
596There are a number of distinct yet related services that an
597address-space can provide. These include communicating memory pressure,
598page lookup by address, and keeping track of pages tagged as Dirty or
599Writeback.
600
601The first can be used independently to the others. The VM can try to
602either write dirty pages in order to clean them, or release clean pages
603in order to reuse them. To do this it can call the ->writepage method
604on dirty pages, and ->releasepage on clean pages with PagePrivate set.
605Clean pages without PagePrivate and with no external references will be
606released without notice being given to the address_space.
607
608To achieve this functionality, pages need to be placed on an LRU with
609lru_cache_add and mark_page_active needs to be called whenever the page
610is used.
611
612Pages are normally kept in a radix tree index by ->index. This tree
613maintains information about the PG_Dirty and PG_Writeback status of each
614page, so that pages with either of these flags can be found quickly.
615
616The Dirty tag is primarily used by mpage_writepages - the default
617->writepages method. It uses the tag to find dirty pages to call
618->writepage on. If mpage_writepages is not used (i.e. the address
619provides its own ->writepages) , the PAGECACHE_TAG_DIRTY tag is almost
620unused. write_inode_now and sync_inode do use it (through
621__sync_single_inode) to check if ->writepages has been successful in
622writing out the whole address_space.
623
624The Writeback tag is used by filemap*wait* and sync_page* functions, via
625filemap_fdatawait_range, to wait for all writeback to complete.
626
627An address_space handler may attach extra information to a page,
628typically using the 'private' field in the 'struct page'. If such
629information is attached, the PG_Private flag should be set. This will
630cause various VM routines to make extra calls into the address_space
631handler to deal with that data.
632
633An address space acts as an intermediate between storage and
634application. Data is read into the address space a whole page at a
635time, and provided to the application either by copying of the page, or
636by memory-mapping the page. Data is written into the address space by
637the application, and then written-back to storage typically in whole
638pages, however the address_space has finer control of write sizes.
639
640The read process essentially only requires 'readpage'. The write
641process is more complicated and uses write_begin/write_end or
642set_page_dirty to write data into the address_space, and writepage and
643writepages to writeback data to storage.
644
645Adding and removing pages to/from an address_space is protected by the
646inode's i_mutex.
647
648When data is written to a page, the PG_Dirty flag should be set. It
649typically remains set until writepage asks for it to be written. This
650should clear PG_Dirty and set PG_Writeback. It can be actually written
651at any point after PG_Dirty is clear. Once it is known to be safe,
652PG_Writeback is cleared.
653
654Writeback makes use of a writeback_control structure to direct the
655operations. This gives the the writepage and writepages operations some
656information about the nature of and reason for the writeback request,
657and the constraints under which it is being done. It is also used to
658return information back to the caller about the result of a writepage or
659writepages request.
660
661
662Handling errors during writeback
663--------------------------------
664
665Most applications that do buffered I/O will periodically call a file
666synchronization call (fsync, fdatasync, msync or sync_file_range) to
667ensure that data written has made it to the backing store. When there
668is an error during writeback, they expect that error to be reported when
669a file sync request is made. After an error has been reported on one
670request, subsequent requests on the same file descriptor should return
6710, unless further writeback errors have occurred since the previous file
672syncronization.
673
674Ideally, the kernel would report errors only on file descriptions on
675which writes were done that subsequently failed to be written back. The
676generic pagecache infrastructure does not track the file descriptions
677that have dirtied each individual page however, so determining which
678file descriptors should get back an error is not possible.
679
680Instead, the generic writeback error tracking infrastructure in the
681kernel settles for reporting errors to fsync on all file descriptions
682that were open at the time that the error occurred. In a situation with
683multiple writers, all of them will get back an error on a subsequent
684fsync, even if all of the writes done through that particular file
685descriptor succeeded (or even if there were no writes on that file
686descriptor at all).
687
688Filesystems that wish to use this infrastructure should call
689mapping_set_error to record the error in the address_space when it
690occurs. Then, after writing back data from the pagecache in their
691file->fsync operation, they should call file_check_and_advance_wb_err to
692ensure that the struct file's error cursor has advanced to the correct
693point in the stream of errors emitted by the backing device(s).
694
695
696struct address_space_operations
697-------------------------------
698
699This describes how the VFS can manipulate mapping of a file to page
700cache in your filesystem. The following members are defined:
701
702.. code-block:: c
703
704 struct address_space_operations {
705 int (*writepage)(struct page *page, struct writeback_control *wbc);
706 int (*readpage)(struct file *, struct page *);
707 int (*writepages)(struct address_space *, struct writeback_control *);
708 int (*set_page_dirty)(struct page *page);
709 int (*readpages)(struct file *filp, struct address_space *mapping,
710 struct list_head *pages, unsigned nr_pages);
711 int (*write_begin)(struct file *, struct address_space *mapping,
712 loff_t pos, unsigned len, unsigned flags,
713 struct page **pagep, void **fsdata);
714 int (*write_end)(struct file *, struct address_space *mapping,
715 loff_t pos, unsigned len, unsigned copied,
716 struct page *page, void *fsdata);
717 sector_t (*bmap)(struct address_space *, sector_t);
718 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
719 int (*releasepage) (struct page *, int);
720 void (*freepage)(struct page *);
721 ssize_t (*direct_IO)(struct kiocb *, struct iov_iter *iter);
722 /* isolate a page for migration */
723 bool (*isolate_page) (struct page *, isolate_mode_t);
724 /* migrate the contents of a page to the specified target */
725 int (*migratepage) (struct page *, struct page *);
726 /* put migration-failed page back to right list */
727 void (*putback_page) (struct page *);
728 int (*launder_page) (struct page *);
729
730 int (*is_partially_uptodate) (struct page *, unsigned long,
731 unsigned long);
732 void (*is_dirty_writeback) (struct page *, bool *, bool *);
733 int (*error_remove_page) (struct mapping *mapping, struct page *page);
734 int (*swap_activate)(struct file *);
735 int (*swap_deactivate)(struct file *);
736 };
737
738``writepage``
739 called by the VM to write a dirty page to backing store. This
740 may happen for data integrity reasons (i.e. 'sync'), or to free
741 up memory (flush). The difference can be seen in
742 wbc->sync_mode. The PG_Dirty flag has been cleared and
743 PageLocked is true. writepage should start writeout, should set
744 PG_Writeback, and should make sure the page is unlocked, either
745 synchronously or asynchronously when the write operation
746 completes.
747
748 If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to
749 try too hard if there are problems, and may choose to write out
750 other pages from the mapping if that is easier (e.g. due to
751 internal dependencies). If it chooses not to start writeout, it
752 should return AOP_WRITEPAGE_ACTIVATE so that the VM will not
753 keep calling ->writepage on that page.
754
755 See the file "Locking" for more details.
756
757``readpage``
758 called by the VM to read a page from backing store. The page
759 will be Locked when readpage is called, and should be unlocked
760 and marked uptodate once the read completes. If ->readpage
761 discovers that it needs to unlock the page for some reason, it
762 can do so, and then return AOP_TRUNCATED_PAGE. In this case,
763 the page will be relocated, relocked and if that all succeeds,
764 ->readpage will be called again.
765
766``writepages``
767 called by the VM to write out pages associated with the
768 address_space object. If wbc->sync_mode is WBC_SYNC_ALL, then
769 the writeback_control will specify a range of pages that must be
770 written out. If it is WBC_SYNC_NONE, then a nr_to_write is
771 given and that many pages should be written if possible. If no
772 ->writepages is given, then mpage_writepages is used instead.
773 This will choose pages from the address space that are tagged as
774 DIRTY and will pass them to ->writepage.
775
776``set_page_dirty``
777 called by the VM to set a page dirty. This is particularly
778 needed if an address space attaches private data to a page, and
779 that data needs to be updated when a page is dirtied. This is
780 called, for example, when a memory mapped page gets modified.
781 If defined, it should set the PageDirty flag, and the
782 PAGECACHE_TAG_DIRTY tag in the radix tree.
783
784``readpages``
785 called by the VM to read pages associated with the address_space
786 object. This is essentially just a vector version of readpage.
787 Instead of just one page, several pages are requested.
788 readpages is only used for read-ahead, so read errors are
789 ignored. If anything goes wrong, feel free to give up.
790
791``write_begin``
792 Called by the generic buffered write code to ask the filesystem
793 to prepare to write len bytes at the given offset in the file.
794 The address_space should check that the write will be able to
795 complete, by allocating space if necessary and doing any other
796 internal housekeeping. If the write will update parts of any
797 basic-blocks on storage, then those blocks should be pre-read
798 (if they haven't been read already) so that the updated blocks
799 can be written out properly.
800
801 The filesystem must return the locked pagecache page for the
802 specified offset, in ``*pagep``, for the caller to write into.
803
804 It must be able to cope with short writes (where the length
805 passed to write_begin is greater than the number of bytes copied
806 into the page).
807
808 flags is a field for AOP_FLAG_xxx flags, described in
809 include/linux/fs.h.
810
811 A void * may be returned in fsdata, which then gets passed into
812 write_end.
813
814 Returns 0 on success; < 0 on failure (which is the error code),
815 in which case write_end is not called.
816
817``write_end``
818 After a successful write_begin, and data copy, write_end must be
819 called. len is the original len passed to write_begin, and
820 copied is the amount that was able to be copied.
821
822 The filesystem must take care of unlocking the page and
823 releasing it refcount, and updating i_size.
824
825 Returns < 0 on failure, otherwise the number of bytes (<=
826 'copied') that were able to be copied into pagecache.
827
828``bmap``
829 called by the VFS to map a logical block offset within object to
830 physical block number. This method is used by the FIBMAP ioctl
831 and for working with swap-files. To be able to swap to a file,
832 the file must have a stable mapping to a block device. The swap
833 system does not go through the filesystem but instead uses bmap
834 to find out where the blocks in the file are and uses those
835 addresses directly.
836
837``invalidatepage``
838 If a page has PagePrivate set, then invalidatepage will be
839 called when part or all of the page is to be removed from the
840 address space. This generally corresponds to either a
841 truncation, punch hole or a complete invalidation of the address
842 space (in the latter case 'offset' will always be 0 and 'length'
843 will be PAGE_SIZE). Any private data associated with the page
844 should be updated to reflect this truncation. If offset is 0
845 and length is PAGE_SIZE, then the private data should be
846 released, because the page must be able to be completely
847 discarded. This may be done by calling the ->releasepage
848 function, but in this case the release MUST succeed.
849
850``releasepage``
851 releasepage is called on PagePrivate pages to indicate that the
852 page should be freed if possible. ->releasepage should remove
853 any private data from the page and clear the PagePrivate flag.
854 If releasepage() fails for some reason, it must indicate failure
855 with a 0 return value. releasepage() is used in two distinct
856 though related cases. The first is when the VM finds a clean
857 page with no active users and wants to make it a free page. If
858 ->releasepage succeeds, the page will be removed from the
859 address_space and become free.
860
861 The second case is when a request has been made to invalidate
862 some or all pages in an address_space. This can happen through
863 the fadvise(POSIX_FADV_DONTNEED) system call or by the
864 filesystem explicitly requesting it as nfs and 9fs do (when they
865 believe the cache may be out of date with storage) by calling
866 invalidate_inode_pages2(). If the filesystem makes such a call,
867 and needs to be certain that all pages are invalidated, then its
868 releasepage will need to ensure this. Possibly it can clear the
869 PageUptodate bit if it cannot free private data yet.
870
871``freepage``
872 freepage is called once the page is no longer visible in the
873 page cache in order to allow the cleanup of any private data.
874 Since it may be called by the memory reclaimer, it should not
875 assume that the original address_space mapping still exists, and
876 it should not block.
877
878``direct_IO``
879 called by the generic read/write routines to perform direct_IO -
880 that is IO requests which bypass the page cache and transfer
881 data directly between the storage and the application's address
882 space.
883
884``isolate_page``
885 Called by the VM when isolating a movable non-lru page. If page
886 is successfully isolated, VM marks the page as PG_isolated via
887 __SetPageIsolated.
888
889``migrate_page``
890 This is used to compact the physical memory usage. If the VM
891 wants to relocate a page (maybe off a memory card that is
892 signalling imminent failure) it will pass a new page and an old
893 page to this function. migrate_page should transfer any private
894 data across and update any references that it has to the page.
895
896``putback_page``
897 Called by the VM when isolated page's migration fails.
898
899``launder_page``
900 Called before freeing a page - it writes back the dirty page.
901 To prevent redirtying the page, it is kept locked during the
902 whole operation.
903
904``is_partially_uptodate``
905 Called by the VM when reading a file through the pagecache when
906 the underlying blocksize != pagesize. If the required block is
907 up to date then the read can complete without needing the IO to
908 bring the whole page up to date.
909
910``is_dirty_writeback``
911 Called by the VM when attempting to reclaim a page. The VM uses
912 dirty and writeback information to determine if it needs to
913 stall to allow flushers a chance to complete some IO.
914 Ordinarily it can use PageDirty and PageWriteback but some
915 filesystems have more complex state (unstable pages in NFS
916 prevent reclaim) or do not set those flags due to locking
917 problems. This callback allows a filesystem to indicate to the
918 VM if a page should be treated as dirty or writeback for the
919 purposes of stalling.
920
921``error_remove_page``
922 normally set to generic_error_remove_page if truncation is ok
923 for this address space. Used for memory failure handling.
924 Setting this implies you deal with pages going away under you,
925 unless you have them locked or reference counts increased.
926
927``swap_activate``
928 Called when swapon is used on a file to allocate space if
929 necessary and pin the block lookup information in memory. A
930 return value of zero indicates success, in which case this file
931 can be used to back swapspace.
932
933``swap_deactivate``
934 Called during swapoff on files where swap_activate was
935 successful.
936
937
938The File Object
939===============
940
941A file object represents a file opened by a process. This is also known
942as an "open file description" in POSIX parlance.
943
944
945struct file_operations
946----------------------
947
948This describes how the VFS can manipulate an open file. As of kernel
9494.18, the following members are defined:
950
951.. code-block:: c
952
953 struct file_operations {
954 struct module *owner;
955 loff_t (*llseek) (struct file *, loff_t, int);
956 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
957 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
958 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
959 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
960 int (*iopoll)(struct kiocb *kiocb, bool spin);
961 int (*iterate) (struct file *, struct dir_context *);
962 int (*iterate_shared) (struct file *, struct dir_context *);
963 __poll_t (*poll) (struct file *, struct poll_table_struct *);
964 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
965 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
966 int (*mmap) (struct file *, struct vm_area_struct *);
967 int (*open) (struct inode *, struct file *);
968 int (*flush) (struct file *, fl_owner_t id);
969 int (*release) (struct inode *, struct file *);
970 int (*fsync) (struct file *, loff_t, loff_t, int datasync);
971 int (*fasync) (int, struct file *, int);
972 int (*lock) (struct file *, int, struct file_lock *);
973 ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
974 unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
975 int (*check_flags)(int);
976 int (*flock) (struct file *, int, struct file_lock *);
977 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
978 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
979 int (*setlease)(struct file *, long, struct file_lock **, void **);
980 long (*fallocate)(struct file *file, int mode, loff_t offset,
981 loff_t len);
982 void (*show_fdinfo)(struct seq_file *m, struct file *f);
983 #ifndef CONFIG_MMU
984 unsigned (*mmap_capabilities)(struct file *);
985 #endif
986 ssize_t (*copy_file_range)(struct file *, loff_t, struct file *, loff_t, size_t, unsigned int);
987 loff_t (*remap_file_range)(struct file *file_in, loff_t pos_in,
988 struct file *file_out, loff_t pos_out,
989 loff_t len, unsigned int remap_flags);
990 int (*fadvise)(struct file *, loff_t, loff_t, int);
991 };
992
993Again, all methods are called without any locks being held, unless
994otherwise noted.
995
996``llseek``
997 called when the VFS needs to move the file position index
998
999``read``
1000 called by read(2) and related system calls
1001
1002``read_iter``
1003 possibly asynchronous read with iov_iter as destination
1004
1005``write``
1006 called by write(2) and related system calls
1007
1008``write_iter``
1009 possibly asynchronous write with iov_iter as source
1010
1011``iopoll``
1012 called when aio wants to poll for completions on HIPRI iocbs
1013
1014``iterate``
1015 called when the VFS needs to read the directory contents
1016
1017``iterate_shared``
1018 called when the VFS needs to read the directory contents when
1019 filesystem supports concurrent dir iterators
1020
1021``poll``
1022 called by the VFS when a process wants to check if there is
1023 activity on this file and (optionally) go to sleep until there
1024 is activity. Called by the select(2) and poll(2) system calls
1025
1026``unlocked_ioctl``
1027 called by the ioctl(2) system call.
1028
1029``compat_ioctl``
1030 called by the ioctl(2) system call when 32 bit system calls are
1031 used on 64 bit kernels.
1032
1033``mmap``
1034 called by the mmap(2) system call
1035
1036``open``
1037 called by the VFS when an inode should be opened. When the VFS
1038 opens a file, it creates a new "struct file". It then calls the
1039 open method for the newly allocated file structure. You might
1040 think that the open method really belongs in "struct
1041 inode_operations", and you may be right. I think it's done the
1042 way it is because it makes filesystems simpler to implement.
1043 The open() method is a good place to initialize the
1044 "private_data" member in the file structure if you want to point
1045 to a device structure
1046
1047``flush``
1048 called by the close(2) system call to flush a file
1049
1050``release``
1051 called when the last reference to an open file is closed
1052
1053``fsync``
1054 called by the fsync(2) system call. Also see the section above
1055 entitled "Handling errors during writeback".
1056
1057``fasync``
1058 called by the fcntl(2) system call when asynchronous
1059 (non-blocking) mode is enabled for a file
1060
1061``lock``
1062 called by the fcntl(2) system call for F_GETLK, F_SETLK, and
1063 F_SETLKW commands
1064
1065``get_unmapped_area``
1066 called by the mmap(2) system call
1067
1068``check_flags``
1069 called by the fcntl(2) system call for F_SETFL command
1070
1071``flock``
1072 called by the flock(2) system call
1073
1074``splice_write``
1075 called by the VFS to splice data from a pipe to a file. This
1076 method is used by the splice(2) system call
1077
1078``splice_read``
1079 called by the VFS to splice data from file to a pipe. This
1080 method is used by the splice(2) system call
1081
1082``setlease``
1083 called by the VFS to set or release a file lock lease. setlease
1084 implementations should call generic_setlease to record or remove
1085 the lease in the inode after setting it.
1086
1087``fallocate``
1088 called by the VFS to preallocate blocks or punch a hole.
1089
1090``copy_file_range``
1091 called by the copy_file_range(2) system call.
1092
1093``remap_file_range``
1094 called by the ioctl(2) system call for FICLONERANGE and FICLONE
1095 and FIDEDUPERANGE commands to remap file ranges. An
1096 implementation should remap len bytes at pos_in of the source
1097 file into the dest file at pos_out. Implementations must handle
1098 callers passing in len == 0; this means "remap to the end of the
1099 source file". The return value should the number of bytes
1100 remapped, or the usual negative error code if errors occurred
1101 before any bytes were remapped. The remap_flags parameter
1102 accepts REMAP_FILE_* flags. If REMAP_FILE_DEDUP is set then the
1103 implementation must only remap if the requested file ranges have
1104 identical contents. If REMAP_CAN_SHORTEN is set, the caller is
1105 ok with the implementation shortening the request length to
1106 satisfy alignment or EOF requirements (or any other reason).
1107
1108``fadvise``
1109 possibly called by the fadvise64() system call.
1110
1111Note that the file operations are implemented by the specific
1112filesystem in which the inode resides. When opening a device node
1113(character or block special) most filesystems will call special
1114support routines in the VFS which will locate the required device
1115driver information. These support routines replace the filesystem file
1116operations with those for the device driver, and then proceed to call
1117the new open() method for the file. This is how opening a device file
1118in the filesystem eventually ends up calling the device driver open()
1119method.
1120
1121
1122Directory Entry Cache (dcache)
1123==============================
1124
1125
1126struct dentry_operations
1127------------------------
1128
1129This describes how a filesystem can overload the standard dentry
1130operations. Dentries and the dcache are the domain of the VFS and the
1131individual filesystem implementations. Device drivers have no business
1132here. These methods may be set to NULL, as they are either optional or
1133the VFS uses a default. As of kernel 2.6.22, the following members are
1134defined:
1135
1136.. code-block:: c
1137
1138 struct dentry_operations {
1139 int (*d_revalidate)(struct dentry *, unsigned int);
1140 int (*d_weak_revalidate)(struct dentry *, unsigned int);
1141 int (*d_hash)(const struct dentry *, struct qstr *);
1142 int (*d_compare)(const struct dentry *,
1143 unsigned int, const char *, const struct qstr *);
1144 int (*d_delete)(const struct dentry *);
1145 int (*d_init)(struct dentry *);
1146 void (*d_release)(struct dentry *);
1147 void (*d_iput)(struct dentry *, struct inode *);
1148 char *(*d_dname)(struct dentry *, char *, int);
1149 struct vfsmount *(*d_automount)(struct path *);
1150 int (*d_manage)(const struct path *, bool);
1151 struct dentry *(*d_real)(struct dentry *, const struct inode *);
1152 };
1153
1154``d_revalidate``
1155 called when the VFS needs to revalidate a dentry. This is
1156 called whenever a name look-up finds a dentry in the dcache.
1157 Most local filesystems leave this as NULL, because all their
1158 dentries in the dcache are valid. Network filesystems are
1159 different since things can change on the server without the
1160 client necessarily being aware of it.
1161
1162 This function should return a positive value if the dentry is
1163 still valid, and zero or a negative error code if it isn't.
1164
1165 d_revalidate may be called in rcu-walk mode (flags &
1166 LOOKUP_RCU). If in rcu-walk mode, the filesystem must
1167 revalidate the dentry without blocking or storing to the dentry,
1168 d_parent and d_inode should not be used without care (because
1169 they can change and, in d_inode case, even become NULL under
1170 us).
1171
1172 If a situation is encountered that rcu-walk cannot handle,
1173 return
1174 -ECHILD and it will be called again in ref-walk mode.
1175
1176``_weak_revalidate``
1177 called when the VFS needs to revalidate a "jumped" dentry. This
1178 is called when a path-walk ends at dentry that was not acquired
1179 by doing a lookup in the parent directory. This includes "/",
1180 "." and "..", as well as procfs-style symlinks and mountpoint
1181 traversal.
1182
1183 In this case, we are less concerned with whether the dentry is
1184 still fully correct, but rather that the inode is still valid.
1185 As with d_revalidate, most local filesystems will set this to
1186 NULL since their dcache entries are always valid.
1187
1188 This function has the same return code semantics as
1189 d_revalidate.
1190
1191 d_weak_revalidate is only called after leaving rcu-walk mode.
1192
1193``d_hash``
1194 called when the VFS adds a dentry to the hash table. The first
1195 dentry passed to d_hash is the parent directory that the name is
1196 to be hashed into.
1197
1198 Same locking and synchronisation rules as d_compare regarding
1199 what is safe to dereference etc.
1200
1201``d_compare``
1202 called to compare a dentry name with a given name. The first
1203 dentry is the parent of the dentry to be compared, the second is
1204 the child dentry. len and name string are properties of the
1205 dentry to be compared. qstr is the name to compare it with.
1206
1207 Must be constant and idempotent, and should not take locks if
1208 possible, and should not or store into the dentry. Should not
1209 dereference pointers outside the dentry without lots of care
1210 (eg. d_parent, d_inode, d_name should not be used).
1211
1212 However, our vfsmount is pinned, and RCU held, so the dentries
1213 and inodes won't disappear, neither will our sb or filesystem
1214 module. ->d_sb may be used.
1215
1216 It is a tricky calling convention because it needs to be called
1217 under "rcu-walk", ie. without any locks or references on things.
1218
1219``d_delete``
1220 called when the last reference to a dentry is dropped and the
1221 dcache is deciding whether or not to cache it. Return 1 to
1222 delete immediately, or 0 to cache the dentry. Default is NULL
1223 which means to always cache a reachable dentry. d_delete must
1224 be constant and idempotent.
1225
1226``d_init``
1227 called when a dentry is allocated
1228
1229``d_release``
1230 called when a dentry is really deallocated
1231
1232``d_iput``
1233 called when a dentry loses its inode (just prior to its being
1234 deallocated). The default when this is NULL is that the VFS
1235 calls iput(). If you define this method, you must call iput()
1236 yourself
1237
1238``d_dname``
1239 called when the pathname of a dentry should be generated.
1240 Useful for some pseudo filesystems (sockfs, pipefs, ...) to
1241 delay pathname generation. (Instead of doing it when dentry is
1242 created, it's done only when the path is needed.). Real
1243 filesystems probably dont want to use it, because their dentries
1244 are present in global dcache hash, so their hash should be an
1245 invariant. As no lock is held, d_dname() should not try to
1246 modify the dentry itself, unless appropriate SMP safety is used.
1247 CAUTION : d_path() logic is quite tricky. The correct way to
1248 return for example "Hello" is to put it at the end of the
1249 buffer, and returns a pointer to the first char.
1250 dynamic_dname() helper function is provided to take care of
1251 this.
1252
1253 Example :
1254
1255.. code-block:: c
1256
1257 static char *pipefs_dname(struct dentry *dent, char *buffer, int buflen)
1258 {
1259 return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]",
1260 dentry->d_inode->i_ino);
1261 }
1262
1263``d_automount``
1264 called when an automount dentry is to be traversed (optional).
1265 This should create a new VFS mount record and return the record
1266 to the caller. The caller is supplied with a path parameter
1267 giving the automount directory to describe the automount target
1268 and the parent VFS mount record to provide inheritable mount
1269 parameters. NULL should be returned if someone else managed to
1270 make the automount first. If the vfsmount creation failed, then
1271 an error code should be returned. If -EISDIR is returned, then
1272 the directory will be treated as an ordinary directory and
1273 returned to pathwalk to continue walking.
1274
1275 If a vfsmount is returned, the caller will attempt to mount it
1276 on the mountpoint and will remove the vfsmount from its
1277 expiration list in the case of failure. The vfsmount should be
1278 returned with 2 refs on it to prevent automatic expiration - the
1279 caller will clean up the additional ref.
1280
1281 This function is only used if DCACHE_NEED_AUTOMOUNT is set on
1282 the dentry. This is set by __d_instantiate() if S_AUTOMOUNT is
1283 set on the inode being added.
1284
1285``d_manage``
1286 called to allow the filesystem to manage the transition from a
1287 dentry (optional). This allows autofs, for example, to hold up
1288 clients waiting to explore behind a 'mountpoint' while letting
1289 the daemon go past and construct the subtree there. 0 should be
1290 returned to let the calling process continue. -EISDIR can be
1291 returned to tell pathwalk to use this directory as an ordinary
1292 directory and to ignore anything mounted on it and not to check
1293 the automount flag. Any other error code will abort pathwalk
1294 completely.
1295
1296 If the 'rcu_walk' parameter is true, then the caller is doing a
1297 pathwalk in RCU-walk mode. Sleeping is not permitted in this
1298 mode, and the caller can be asked to leave it and call again by
1299 returning -ECHILD. -EISDIR may also be returned to tell
1300 pathwalk to ignore d_automount or any mounts.
1301
1302 This function is only used if DCACHE_MANAGE_TRANSIT is set on
1303 the dentry being transited from.
1304
1305``d_real``
1306 overlay/union type filesystems implement this method to return
1307 one of the underlying dentries hidden by the overlay. It is
1308 used in two different modes:
1309
1310 Called from file_dentry() it returns the real dentry matching
1311 the inode argument. The real dentry may be from a lower layer
1312 already copied up, but still referenced from the file. This
1313 mode is selected with a non-NULL inode argument.
1314
1315 With NULL inode the topmost real underlying dentry is returned.
1316
1317Each dentry has a pointer to its parent dentry, as well as a hash list
1318of child dentries. Child dentries are basically like files in a
1319directory.
1320
1321
1322Directory Entry Cache API
1323--------------------------
1324
1325There are a number of functions defined which permit a filesystem to
1326manipulate dentries:
1327
1328``dget``
1329 open a new handle for an existing dentry (this just increments
1330 the usage count)
1331
1332``dput``
1333 close a handle for a dentry (decrements the usage count). If
1334 the usage count drops to 0, and the dentry is still in its
1335 parent's hash, the "d_delete" method is called to check whether
1336 it should be cached. If it should not be cached, or if the
1337 dentry is not hashed, it is deleted. Otherwise cached dentries
1338 are put into an LRU list to be reclaimed on memory shortage.
1339
1340``d_drop``
1341 this unhashes a dentry from its parents hash list. A subsequent
1342 call to dput() will deallocate the dentry if its usage count
1343 drops to 0
1344
1345``d_delete``
1346 delete a dentry. If there are no other open references to the
1347 dentry then the dentry is turned into a negative dentry (the
1348 d_iput() method is called). If there are other references, then
1349 d_drop() is called instead
1350
1351``d_add``
1352 add a dentry to its parents hash list and then calls
1353 d_instantiate()
1354
1355``d_instantiate``
1356 add a dentry to the alias hash list for the inode and updates
1357 the "d_inode" member. The "i_count" member in the inode
1358 structure should be set/incremented. If the inode pointer is
1359 NULL, the dentry is called a "negative dentry". This function
1360 is commonly called when an inode is created for an existing
1361 negative dentry
1362
1363``d_lookup``
1364 look up a dentry given its parent and path name component It
1365 looks up the child of that given name from the dcache hash
1366 table. If it is found, the reference count is incremented and
1367 the dentry is returned. The caller must use dput() to free the
1368 dentry when it finishes using it.
1369
1370
1371Mount Options
1372=============
1373
1374
1375Parsing options
1376---------------
1377
1378On mount and remount the filesystem is passed a string containing a
1379comma separated list of mount options. The options can have either of
1380these forms:
1381
1382 option
1383 option=value
1384
1385The <linux/parser.h> header defines an API that helps parse these
1386options. There are plenty of examples on how to use it in existing
1387filesystems.
1388
1389
1390Showing options
1391---------------
1392
1393If a filesystem accepts mount options, it must define show_options() to
1394show all the currently active options. The rules are:
1395
1396 - options MUST be shown which are not default or their values differ
1397 from the default
1398
1399 - options MAY be shown which are enabled by default or have their
1400 default value
1401
1402Options used only internally between a mount helper and the kernel (such
1403as file descriptors), or which only have an effect during the mounting
1404(such as ones controlling the creation of a journal) are exempt from the
1405above rules.
1406
1407The underlying reason for the above rules is to make sure, that a mount
1408can be accurately replicated (e.g. umounting and mounting again) based
1409on the information found in /proc/mounts.
1410
1411
1412Resources
1413=========
1414
1415(Note some of these resources are not up-to-date with the latest kernel
1416 version.)
1417
1418Creating Linux virtual filesystems. 2002
1419 <http://lwn.net/Articles/13325/>
1420
1421The Linux Virtual File-system Layer by Neil Brown. 1999
1422 <http://www.cse.unsw.edu.au/~neilb/oss/linux-commentary/vfs.html>
1423
1424A tour of the Linux VFS by Michael K. Johnson. 1996
1425 <http://www.tldp.org/LDP/khg/HyperNews/get/fs/vfstour.html>
1426
1427A small trail through the Linux kernel by Andries Brouwer. 2001
1428 <http://www.win.tue.nl/~aeb/linux/vfs/trail.html>
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
deleted file mode 100644
index 57fc576b1f3e..000000000000
--- a/Documentation/filesystems/vfs.txt
+++ /dev/null
@@ -1,1268 +0,0 @@
1
2 Overview of the Linux Virtual File System
3
4 Original author: Richard Gooch <rgooch@atnf.csiro.au>
5
6 Copyright (C) 1999 Richard Gooch
7 Copyright (C) 2005 Pekka Enberg
8
9 This file is released under the GPLv2.
10
11
12Introduction
13============
14
15The Virtual File System (also known as the Virtual Filesystem Switch)
16is the software layer in the kernel that provides the filesystem
17interface to userspace programs. It also provides an abstraction
18within the kernel which allows different filesystem implementations to
19coexist.
20
21VFS system calls open(2), stat(2), read(2), write(2), chmod(2) and so
22on are called from a process context. Filesystem locking is described
23in the document Documentation/filesystems/Locking.
24
25
26Directory Entry Cache (dcache)
27------------------------------
28
29The VFS implements the open(2), stat(2), chmod(2), and similar system
30calls. The pathname argument that is passed to them is used by the VFS
31to search through the directory entry cache (also known as the dentry
32cache or dcache). This provides a very fast look-up mechanism to
33translate a pathname (filename) into a specific dentry. Dentries live
34in RAM and are never saved to disc: they exist only for performance.
35
36The dentry cache is meant to be a view into your entire filespace. As
37most computers cannot fit all dentries in the RAM at the same time,
38some bits of the cache are missing. In order to resolve your pathname
39into a dentry, the VFS may have to resort to creating dentries along
40the way, and then loading the inode. This is done by looking up the
41inode.
42
43
44The Inode Object
45----------------
46
47An individual dentry usually has a pointer to an inode. Inodes are
48filesystem objects such as regular files, directories, FIFOs and other
49beasts. They live either on the disc (for block device filesystems)
50or in the memory (for pseudo filesystems). Inodes that live on the
51disc are copied into the memory when required and changes to the inode
52are written back to disc. A single inode can be pointed to by multiple
53dentries (hard links, for example, do this).
54
55To look up an inode requires that the VFS calls the lookup() method of
56the parent directory inode. This method is installed by the specific
57filesystem implementation that the inode lives in. Once the VFS has
58the required dentry (and hence the inode), we can do all those boring
59things like open(2) the file, or stat(2) it to peek at the inode
60data. The stat(2) operation is fairly simple: once the VFS has the
61dentry, it peeks at the inode data and passes some of it back to
62userspace.
63
64
65The File Object
66---------------
67
68Opening a file requires another operation: allocation of a file
69structure (this is the kernel-side implementation of file
70descriptors). The freshly allocated file structure is initialized with
71a pointer to the dentry and a set of file operation member functions.
72These are taken from the inode data. The open() file method is then
73called so the specific filesystem implementation can do its work. You
74can see that this is another switch performed by the VFS. The file
75structure is placed into the file descriptor table for the process.
76
77Reading, writing and closing files (and other assorted VFS operations)
78is done by using the userspace file descriptor to grab the appropriate
79file structure, and then calling the required file structure method to
80do whatever is required. For as long as the file is open, it keeps the
81dentry in use, which in turn means that the VFS inode is still in use.
82
83
84Registering and Mounting a Filesystem
85=====================================
86
87To register and unregister a filesystem, use the following API
88functions:
89
90 #include <linux/fs.h>
91
92 extern int register_filesystem(struct file_system_type *);
93 extern int unregister_filesystem(struct file_system_type *);
94
95The passed struct file_system_type describes your filesystem. When a
96request is made to mount a filesystem onto a directory in your namespace,
97the VFS will call the appropriate mount() method for the specific
98filesystem. New vfsmount referring to the tree returned by ->mount()
99will be attached to the mountpoint, so that when pathname resolution
100reaches the mountpoint it will jump into the root of that vfsmount.
101
102You can see all filesystems that are registered to the kernel in the
103file /proc/filesystems.
104
105
106struct file_system_type
107-----------------------
108
109This describes the filesystem. As of kernel 2.6.39, the following
110members are defined:
111
112struct file_system_type {
113 const char *name;
114 int fs_flags;
115 struct dentry *(*mount) (struct file_system_type *, int,
116 const char *, void *);
117 void (*kill_sb) (struct super_block *);
118 struct module *owner;
119 struct file_system_type * next;
120 struct list_head fs_supers;
121 struct lock_class_key s_lock_key;
122 struct lock_class_key s_umount_key;
123};
124
125 name: the name of the filesystem type, such as "ext2", "iso9660",
126 "msdos" and so on
127
128 fs_flags: various flags (i.e. FS_REQUIRES_DEV, FS_NO_DCACHE, etc.)
129
130 mount: the method to call when a new instance of this
131 filesystem should be mounted
132
133 kill_sb: the method to call when an instance of this filesystem
134 should be shut down
135
136 owner: for internal VFS use: you should initialize this to THIS_MODULE in
137 most cases.
138
139 next: for internal VFS use: you should initialize this to NULL
140
141 s_lock_key, s_umount_key: lockdep-specific
142
143The mount() method has the following arguments:
144
145 struct file_system_type *fs_type: describes the filesystem, partly initialized
146 by the specific filesystem code
147
148 int flags: mount flags
149
150 const char *dev_name: the device name we are mounting.
151
152 void *data: arbitrary mount options, usually comes as an ASCII
153 string (see "Mount Options" section)
154
155The mount() method must return the root dentry of the tree requested by
156caller. An active reference to its superblock must be grabbed and the
157superblock must be locked. On failure it should return ERR_PTR(error).
158
159The arguments match those of mount(2) and their interpretation
160depends on filesystem type. E.g. for block filesystems, dev_name is
161interpreted as block device name, that device is opened and if it
162contains a suitable filesystem image the method creates and initializes
163struct super_block accordingly, returning its root dentry to caller.
164
165->mount() may choose to return a subtree of existing filesystem - it
166doesn't have to create a new one. The main result from the caller's
167point of view is a reference to dentry at the root of (sub)tree to
168be attached; creation of new superblock is a common side effect.
169
170The most interesting member of the superblock structure that the
171mount() method fills in is the "s_op" field. This is a pointer to
172a "struct super_operations" which describes the next level of the
173filesystem implementation.
174
175Usually, a filesystem uses one of the generic mount() implementations
176and provides a fill_super() callback instead. The generic variants are:
177
178 mount_bdev: mount a filesystem residing on a block device
179
180 mount_nodev: mount a filesystem that is not backed by a device
181
182 mount_single: mount a filesystem which shares the instance between
183 all mounts
184
185A fill_super() callback implementation has the following arguments:
186
187 struct super_block *sb: the superblock structure. The callback
188 must initialize this properly.
189
190 void *data: arbitrary mount options, usually comes as an ASCII
191 string (see "Mount Options" section)
192
193 int silent: whether or not to be silent on error
194
195
196The Superblock Object
197=====================
198
199A superblock object represents a mounted filesystem.
200
201
202struct super_operations
203-----------------------
204
205This describes how the VFS can manipulate the superblock of your
206filesystem. As of kernel 2.6.22, the following members are defined:
207
208struct super_operations {
209 struct inode *(*alloc_inode)(struct super_block *sb);
210 void (*destroy_inode)(struct inode *);
211
212 void (*dirty_inode) (struct inode *, int flags);
213 int (*write_inode) (struct inode *, int);
214 void (*drop_inode) (struct inode *);
215 void (*delete_inode) (struct inode *);
216 void (*put_super) (struct super_block *);
217 int (*sync_fs)(struct super_block *sb, int wait);
218 int (*freeze_fs) (struct super_block *);
219 int (*unfreeze_fs) (struct super_block *);
220 int (*statfs) (struct dentry *, struct kstatfs *);
221 int (*remount_fs) (struct super_block *, int *, char *);
222 void (*clear_inode) (struct inode *);
223 void (*umount_begin) (struct super_block *);
224
225 int (*show_options)(struct seq_file *, struct dentry *);
226
227 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
228 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
229 int (*nr_cached_objects)(struct super_block *);
230 void (*free_cached_objects)(struct super_block *, int);
231};
232
233All methods are called without any locks being held, unless otherwise
234noted. This means that most methods can block safely. All methods are
235only called from a process context (i.e. not from an interrupt handler
236or bottom half).
237
238 alloc_inode: this method is called by alloc_inode() to allocate memory
239 for struct inode and initialize it. If this function is not
240 defined, a simple 'struct inode' is allocated. Normally
241 alloc_inode will be used to allocate a larger structure which
242 contains a 'struct inode' embedded within it.
243
244 destroy_inode: this method is called by destroy_inode() to release
245 resources allocated for struct inode. It is only required if
246 ->alloc_inode was defined and simply undoes anything done by
247 ->alloc_inode.
248
249 dirty_inode: this method is called by the VFS to mark an inode dirty.
250
251 write_inode: this method is called when the VFS needs to write an
252 inode to disc. The second parameter indicates whether the write
253 should be synchronous or not, not all filesystems check this flag.
254
255 drop_inode: called when the last access to the inode is dropped,
256 with the inode->i_lock spinlock held.
257
258 This method should be either NULL (normal UNIX filesystem
259 semantics) or "generic_delete_inode" (for filesystems that do not
260 want to cache inodes - causing "delete_inode" to always be
261 called regardless of the value of i_nlink)
262
263 The "generic_delete_inode()" behavior is equivalent to the
264 old practice of using "force_delete" in the put_inode() case,
265 but does not have the races that the "force_delete()" approach
266 had.
267
268 delete_inode: called when the VFS wants to delete an inode
269
270 put_super: called when the VFS wishes to free the superblock
271 (i.e. unmount). This is called with the superblock lock held
272
273 sync_fs: called when VFS is writing out all dirty data associated with
274 a superblock. The second parameter indicates whether the method
275 should wait until the write out has been completed. Optional.
276
277 freeze_fs: called when VFS is locking a filesystem and
278 forcing it into a consistent state. This method is currently
279 used by the Logical Volume Manager (LVM).
280
281 unfreeze_fs: called when VFS is unlocking a filesystem and making it writable
282 again.
283
284 statfs: called when the VFS needs to get filesystem statistics.
285
286 remount_fs: called when the filesystem is remounted. This is called
287 with the kernel lock held
288
289 clear_inode: called then the VFS clears the inode. Optional
290
291 umount_begin: called when the VFS is unmounting a filesystem.
292
293 show_options: called by the VFS to show mount options for
294 /proc/<pid>/mounts. (see "Mount Options" section)
295
296 quota_read: called by the VFS to read from filesystem quota file.
297
298 quota_write: called by the VFS to write to filesystem quota file.
299
300 nr_cached_objects: called by the sb cache shrinking function for the
301 filesystem to return the number of freeable cached objects it contains.
302 Optional.
303
304 free_cache_objects: called by the sb cache shrinking function for the
305 filesystem to scan the number of objects indicated to try to free them.
306 Optional, but any filesystem implementing this method needs to also
307 implement ->nr_cached_objects for it to be called correctly.
308
309 We can't do anything with any errors that the filesystem might
310 encountered, hence the void return type. This will never be called if
311 the VM is trying to reclaim under GFP_NOFS conditions, hence this
312 method does not need to handle that situation itself.
313
314 Implementations must include conditional reschedule calls inside any
315 scanning loop that is done. This allows the VFS to determine
316 appropriate scan batch sizes without having to worry about whether
317 implementations will cause holdoff problems due to large scan batch
318 sizes.
319
320Whoever sets up the inode is responsible for filling in the "i_op" field. This
321is a pointer to a "struct inode_operations" which describes the methods that
322can be performed on individual inodes.
323
324struct xattr_handlers
325---------------------
326
327On filesystems that support extended attributes (xattrs), the s_xattr
328superblock field points to a NULL-terminated array of xattr handlers. Extended
329attributes are name:value pairs.
330
331 name: Indicates that the handler matches attributes with the specified name
332 (such as "system.posix_acl_access"); the prefix field must be NULL.
333
334 prefix: Indicates that the handler matches all attributes with the specified
335 name prefix (such as "user."); the name field must be NULL.
336
337 list: Determine if attributes matching this xattr handler should be listed
338 for a particular dentry. Used by some listxattr implementations like
339 generic_listxattr.
340
341 get: Called by the VFS to get the value of a particular extended attribute.
342 This method is called by the getxattr(2) system call.
343
344 set: Called by the VFS to set the value of a particular extended attribute.
345 When the new value is NULL, called to remove a particular extended
346 attribute. This method is called by the the setxattr(2) and
347 removexattr(2) system calls.
348
349When none of the xattr handlers of a filesystem match the specified attribute
350name or when a filesystem doesn't support extended attributes, the various
351*xattr(2) system calls return -EOPNOTSUPP.
352
353
354The Inode Object
355================
356
357An inode object represents an object within the filesystem.
358
359
360struct inode_operations
361-----------------------
362
363This describes how the VFS can manipulate an inode in your
364filesystem. As of kernel 2.6.22, the following members are defined:
365
366struct inode_operations {
367 int (*create) (struct inode *,struct dentry *, umode_t, bool);
368 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
369 int (*link) (struct dentry *,struct inode *,struct dentry *);
370 int (*unlink) (struct inode *,struct dentry *);
371 int (*symlink) (struct inode *,struct dentry *,const char *);
372 int (*mkdir) (struct inode *,struct dentry *,umode_t);
373 int (*rmdir) (struct inode *,struct dentry *);
374 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
375 int (*rename) (struct inode *, struct dentry *,
376 struct inode *, struct dentry *, unsigned int);
377 int (*readlink) (struct dentry *, char __user *,int);
378 const char *(*get_link) (struct dentry *, struct inode *,
379 struct delayed_call *);
380 int (*permission) (struct inode *, int);
381 int (*get_acl)(struct inode *, int);
382 int (*setattr) (struct dentry *, struct iattr *);
383 int (*getattr) (const struct path *, struct kstat *, u32, unsigned int);
384 ssize_t (*listxattr) (struct dentry *, char *, size_t);
385 void (*update_time)(struct inode *, struct timespec *, int);
386 int (*atomic_open)(struct inode *, struct dentry *, struct file *,
387 unsigned open_flag, umode_t create_mode);
388 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
389};
390
391Again, all methods are called without any locks being held, unless
392otherwise noted.
393
394 create: called by the open(2) and creat(2) system calls. Only
395 required if you want to support regular files. The dentry you
396 get should not have an inode (i.e. it should be a negative
397 dentry). Here you will probably call d_instantiate() with the
398 dentry and the newly created inode
399
400 lookup: called when the VFS needs to look up an inode in a parent
401 directory. The name to look for is found in the dentry. This
402 method must call d_add() to insert the found inode into the
403 dentry. The "i_count" field in the inode structure should be
404 incremented. If the named inode does not exist a NULL inode
405 should be inserted into the dentry (this is called a negative
406 dentry). Returning an error code from this routine must only
407 be done on a real error, otherwise creating inodes with system
408 calls like create(2), mknod(2), mkdir(2) and so on will fail.
409 If you wish to overload the dentry methods then you should
410 initialise the "d_dop" field in the dentry; this is a pointer
411 to a struct "dentry_operations".
412 This method is called with the directory inode semaphore held
413
414 link: called by the link(2) system call. Only required if you want
415 to support hard links. You will probably need to call
416 d_instantiate() just as you would in the create() method
417
418 unlink: called by the unlink(2) system call. Only required if you
419 want to support deleting inodes
420
421 symlink: called by the symlink(2) system call. Only required if you
422 want to support symlinks. You will probably need to call
423 d_instantiate() just as you would in the create() method
424
425 mkdir: called by the mkdir(2) system call. Only required if you want
426 to support creating subdirectories. You will probably need to
427 call d_instantiate() just as you would in the create() method
428
429 rmdir: called by the rmdir(2) system call. Only required if you want
430 to support deleting subdirectories
431
432 mknod: called by the mknod(2) system call to create a device (char,
433 block) inode or a named pipe (FIFO) or socket. Only required
434 if you want to support creating these types of inodes. You
435 will probably need to call d_instantiate() just as you would
436 in the create() method
437
438 rename: called by the rename(2) system call to rename the object to
439 have the parent and name given by the second inode and dentry.
440
441 The filesystem must return -EINVAL for any unsupported or
442 unknown flags. Currently the following flags are implemented:
443 (1) RENAME_NOREPLACE: this flag indicates that if the target
444 of the rename exists the rename should fail with -EEXIST
445 instead of replacing the target. The VFS already checks for
446 existence, so for local filesystems the RENAME_NOREPLACE
447 implementation is equivalent to plain rename.
448 (2) RENAME_EXCHANGE: exchange source and target. Both must
449 exist; this is checked by the VFS. Unlike plain rename,
450 source and target may be of different type.
451
452 get_link: called by the VFS to follow a symbolic link to the
453 inode it points to. Only required if you want to support
454 symbolic links. This method returns the symlink body
455 to traverse (and possibly resets the current position with
456 nd_jump_link()). If the body won't go away until the inode
457 is gone, nothing else is needed; if it needs to be otherwise
458 pinned, arrange for its release by having get_link(..., ..., done)
459 do set_delayed_call(done, destructor, argument).
460 In that case destructor(argument) will be called once VFS is
461 done with the body you've returned.
462 May be called in RCU mode; that is indicated by NULL dentry
463 argument. If request can't be handled without leaving RCU mode,
464 have it return ERR_PTR(-ECHILD).
465
466 If the filesystem stores the symlink target in ->i_link, the
467 VFS may use it directly without calling ->get_link(); however,
468 ->get_link() must still be provided. ->i_link must not be
469 freed until after an RCU grace period. Writing to ->i_link
470 post-iget() time requires a 'release' memory barrier.
471
472 readlink: this is now just an override for use by readlink(2) for the
473 cases when ->get_link uses nd_jump_link() or object is not in
474 fact a symlink. Normally filesystems should only implement
475 ->get_link for symlinks and readlink(2) will automatically use
476 that.
477
478 permission: called by the VFS to check for access rights on a POSIX-like
479 filesystem.
480
481 May be called in rcu-walk mode (mask & MAY_NOT_BLOCK). If in rcu-walk
482 mode, the filesystem must check the permission without blocking or
483 storing to the inode.
484
485 If a situation is encountered that rcu-walk cannot handle, return
486 -ECHILD and it will be called again in ref-walk mode.
487
488 setattr: called by the VFS to set attributes for a file. This method
489 is called by chmod(2) and related system calls.
490
491 getattr: called by the VFS to get attributes of a file. This method
492 is called by stat(2) and related system calls.
493
494 listxattr: called by the VFS to list all extended attributes for a
495 given file. This method is called by the listxattr(2) system call.
496
497 update_time: called by the VFS to update a specific time or the i_version of
498 an inode. If this is not defined the VFS will update the inode itself
499 and call mark_inode_dirty_sync.
500
501 atomic_open: called on the last component of an open. Using this optional
502 method the filesystem can look up, possibly create and open the file in
503 one atomic operation. If it wants to leave actual opening to the
504 caller (e.g. if the file turned out to be a symlink, device, or just
505 something filesystem won't do atomic open for), it may signal this by
506 returning finish_no_open(file, dentry). This method is only called if
507 the last component is negative or needs lookup. Cached positive dentries
508 are still handled by f_op->open(). If the file was created,
509 FMODE_CREATED flag should be set in file->f_mode. In case of O_EXCL
510 the method must only succeed if the file didn't exist and hence FMODE_CREATED
511 shall always be set on success.
512
513 tmpfile: called in the end of O_TMPFILE open(). Optional, equivalent to
514 atomically creating, opening and unlinking a file in given directory.
515
516The Address Space Object
517========================
518
519The address space object is used to group and manage pages in the page
520cache. It can be used to keep track of the pages in a file (or
521anything else) and also track the mapping of sections of the file into
522process address spaces.
523
524There are a number of distinct yet related services that an
525address-space can provide. These include communicating memory
526pressure, page lookup by address, and keeping track of pages tagged as
527Dirty or Writeback.
528
529The first can be used independently to the others. The VM can try to
530either write dirty pages in order to clean them, or release clean
531pages in order to reuse them. To do this it can call the ->writepage
532method on dirty pages, and ->releasepage on clean pages with
533PagePrivate set. Clean pages without PagePrivate and with no external
534references will be released without notice being given to the
535address_space.
536
537To achieve this functionality, pages need to be placed on an LRU with
538lru_cache_add and mark_page_active needs to be called whenever the
539page is used.
540
541Pages are normally kept in a radix tree index by ->index. This tree
542maintains information about the PG_Dirty and PG_Writeback status of
543each page, so that pages with either of these flags can be found
544quickly.
545
546The Dirty tag is primarily used by mpage_writepages - the default
547->writepages method. It uses the tag to find dirty pages to call
548->writepage on. If mpage_writepages is not used (i.e. the address
549provides its own ->writepages) , the PAGECACHE_TAG_DIRTY tag is
550almost unused. write_inode_now and sync_inode do use it (through
551__sync_single_inode) to check if ->writepages has been successful in
552writing out the whole address_space.
553
554The Writeback tag is used by filemap*wait* and sync_page* functions,
555via filemap_fdatawait_range, to wait for all writeback to complete.
556
557An address_space handler may attach extra information to a page,
558typically using the 'private' field in the 'struct page'. If such
559information is attached, the PG_Private flag should be set. This will
560cause various VM routines to make extra calls into the address_space
561handler to deal with that data.
562
563An address space acts as an intermediate between storage and
564application. Data is read into the address space a whole page at a
565time, and provided to the application either by copying of the page,
566or by memory-mapping the page.
567Data is written into the address space by the application, and then
568written-back to storage typically in whole pages, however the
569address_space has finer control of write sizes.
570
571The read process essentially only requires 'readpage'. The write
572process is more complicated and uses write_begin/write_end or
573set_page_dirty to write data into the address_space, and writepage
574and writepages to writeback data to storage.
575
576Adding and removing pages to/from an address_space is protected by the
577inode's i_mutex.
578
579When data is written to a page, the PG_Dirty flag should be set. It
580typically remains set until writepage asks for it to be written. This
581should clear PG_Dirty and set PG_Writeback. It can be actually
582written at any point after PG_Dirty is clear. Once it is known to be
583safe, PG_Writeback is cleared.
584
585Writeback makes use of a writeback_control structure to direct the
586operations. This gives the the writepage and writepages operations some
587information about the nature of and reason for the writeback request,
588and the constraints under which it is being done. It is also used to
589return information back to the caller about the result of a writepage or
590writepages request.
591
592Handling errors during writeback
593--------------------------------
594Most applications that do buffered I/O will periodically call a file
595synchronization call (fsync, fdatasync, msync or sync_file_range) to
596ensure that data written has made it to the backing store. When there
597is an error during writeback, they expect that error to be reported when
598a file sync request is made. After an error has been reported on one
599request, subsequent requests on the same file descriptor should return
6000, unless further writeback errors have occurred since the previous file
601syncronization.
602
603Ideally, the kernel would report errors only on file descriptions on
604which writes were done that subsequently failed to be written back. The
605generic pagecache infrastructure does not track the file descriptions
606that have dirtied each individual page however, so determining which
607file descriptors should get back an error is not possible.
608
609Instead, the generic writeback error tracking infrastructure in the
610kernel settles for reporting errors to fsync on all file descriptions
611that were open at the time that the error occurred. In a situation with
612multiple writers, all of them will get back an error on a subsequent fsync,
613even if all of the writes done through that particular file descriptor
614succeeded (or even if there were no writes on that file descriptor at all).
615
616Filesystems that wish to use this infrastructure should call
617mapping_set_error to record the error in the address_space when it
618occurs. Then, after writing back data from the pagecache in their
619file->fsync operation, they should call file_check_and_advance_wb_err to
620ensure that the struct file's error cursor has advanced to the correct
621point in the stream of errors emitted by the backing device(s).
622
623struct address_space_operations
624-------------------------------
625
626This describes how the VFS can manipulate mapping of a file to page cache in
627your filesystem. The following members are defined:
628
629struct address_space_operations {
630 int (*writepage)(struct page *page, struct writeback_control *wbc);
631 int (*readpage)(struct file *, struct page *);
632 int (*writepages)(struct address_space *, struct writeback_control *);
633 int (*set_page_dirty)(struct page *page);
634 int (*readpages)(struct file *filp, struct address_space *mapping,
635 struct list_head *pages, unsigned nr_pages);
636 int (*write_begin)(struct file *, struct address_space *mapping,
637 loff_t pos, unsigned len, unsigned flags,
638 struct page **pagep, void **fsdata);
639 int (*write_end)(struct file *, struct address_space *mapping,
640 loff_t pos, unsigned len, unsigned copied,
641 struct page *page, void *fsdata);
642 sector_t (*bmap)(struct address_space *, sector_t);
643 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
644 int (*releasepage) (struct page *, int);
645 void (*freepage)(struct page *);
646 ssize_t (*direct_IO)(struct kiocb *, struct iov_iter *iter);
647 /* isolate a page for migration */
648 bool (*isolate_page) (struct page *, isolate_mode_t);
649 /* migrate the contents of a page to the specified target */
650 int (*migratepage) (struct page *, struct page *);
651 /* put migration-failed page back to right list */
652 void (*putback_page) (struct page *);
653 int (*launder_page) (struct page *);
654
655 int (*is_partially_uptodate) (struct page *, unsigned long,
656 unsigned long);
657 void (*is_dirty_writeback) (struct page *, bool *, bool *);
658 int (*error_remove_page) (struct mapping *mapping, struct page *page);
659 int (*swap_activate)(struct file *);
660 int (*swap_deactivate)(struct file *);
661};
662
663 writepage: called by the VM to write a dirty page to backing store.
664 This may happen for data integrity reasons (i.e. 'sync'), or
665 to free up memory (flush). The difference can be seen in
666 wbc->sync_mode.
667 The PG_Dirty flag has been cleared and PageLocked is true.
668 writepage should start writeout, should set PG_Writeback,
669 and should make sure the page is unlocked, either synchronously
670 or asynchronously when the write operation completes.
671
672 If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to
673 try too hard if there are problems, and may choose to write out
674 other pages from the mapping if that is easier (e.g. due to
675 internal dependencies). If it chooses not to start writeout, it
676 should return AOP_WRITEPAGE_ACTIVATE so that the VM will not keep
677 calling ->writepage on that page.
678
679 See the file "Locking" for more details.
680
681 readpage: called by the VM to read a page from backing store.
682 The page will be Locked when readpage is called, and should be
683 unlocked and marked uptodate once the read completes.
684 If ->readpage discovers that it needs to unlock the page for
685 some reason, it can do so, and then return AOP_TRUNCATED_PAGE.
686 In this case, the page will be relocated, relocked and if
687 that all succeeds, ->readpage will be called again.
688
689 writepages: called by the VM to write out pages associated with the
690 address_space object. If wbc->sync_mode is WBC_SYNC_ALL, then
691 the writeback_control will specify a range of pages that must be
692 written out. If it is WBC_SYNC_NONE, then a nr_to_write is given
693 and that many pages should be written if possible.
694 If no ->writepages is given, then mpage_writepages is used
695 instead. This will choose pages from the address space that are
696 tagged as DIRTY and will pass them to ->writepage.
697
698 set_page_dirty: called by the VM to set a page dirty.
699 This is particularly needed if an address space attaches
700 private data to a page, and that data needs to be updated when
701 a page is dirtied. This is called, for example, when a memory
702 mapped page gets modified.
703 If defined, it should set the PageDirty flag, and the
704 PAGECACHE_TAG_DIRTY tag in the radix tree.
705
706 readpages: called by the VM to read pages associated with the address_space
707 object. This is essentially just a vector version of
708 readpage. Instead of just one page, several pages are
709 requested.
710 readpages is only used for read-ahead, so read errors are
711 ignored. If anything goes wrong, feel free to give up.
712
713 write_begin:
714 Called by the generic buffered write code to ask the filesystem to
715 prepare to write len bytes at the given offset in the file. The
716 address_space should check that the write will be able to complete,
717 by allocating space if necessary and doing any other internal
718 housekeeping. If the write will update parts of any basic-blocks on
719 storage, then those blocks should be pre-read (if they haven't been
720 read already) so that the updated blocks can be written out properly.
721
722 The filesystem must return the locked pagecache page for the specified
723 offset, in *pagep, for the caller to write into.
724
725 It must be able to cope with short writes (where the length passed to
726 write_begin is greater than the number of bytes copied into the page).
727
728 flags is a field for AOP_FLAG_xxx flags, described in
729 include/linux/fs.h.
730
731 A void * may be returned in fsdata, which then gets passed into
732 write_end.
733
734 Returns 0 on success; < 0 on failure (which is the error code), in
735 which case write_end is not called.
736
737 write_end: After a successful write_begin, and data copy, write_end must
738 be called. len is the original len passed to write_begin, and copied
739 is the amount that was able to be copied.
740
741 The filesystem must take care of unlocking the page and releasing it
742 refcount, and updating i_size.
743
744 Returns < 0 on failure, otherwise the number of bytes (<= 'copied')
745 that were able to be copied into pagecache.
746
747 bmap: called by the VFS to map a logical block offset within object to
748 physical block number. This method is used by the FIBMAP
749 ioctl and for working with swap-files. To be able to swap to
750 a file, the file must have a stable mapping to a block
751 device. The swap system does not go through the filesystem
752 but instead uses bmap to find out where the blocks in the file
753 are and uses those addresses directly.
754
755 invalidatepage: If a page has PagePrivate set, then invalidatepage
756 will be called when part or all of the page is to be removed
757 from the address space. This generally corresponds to either a
758 truncation, punch hole or a complete invalidation of the address
759 space (in the latter case 'offset' will always be 0 and 'length'
760 will be PAGE_SIZE). Any private data associated with the page
761 should be updated to reflect this truncation. If offset is 0 and
762 length is PAGE_SIZE, then the private data should be released,
763 because the page must be able to be completely discarded. This may
764 be done by calling the ->releasepage function, but in this case the
765 release MUST succeed.
766
767 releasepage: releasepage is called on PagePrivate pages to indicate
768 that the page should be freed if possible. ->releasepage
769 should remove any private data from the page and clear the
770 PagePrivate flag. If releasepage() fails for some reason, it must
771 indicate failure with a 0 return value.
772 releasepage() is used in two distinct though related cases. The
773 first is when the VM finds a clean page with no active users and
774 wants to make it a free page. If ->releasepage succeeds, the
775 page will be removed from the address_space and become free.
776
777 The second case is when a request has been made to invalidate
778 some or all pages in an address_space. This can happen
779 through the fadvise(POSIX_FADV_DONTNEED) system call or by the
780 filesystem explicitly requesting it as nfs and 9fs do (when
781 they believe the cache may be out of date with storage) by
782 calling invalidate_inode_pages2().
783 If the filesystem makes such a call, and needs to be certain
784 that all pages are invalidated, then its releasepage will
785 need to ensure this. Possibly it can clear the PageUptodate
786 bit if it cannot free private data yet.
787
788 freepage: freepage is called once the page is no longer visible in
789 the page cache in order to allow the cleanup of any private
790 data. Since it may be called by the memory reclaimer, it
791 should not assume that the original address_space mapping still
792 exists, and it should not block.
793
794 direct_IO: called by the generic read/write routines to perform
795 direct_IO - that is IO requests which bypass the page cache
796 and transfer data directly between the storage and the
797 application's address space.
798
799 isolate_page: Called by the VM when isolating a movable non-lru page.
800 If page is successfully isolated, VM marks the page as PG_isolated
801 via __SetPageIsolated.
802
803 migrate_page: This is used to compact the physical memory usage.
804 If the VM wants to relocate a page (maybe off a memory card
805 that is signalling imminent failure) it will pass a new page
806 and an old page to this function. migrate_page should
807 transfer any private data across and update any references
808 that it has to the page.
809
810 putback_page: Called by the VM when isolated page's migration fails.
811
812 launder_page: Called before freeing a page - it writes back the dirty page. To
813 prevent redirtying the page, it is kept locked during the whole
814 operation.
815
816 is_partially_uptodate: Called by the VM when reading a file through the
817 pagecache when the underlying blocksize != pagesize. If the required
818 block is up to date then the read can complete without needing the IO
819 to bring the whole page up to date.
820
821 is_dirty_writeback: Called by the VM when attempting to reclaim a page.
822 The VM uses dirty and writeback information to determine if it needs
823 to stall to allow flushers a chance to complete some IO. Ordinarily
824 it can use PageDirty and PageWriteback but some filesystems have
825 more complex state (unstable pages in NFS prevent reclaim) or
826 do not set those flags due to locking problems. This callback
827 allows a filesystem to indicate to the VM if a page should be
828 treated as dirty or writeback for the purposes of stalling.
829
830 error_remove_page: normally set to generic_error_remove_page if truncation
831 is ok for this address space. Used for memory failure handling.
832 Setting this implies you deal with pages going away under you,
833 unless you have them locked or reference counts increased.
834
835 swap_activate: Called when swapon is used on a file to allocate
836 space if necessary and pin the block lookup information in
837 memory. A return value of zero indicates success,
838 in which case this file can be used to back swapspace.
839
840 swap_deactivate: Called during swapoff on files where swap_activate
841 was successful.
842
843
844The File Object
845===============
846
847A file object represents a file opened by a process. This is also known
848as an "open file description" in POSIX parlance.
849
850
851struct file_operations
852----------------------
853
854This describes how the VFS can manipulate an open file. As of kernel
8554.18, the following members are defined:
856
857struct file_operations {
858 struct module *owner;
859 loff_t (*llseek) (struct file *, loff_t, int);
860 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
861 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
862 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
863 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
864 int (*iopoll)(struct kiocb *kiocb, bool spin);
865 int (*iterate) (struct file *, struct dir_context *);
866 int (*iterate_shared) (struct file *, struct dir_context *);
867 __poll_t (*poll) (struct file *, struct poll_table_struct *);
868 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
869 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
870 int (*mmap) (struct file *, struct vm_area_struct *);
871 int (*open) (struct inode *, struct file *);
872 int (*flush) (struct file *, fl_owner_t id);
873 int (*release) (struct inode *, struct file *);
874 int (*fsync) (struct file *, loff_t, loff_t, int datasync);
875 int (*fasync) (int, struct file *, int);
876 int (*lock) (struct file *, int, struct file_lock *);
877 ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
878 unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
879 int (*check_flags)(int);
880 int (*flock) (struct file *, int, struct file_lock *);
881 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
882 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
883 int (*setlease)(struct file *, long, struct file_lock **, void **);
884 long (*fallocate)(struct file *file, int mode, loff_t offset,
885 loff_t len);
886 void (*show_fdinfo)(struct seq_file *m, struct file *f);
887#ifndef CONFIG_MMU
888 unsigned (*mmap_capabilities)(struct file *);
889#endif
890 ssize_t (*copy_file_range)(struct file *, loff_t, struct file *, loff_t, size_t, unsigned int);
891 loff_t (*remap_file_range)(struct file *file_in, loff_t pos_in,
892 struct file *file_out, loff_t pos_out,
893 loff_t len, unsigned int remap_flags);
894 int (*fadvise)(struct file *, loff_t, loff_t, int);
895};
896
897Again, all methods are called without any locks being held, unless
898otherwise noted.
899
900 llseek: called when the VFS needs to move the file position index
901
902 read: called by read(2) and related system calls
903
904 read_iter: possibly asynchronous read with iov_iter as destination
905
906 write: called by write(2) and related system calls
907
908 write_iter: possibly asynchronous write with iov_iter as source
909
910 iopoll: called when aio wants to poll for completions on HIPRI iocbs
911
912 iterate: called when the VFS needs to read the directory contents
913
914 iterate_shared: called when the VFS needs to read the directory contents
915 when filesystem supports concurrent dir iterators
916
917 poll: called by the VFS when a process wants to check if there is
918 activity on this file and (optionally) go to sleep until there
919 is activity. Called by the select(2) and poll(2) system calls
920
921 unlocked_ioctl: called by the ioctl(2) system call.
922
923 compat_ioctl: called by the ioctl(2) system call when 32 bit system calls
924 are used on 64 bit kernels.
925
926 mmap: called by the mmap(2) system call
927
928 open: called by the VFS when an inode should be opened. When the VFS
929 opens a file, it creates a new "struct file". It then calls the
930 open method for the newly allocated file structure. You might
931 think that the open method really belongs in
932 "struct inode_operations", and you may be right. I think it's
933 done the way it is because it makes filesystems simpler to
934 implement. The open() method is a good place to initialize the
935 "private_data" member in the file structure if you want to point
936 to a device structure
937
938 flush: called by the close(2) system call to flush a file
939
940 release: called when the last reference to an open file is closed
941
942 fsync: called by the fsync(2) system call. Also see the section above
943 entitled "Handling errors during writeback".
944
945 fasync: called by the fcntl(2) system call when asynchronous
946 (non-blocking) mode is enabled for a file
947
948 lock: called by the fcntl(2) system call for F_GETLK, F_SETLK, and F_SETLKW
949 commands
950
951 get_unmapped_area: called by the mmap(2) system call
952
953 check_flags: called by the fcntl(2) system call for F_SETFL command
954
955 flock: called by the flock(2) system call
956
957 splice_write: called by the VFS to splice data from a pipe to a file. This
958 method is used by the splice(2) system call
959
960 splice_read: called by the VFS to splice data from file to a pipe. This
961 method is used by the splice(2) system call
962
963 setlease: called by the VFS to set or release a file lock lease. setlease
964 implementations should call generic_setlease to record or remove
965 the lease in the inode after setting it.
966
967 fallocate: called by the VFS to preallocate blocks or punch a hole.
968
969 copy_file_range: called by the copy_file_range(2) system call.
970
971 remap_file_range: called by the ioctl(2) system call for FICLONERANGE and
972 FICLONE and FIDEDUPERANGE commands to remap file ranges. An
973 implementation should remap len bytes at pos_in of the source file into
974 the dest file at pos_out. Implementations must handle callers passing
975 in len == 0; this means "remap to the end of the source file". The
976 return value should the number of bytes remapped, or the usual
977 negative error code if errors occurred before any bytes were remapped.
978 The remap_flags parameter accepts REMAP_FILE_* flags. If
979 REMAP_FILE_DEDUP is set then the implementation must only remap if the
980 requested file ranges have identical contents. If REMAP_CAN_SHORTEN is
981 set, the caller is ok with the implementation shortening the request
982 length to satisfy alignment or EOF requirements (or any other reason).
983
984 fadvise: possibly called by the fadvise64() system call.
985
986Note that the file operations are implemented by the specific
987filesystem in which the inode resides. When opening a device node
988(character or block special) most filesystems will call special
989support routines in the VFS which will locate the required device
990driver information. These support routines replace the filesystem file
991operations with those for the device driver, and then proceed to call
992the new open() method for the file. This is how opening a device file
993in the filesystem eventually ends up calling the device driver open()
994method.
995
996
997Directory Entry Cache (dcache)
998==============================
999
1000
1001struct dentry_operations
1002------------------------
1003
1004This describes how a filesystem can overload the standard dentry
1005operations. Dentries and the dcache are the domain of the VFS and the
1006individual filesystem implementations. Device drivers have no business
1007here. These methods may be set to NULL, as they are either optional or
1008the VFS uses a default. As of kernel 2.6.22, the following members are
1009defined:
1010
1011struct dentry_operations {
1012 int (*d_revalidate)(struct dentry *, unsigned int);
1013 int (*d_weak_revalidate)(struct dentry *, unsigned int);
1014 int (*d_hash)(const struct dentry *, struct qstr *);
1015 int (*d_compare)(const struct dentry *,
1016 unsigned int, const char *, const struct qstr *);
1017 int (*d_delete)(const struct dentry *);
1018 int (*d_init)(struct dentry *);
1019 void (*d_release)(struct dentry *);
1020 void (*d_iput)(struct dentry *, struct inode *);
1021 char *(*d_dname)(struct dentry *, char *, int);
1022 struct vfsmount *(*d_automount)(struct path *);
1023 int (*d_manage)(const struct path *, bool);
1024 struct dentry *(*d_real)(struct dentry *, const struct inode *);
1025};
1026
1027 d_revalidate: called when the VFS needs to revalidate a dentry. This
1028 is called whenever a name look-up finds a dentry in the
1029 dcache. Most local filesystems leave this as NULL, because all their
1030 dentries in the dcache are valid. Network filesystems are different
1031 since things can change on the server without the client necessarily
1032 being aware of it.
1033
1034 This function should return a positive value if the dentry is still
1035 valid, and zero or a negative error code if it isn't.
1036
1037 d_revalidate may be called in rcu-walk mode (flags & LOOKUP_RCU).
1038 If in rcu-walk mode, the filesystem must revalidate the dentry without
1039 blocking or storing to the dentry, d_parent and d_inode should not be
1040 used without care (because they can change and, in d_inode case, even
1041 become NULL under us).
1042
1043 If a situation is encountered that rcu-walk cannot handle, return
1044 -ECHILD and it will be called again in ref-walk mode.
1045
1046 d_weak_revalidate: called when the VFS needs to revalidate a "jumped" dentry.
1047 This is called when a path-walk ends at dentry that was not acquired by
1048 doing a lookup in the parent directory. This includes "/", "." and "..",
1049 as well as procfs-style symlinks and mountpoint traversal.
1050
1051 In this case, we are less concerned with whether the dentry is still
1052 fully correct, but rather that the inode is still valid. As with
1053 d_revalidate, most local filesystems will set this to NULL since their
1054 dcache entries are always valid.
1055
1056 This function has the same return code semantics as d_revalidate.
1057
1058 d_weak_revalidate is only called after leaving rcu-walk mode.
1059
1060 d_hash: called when the VFS adds a dentry to the hash table. The first
1061 dentry passed to d_hash is the parent directory that the name is
1062 to be hashed into.
1063
1064 Same locking and synchronisation rules as d_compare regarding
1065 what is safe to dereference etc.
1066
1067 d_compare: called to compare a dentry name with a given name. The first
1068 dentry is the parent of the dentry to be compared, the second is
1069 the child dentry. len and name string are properties of the dentry
1070 to be compared. qstr is the name to compare it with.
1071
1072 Must be constant and idempotent, and should not take locks if
1073 possible, and should not or store into the dentry.
1074 Should not dereference pointers outside the dentry without
1075 lots of care (eg. d_parent, d_inode, d_name should not be used).
1076
1077 However, our vfsmount is pinned, and RCU held, so the dentries and
1078 inodes won't disappear, neither will our sb or filesystem module.
1079 ->d_sb may be used.
1080
1081 It is a tricky calling convention because it needs to be called under
1082 "rcu-walk", ie. without any locks or references on things.
1083
1084 d_delete: called when the last reference to a dentry is dropped and the
1085 dcache is deciding whether or not to cache it. Return 1 to delete
1086 immediately, or 0 to cache the dentry. Default is NULL which means to
1087 always cache a reachable dentry. d_delete must be constant and
1088 idempotent.
1089
1090 d_init: called when a dentry is allocated
1091
1092 d_release: called when a dentry is really deallocated
1093
1094 d_iput: called when a dentry loses its inode (just prior to its
1095 being deallocated). The default when this is NULL is that the
1096 VFS calls iput(). If you define this method, you must call
1097 iput() yourself
1098
1099 d_dname: called when the pathname of a dentry should be generated.
1100 Useful for some pseudo filesystems (sockfs, pipefs, ...) to delay
1101 pathname generation. (Instead of doing it when dentry is created,
1102 it's done only when the path is needed.). Real filesystems probably
1103 dont want to use it, because their dentries are present in global
1104 dcache hash, so their hash should be an invariant. As no lock is
1105 held, d_dname() should not try to modify the dentry itself, unless
1106 appropriate SMP safety is used. CAUTION : d_path() logic is quite
1107 tricky. The correct way to return for example "Hello" is to put it
1108 at the end of the buffer, and returns a pointer to the first char.
1109 dynamic_dname() helper function is provided to take care of this.
1110
1111 Example :
1112
1113 static char *pipefs_dname(struct dentry *dent, char *buffer, int buflen)
1114 {
1115 return dynamic_dname(dentry, buffer, buflen, "pipe:[%lu]",
1116 dentry->d_inode->i_ino);
1117 }
1118
1119 d_automount: called when an automount dentry is to be traversed (optional).
1120 This should create a new VFS mount record and return the record to the
1121 caller. The caller is supplied with a path parameter giving the
1122 automount directory to describe the automount target and the parent
1123 VFS mount record to provide inheritable mount parameters. NULL should
1124 be returned if someone else managed to make the automount first. If
1125 the vfsmount creation failed, then an error code should be returned.
1126 If -EISDIR is returned, then the directory will be treated as an
1127 ordinary directory and returned to pathwalk to continue walking.
1128
1129 If a vfsmount is returned, the caller will attempt to mount it on the
1130 mountpoint and will remove the vfsmount from its expiration list in
1131 the case of failure. The vfsmount should be returned with 2 refs on
1132 it to prevent automatic expiration - the caller will clean up the
1133 additional ref.
1134
1135 This function is only used if DCACHE_NEED_AUTOMOUNT is set on the
1136 dentry. This is set by __d_instantiate() if S_AUTOMOUNT is set on the
1137 inode being added.
1138
1139 d_manage: called to allow the filesystem to manage the transition from a
1140 dentry (optional). This allows autofs, for example, to hold up clients
1141 waiting to explore behind a 'mountpoint' while letting the daemon go
1142 past and construct the subtree there. 0 should be returned to let the
1143 calling process continue. -EISDIR can be returned to tell pathwalk to
1144 use this directory as an ordinary directory and to ignore anything
1145 mounted on it and not to check the automount flag. Any other error
1146 code will abort pathwalk completely.
1147
1148 If the 'rcu_walk' parameter is true, then the caller is doing a
1149 pathwalk in RCU-walk mode. Sleeping is not permitted in this mode,
1150 and the caller can be asked to leave it and call again by returning
1151 -ECHILD. -EISDIR may also be returned to tell pathwalk to
1152 ignore d_automount or any mounts.
1153
1154 This function is only used if DCACHE_MANAGE_TRANSIT is set on the
1155 dentry being transited from.
1156
1157 d_real: overlay/union type filesystems implement this method to return one of
1158 the underlying dentries hidden by the overlay. It is used in two
1159 different modes:
1160
1161 Called from file_dentry() it returns the real dentry matching the inode
1162 argument. The real dentry may be from a lower layer already copied up,
1163 but still referenced from the file. This mode is selected with a
1164 non-NULL inode argument.
1165
1166 With NULL inode the topmost real underlying dentry is returned.
1167
1168Each dentry has a pointer to its parent dentry, as well as a hash list
1169of child dentries. Child dentries are basically like files in a
1170directory.
1171
1172
1173Directory Entry Cache API
1174--------------------------
1175
1176There are a number of functions defined which permit a filesystem to
1177manipulate dentries:
1178
1179 dget: open a new handle for an existing dentry (this just increments
1180 the usage count)
1181
1182 dput: close a handle for a dentry (decrements the usage count). If
1183 the usage count drops to 0, and the dentry is still in its
1184 parent's hash, the "d_delete" method is called to check whether
1185 it should be cached. If it should not be cached, or if the dentry
1186 is not hashed, it is deleted. Otherwise cached dentries are put
1187 into an LRU list to be reclaimed on memory shortage.
1188
1189 d_drop: this unhashes a dentry from its parents hash list. A
1190 subsequent call to dput() will deallocate the dentry if its
1191 usage count drops to 0
1192
1193 d_delete: delete a dentry. If there are no other open references to
1194 the dentry then the dentry is turned into a negative dentry
1195 (the d_iput() method is called). If there are other
1196 references, then d_drop() is called instead
1197
1198 d_add: add a dentry to its parents hash list and then calls
1199 d_instantiate()
1200
1201 d_instantiate: add a dentry to the alias hash list for the inode and
1202 updates the "d_inode" member. The "i_count" member in the
1203 inode structure should be set/incremented. If the inode
1204 pointer is NULL, the dentry is called a "negative
1205 dentry". This function is commonly called when an inode is
1206 created for an existing negative dentry
1207
1208 d_lookup: look up a dentry given its parent and path name component
1209 It looks up the child of that given name from the dcache
1210 hash table. If it is found, the reference count is incremented
1211 and the dentry is returned. The caller must use dput()
1212 to free the dentry when it finishes using it.
1213
1214Mount Options
1215=============
1216
1217Parsing options
1218---------------
1219
1220On mount and remount the filesystem is passed a string containing a
1221comma separated list of mount options. The options can have either of
1222these forms:
1223
1224 option
1225 option=value
1226
1227The <linux/parser.h> header defines an API that helps parse these
1228options. There are plenty of examples on how to use it in existing
1229filesystems.
1230
1231Showing options
1232---------------
1233
1234If a filesystem accepts mount options, it must define show_options()
1235to show all the currently active options. The rules are:
1236
1237 - options MUST be shown which are not default or their values differ
1238 from the default
1239
1240 - options MAY be shown which are enabled by default or have their
1241 default value
1242
1243Options used only internally between a mount helper and the kernel
1244(such as file descriptors), or which only have an effect during the
1245mounting (such as ones controlling the creation of a journal) are exempt
1246from the above rules.
1247
1248The underlying reason for the above rules is to make sure, that a
1249mount can be accurately replicated (e.g. umounting and mounting again)
1250based on the information found in /proc/mounts.
1251
1252Resources
1253=========
1254
1255(Note some of these resources are not up-to-date with the latest kernel
1256 version.)
1257
1258Creating Linux virtual filesystems. 2002
1259 <http://lwn.net/Articles/13325/>
1260
1261The Linux Virtual File-system Layer by Neil Brown. 1999
1262 <http://www.cse.unsw.edu.au/~neilb/oss/linux-commentary/vfs.html>
1263
1264A tour of the Linux VFS by Michael K. Johnson. 1996
1265 <http://www.tldp.org/LDP/khg/HyperNews/get/fs/vfstour.html>
1266
1267A small trail through the Linux kernel by Andries Brouwer. 2001
1268 <http://www.win.tue.nl/~aeb/linux/vfs/trail.html>
diff --git a/Documentation/filesystems/xfs-delayed-logging-design.txt b/Documentation/filesystems/xfs-delayed-logging-design.txt
index 2ce36439c09f..9a6dd289b17b 100644
--- a/Documentation/filesystems/xfs-delayed-logging-design.txt
+++ b/Documentation/filesystems/xfs-delayed-logging-design.txt
@@ -34,7 +34,7 @@ transaction:
34 D A+B+C+D X+n+m+o 34 D A+B+C+D X+n+m+o
35 <object written to disk> 35 <object written to disk>
36 E E Y (> X+n+m+o) 36 E E Y (> X+n+m+o)
37 F E+F YÙ+p 37 F E+F Y+p
38 38
39In other words, each time an object is relogged, the new transaction contains 39In other words, each time an object is relogged, the new transaction contains
40the aggregation of all the previous changes currently held only in the log. 40the aggregation of all the previous changes currently held only in the log.
diff --git a/Documentation/firmware-guide/acpi/enumeration.rst b/Documentation/firmware-guide/acpi/enumeration.rst
index 850be9696931..1252617b520f 100644
--- a/Documentation/firmware-guide/acpi/enumeration.rst
+++ b/Documentation/firmware-guide/acpi/enumeration.rst
@@ -339,7 +339,7 @@ a code like this::
339There are also devm_* versions of these functions which release the 339There are also devm_* versions of these functions which release the
340descriptors once the device is released. 340descriptors once the device is released.
341 341
342See Documentation/acpi/gpio-properties.txt for more information about the 342See Documentation/firmware-guide/acpi/gpio-properties.rst for more information about the
343_DSD binding related to GPIOs. 343_DSD binding related to GPIOs.
344 344
345MFD devices 345MFD devices
diff --git a/Documentation/firmware-guide/acpi/method-tracing.rst b/Documentation/firmware-guide/acpi/method-tracing.rst
index d0b077b73f5f..0aa7e2c5d32a 100644
--- a/Documentation/firmware-guide/acpi/method-tracing.rst
+++ b/Documentation/firmware-guide/acpi/method-tracing.rst
@@ -68,7 +68,7 @@ c. Filter out the debug layer/level matched logs when the specified
68 68
69Where: 69Where:
70 0xXXXXXXXX/0xYYYYYYYY 70 0xXXXXXXXX/0xYYYYYYYY
71 Refer to Documentation/acpi/debug.txt for possible debug layer/level 71 Refer to Documentation/firmware-guide/acpi/debug.rst for possible debug layer/level
72 masking values. 72 masking values.
73 \PPPP.AAAA.TTTT.HHHH 73 \PPPP.AAAA.TTTT.HHHH
74 Full path of a control method that can be found in the ACPI namespace. 74 Full path of a control method that can be found in the ACPI namespace.
diff --git a/Documentation/fpga/dfl.txt b/Documentation/fpga/dfl.rst
index 6df4621c3f2a..2f125abd777f 100644
--- a/Documentation/fpga/dfl.txt
+++ b/Documentation/fpga/dfl.rst
@@ -1,9 +1,12 @@
1=============================================================================== 1=================================================
2 FPGA Device Feature List (DFL) Framework Overview 2FPGA Device Feature List (DFL) Framework Overview
3------------------------------------------------------------------------------- 3=================================================
4 Enno Luebbers <enno.luebbers@intel.com> 4
5 Xiao Guangrong <guangrong.xiao@linux.intel.com> 5Authors:
6 Wu Hao <hao.wu@intel.com> 6
7- Enno Luebbers <enno.luebbers@intel.com>
8- Xiao Guangrong <guangrong.xiao@linux.intel.com>
9- Wu Hao <hao.wu@intel.com>
7 10
8The Device Feature List (DFL) FPGA framework (and drivers according to this 11The Device Feature List (DFL) FPGA framework (and drivers according to this
9this framework) hides the very details of low layer hardwares and provides 12this framework) hides the very details of low layer hardwares and provides
@@ -19,7 +22,7 @@ Device Feature List (DFL) defines a linked list of feature headers within the
19device MMIO space to provide an extensible way of adding features. Software can 22device MMIO space to provide an extensible way of adding features. Software can
20walk through these predefined data structures to enumerate FPGA features: 23walk through these predefined data structures to enumerate FPGA features:
21FPGA Interface Unit (FIU), Accelerated Function Unit (AFU) and Private Features, 24FPGA Interface Unit (FIU), Accelerated Function Unit (AFU) and Private Features,
22as illustrated below: 25as illustrated below::
23 26
24 Header Header Header Header 27 Header Header Header Header
25 +----------+ +-->+----------+ +-->+----------+ +-->+----------+ 28 +----------+ +-->+----------+ +-->+----------+ +-->+----------+
@@ -81,9 +84,9 @@ and release it using close().
81 84
82The following functions are exposed through ioctls: 85The following functions are exposed through ioctls:
83 86
84 Get driver API version (DFL_FPGA_GET_API_VERSION) 87- Get driver API version (DFL_FPGA_GET_API_VERSION)
85 Check for extensions (DFL_FPGA_CHECK_EXTENSION) 88- Check for extensions (DFL_FPGA_CHECK_EXTENSION)
86 Program bitstream (DFL_FPGA_FME_PORT_PR) 89- Program bitstream (DFL_FPGA_FME_PORT_PR)
87 90
88More functions are exposed through sysfs 91More functions are exposed through sysfs
89(/sys/class/fpga_region/regionX/dfl-fme.n/): 92(/sys/class/fpga_region/regionX/dfl-fme.n/):
@@ -118,18 +121,19 @@ port by using open() on the port device node and release it using close().
118 121
119The following functions are exposed through ioctls: 122The following functions are exposed through ioctls:
120 123
121 Get driver API version (DFL_FPGA_GET_API_VERSION) 124- Get driver API version (DFL_FPGA_GET_API_VERSION)
122 Check for extensions (DFL_FPGA_CHECK_EXTENSION) 125- Check for extensions (DFL_FPGA_CHECK_EXTENSION)
123 Get port info (DFL_FPGA_PORT_GET_INFO) 126- Get port info (DFL_FPGA_PORT_GET_INFO)
124 Get MMIO region info (DFL_FPGA_PORT_GET_REGION_INFO) 127- Get MMIO region info (DFL_FPGA_PORT_GET_REGION_INFO)
125 Map DMA buffer (DFL_FPGA_PORT_DMA_MAP) 128- Map DMA buffer (DFL_FPGA_PORT_DMA_MAP)
126 Unmap DMA buffer (DFL_FPGA_PORT_DMA_UNMAP) 129- Unmap DMA buffer (DFL_FPGA_PORT_DMA_UNMAP)
127 Reset AFU (*DFL_FPGA_PORT_RESET) 130- Reset AFU (DFL_FPGA_PORT_RESET)
128 131
129*DFL_FPGA_PORT_RESET: reset the FPGA Port and its AFU. Userspace can do Port 132DFL_FPGA_PORT_RESET:
130reset at any time, e.g. during DMA or Partial Reconfiguration. But it should 133 reset the FPGA Port and its AFU. Userspace can do Port
131never cause any system level issue, only functional failure (e.g. DMA or PR 134 reset at any time, e.g. during DMA or Partial Reconfiguration. But it should
132operation failure) and be recoverable from the failure. 135 never cause any system level issue, only functional failure (e.g. DMA or PR
136 operation failure) and be recoverable from the failure.
133 137
134User-space applications can also mmap() accelerator MMIO regions. 138User-space applications can also mmap() accelerator MMIO regions.
135 139
@@ -143,6 +147,8 @@ More functions are exposed through sysfs:
143DFL Framework Overview 147DFL Framework Overview
144====================== 148======================
145 149
150::
151
146 +----------+ +--------+ +--------+ +--------+ 152 +----------+ +--------+ +--------+ +--------+
147 | FME | | AFU | | AFU | | AFU | 153 | FME | | AFU | | AFU | | AFU |
148 | Module | | Module | | Module | | Module | 154 | Module | | Module | | Module | | Module |
@@ -151,7 +157,7 @@ DFL Framework Overview
151 | FPGA Container Device | Device Feature List 157 | FPGA Container Device | Device Feature List
152 | (FPGA Base Region) | Framework 158 | (FPGA Base Region) | Framework
153 +-----------------------+ 159 +-----------------------+
154-------------------------------------------------------------------- 160 ------------------------------------------------------------------
155 +----------------------------+ 161 +----------------------------+
156 | FPGA DFL Device Module | 162 | FPGA DFL Device Module |
157 | (e.g. PCIE/Platform Device)| 163 | (e.g. PCIE/Platform Device)|
@@ -220,7 +226,7 @@ the sysfs hierarchy under /sys/class/fpga_region.
220In the example below, two DFL based FPGA devices are installed in the host. Each 226In the example below, two DFL based FPGA devices are installed in the host. Each
221fpga device has one FME and two ports (AFUs). 227fpga device has one FME and two ports (AFUs).
222 228
223FPGA regions are created under /sys/class/fpga_region/ 229FPGA regions are created under /sys/class/fpga_region/::
224 230
225 /sys/class/fpga_region/region0 231 /sys/class/fpga_region/region0
226 /sys/class/fpga_region/region1 232 /sys/class/fpga_region/region1
@@ -231,7 +237,7 @@ Application needs to search each regionX folder, if feature device is found,
231(e.g. "dfl-port.n" or "dfl-fme.m" is found), then it's the base 237(e.g. "dfl-port.n" or "dfl-fme.m" is found), then it's the base
232fpga region which represents the FPGA device. 238fpga region which represents the FPGA device.
233 239
234Each base region has one FME and two ports (AFUs) as child devices: 240Each base region has one FME and two ports (AFUs) as child devices::
235 241
236 /sys/class/fpga_region/region0/dfl-fme.0 242 /sys/class/fpga_region/region0/dfl-fme.0
237 /sys/class/fpga_region/region0/dfl-port.0 243 /sys/class/fpga_region/region0/dfl-port.0
@@ -243,7 +249,7 @@ Each base region has one FME and two ports (AFUs) as child devices:
243 /sys/class/fpga_region/region3/dfl-port.3 249 /sys/class/fpga_region/region3/dfl-port.3
244 ... 250 ...
245 251
246In general, the FME/AFU sysfs interfaces are named as follows: 252In general, the FME/AFU sysfs interfaces are named as follows::
247 253
248 /sys/class/fpga_region/<regionX>/<dfl-fme.n>/ 254 /sys/class/fpga_region/<regionX>/<dfl-fme.n>/
249 /sys/class/fpga_region/<regionX>/<dfl-port.m>/ 255 /sys/class/fpga_region/<regionX>/<dfl-port.m>/
@@ -251,7 +257,7 @@ In general, the FME/AFU sysfs interfaces are named as follows:
251with 'n' consecutively numbering all FMEs and 'm' consecutively numbering all 257with 'n' consecutively numbering all FMEs and 'm' consecutively numbering all
252ports. 258ports.
253 259
254The device nodes used for ioctl() or mmap() can be referenced through: 260The device nodes used for ioctl() or mmap() can be referenced through::
255 261
256 /sys/class/fpga_region/<regionX>/<dfl-fme.n>/dev 262 /sys/class/fpga_region/<regionX>/<dfl-fme.n>/dev
257 /sys/class/fpga_region/<regionX>/<dfl-port.n>/dev 263 /sys/class/fpga_region/<regionX>/<dfl-port.n>/dev
diff --git a/Documentation/fpga/index.rst b/Documentation/fpga/index.rst
new file mode 100644
index 000000000000..2c87d1ea084f
--- /dev/null
+++ b/Documentation/fpga/index.rst
@@ -0,0 +1,17 @@
1:orphan:
2
3====
4fpga
5====
6
7.. toctree::
8 :maxdepth: 1
9
10 dfl
11
12.. only:: subproject and html
13
14 Indices
15 =======
16
17 * :ref:`genindex`
diff --git a/Documentation/gpu/msm-crash-dump.rst b/Documentation/gpu/msm-crash-dump.rst
index 757cd257e0d8..240ef200f76c 100644
--- a/Documentation/gpu/msm-crash-dump.rst
+++ b/Documentation/gpu/msm-crash-dump.rst
@@ -1,3 +1,5 @@
1:orphan:
2
1===================== 3=====================
2MSM Crash Dump Format 4MSM Crash Dump Format
3===================== 5=====================
diff --git a/Documentation/hid/hid-transport.txt b/Documentation/hid/hid-transport.txt
index 3dcba9fd4a3a..4f41d67f1b4b 100644
--- a/Documentation/hid/hid-transport.txt
+++ b/Documentation/hid/hid-transport.txt
@@ -194,9 +194,9 @@ with HID core:
194 goto err_<...>; 194 goto err_<...>;
195 } 195 }
196 196
197 strlcpy(hid->name, <device-name-src>, 127); 197 strscpy(hid->name, <device-name-src>, sizeof(hid->name));
198 strlcpy(hid->phys, <device-phys-src>, 63); 198 strscpy(hid->phys, <device-phys-src>, sizeof(hid->phys));
199 strlcpy(hid->uniq, <device-uniq-src>, 63); 199 strscpy(hid->uniq, <device-uniq-src>, sizeof(hid->uniq));
200 200
201 hid->ll_driver = &custom_ll_driver; 201 hid->ll_driver = &custom_ll_driver;
202 hid->bus = <device-bus>; 202 hid->bus = <device-bus>;
diff --git a/Documentation/i2c/instantiating-devices b/Documentation/i2c/instantiating-devices
index 0d85ac1935b7..345e9ea8281a 100644
--- a/Documentation/i2c/instantiating-devices
+++ b/Documentation/i2c/instantiating-devices
@@ -85,7 +85,7 @@ Method 1c: Declare the I2C devices via ACPI
85------------------------------------------- 85-------------------------------------------
86 86
87ACPI can also describe I2C devices. There is special documentation for this 87ACPI can also describe I2C devices. There is special documentation for this
88which is currently located at Documentation/acpi/enumeration.txt. 88which is currently located at Documentation/firmware-guide/acpi/enumeration.rst.
89 89
90 90
91Method 2: Instantiate the devices explicitly 91Method 2: Instantiate the devices explicitly
@@ -137,7 +137,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
137 (...) 137 (...)
138 i2c_adap = i2c_get_adapter(2); 138 i2c_adap = i2c_get_adapter(2);
139 memset(&i2c_info, 0, sizeof(struct i2c_board_info)); 139 memset(&i2c_info, 0, sizeof(struct i2c_board_info));
140 strlcpy(i2c_info.type, "isp1301_nxp", I2C_NAME_SIZE); 140 strscpy(i2c_info.type, "isp1301_nxp", sizeof(i2c_info.type));
141 isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info, 141 isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,
142 normal_i2c, NULL); 142 normal_i2c, NULL);
143 i2c_put_adapter(i2c_adap); 143 i2c_put_adapter(i2c_adap);
diff --git a/Documentation/i2c/upgrading-clients b/Documentation/i2c/upgrading-clients
index ccba3ffd6e80..96392cc5b5c7 100644
--- a/Documentation/i2c/upgrading-clients
+++ b/Documentation/i2c/upgrading-clients
@@ -43,7 +43,7 @@ static int example_attach(struct i2c_adapter *adap, int addr, int kind)
43 example->client.adapter = adap; 43 example->client.adapter = adap;
44 44
45 i2c_set_clientdata(&state->i2c_client, state); 45 i2c_set_clientdata(&state->i2c_client, state);
46 strlcpy(client->i2c_client.name, "example", I2C_NAME_SIZE); 46 strscpy(client->i2c_client.name, "example", sizeof(client->i2c_client.name));
47 47
48 ret = i2c_attach_client(&state->i2c_client); 48 ret = i2c_attach_client(&state->i2c_client);
49 if (ret < 0) { 49 if (ret < 0) {
@@ -138,7 +138,7 @@ can be removed:
138- example->client.flags = 0; 138- example->client.flags = 0;
139- example->client.adapter = adap; 139- example->client.adapter = adap;
140- 140-
141- strlcpy(client->i2c_client.name, "example", I2C_NAME_SIZE); 141- strscpy(client->i2c_client.name, "example", sizeof(client->i2c_client.name));
142 142
143The i2c_set_clientdata is now: 143The i2c_set_clientdata is now:
144 144
diff --git a/Documentation/ide/changelogs.rst b/Documentation/ide/changelogs.rst
new file mode 100644
index 000000000000..fdf9d0fb8027
--- /dev/null
+++ b/Documentation/ide/changelogs.rst
@@ -0,0 +1,17 @@
1Changelog for ide cd
2--------------------
3
4 .. include:: ChangeLog.ide-cd.1994-2004
5 :literal:
6
7Changelog for ide floppy
8------------------------
9
10 .. include:: ChangeLog.ide-floppy.1996-2002
11 :literal:
12
13Changelog for ide tape
14----------------------
15
16 .. include:: ChangeLog.ide-tape.1995-2002
17 :literal:
diff --git a/Documentation/ide/ide-tape.txt b/Documentation/ide/ide-tape.rst
index 3f348a0b21d8..3e061d9c0e38 100644
--- a/Documentation/ide/ide-tape.txt
+++ b/Documentation/ide/ide-tape.rst
@@ -1,4 +1,6 @@
1IDE ATAPI streaming tape driver. 1===============================
2IDE ATAPI streaming tape driver
3===============================
2 4
3This driver is a part of the Linux ide driver. 5This driver is a part of the Linux ide driver.
4 6
@@ -10,14 +12,14 @@ to the request-list of the block device, and waits for their completion.
10The block device major and minor numbers are determined from the 12The block device major and minor numbers are determined from the
11tape's relative position in the ide interfaces, as explained in ide.c. 13tape's relative position in the ide interfaces, as explained in ide.c.
12 14
13The character device interface consists of the following devices: 15The character device interface consists of the following devices::
14 16
15ht0 major 37, minor 0 first IDE tape, rewind on close. 17 ht0 major 37, minor 0 first IDE tape, rewind on close.
16ht1 major 37, minor 1 second IDE tape, rewind on close. 18 ht1 major 37, minor 1 second IDE tape, rewind on close.
17... 19 ...
18nht0 major 37, minor 128 first IDE tape, no rewind on close. 20 nht0 major 37, minor 128 first IDE tape, no rewind on close.
19nht1 major 37, minor 129 second IDE tape, no rewind on close. 21 nht1 major 37, minor 129 second IDE tape, no rewind on close.
20... 22 ...
21 23
22The general magnetic tape commands compatible interface, as defined by 24The general magnetic tape commands compatible interface, as defined by
23include/linux/mtio.h, is accessible through the character device. 25include/linux/mtio.h, is accessible through the character device.
@@ -40,9 +42,10 @@ Testing was done with a 2 GB CONNER CTMA 4000 IDE ATAPI Streaming Tape Drive.
40Here are some words from the first releases of hd.c, which are quoted 42Here are some words from the first releases of hd.c, which are quoted
41in ide.c and apply here as well: 43in ide.c and apply here as well:
42 44
43| Special care is recommended. Have Fun! 45* Special care is recommended. Have Fun!
44 46
45Possible improvements: 47Possible improvements
48=====================
46 49
471. Support for the ATAPI overlap protocol. 501. Support for the ATAPI overlap protocol.
48 51
diff --git a/Documentation/ide/ide.txt b/Documentation/ide/ide.rst
index 7aca987c23d9..88bdcba92f7d 100644
--- a/Documentation/ide/ide.txt
+++ b/Documentation/ide/ide.rst
@@ -1,41 +1,43 @@
1 1============================================
2 Information regarding the Enhanced IDE drive in Linux 2.6 2Information regarding the Enhanced IDE drive
3 3============================================
4==============================================================================
5
6 4
7 The hdparm utility can be used to control various IDE features on a 5 The hdparm utility can be used to control various IDE features on a
8 running system. It is packaged separately. Please Look for it on popular 6 running system. It is packaged separately. Please Look for it on popular
9 linux FTP sites. 7 linux FTP sites.
10 8
9-------------------------------------------------------------------------------
10
11.. important::
12
13 BUGGY IDE CHIPSETS CAN CORRUPT DATA!!
14
15 PCI versions of the CMD640 and RZ1000 interfaces are now detected
16 automatically at startup when PCI BIOS support is configured.
17
18 Linux disables the "prefetch" ("readahead") mode of the RZ1000
19 to prevent data corruption possible due to hardware design flaws.
20
21 For the CMD640, linux disables "IRQ unmasking" (hdparm -u1) on any
22 drive for which the "prefetch" mode of the CMD640 is turned on.
23 If "prefetch" is disabled (hdparm -p8), then "IRQ unmasking" can be
24 used again.
25
26 For the CMD640, linux disables "32bit I/O" (hdparm -c1) on any drive
27 for which the "prefetch" mode of the CMD640 is turned off.
28 If "prefetch" is enabled (hdparm -p9), then "32bit I/O" can be
29 used again.
30
31 The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT*
32 automatically detected by Linux. For safe, reliable operation with such
33 interfaces, one *MUST* use the "cmd640.probe_vlb" kernel option.
34
35 Use of the "serialize" option is no longer necessary.
11 36
37-------------------------------------------------------------------------------
12 38
13*** IMPORTANT NOTICES: BUGGY IDE CHIPSETS CAN CORRUPT DATA!! 39Common pitfalls
14*** ================= 40===============
15*** PCI versions of the CMD640 and RZ1000 interfaces are now detected
16*** automatically at startup when PCI BIOS support is configured.
17***
18*** Linux disables the "prefetch" ("readahead") mode of the RZ1000
19*** to prevent data corruption possible due to hardware design flaws.
20***
21*** For the CMD640, linux disables "IRQ unmasking" (hdparm -u1) on any
22*** drive for which the "prefetch" mode of the CMD640 is turned on.
23*** If "prefetch" is disabled (hdparm -p8), then "IRQ unmasking" can be
24*** used again.
25***
26*** For the CMD640, linux disables "32bit I/O" (hdparm -c1) on any drive
27*** for which the "prefetch" mode of the CMD640 is turned off.
28*** If "prefetch" is enabled (hdparm -p9), then "32bit I/O" can be
29*** used again.
30***
31*** The CMD640 is also used on some Vesa Local Bus (VLB) cards, and is *NOT*
32*** automatically detected by Linux. For safe, reliable operation with such
33*** interfaces, one *MUST* use the "cmd640.probe_vlb" kernel option.
34***
35*** Use of the "serialize" option is no longer necessary.
36
37================================================================================
38Common pitfalls:
39 41
40- 40-conductor IDE cables are capable of transferring data in DMA modes up to 42- 40-conductor IDE cables are capable of transferring data in DMA modes up to
41 udma2, but no faster. 43 udma2, but no faster.
@@ -49,19 +51,18 @@ Common pitfalls:
49- Even better try to stick to the same vendor and device type on the same 51- Even better try to stick to the same vendor and device type on the same
50 cable. 52 cable.
51 53
52================================================================================ 54This is the multiple IDE interface driver, as evolved from hd.c
53 55===============================================================
54This is the multiple IDE interface driver, as evolved from hd.c.
55 56
56It supports up to 9 IDE interfaces per default, on one or more IRQs (usually 57It supports up to 9 IDE interfaces per default, on one or more IRQs (usually
5714 & 15). There can be up to two drives per interface, as per the ATA-6 spec. 5814 & 15). There can be up to two drives per interface, as per the ATA-6 spec.::
58 59
59Primary: ide0, port 0x1f0; major=3; hda is minor=0; hdb is minor=64 60 Primary: ide0, port 0x1f0; major=3; hda is minor=0; hdb is minor=64
60Secondary: ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64 61 Secondary: ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64
61Tertiary: ide2, port 0x1e8; major=33; hde is minor=0; hdf is minor=64 62 Tertiary: ide2, port 0x1e8; major=33; hde is minor=0; hdf is minor=64
62Quaternary: ide3, port 0x168; major=34; hdg is minor=0; hdh is minor=64 63 Quaternary: ide3, port 0x168; major=34; hdg is minor=0; hdh is minor=64
63fifth.. ide4, usually PCI, probed 64 fifth.. ide4, usually PCI, probed
64sixth.. ide5, usually PCI, probed 65 sixth.. ide5, usually PCI, probed
65 66
66To access devices on interfaces > ide0, device entries please make sure that 67To access devices on interfaces > ide0, device entries please make sure that
67device files for them are present in /dev. If not, please create such 68device files for them are present in /dev. If not, please create such
@@ -80,12 +81,15 @@ seldom occurs. Be careful, and if in doubt, don't do it!
80 81
81Drives are normally found by auto-probing and/or examining the CMOS/BIOS data. 82Drives are normally found by auto-probing and/or examining the CMOS/BIOS data.
82For really weird situations, the apparent (fdisk) geometry can also be specified 83For really weird situations, the apparent (fdisk) geometry can also be specified
83on the kernel "command line" using LILO. The format of such lines is: 84on the kernel "command line" using LILO. The format of such lines is::
84 85
85 ide_core.chs=[interface_number.device_number]:cyls,heads,sects 86 ide_core.chs=[interface_number.device_number]:cyls,heads,sects
86or ide_core.cdrom=[interface_number.device_number]
87 87
88For example: 88or::
89
90 ide_core.cdrom=[interface_number.device_number]
91
92For example::
89 93
90 ide_core.chs=1.0:1050,32,64 ide_core.cdrom=1.1 94 ide_core.chs=1.0:1050,32,64 ide_core.cdrom=1.1
91 95
@@ -96,10 +100,12 @@ geometry for partitioning purposes (fdisk).
96If the auto-probing during boot time confuses a drive (ie. the drive works 100If the auto-probing during boot time confuses a drive (ie. the drive works
97with hd.c but not with ide.c), then an command line option may be specified 101with hd.c but not with ide.c), then an command line option may be specified
98for each drive for which you'd like the drive to skip the hardware 102for each drive for which you'd like the drive to skip the hardware
99probe/identification sequence. For example: 103probe/identification sequence. For example::
100 104
101 ide_core.noprobe=0.1 105 ide_core.noprobe=0.1
102or 106
107or::
108
103 ide_core.chs=1.0:768,16,32 109 ide_core.chs=1.0:768,16,32
104 ide_core.noprobe=1.0 110 ide_core.noprobe=1.0
105 111
@@ -115,22 +121,24 @@ Such drives will be identified at boot time, just like a hard disk.
115 121
116If for some reason your cdrom drive is *not* found at boot time, you can force 122If for some reason your cdrom drive is *not* found at boot time, you can force
117the probe to look harder by supplying a kernel command line parameter 123the probe to look harder by supplying a kernel command line parameter
118via LILO, such as: 124via LILO, such as:::
119 125
120 ide_core.cdrom=1.0 /* "master" on second interface (hdc) */ 126 ide_core.cdrom=1.0 /* "master" on second interface (hdc) */
121or 127
128or::
129
122 ide_core.cdrom=1.1 /* "slave" on second interface (hdd) */ 130 ide_core.cdrom=1.1 /* "slave" on second interface (hdd) */
123 131
124For example, a GW2000 system might have a hard drive on the primary 132For example, a GW2000 system might have a hard drive on the primary
125interface (/dev/hda) and an IDE cdrom drive on the secondary interface 133interface (/dev/hda) and an IDE cdrom drive on the secondary interface
126(/dev/hdc). To mount a CD in the cdrom drive, one would use something like: 134(/dev/hdc). To mount a CD in the cdrom drive, one would use something like::
127 135
128 ln -sf /dev/hdc /dev/cdrom 136 ln -sf /dev/hdc /dev/cdrom
129 mkdir /mnt/cdrom 137 mkdir /mnt/cdrom
130 mount /dev/cdrom /mnt/cdrom -t iso9660 -o ro 138 mount /dev/cdrom /mnt/cdrom -t iso9660 -o ro
131 139
132If, after doing all of the above, mount doesn't work and you see 140If, after doing all of the above, mount doesn't work and you see
133errors from the driver (with dmesg) complaining about `status=0xff', 141errors from the driver (with dmesg) complaining about `status=0xff`,
134this means that the hardware is not responding to the driver's attempts 142this means that the hardware is not responding to the driver's attempts
135to read it. One of the following is probably the problem: 143to read it. One of the following is probably the problem:
136 144
@@ -165,7 +173,7 @@ drivers can always be compiled as loadable modules, the chipset drivers
165can only be compiled into the kernel, and the core code (ide.c) can be 173can only be compiled into the kernel, and the core code (ide.c) can be
166compiled as a loadable module provided no chipset support is needed. 174compiled as a loadable module provided no chipset support is needed.
167 175
168When using ide.c as a module in combination with kmod, add: 176When using ide.c as a module in combination with kmod, add::
169 177
170 alias block-major-3 ide-probe 178 alias block-major-3 ide-probe
171 179
@@ -176,10 +184,8 @@ driver using the "options=" keyword to insmod, while replacing any ',' with
176';'. 184';'.
177 185
178 186
179================================================================================
180
181Summary of ide driver parameters for kernel command line 187Summary of ide driver parameters for kernel command line
182-------------------------------------------------------- 188========================================================
183 189
184For legacy IDE VLB host drivers (ali14xx/dtc2278/ht6560b/qd65xx/umc8672) 190For legacy IDE VLB host drivers (ali14xx/dtc2278/ht6560b/qd65xx/umc8672)
185you need to explicitly enable probing by using "probe" kernel parameter, 191you need to explicitly enable probing by using "probe" kernel parameter,
@@ -226,28 +232,31 @@ Other kernel parameters for ide_core are:
226 232
227* "chs=[interface_number.device_number]" to force device as a disk (using CHS) 233* "chs=[interface_number.device_number]" to force device as a disk (using CHS)
228 234
229================================================================================
230 235
231Some Terminology 236Some Terminology
232---------------- 237================
233IDE = Integrated Drive Electronics, meaning that each drive has a built-in
234controller, which is why an "IDE interface card" is not a "controller card".
235 238
236ATA = AT (the old IBM 286 computer) Attachment Interface, a draft American 239IDE
237National Standard for connecting hard drives to PCs. This is the official 240 Integrated Drive Electronics, meaning that each drive has a built-in
238name for "IDE". 241 controller, which is why an "IDE interface card" is not a "controller card".
239 242
240The latest standards define some enhancements, known as the ATA-6 spec, 243ATA
241which grew out of vendor-specific "Enhanced IDE" (EIDE) implementations. 244 AT (the old IBM 286 computer) Attachment Interface, a draft American
245 National Standard for connecting hard drives to PCs. This is the official
246 name for "IDE".
242 247
243ATAPI = ATA Packet Interface, a new protocol for controlling the drives, 248 The latest standards define some enhancements, known as the ATA-6 spec,
244similar to SCSI protocols, created at the same time as the ATA2 standard. 249 which grew out of vendor-specific "Enhanced IDE" (EIDE) implementations.
245ATAPI is currently used for controlling CDROM, TAPE and FLOPPY (ZIP or 250
246LS120/240) devices, removable R/W cartridges, and for high capacity hard disk 251ATAPI
247drives. 252 ATA Packet Interface, a new protocol for controlling the drives,
253 similar to SCSI protocols, created at the same time as the ATA2 standard.
254 ATAPI is currently used for controlling CDROM, TAPE and FLOPPY (ZIP or
255 LS120/240) devices, removable R/W cartridges, and for high capacity hard disk
256 drives.
248 257
249mlord@pobox.com 258mlord@pobox.com
250-- 259
251 260
252Wed Apr 17 22:52:44 CEST 2002 edited by Marcin Dalecki, the current 261Wed Apr 17 22:52:44 CEST 2002 edited by Marcin Dalecki, the current
253maintainer. 262maintainer.
diff --git a/Documentation/ide/index.rst b/Documentation/ide/index.rst
new file mode 100644
index 000000000000..45bc12d3957f
--- /dev/null
+++ b/Documentation/ide/index.rst
@@ -0,0 +1,21 @@
1:orphan:
2
3==================================
4Integrated Drive Electronics (IDE)
5==================================
6
7.. toctree::
8 :maxdepth: 1
9
10 ide
11 ide-tape
12 warm-plug-howto
13
14 changelogs
15
16.. only:: subproject and html
17
18 Indices
19 =======
20
21 * :ref:`genindex`
diff --git a/Documentation/ide/warm-plug-howto.txt b/Documentation/ide/warm-plug-howto.rst
index 98152bcd515a..c245242ef2f1 100644
--- a/Documentation/ide/warm-plug-howto.txt
+++ b/Documentation/ide/warm-plug-howto.rst
@@ -1,14 +1,14 @@
1 1===================
2IDE warm-plug HOWTO 2IDE warm-plug HOWTO
3=================== 3===================
4 4
5To warm-plug devices on a port 'idex': 5To warm-plug devices on a port 'idex'::
6 6
7# echo -n "1" > /sys/class/ide_port/idex/delete_devices 7 # echo -n "1" > /sys/class/ide_port/idex/delete_devices
8 8
9unplug old device(s) and plug new device(s) 9unplug old device(s) and plug new device(s)::
10 10
11# echo -n "1" > /sys/class/ide_port/idex/scan 11 # echo -n "1" > /sys/class/ide_port/idex/scan
12 12
13done 13done
14 14
diff --git a/Documentation/index.rst b/Documentation/index.rst
index a7566ef62411..781042b4579d 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -112,7 +112,6 @@ implementation.
112.. toctree:: 112.. toctree::
113 :maxdepth: 2 113 :maxdepth: 2
114 114
115 x86/index
116 sh/index 115 sh/index
117 x86/index 116 x86/index
118 117
diff --git a/Documentation/interconnect/interconnect.rst b/Documentation/interconnect/interconnect.rst
index b8107dcc4cd3..56e331dab70e 100644
--- a/Documentation/interconnect/interconnect.rst
+++ b/Documentation/interconnect/interconnect.rst
@@ -1,5 +1,7 @@
1.. SPDX-License-Identifier: GPL-2.0 1.. SPDX-License-Identifier: GPL-2.0
2 2
3:orphan:
4
3===================================== 5=====================================
4GENERIC SYSTEM INTERCONNECT SUBSYSTEM 6GENERIC SYSTEM INTERCONNECT SUBSYSTEM
5===================================== 7=====================================
@@ -89,6 +91,5 @@ Interconnect consumers
89 91
90Interconnect consumers are the clients which use the interconnect APIs to 92Interconnect consumers are the clients which use the interconnect APIs to
91get paths between endpoints and set their bandwidth/latency/QoS requirements 93get paths between endpoints and set their bandwidth/latency/QoS requirements
92for these interconnect paths. 94for these interconnect paths. These interfaces are not currently
93 95documented.
94.. kernel-doc:: include/linux/interconnect.h
diff --git a/Documentation/iostats.txt b/Documentation/iostats.txt
index 49df45f90e8a..5d63b18bd6d1 100644
--- a/Documentation/iostats.txt
+++ b/Documentation/iostats.txt
@@ -97,6 +97,10 @@ Field 9 -- # of I/Os currently in progress
97Field 10 -- # of milliseconds spent doing I/Os 97Field 10 -- # of milliseconds spent doing I/Os
98 This field increases so long as field 9 is nonzero. 98 This field increases so long as field 9 is nonzero.
99 99
100 Since 5.0 this field counts jiffies when at least one request was
101 started or completed. If request runs more than 2 jiffies then some
102 I/O time will not be accounted unless there are other requests.
103
100Field 11 -- weighted # of milliseconds spent doing I/Os 104Field 11 -- weighted # of milliseconds spent doing I/Os
101 This field is incremented at each I/O start, I/O completion, I/O 105 This field is incremented at each I/O start, I/O completion, I/O
102 merge, or read of these stats by the number of I/Os in progress 106 merge, or read of these stats by the number of I/Os in progress
diff --git a/Documentation/kbuild/headers_install.txt b/Documentation/kbuild/headers_install.rst
index f0153adb95e2..1ab7294e41ac 100644
--- a/Documentation/kbuild/headers_install.txt
+++ b/Documentation/kbuild/headers_install.rst
@@ -1,3 +1,4 @@
1=============================================
1Exporting kernel headers for use by userspace 2Exporting kernel headers for use by userspace
2============================================= 3=============================================
3 4
@@ -22,14 +23,14 @@ older kernel.
22 23
23The "make headers_install" command can be run in the top level directory of the 24The "make headers_install" command can be run in the top level directory of the
24kernel source code (or using a standard out-of-tree build). It takes two 25kernel source code (or using a standard out-of-tree build). It takes two
25optional arguments: 26optional arguments::
26 27
27 make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr 28 make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
28 29
29ARCH indicates which architecture to produce headers for, and defaults to the 30ARCH indicates which architecture to produce headers for, and defaults to the
30current architecture. The linux/asm directory of the exported kernel headers 31current architecture. The linux/asm directory of the exported kernel headers
31is platform-specific, to see a complete list of supported architectures use 32is platform-specific, to see a complete list of supported architectures use
32the command: 33the command::
33 34
34 ls -d include/asm-* | sed 's/.*-//' 35 ls -d include/asm-* | sed 's/.*-//'
35 36
diff --git a/Documentation/kbuild/index.rst b/Documentation/kbuild/index.rst
new file mode 100644
index 000000000000..42d4cbe4460c
--- /dev/null
+++ b/Documentation/kbuild/index.rst
@@ -0,0 +1,27 @@
1:orphan:
2
3===================
4Kernel Build System
5===================
6
7.. toctree::
8 :maxdepth: 1
9
10 kconfig-language
11 kconfig-macro-language
12
13 kbuild
14 kconfig
15 makefiles
16 modules
17
18 headers_install
19
20 issues
21
22.. only:: subproject and html
23
24 Indices
25 =======
26
27 * :ref:`genindex`
diff --git a/Documentation/kbuild/issues.rst b/Documentation/kbuild/issues.rst
new file mode 100644
index 000000000000..9fdded4b681c
--- /dev/null
+++ b/Documentation/kbuild/issues.rst
@@ -0,0 +1,11 @@
1Recursion issue #1
2------------------
3
4 .. include:: Kconfig.recursion-issue-01
5 :literal:
6
7Recursion issue #2
8------------------
9
10 .. include:: Kconfig.recursion-issue-02
11 :literal:
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.rst
index 9c230ea71963..e774e760522d 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.rst
@@ -1,13 +1,19 @@
1======
2Kbuild
3======
4
5
1Output files 6Output files
7============
2 8
3modules.order 9modules.order
4-------------------------------------------------- 10-------------
5This file records the order in which modules appear in Makefiles. This 11This file records the order in which modules appear in Makefiles. This
6is used by modprobe to deterministically resolve aliases that match 12is used by modprobe to deterministically resolve aliases that match
7multiple modules. 13multiple modules.
8 14
9modules.builtin 15modules.builtin
10-------------------------------------------------- 16---------------
11This file lists all modules that are built into the kernel. This is used 17This file lists all modules that are built into the kernel. This is used
12by modprobe to not fail when trying to load something builtin. 18by modprobe to not fail when trying to load something builtin.
13 19
@@ -18,84 +24,90 @@ Unlike modinfo of a separate module, all fields are prefixed with module name.
18 24
19 25
20Environment variables 26Environment variables
27=====================
21 28
22KCPPFLAGS 29KCPPFLAGS
23-------------------------------------------------- 30---------
24Additional options to pass when preprocessing. The preprocessing options 31Additional options to pass when preprocessing. The preprocessing options
25will be used in all cases where kbuild does preprocessing including 32will be used in all cases where kbuild does preprocessing including
26building C files and assembler files. 33building C files and assembler files.
27 34
28KAFLAGS 35KAFLAGS
29-------------------------------------------------- 36-------
30Additional options to the assembler (for built-in and modules). 37Additional options to the assembler (for built-in and modules).
31 38
32AFLAGS_MODULE 39AFLAGS_MODULE
33-------------------------------------------------- 40-------------
34Additional module specific options to use for $(AS). 41Additional module specific options to use for $(AS).
35 42
36AFLAGS_KERNEL 43AFLAGS_KERNEL
37-------------------------------------------------- 44-------------
38Additional options for $(AS) when used for assembler 45Additional options for $(AS) when used for assembler
39code for code that is compiled as built-in. 46code for code that is compiled as built-in.
40 47
41KCFLAGS 48KCFLAGS
42-------------------------------------------------- 49-------
43Additional options to the C compiler (for built-in and modules). 50Additional options to the C compiler (for built-in and modules).
44 51
45CFLAGS_KERNEL 52CFLAGS_KERNEL
46-------------------------------------------------- 53-------------
47Additional options for $(CC) when used to compile 54Additional options for $(CC) when used to compile
48code that is compiled as built-in. 55code that is compiled as built-in.
49 56
50CFLAGS_MODULE 57CFLAGS_MODULE
51-------------------------------------------------- 58-------------
52Additional module specific options to use for $(CC). 59Additional module specific options to use for $(CC).
53 60
54LDFLAGS_MODULE 61LDFLAGS_MODULE
55-------------------------------------------------- 62--------------
56Additional options used for $(LD) when linking modules. 63Additional options used for $(LD) when linking modules.
57 64
58HOSTCFLAGS 65HOSTCFLAGS
59-------------------------------------------------- 66----------
60Additional flags to be passed to $(HOSTCC) when building host programs. 67Additional flags to be passed to $(HOSTCC) when building host programs.
61 68
62HOSTCXXFLAGS 69HOSTCXXFLAGS
63-------------------------------------------------- 70------------
64Additional flags to be passed to $(HOSTCXX) when building host programs. 71Additional flags to be passed to $(HOSTCXX) when building host programs.
65 72
66HOSTLDFLAGS 73HOSTLDFLAGS
67-------------------------------------------------- 74-----------
68Additional flags to be passed when linking host programs. 75Additional flags to be passed when linking host programs.
69 76
70HOSTLDLIBS 77HOSTLDLIBS
71-------------------------------------------------- 78----------
72Additional libraries to link against when building host programs. 79Additional libraries to link against when building host programs.
73 80
74KBUILD_KCONFIG 81KBUILD_KCONFIG
75-------------------------------------------------- 82--------------
76Set the top-level Kconfig file to the value of this environment 83Set the top-level Kconfig file to the value of this environment
77variable. The default name is "Kconfig". 84variable. The default name is "Kconfig".
78 85
79KBUILD_VERBOSE 86KBUILD_VERBOSE
80-------------------------------------------------- 87--------------
81Set the kbuild verbosity. Can be assigned same values as "V=...". 88Set the kbuild verbosity. Can be assigned same values as "V=...".
89
82See make help for the full list. 90See make help for the full list.
91
83Setting "V=..." takes precedence over KBUILD_VERBOSE. 92Setting "V=..." takes precedence over KBUILD_VERBOSE.
84 93
85KBUILD_EXTMOD 94KBUILD_EXTMOD
86-------------------------------------------------- 95-------------
87Set the directory to look for the kernel source when building external 96Set the directory to look for the kernel source when building external
88modules. 97modules.
98
89Setting "M=..." takes precedence over KBUILD_EXTMOD. 99Setting "M=..." takes precedence over KBUILD_EXTMOD.
90 100
91KBUILD_OUTPUT 101KBUILD_OUTPUT
92-------------------------------------------------- 102-------------
93Specify the output directory when building the kernel. 103Specify the output directory when building the kernel.
104
94The output directory can also be specified using "O=...". 105The output directory can also be specified using "O=...".
106
95Setting "O=..." takes precedence over KBUILD_OUTPUT. 107Setting "O=..." takes precedence over KBUILD_OUTPUT.
96 108
97KBUILD_DEBARCH 109KBUILD_DEBARCH
98-------------------------------------------------- 110--------------
99For the deb-pkg target, allows overriding the normal heuristics deployed by 111For the deb-pkg target, allows overriding the normal heuristics deployed by
100deb-pkg. Normally deb-pkg attempts to guess the right architecture based on 112deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
101the UTS_MACHINE variable, and on some architectures also the kernel config. 113the UTS_MACHINE variable, and on some architectures also the kernel config.
@@ -103,44 +115,48 @@ The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
103architecture. 115architecture.
104 116
105ARCH 117ARCH
106-------------------------------------------------- 118----
107Set ARCH to the architecture to be built. 119Set ARCH to the architecture to be built.
120
108In most cases the name of the architecture is the same as the 121In most cases the name of the architecture is the same as the
109directory name found in the arch/ directory. 122directory name found in the arch/ directory.
123
110But some architectures such as x86 and sparc have aliases. 124But some architectures such as x86 and sparc have aliases.
111x86: i386 for 32 bit, x86_64 for 64 bit 125
112sh: sh for 32 bit, sh64 for 64 bit 126- x86: i386 for 32 bit, x86_64 for 64 bit
113sparc: sparc32 for 32 bit, sparc64 for 64 bit 127- sh: sh for 32 bit, sh64 for 64 bit
128- sparc: sparc32 for 32 bit, sparc64 for 64 bit
114 129
115CROSS_COMPILE 130CROSS_COMPILE
116-------------------------------------------------- 131-------------
117Specify an optional fixed part of the binutils filename. 132Specify an optional fixed part of the binutils filename.
118CROSS_COMPILE can be a part of the filename or the full path. 133CROSS_COMPILE can be a part of the filename or the full path.
119 134
120CROSS_COMPILE is also used for ccache in some setups. 135CROSS_COMPILE is also used for ccache in some setups.
121 136
122CF 137CF
123-------------------------------------------------- 138--
124Additional options for sparse. 139Additional options for sparse.
125CF is often used on the command-line like this: 140
141CF is often used on the command-line like this::
126 142
127 make CF=-Wbitwise C=2 143 make CF=-Wbitwise C=2
128 144
129INSTALL_PATH 145INSTALL_PATH
130-------------------------------------------------- 146------------
131INSTALL_PATH specifies where to place the updated kernel and system map 147INSTALL_PATH specifies where to place the updated kernel and system map
132images. Default is /boot, but you can set it to other values. 148images. Default is /boot, but you can set it to other values.
133 149
134INSTALLKERNEL 150INSTALLKERNEL
135-------------------------------------------------- 151-------------
136Install script called when using "make install". 152Install script called when using "make install".
137The default name is "installkernel". 153The default name is "installkernel".
138 154
139The script will be called with the following arguments: 155The script will be called with the following arguments:
140 $1 - kernel version 156 - $1 - kernel version
141 $2 - kernel image file 157 - $2 - kernel image file
142 $3 - kernel map file 158 - $3 - kernel map file
143 $4 - default install path (use root directory if blank) 159 - $4 - default install path (use root directory if blank)
144 160
145The implementation of "make install" is architecture specific 161The implementation of "make install" is architecture specific
146and it may differ from the above. 162and it may differ from the above.
@@ -149,32 +165,33 @@ INSTALLKERNEL is provided to enable the possibility to
149specify a custom installer when cross compiling a kernel. 165specify a custom installer when cross compiling a kernel.
150 166
151MODLIB 167MODLIB
152-------------------------------------------------- 168------
153Specify where to install modules. 169Specify where to install modules.
154The default value is: 170The default value is::
155 171
156 $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) 172 $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
157 173
158The value can be overridden in which case the default value is ignored. 174The value can be overridden in which case the default value is ignored.
159 175
160INSTALL_MOD_PATH 176INSTALL_MOD_PATH
161-------------------------------------------------- 177----------------
162INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory 178INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
163relocations required by build roots. This is not defined in the 179relocations required by build roots. This is not defined in the
164makefile but the argument can be passed to make if needed. 180makefile but the argument can be passed to make if needed.
165 181
166INSTALL_MOD_STRIP 182INSTALL_MOD_STRIP
167-------------------------------------------------- 183-----------------
168INSTALL_MOD_STRIP, if defined, will cause modules to be 184INSTALL_MOD_STRIP, if defined, will cause modules to be
169stripped after they are installed. If INSTALL_MOD_STRIP is '1', then 185stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
170the default option --strip-debug will be used. Otherwise, 186the default option --strip-debug will be used. Otherwise,
171INSTALL_MOD_STRIP value will be used as the options to the strip command. 187INSTALL_MOD_STRIP value will be used as the options to the strip command.
172 188
173INSTALL_HDR_PATH 189INSTALL_HDR_PATH
174-------------------------------------------------- 190----------------
175INSTALL_HDR_PATH specifies where to install user space headers when 191INSTALL_HDR_PATH specifies where to install user space headers when
176executing "make headers_*". 192executing "make headers_*".
177The default value is: 193
194The default value is::
178 195
179 $(objtree)/usr 196 $(objtree)/usr
180 197
@@ -184,65 +201,65 @@ The output directory is often set using "O=..." on the commandline.
184The value can be overridden in which case the default value is ignored. 201The value can be overridden in which case the default value is ignored.
185 202
186KBUILD_SIGN_PIN 203KBUILD_SIGN_PIN
187-------------------------------------------------- 204---------------
188This variable allows a passphrase or PIN to be passed to the sign-file 205This variable allows a passphrase or PIN to be passed to the sign-file
189utility when signing kernel modules, if the private key requires such. 206utility when signing kernel modules, if the private key requires such.
190 207
191KBUILD_MODPOST_WARN 208KBUILD_MODPOST_WARN
192-------------------------------------------------- 209-------------------
193KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined 210KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
194symbols in the final module linking stage. It changes such errors 211symbols in the final module linking stage. It changes such errors
195into warnings. 212into warnings.
196 213
197KBUILD_MODPOST_NOFINAL 214KBUILD_MODPOST_NOFINAL
198-------------------------------------------------- 215----------------------
199KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules. 216KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
200This is solely useful to speed up test compiles. 217This is solely useful to speed up test compiles.
201 218
202KBUILD_EXTRA_SYMBOLS 219KBUILD_EXTRA_SYMBOLS
203-------------------------------------------------- 220--------------------
204For modules that use symbols from other modules. 221For modules that use symbols from other modules.
205See more details in modules.txt. 222See more details in modules.txt.
206 223
207ALLSOURCE_ARCHS 224ALLSOURCE_ARCHS
208-------------------------------------------------- 225---------------
209For tags/TAGS/cscope targets, you can specify more than one arch 226For tags/TAGS/cscope targets, you can specify more than one arch
210to be included in the databases, separated by blank space. E.g.: 227to be included in the databases, separated by blank space. E.g.::
211 228
212 $ make ALLSOURCE_ARCHS="x86 mips arm" tags 229 $ make ALLSOURCE_ARCHS="x86 mips arm" tags
213 230
214To get all available archs you can also specify all. E.g.: 231To get all available archs you can also specify all. E.g.::
215 232
216 $ make ALLSOURCE_ARCHS=all tags 233 $ make ALLSOURCE_ARCHS=all tags
217 234
218KBUILD_ENABLE_EXTRA_GCC_CHECKS 235KBUILD_ENABLE_EXTRA_GCC_CHECKS
219-------------------------------------------------- 236------------------------------
220If enabled over the make command line with "W=1", it turns on additional 237If enabled over the make command line with "W=1", it turns on additional
221gcc -W... options for more extensive build-time checking. 238gcc -W... options for more extensive build-time checking.
222 239
223KBUILD_BUILD_TIMESTAMP 240KBUILD_BUILD_TIMESTAMP
224-------------------------------------------------- 241----------------------
225Setting this to a date string overrides the timestamp used in the 242Setting this to a date string overrides the timestamp used in the
226UTS_VERSION definition (uname -v in the running kernel). The value has to 243UTS_VERSION definition (uname -v in the running kernel). The value has to
227be a string that can be passed to date -d. The default value 244be a string that can be passed to date -d. The default value
228is the output of the date command at one point during build. 245is the output of the date command at one point during build.
229 246
230KBUILD_BUILD_USER, KBUILD_BUILD_HOST 247KBUILD_BUILD_USER, KBUILD_BUILD_HOST
231-------------------------------------------------- 248------------------------------------
232These two variables allow to override the user@host string displayed during 249These two variables allow to override the user@host string displayed during
233boot and in /proc/version. The default value is the output of the commands 250boot and in /proc/version. The default value is the output of the commands
234whoami and host, respectively. 251whoami and host, respectively.
235 252
236KBUILD_LDS 253KBUILD_LDS
237-------------------------------------------------- 254----------
238The linker script with full path. Assigned by the top-level Makefile. 255The linker script with full path. Assigned by the top-level Makefile.
239 256
240KBUILD_VMLINUX_OBJS 257KBUILD_VMLINUX_OBJS
241-------------------------------------------------- 258-------------------
242All object files for vmlinux. They are linked to vmlinux in the same 259All object files for vmlinux. They are linked to vmlinux in the same
243order as listed in KBUILD_VMLINUX_OBJS. 260order as listed in KBUILD_VMLINUX_OBJS.
244 261
245KBUILD_VMLINUX_LIBS 262KBUILD_VMLINUX_LIBS
246-------------------------------------------------- 263-------------------
247All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS 264All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS
248together specify all the object files used to link vmlinux. 265together specify all the object files used to link vmlinux.
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.rst
index 864e740811da..2bc8a7803365 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.rst
@@ -1,8 +1,12 @@
1================
2Kconfig Language
3================
4
1Introduction 5Introduction
2------------ 6------------
3 7
4The configuration database is a collection of configuration options 8The configuration database is a collection of configuration options
5organized in a tree structure: 9organized in a tree structure::
6 10
7 +- Code maturity level options 11 +- Code maturity level options
8 | +- Prompt for development and/or incomplete code/drivers 12 | +- Prompt for development and/or incomplete code/drivers
@@ -25,9 +29,9 @@ Menu entries
25------------ 29------------
26 30
27Most entries define a config option; all other entries help to organize 31Most entries define a config option; all other entries help to organize
28them. A single configuration option is defined like this: 32them. A single configuration option is defined like this::
29 33
30config MODVERSIONS 34 config MODVERSIONS
31 bool "Set version information on all module symbols" 35 bool "Set version information on all module symbols"
32 depends on MODULES 36 depends on MODULES
33 help 37 help
@@ -52,10 +56,12 @@ applicable everywhere (see syntax).
52 Every config option must have a type. There are only two basic types: 56 Every config option must have a type. There are only two basic types:
53 tristate and string; the other types are based on these two. The type 57 tristate and string; the other types are based on these two. The type
54 definition optionally accepts an input prompt, so these two examples 58 definition optionally accepts an input prompt, so these two examples
55 are equivalent: 59 are equivalent::
56 60
57 bool "Networking support" 61 bool "Networking support"
58 and 62
63 and::
64
59 bool 65 bool
60 prompt "Networking support" 66 prompt "Networking support"
61 67
@@ -98,8 +104,10 @@ applicable everywhere (see syntax).
98 d) Hardware or infrastructure that everybody expects, such as CONFIG_NET 104 d) Hardware or infrastructure that everybody expects, such as CONFIG_NET
99 or CONFIG_BLOCK. These are rare exceptions. 105 or CONFIG_BLOCK. These are rare exceptions.
100 106
101- type definition + default value: 107- type definition + default value::
108
102 "def_bool"/"def_tristate" <expr> ["if" <expr>] 109 "def_bool"/"def_tristate" <expr> ["if" <expr>]
110
103 This is a shorthand notation for a type definition plus a value. 111 This is a shorthand notation for a type definition plus a value.
104 Optionally dependencies for this default value can be added with "if". 112 Optionally dependencies for this default value can be added with "if".
105 113
@@ -107,11 +115,13 @@ applicable everywhere (see syntax).
107 This defines a dependency for this menu entry. If multiple 115 This defines a dependency for this menu entry. If multiple
108 dependencies are defined, they are connected with '&&'. Dependencies 116 dependencies are defined, they are connected with '&&'. Dependencies
109 are applied to all other options within this menu entry (which also 117 are applied to all other options within this menu entry (which also
110 accept an "if" expression), so these two examples are equivalent: 118 accept an "if" expression), so these two examples are equivalent::
111 119
112 bool "foo" if BAR 120 bool "foo" if BAR
113 default y if BAR 121 default y if BAR
114 and 122
123 and::
124
115 depends on BAR 125 depends on BAR
116 bool "foo" 126 bool "foo"
117 default y 127 default y
@@ -124,6 +134,7 @@ applicable everywhere (see syntax).
124 times, the limit is set to the largest selection. 134 times, the limit is set to the largest selection.
125 Reverse dependencies can only be used with boolean or tristate 135 Reverse dependencies can only be used with boolean or tristate
126 symbols. 136 symbols.
137
127 Note: 138 Note:
128 select should be used with care. select will force 139 select should be used with care. select will force
129 a symbol to a value without visiting the dependencies. 140 a symbol to a value without visiting the dependencies.
@@ -139,24 +150,26 @@ applicable everywhere (see syntax).
139 symbol except that the "implied" symbol's value may still be set to n 150 symbol except that the "implied" symbol's value may still be set to n
140 from a direct dependency or with a visible prompt. 151 from a direct dependency or with a visible prompt.
141 152
142 Given the following example: 153 Given the following example::
143 154
144 config FOO 155 config FOO
145 tristate 156 tristate
146 imply BAZ 157 imply BAZ
147 158
148 config BAZ 159 config BAZ
149 tristate 160 tristate
150 depends on BAR 161 depends on BAR
151 162
152 The following values are possible: 163 The following values are possible:
153 164
165 === === ============= ==============
154 FOO BAR BAZ's default choice for BAZ 166 FOO BAR BAZ's default choice for BAZ
155 --- --- ------------- -------------- 167 === === ============= ==============
156 n y n N/m/y 168 n y n N/m/y
157 m y m M/y/n 169 m y m M/y/n
158 y y y Y/n 170 y y y Y/n
159 y n * N 171 y n * N
172 === === ============= ==============
160 173
161 This is useful e.g. with multiple drivers that want to indicate their 174 This is useful e.g. with multiple drivers that want to indicate their
162 ability to hook into a secondary subsystem while allowing the user to 175 ability to hook into a secondary subsystem while allowing the user to
@@ -208,9 +221,9 @@ Menu dependencies
208Dependencies define the visibility of a menu entry and can also reduce 221Dependencies define the visibility of a menu entry and can also reduce
209the input range of tristate symbols. The tristate logic used in the 222the input range of tristate symbols. The tristate logic used in the
210expressions uses one more state than normal boolean logic to express the 223expressions uses one more state than normal boolean logic to express the
211module state. Dependency expressions have the following syntax: 224module state. Dependency expressions have the following syntax::
212 225
213<expr> ::= <symbol> (1) 226 <expr> ::= <symbol> (1)
214 <symbol> '=' <symbol> (2) 227 <symbol> '=' <symbol> (2)
215 <symbol> '!=' <symbol> (3) 228 <symbol> '!=' <symbol> (3)
216 <symbol1> '<' <symbol2> (4) 229 <symbol1> '<' <symbol2> (4)
@@ -222,7 +235,7 @@ module state. Dependency expressions have the following syntax:
222 <expr> '&&' <expr> (7) 235 <expr> '&&' <expr> (7)
223 <expr> '||' <expr> (8) 236 <expr> '||' <expr> (8)
224 237
225Expressions are listed in decreasing order of precedence. 238Expressions are listed in decreasing order of precedence.
226 239
227(1) Convert the symbol into an expression. Boolean and tristate symbols 240(1) Convert the symbol into an expression. Boolean and tristate symbols
228 are simply converted into the respective expression values. All 241 are simply converted into the respective expression values. All
@@ -255,15 +268,15 @@ Menu structure
255-------------- 268--------------
256 269
257The position of a menu entry in the tree is determined in two ways. First 270The position of a menu entry in the tree is determined in two ways. First
258it can be specified explicitly: 271it can be specified explicitly::
259 272
260menu "Network device support" 273 menu "Network device support"
261 depends on NET 274 depends on NET
262 275
263config NETDEVICES 276 config NETDEVICES
264 ... 277 ...
265 278
266endmenu 279 endmenu
267 280
268All entries within the "menu" ... "endmenu" block become a submenu of 281All entries within the "menu" ... "endmenu" block become a submenu of
269"Network device support". All subentries inherit the dependencies from 282"Network device support". All subentries inherit the dependencies from
@@ -275,17 +288,18 @@ dependencies. If a menu entry somehow depends on the previous entry, it
275can be made a submenu of it. First, the previous (parent) symbol must 288can be made a submenu of it. First, the previous (parent) symbol must
276be part of the dependency list and then one of these two conditions 289be part of the dependency list and then one of these two conditions
277must be true: 290must be true:
291
278- the child entry must become invisible, if the parent is set to 'n' 292- the child entry must become invisible, if the parent is set to 'n'
279- the child entry must only be visible, if the parent is visible 293- the child entry must only be visible, if the parent is visible::
280 294
281config MODULES 295 config MODULES
282 bool "Enable loadable module support" 296 bool "Enable loadable module support"
283 297
284config MODVERSIONS 298 config MODVERSIONS
285 bool "Set version information on all module symbols" 299 bool "Set version information on all module symbols"
286 depends on MODULES 300 depends on MODULES
287 301
288comment "module support disabled" 302 comment "module support disabled"
289 depends on !MODULES 303 depends on !MODULES
290 304
291MODVERSIONS directly depends on MODULES, this means it's only visible if 305MODVERSIONS directly depends on MODULES, this means it's only visible if
@@ -299,6 +313,7 @@ Kconfig syntax
299The configuration file describes a series of menu entries, where every 313The configuration file describes a series of menu entries, where every
300line starts with a keyword (except help texts). The following keywords 314line starts with a keyword (except help texts). The following keywords
301end a menu entry: 315end a menu entry:
316
302- config 317- config
303- menuconfig 318- menuconfig
304- choice/endchoice 319- choice/endchoice
@@ -306,17 +321,17 @@ end a menu entry:
306- menu/endmenu 321- menu/endmenu
307- if/endif 322- if/endif
308- source 323- source
309The first five also start the definition of a menu entry.
310 324
311config: 325The first five also start the definition of a menu entry.
312 326
327config::
313 "config" <symbol> 328 "config" <symbol>
314 <config options> 329 <config options>
315 330
316This defines a config symbol <symbol> and accepts any of above 331This defines a config symbol <symbol> and accepts any of above
317attributes as options. 332attributes as options.
318 333
319menuconfig: 334menuconfig::
320 "menuconfig" <symbol> 335 "menuconfig" <symbol>
321 <config options> 336 <config options>
322 337
@@ -325,43 +340,43 @@ hint to front ends, that all suboptions should be displayed as a
325separate list of options. To make sure all the suboptions will really 340separate list of options. To make sure all the suboptions will really
326show up under the menuconfig entry and not outside of it, every item 341show up under the menuconfig entry and not outside of it, every item
327from the <config options> list must depend on the menuconfig symbol. 342from the <config options> list must depend on the menuconfig symbol.
328In practice, this is achieved by using one of the next two constructs: 343In practice, this is achieved by using one of the next two constructs::
329 344
330(1): 345 (1):
331menuconfig M 346 menuconfig M
332if M 347 if M
333 config C1 348 config C1
334 config C2 349 config C2
335endif 350 endif
336 351
337(2): 352 (2):
338menuconfig M 353 menuconfig M
339config C1 354 config C1
340 depends on M 355 depends on M
341config C2 356 config C2
342 depends on M 357 depends on M
343 358
344In the following examples (3) and (4), C1 and C2 still have the M 359In the following examples (3) and (4), C1 and C2 still have the M
345dependency, but will not appear under menuconfig M anymore, because 360dependency, but will not appear under menuconfig M anymore, because
346of C0, which doesn't depend on M: 361of C0, which doesn't depend on M::
347 362
348(3): 363 (3):
349menuconfig M 364 menuconfig M
350 config C0 365 config C0
351if M 366 if M
352 config C1 367 config C1
353 config C2 368 config C2
354endif 369 endif
355 370
356(4): 371 (4):
357menuconfig M 372 menuconfig M
358config C0 373 config C0
359config C1 374 config C1
360 depends on M 375 depends on M
361config C2 376 config C2
362 depends on M 377 depends on M
363 378
364choices: 379choices::
365 380
366 "choice" [symbol] 381 "choice" [symbol]
367 <choice options> 382 <choice options>
@@ -387,7 +402,7 @@ definitions of that choice. If a [symbol] is associated to the choice,
387then you may define the same choice (i.e. with the same entries) in another 402then you may define the same choice (i.e. with the same entries) in another
388place. 403place.
389 404
390comment: 405comment::
391 406
392 "comment" <prompt> 407 "comment" <prompt>
393 <comment options> 408 <comment options>
@@ -396,7 +411,7 @@ This defines a comment which is displayed to the user during the
396configuration process and is also echoed to the output files. The only 411configuration process and is also echoed to the output files. The only
397possible options are dependencies. 412possible options are dependencies.
398 413
399menu: 414menu::
400 415
401 "menu" <prompt> 416 "menu" <prompt>
402 <menu options> 417 <menu options>
@@ -407,7 +422,7 @@ This defines a menu block, see "Menu structure" above for more
407information. The only possible options are dependencies and "visible" 422information. The only possible options are dependencies and "visible"
408attributes. 423attributes.
409 424
410if: 425if::
411 426
412 "if" <expr> 427 "if" <expr>
413 <if block> 428 <if block>
@@ -416,13 +431,13 @@ if:
416This defines an if block. The dependency expression <expr> is appended 431This defines an if block. The dependency expression <expr> is appended
417to all enclosed menu entries. 432to all enclosed menu entries.
418 433
419source: 434source::
420 435
421 "source" <prompt> 436 "source" <prompt>
422 437
423This reads the specified configuration file. This file is always parsed. 438This reads the specified configuration file. This file is always parsed.
424 439
425mainmenu: 440mainmenu::
426 441
427 "mainmenu" <prompt> 442 "mainmenu" <prompt>
428 443
@@ -452,20 +467,21 @@ that is defined in a common Kconfig file and selected by the relevant
452architectures. 467architectures.
453An example is the generic IOMAP functionality. 468An example is the generic IOMAP functionality.
454 469
455We would in lib/Kconfig see: 470We would in lib/Kconfig see::
456 471
457# Generic IOMAP is used to ... 472 # Generic IOMAP is used to ...
458config HAVE_GENERIC_IOMAP 473 config HAVE_GENERIC_IOMAP
459 474
460config GENERIC_IOMAP 475 config GENERIC_IOMAP
461 depends on HAVE_GENERIC_IOMAP && FOO 476 depends on HAVE_GENERIC_IOMAP && FOO
462 477
463And in lib/Makefile we would see: 478And in lib/Makefile we would see::
464obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
465 479
466For each architecture using the generic IOMAP functionality we would see: 480 obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
467 481
468config X86 482For each architecture using the generic IOMAP functionality we would see::
483
484 config X86
469 select ... 485 select ...
470 select HAVE_GENERIC_IOMAP 486 select HAVE_GENERIC_IOMAP
471 select ... 487 select ...
@@ -484,25 +500,25 @@ Adding features that need compiler support
484 500
485There are several features that need compiler support. The recommended way 501There are several features that need compiler support. The recommended way
486to describe the dependency on the compiler feature is to use "depends on" 502to describe the dependency on the compiler feature is to use "depends on"
487followed by a test macro. 503followed by a test macro::
488 504
489config STACKPROTECTOR 505 config STACKPROTECTOR
490 bool "Stack Protector buffer overflow detection" 506 bool "Stack Protector buffer overflow detection"
491 depends on $(cc-option,-fstack-protector) 507 depends on $(cc-option,-fstack-protector)
492 ... 508 ...
493 509
494If you need to expose a compiler capability to makefiles and/or C source files, 510If you need to expose a compiler capability to makefiles and/or C source files,
495CC_HAS_ is the recommended prefix for the config option. 511`CC_HAS_` is the recommended prefix for the config option::
496 512
497config CC_HAS_STACKPROTECTOR_NONE 513 config CC_HAS_STACKPROTECTOR_NONE
498 def_bool $(cc-option,-fno-stack-protector) 514 def_bool $(cc-option,-fno-stack-protector)
499 515
500Build as module only 516Build as module only
501~~~~~~~~~~~~~~~~~~~~ 517~~~~~~~~~~~~~~~~~~~~
502To restrict a component build to module-only, qualify its config symbol 518To restrict a component build to module-only, qualify its config symbol
503with "depends on m". E.g.: 519with "depends on m". E.g.::
504 520
505config FOO 521 config FOO
506 depends on BAR && m 522 depends on BAR && m
507 523
508limits FOO to module (=m) or disabled (=n). 524limits FOO to module (=m) or disabled (=n).
@@ -529,18 +545,18 @@ Simple Kconfig recursive issue
529 545
530Read: Documentation/kbuild/Kconfig.recursion-issue-01 546Read: Documentation/kbuild/Kconfig.recursion-issue-01
531 547
532Test with: 548Test with::
533 549
534make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig 550 make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
535 551
536Cumulative Kconfig recursive issue 552Cumulative Kconfig recursive issue
537~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 553~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
538 554
539Read: Documentation/kbuild/Kconfig.recursion-issue-02 555Read: Documentation/kbuild/Kconfig.recursion-issue-02
540 556
541Test with: 557Test with::
542 558
543make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig 559 make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
544 560
545Practical solutions to kconfig recursive issue 561Practical solutions to kconfig recursive issue
546~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -551,7 +567,9 @@ historical issues resolved through these different solutions.
551 567
552 a) Remove any superfluous "select FOO" or "depends on FOO" 568 a) Remove any superfluous "select FOO" or "depends on FOO"
553 b) Match dependency semantics: 569 b) Match dependency semantics:
570
554 b1) Swap all "select FOO" to "depends on FOO" or, 571 b1) Swap all "select FOO" to "depends on FOO" or,
572
555 b2) Swap all "depends on FOO" to "select FOO" 573 b2) Swap all "depends on FOO" to "select FOO"
556 574
557The resolution to a) can be tested with the sample Kconfig file 575The resolution to a) can be tested with the sample Kconfig file
@@ -566,8 +584,9 @@ Documentation/kbuild/Kconfig.recursion-issue-02.
566Below is a list of examples of prior fixes for these types of recursive issues; 584Below is a list of examples of prior fixes for these types of recursive issues;
567all errors appear to involve one or more select's and one or more "depends on". 585all errors appear to involve one or more select's and one or more "depends on".
568 586
587============ ===================================
569commit fix 588commit fix
570====== === 589============ ===================================
57106b718c01208 select A -> depends on A 59006b718c01208 select A -> depends on A
572c22eacfe82f9 depends on A -> depends on B 591c22eacfe82f9 depends on A -> depends on B
5736a91e854442c select A -> depends on A 5926a91e854442c select A -> depends on A
@@ -590,6 +609,7 @@ d9f9ab51e55e select A -> depends on A
5900c51a4d8abd6 depends on A -> select A (3) 6090c51a4d8abd6 depends on A -> select A (3)
591e98062ed6dc4 select A -> depends on A (3) 610e98062ed6dc4 select A -> depends on A (3)
59291e5d284a7f1 select A -> (null) 61191e5d284a7f1 select A -> (null)
612============ ===================================
593 613
594(1) Partial (or no) quote of error. 614(1) Partial (or no) quote of error.
595(2) That seems to be the gist of that fix. 615(2) That seems to be the gist of that fix.
@@ -616,11 +636,11 @@ Semantics of Kconfig
616~~~~~~~~~~~~~~~~~~~~ 636~~~~~~~~~~~~~~~~~~~~
617 637
618The use of Kconfig is broad, Linux is now only one of Kconfig's users: 638The use of Kconfig is broad, Linux is now only one of Kconfig's users:
619one study has completed a broad analysis of Kconfig use in 12 projects [0]. 639one study has completed a broad analysis of Kconfig use in 12 projects [0]_.
620Despite its widespread use, and although this document does a reasonable job 640Despite its widespread use, and although this document does a reasonable job
621in documenting basic Kconfig syntax a more precise definition of Kconfig 641in documenting basic Kconfig syntax a more precise definition of Kconfig
622semantics is welcomed. One project deduced Kconfig semantics through 642semantics is welcomed. One project deduced Kconfig semantics through
623the use of the xconfig configurator [1]. Work should be done to confirm if 643the use of the xconfig configurator [1]_. Work should be done to confirm if
624the deduced semantics matches our intended Kconfig design goals. 644the deduced semantics matches our intended Kconfig design goals.
625 645
626Having well defined semantics can be useful for tools for practical 646Having well defined semantics can be useful for tools for practical
@@ -628,42 +648,42 @@ evaluation of depenencies, for instance one such use known case was work to
628express in boolean abstraction of the inferred semantics of Kconfig to 648express in boolean abstraction of the inferred semantics of Kconfig to
629translate Kconfig logic into boolean formulas and run a SAT solver on this to 649translate Kconfig logic into boolean formulas and run a SAT solver on this to
630find dead code / features (always inactive), 114 dead features were found in 650find dead code / features (always inactive), 114 dead features were found in
631Linux using this methodology [1] (Section 8: Threats to validity). 651Linux using this methodology [1]_ (Section 8: Threats to validity).
632 652
633Confirming this could prove useful as Kconfig stands as one of the the leading 653Confirming this could prove useful as Kconfig stands as one of the the leading
634industrial variability modeling languages [1] [2]. Its study would help 654industrial variability modeling languages [1]_ [2]_. Its study would help
635evaluate practical uses of such languages, their use was only theoretical 655evaluate practical uses of such languages, their use was only theoretical
636and real world requirements were not well understood. As it stands though 656and real world requirements were not well understood. As it stands though
637only reverse engineering techniques have been used to deduce semantics from 657only reverse engineering techniques have been used to deduce semantics from
638variability modeling languages such as Kconfig [3]. 658variability modeling languages such as Kconfig [3]_.
639 659
640[0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf 660.. [0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
641[1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf 661.. [1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
642[2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf 662.. [2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
643[3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf 663.. [3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf
644 664
645Full SAT solver for Kconfig 665Full SAT solver for Kconfig
646~~~~~~~~~~~~~~~~~~~~~~~~~~~ 666~~~~~~~~~~~~~~~~~~~~~~~~~~~
647 667
648Although SAT solvers [0] haven't yet been used by Kconfig directly, as noted in 668Although SAT solvers [4]_ haven't yet been used by Kconfig directly, as noted
649the previous subsection, work has been done however to express in boolean 669in the previous subsection, work has been done however to express in boolean
650abstraction the inferred semantics of Kconfig to translate Kconfig logic into 670abstraction the inferred semantics of Kconfig to translate Kconfig logic into
651boolean formulas and run a SAT solver on it [1]. Another known related project 671boolean formulas and run a SAT solver on it [5]_. Another known related project
652is CADOS [2] (former VAMOS [3]) and the tools, mainly undertaker [4], which has 672is CADOS [6]_ (former VAMOS [7]_) and the tools, mainly undertaker [8]_, which
653been introduced first with [5]. The basic concept of undertaker is to exract 673has been introduced first with [9]_. The basic concept of undertaker is to
654variability models from Kconfig, and put them together with a propositional 674exract variability models from Kconfig, and put them together with a
655formula extracted from CPP #ifdefs and build-rules into a SAT solver in order 675propositional formula extracted from CPP #ifdefs and build-rules into a SAT
656to find dead code, dead files, and dead symbols. If using a SAT solver is 676solver in order to find dead code, dead files, and dead symbols. If using a SAT
657desirable on Kconfig one approach would be to evaluate repurposing such efforts 677solver is desirable on Kconfig one approach would be to evaluate repurposing
658somehow on Kconfig. There is enough interest from mentors of existing projects 678such efforts somehow on Kconfig. There is enough interest from mentors of
659to not only help advise how to integrate this work upstream but also help 679existing projects to not only help advise how to integrate this work upstream
660maintain it long term. Interested developers should visit: 680but also help maintain it long term. Interested developers should visit:
661 681
662http://kernelnewbies.org/KernelProjects/kconfig-sat 682http://kernelnewbies.org/KernelProjects/kconfig-sat
663 683
664[0] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf 684.. [4] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
665[1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf 685.. [5] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
666[2] https://cados.cs.fau.de 686.. [6] https://cados.cs.fau.de
667[3] https://vamos.cs.fau.de 687.. [7] https://vamos.cs.fau.de
668[4] https://undertaker.cs.fau.de 688.. [8] https://undertaker.cs.fau.de
669[5] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf 689.. [9] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
diff --git a/Documentation/kbuild/kconfig-macro-language.txt b/Documentation/kbuild/kconfig-macro-language.rst
index 07da2ea68dce..35b3263b7e40 100644
--- a/Documentation/kbuild/kconfig-macro-language.txt
+++ b/Documentation/kbuild/kconfig-macro-language.rst
@@ -1,3 +1,7 @@
1======================
2Kconfig macro language
3======================
4
1Concept 5Concept
2------- 6-------
3 7
@@ -7,7 +11,7 @@ targets and prerequisites. The other is a macro language for performing textual
7substitution. 11substitution.
8 12
9There is clear distinction between the two language stages. For example, you 13There is clear distinction between the two language stages. For example, you
10can write a makefile like follows: 14can write a makefile like follows::
11 15
12 APP := foo 16 APP := foo
13 SRC := foo.c 17 SRC := foo.c
@@ -17,7 +21,7 @@ can write a makefile like follows:
17 $(CC) -o $(APP) $(SRC) 21 $(CC) -o $(APP) $(SRC)
18 22
19The macro language replaces the variable references with their expanded form, 23The macro language replaces the variable references with their expanded form,
20and handles as if the source file were input like follows: 24and handles as if the source file were input like follows::
21 25
22 foo: foo.c 26 foo: foo.c
23 gcc -o foo foo.c 27 gcc -o foo foo.c
@@ -26,7 +30,7 @@ Then, Make analyzes the dependency graph and determines the targets to be
26updated. 30updated.
27 31
28The idea is quite similar in Kconfig - it is possible to describe a Kconfig 32The idea is quite similar in Kconfig - it is possible to describe a Kconfig
29file like this: 33file like this::
30 34
31 CC := gcc 35 CC := gcc
32 36
@@ -34,7 +38,7 @@ file like this:
34 def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC)) 38 def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC))
35 39
36The macro language in Kconfig processes the source file into the following 40The macro language in Kconfig processes the source file into the following
37intermediate: 41intermediate::
38 42
39 config CC_HAS_FOO 43 config CC_HAS_FOO
40 def_bool y 44 def_bool y
@@ -69,7 +73,7 @@ variable. The righthand side of += is expanded immediately if the lefthand
69side was originally defined as a simple variable. Otherwise, its evaluation is 73side was originally defined as a simple variable. Otherwise, its evaluation is
70deferred. 74deferred.
71 75
72The variable reference can take parameters, in the following form: 76The variable reference can take parameters, in the following form::
73 77
74 $(name,arg1,arg2,arg3) 78 $(name,arg1,arg2,arg3)
75 79
@@ -141,7 +145,7 @@ Make vs Kconfig
141Kconfig adopts Make-like macro language, but the function call syntax is 145Kconfig adopts Make-like macro language, but the function call syntax is
142slightly different. 146slightly different.
143 147
144A function call in Make looks like this: 148A function call in Make looks like this::
145 149
146 $(func-name arg1,arg2,arg3) 150 $(func-name arg1,arg2,arg3)
147 151
@@ -149,14 +153,14 @@ The function name and the first argument are separated by at least one
149whitespace. Then, leading whitespaces are trimmed from the first argument, 153whitespace. Then, leading whitespaces are trimmed from the first argument,
150while whitespaces in the other arguments are kept. You need to use a kind of 154while whitespaces in the other arguments are kept. You need to use a kind of
151trick to start the first parameter with spaces. For example, if you want 155trick to start the first parameter with spaces. For example, if you want
152to make "info" function print " hello", you can write like follows: 156to make "info" function print " hello", you can write like follows::
153 157
154 empty := 158 empty :=
155 space := $(empty) $(empty) 159 space := $(empty) $(empty)
156 $(info $(space)$(space)hello) 160 $(info $(space)$(space)hello)
157 161
158Kconfig uses only commas for delimiters, and keeps all whitespaces in the 162Kconfig uses only commas for delimiters, and keeps all whitespaces in the
159function call. Some people prefer putting a space after each comma delimiter: 163function call. Some people prefer putting a space after each comma delimiter::
160 164
161 $(func-name, arg1, arg2, arg3) 165 $(func-name, arg1, arg2, arg3)
162 166
@@ -166,7 +170,7 @@ Make - for example, $(subst .c, .o, $(sources)) is a typical mistake; it
166replaces ".c" with " .o". 170replaces ".c" with " .o".
167 171
168In Make, a user-defined function is referenced by using a built-in function, 172In Make, a user-defined function is referenced by using a built-in function,
169'call', like this: 173'call', like this::
170 174
171 $(call my-func,arg1,arg2,arg3) 175 $(call my-func,arg1,arg2,arg3)
172 176
@@ -179,12 +183,12 @@ Likewise, $(info hello, world) prints "hello, world" to stdout. You could say
179this is _useful_ inconsistency. 183this is _useful_ inconsistency.
180 184
181In Kconfig, for simpler implementation and grammatical consistency, commas that 185In Kconfig, for simpler implementation and grammatical consistency, commas that
182appear in the $( ) context are always delimiters. It means 186appear in the $( ) context are always delimiters. It means::
183 187
184 $(shell, echo hello, world) 188 $(shell, echo hello, world)
185 189
186is an error because it is passing two parameters where the 'shell' function 190is an error because it is passing two parameters where the 'shell' function
187accepts only one. To pass commas in arguments, you can use the following trick: 191accepts only one. To pass commas in arguments, you can use the following trick::
188 192
189 comma := , 193 comma := ,
190 $(shell, echo hello$(comma) world) 194 $(shell, echo hello$(comma) world)
@@ -195,7 +199,7 @@ Caveats
195 199
196A variable (or function) cannot be expanded across tokens. So, you cannot use 200A variable (or function) cannot be expanded across tokens. So, you cannot use
197a variable as a shorthand for an expression that consists of multiple tokens. 201a variable as a shorthand for an expression that consists of multiple tokens.
198The following works: 202The following works::
199 203
200 RANGE_MIN := 1 204 RANGE_MIN := 1
201 RANGE_MAX := 3 205 RANGE_MAX := 3
@@ -204,7 +208,7 @@ The following works:
204 int "foo" 208 int "foo"
205 range $(RANGE_MIN) $(RANGE_MAX) 209 range $(RANGE_MIN) $(RANGE_MAX)
206 210
207But, the following does not work: 211But, the following does not work::
208 212
209 RANGES := 1 3 213 RANGES := 1 3
210 214
@@ -213,7 +217,7 @@ But, the following does not work:
213 range $(RANGES) 217 range $(RANGES)
214 218
215A variable cannot be expanded to any keyword in Kconfig. The following does 219A variable cannot be expanded to any keyword in Kconfig. The following does
216not work: 220not work::
217 221
218 MY_TYPE := tristate 222 MY_TYPE := tristate
219 223
@@ -223,7 +227,8 @@ not work:
223 227
224Obviously from the design, $(shell command) is expanded in the textual 228Obviously from the design, $(shell command) is expanded in the textual
225substitution phase. You cannot pass symbols to the 'shell' function. 229substitution phase. You cannot pass symbols to the 'shell' function.
226The following does not work as expected. 230
231The following does not work as expected::
227 232
228 config ENDIAN_FLAG 233 config ENDIAN_FLAG
229 string 234 string
@@ -234,7 +239,7 @@ The following does not work as expected.
234 def_bool $(shell $(srctree)/scripts/gcc-check-flag ENDIAN_FLAG) 239 def_bool $(shell $(srctree)/scripts/gcc-check-flag ENDIAN_FLAG)
235 240
236Instead, you can do like follows so that any function call is statically 241Instead, you can do like follows so that any function call is statically
237expanded. 242expanded::
238 243
239 config CC_HAS_ENDIAN_FLAG 244 config CC_HAS_ENDIAN_FLAG
240 bool 245 bool
diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.rst
index 68c82914c0f3..88129af7e539 100644
--- a/Documentation/kbuild/kconfig.txt
+++ b/Documentation/kbuild/kconfig.rst
@@ -1,4 +1,8 @@
1This file contains some assistance for using "make *config". 1===================
2Kconfig make config
3===================
4
5This file contains some assistance for using `make *config`.
2 6
3Use "make help" to list all of the possible configuration targets. 7Use "make help" to list all of the possible configuration targets.
4 8
@@ -6,9 +10,8 @@ The xconfig ('qconf'), menuconfig ('mconf'), and nconfig ('nconf')
6programs also have embedded help text. Be sure to check that for 10programs also have embedded help text. Be sure to check that for
7navigation, search, and other general help text. 11navigation, search, and other general help text.
8 12
9======================================================================
10General 13General
11-------------------------------------------------- 14-------
12 15
13New kernel releases often introduce new config symbols. Often more 16New kernel releases often introduce new config symbols. Often more
14important, new kernel releases may rename config symbols. When 17important, new kernel releases may rename config symbols. When
@@ -17,51 +20,55 @@ this happens, using a previously working .config file and running
17for you, so you may find that you need to see what NEW kernel 20for you, so you may find that you need to see what NEW kernel
18symbols have been introduced. 21symbols have been introduced.
19 22
20To see a list of new config symbols, use 23To see a list of new config symbols, use::
21 24
22 cp user/some/old.config .config 25 cp user/some/old.config .config
23 make listnewconfig 26 make listnewconfig
24 27
25and the config program will list any new symbols, one per line. 28and the config program will list any new symbols, one per line.
26 29
27Alternatively, you can use the brute force method: 30Alternatively, you can use the brute force method::
28 31
29 make oldconfig 32 make oldconfig
30 scripts/diffconfig .config.old .config | less 33 scripts/diffconfig .config.old .config | less
31 34
32______________________________________________________________________ 35----------------------------------------------------------------------
33Environment variables for '*config' 36
37Environment variables for `*config`
34 38
35KCONFIG_CONFIG 39KCONFIG_CONFIG
36-------------------------------------------------- 40--------------
37This environment variable can be used to specify a default kernel config 41This environment variable can be used to specify a default kernel config
38file name to override the default name of ".config". 42file name to override the default name of ".config".
39 43
40KCONFIG_OVERWRITECONFIG 44KCONFIG_OVERWRITECONFIG
41-------------------------------------------------- 45-----------------------
42If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not 46If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not
43break symlinks when .config is a symlink to somewhere else. 47break symlinks when .config is a symlink to somewhere else.
44 48
45CONFIG_ 49`CONFIG_`
46-------------------------------------------------- 50---------
47If you set CONFIG_ in the environment, Kconfig will prefix all symbols 51If you set `CONFIG_` in the environment, Kconfig will prefix all symbols
48with its value when saving the configuration, instead of using the default, 52with its value when saving the configuration, instead of using the default,
49"CONFIG_". 53`CONFIG_`.
54
55----------------------------------------------------------------------
50 56
51______________________________________________________________________
52Environment variables for '{allyes/allmod/allno/rand}config' 57Environment variables for '{allyes/allmod/allno/rand}config'
53 58
54KCONFIG_ALLCONFIG 59KCONFIG_ALLCONFIG
55-------------------------------------------------- 60-----------------
56(partially based on lkml email from/by Rob Landley, re: miniconfig) 61(partially based on lkml email from/by Rob Landley, re: miniconfig)
62
57-------------------------------------------------- 63--------------------------------------------------
64
58The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also 65The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also
59use the environment variable KCONFIG_ALLCONFIG as a flag or a filename 66use the environment variable KCONFIG_ALLCONFIG as a flag or a filename
60that contains config symbols that the user requires to be set to a 67that contains config symbols that the user requires to be set to a
61specific value. If KCONFIG_ALLCONFIG is used without a filename where 68specific value. If KCONFIG_ALLCONFIG is used without a filename where
62KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", "make *config" 69KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", `make *config`
63checks for a file named "all{yes/mod/no/def/random}.config" 70checks for a file named "all{yes/mod/no/def/random}.config"
64(corresponding to the *config command that was used) for symbol values 71(corresponding to the `*config` command that was used) for symbol values
65that are to be forced. If this file is not found, it checks for a 72that are to be forced. If this file is not found, it checks for a
66file named "all.config" to contain forced values. 73file named "all.config" to contain forced values.
67 74
@@ -74,43 +81,55 @@ This 'KCONFIG_ALLCONFIG' file is a config file which contains
74(usually a subset of all) preset config symbols. These variable 81(usually a subset of all) preset config symbols. These variable
75settings are still subject to normal dependency checks. 82settings are still subject to normal dependency checks.
76 83
77Examples: 84Examples::
85
78 KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig 86 KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig
79or 87
88or::
89
80 KCONFIG_ALLCONFIG=mini.config make allnoconfig 90 KCONFIG_ALLCONFIG=mini.config make allnoconfig
81or 91
92or::
93
82 make KCONFIG_ALLCONFIG=mini.config allnoconfig 94 make KCONFIG_ALLCONFIG=mini.config allnoconfig
83 95
84These examples will disable most options (allnoconfig) but enable or 96These examples will disable most options (allnoconfig) but enable or
85disable the options that are explicitly listed in the specified 97disable the options that are explicitly listed in the specified
86mini-config files. 98mini-config files.
87 99
88______________________________________________________________________ 100----------------------------------------------------------------------
101
89Environment variables for 'randconfig' 102Environment variables for 'randconfig'
90 103
91KCONFIG_SEED 104KCONFIG_SEED
92-------------------------------------------------- 105------------
93You can set this to the integer value used to seed the RNG, if you want 106You can set this to the integer value used to seed the RNG, if you want
94to somehow debug the behaviour of the kconfig parser/frontends. 107to somehow debug the behaviour of the kconfig parser/frontends.
95If not set, the current time will be used. 108If not set, the current time will be used.
96 109
97KCONFIG_PROBABILITY 110KCONFIG_PROBABILITY
98-------------------------------------------------- 111-------------------
99This variable can be used to skew the probabilities. This variable can 112This variable can be used to skew the probabilities. This variable can
100be unset or empty, or set to three different formats: 113be unset or empty, or set to three different formats:
114
115 ======================= ================== =====================
101 KCONFIG_PROBABILITY y:n split y:m:n split 116 KCONFIG_PROBABILITY y:n split y:m:n split
102 ----------------------------------------------------------------- 117 ======================= ================== =====================
103 unset or empty 50 : 50 33 : 33 : 34 118 unset or empty 50 : 50 33 : 33 : 34
104 N N : 100-N N/2 : N/2 : 100-N 119 N N : 100-N N/2 : N/2 : 100-N
105 [1] N:M N+M : 100-(N+M) N : M : 100-(N+M) 120 [1] N:M N+M : 100-(N+M) N : M : 100-(N+M)
106 [2] N:M:L N : 100-N M : L : 100-(M+L) 121 [2] N:M:L N : 100-N M : L : 100-(M+L)
122 ======================= ================== =====================
107 123
108where N, M and L are integers (in base 10) in the range [0,100], and so 124where N, M and L are integers (in base 10) in the range [0,100], and so
109that: 125that:
126
110 [1] N+M is in the range [0,100] 127 [1] N+M is in the range [0,100]
128
111 [2] M+L is in the range [0,100] 129 [2] M+L is in the range [0,100]
112 130
113Examples: 131Examples::
132
114 KCONFIG_PROBABILITY=10 133 KCONFIG_PROBABILITY=10
115 10% of booleans will be set to 'y', 90% to 'n' 134 10% of booleans will be set to 'y', 90% to 'n'
116 5% of tristates will be set to 'y', 5% to 'm', 90% to 'n' 135 5% of tristates will be set to 'y', 5% to 'm', 90% to 'n'
@@ -121,34 +140,36 @@ Examples:
121 10% of booleans will be set to 'y', 90% to 'n' 140 10% of booleans will be set to 'y', 90% to 'n'
122 15% of tristates will be set to 'y', 15% to 'm', 70% to 'n' 141 15% of tristates will be set to 'y', 15% to 'm', 70% to 'n'
123 142
124______________________________________________________________________ 143----------------------------------------------------------------------
144
125Environment variables for 'syncconfig' 145Environment variables for 'syncconfig'
126 146
127KCONFIG_NOSILENTUPDATE 147KCONFIG_NOSILENTUPDATE
128-------------------------------------------------- 148----------------------
129If this variable has a non-blank value, it prevents silent kernel 149If this variable has a non-blank value, it prevents silent kernel
130config updates (requires explicit updates). 150config updates (requires explicit updates).
131 151
132KCONFIG_AUTOCONFIG 152KCONFIG_AUTOCONFIG
133-------------------------------------------------- 153------------------
134This environment variable can be set to specify the path & name of the 154This environment variable can be set to specify the path & name of the
135"auto.conf" file. Its default value is "include/config/auto.conf". 155"auto.conf" file. Its default value is "include/config/auto.conf".
136 156
137KCONFIG_TRISTATE 157KCONFIG_TRISTATE
138-------------------------------------------------- 158----------------
139This environment variable can be set to specify the path & name of the 159This environment variable can be set to specify the path & name of the
140"tristate.conf" file. Its default value is "include/config/tristate.conf". 160"tristate.conf" file. Its default value is "include/config/tristate.conf".
141 161
142KCONFIG_AUTOHEADER 162KCONFIG_AUTOHEADER
143-------------------------------------------------- 163------------------
144This environment variable can be set to specify the path & name of the 164This environment variable can be set to specify the path & name of the
145"autoconf.h" (header) file. 165"autoconf.h" (header) file.
146Its default value is "include/generated/autoconf.h". 166Its default value is "include/generated/autoconf.h".
147 167
148 168
149====================================================================== 169----------------------------------------------------------------------
170
150menuconfig 171menuconfig
151-------------------------------------------------- 172----------
152 173
153SEARCHING for CONFIG symbols 174SEARCHING for CONFIG symbols
154 175
@@ -158,7 +179,8 @@ Searching in menuconfig:
158 names, so you have to know something close to what you are 179 names, so you have to know something close to what you are
159 looking for. 180 looking for.
160 181
161 Example: 182 Example::
183
162 /hotplug 184 /hotplug
163 This lists all config symbols that contain "hotplug", 185 This lists all config symbols that contain "hotplug",
164 e.g., HOTPLUG_CPU, MEMORY_HOTPLUG. 186 e.g., HOTPLUG_CPU, MEMORY_HOTPLUG.
@@ -166,48 +188,55 @@ Searching in menuconfig:
166 For search help, enter / followed by TAB-TAB (to highlight 188 For search help, enter / followed by TAB-TAB (to highlight
167 <Help>) and Enter. This will tell you that you can also use 189 <Help>) and Enter. This will tell you that you can also use
168 regular expressions (regexes) in the search string, so if you 190 regular expressions (regexes) in the search string, so if you
169 are not interested in MEMORY_HOTPLUG, you could try 191 are not interested in MEMORY_HOTPLUG, you could try::
170 192
171 /^hotplug 193 /^hotplug
172 194
173 When searching, symbols are sorted thus: 195 When searching, symbols are sorted thus:
196
174 - first, exact matches, sorted alphabetically (an exact match 197 - first, exact matches, sorted alphabetically (an exact match
175 is when the search matches the complete symbol name); 198 is when the search matches the complete symbol name);
176 - then, other matches, sorted alphabetically. 199 - then, other matches, sorted alphabetically.
200
177 For example: ^ATH.K matches: 201 For example: ^ATH.K matches:
202
178 ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG 203 ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG
179 [...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...] 204 [...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...]
205
180 of which only ATH5K and ATH9K match exactly and so are sorted 206 of which only ATH5K and ATH9K match exactly and so are sorted
181 first (and in alphabetical order), then come all other symbols, 207 first (and in alphabetical order), then come all other symbols,
182 sorted in alphabetical order. 208 sorted in alphabetical order.
183 209
184______________________________________________________________________ 210----------------------------------------------------------------------
211
185User interface options for 'menuconfig' 212User interface options for 'menuconfig'
186 213
187MENUCONFIG_COLOR 214MENUCONFIG_COLOR
188-------------------------------------------------- 215----------------
189It is possible to select different color themes using the variable 216It is possible to select different color themes using the variable
190MENUCONFIG_COLOR. To select a theme use: 217MENUCONFIG_COLOR. To select a theme use::
191 218
192 make MENUCONFIG_COLOR=<theme> menuconfig 219 make MENUCONFIG_COLOR=<theme> menuconfig
193 220
194Available themes are: 221Available themes are::
195 mono => selects colors suitable for monochrome displays 222
196 blackbg => selects a color scheme with black background 223 - mono => selects colors suitable for monochrome displays
197 classic => theme with blue background. The classic look 224 - blackbg => selects a color scheme with black background
198 bluetitle => a LCD friendly version of classic. (default) 225 - classic => theme with blue background. The classic look
226 - bluetitle => a LCD friendly version of classic. (default)
199 227
200MENUCONFIG_MODE 228MENUCONFIG_MODE
201-------------------------------------------------- 229---------------
202This mode shows all sub-menus in one large tree. 230This mode shows all sub-menus in one large tree.
203 231
204Example: 232Example::
233
205 make MENUCONFIG_MODE=single_menu menuconfig 234 make MENUCONFIG_MODE=single_menu menuconfig
206 235
236----------------------------------------------------------------------
207 237
208======================================================================
209nconfig 238nconfig
210-------------------------------------------------- 239-------
211 240
212nconfig is an alternate text-based configurator. It lists function 241nconfig is an alternate text-based configurator. It lists function
213keys across the bottom of the terminal (window) that execute commands. 242keys across the bottom of the terminal (window) that execute commands.
@@ -231,16 +260,16 @@ Searching in nconfig:
231 given string or regular expression (regex). 260 given string or regular expression (regex).
232 261
233NCONFIG_MODE 262NCONFIG_MODE
234-------------------------------------------------- 263------------
235This mode shows all sub-menus in one large tree. 264This mode shows all sub-menus in one large tree.
236 265
237Example: 266Example::
238 make NCONFIG_MODE=single_menu nconfig 267 make NCONFIG_MODE=single_menu nconfig
239 268
269----------------------------------------------------------------------
240 270
241======================================================================
242xconfig 271xconfig
243-------------------------------------------------- 272-------
244 273
245Searching in xconfig: 274Searching in xconfig:
246 275
@@ -260,13 +289,12 @@ Searching in xconfig:
260 to return to the main menu. 289 to return to the main menu.
261 290
262 291
263====================================================================== 292----------------------------------------------------------------------
293
264gconfig 294gconfig
265-------------------------------------------------- 295-------
266 296
267Searching in gconfig: 297Searching in gconfig:
268 298
269 There is no search command in gconfig. However, gconfig does 299 There is no search command in gconfig. However, gconfig does
270 have several different viewing choices, modes, and options. 300 have several different viewing choices, modes, and options.
271
272###
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.rst
index d65ad5746f94..9274cdcc9bd2 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.rst
@@ -1,8 +1,10 @@
1======================
1Linux Kernel Makefiles 2Linux Kernel Makefiles
3======================
2 4
3This document describes the Linux kernel Makefiles. 5This document describes the Linux kernel Makefiles.
4 6
5=== Table of Contents 7.. Table of Contents
6 8
7 === 1 Overview 9 === 1 Overview
8 === 2 Who does what 10 === 2 Who does what
@@ -54,9 +56,10 @@ This document describes the Linux kernel Makefiles.
54 === 10 Credits 56 === 10 Credits
55 === 11 TODO 57 === 11 TODO
56 58
57=== 1 Overview 591 Overview
60==========
58 61
59The Makefiles have five parts: 62The Makefiles have five parts::
60 63
61 Makefile the top Makefile. 64 Makefile the top Makefile.
62 .config the kernel configuration file. 65 .config the kernel configuration file.
@@ -85,7 +88,8 @@ scripts/Makefile.* contains all the definitions/rules etc. that
85are used to build the kernel based on the kbuild makefiles. 88are used to build the kernel based on the kbuild makefiles.
86 89
87 90
88=== 2 Who does what 912 Who does what
92===============
89 93
90People have four different relationships with the kernel Makefiles. 94People have four different relationships with the kernel Makefiles.
91 95
@@ -110,7 +114,8 @@ These people need to know about all aspects of the kernel Makefiles.
110This document is aimed towards normal developers and arch developers. 114This document is aimed towards normal developers and arch developers.
111 115
112 116
113=== 3 The kbuild files 1173 The kbuild files
118==================
114 119
115Most Makefiles within the kernel are kbuild Makefiles that use the 120Most Makefiles within the kernel are kbuild Makefiles that use the
116kbuild infrastructure. This chapter introduces the syntax used in the 121kbuild infrastructure. This chapter introduces the syntax used in the
@@ -122,7 +127,8 @@ file will be used.
122Section 3.1 "Goal definitions" is a quick intro, further chapters provide 127Section 3.1 "Goal definitions" is a quick intro, further chapters provide
123more details, with real examples. 128more details, with real examples.
124 129
125--- 3.1 Goal definitions 1303.1 Goal definitions
131--------------------
126 132
127 Goal definitions are the main part (heart) of the kbuild Makefile. 133 Goal definitions are the main part (heart) of the kbuild Makefile.
128 These lines define the files to be built, any special compilation 134 These lines define the files to be built, any special compilation
@@ -130,7 +136,8 @@ more details, with real examples.
130 136
131 The most simple kbuild makefile contains one line: 137 The most simple kbuild makefile contains one line:
132 138
133 Example: 139 Example::
140
134 obj-y += foo.o 141 obj-y += foo.o
135 142
136 This tells kbuild that there is one object in that directory, named 143 This tells kbuild that there is one object in that directory, named
@@ -139,14 +146,16 @@ more details, with real examples.
139 If foo.o shall be built as a module, the variable obj-m is used. 146 If foo.o shall be built as a module, the variable obj-m is used.
140 Therefore the following pattern is often used: 147 Therefore the following pattern is often used:
141 148
142 Example: 149 Example::
150
143 obj-$(CONFIG_FOO) += foo.o 151 obj-$(CONFIG_FOO) += foo.o
144 152
145 $(CONFIG_FOO) evaluates to either y (for built-in) or m (for module). 153 $(CONFIG_FOO) evaluates to either y (for built-in) or m (for module).
146 If CONFIG_FOO is neither y nor m, then the file will not be compiled 154 If CONFIG_FOO is neither y nor m, then the file will not be compiled
147 nor linked. 155 nor linked.
148 156
149--- 3.2 Built-in object goals - obj-y 1573.2 Built-in object goals - obj-y
158---------------------------------
150 159
151 The kbuild Makefile specifies object files for vmlinux 160 The kbuild Makefile specifies object files for vmlinux
152 in the $(obj-y) lists. These lists depend on the kernel 161 in the $(obj-y) lists. These lists depend on the kernel
@@ -167,14 +176,16 @@ more details, with real examples.
167 order may e.g. change the order in which your SCSI 176 order may e.g. change the order in which your SCSI
168 controllers are detected, and thus your disks are renumbered. 177 controllers are detected, and thus your disks are renumbered.
169 178
170 Example: 179 Example::
180
171 #drivers/isdn/i4l/Makefile 181 #drivers/isdn/i4l/Makefile
172 # Makefile for the kernel ISDN subsystem and device drivers. 182 # Makefile for the kernel ISDN subsystem and device drivers.
173 # Each configuration option enables a list of files. 183 # Each configuration option enables a list of files.
174 obj-$(CONFIG_ISDN_I4L) += isdn.o 184 obj-$(CONFIG_ISDN_I4L) += isdn.o
175 obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o 185 obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
176 186
177--- 3.3 Loadable module goals - obj-m 1873.3 Loadable module goals - obj-m
188---------------------------------
178 189
179 $(obj-m) specifies object files which are built as loadable 190 $(obj-m) specifies object files which are built as loadable
180 kernel modules. 191 kernel modules.
@@ -183,7 +194,8 @@ more details, with real examples.
183 files. In the case of one source file, the kbuild makefile 194 files. In the case of one source file, the kbuild makefile
184 simply adds the file to $(obj-m). 195 simply adds the file to $(obj-m).
185 196
186 Example: 197 Example::
198
187 #drivers/isdn/i4l/Makefile 199 #drivers/isdn/i4l/Makefile
188 obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o 200 obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
189 201
@@ -195,7 +207,8 @@ more details, with real examples.
195 module from, so you have to tell it by setting a $(<module_name>-y) 207 module from, so you have to tell it by setting a $(<module_name>-y)
196 variable. 208 variable.
197 209
198 Example: 210 Example::
211
199 #drivers/isdn/i4l/Makefile 212 #drivers/isdn/i4l/Makefile
200 obj-$(CONFIG_ISDN_I4L) += isdn.o 213 obj-$(CONFIG_ISDN_I4L) += isdn.o
201 isdn-y := isdn_net_lib.o isdn_v110.o isdn_common.o 214 isdn-y := isdn_net_lib.o isdn_v110.o isdn_common.o
@@ -205,10 +218,11 @@ more details, with real examples.
205 "$(LD) -r" on the list of these files to generate isdn.o. 218 "$(LD) -r" on the list of these files to generate isdn.o.
206 219
207 Due to kbuild recognizing $(<module_name>-y) for composite objects, 220 Due to kbuild recognizing $(<module_name>-y) for composite objects,
208 you can use the value of a CONFIG_ symbol to optionally include an 221 you can use the value of a `CONFIG_` symbol to optionally include an
209 object file as part of a composite object. 222 object file as part of a composite object.
210 223
211 Example: 224 Example::
225
212 #fs/ext2/Makefile 226 #fs/ext2/Makefile
213 obj-$(CONFIG_EXT2_FS) += ext2.o 227 obj-$(CONFIG_EXT2_FS) += ext2.o
214 ext2-y := balloc.o dir.o file.o ialloc.o inode.o ioctl.o \ 228 ext2-y := balloc.o dir.o file.o ialloc.o inode.o ioctl.o \
@@ -225,12 +239,14 @@ more details, with real examples.
225 kbuild will build an ext2.o file for you out of the individual 239 kbuild will build an ext2.o file for you out of the individual
226 parts and then link this into built-in.a, as you would expect. 240 parts and then link this into built-in.a, as you would expect.
227 241
228--- 3.4 Objects which export symbols 2423.4 Objects which export symbols
243--------------------------------
229 244
230 No special notation is required in the makefiles for 245 No special notation is required in the makefiles for
231 modules exporting symbols. 246 modules exporting symbols.
232 247
233--- 3.5 Library file goals - lib-y 2483.5 Library file goals - lib-y
249------------------------------
234 250
235 Objects listed with obj-* are used for modules, or 251 Objects listed with obj-* are used for modules, or
236 combined in a built-in.a for that specific directory. 252 combined in a built-in.a for that specific directory.
@@ -247,18 +263,21 @@ more details, with real examples.
247 and to be part of a library. Therefore the same directory 263 and to be part of a library. Therefore the same directory
248 may contain both a built-in.a and a lib.a file. 264 may contain both a built-in.a and a lib.a file.
249 265
250 Example: 266 Example::
267
251 #arch/x86/lib/Makefile 268 #arch/x86/lib/Makefile
252 lib-y := delay.o 269 lib-y := delay.o
253 270
254 This will create a library lib.a based on delay.o. For kbuild to 271 This will create a library lib.a based on delay.o. For kbuild to
255 actually recognize that there is a lib.a being built, the directory 272 actually recognize that there is a lib.a being built, the directory
256 shall be listed in libs-y. 273 shall be listed in libs-y.
274
257 See also "6.4 List directories to visit when descending". 275 See also "6.4 List directories to visit when descending".
258 276
259 Use of lib-y is normally restricted to lib/ and arch/*/lib. 277 Use of lib-y is normally restricted to `lib/` and `arch/*/lib`.
260 278
261--- 3.6 Descending down in directories 2793.6 Descending down in directories
280----------------------------------
262 281
263 A Makefile is only responsible for building objects in its own 282 A Makefile is only responsible for building objects in its own
264 directory. Files in subdirectories should be taken care of by 283 directory. Files in subdirectories should be taken care of by
@@ -270,7 +289,8 @@ more details, with real examples.
270 ext2 lives in a separate directory, and the Makefile present in fs/ 289 ext2 lives in a separate directory, and the Makefile present in fs/
271 tells kbuild to descend down using the following assignment. 290 tells kbuild to descend down using the following assignment.
272 291
273 Example: 292 Example::
293
274 #fs/Makefile 294 #fs/Makefile
275 obj-$(CONFIG_EXT2_FS) += ext2/ 295 obj-$(CONFIG_EXT2_FS) += ext2/
276 296
@@ -281,11 +301,12 @@ more details, with real examples.
281 the directory, it is the Makefile in the subdirectory that 301 the directory, it is the Makefile in the subdirectory that
282 specifies what is modular and what is built-in. 302 specifies what is modular and what is built-in.
283 303
284 It is good practice to use a CONFIG_ variable when assigning directory 304 It is good practice to use a `CONFIG_` variable when assigning directory
285 names. This allows kbuild to totally skip the directory if the 305 names. This allows kbuild to totally skip the directory if the
286 corresponding CONFIG_ option is neither 'y' nor 'm'. 306 corresponding `CONFIG_` option is neither 'y' nor 'm'.
287 307
288--- 3.7 Compilation flags 3083.7 Compilation flags
309---------------------
289 310
290 ccflags-y, asflags-y and ldflags-y 311 ccflags-y, asflags-y and ldflags-y
291 These three flags apply only to the kbuild makefile in which they 312 These three flags apply only to the kbuild makefile in which they
@@ -297,7 +318,8 @@ more details, with real examples.
297 318
298 ccflags-y specifies options for compiling with $(CC). 319 ccflags-y specifies options for compiling with $(CC).
299 320
300 Example: 321 Example::
322
301 # drivers/acpi/acpica/Makefile 323 # drivers/acpi/acpica/Makefile
302 ccflags-y := -Os -D_LINUX -DBUILDING_ACPICA 324 ccflags-y := -Os -D_LINUX -DBUILDING_ACPICA
303 ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT 325 ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT
@@ -308,13 +330,15 @@ more details, with real examples.
308 330
309 asflags-y specifies options for assembling with $(AS). 331 asflags-y specifies options for assembling with $(AS).
310 332
311 Example: 333 Example::
334
312 #arch/sparc/kernel/Makefile 335 #arch/sparc/kernel/Makefile
313 asflags-y := -ansi 336 asflags-y := -ansi
314 337
315 ldflags-y specifies options for linking with $(LD). 338 ldflags-y specifies options for linking with $(LD).
316 339
317 Example: 340 Example::
341
318 #arch/cris/boot/compressed/Makefile 342 #arch/cris/boot/compressed/Makefile
319 ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds 343 ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds
320 344
@@ -325,18 +349,19 @@ more details, with real examples.
325 Options specified using subdir-* are added to the commandline before 349 Options specified using subdir-* are added to the commandline before
326 the options specified using the non-subdir variants. 350 the options specified using the non-subdir variants.
327 351
328 Example: 352 Example::
353
329 subdir-ccflags-y := -Werror 354 subdir-ccflags-y := -Werror
330 355
331 CFLAGS_$@, AFLAGS_$@ 356 CFLAGS_$@, AFLAGS_$@
332
333 CFLAGS_$@ and AFLAGS_$@ only apply to commands in current 357 CFLAGS_$@ and AFLAGS_$@ only apply to commands in current
334 kbuild makefile. 358 kbuild makefile.
335 359
336 $(CFLAGS_$@) specifies per-file options for $(CC). The $@ 360 $(CFLAGS_$@) specifies per-file options for $(CC). The $@
337 part has a literal value which specifies the file that it is for. 361 part has a literal value which specifies the file that it is for.
338 362
339 Example: 363 Example::
364
340 # drivers/scsi/Makefile 365 # drivers/scsi/Makefile
341 CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF 366 CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF
342 CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ \ 367 CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ \
@@ -347,24 +372,27 @@ more details, with real examples.
347 $(AFLAGS_$@) is a similar feature for source files in assembly 372 $(AFLAGS_$@) is a similar feature for source files in assembly
348 languages. 373 languages.
349 374
350 Example: 375 Example::
376
351 # arch/arm/kernel/Makefile 377 # arch/arm/kernel/Makefile
352 AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) 378 AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
353 AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312 379 AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
354 AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt 380 AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
355 381
356 382
357--- 3.9 Dependency tracking 3833.9 Dependency tracking
384-----------------------
358 385
359 Kbuild tracks dependencies on the following: 386 Kbuild tracks dependencies on the following:
360 1) All prerequisite files (both *.c and *.h) 387 1) All prerequisite files (both `*.c` and `*.h`)
361 2) CONFIG_ options used in all prerequisite files 388 2) `CONFIG_` options used in all prerequisite files
362 3) Command-line used to compile target 389 3) Command-line used to compile target
363 390
364 Thus, if you change an option to $(CC) all affected files will 391 Thus, if you change an option to $(CC) all affected files will
365 be re-compiled. 392 be re-compiled.
366 393
367--- 3.10 Special Rules 3943.10 Special Rules
395------------------
368 396
369 Special rules are used when the kbuild infrastructure does 397 Special rules are used when the kbuild infrastructure does
370 not provide the required support. A typical example is 398 not provide the required support. A typical example is
@@ -379,43 +407,47 @@ more details, with real examples.
379 407
380 Two variables are used when defining special rules: 408 Two variables are used when defining special rules:
381 409
382 $(src) 410 $(src)
383 $(src) is a relative path which points to the directory 411 $(src) is a relative path which points to the directory
384 where the Makefile is located. Always use $(src) when 412 where the Makefile is located. Always use $(src) when
385 referring to files located in the src tree. 413 referring to files located in the src tree.
414
415 $(obj)
416 $(obj) is a relative path which points to the directory
417 where the target is saved. Always use $(obj) when
418 referring to generated files.
386 419
387 $(obj) 420 Example::
388 $(obj) is a relative path which points to the directory
389 where the target is saved. Always use $(obj) when
390 referring to generated files.
391 421
392 Example:
393 #drivers/scsi/Makefile 422 #drivers/scsi/Makefile
394 $(obj)/53c8xx_d.h: $(src)/53c7,8xx.scr $(src)/script_asm.pl 423 $(obj)/53c8xx_d.h: $(src)/53c7,8xx.scr $(src)/script_asm.pl
395 $(CPP) -DCHIP=810 - < $< | ... $(src)/script_asm.pl 424 $(CPP) -DCHIP=810 - < $< | ... $(src)/script_asm.pl
396 425
397 This is a special rule, following the normal syntax 426 This is a special rule, following the normal syntax
398 required by make. 427 required by make.
399 The target file depends on two prerequisite files. References 428
400 to the target file are prefixed with $(obj), references 429 The target file depends on two prerequisite files. References
401 to prerequisites are referenced with $(src) (because they are not 430 to the target file are prefixed with $(obj), references
402 generated files). 431 to prerequisites are referenced with $(src) (because they are not
403 432 generated files).
404 $(kecho) 433
405 echoing information to user in a rule is often a good practice 434 $(kecho)
406 but when execution "make -s" one does not expect to see any output 435 echoing information to user in a rule is often a good practice
407 except for warnings/errors. 436 but when execution "make -s" one does not expect to see any output
408 To support this kbuild defines $(kecho) which will echo out the 437 except for warnings/errors.
409 text following $(kecho) to stdout except if "make -s" is used. 438 To support this kbuild defines $(kecho) which will echo out the
410 439 text following $(kecho) to stdout except if "make -s" is used.
411 Example: 440
441 Example::
442
412 #arch/blackfin/boot/Makefile 443 #arch/blackfin/boot/Makefile
413 $(obj)/vmImage: $(obj)/vmlinux.gz 444 $(obj)/vmImage: $(obj)/vmlinux.gz
414 $(call if_changed,uimage) 445 $(call if_changed,uimage)
415 @$(kecho) 'Kernel: $@ is ready' 446 @$(kecho) 'Kernel: $@ is ready'
416 447
417 448
418--- 3.11 $(CC) support functions 4493.11 $(CC) support functions
450----------------------------
419 451
420 The kernel may be built with several different versions of 452 The kernel may be built with several different versions of
421 $(CC), each supporting a unique set of features and options. 453 $(CC), each supporting a unique set of features and options.
@@ -425,10 +457,11 @@ more details, with real examples.
425 457
426 as-option 458 as-option
427 as-option is used to check if $(CC) -- when used to compile 459 as-option is used to check if $(CC) -- when used to compile
428 assembler (*.S) files -- supports the given option. An optional 460 assembler (`*.S`) files -- supports the given option. An optional
429 second option may be specified if the first option is not supported. 461 second option may be specified if the first option is not supported.
430 462
431 Example: 463 Example::
464
432 #arch/sh/Makefile 465 #arch/sh/Makefile
433 cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) 466 cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),)
434 467
@@ -437,6 +470,21 @@ more details, with real examples.
437 The second argument is optional, and if supplied will be used 470 The second argument is optional, and if supplied will be used
438 if first argument is not supported. 471 if first argument is not supported.
439 472
473 cc-ldoption
474 cc-ldoption is used to check if $(CC) when used to link object files
475 supports the given option. An optional second option may be
476 specified if first option are not supported.
477
478 Example::
479
480 #arch/x86/kernel/Makefile
481 vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
482
483 In the above example, vsyscall-flags will be assigned the option
484 -Wl$(comma)--hash-style=sysv if it is supported by $(CC).
485 The second argument is optional, and if supplied will be used
486 if first argument is not supported.
487
440 as-instr 488 as-instr
441 as-instr checks if the assembler reports a specific instruction 489 as-instr checks if the assembler reports a specific instruction
442 and then outputs either option1 or option2 490 and then outputs either option1 or option2
@@ -447,7 +495,8 @@ more details, with real examples.
447 cc-option is used to check if $(CC) supports a given option, and if 495 cc-option is used to check if $(CC) supports a given option, and if
448 not supported to use an optional second option. 496 not supported to use an optional second option.
449 497
450 Example: 498 Example::
499
451 #arch/x86/Makefile 500 #arch/x86/Makefile
452 cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586) 501 cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586)
453 502
@@ -461,7 +510,8 @@ more details, with real examples.
461 cc-option-yn is used to check if gcc supports a given option 510 cc-option-yn is used to check if gcc supports a given option
462 and return 'y' if supported, otherwise 'n'. 511 and return 'y' if supported, otherwise 'n'.
463 512
464 Example: 513 Example::
514
465 #arch/ppc/Makefile 515 #arch/ppc/Makefile
466 biarch := $(call cc-option-yn, -m32) 516 biarch := $(call cc-option-yn, -m32)
467 aflags-$(biarch) += -a32 517 aflags-$(biarch) += -a32
@@ -479,7 +529,8 @@ more details, with real examples.
479 because gcc 4.4 and later accept any unknown -Wno-* option and only 529 because gcc 4.4 and later accept any unknown -Wno-* option and only
480 warn about it if there is another warning in the source file. 530 warn about it if there is another warning in the source file.
481 531
482 Example: 532 Example::
533
483 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) 534 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
484 535
485 In the above example, -Wno-unused-but-set-variable will be added to 536 In the above example, -Wno-unused-but-set-variable will be added to
@@ -490,7 +541,8 @@ more details, with real examples.
490 if version expression is true, or the fifth (if given) if the version 541 if version expression is true, or the fifth (if given) if the version
491 expression is false. 542 expression is false.
492 543
493 Example: 544 Example::
545
494 #fs/reiserfs/Makefile 546 #fs/reiserfs/Makefile
495 ccflags-y := $(call cc-ifversion, -lt, 0402, -O1) 547 ccflags-y := $(call cc-ifversion, -lt, 0402, -O1)
496 548
@@ -515,7 +567,8 @@ more details, with real examples.
515 build (host arch is different from target arch). And if CROSS_COMPILE 567 build (host arch is different from target arch). And if CROSS_COMPILE
516 is already set then leave it with the old value. 568 is already set then leave it with the old value.
517 569
518 Example: 570 Example::
571
519 #arch/m68k/Makefile 572 #arch/m68k/Makefile
520 ifneq ($(SUBARCH),$(ARCH)) 573 ifneq ($(SUBARCH),$(ARCH))
521 ifeq ($(CROSS_COMPILE),) 574 ifeq ($(CROSS_COMPILE),)
@@ -523,7 +576,8 @@ more details, with real examples.
523 endif 576 endif
524 endif 577 endif
525 578
526--- 3.12 $(LD) support functions 5793.12 $(LD) support functions
580----------------------------
527 581
528 ld-option 582 ld-option
529 ld-option is used to check if $(LD) supports the supplied option. 583 ld-option is used to check if $(LD) supports the supplied option.
@@ -531,12 +585,14 @@ more details, with real examples.
531 The second argument is an optional option that can be used if the 585 The second argument is an optional option that can be used if the
532 first option is not supported by $(LD). 586 first option is not supported by $(LD).
533 587
534 Example: 588 Example::
589
535 #Makefile 590 #Makefile
536 LDFLAGS_vmlinux += $(call ld-option, -X) 591 LDFLAGS_vmlinux += $(call ld-option, -X)
537 592
538 593
539=== 4 Host Program support 5944 Host Program support
595======================
540 596
541Kbuild supports building executables on the host for use during the 597Kbuild supports building executables on the host for use during the
542compilation stage. 598compilation stage.
@@ -550,21 +606,24 @@ This can be done in two ways. Either add the dependency in a rule,
550or utilise the variable $(always). 606or utilise the variable $(always).
551Both possibilities are described in the following. 607Both possibilities are described in the following.
552 608
553--- 4.1 Simple Host Program 6094.1 Simple Host Program
610-----------------------
554 611
555 In some cases there is a need to compile and run a program on the 612 In some cases there is a need to compile and run a program on the
556 computer where the build is running. 613 computer where the build is running.
557 The following line tells kbuild that the program bin2hex shall be 614 The following line tells kbuild that the program bin2hex shall be
558 built on the build host. 615 built on the build host.
559 616
560 Example: 617 Example::
618
561 hostprogs-y := bin2hex 619 hostprogs-y := bin2hex
562 620
563 Kbuild assumes in the above example that bin2hex is made from a single 621 Kbuild assumes in the above example that bin2hex is made from a single
564 c-source file named bin2hex.c located in the same directory as 622 c-source file named bin2hex.c located in the same directory as
565 the Makefile. 623 the Makefile.
566 624
567--- 4.2 Composite Host Programs 6254.2 Composite Host Programs
626---------------------------
568 627
569 Host programs can be made up based on composite objects. 628 Host programs can be made up based on composite objects.
570 The syntax used to define composite objects for host programs is 629 The syntax used to define composite objects for host programs is
@@ -572,7 +631,8 @@ Both possibilities are described in the following.
572 $(<executable>-objs) lists all objects used to link the final 631 $(<executable>-objs) lists all objects used to link the final
573 executable. 632 executable.
574 633
575 Example: 634 Example::
635
576 #scripts/lxdialog/Makefile 636 #scripts/lxdialog/Makefile
577 hostprogs-y := lxdialog 637 hostprogs-y := lxdialog
578 lxdialog-objs := checklist.o lxdialog.o 638 lxdialog-objs := checklist.o lxdialog.o
@@ -580,16 +640,19 @@ Both possibilities are described in the following.
580 Objects with extension .o are compiled from the corresponding .c 640 Objects with extension .o are compiled from the corresponding .c
581 files. In the above example, checklist.c is compiled to checklist.o 641 files. In the above example, checklist.c is compiled to checklist.o
582 and lxdialog.c is compiled to lxdialog.o. 642 and lxdialog.c is compiled to lxdialog.o.
643
583 Finally, the two .o files are linked to the executable, lxdialog. 644 Finally, the two .o files are linked to the executable, lxdialog.
584 Note: The syntax <executable>-y is not permitted for host-programs. 645 Note: The syntax <executable>-y is not permitted for host-programs.
585 646
586--- 4.3 Using C++ for host programs 6474.3 Using C++ for host programs
648-------------------------------
587 649
588 kbuild offers support for host programs written in C++. This was 650 kbuild offers support for host programs written in C++. This was
589 introduced solely to support kconfig, and is not recommended 651 introduced solely to support kconfig, and is not recommended
590 for general use. 652 for general use.
591 653
592 Example: 654 Example::
655
593 #scripts/kconfig/Makefile 656 #scripts/kconfig/Makefile
594 hostprogs-y := qconf 657 hostprogs-y := qconf
595 qconf-cxxobjs := qconf.o 658 qconf-cxxobjs := qconf.o
@@ -600,13 +663,15 @@ Both possibilities are described in the following.
600 If qconf is composed of a mixture of .c and .cc files, then an 663 If qconf is composed of a mixture of .c and .cc files, then an
601 additional line can be used to identify this. 664 additional line can be used to identify this.
602 665
603 Example: 666 Example::
667
604 #scripts/kconfig/Makefile 668 #scripts/kconfig/Makefile
605 hostprogs-y := qconf 669 hostprogs-y := qconf
606 qconf-cxxobjs := qconf.o 670 qconf-cxxobjs := qconf.o
607 qconf-objs := check.o 671 qconf-objs := check.o
608 672
609--- 4.4 Controlling compiler options for host programs 6734.4 Controlling compiler options for host programs
674--------------------------------------------------
610 675
611 When compiling host programs, it is possible to set specific flags. 676 When compiling host programs, it is possible to set specific flags.
612 The programs will always be compiled utilising $(HOSTCC) passed 677 The programs will always be compiled utilising $(HOSTCC) passed
@@ -614,27 +679,31 @@ Both possibilities are described in the following.
614 To set flags that will take effect for all host programs created 679 To set flags that will take effect for all host programs created
615 in that Makefile, use the variable HOST_EXTRACFLAGS. 680 in that Makefile, use the variable HOST_EXTRACFLAGS.
616 681
617 Example: 682 Example::
683
618 #scripts/lxdialog/Makefile 684 #scripts/lxdialog/Makefile
619 HOST_EXTRACFLAGS += -I/usr/include/ncurses 685 HOST_EXTRACFLAGS += -I/usr/include/ncurses
620 686
621 To set specific flags for a single file the following construction 687 To set specific flags for a single file the following construction
622 is used: 688 is used:
623 689
624 Example: 690 Example::
691
625 #arch/ppc64/boot/Makefile 692 #arch/ppc64/boot/Makefile
626 HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE) 693 HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE)
627 694
628 It is also possible to specify additional options to the linker. 695 It is also possible to specify additional options to the linker.
629 696
630 Example: 697 Example::
698
631 #scripts/kconfig/Makefile 699 #scripts/kconfig/Makefile
632 HOSTLDLIBS_qconf := -L$(QTDIR)/lib 700 HOSTLDLIBS_qconf := -L$(QTDIR)/lib
633 701
634 When linking qconf, it will be passed the extra option 702 When linking qconf, it will be passed the extra option
635 "-L$(QTDIR)/lib". 703 "-L$(QTDIR)/lib".
636 704
637--- 4.5 When host programs are actually built 7054.5 When host programs are actually built
706-----------------------------------------
638 707
639 Kbuild will only build host-programs when they are referenced 708 Kbuild will only build host-programs when they are referenced
640 as a prerequisite. 709 as a prerequisite.
@@ -642,7 +711,8 @@ Both possibilities are described in the following.
642 711
643 (1) List the prerequisite explicitly in a special rule. 712 (1) List the prerequisite explicitly in a special rule.
644 713
645 Example: 714 Example::
715
646 #drivers/pci/Makefile 716 #drivers/pci/Makefile
647 hostprogs-y := gen-devlist 717 hostprogs-y := gen-devlist
648 $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist 718 $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist
@@ -653,11 +723,13 @@ Both possibilities are described in the following.
653 the host programs in special rules must be prefixed with $(obj). 723 the host programs in special rules must be prefixed with $(obj).
654 724
655 (2) Use $(always) 725 (2) Use $(always)
726
656 When there is no suitable special rule, and the host program 727 When there is no suitable special rule, and the host program
657 shall be built when a makefile is entered, the $(always) 728 shall be built when a makefile is entered, the $(always)
658 variable shall be used. 729 variable shall be used.
659 730
660 Example: 731 Example::
732
661 #scripts/lxdialog/Makefile 733 #scripts/lxdialog/Makefile
662 hostprogs-y := lxdialog 734 hostprogs-y := lxdialog
663 always := $(hostprogs-y) 735 always := $(hostprogs-y)
@@ -665,11 +737,13 @@ Both possibilities are described in the following.
665 This will tell kbuild to build lxdialog even if not referenced in 737 This will tell kbuild to build lxdialog even if not referenced in
666 any rule. 738 any rule.
667 739
668--- 4.6 Using hostprogs-$(CONFIG_FOO) 7404.6 Using hostprogs-$(CONFIG_FOO)
741---------------------------------
669 742
670 A typical pattern in a Kbuild file looks like this: 743 A typical pattern in a Kbuild file looks like this:
671 744
672 Example: 745 Example::
746
673 #scripts/Makefile 747 #scripts/Makefile
674 hostprogs-$(CONFIG_KALLSYMS) += kallsyms 748 hostprogs-$(CONFIG_KALLSYMS) += kallsyms
675 749
@@ -679,7 +753,8 @@ Both possibilities are described in the following.
679 like hostprogs-y. But only hostprogs-y is recommended to be used 753 like hostprogs-y. But only hostprogs-y is recommended to be used
680 when no CONFIG symbols are involved. 754 when no CONFIG symbols are involved.
681 755
682=== 5 Kbuild clean infrastructure 7565 Kbuild clean infrastructure
757=============================
683 758
684"make clean" deletes most generated files in the obj tree where the kernel 759"make clean" deletes most generated files in the obj tree where the kernel
685is compiled. This includes generated files such as host programs. 760is compiled. This includes generated files such as host programs.
@@ -691,7 +766,8 @@ generated by kbuild are deleted all over the kernel src tree when
691 766
692Additional files can be specified in kbuild makefiles by use of $(clean-files). 767Additional files can be specified in kbuild makefiles by use of $(clean-files).
693 768
694 Example: 769 Example::
770
695 #lib/Makefile 771 #lib/Makefile
696 clean-files := crc32table.h 772 clean-files := crc32table.h
697 773
@@ -701,7 +777,8 @@ Makefile, except if prefixed with $(objtree).
701 777
702To delete a directory hierarchy use: 778To delete a directory hierarchy use:
703 779
704 Example: 780 Example::
781
705 #scripts/package/Makefile 782 #scripts/package/Makefile
706 clean-dirs := $(objtree)/debian/ 783 clean-dirs := $(objtree)/debian/
707 784
@@ -711,7 +788,8 @@ subdirectories.
711To exclude certain files from make clean, use the $(no-clean-files) variable. 788To exclude certain files from make clean, use the $(no-clean-files) variable.
712This is only a special case used in the top level Kbuild file: 789This is only a special case used in the top level Kbuild file:
713 790
714 Example: 791 Example::
792
715 #Kbuild 793 #Kbuild
716 no-clean-files := $(bounds-file) $(offsets-file) 794 no-clean-files := $(bounds-file) $(offsets-file)
717 795
@@ -719,7 +797,8 @@ Usually kbuild descends down in subdirectories due to "obj-* := dir/",
719but in the architecture makefiles where the kbuild infrastructure 797but in the architecture makefiles where the kbuild infrastructure
720is not sufficient this sometimes needs to be explicit. 798is not sufficient this sometimes needs to be explicit.
721 799
722 Example: 800 Example::
801
723 #arch/x86/boot/Makefile 802 #arch/x86/boot/Makefile
724 subdir- := compressed/ 803 subdir- := compressed/
725 804
@@ -729,7 +808,8 @@ directory compressed/ when "make clean" is executed.
729To support the clean infrastructure in the Makefiles that build the 808To support the clean infrastructure in the Makefiles that build the
730final bootimage there is an optional target named archclean: 809final bootimage there is an optional target named archclean:
731 810
732 Example: 811 Example::
812
733 #arch/x86/Makefile 813 #arch/x86/Makefile
734 archclean: 814 archclean:
735 $(Q)$(MAKE) $(clean)=arch/x86/boot 815 $(Q)$(MAKE) $(clean)=arch/x86/boot
@@ -745,7 +825,8 @@ is not operational at that point.
745Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will 825Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will
746be visited during "make clean". 826be visited during "make clean".
747 827
748=== 6 Architecture Makefiles 8286 Architecture Makefiles
829========================
749 830
750The top level Makefile sets up the environment and does the preparation, 831The top level Makefile sets up the environment and does the preparation,
751before starting to descend down in the individual directories. 832before starting to descend down in the individual directories.
@@ -756,6 +837,7 @@ To do so, arch/$(ARCH)/Makefile sets up a number of variables and defines
756a few targets. 837a few targets.
757 838
758When kbuild executes, the following steps are followed (roughly): 839When kbuild executes, the following steps are followed (roughly):
840
7591) Configuration of the kernel => produce .config 8411) Configuration of the kernel => produce .config
7602) Store kernel version in include/linux/version.h 8422) Store kernel version in include/linux/version.h
7613) Updating all other prerequisites to the target prepare: 8433) Updating all other prerequisites to the target prepare:
@@ -773,37 +855,45 @@ When kbuild executes, the following steps are followed (roughly):
773 - Preparing initrd images and the like 855 - Preparing initrd images and the like
774 856
775 857
776--- 6.1 Set variables to tweak the build to the architecture 8586.1 Set variables to tweak the build to the architecture
859--------------------------------------------------------
777 860
778 LDFLAGS Generic $(LD) options 861 LDFLAGS
862 Generic $(LD) options
779 863
780 Flags used for all invocations of the linker. 864 Flags used for all invocations of the linker.
781 Often specifying the emulation is sufficient. 865 Often specifying the emulation is sufficient.
782 866
783 Example: 867 Example::
868
784 #arch/s390/Makefile 869 #arch/s390/Makefile
785 LDFLAGS := -m elf_s390 870 LDFLAGS := -m elf_s390
871
786 Note: ldflags-y can be used to further customise 872 Note: ldflags-y can be used to further customise
787 the flags used. See chapter 3.7. 873 the flags used. See chapter 3.7.
788 874
789 LDFLAGS_vmlinux Options for $(LD) when linking vmlinux 875 LDFLAGS_vmlinux
876 Options for $(LD) when linking vmlinux
790 877
791 LDFLAGS_vmlinux is used to specify additional flags to pass to 878 LDFLAGS_vmlinux is used to specify additional flags to pass to
792 the linker when linking the final vmlinux image. 879 the linker when linking the final vmlinux image.
793 LDFLAGS_vmlinux uses the LDFLAGS_$@ support. 880 LDFLAGS_vmlinux uses the LDFLAGS_$@ support.
794 881
795 Example: 882 Example::
883
796 #arch/x86/Makefile 884 #arch/x86/Makefile
797 LDFLAGS_vmlinux := -e stext 885 LDFLAGS_vmlinux := -e stext
798 886
799 OBJCOPYFLAGS objcopy flags 887 OBJCOPYFLAGS
888 objcopy flags
800 889
801 When $(call if_changed,objcopy) is used to translate a .o file, 890 When $(call if_changed,objcopy) is used to translate a .o file,
802 the flags specified in OBJCOPYFLAGS will be used. 891 the flags specified in OBJCOPYFLAGS will be used.
803 $(call if_changed,objcopy) is often used to generate raw binaries on 892 $(call if_changed,objcopy) is often used to generate raw binaries on
804 vmlinux. 893 vmlinux.
805 894
806 Example: 895 Example::
896
807 #arch/s390/Makefile 897 #arch/s390/Makefile
808 OBJCOPYFLAGS := -O binary 898 OBJCOPYFLAGS := -O binary
809 899
@@ -814,30 +904,34 @@ When kbuild executes, the following steps are followed (roughly):
814 In this example, the binary $(obj)/image is a binary version of 904 In this example, the binary $(obj)/image is a binary version of
815 vmlinux. The usage of $(call if_changed,xxx) will be described later. 905 vmlinux. The usage of $(call if_changed,xxx) will be described later.
816 906
817 KBUILD_AFLAGS $(AS) assembler flags 907 KBUILD_AFLAGS
908 $(AS) assembler flags
818 909
819 Default value - see top level Makefile 910 Default value - see top level Makefile
820 Append or modify as required per architecture. 911 Append or modify as required per architecture.
821 912
822 Example: 913 Example::
914
823 #arch/sparc64/Makefile 915 #arch/sparc64/Makefile
824 KBUILD_AFLAGS += -m64 -mcpu=ultrasparc 916 KBUILD_AFLAGS += -m64 -mcpu=ultrasparc
825 917
826 KBUILD_CFLAGS $(CC) compiler flags 918 KBUILD_CFLAGS
919 $(CC) compiler flags
827 920
828 Default value - see top level Makefile 921 Default value - see top level Makefile
829 Append or modify as required per architecture. 922 Append or modify as required per architecture.
830 923
831 Often, the KBUILD_CFLAGS variable depends on the configuration. 924 Often, the KBUILD_CFLAGS variable depends on the configuration.
832 925
833 Example: 926 Example::
927
834 #arch/x86/boot/compressed/Makefile 928 #arch/x86/boot/compressed/Makefile
835 cflags-$(CONFIG_X86_32) := -march=i386 929 cflags-$(CONFIG_X86_32) := -march=i386
836 cflags-$(CONFIG_X86_64) := -mcmodel=small 930 cflags-$(CONFIG_X86_64) := -mcmodel=small
837 KBUILD_CFLAGS += $(cflags-y) 931 KBUILD_CFLAGS += $(cflags-y)
838 932
839 Many arch Makefiles dynamically run the target C compiler to 933 Many arch Makefiles dynamically run the target C compiler to
840 probe supported options: 934 probe supported options::
841 935
842 #arch/x86/Makefile 936 #arch/x86/Makefile
843 937
@@ -853,32 +947,39 @@ When kbuild executes, the following steps are followed (roughly):
853 The first example utilises the trick that a config option expands 947 The first example utilises the trick that a config option expands
854 to 'y' when selected. 948 to 'y' when selected.
855 949
856 KBUILD_AFLAGS_KERNEL $(AS) options specific for built-in 950 KBUILD_AFLAGS_KERNEL
951 $(AS) options specific for built-in
857 952
858 $(KBUILD_AFLAGS_KERNEL) contains extra C compiler flags used to compile 953 $(KBUILD_AFLAGS_KERNEL) contains extra C compiler flags used to compile
859 resident kernel code. 954 resident kernel code.
860 955
861 KBUILD_AFLAGS_MODULE Options for $(AS) when building modules 956 KBUILD_AFLAGS_MODULE
957 Options for $(AS) when building modules
862 958
863 $(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that 959 $(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that
864 are used for $(AS). 960 are used for $(AS).
961
865 From commandline AFLAGS_MODULE shall be used (see kbuild.txt). 962 From commandline AFLAGS_MODULE shall be used (see kbuild.txt).
866 963
867 KBUILD_CFLAGS_KERNEL $(CC) options specific for built-in 964 KBUILD_CFLAGS_KERNEL
965 $(CC) options specific for built-in
868 966
869 $(KBUILD_CFLAGS_KERNEL) contains extra C compiler flags used to compile 967 $(KBUILD_CFLAGS_KERNEL) contains extra C compiler flags used to compile
870 resident kernel code. 968 resident kernel code.
871 969
872 KBUILD_CFLAGS_MODULE Options for $(CC) when building modules 970 KBUILD_CFLAGS_MODULE
971 Options for $(CC) when building modules
873 972
874 $(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that 973 $(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that
875 are used for $(CC). 974 are used for $(CC).
876 From commandline CFLAGS_MODULE shall be used (see kbuild.txt). 975 From commandline CFLAGS_MODULE shall be used (see kbuild.txt).
877 976
878 KBUILD_LDFLAGS_MODULE Options for $(LD) when linking modules 977 KBUILD_LDFLAGS_MODULE
978 Options for $(LD) when linking modules
879 979
880 $(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options 980 $(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options
881 used when linking modules. This is often a linker script. 981 used when linking modules. This is often a linker script.
982
882 From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). 983 From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
883 984
884 KBUILD_ARFLAGS Options for $(AR) when creating archives 985 KBUILD_ARFLAGS Options for $(AR) when creating archives
@@ -894,7 +995,8 @@ When kbuild executes, the following steps are followed (roughly):
894 means for an architecture to override the defaults. 995 means for an architecture to override the defaults.
895 996
896 997
897--- 6.2 Add prerequisites to archheaders: 9986.2 Add prerequisites to archheaders
999------------------------------------
898 1000
899 The archheaders: rule is used to generate header files that 1001 The archheaders: rule is used to generate header files that
900 may be installed into user space by "make header_install" or 1002 may be installed into user space by "make header_install" or
@@ -907,13 +1009,15 @@ When kbuild executes, the following steps are followed (roughly):
907 architecture itself. 1009 architecture itself.
908 1010
909 1011
910--- 6.3 Add prerequisites to archprepare: 10126.3 Add prerequisites to archprepare
1013------------------------------------
911 1014
912 The archprepare: rule is used to list prerequisites that need to be 1015 The archprepare: rule is used to list prerequisites that need to be
913 built before starting to descend down in the subdirectories. 1016 built before starting to descend down in the subdirectories.
914 This is usually used for header files containing assembler constants. 1017 This is usually used for header files containing assembler constants.
915 1018
916 Example: 1019 Example::
1020
917 #arch/arm/Makefile 1021 #arch/arm/Makefile
918 archprepare: maketools 1022 archprepare: maketools
919 1023
@@ -923,7 +1027,8 @@ When kbuild executes, the following steps are followed (roughly):
923 generating offset header files. 1027 generating offset header files.
924 1028
925 1029
926--- 6.4 List directories to visit when descending 10306.4 List directories to visit when descending
1031---------------------------------------------
927 1032
928 An arch Makefile cooperates with the top Makefile to define variables 1033 An arch Makefile cooperates with the top Makefile to define variables
929 which specify how to build the vmlinux file. Note that there is no 1034 which specify how to build the vmlinux file. Note that there is no
@@ -931,28 +1036,34 @@ When kbuild executes, the following steps are followed (roughly):
931 machinery is all architecture-independent. 1036 machinery is all architecture-independent.
932 1037
933 1038
934 head-y, init-y, core-y, libs-y, drivers-y, net-y 1039 head-y, init-y, core-y, libs-y, drivers-y, net-y
1040 $(head-y) lists objects to be linked first in vmlinux.
1041
1042 $(libs-y) lists directories where a lib.a archive can be located.
1043
1044 The rest list directories where a built-in.a object file can be
1045 located.
935 1046
936 $(head-y) lists objects to be linked first in vmlinux. 1047 $(init-y) objects will be located after $(head-y).
937 $(libs-y) lists directories where a lib.a archive can be located.
938 The rest list directories where a built-in.a object file can be
939 located.
940 1048
941 $(init-y) objects will be located after $(head-y). 1049 Then the rest follows in this order:
942 Then the rest follows in this order:
943 $(core-y), $(libs-y), $(drivers-y) and $(net-y).
944 1050
945 The top level Makefile defines values for all generic directories, 1051 $(core-y), $(libs-y), $(drivers-y) and $(net-y).
946 and arch/$(ARCH)/Makefile only adds architecture-specific directories. 1052
1053 The top level Makefile defines values for all generic directories,
1054 and arch/$(ARCH)/Makefile only adds architecture-specific
1055 directories.
1056
1057 Example::
947 1058
948 Example:
949 #arch/sparc64/Makefile 1059 #arch/sparc64/Makefile
950 core-y += arch/sparc64/kernel/ 1060 core-y += arch/sparc64/kernel/
951 libs-y += arch/sparc64/prom/ arch/sparc64/lib/ 1061 libs-y += arch/sparc64/prom/ arch/sparc64/lib/
952 drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/ 1062 drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/
953 1063
954 1064
955--- 6.5 Architecture-specific boot images 10656.5 Architecture-specific boot images
1066-------------------------------------
956 1067
957 An arch Makefile specifies goals that take the vmlinux file, compress 1068 An arch Makefile specifies goals that take the vmlinux file, compress
958 it, wrap it in bootstrapping code, and copy the resulting files 1069 it, wrap it in bootstrapping code, and copy the resulting files
@@ -970,7 +1081,8 @@ When kbuild executes, the following steps are followed (roughly):
970 arch/$(ARCH)/Makefile, and use the full path when calling down 1081 arch/$(ARCH)/Makefile, and use the full path when calling down
971 into the arch/$(ARCH)/boot/Makefile. 1082 into the arch/$(ARCH)/boot/Makefile.
972 1083
973 Example: 1084 Example::
1085
974 #arch/x86/Makefile 1086 #arch/x86/Makefile
975 boot := arch/x86/boot 1087 boot := arch/x86/boot
976 bzImage: vmlinux 1088 bzImage: vmlinux
@@ -983,7 +1095,8 @@ When kbuild executes, the following steps are followed (roughly):
983 but executing "make help" will list all relevant targets. 1095 but executing "make help" will list all relevant targets.
984 To support this, $(archhelp) must be defined. 1096 To support this, $(archhelp) must be defined.
985 1097
986 Example: 1098 Example::
1099
987 #arch/x86/Makefile 1100 #arch/x86/Makefile
988 define archhelp 1101 define archhelp
989 echo '* bzImage - Image (arch/$(ARCH)/boot/bzImage)' 1102 echo '* bzImage - Image (arch/$(ARCH)/boot/bzImage)'
@@ -997,25 +1110,30 @@ When kbuild executes, the following steps are followed (roughly):
997 Add a new prerequisite to all: to select a default goal different 1110 Add a new prerequisite to all: to select a default goal different
998 from vmlinux. 1111 from vmlinux.
999 1112
1000 Example: 1113 Example::
1114
1001 #arch/x86/Makefile 1115 #arch/x86/Makefile
1002 all: bzImage 1116 all: bzImage
1003 1117
1004 When "make" is executed without arguments, bzImage will be built. 1118 When "make" is executed without arguments, bzImage will be built.
1005 1119
1006--- 6.6 Building non-kbuild targets 11206.6 Building non-kbuild targets
1121-------------------------------
1007 1122
1008 extra-y 1123 extra-y
1009
1010 extra-y specifies additional targets created in the current 1124 extra-y specifies additional targets created in the current
1011 directory, in addition to any targets specified by obj-*. 1125 directory, in addition to any targets specified by `obj-*`.
1012 1126
1013 Listing all targets in extra-y is required for two purposes: 1127 Listing all targets in extra-y is required for two purposes:
1128
1014 1) Enable kbuild to check changes in command lines 1129 1) Enable kbuild to check changes in command lines
1130
1015 - When $(call if_changed,xxx) is used 1131 - When $(call if_changed,xxx) is used
1132
1016 2) kbuild knows what files to delete during "make clean" 1133 2) kbuild knows what files to delete during "make clean"
1017 1134
1018 Example: 1135 Example::
1136
1019 #arch/x86/kernel/Makefile 1137 #arch/x86/kernel/Makefile
1020 extra-y := head.o init_task.o 1138 extra-y := head.o init_task.o
1021 1139
@@ -1023,16 +1141,17 @@ When kbuild executes, the following steps are followed (roughly):
1023 shall be built, but shall not be linked as part of built-in.a. 1141 shall be built, but shall not be linked as part of built-in.a.
1024 1142
1025 1143
1026--- 6.7 Commands useful for building a boot image 11446.7 Commands useful for building a boot image
1145---------------------------------------------
1027 1146
1028 Kbuild provides a few macros that are useful when building a 1147 Kbuild provides a few macros that are useful when building a
1029 boot image. 1148 boot image.
1030 1149
1031 if_changed 1150 if_changed
1032
1033 if_changed is the infrastructure used for the following commands. 1151 if_changed is the infrastructure used for the following commands.
1034 1152
1035 Usage: 1153 Usage::
1154
1036 target: source(s) FORCE 1155 target: source(s) FORCE
1037 $(call if_changed,ld/objcopy/gzip/...) 1156 $(call if_changed,ld/objcopy/gzip/...)
1038 1157
@@ -1050,12 +1169,16 @@ When kbuild executes, the following steps are followed (roughly):
1050 Note: It is a typical mistake to forget the FORCE prerequisite. 1169 Note: It is a typical mistake to forget the FORCE prerequisite.
1051 Another common pitfall is that whitespace is sometimes 1170 Another common pitfall is that whitespace is sometimes
1052 significant; for instance, the below will fail (note the extra space 1171 significant; for instance, the below will fail (note the extra space
1053 after the comma): 1172 after the comma)::
1173
1054 target: source(s) FORCE 1174 target: source(s) FORCE
1055 #WRONG!# $(call if_changed, ld/objcopy/gzip/...)
1056 1175
1057 Note: if_changed should not be used more than once per target. 1176 **WRONG!** $(call if_changed, ld/objcopy/gzip/...)
1177
1178 Note:
1179 if_changed should not be used more than once per target.
1058 It stores the executed command in a corresponding .cmd 1180 It stores the executed command in a corresponding .cmd
1181
1059 file and multiple calls would result in overwrites and 1182 file and multiple calls would result in overwrites and
1060 unwanted results when the target is up to date and only the 1183 unwanted results when the target is up to date and only the
1061 tests on changed commands trigger execution of commands. 1184 tests on changed commands trigger execution of commands.
@@ -1063,7 +1186,8 @@ When kbuild executes, the following steps are followed (roughly):
1063 ld 1186 ld
1064 Link target. Often, LDFLAGS_$@ is used to set specific options to ld. 1187 Link target. Often, LDFLAGS_$@ is used to set specific options to ld.
1065 1188
1066 Example: 1189 Example::
1190
1067 #arch/x86/boot/Makefile 1191 #arch/x86/boot/Makefile
1068 LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary 1192 LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
1069 LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext 1193 LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
@@ -1077,12 +1201,15 @@ When kbuild executes, the following steps are followed (roughly):
1077 LDFLAGS_$@ syntax - one for each potential target. 1201 LDFLAGS_$@ syntax - one for each potential target.
1078 $(targets) are assigned all potential targets, by which kbuild knows 1202 $(targets) are assigned all potential targets, by which kbuild knows
1079 the targets and will: 1203 the targets and will:
1204
1080 1) check for commandline changes 1205 1) check for commandline changes
1081 2) delete target during make clean 1206 2) delete target during make clean
1082 1207
1083 The ": %: %.o" part of the prerequisite is a shorthand that 1208 The ": %: %.o" part of the prerequisite is a shorthand that
1084 frees us from listing the setup.o and bootsect.o files. 1209 frees us from listing the setup.o and bootsect.o files.
1085 Note: It is a common mistake to forget the "targets :=" assignment, 1210
1211 Note:
1212 It is a common mistake to forget the "targets :=" assignment,
1086 resulting in the target file being recompiled for no 1213 resulting in the target file being recompiled for no
1087 obvious reason. 1214 obvious reason.
1088 1215
@@ -1094,7 +1221,8 @@ When kbuild executes, the following steps are followed (roughly):
1094 gzip 1221 gzip
1095 Compress target. Use maximum compression to compress target. 1222 Compress target. Use maximum compression to compress target.
1096 1223
1097 Example: 1224 Example::
1225
1098 #arch/x86/boot/compressed/Makefile 1226 #arch/x86/boot/compressed/Makefile
1099 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE 1227 $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
1100 $(call if_changed,gzip) 1228 $(call if_changed,gzip)
@@ -1105,26 +1233,30 @@ When kbuild executes, the following steps are followed (roughly):
1105 in an init section in the image. Platform code *must* copy the 1233 in an init section in the image. Platform code *must* copy the
1106 blob to non-init memory prior to calling unflatten_device_tree(). 1234 blob to non-init memory prior to calling unflatten_device_tree().
1107 1235
1108 To use this command, simply add *.dtb into obj-y or targets, or make 1236 To use this command, simply add `*.dtb` into obj-y or targets, or make
1109 some other target depend on %.dtb 1237 some other target depend on `%.dtb`
1110 1238
1111 A central rule exists to create $(obj)/%.dtb from $(src)/%.dts; 1239 A central rule exists to create `$(obj)/%.dtb` from `$(src)/%.dts`;
1112 architecture Makefiles do no need to explicitly write out that rule. 1240 architecture Makefiles do no need to explicitly write out that rule.
1113 1241
1114 Example: 1242 Example::
1243
1115 targets += $(dtb-y) 1244 targets += $(dtb-y)
1116 DTC_FLAGS ?= -p 1024 1245 DTC_FLAGS ?= -p 1024
1117 1246
1118--- 6.8 Custom kbuild commands 12476.8 Custom kbuild commands
1248--------------------------
1119 1249
1120 When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand 1250 When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand
1121 of a command is normally displayed. 1251 of a command is normally displayed.
1122 To enable this behaviour for custom commands kbuild requires 1252 To enable this behaviour for custom commands kbuild requires
1123 two variables to be set: 1253 two variables to be set::
1124 quiet_cmd_<command> - what shall be echoed 1254
1125 cmd_<command> - the command to execute 1255 quiet_cmd_<command> - what shall be echoed
1256 cmd_<command> - the command to execute
1257
1258 Example::
1126 1259
1127 Example:
1128 # 1260 #
1129 quiet_cmd_image = BUILD $@ 1261 quiet_cmd_image = BUILD $@
1130 cmd_image = $(obj)/tools/build $(BUILDFLAGS) \ 1262 cmd_image = $(obj)/tools/build $(BUILDFLAGS) \
@@ -1135,9 +1267,9 @@ When kbuild executes, the following steps are followed (roughly):
1135 $(call if_changed,image) 1267 $(call if_changed,image)
1136 @echo 'Kernel: $@ is ready' 1268 @echo 'Kernel: $@ is ready'
1137 1269
1138 When updating the $(obj)/bzImage target, the line 1270 When updating the $(obj)/bzImage target, the line:
1139 1271
1140 BUILD arch/x86/boot/bzImage 1272 BUILD arch/x86/boot/bzImage
1141 1273
1142 will be displayed with "make KBUILD_VERBOSE=0". 1274 will be displayed with "make KBUILD_VERBOSE=0".
1143 1275
@@ -1148,9 +1280,10 @@ When kbuild executes, the following steps are followed (roughly):
1148 arch/$(ARCH)/kernel/vmlinux.lds is used. 1280 arch/$(ARCH)/kernel/vmlinux.lds is used.
1149 The script is a preprocessed variant of the file vmlinux.lds.S 1281 The script is a preprocessed variant of the file vmlinux.lds.S
1150 located in the same directory. 1282 located in the same directory.
1151 kbuild knows .lds files and includes a rule *lds.S -> *lds. 1283 kbuild knows .lds files and includes a rule `*lds.S` -> `*lds`.
1284
1285 Example::
1152 1286
1153 Example:
1154 #arch/x86/kernel/Makefile 1287 #arch/x86/kernel/Makefile
1155 always := vmlinux.lds 1288 always := vmlinux.lds
1156 1289
@@ -1162,17 +1295,19 @@ When kbuild executes, the following steps are followed (roughly):
1162 The assignment to $(CPPFLAGS_vmlinux.lds) tells kbuild to use the 1295 The assignment to $(CPPFLAGS_vmlinux.lds) tells kbuild to use the
1163 specified options when building the target vmlinux.lds. 1296 specified options when building the target vmlinux.lds.
1164 1297
1165 When building the *.lds target, kbuild uses the variables: 1298 When building the `*.lds` target, kbuild uses the variables::
1166 KBUILD_CPPFLAGS : Set in top-level Makefile 1299
1167 cppflags-y : May be set in the kbuild makefile 1300 KBUILD_CPPFLAGS : Set in top-level Makefile
1168 CPPFLAGS_$(@F) : Target-specific flags. 1301 cppflags-y : May be set in the kbuild makefile
1169 Note that the full filename is used in this 1302 CPPFLAGS_$(@F) : Target-specific flags.
1170 assignment. 1303 Note that the full filename is used in this
1304 assignment.
1171 1305
1172 The kbuild infrastructure for *lds files is used in several 1306 The kbuild infrastructure for `*lds` files is used in several
1173 architecture-specific files. 1307 architecture-specific files.
1174 1308
1175--- 6.10 Generic header files 13096.10 Generic header files
1310-------------------------
1176 1311
1177 The directory include/asm-generic contains the header files 1312 The directory include/asm-generic contains the header files
1178 that may be shared between individual architectures. 1313 that may be shared between individual architectures.
@@ -1180,7 +1315,8 @@ When kbuild executes, the following steps are followed (roughly):
1180 to list the file in the Kbuild file. 1315 to list the file in the Kbuild file.
1181 See "7.2 generic-y" for further info on syntax etc. 1316 See "7.2 generic-y" for further info on syntax etc.
1182 1317
1183--- 6.11 Post-link pass 13186.11 Post-link pass
1319-------------------
1184 1320
1185 If the file arch/xxx/Makefile.postlink exists, this makefile 1321 If the file arch/xxx/Makefile.postlink exists, this makefile
1186 will be invoked for post-link objects (vmlinux and modules.ko) 1322 will be invoked for post-link objects (vmlinux and modules.ko)
@@ -1195,15 +1331,17 @@ When kbuild executes, the following steps are followed (roughly):
1195 For example, powerpc uses this to check relocation sanity of 1331 For example, powerpc uses this to check relocation sanity of
1196 the linked vmlinux file. 1332 the linked vmlinux file.
1197 1333
1198=== 7 Kbuild syntax for exported headers 13347 Kbuild syntax for exported headers
1335------------------------------------
1199 1336
1200The kernel includes a set of headers that is exported to userspace. 1337The kernel includes a set of headers that is exported to userspace.
1201Many headers can be exported as-is but other headers require a 1338Many headers can be exported as-is but other headers require a
1202minimal pre-processing before they are ready for user-space. 1339minimal pre-processing before they are ready for user-space.
1203The pre-processing does: 1340The pre-processing does:
1341
1204- drop kernel-specific annotations 1342- drop kernel-specific annotations
1205- drop include of compiler.h 1343- drop include of compiler.h
1206- drop all sections that are kernel internal (guarded by ifdef __KERNEL__) 1344- drop all sections that are kernel internal (guarded by `ifdef __KERNEL__`)
1207 1345
1208All headers under include/uapi/, include/generated/uapi/, 1346All headers under include/uapi/, include/generated/uapi/,
1209arch/<arch>/include/uapi/ and arch/<arch>/include/generated/uapi/ 1347arch/<arch>/include/uapi/ and arch/<arch>/include/generated/uapi/
@@ -1213,40 +1351,45 @@ A Kbuild file may be defined under arch/<arch>/include/uapi/asm/ and
1213arch/<arch>/include/asm/ to list asm files coming from asm-generic. 1351arch/<arch>/include/asm/ to list asm files coming from asm-generic.
1214See subsequent chapter for the syntax of the Kbuild file. 1352See subsequent chapter for the syntax of the Kbuild file.
1215 1353
1216--- 7.1 no-export-headers 13547.1 no-export-headers
1355---------------------
1217 1356
1218 no-export-headers is essentially used by include/uapi/linux/Kbuild to 1357 no-export-headers is essentially used by include/uapi/linux/Kbuild to
1219 avoid exporting specific headers (e.g. kvm.h) on architectures that do 1358 avoid exporting specific headers (e.g. kvm.h) on architectures that do
1220 not support it. It should be avoided as much as possible. 1359 not support it. It should be avoided as much as possible.
1221 1360
1222--- 7.2 generic-y 13617.2 generic-y
1362-------------
1223 1363
1224 If an architecture uses a verbatim copy of a header from 1364 If an architecture uses a verbatim copy of a header from
1225 include/asm-generic then this is listed in the file 1365 include/asm-generic then this is listed in the file
1226 arch/$(ARCH)/include/asm/Kbuild like this: 1366 arch/$(ARCH)/include/asm/Kbuild like this:
1227 1367
1228 Example: 1368 Example::
1369
1229 #arch/x86/include/asm/Kbuild 1370 #arch/x86/include/asm/Kbuild
1230 generic-y += termios.h 1371 generic-y += termios.h
1231 generic-y += rtc.h 1372 generic-y += rtc.h
1232 1373
1233 During the prepare phase of the build a wrapper include 1374 During the prepare phase of the build a wrapper include
1234 file is generated in the directory: 1375 file is generated in the directory::
1235 1376
1236 arch/$(ARCH)/include/generated/asm 1377 arch/$(ARCH)/include/generated/asm
1237 1378
1238 When a header is exported where the architecture uses 1379 When a header is exported where the architecture uses
1239 the generic header a similar wrapper is generated as part 1380 the generic header a similar wrapper is generated as part
1240 of the set of exported headers in the directory: 1381 of the set of exported headers in the directory::
1241 1382
1242 usr/include/asm 1383 usr/include/asm
1243 1384
1244 The generated wrapper will in both cases look like the following: 1385 The generated wrapper will in both cases look like the following:
1245 1386
1246 Example: termios.h 1387 Example: termios.h::
1388
1247 #include <asm-generic/termios.h> 1389 #include <asm-generic/termios.h>
1248 1390
1249--- 7.3 generated-y 13917.3 generated-y
1392---------------
1250 1393
1251 If an architecture generates other header files alongside generic-y 1394 If an architecture generates other header files alongside generic-y
1252 wrappers, generated-y specifies them. 1395 wrappers, generated-y specifies them.
@@ -1254,11 +1397,13 @@ See subsequent chapter for the syntax of the Kbuild file.
1254 This prevents them being treated as stale asm-generic wrappers and 1397 This prevents them being treated as stale asm-generic wrappers and
1255 removed. 1398 removed.
1256 1399
1257 Example: 1400 Example::
1401
1258 #arch/x86/include/asm/Kbuild 1402 #arch/x86/include/asm/Kbuild
1259 generated-y += syscalls_32.h 1403 generated-y += syscalls_32.h
1260 1404
1261--- 7.4 mandatory-y 14057.4 mandatory-y
1406---------------
1262 1407
1263 mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild 1408 mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild
1264 to define the minimum set of ASM headers that all architectures must have. 1409 to define the minimum set of ASM headers that all architectures must have.
@@ -1270,12 +1415,12 @@ See subsequent chapter for the syntax of the Kbuild file.
1270 The convention is to list one subdir per line and 1415 The convention is to list one subdir per line and
1271 preferably in alphabetic order. 1416 preferably in alphabetic order.
1272 1417
1273=== 8 Kbuild Variables 14188 Kbuild Variables
1419==================
1274 1420
1275The top Makefile exports the following variables: 1421The top Makefile exports the following variables:
1276 1422
1277 VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION 1423 VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
1278
1279 These variables define the current kernel version. A few arch 1424 These variables define the current kernel version. A few arch
1280 Makefiles actually use these values directly; they should use 1425 Makefiles actually use these values directly; they should use
1281 $(KERNELRELEASE) instead. 1426 $(KERNELRELEASE) instead.
@@ -1289,32 +1434,28 @@ The top Makefile exports the following variables:
1289 such as "-pre4", and is often blank. 1434 such as "-pre4", and is often blank.
1290 1435
1291 KERNELRELEASE 1436 KERNELRELEASE
1292
1293 $(KERNELRELEASE) is a single string such as "2.4.0-pre4", suitable 1437 $(KERNELRELEASE) is a single string such as "2.4.0-pre4", suitable
1294 for constructing installation directory names or showing in 1438 for constructing installation directory names or showing in
1295 version strings. Some arch Makefiles use it for this purpose. 1439 version strings. Some arch Makefiles use it for this purpose.
1296 1440
1297 ARCH 1441 ARCH
1298
1299 This variable defines the target architecture, such as "i386", 1442 This variable defines the target architecture, such as "i386",
1300 "arm", or "sparc". Some kbuild Makefiles test $(ARCH) to 1443 "arm", or "sparc". Some kbuild Makefiles test $(ARCH) to
1301 determine which files to compile. 1444 determine which files to compile.
1302 1445
1303 By default, the top Makefile sets $(ARCH) to be the same as the 1446 By default, the top Makefile sets $(ARCH) to be the same as the
1304 host system architecture. For a cross build, a user may 1447 host system architecture. For a cross build, a user may
1305 override the value of $(ARCH) on the command line: 1448 override the value of $(ARCH) on the command line::
1306 1449
1307 make ARCH=m68k ... 1450 make ARCH=m68k ...
1308 1451
1309 1452
1310 INSTALL_PATH 1453 INSTALL_PATH
1311
1312 This variable defines a place for the arch Makefiles to install 1454 This variable defines a place for the arch Makefiles to install
1313 the resident kernel image and System.map file. 1455 the resident kernel image and System.map file.
1314 Use this for architecture-specific install targets. 1456 Use this for architecture-specific install targets.
1315 1457
1316 INSTALL_MOD_PATH, MODLIB 1458 INSTALL_MOD_PATH, MODLIB
1317
1318 $(INSTALL_MOD_PATH) specifies a prefix to $(MODLIB) for module 1459 $(INSTALL_MOD_PATH) specifies a prefix to $(MODLIB) for module
1319 installation. This variable is not defined in the Makefile but 1460 installation. This variable is not defined in the Makefile but
1320 may be passed in by the user if desired. 1461 may be passed in by the user if desired.
@@ -1325,7 +1466,6 @@ The top Makefile exports the following variables:
1325 override this value on the command line if desired. 1466 override this value on the command line if desired.
1326 1467
1327 INSTALL_MOD_STRIP 1468 INSTALL_MOD_STRIP
1328
1329 If this variable is specified, it will cause modules to be stripped 1469 If this variable is specified, it will cause modules to be stripped
1330 after they are installed. If INSTALL_MOD_STRIP is '1', then the 1470 after they are installed. If INSTALL_MOD_STRIP is '1', then the
1331 default option --strip-debug will be used. Otherwise, the 1471 default option --strip-debug will be used. Otherwise, the
@@ -1333,7 +1473,8 @@ The top Makefile exports the following variables:
1333 command. 1473 command.
1334 1474
1335 1475
1336=== 9 Makefile language 14769 Makefile language
1477===================
1337 1478
1338The kernel Makefiles are designed to be run with GNU Make. The Makefiles 1479The kernel Makefiles are designed to be run with GNU Make. The Makefiles
1339use only the documented features of GNU Make, but they do use many 1480use only the documented features of GNU Make, but they do use many
@@ -1352,18 +1493,17 @@ time the left-hand side is used.
1352There are some cases where "=" is appropriate. Usually, though, ":=" 1493There are some cases where "=" is appropriate. Usually, though, ":="
1353is the right choice. 1494is the right choice.
1354 1495
1355=== 10 Credits 149610 Credits
1497==========
1356 1498
1357Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net> 1499- Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net>
1358Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> 1500- Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
1359Updates by Sam Ravnborg <sam@ravnborg.org> 1501- Updates by Sam Ravnborg <sam@ravnborg.org>
1360Language QA by Jan Engelhardt <jengelh@gmx.de> 1502- Language QA by Jan Engelhardt <jengelh@gmx.de>
1361 1503
1362=== 11 TODO 150411 TODO
1505=======
1363 1506
1364- Describe how kbuild supports shipped files with _shipped. 1507- Describe how kbuild supports shipped files with _shipped.
1365- Generating offset header files. 1508- Generating offset header files.
1366- Add more variables to section 7? 1509- Add more variables to section 7?
1367
1368
1369
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.rst
index 80295c613e37..24e763482650 100644
--- a/Documentation/kbuild/modules.txt
+++ b/Documentation/kbuild/modules.rst
@@ -1,8 +1,10 @@
1=========================
1Building External Modules 2Building External Modules
3=========================
2 4
3This document describes how to build an out-of-tree kernel module. 5This document describes how to build an out-of-tree kernel module.
4 6
5=== Table of Contents 7.. Table of Contents
6 8
7 === 1 Introduction 9 === 1 Introduction
8 === 2 How to Build External Modules 10 === 2 How to Build External Modules
@@ -31,7 +33,8 @@ This document describes how to build an out-of-tree kernel module.
31 33
32 34
33 35
34=== 1. Introduction 361. Introduction
37===============
35 38
36"kbuild" is the build system used by the Linux kernel. Modules must use 39"kbuild" is the build system used by the Linux kernel. Modules must use
37kbuild to stay compatible with changes in the build infrastructure and 40kbuild to stay compatible with changes in the build infrastructure and
@@ -48,7 +51,8 @@ easily accomplished, and a complete example will be presented in
48section 3. 51section 3.
49 52
50 53
51=== 2. How to Build External Modules 542. How to Build External Modules
55================================
52 56
53To build external modules, you must have a prebuilt kernel available 57To build external modules, you must have a prebuilt kernel available
54that contains the configuration and header files used in the build. 58that contains the configuration and header files used in the build.
@@ -65,25 +69,27 @@ NOTE: "modules_prepare" will not build Module.symvers even if
65CONFIG_MODVERSIONS is set; therefore, a full kernel build needs to be 69CONFIG_MODVERSIONS is set; therefore, a full kernel build needs to be
66executed to make module versioning work. 70executed to make module versioning work.
67 71
68--- 2.1 Command Syntax 722.1 Command Syntax
73==================
69 74
70 The command to build an external module is: 75 The command to build an external module is::
71 76
72 $ make -C <path_to_kernel_src> M=$PWD 77 $ make -C <path_to_kernel_src> M=$PWD
73 78
74 The kbuild system knows that an external module is being built 79 The kbuild system knows that an external module is being built
75 due to the "M=<dir>" option given in the command. 80 due to the "M=<dir>" option given in the command.
76 81
77 To build against the running kernel use: 82 To build against the running kernel use::
78 83
79 $ make -C /lib/modules/`uname -r`/build M=$PWD 84 $ make -C /lib/modules/`uname -r`/build M=$PWD
80 85
81 Then to install the module(s) just built, add the target 86 Then to install the module(s) just built, add the target
82 "modules_install" to the command: 87 "modules_install" to the command::
83 88
84 $ make -C /lib/modules/`uname -r`/build M=$PWD modules_install 89 $ make -C /lib/modules/`uname -r`/build M=$PWD modules_install
85 90
86--- 2.2 Options 912.2 Options
92===========
87 93
88 ($KDIR refers to the path of the kernel source directory.) 94 ($KDIR refers to the path of the kernel source directory.)
89 95
@@ -100,7 +106,8 @@ executed to make module versioning work.
100 directory where the external module (kbuild file) is 106 directory where the external module (kbuild file) is
101 located. 107 located.
102 108
103--- 2.3 Targets 1092.3 Targets
110===========
104 111
105 When building an external module, only a subset of the "make" 112 When building an external module, only a subset of the "make"
106 targets are available. 113 targets are available.
@@ -130,26 +137,29 @@ executed to make module versioning work.
130 help 137 help
131 List the available targets for external modules. 138 List the available targets for external modules.
132 139
133--- 2.4 Building Separate Files 1402.4 Building Separate Files
141===========================
134 142
135 It is possible to build single files that are part of a module. 143 It is possible to build single files that are part of a module.
136 This works equally well for the kernel, a module, and even for 144 This works equally well for the kernel, a module, and even for
137 external modules. 145 external modules.
138 146
139 Example (The module foo.ko, consist of bar.o and baz.o): 147 Example (The module foo.ko, consist of bar.o and baz.o)::
148
140 make -C $KDIR M=$PWD bar.lst 149 make -C $KDIR M=$PWD bar.lst
141 make -C $KDIR M=$PWD baz.o 150 make -C $KDIR M=$PWD baz.o
142 make -C $KDIR M=$PWD foo.ko 151 make -C $KDIR M=$PWD foo.ko
143 make -C $KDIR M=$PWD ./ 152 make -C $KDIR M=$PWD ./
144 153
145 154
146=== 3. Creating a Kbuild File for an External Module 1553. Creating a Kbuild File for an External Module
156================================================
147 157
148In the last section we saw the command to build a module for the 158In the last section we saw the command to build a module for the
149running kernel. The module is not actually built, however, because a 159running kernel. The module is not actually built, however, because a
150build file is required. Contained in this file will be the name of 160build file is required. Contained in this file will be the name of
151the module(s) being built, along with the list of requisite source 161the module(s) being built, along with the list of requisite source
152files. The file may be as simple as a single line: 162files. The file may be as simple as a single line::
153 163
154 obj-m := <module_name>.o 164 obj-m := <module_name>.o
155 165
@@ -157,15 +167,15 @@ The kbuild system will build <module_name>.o from <module_name>.c,
157and, after linking, will result in the kernel module <module_name>.ko. 167and, after linking, will result in the kernel module <module_name>.ko.
158The above line can be put in either a "Kbuild" file or a "Makefile." 168The above line can be put in either a "Kbuild" file or a "Makefile."
159When the module is built from multiple sources, an additional line is 169When the module is built from multiple sources, an additional line is
160needed listing the files: 170needed listing the files::
161 171
162 <module_name>-y := <src1>.o <src2>.o ... 172 <module_name>-y := <src1>.o <src2>.o ...
163 173
164NOTE: Further documentation describing the syntax used by kbuild is 174NOTE: Further documentation describing the syntax used by kbuild is
165located in Documentation/kbuild/makefiles.txt. 175located in Documentation/kbuild/makefiles.rst.
166 176
167The examples below demonstrate how to create a build file for the 177The examples below demonstrate how to create a build file for the
168module 8123.ko, which is built from the following files: 178module 8123.ko, which is built from the following files::
169 179
170 8123_if.c 180 8123_if.c
171 8123_if.h 181 8123_if.h
@@ -181,7 +191,8 @@ module 8123.ko, which is built from the following files:
181 but should be filtered out from kbuild due to possible name 191 but should be filtered out from kbuild due to possible name
182 clashes. 192 clashes.
183 193
184 Example 1: 194 Example 1::
195
185 --> filename: Makefile 196 --> filename: Makefile
186 ifneq ($(KERNELRELEASE),) 197 ifneq ($(KERNELRELEASE),)
187 # kbuild part of makefile 198 # kbuild part of makefile
@@ -209,14 +220,16 @@ module 8123.ko, which is built from the following files:
209 line; the second pass is by the kbuild system, which is 220 line; the second pass is by the kbuild system, which is
210 initiated by the parameterized "make" in the default target. 221 initiated by the parameterized "make" in the default target.
211 222
212--- 3.2 Separate Kbuild File and Makefile 2233.2 Separate Kbuild File and Makefile
224-------------------------------------
213 225
214 In newer versions of the kernel, kbuild will first look for a 226 In newer versions of the kernel, kbuild will first look for a
215 file named "Kbuild," and only if that is not found, will it 227 file named "Kbuild," and only if that is not found, will it
216 then look for a makefile. Utilizing a "Kbuild" file allows us 228 then look for a makefile. Utilizing a "Kbuild" file allows us
217 to split up the makefile from example 1 into two files: 229 to split up the makefile from example 1 into two files:
218 230
219 Example 2: 231 Example 2::
232
220 --> filename: Kbuild 233 --> filename: Kbuild
221 obj-m := 8123.o 234 obj-m := 8123.o
222 8123-y := 8123_if.o 8123_pci.o 8123_bin.o 235 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
@@ -238,7 +251,8 @@ module 8123.ko, which is built from the following files:
238 251
239 The next example shows a backward compatible version. 252 The next example shows a backward compatible version.
240 253
241 Example 3: 254 Example 3::
255
242 --> filename: Kbuild 256 --> filename: Kbuild
243 obj-m := 8123.o 257 obj-m := 8123.o
244 8123-y := 8123_if.o 8123_pci.o 8123_bin.o 258 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
@@ -266,7 +280,8 @@ module 8123.ko, which is built from the following files:
266 makefiles, to be used when the "make" and kbuild parts are 280 makefiles, to be used when the "make" and kbuild parts are
267 split into separate files. 281 split into separate files.
268 282
269--- 3.3 Binary Blobs 2833.3 Binary Blobs
284----------------
270 285
271 Some external modules need to include an object file as a blob. 286 Some external modules need to include an object file as a blob.
272 kbuild has support for this, but requires the blob file to be 287 kbuild has support for this, but requires the blob file to be
@@ -277,7 +292,7 @@ module 8123.ko, which is built from the following files:
277 292
278 Throughout this section, 8123_bin.o_shipped has been used to 293 Throughout this section, 8123_bin.o_shipped has been used to
279 build the kernel module 8123.ko; it has been included as 294 build the kernel module 8123.ko; it has been included as
280 8123_bin.o. 295 8123_bin.o::
281 296
282 8123-y := 8123_if.o 8123_pci.o 8123_bin.o 297 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
283 298
@@ -285,11 +300,12 @@ module 8123.ko, which is built from the following files:
285 files and the binary file, kbuild will pick up different rules 300 files and the binary file, kbuild will pick up different rules
286 when creating the object file for the module. 301 when creating the object file for the module.
287 302
288--- 3.4 Building Multiple Modules 3033.4 Building Multiple Modules
304=============================
289 305
290 kbuild supports building multiple modules with a single build 306 kbuild supports building multiple modules with a single build
291 file. For example, if you wanted to build two modules, foo.ko 307 file. For example, if you wanted to build two modules, foo.ko
292 and bar.ko, the kbuild lines would be: 308 and bar.ko, the kbuild lines would be::
293 309
294 obj-m := foo.o bar.o 310 obj-m := foo.o bar.o
295 foo-y := <foo_srcs> 311 foo-y := <foo_srcs>
@@ -298,7 +314,8 @@ module 8123.ko, which is built from the following files:
298 It is that simple! 314 It is that simple!
299 315
300 316
301=== 4. Include Files 3174. Include Files
318================
302 319
303Within the kernel, header files are kept in standard locations 320Within the kernel, header files are kept in standard locations
304according to the following rule: 321according to the following rule:
@@ -310,22 +327,25 @@ according to the following rule:
310 of the kernel that are located in different directories, then 327 of the kernel that are located in different directories, then
311 the file is placed in include/linux/. 328 the file is placed in include/linux/.
312 329
313 NOTE: There are two notable exceptions to this rule: larger 330 NOTE:
314 subsystems have their own directory under include/, such as 331 There are two notable exceptions to this rule: larger
315 include/scsi; and architecture specific headers are located 332 subsystems have their own directory under include/, such as
316 under arch/$(ARCH)/include/. 333 include/scsi; and architecture specific headers are located
334 under arch/$(ARCH)/include/.
317 335
318--- 4.1 Kernel Includes 3364.1 Kernel Includes
337-------------------
319 338
320 To include a header file located under include/linux/, simply 339 To include a header file located under include/linux/, simply
321 use: 340 use::
322 341
323 #include <linux/module.h> 342 #include <linux/module.h>
324 343
325 kbuild will add options to "gcc" so the relevant directories 344 kbuild will add options to "gcc" so the relevant directories
326 are searched. 345 are searched.
327 346
328--- 4.2 Single Subdirectory 3474.2 Single Subdirectory
348-----------------------
329 349
330 External modules tend to place header files in a separate 350 External modules tend to place header files in a separate
331 include/ directory where their source is located, although this 351 include/ directory where their source is located, although this
@@ -334,7 +354,7 @@ according to the following rule:
334 354
335 Using the example from section 3, if we moved 8123_if.h to a 355 Using the example from section 3, if we moved 8123_if.h to a
336 subdirectory named include, the resulting kbuild file would 356 subdirectory named include, the resulting kbuild file would
337 look like: 357 look like::
338 358
339 --> filename: Kbuild 359 --> filename: Kbuild
340 obj-m := 8123.o 360 obj-m := 8123.o
@@ -346,23 +366,24 @@ according to the following rule:
346 the path. This is a limitation of kbuild: there must be no 366 the path. This is a limitation of kbuild: there must be no
347 space present. 367 space present.
348 368
349--- 4.3 Several Subdirectories 3694.3 Several Subdirectories
370--------------------------
350 371
351 kbuild can handle files that are spread over several directories. 372 kbuild can handle files that are spread over several directories.
352 Consider the following example: 373 Consider the following example::
353 374
354 . 375 .
355 |__ src 376 |__ src
356 | |__ complex_main.c 377 | |__ complex_main.c
357 | |__ hal 378 | |__ hal
358 | |__ hardwareif.c 379 | |__ hardwareif.c
359 | |__ include 380 | |__ include
360 | |__ hardwareif.h 381 | |__ hardwareif.h
361 |__ include 382 |__ include
362 |__ complex.h 383 |__ complex.h
363 384
364 To build the module complex.ko, we then need the following 385 To build the module complex.ko, we then need the following
365 kbuild file: 386 kbuild file::
366 387
367 --> filename: Kbuild 388 --> filename: Kbuild
368 obj-m := complex.o 389 obj-m := complex.o
@@ -385,7 +406,8 @@ according to the following rule:
385 file is located. 406 file is located.
386 407
387 408
388=== 5. Module Installation 4095. Module Installation
410======================
389 411
390Modules which are included in the kernel are installed in the 412Modules which are included in the kernel are installed in the
391directory: 413directory:
@@ -396,11 +418,12 @@ And external modules are installed in:
396 418
397 /lib/modules/$(KERNELRELEASE)/extra/ 419 /lib/modules/$(KERNELRELEASE)/extra/
398 420
399--- 5.1 INSTALL_MOD_PATH 4215.1 INSTALL_MOD_PATH
422--------------------
400 423
401 Above are the default directories but as always some level of 424 Above are the default directories but as always some level of
402 customization is possible. A prefix can be added to the 425 customization is possible. A prefix can be added to the
403 installation path using the variable INSTALL_MOD_PATH: 426 installation path using the variable INSTALL_MOD_PATH::
404 427
405 $ make INSTALL_MOD_PATH=/frodo modules_install 428 $ make INSTALL_MOD_PATH=/frodo modules_install
406 => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel/ 429 => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel/
@@ -410,20 +433,22 @@ And external modules are installed in:
410 calling "make." This has effect when installing both in-tree 433 calling "make." This has effect when installing both in-tree
411 and out-of-tree modules. 434 and out-of-tree modules.
412 435
413--- 5.2 INSTALL_MOD_DIR 4365.2 INSTALL_MOD_DIR
437-------------------
414 438
415 External modules are by default installed to a directory under 439 External modules are by default installed to a directory under
416 /lib/modules/$(KERNELRELEASE)/extra/, but you may wish to 440 /lib/modules/$(KERNELRELEASE)/extra/, but you may wish to
417 locate modules for a specific functionality in a separate 441 locate modules for a specific functionality in a separate
418 directory. For this purpose, use INSTALL_MOD_DIR to specify an 442 directory. For this purpose, use INSTALL_MOD_DIR to specify an
419 alternative name to "extra." 443 alternative name to "extra."::
420 444
421 $ make INSTALL_MOD_DIR=gandalf -C $KDIR \ 445 $ make INSTALL_MOD_DIR=gandalf -C $KDIR \
422 M=$PWD modules_install 446 M=$PWD modules_install
423 => Install dir: /lib/modules/$(KERNELRELEASE)/gandalf/ 447 => Install dir: /lib/modules/$(KERNELRELEASE)/gandalf/
424 448
425 449
426=== 6. Module Versioning 4506. Module Versioning
451====================
427 452
428Module versioning is enabled by the CONFIG_MODVERSIONS tag, and is used 453Module versioning is enabled by the CONFIG_MODVERSIONS tag, and is used
429as a simple ABI consistency check. A CRC value of the full prototype 454as a simple ABI consistency check. A CRC value of the full prototype
@@ -435,14 +460,16 @@ module.
435Module.symvers contains a list of all exported symbols from a kernel 460Module.symvers contains a list of all exported symbols from a kernel
436build. 461build.
437 462
438--- 6.1 Symbols From the Kernel (vmlinux + modules) 4636.1 Symbols From the Kernel (vmlinux + modules)
464-----------------------------------------------
439 465
440 During a kernel build, a file named Module.symvers will be 466 During a kernel build, a file named Module.symvers will be
441 generated. Module.symvers contains all exported symbols from 467 generated. Module.symvers contains all exported symbols from
442 the kernel and compiled modules. For each symbol, the 468 the kernel and compiled modules. For each symbol, the
443 corresponding CRC value is also stored. 469 corresponding CRC value is also stored.
444 470
445 The syntax of the Module.symvers file is: 471 The syntax of the Module.symvers file is::
472
446 <CRC> <Symbol> <module> 473 <CRC> <Symbol> <module>
447 474
448 0x2d036834 scsi_remove_host drivers/scsi/scsi_mod 475 0x2d036834 scsi_remove_host drivers/scsi/scsi_mod
@@ -451,10 +478,12 @@ build.
451 would read 0x00000000. 478 would read 0x00000000.
452 479
453 Module.symvers serves two purposes: 480 Module.symvers serves two purposes:
481
454 1) It lists all exported symbols from vmlinux and all modules. 482 1) It lists all exported symbols from vmlinux and all modules.
455 2) It lists the CRC if CONFIG_MODVERSIONS is enabled. 483 2) It lists the CRC if CONFIG_MODVERSIONS is enabled.
456 484
457--- 6.2 Symbols and External Modules 4856.2 Symbols and External Modules
486--------------------------------
458 487
459 When building an external module, the build system needs access 488 When building an external module, the build system needs access
460 to the symbols from the kernel to check if all external symbols 489 to the symbols from the kernel to check if all external symbols
@@ -481,17 +510,17 @@ build.
481 foo.ko needs symbols from bar.ko, you can use a 510 foo.ko needs symbols from bar.ko, you can use a
482 common top-level kbuild file so both modules are 511 common top-level kbuild file so both modules are
483 compiled in the same build. Consider the following 512 compiled in the same build. Consider the following
484 directory layout: 513 directory layout::
485 514
486 ./foo/ <= contains foo.ko 515 ./foo/ <= contains foo.ko
487 ./bar/ <= contains bar.ko 516 ./bar/ <= contains bar.ko
488 517
489 The top-level kbuild file would then look like: 518 The top-level kbuild file would then look like::
490 519
491 #./Kbuild (or ./Makefile): 520 #./Kbuild (or ./Makefile):
492 obj-y := foo/ bar/ 521 obj-y := foo/ bar/
493 522
494 And executing 523 And executing::
495 524
496 $ make -C $KDIR M=$PWD 525 $ make -C $KDIR M=$PWD
497 526
@@ -518,14 +547,16 @@ build.
518 initialization of its symbol tables. 547 initialization of its symbol tables.
519 548
520 549
521=== 7. Tips & Tricks 5507. Tips & Tricks
551================
522 552
523--- 7.1 Testing for CONFIG_FOO_BAR 5537.1 Testing for CONFIG_FOO_BAR
554------------------------------
524 555
525 Modules often need to check for certain CONFIG_ options to 556 Modules often need to check for certain `CONFIG_` options to
526 decide if a specific feature is included in the module. In 557 decide if a specific feature is included in the module. In
527 kbuild this is done by referencing the CONFIG_ variable 558 kbuild this is done by referencing the `CONFIG_` variable
528 directly. 559 directly::
529 560
530 #fs/ext2/Makefile 561 #fs/ext2/Makefile
531 obj-$(CONFIG_EXT2_FS) += ext2.o 562 obj-$(CONFIG_EXT2_FS) += ext2.o
@@ -534,8 +565,7 @@ build.
534 ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o 565 ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o
535 566
536 External modules have traditionally used "grep" to check for 567 External modules have traditionally used "grep" to check for
537 specific CONFIG_ settings directly in .config. This usage is 568 specific `CONFIG_` settings directly in .config. This usage is
538 broken. As introduced before, external modules should use 569 broken. As introduced before, external modules should use
539 kbuild for building and can therefore use the same methods as 570 kbuild for building and can therefore use the same methods as
540 in-tree modules when testing for CONFIG_ definitions. 571 in-tree modules when testing for `CONFIG_` definitions.
541
diff --git a/Documentation/kdump/index.rst b/Documentation/kdump/index.rst
new file mode 100644
index 000000000000..2b17fcf6867a
--- /dev/null
+++ b/Documentation/kdump/index.rst
@@ -0,0 +1,21 @@
1:orphan:
2
3================================================================
4Documentation for Kdump - The kexec-based Crash Dumping Solution
5================================================================
6
7This document includes overview, setup and installation, and analysis
8information.
9
10.. toctree::
11 :maxdepth: 1
12
13 kdump
14 vmcoreinfo
15
16.. only:: subproject and html
17
18 Indices
19 =======
20
21 * :ref:`genindex`
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.rst
index 3162eeb8c262..ac7e131d2935 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.rst
@@ -71,9 +71,8 @@ This is a symlink to the latest version.
71 71
72The latest kexec-tools git tree is available at: 72The latest kexec-tools git tree is available at:
73 73
74git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git 74- git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
75and 75- http://www.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
76http://www.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
77 76
78There is also a gitweb interface available at 77There is also a gitweb interface available at
79http://www.kernel.org/git/?p=utils/kernel/kexec/kexec-tools.git 78http://www.kernel.org/git/?p=utils/kernel/kexec/kexec-tools.git
@@ -81,25 +80,25 @@ http://www.kernel.org/git/?p=utils/kernel/kexec/kexec-tools.git
81More information about kexec-tools can be found at 80More information about kexec-tools can be found at
82http://horms.net/projects/kexec/ 81http://horms.net/projects/kexec/
83 82
843) Unpack the tarball with the tar command, as follows: 833) Unpack the tarball with the tar command, as follows::
85 84
86 tar xvpzf kexec-tools.tar.gz 85 tar xvpzf kexec-tools.tar.gz
87 86
884) Change to the kexec-tools directory, as follows: 874) Change to the kexec-tools directory, as follows::
89 88
90 cd kexec-tools-VERSION 89 cd kexec-tools-VERSION
91 90
925) Configure the package, as follows: 915) Configure the package, as follows::
93 92
94 ./configure 93 ./configure
95 94
966) Compile the package, as follows: 956) Compile the package, as follows::
97 96
98 make 97 make
99 98
1007) Install the package, as follows: 997) Install the package, as follows::
101 100
102 make install 101 make install
103 102
104 103
105Build the system and dump-capture kernels 104Build the system and dump-capture kernels
@@ -126,25 +125,25 @@ dump-capture kernels for enabling kdump support.
126System kernel config options 125System kernel config options
127---------------------------- 126----------------------------
128 127
1291) Enable "kexec system call" in "Processor type and features." 1281) Enable "kexec system call" in "Processor type and features."::
130 129
131 CONFIG_KEXEC=y 130 CONFIG_KEXEC=y
132 131
1332) Enable "sysfs file system support" in "Filesystem" -> "Pseudo 1322) Enable "sysfs file system support" in "Filesystem" -> "Pseudo
134 filesystems." This is usually enabled by default. 133 filesystems." This is usually enabled by default::
135 134
136 CONFIG_SYSFS=y 135 CONFIG_SYSFS=y
137 136
138 Note that "sysfs file system support" might not appear in the "Pseudo 137 Note that "sysfs file system support" might not appear in the "Pseudo
139 filesystems" menu if "Configure standard kernel features (for small 138 filesystems" menu if "Configure standard kernel features (for small
140 systems)" is not enabled in "General Setup." In this case, check the 139 systems)" is not enabled in "General Setup." In this case, check the
141 .config file itself to ensure that sysfs is turned on, as follows: 140 .config file itself to ensure that sysfs is turned on, as follows::
142 141
143 grep 'CONFIG_SYSFS' .config 142 grep 'CONFIG_SYSFS' .config
144 143
1453) Enable "Compile the kernel with debug info" in "Kernel hacking." 1443) Enable "Compile the kernel with debug info" in "Kernel hacking."::
146 145
147 CONFIG_DEBUG_INFO=Y 146 CONFIG_DEBUG_INFO=Y
148 147
149 This causes the kernel to be built with debug symbols. The dump 148 This causes the kernel to be built with debug symbols. The dump
150 analysis tools require a vmlinux with debug symbols in order to read 149 analysis tools require a vmlinux with debug symbols in order to read
@@ -154,29 +153,32 @@ Dump-capture kernel config options (Arch Independent)
154----------------------------------------------------- 153-----------------------------------------------------
155 154
1561) Enable "kernel crash dumps" support under "Processor type and 1551) Enable "kernel crash dumps" support under "Processor type and
157 features": 156 features"::
158 157
159 CONFIG_CRASH_DUMP=y 158 CONFIG_CRASH_DUMP=y
160 159
1612) Enable "/proc/vmcore support" under "Filesystems" -> "Pseudo filesystems". 1602) Enable "/proc/vmcore support" under "Filesystems" -> "Pseudo filesystems"::
161
162 CONFIG_PROC_VMCORE=y
162 163
163 CONFIG_PROC_VMCORE=y
164 (CONFIG_PROC_VMCORE is set by default when CONFIG_CRASH_DUMP is selected.) 164 (CONFIG_PROC_VMCORE is set by default when CONFIG_CRASH_DUMP is selected.)
165 165
166Dump-capture kernel config options (Arch Dependent, i386 and x86_64) 166Dump-capture kernel config options (Arch Dependent, i386 and x86_64)
167-------------------------------------------------------------------- 167--------------------------------------------------------------------
168 168
1691) On i386, enable high memory support under "Processor type and 1691) On i386, enable high memory support under "Processor type and
170 features": 170 features"::
171
172 CONFIG_HIGHMEM64G=y
173
174 or::
171 175
172 CONFIG_HIGHMEM64G=y 176 CONFIG_HIGHMEM4G
173 or
174 CONFIG_HIGHMEM4G
175 177
1762) On i386 and x86_64, disable symmetric multi-processing support 1782) On i386 and x86_64, disable symmetric multi-processing support
177 under "Processor type and features": 179 under "Processor type and features"::
178 180
179 CONFIG_SMP=n 181 CONFIG_SMP=n
180 182
181 (If CONFIG_SMP=y, then specify maxcpus=1 on the kernel command line 183 (If CONFIG_SMP=y, then specify maxcpus=1 on the kernel command line
182 when loading the dump-capture kernel, see section "Load the Dump-capture 184 when loading the dump-capture kernel, see section "Load the Dump-capture
@@ -184,9 +186,9 @@ Dump-capture kernel config options (Arch Dependent, i386 and x86_64)
184 186
1853) If one wants to build and use a relocatable kernel, 1873) If one wants to build and use a relocatable kernel,
186 Enable "Build a relocatable kernel" support under "Processor type and 188 Enable "Build a relocatable kernel" support under "Processor type and
187 features" 189 features"::
188 190
189 CONFIG_RELOCATABLE=y 191 CONFIG_RELOCATABLE=y
190 192
1914) Use a suitable value for "Physical address where the kernel is 1934) Use a suitable value for "Physical address where the kernel is
192 loaded" (under "Processor type and features"). This only appears when 194 loaded" (under "Processor type and features"). This only appears when
@@ -211,13 +213,13 @@ Dump-capture kernel config options (Arch Dependent, i386 and x86_64)
211Dump-capture kernel config options (Arch Dependent, ppc64) 213Dump-capture kernel config options (Arch Dependent, ppc64)
212---------------------------------------------------------- 214----------------------------------------------------------
213 215
2141) Enable "Build a kdump crash kernel" support under "Kernel" options: 2161) Enable "Build a kdump crash kernel" support under "Kernel" options::
215 217
216 CONFIG_CRASH_DUMP=y 218 CONFIG_CRASH_DUMP=y
217 219
2182) Enable "Build a relocatable kernel" support 2202) Enable "Build a relocatable kernel" support::
219 221
220 CONFIG_RELOCATABLE=y 222 CONFIG_RELOCATABLE=y
221 223
222 Make and install the kernel and its modules. 224 Make and install the kernel and its modules.
223 225
@@ -231,11 +233,13 @@ Dump-capture kernel config options (Arch Dependent, ia64)
231 233
232 The crashkernel region can be automatically placed by the system 234 The crashkernel region can be automatically placed by the system
233 kernel at run time. This is done by specifying the base address as 0, 235 kernel at run time. This is done by specifying the base address as 0,
234 or omitting it all together. 236 or omitting it all together::
235 237
236 crashkernel=256M@0 238 crashkernel=256M@0
237 or 239
238 crashkernel=256M 240 or::
241
242 crashkernel=256M
239 243
240 If the start address is specified, note that the start address of the 244 If the start address is specified, note that the start address of the
241 kernel will be aligned to 64Mb, so if the start address is not then 245 kernel will be aligned to 64Mb, so if the start address is not then
@@ -245,9 +249,9 @@ Dump-capture kernel config options (Arch Dependent, arm)
245---------------------------------------------------------- 249----------------------------------------------------------
246 250
247- To use a relocatable kernel, 251- To use a relocatable kernel,
248 Enable "AUTO_ZRELADDR" support under "Boot" options: 252 Enable "AUTO_ZRELADDR" support under "Boot" options::
249 253
250 AUTO_ZRELADDR=y 254 AUTO_ZRELADDR=y
251 255
252Dump-capture kernel config options (Arch Dependent, arm64) 256Dump-capture kernel config options (Arch Dependent, arm64)
253---------------------------------------------------------- 257----------------------------------------------------------
@@ -265,12 +269,12 @@ on the value of System RAM -- that's mostly for distributors that pre-setup
265the kernel command line to avoid a unbootable system after some memory has 269the kernel command line to avoid a unbootable system after some memory has
266been removed from the machine. 270been removed from the machine.
267 271
268The syntax is: 272The syntax is::
269 273
270 crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset] 274 crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset]
271 range=start-[end] 275 range=start-[end]
272 276
273For example: 277For example::
274 278
275 crashkernel=512M-2G:64M,2G-:128M 279 crashkernel=512M-2G:64M,2G-:128M
276 280
@@ -326,35 +330,46 @@ can choose to load the uncompressed vmlinux or compressed bzImage/vmlinuz
326of dump-capture kernel. Following is the summary. 330of dump-capture kernel. Following is the summary.
327 331
328For i386 and x86_64: 332For i386 and x86_64:
333
329 - Use vmlinux if kernel is not relocatable. 334 - Use vmlinux if kernel is not relocatable.
330 - Use bzImage/vmlinuz if kernel is relocatable. 335 - Use bzImage/vmlinuz if kernel is relocatable.
336
331For ppc64: 337For ppc64:
338
332 - Use vmlinux 339 - Use vmlinux
340
333For ia64: 341For ia64:
342
334 - Use vmlinux or vmlinuz.gz 343 - Use vmlinux or vmlinuz.gz
344
335For s390x: 345For s390x:
346
336 - Use image or bzImage 347 - Use image or bzImage
348
337For arm: 349For arm:
350
338 - Use zImage 351 - Use zImage
352
339For arm64: 353For arm64:
354
340 - Use vmlinux or Image 355 - Use vmlinux or Image
341 356
342If you are using an uncompressed vmlinux image then use following command 357If you are using an uncompressed vmlinux image then use following command
343to load dump-capture kernel. 358to load dump-capture kernel::
344 359
345 kexec -p <dump-capture-kernel-vmlinux-image> \ 360 kexec -p <dump-capture-kernel-vmlinux-image> \
346 --initrd=<initrd-for-dump-capture-kernel> --args-linux \ 361 --initrd=<initrd-for-dump-capture-kernel> --args-linux \
347 --append="root=<root-dev> <arch-specific-options>" 362 --append="root=<root-dev> <arch-specific-options>"
348 363
349If you are using a compressed bzImage/vmlinuz, then use following command 364If you are using a compressed bzImage/vmlinuz, then use following command
350to load dump-capture kernel. 365to load dump-capture kernel::
351 366
352 kexec -p <dump-capture-kernel-bzImage> \ 367 kexec -p <dump-capture-kernel-bzImage> \
353 --initrd=<initrd-for-dump-capture-kernel> \ 368 --initrd=<initrd-for-dump-capture-kernel> \
354 --append="root=<root-dev> <arch-specific-options>" 369 --append="root=<root-dev> <arch-specific-options>"
355 370
356If you are using a compressed zImage, then use following command 371If you are using a compressed zImage, then use following command
357to load dump-capture kernel. 372to load dump-capture kernel::
358 373
359 kexec --type zImage -p <dump-capture-kernel-bzImage> \ 374 kexec --type zImage -p <dump-capture-kernel-bzImage> \
360 --initrd=<initrd-for-dump-capture-kernel> \ 375 --initrd=<initrd-for-dump-capture-kernel> \
@@ -362,7 +377,7 @@ to load dump-capture kernel.
362 --append="root=<root-dev> <arch-specific-options>" 377 --append="root=<root-dev> <arch-specific-options>"
363 378
364If you are using an uncompressed Image, then use following command 379If you are using an uncompressed Image, then use following command
365to load dump-capture kernel. 380to load dump-capture kernel::
366 381
367 kexec -p <dump-capture-kernel-Image> \ 382 kexec -p <dump-capture-kernel-Image> \
368 --initrd=<initrd-for-dump-capture-kernel> \ 383 --initrd=<initrd-for-dump-capture-kernel> \
@@ -376,18 +391,23 @@ Following are the arch specific command line options to be used while
376loading dump-capture kernel. 391loading dump-capture kernel.
377 392
378For i386, x86_64 and ia64: 393For i386, x86_64 and ia64:
394
379 "1 irqpoll maxcpus=1 reset_devices" 395 "1 irqpoll maxcpus=1 reset_devices"
380 396
381For ppc64: 397For ppc64:
398
382 "1 maxcpus=1 noirqdistrib reset_devices" 399 "1 maxcpus=1 noirqdistrib reset_devices"
383 400
384For s390x: 401For s390x:
402
385 "1 maxcpus=1 cgroup_disable=memory" 403 "1 maxcpus=1 cgroup_disable=memory"
386 404
387For arm: 405For arm:
406
388 "1 maxcpus=1 reset_devices" 407 "1 maxcpus=1 reset_devices"
389 408
390For arm64: 409For arm64:
410
391 "1 maxcpus=1 reset_devices" 411 "1 maxcpus=1 reset_devices"
392 412
393Notes on loading the dump-capture kernel: 413Notes on loading the dump-capture kernel:
@@ -464,7 +484,7 @@ Write Out the Dump File
464======================= 484=======================
465 485
466After the dump-capture kernel is booted, write out the dump file with 486After the dump-capture kernel is booted, write out the dump file with
467the following command: 487the following command::
468 488
469 cp /proc/vmcore <dump-file> 489 cp /proc/vmcore <dump-file>
470 490
@@ -476,7 +496,7 @@ Before analyzing the dump image, you should reboot into a stable kernel.
476 496
477You can do limited analysis using GDB on the dump file copied out of 497You can do limited analysis using GDB on the dump file copied out of
478/proc/vmcore. Use the debug vmlinux built with -g and run the following 498/proc/vmcore. Use the debug vmlinux built with -g and run the following
479command: 499command::
480 500
481 gdb vmlinux <dump-file> 501 gdb vmlinux <dump-file>
482 502
@@ -504,6 +524,11 @@ to achieve the same behaviour.
504Contact 524Contact
505======= 525=======
506 526
507Vivek Goyal (vgoyal@redhat.com) 527- Vivek Goyal (vgoyal@redhat.com)
508Maneesh Soni (maneesh@in.ibm.com) 528- Maneesh Soni (maneesh@in.ibm.com)
529
530GDB macros
531==========
509 532
533.. include:: gdbmacros.txt
534 :literal:
diff --git a/Documentation/kdump/vmcoreinfo.txt b/Documentation/kdump/vmcoreinfo.rst
index bb94a4bd597a..007a6b86e0ee 100644
--- a/Documentation/kdump/vmcoreinfo.txt
+++ b/Documentation/kdump/vmcoreinfo.rst
@@ -1,8 +1,7 @@
1================================================================ 1==========
2 VMCOREINFO 2VMCOREINFO
3================================================================ 3==========
4 4
5===========
6What is it? 5What is it?
7=========== 6===========
8 7
@@ -12,7 +11,6 @@ values, field offsets, etc. These data are packed into an ELF note
12section and used by user-space tools like crash and makedumpfile to 11section and used by user-space tools like crash and makedumpfile to
13analyze a kernel's memory layout. 12analyze a kernel's memory layout.
14 13
15================
16Common variables 14Common variables
17================ 15================
18 16
@@ -49,7 +47,7 @@ in a system, one bit position per node number. Used to keep track of
49which nodes are in the system and online. 47which nodes are in the system and online.
50 48
51swapper_pg_dir 49swapper_pg_dir
52------------- 50--------------
53 51
54The global page directory pointer of the kernel. Used to translate 52The global page directory pointer of the kernel. Used to translate
55virtual to physical addresses. 53virtual to physical addresses.
@@ -132,16 +130,14 @@ nodemask_t
132The size of a nodemask_t type. Used to compute the number of online 130The size of a nodemask_t type. Used to compute the number of online
133nodes. 131nodes.
134 132
135(page, flags|_refcount|mapping|lru|_mapcount|private|compound_dtor| 133(page, flags|_refcount|mapping|lru|_mapcount|private|compound_dtor|compound_order|compound_head)
136 compound_order|compound_head) 134-------------------------------------------------------------------------------------------------
137-------------------------------------------------------------------
138 135
139User-space tools compute their values based on the offset of these 136User-space tools compute their values based on the offset of these
140variables. The variables are used when excluding unnecessary pages. 137variables. The variables are used when excluding unnecessary pages.
141 138
142(pglist_data, node_zones|nr_zones|node_mem_map|node_start_pfn|node_ 139(pglist_data, node_zones|nr_zones|node_mem_map|node_start_pfn|node_spanned_pages|node_id)
143 spanned_pages|node_id) 140-----------------------------------------------------------------------------------------
144-------------------------------------------------------------------
145 141
146On NUMA machines, each NUMA node has a pg_data_t to describe its memory 142On NUMA machines, each NUMA node has a pg_data_t to describe its memory
147layout. On UMA machines there is a single pglist_data which describes the 143layout. On UMA machines there is a single pglist_data which describes the
@@ -245,21 +241,25 @@ NR_FREE_PAGES
245On linux-2.6.21 or later, the number of free pages is in 241On linux-2.6.21 or later, the number of free pages is in
246vm_stat[NR_FREE_PAGES]. Used to get the number of free pages. 242vm_stat[NR_FREE_PAGES]. Used to get the number of free pages.
247 243
248PG_lru|PG_private|PG_swapcache|PG_swapbacked|PG_slab|PG_hwpoision 244PG_lru|PG_private|PG_swapcache|PG_swapbacked|PG_slab|PG_hwpoision|PG_head_mask
249|PG_head_mask|PAGE_BUDDY_MAPCOUNT_VALUE(~PG_buddy) 245------------------------------------------------------------------------------
250|PAGE_OFFLINE_MAPCOUNT_VALUE(~PG_offline)
251-----------------------------------------------------------------
252 246
253Page attributes. These flags are used to filter various unnecessary for 247Page attributes. These flags are used to filter various unnecessary for
254dumping pages. 248dumping pages.
255 249
250PAGE_BUDDY_MAPCOUNT_VALUE(~PG_buddy)|PAGE_OFFLINE_MAPCOUNT_VALUE(~PG_offline)
251-----------------------------------------------------------------------------
252
253More page attributes. These flags are used to filter various unnecessary for
254dumping pages.
255
256
256HUGETLB_PAGE_DTOR 257HUGETLB_PAGE_DTOR
257----------------- 258-----------------
258 259
259The HUGETLB_PAGE_DTOR flag denotes hugetlbfs pages. Makedumpfile 260The HUGETLB_PAGE_DTOR flag denotes hugetlbfs pages. Makedumpfile
260excludes these pages. 261excludes these pages.
261 262
262======
263x86_64 263x86_64
264====== 264======
265 265
@@ -318,12 +318,12 @@ address.
318Currently, sme_mask stores the value of the C-bit position. If needed, 318Currently, sme_mask stores the value of the C-bit position. If needed,
319additional SME-relevant info can be placed in that variable. 319additional SME-relevant info can be placed in that variable.
320 320
321For example: 321For example::
322[ misc ][ enc bit ][ other misc SME info ] 322
3230000_0000_0000_0000_1000_0000_0000_0000_0000_0000_..._0000 323 [ misc ][ enc bit ][ other misc SME info ]
32463 59 55 51 47 43 39 35 31 27 ... 3 324 0000_0000_0000_0000_1000_0000_0000_0000_0000_0000_..._0000
325 63 59 55 51 47 43 39 35 31 27 ... 3
325 326
326======
327x86_32 327x86_32
328====== 328======
329 329
@@ -335,7 +335,6 @@ of a higher page table lookup overhead, and also consumes more page
335table space per process. Used to check whether PAE was enabled in the 335table space per process. Used to check whether PAE was enabled in the
336crash kernel when converting virtual addresses to physical addresses. 336crash kernel when converting virtual addresses to physical addresses.
337 337
338====
339ia64 338ia64
340==== 339====
341 340
@@ -366,7 +365,6 @@ PGTABLE_3|PGTABLE_4
366User-space tools need to know whether the crash kernel was in 3-level or 365User-space tools need to know whether the crash kernel was in 3-level or
3674-level paging mode. Used to distinguish the page table. 3664-level paging mode. Used to distinguish the page table.
368 367
369=====
370ARM64 368ARM64
371===== 369=====
372 370
@@ -395,9 +393,8 @@ KERNELOFFSET
395The kernel randomization offset. Used to compute the page offset. If 393The kernel randomization offset. Used to compute the page offset. If
396KASLR is disabled, this value is zero. 394KASLR is disabled, this value is zero.
397 395
398====
399arm 396arm
400==== 397===
401 398
402ARM_LPAE 399ARM_LPAE
403-------- 400--------
@@ -405,12 +402,11 @@ ARM_LPAE
405It indicates whether the crash kernel supports large physical address 402It indicates whether the crash kernel supports large physical address
406extensions. Used to translate virtual to physical addresses. 403extensions. Used to translate virtual to physical addresses.
407 404
408====
409s390 405s390
410==== 406====
411 407
412lowcore_ptr 408lowcore_ptr
413---------- 409-----------
414 410
415An array with a pointer to the lowcore of every CPU. Used to print the 411An array with a pointer to the lowcore of every CPU. Used to print the
416psw and all registers information. 412psw and all registers information.
@@ -425,7 +421,6 @@ Used to get the vmalloc_start address from the high_memory symbol.
425 421
426The maximum number of CPUs. 422The maximum number of CPUs.
427 423
428=======
429powerpc 424powerpc
430======= 425=======
431 426
@@ -460,9 +455,8 @@ Page size definitions, i.e. 4k, 64k, or 16M.
460 455
461Used to make vtop translations. 456Used to make vtop translations.
462 457
463vmemmap_backing|(vmemmap_backing, list)|(vmemmap_backing, phys)| 458vmemmap_backing|(vmemmap_backing, list)|(vmemmap_backing, phys)|(vmemmap_backing, virt_addr)
464(vmemmap_backing, virt_addr) 459--------------------------------------------------------------------------------------------
465----------------------------------------------------------------
466 460
467The vmemmap virtual address space management does not have a traditional 461The vmemmap virtual address space management does not have a traditional
468page table to track which virtual struct pages are backed by a physical 462page table to track which virtual struct pages are backed by a physical
@@ -480,7 +474,6 @@ member.
480 474
481Used in vtop translations. 475Used in vtop translations.
482 476
483==
484sh 477sh
485== 478==
486 479
diff --git a/Documentation/kernel-hacking/hacking.rst b/Documentation/kernel-hacking/hacking.rst
index d824e4feaff3..5891a701a159 100644
--- a/Documentation/kernel-hacking/hacking.rst
+++ b/Documentation/kernel-hacking/hacking.rst
@@ -718,7 +718,7 @@ make a neat patch, there's administrative work to be done:
718- Usually you want a configuration option for your kernel hack. Edit 718- Usually you want a configuration option for your kernel hack. Edit
719 ``Kconfig`` in the appropriate directory. The Config language is 719 ``Kconfig`` in the appropriate directory. The Config language is
720 simple to use by cut and paste, and there's complete documentation in 720 simple to use by cut and paste, and there's complete documentation in
721 ``Documentation/kbuild/kconfig-language.txt``. 721 ``Documentation/kbuild/kconfig-language.rst``.
722 722
723 In your description of the option, make sure you address both the 723 In your description of the option, make sure you address both the
724 expert user and the user who knows nothing about your feature. 724 expert user and the user who knows nothing about your feature.
@@ -728,7 +728,7 @@ make a neat patch, there's administrative work to be done:
728 728
729- Edit the ``Makefile``: the CONFIG variables are exported here so you 729- Edit the ``Makefile``: the CONFIG variables are exported here so you
730 can usually just add a "obj-$(CONFIG_xxx) += xxx.o" line. The syntax 730 can usually just add a "obj-$(CONFIG_xxx) += xxx.o" line. The syntax
731 is documented in ``Documentation/kbuild/makefiles.txt``. 731 is documented in ``Documentation/kbuild/makefiles.rst``.
732 732
733- Put yourself in ``CREDITS`` if you've done something noteworthy, 733- Put yourself in ``CREDITS`` if you've done something noteworthy,
734 usually beyond a single file (your name should be at the top of the 734 usually beyond a single file (your name should be at the top of the
diff --git a/Documentation/kernel-hacking/locking.rst b/Documentation/kernel-hacking/locking.rst
index 519673df0e82..dc698ea456e0 100644
--- a/Documentation/kernel-hacking/locking.rst
+++ b/Documentation/kernel-hacking/locking.rst
@@ -451,7 +451,7 @@ to protect the cache and all the objects within it. Here's the code::
451 if ((obj = kmalloc(sizeof(*obj), GFP_KERNEL)) == NULL) 451 if ((obj = kmalloc(sizeof(*obj), GFP_KERNEL)) == NULL)
452 return -ENOMEM; 452 return -ENOMEM;
453 453
454 strlcpy(obj->name, name, sizeof(obj->name)); 454 strscpy(obj->name, name, sizeof(obj->name));
455 obj->id = id; 455 obj->id = id;
456 obj->popularity = 0; 456 obj->popularity = 0;
457 457
@@ -660,7 +660,7 @@ Here is the code::
660 } 660 }
661 661
662 @@ -63,6 +94,7 @@ 662 @@ -63,6 +94,7 @@
663 strlcpy(obj->name, name, sizeof(obj->name)); 663 strscpy(obj->name, name, sizeof(obj->name));
664 obj->id = id; 664 obj->id = id;
665 obj->popularity = 0; 665 obj->popularity = 0;
666 + obj->refcnt = 1; /* The cache holds a reference */ 666 + obj->refcnt = 1; /* The cache holds a reference */
@@ -774,7 +774,7 @@ the lock is no longer used to protect the reference count itself.
774 } 774 }
775 775
776 @@ -94,7 +76,7 @@ 776 @@ -94,7 +76,7 @@
777 strlcpy(obj->name, name, sizeof(obj->name)); 777 strscpy(obj->name, name, sizeof(obj->name));
778 obj->id = id; 778 obj->id = id;
779 obj->popularity = 0; 779 obj->popularity = 0;
780 - obj->refcnt = 1; /* The cache holds a reference */ 780 - obj->refcnt = 1; /* The cache holds a reference */
diff --git a/Documentation/kernel-per-CPU-kthreads.txt b/Documentation/kernel-per-CPU-kthreads.txt
index 23b0c8b20cd1..5623b9916411 100644
--- a/Documentation/kernel-per-CPU-kthreads.txt
+++ b/Documentation/kernel-per-CPU-kthreads.txt
@@ -348,7 +348,7 @@ To reduce its OS jitter, do at least one of the following:
3482. Boot with "nosoftlockup=0", which will also prevent these kthreads 3482. Boot with "nosoftlockup=0", which will also prevent these kthreads
349 from being created. Other related watchdog and softlockup boot 349 from being created. Other related watchdog and softlockup boot
350 parameters may be found in Documentation/admin-guide/kernel-parameters.rst 350 parameters may be found in Documentation/admin-guide/kernel-parameters.rst
351 and Documentation/watchdog/watchdog-parameters.txt. 351 and Documentation/watchdog/watchdog-parameters.rst.
3523. Echo a zero to /proc/sys/kernel/watchdog to disable the 3523. Echo a zero to /proc/sys/kernel/watchdog to disable the
353 watchdog timer. 353 watchdog timer.
3544. Echo a large number of /proc/sys/kernel/watchdog_thresh in 3544. Echo a large number of /proc/sys/kernel/watchdog_thresh in
diff --git a/Documentation/laptops/lg-laptop.rst b/Documentation/laptops/lg-laptop.rst
index aa503ee9b3bc..f2c2ffe31101 100644
--- a/Documentation/laptops/lg-laptop.rst
+++ b/Documentation/laptops/lg-laptop.rst
@@ -1,5 +1,7 @@
1.. SPDX-License-Identifier: GPL-2.0+ 1.. SPDX-License-Identifier: GPL-2.0+
2 2
3:orphan:
4
3LG Gram laptop extra features 5LG Gram laptop extra features
4============================= 6=============================
5 7
diff --git a/Documentation/maintainer/index.rst b/Documentation/maintainer/index.rst
index 2a14916930cb..56e2c09dfa39 100644
--- a/Documentation/maintainer/index.rst
+++ b/Documentation/maintainer/index.rst
@@ -10,5 +10,6 @@ additions to this manual.
10 :maxdepth: 2 10 :maxdepth: 2
11 11
12 configure-git 12 configure-git
13 rebasing-and-merging
13 pull-requests 14 pull-requests
14 15
diff --git a/Documentation/maintainer/rebasing-and-merging.rst b/Documentation/maintainer/rebasing-and-merging.rst
new file mode 100644
index 000000000000..09f988e7fa71
--- /dev/null
+++ b/Documentation/maintainer/rebasing-and-merging.rst
@@ -0,0 +1,226 @@
1.. SPDX-License-Identifier: GPL-2.0
2
3====================
4Rebasing and merging
5====================
6
7Maintaining a subsystem, as a general rule, requires a familiarity with the
8Git source-code management system. Git is a powerful tool with a lot of
9features; as is often the case with such tools, there are right and wrong
10ways to use those features. This document looks in particular at the use
11of rebasing and merging. Maintainers often get in trouble when they use
12those tools incorrectly, but avoiding problems is not actually all that
13hard.
14
15One thing to be aware of in general is that, unlike many other projects,
16the kernel community is not scared by seeing merge commits in its
17development history. Indeed, given the scale of the project, avoiding
18merges would be nearly impossible. Some problems encountered by
19maintainers result from a desire to avoid merges, while others come from
20merging a little too often.
21
22Rebasing
23========
24
25"Rebasing" is the process of changing the history of a series of commits
26within a repository. There are two different types of operations that are
27referred to as rebasing since both are done with the ``git rebase``
28command, but there are significant differences between them:
29
30 - Changing the parent (starting) commit upon which a series of patches is
31 built. For example, a rebase operation could take a patch set built on
32 the previous kernel release and base it, instead, on the current
33 release. We'll call this operation "reparenting" in the discussion
34 below.
35
36 - Changing the history of a set of patches by fixing (or deleting) broken
37 commits, adding patches, adding tags to commit changelogs, or changing
38 the order in which commits are applied. In the following text, this
39 type of operation will be referred to as "history modification"
40
41The term "rebasing" will be used to refer to both of the above operations.
42Used properly, rebasing can yield a cleaner and clearer development
43history; used improperly, it can obscure that history and introduce bugs.
44
45There are a few rules of thumb that can help developers to avoid the worst
46perils of rebasing:
47
48 - History that has been exposed to the world beyond your private system
49 should usually not be changed. Others may have pulled a copy of your
50 tree and built on it; modifying your tree will create pain for them. If
51 work is in need of rebasing, that is usually a sign that it is not yet
52 ready to be committed to a public repository.
53
54 That said, there are always exceptions. Some trees (linux-next being
55 a significant example) are frequently rebased by their nature, and
56 developers know not to base work on them. Developers will sometimes
57 expose an unstable branch for others to test with or for automated
58 testing services. If you do expose a branch that may be unstable in
59 this way, be sure that prospective users know not to base work on it.
60
61 - Do not rebase a branch that contains history created by others. If you
62 have pulled changes from another developer's repository, you are now a
63 custodian of their history. You should not change it. With few
64 exceptions, for example, a broken commit in a tree like this should be
65 explicitly reverted rather than disappeared via history modification.
66
67 - Do not reparent a tree without a good reason to do so. Just being on a
68 newer base or avoiding a merge with an upstream repository is not
69 generally a good reason.
70
71 - If you must reparent a repository, do not pick some random kernel commit
72 as the new base. The kernel is often in a relatively unstable state
73 between release points; basing development on one of those points
74 increases the chances of running into surprising bugs. When a patch
75 series must move to a new base, pick a stable point (such as one of
76 the -rc releases) to move to.
77
78 - Realize that reparenting a patch series (or making significant history
79 modifications) changes the environment in which it was developed and,
80 likely, invalidates much of the testing that was done. A reparented
81 patch series should, as a general rule, be treated like new code and
82 retested from the beginning.
83
84A frequent cause of merge-window trouble is when Linus is presented with a
85patch series that has clearly been reparented, often to a random commit,
86shortly before the pull request was sent. The chances of such a series
87having been adequately tested are relatively low - as are the chances of
88the pull request being acted upon.
89
90If, instead, rebasing is limited to private trees, commits are based on a
91well-known starting point, and they are well tested, the potential for
92trouble is low.
93
94Merging
95=======
96
97Merging is a common operation in the kernel development process; the 5.1
98development cycle included 1,126 merge commits - nearly 9% of the total.
99Kernel work is accumulated in over 100 different subsystem trees, each of
100which may contain multiple topic branches; each branch is usually developed
101independently of the others. So naturally, at least one merge will be
102required before any given branch finds its way into an upstream repository.
103
104Many projects require that branches in pull requests be based on the
105current trunk so that no merge commits appear in the history. The kernel
106is not such a project; any rebasing of branches to avoid merges will, most
107likely, lead to trouble.
108
109Subsystem maintainers find themselves having to do two types of merges:
110from lower-level subsystem trees and from others, either sibling trees or
111the mainline. The best practices to follow differ in those two situations.
112
113Merging from lower-level trees
114------------------------------
115
116Larger subsystems tend to have multiple levels of maintainers, with the
117lower-level maintainers sending pull requests to the higher levels. Acting
118on such a pull request will almost certainly generate a merge commit; that
119is as it should be. In fact, subsystem maintainers may want to use
120the --no-ff flag to force the addition of a merge commit in the rare cases
121where one would not normally be created so that the reasons for the merge
122can be recorded. The changelog for the merge should, for any kind of
123merge, say *why* the merge is being done. For a lower-level tree, "why" is
124usually a summary of the changes that will come with that pull.
125
126Maintainers at all levels should be using signed tags on their pull
127requests, and upstream maintainers should verify the tags when pulling
128branches. Failure to do so threatens the security of the development
129process as a whole.
130
131As per the rules outlined above, once you have merged somebody else's
132history into your tree, you cannot rebase that branch, even if you
133otherwise would be able to.
134
135Merging from sibling or upstream trees
136--------------------------------------
137
138While merges from downstream are common and unremarkable, merges from other
139trees tend to be a red flag when it comes time to push a branch upstream.
140Such merges need to be carefully thought about and well justified, or
141there's a good chance that a subsequent pull request will be rejected.
142
143It is natural to want to merge the master branch into a repository; this
144type of merge is often called a "back merge". Back merges can help to make
145sure that there are no conflicts with parallel development and generally
146gives a warm, fuzzy feeling of being up-to-date. But this temptation
147should be avoided almost all of the time.
148
149Why is that? Back merges will muddy the development history of your own
150branch. They will significantly increase your chances of encountering bugs
151from elsewhere in the community and make it hard to ensure that the work
152you are managing is stable and ready for upstream. Frequent merges can
153also obscure problems with the development process in your tree; they can
154hide interactions with other trees that should not be happening (often) in
155a well-managed branch.
156
157That said, back merges are occasionally required; when that happens, be
158sure to document *why* it was required in the commit message. As always,
159merge to a well-known stable point, rather than to some random commit.
160Even then, you should not back merge a tree above your immediate upstream
161tree; if a higher-level back merge is really required, the upstream tree
162should do it first.
163
164One of the most frequent causes of merge-related trouble is when a
165maintainer merges with the upstream in order to resolve merge conflicts
166before sending a pull request. Again, this temptation is easy enough to
167understand, but it should absolutely be avoided. This is especially true
168for the final pull request: Linus is adamant that he would much rather see
169merge conflicts than unnecessary back merges. Seeing the conflicts lets
170him know where potential problem areas are. He does a lot of merges (382
171in the 5.1 development cycle) and has gotten quite good at conflict
172resolution - often better than the developers involved.
173
174So what should a maintainer do when there is a conflict between their
175subsystem branch and the mainline? The most important step is to warn
176Linus in the pull request that the conflict will happen; if nothing else,
177that demonstrates an awareness of how your branch fits into the whole. For
178especially difficult conflicts, create and push a *separate* branch to show
179how you would resolve things. Mention that branch in your pull request,
180but the pull request itself should be for the unmerged branch.
181
182Even in the absence of known conflicts, doing a test merge before sending a
183pull request is a good idea. It may alert you to problems that you somehow
184didn't see from linux-next and helps to understand exactly what you are
185asking upstream to do.
186
187Another reason for doing merges of upstream or another subsystem tree is to
188resolve dependencies. These dependency issues do happen at times, and
189sometimes a cross-merge with another tree is the best way to resolve them;
190as always, in such situations, the merge commit should explain why the
191merge has been done. Take a moment to do it right; people will read those
192changelogs.
193
194Often, though, dependency issues indicate that a change of approach is
195needed. Merging another subsystem tree to resolve a dependency risks
196bringing in other bugs and should almost never be done. If that subsystem
197tree fails to be pulled upstream, whatever problems it had will block the
198merging of your tree as well. Preferable alternatives include agreeing
199with the maintainer to carry both sets of changes in one of the trees or
200creating a topic branch dedicated to the prerequisite commits that can be
201merged into both trees. If the dependency is related to major
202infrastructural changes, the right solution might be to hold the dependent
203commits for one development cycle so that those changes have time to
204stabilize in the mainline.
205
206Finally
207=======
208
209It is relatively common to merge with the mainline toward the beginning of
210the development cycle in order to pick up changes and fixes done elsewhere
211in the tree. As always, such a merge should pick a well-known release
212point rather than some random spot. If your upstream-bound branch has
213emptied entirely into the mainline during the merge window, you can pull it
214forward with a command like::
215
216 git merge v5.2-rc1^0
217
218The "^0" will cause Git to do a fast-forward merge (which should be
219possible in this situation), thus avoiding the addition of a spurious merge
220commit.
221
222The guidelines laid out above are just that: guidelines. There will always
223be situations that call out for a different solution, and these guidelines
224should not prevent developers from doing the right thing when the need
225arises. But one should always think about whether the need has truly
226arisen and be prepared to explain why something abnormal needs to be done.
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index e4e07c8ab89e..045bb8148fe9 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -548,7 +548,7 @@ There are certain things that the Linux kernel memory barriers do not guarantee:
548 548
549 [*] For information on bus mastering DMA and coherency please read: 549 [*] For information on bus mastering DMA and coherency please read:
550 550
551 Documentation/PCI/pci.txt 551 Documentation/PCI/pci.rst
552 Documentation/DMA-API-HOWTO.txt 552 Documentation/DMA-API-HOWTO.txt
553 Documentation/DMA-API.txt 553 Documentation/DMA-API.txt
554 554
diff --git a/Documentation/mic/index.rst b/Documentation/mic/index.rst
new file mode 100644
index 000000000000..082fa8f6a260
--- /dev/null
+++ b/Documentation/mic/index.rst
@@ -0,0 +1,18 @@
1:orphan:
2
3=============================================
4Intel Many Integrated Core (MIC) architecture
5=============================================
6
7.. toctree::
8 :maxdepth: 1
9
10 mic_overview
11 scif_overview
12
13.. only:: subproject and html
14
15 Indices
16 =======
17
18 * :ref:`genindex`
diff --git a/Documentation/mic/mic_overview.txt b/Documentation/mic/mic_overview.rst
index 074adbdf83a4..17d956bdaf7c 100644
--- a/Documentation/mic/mic_overview.txt
+++ b/Documentation/mic/mic_overview.rst
@@ -1,3 +1,7 @@
1======================================================
2Intel Many Integrated Core (MIC) architecture overview
3======================================================
4
1An Intel MIC X100 device is a PCIe form factor add-in coprocessor 5An Intel MIC X100 device is a PCIe form factor add-in coprocessor
2card based on the Intel Many Integrated Core (MIC) architecture 6card based on the Intel Many Integrated Core (MIC) architecture
3that runs a Linux OS. It is a PCIe endpoint in a platform and therefore 7that runs a Linux OS. It is a PCIe endpoint in a platform and therefore
@@ -45,7 +49,7 @@ Here is a block diagram of the various components described above. The
45virtio backends are situated on the host rather than the card given better 49virtio backends are situated on the host rather than the card given better
46single threaded performance for the host compared to MIC, the ability of 50single threaded performance for the host compared to MIC, the ability of
47the host to initiate DMA's to/from the card using the MIC DMA engine and 51the host to initiate DMA's to/from the card using the MIC DMA engine and
48the fact that the virtio block storage backend can only be on the host. 52the fact that the virtio block storage backend can only be on the host::
49 53
50 +----------+ | +----------+ 54 +----------+ | +----------+
51 | Card OS | | | Host OS | 55 | Card OS | | | Host OS |
diff --git a/Documentation/mic/scif_overview.txt b/Documentation/mic/scif_overview.rst
index 0a280d986731..4c8ad9e43706 100644
--- a/Documentation/mic/scif_overview.txt
+++ b/Documentation/mic/scif_overview.rst
@@ -1,3 +1,7 @@
1========================================
2Symmetric Communication Interface (SCIF)
3========================================
4
1The Symmetric Communication Interface (SCIF (pronounced as skiff)) is a low 5The Symmetric Communication Interface (SCIF (pronounced as skiff)) is a low
2level communications API across PCIe currently implemented for MIC. Currently 6level communications API across PCIe currently implemented for MIC. Currently
3SCIF provides inter-node communication within a single host platform, where a 7SCIF provides inter-node communication within a single host platform, where a
@@ -8,8 +12,11 @@ is to deliver the maximum possible performance given the communication
8abilities of the hardware. SCIF has been used to implement an offload compiler 12abilities of the hardware. SCIF has been used to implement an offload compiler
9runtime and OFED support for MPI implementations for MIC coprocessors. 13runtime and OFED support for MPI implementations for MIC coprocessors.
10 14
11==== SCIF API Components ==== 15SCIF API Components
16===================
17
12The SCIF API has the following parts: 18The SCIF API has the following parts:
19
131. Connection establishment using a client server model 201. Connection establishment using a client server model
142. Byte stream messaging intended for short messages 212. Byte stream messaging intended for short messages
153. Node enumeration to determine online nodes 223. Node enumeration to determine online nodes
@@ -28,9 +35,12 @@ can also register local memory which is followed by data transfer using either
28DMA, CPU copies or remote memory mapping via mmap. SCIF supports both user and 35DMA, CPU copies or remote memory mapping via mmap. SCIF supports both user and
29kernel mode clients which are functionally equivalent. 36kernel mode clients which are functionally equivalent.
30 37
31==== SCIF Performance for MIC ==== 38SCIF Performance for MIC
39========================
40
32DMA bandwidth comparison between the TCP (over ethernet over PCIe) stack versus 41DMA bandwidth comparison between the TCP (over ethernet over PCIe) stack versus
33SCIF shows the performance advantages of SCIF for HPC applications and runtimes. 42SCIF shows the performance advantages of SCIF for HPC applications and
43runtimes::
34 44
35 Comparison of TCP and SCIF based BW 45 Comparison of TCP and SCIF based BW
36 46
@@ -66,33 +76,33 @@ space API similar to the kernel API in scif.h. The SCIF user space library
66is distributed @ https://software.intel.com/en-us/mic-developer 76is distributed @ https://software.intel.com/en-us/mic-developer
67 77
68Here is some pseudo code for an example of how two applications on two PCIe 78Here is some pseudo code for an example of how two applications on two PCIe
69nodes would typically use the SCIF API: 79nodes would typically use the SCIF API::
70 80
71Process A (on node A) Process B (on node B) 81 Process A (on node A) Process B (on node B)
72 82
73/* get online node information */ 83 /* get online node information */
74scif_get_node_ids(..) scif_get_node_ids(..) 84 scif_get_node_ids(..) scif_get_node_ids(..)
75scif_open(..) scif_open(..) 85 scif_open(..) scif_open(..)
76scif_bind(..) scif_bind(..) 86 scif_bind(..) scif_bind(..)
77scif_listen(..) 87 scif_listen(..)
78scif_accept(..) scif_connect(..) 88 scif_accept(..) scif_connect(..)
79/* SCIF connection established */ 89 /* SCIF connection established */
80 90
81/* Send and receive short messages */ 91 /* Send and receive short messages */
82scif_send(..)/scif_recv(..) scif_send(..)/scif_recv(..) 92 scif_send(..)/scif_recv(..) scif_send(..)/scif_recv(..)
83 93
84/* Register memory */ 94 /* Register memory */
85scif_register(..) scif_register(..) 95 scif_register(..) scif_register(..)
86 96
87/* RDMA */ 97 /* RDMA */
88scif_readfrom(..)/scif_writeto(..) scif_readfrom(..)/scif_writeto(..) 98 scif_readfrom(..)/scif_writeto(..) scif_readfrom(..)/scif_writeto(..)
89 99
90/* Fence DMAs */ 100 /* Fence DMAs */
91scif_fence_signal(..) scif_fence_signal(..) 101 scif_fence_signal(..) scif_fence_signal(..)
92 102
93mmap(..) mmap(..) 103 mmap(..) mmap(..)
94 104
95/* Access remote registered memory */ 105 /* Access remote registered memory */
96 106
97/* Close the endpoints */ 107 /* Close the endpoints */
98scif_close(..) scif_close(..) 108 scif_close(..) scif_close(..)
diff --git a/Documentation/netlabel/cipso_ipv4.txt b/Documentation/netlabel/cipso_ipv4.rst
index a6075481fd60..cbd3f3231221 100644
--- a/Documentation/netlabel/cipso_ipv4.txt
+++ b/Documentation/netlabel/cipso_ipv4.rst
@@ -1,10 +1,13 @@
1===================================
1NetLabel CIPSO/IPv4 Protocol Engine 2NetLabel CIPSO/IPv4 Protocol Engine
2============================================================================== 3===================================
4
3Paul Moore, paul.moore@hp.com 5Paul Moore, paul.moore@hp.com
4 6
5May 17, 2006 7May 17, 2006
6 8
7 * Overview 9Overview
10========
8 11
9The NetLabel CIPSO/IPv4 protocol engine is based on the IETF Commercial 12The NetLabel CIPSO/IPv4 protocol engine is based on the IETF Commercial
10IP Security Option (CIPSO) draft from July 16, 1992. A copy of this 13IP Security Option (CIPSO) draft from July 16, 1992. A copy of this
@@ -13,7 +16,8 @@ draft can be found in this directory
13it to an RFC standard it has become a de-facto standard for labeled 16it to an RFC standard it has become a de-facto standard for labeled
14networking and is used in many trusted operating systems. 17networking and is used in many trusted operating systems.
15 18
16 * Outbound Packet Processing 19Outbound Packet Processing
20==========================
17 21
18The CIPSO/IPv4 protocol engine applies the CIPSO IP option to packets by 22The CIPSO/IPv4 protocol engine applies the CIPSO IP option to packets by
19adding the CIPSO label to the socket. This causes all packets leaving the 23adding the CIPSO label to the socket. This causes all packets leaving the
@@ -24,7 +28,8 @@ label by using the NetLabel security module API; if the NetLabel "domain" is
24configured to use CIPSO for packet labeling then a CIPSO IP option will be 28configured to use CIPSO for packet labeling then a CIPSO IP option will be
25generated and attached to the socket. 29generated and attached to the socket.
26 30
27 * Inbound Packet Processing 31Inbound Packet Processing
32=========================
28 33
29The CIPSO/IPv4 protocol engine validates every CIPSO IP option it finds at the 34The CIPSO/IPv4 protocol engine validates every CIPSO IP option it finds at the
30IP layer without any special handling required by the LSM. However, in order 35IP layer without any special handling required by the LSM. However, in order
@@ -33,7 +38,8 @@ NetLabel security module API to extract the security attributes of the packet.
33This is typically done at the socket layer using the 'socket_sock_rcv_skb()' 38This is typically done at the socket layer using the 'socket_sock_rcv_skb()'
34LSM hook. 39LSM hook.
35 40
36 * Label Translation 41Label Translation
42=================
37 43
38The CIPSO/IPv4 protocol engine contains a mechanism to translate CIPSO security 44The CIPSO/IPv4 protocol engine contains a mechanism to translate CIPSO security
39attributes such as sensitivity level and category to values which are 45attributes such as sensitivity level and category to values which are
@@ -42,7 +48,8 @@ Domain Of Interpretation (DOI) definition and are configured through the
42NetLabel user space communication layer. Each DOI definition can have a 48NetLabel user space communication layer. Each DOI definition can have a
43different security attribute mapping table. 49different security attribute mapping table.
44 50
45 * Label Translation Cache 51Label Translation Cache
52=======================
46 53
47The NetLabel system provides a framework for caching security attribute 54The NetLabel system provides a framework for caching security attribute
48mappings from the network labels to the corresponding LSM identifiers. The 55mappings from the network labels to the corresponding LSM identifiers. The
diff --git a/Documentation/netlabel/draft_ietf.rst b/Documentation/netlabel/draft_ietf.rst
new file mode 100644
index 000000000000..5ed39ab8234b
--- /dev/null
+++ b/Documentation/netlabel/draft_ietf.rst
@@ -0,0 +1,5 @@
1Draft IETF CIPSO IP Security
2----------------------------
3
4 .. include:: draft-ietf-cipso-ipsecurity-01.txt
5 :literal:
diff --git a/Documentation/netlabel/index.rst b/Documentation/netlabel/index.rst
new file mode 100644
index 000000000000..47f1e0e5acd1
--- /dev/null
+++ b/Documentation/netlabel/index.rst
@@ -0,0 +1,21 @@
1:orphan:
2
3========
4NetLabel
5========
6
7.. toctree::
8 :maxdepth: 1
9
10 introduction
11 cipso_ipv4
12 lsm_interface
13
14 draft_ietf
15
16.. only:: subproject and html
17
18 Indices
19 =======
20
21 * :ref:`genindex`
diff --git a/Documentation/netlabel/introduction.txt b/Documentation/netlabel/introduction.rst
index 3caf77bcff0f..9333bbb0adc1 100644
--- a/Documentation/netlabel/introduction.txt
+++ b/Documentation/netlabel/introduction.rst
@@ -1,10 +1,13 @@
1=====================
1NetLabel Introduction 2NetLabel Introduction
2============================================================================== 3=====================
4
3Paul Moore, paul.moore@hp.com 5Paul Moore, paul.moore@hp.com
4 6
5August 2, 2006 7August 2, 2006
6 8
7 * Overview 9Overview
10========
8 11
9NetLabel is a mechanism which can be used by kernel security modules to attach 12NetLabel is a mechanism which can be used by kernel security modules to attach
10security attributes to outgoing network packets generated from user space 13security attributes to outgoing network packets generated from user space
@@ -12,7 +15,8 @@ applications and read security attributes from incoming network packets. It
12is composed of three main components, the protocol engines, the communication 15is composed of three main components, the protocol engines, the communication
13layer, and the kernel security module API. 16layer, and the kernel security module API.
14 17
15 * Protocol Engines 18Protocol Engines
19================
16 20
17The protocol engines are responsible for both applying and retrieving the 21The protocol engines are responsible for both applying and retrieving the
18network packet's security attributes. If any translation between the network 22network packet's security attributes. If any translation between the network
@@ -24,7 +28,8 @@ the NetLabel kernel security module API described below.
24Detailed information about each NetLabel protocol engine can be found in this 28Detailed information about each NetLabel protocol engine can be found in this
25directory. 29directory.
26 30
27 * Communication Layer 31Communication Layer
32===================
28 33
29The communication layer exists to allow NetLabel configuration and monitoring 34The communication layer exists to allow NetLabel configuration and monitoring
30from user space. The NetLabel communication layer uses a message based 35from user space. The NetLabel communication layer uses a message based
@@ -33,7 +38,8 @@ formatting of these NetLabel messages as well as the Generic NETLINK family
33names can be found in the 'net/netlabel/' directory as comments in the 38names can be found in the 'net/netlabel/' directory as comments in the
34header files as well as in 'include/net/netlabel.h'. 39header files as well as in 'include/net/netlabel.h'.
35 40
36 * Security Module API 41Security Module API
42===================
37 43
38The purpose of the NetLabel security module API is to provide a protocol 44The purpose of the NetLabel security module API is to provide a protocol
39independent interface to the underlying NetLabel protocol engines. In addition 45independent interface to the underlying NetLabel protocol engines. In addition
diff --git a/Documentation/netlabel/lsm_interface.txt b/Documentation/netlabel/lsm_interface.rst
index 638c74f7de7f..026fc267f798 100644
--- a/Documentation/netlabel/lsm_interface.txt
+++ b/Documentation/netlabel/lsm_interface.rst
@@ -1,10 +1,13 @@
1========================================
1NetLabel Linux Security Module Interface 2NetLabel Linux Security Module Interface
2============================================================================== 3========================================
4
3Paul Moore, paul.moore@hp.com 5Paul Moore, paul.moore@hp.com
4 6
5May 17, 2006 7May 17, 2006
6 8
7 * Overview 9Overview
10========
8 11
9NetLabel is a mechanism which can set and retrieve security attributes from 12NetLabel is a mechanism which can set and retrieve security attributes from
10network packets. It is intended to be used by LSM developers who want to make 13network packets. It is intended to be used by LSM developers who want to make
@@ -12,7 +15,8 @@ use of a common code base for several different packet labeling protocols.
12The NetLabel security module API is defined in 'include/net/netlabel.h' but a 15The NetLabel security module API is defined in 'include/net/netlabel.h' but a
13brief overview is given below. 16brief overview is given below.
14 17
15 * NetLabel Security Attributes 18NetLabel Security Attributes
19============================
16 20
17Since NetLabel supports multiple different packet labeling protocols and LSMs 21Since NetLabel supports multiple different packet labeling protocols and LSMs
18it uses the concept of security attributes to refer to the packet's security 22it uses the concept of security attributes to refer to the packet's security
@@ -24,7 +28,8 @@ configuration. It is up to the LSM developer to translate the NetLabel
24security attributes into whatever security identifiers are in use for their 28security attributes into whatever security identifiers are in use for their
25particular LSM. 29particular LSM.
26 30
27 * NetLabel LSM Protocol Operations 31NetLabel LSM Protocol Operations
32================================
28 33
29These are the functions which allow the LSM developer to manipulate the labels 34These are the functions which allow the LSM developer to manipulate the labels
30on outgoing packets as well as read the labels on incoming packets. Functions 35on outgoing packets as well as read the labels on incoming packets. Functions
@@ -32,7 +37,8 @@ exist to operate both on sockets as well as the sk_buffs directly. These high
32level functions are translated into low level protocol operations based on how 37level functions are translated into low level protocol operations based on how
33the administrator has configured the NetLabel subsystem. 38the administrator has configured the NetLabel subsystem.
34 39
35 * NetLabel Label Mapping Cache Operations 40NetLabel Label Mapping Cache Operations
41=======================================
36 42
37Depending on the exact configuration, translation between the network packet 43Depending on the exact configuration, translation between the network packet
38label and the internal LSM security identifier can be time consuming. The 44label and the internal LSM security identifier can be time consuming. The
diff --git a/Documentation/networking/device_drivers/freescale/dpaa2/dpio-driver.rst b/Documentation/networking/device_drivers/freescale/dpaa2/dpio-driver.rst
index 5045df990a4c..17dbee1ac53e 100644
--- a/Documentation/networking/device_drivers/freescale/dpaa2/dpio-driver.rst
+++ b/Documentation/networking/device_drivers/freescale/dpaa2/dpio-driver.rst
@@ -39,8 +39,7 @@ The Linux DPIO driver consists of 3 primary components--
39 39
40 DPIO service-- provides APIs to other Linux drivers for services 40 DPIO service-- provides APIs to other Linux drivers for services
41 41
42 QBman portal interface-- sends portal commands, gets responses 42 QBman portal interface-- sends portal commands, gets responses::
43::
44 43
45 fsl-mc other 44 fsl-mc other
46 bus drivers 45 bus drivers
@@ -60,6 +59,7 @@ The Linux DPIO driver consists of 3 primary components--
60 59
61The diagram below shows how the DPIO driver components fit with the other 60The diagram below shows how the DPIO driver components fit with the other
62DPAA2 Linux driver components:: 61DPAA2 Linux driver components::
62
63 +------------+ 63 +------------+
64 | OS Network | 64 | OS Network |
65 | Stack | 65 | Stack |
diff --git a/Documentation/networking/dsa/dsa.rst b/Documentation/networking/dsa/dsa.rst
index ca87068b9ab9..563d56c6a25c 100644
--- a/Documentation/networking/dsa/dsa.rst
+++ b/Documentation/networking/dsa/dsa.rst
@@ -531,7 +531,7 @@ Bridge VLAN filtering
531 a software implementation. 531 a software implementation.
532 532
533.. note:: VLAN ID 0 corresponds to the port private database, which, in the context 533.. note:: VLAN ID 0 corresponds to the port private database, which, in the context
534 of DSA, would be the its port-based VLAN, used by the associated bridge device. 534 of DSA, would be its port-based VLAN, used by the associated bridge device.
535 535
536- ``port_fdb_del``: bridge layer function invoked when the bridge wants to remove a 536- ``port_fdb_del``: bridge layer function invoked when the bridge wants to remove a
537 Forwarding Database entry, the switch hardware should be programmed to delete 537 Forwarding Database entry, the switch hardware should be programmed to delete
@@ -554,7 +554,7 @@ Bridge VLAN filtering
554 associated with this VLAN ID. 554 associated with this VLAN ID.
555 555
556.. note:: VLAN ID 0 corresponds to the port private database, which, in the context 556.. note:: VLAN ID 0 corresponds to the port private database, which, in the context
557 of DSA, would be the its port-based VLAN, used by the associated bridge device. 557 of DSA, would be its port-based VLAN, used by the associated bridge device.
558 558
559- ``port_mdb_del``: bridge layer function invoked when the bridge wants to remove a 559- ``port_mdb_del``: bridge layer function invoked when the bridge wants to remove a
560 multicast database entry, the switch hardware should be programmed to delete 560 multicast database entry, the switch hardware should be programmed to delete
diff --git a/Documentation/networking/dsa/sja1105.rst b/Documentation/networking/dsa/sja1105.rst
index ea7bac438cfd..cb2858dece93 100644
--- a/Documentation/networking/dsa/sja1105.rst
+++ b/Documentation/networking/dsa/sja1105.rst
@@ -86,13 +86,13 @@ functionality.
86The following traffic modes are supported over the switch netdevices: 86The following traffic modes are supported over the switch netdevices:
87 87
88+--------------------+------------+------------------+------------------+ 88+--------------------+------------+------------------+------------------+
89| | Standalone | Bridged with | Bridged with | 89| | Standalone | Bridged with | Bridged with |
90| | ports | vlan_filtering 0 | vlan_filtering 1 | 90| | ports | vlan_filtering 0 | vlan_filtering 1 |
91+====================+============+==================+==================+ 91+====================+============+==================+==================+
92| Regular traffic | Yes | Yes | No (use master) | 92| Regular traffic | Yes | Yes | No (use master) |
93+--------------------+------------+------------------+------------------+ 93+--------------------+------------+------------------+------------------+
94| Management traffic | Yes | Yes | Yes | 94| Management traffic | Yes | Yes | Yes |
95| (BPDU, PTP) | | | | 95| (BPDU, PTP) | | | |
96+--------------------+------------+------------------+------------------+ 96+--------------------+------------+------------------+------------------+
97 97
98Switching features 98Switching features
diff --git a/Documentation/networking/timestamping.txt b/Documentation/networking/timestamping.txt
index bbdaf8990031..8dd6333c3270 100644
--- a/Documentation/networking/timestamping.txt
+++ b/Documentation/networking/timestamping.txt
@@ -368,7 +368,7 @@ ts[1] used to hold hardware timestamps converted to system time.
368Instead, expose the hardware clock device on the NIC directly as 368Instead, expose the hardware clock device on the NIC directly as
369a HW PTP clock source, to allow time conversion in userspace and 369a HW PTP clock source, to allow time conversion in userspace and
370optionally synchronize system time with a userspace PTP stack such 370optionally synchronize system time with a userspace PTP stack such
371as linuxptp. For the PTP clock API, see Documentation/ptp/ptp.txt. 371as linuxptp. For the PTP clock API, see Documentation/driver-api/ptp.rst.
372 372
373Note that if the SO_TIMESTAMP or SO_TIMESTAMPNS option is enabled 373Note that if the SO_TIMESTAMP or SO_TIMESTAMPNS option is enabled
374together with SO_TIMESTAMPING using SOF_TIMESTAMPING_SOFTWARE, a false 374together with SO_TIMESTAMPING using SOF_TIMESTAMPING_SOFTWARE, a false
diff --git a/Documentation/nvdimm/nvdimm.txt b/Documentation/nvdimm/nvdimm.txt
index e894de69915a..1669f626b037 100644
--- a/Documentation/nvdimm/nvdimm.txt
+++ b/Documentation/nvdimm/nvdimm.txt
@@ -284,8 +284,8 @@ A bus has a 1:1 relationship with an NFIT. The current expectation for
284ACPI based systems is that there is only ever one platform-global NFIT. 284ACPI based systems is that there is only ever one platform-global NFIT.
285That said, it is trivial to register multiple NFITs, the specification 285That said, it is trivial to register multiple NFITs, the specification
286does not preclude it. The infrastructure supports multiple busses and 286does not preclude it. The infrastructure supports multiple busses and
287we we use this capability to test multiple NFIT configurations in the 287we use this capability to test multiple NFIT configurations in the unit
288unit test. 288test.
289 289
290LIBNVDIMM: control class device in /sys/class 290LIBNVDIMM: control class device in /sys/class
291 291
diff --git a/Documentation/pcmcia/devicetable.txt b/Documentation/pcmcia/devicetable.rst
index 5f3e00ab54c4..fd1d60d12ca1 100644
--- a/Documentation/pcmcia/devicetable.txt
+++ b/Documentation/pcmcia/devicetable.rst
@@ -1,3 +1,7 @@
1============
2Device table
3============
4
1Matching of PCMCIA devices to drivers is done using one or more of the 5Matching of PCMCIA devices to drivers is done using one or more of the
2following criteria: 6following criteria:
3 7
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.rst
index 78355c4c268a..33fe9ebec049 100644
--- a/Documentation/pcmcia/driver-changes.txt
+++ b/Documentation/pcmcia/driver-changes.rst
@@ -1,15 +1,21 @@
1==============
2Driver changes
3==============
4
1This file details changes in 2.6 which affect PCMCIA card driver authors: 5This file details changes in 2.6 which affect PCMCIA card driver authors:
6
2* pcmcia_loop_config() and autoconfiguration (as of 2.6.36) 7* pcmcia_loop_config() and autoconfiguration (as of 2.6.36)
3 If struct pcmcia_device *p_dev->config_flags is set accordingly, 8 If `struct pcmcia_device *p_dev->config_flags` is set accordingly,
4 pcmcia_loop_config() now sets up certain configuration values 9 pcmcia_loop_config() now sets up certain configuration values
5 automatically, though the driver may still override the settings 10 automatically, though the driver may still override the settings
6 in the callback function. The following autoconfiguration options 11 in the callback function. The following autoconfiguration options
7 are provided at the moment: 12 are provided at the moment:
8 CONF_AUTO_CHECK_VCC : check for matching Vcc 13
9 CONF_AUTO_SET_VPP : set Vpp 14 - CONF_AUTO_CHECK_VCC : check for matching Vcc
10 CONF_AUTO_AUDIO : auto-enable audio line, if required 15 - CONF_AUTO_SET_VPP : set Vpp
11 CONF_AUTO_SET_IO : set ioport resources (->resource[0,1]) 16 - CONF_AUTO_AUDIO : auto-enable audio line, if required
12 CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2]) 17 - CONF_AUTO_SET_IO : set ioport resources (->resource[0,1])
18 - CONF_AUTO_SET_IOMEM : set first iomem resource (->resource[2])
13 19
14* pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36) 20* pcmcia_request_configuration -> pcmcia_enable_device (as of 2.6.36)
15 pcmcia_request_configuration() got renamed to pcmcia_enable_device(), 21 pcmcia_request_configuration() got renamed to pcmcia_enable_device(),
@@ -19,14 +25,14 @@ This file details changes in 2.6 which affect PCMCIA card driver authors:
19 25
20* pcmcia_request_window changes (as of 2.6.36) 26* pcmcia_request_window changes (as of 2.6.36)
21 Instead of win_req_t, drivers are now requested to fill out 27 Instead of win_req_t, drivers are now requested to fill out
22 struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four ioport 28 `struct pcmcia_device *p_dev->resource[2,3,4,5]` for up to four ioport
23 ranges. After a call to pcmcia_request_window(), the regions found there 29 ranges. After a call to pcmcia_request_window(), the regions found there
24 are reserved and may be used immediately -- until pcmcia_release_window() 30 are reserved and may be used immediately -- until pcmcia_release_window()
25 is called. 31 is called.
26 32
27* pcmcia_request_io changes (as of 2.6.36) 33* pcmcia_request_io changes (as of 2.6.36)
28 Instead of io_req_t, drivers are now requested to fill out 34 Instead of io_req_t, drivers are now requested to fill out
29 struct pcmcia_device *p_dev->resource[0,1] for up to two ioport 35 `struct pcmcia_device *p_dev->resource[0,1]` for up to two ioport
30 ranges. After a call to pcmcia_request_io(), the ports found there 36 ranges. After a call to pcmcia_request_io(), the ports found there
31 are reserved, after calling pcmcia_request_configuration(), they may 37 are reserved, after calling pcmcia_request_configuration(), they may
32 be used. 38 be used.
@@ -42,7 +48,8 @@ This file details changes in 2.6 which affect PCMCIA card driver authors:
42* New IRQ request rules (as of 2.6.35) 48* New IRQ request rules (as of 2.6.35)
43 Instead of the old pcmcia_request_irq() interface, drivers may now 49 Instead of the old pcmcia_request_irq() interface, drivers may now
44 choose between: 50 choose between:
45 - calling request_irq/free_irq directly. Use the IRQ from *p_dev->irq. 51
52 - calling request_irq/free_irq directly. Use the IRQ from `*p_dev->irq`.
46 - use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will 53 - use pcmcia_request_irq(p_dev, handler_t); the PCMCIA core will
47 clean up automatically on calls to pcmcia_disable_device() or 54 clean up automatically on calls to pcmcia_disable_device() or
48 device ejection. 55 device ejection.
@@ -72,13 +79,16 @@ This file details changes in 2.6 which affect PCMCIA card driver authors:
72 exports for them were removed. 79 exports for them were removed.
73 80
74* Unify detach and REMOVAL event code, as well as attach and INSERTION 81* Unify detach and REMOVAL event code, as well as attach and INSERTION
75 code (as of 2.6.16) 82 code (as of 2.6.16)::
83
76 void (*remove) (struct pcmcia_device *dev); 84 void (*remove) (struct pcmcia_device *dev);
77 int (*probe) (struct pcmcia_device *dev); 85 int (*probe) (struct pcmcia_device *dev);
78 86
79* Move suspend, resume and reset out of event handler (as of 2.6.16) 87* Move suspend, resume and reset out of event handler (as of 2.6.16)::
88
80 int (*suspend) (struct pcmcia_device *dev); 89 int (*suspend) (struct pcmcia_device *dev);
81 int (*resume) (struct pcmcia_device *dev); 90 int (*resume) (struct pcmcia_device *dev);
91
82 should be initialized in struct pcmcia_driver, and handle 92 should be initialized in struct pcmcia_driver, and handle
83 (SUSPEND == RESET_PHYSICAL) and (RESUME == CARD_RESET) events 93 (SUSPEND == RESET_PHYSICAL) and (RESUME == CARD_RESET) events
84 94
@@ -117,7 +127,8 @@ This file details changes in 2.6 which affect PCMCIA card driver authors:
117* core functions no longer available (as of 2.6.11) 127* core functions no longer available (as of 2.6.11)
118 The following functions have been removed from the kernel source 128 The following functions have been removed from the kernel source
119 because they are unused by all in-kernel drivers, and no external 129 because they are unused by all in-kernel drivers, and no external
120 driver was reported to rely on them: 130 driver was reported to rely on them::
131
121 pcmcia_get_first_region() 132 pcmcia_get_first_region()
122 pcmcia_get_next_region() 133 pcmcia_get_next_region()
123 pcmcia_modify_window() 134 pcmcia_modify_window()
diff --git a/Documentation/pcmcia/driver.txt b/Documentation/pcmcia/driver.rst
index 0ac167920778..5c4fe84d51c1 100644
--- a/Documentation/pcmcia/driver.txt
+++ b/Documentation/pcmcia/driver.rst
@@ -1,16 +1,16 @@
1=============
1PCMCIA Driver 2PCMCIA Driver
2------------- 3=============
3
4 4
5sysfs 5sysfs
6----- 6-----
7 7
8New PCMCIA IDs may be added to a device driver pcmcia_device_id table at 8New PCMCIA IDs may be added to a device driver pcmcia_device_id table at
9runtime as shown below: 9runtime as shown below::
10 10
11echo "match_flags manf_id card_id func_id function device_no \ 11 echo "match_flags manf_id card_id func_id function device_no \
12prod_id_hash[0] prod_id_hash[1] prod_id_hash[2] prod_id_hash[3]" > \ 12 prod_id_hash[0] prod_id_hash[1] prod_id_hash[2] prod_id_hash[3]" > \
13/sys/bus/pcmcia/drivers/{driver}/new_id 13 /sys/bus/pcmcia/drivers/{driver}/new_id
14 14
15All fields are passed in as hexadecimal values (no leading 0x). 15All fields are passed in as hexadecimal values (no leading 0x).
16The meaning is described in the PCMCIA specification, the match_flags is 16The meaning is described in the PCMCIA specification, the match_flags is
@@ -22,9 +22,9 @@ PCMCIA device listed in its (newly updated) pcmcia_device_id list.
22 22
23A common use-case is to add a new device according to the manufacturer ID 23A common use-case is to add a new device according to the manufacturer ID
24and the card ID (form the manf_id and card_id file in the device tree). 24and the card ID (form the manf_id and card_id file in the device tree).
25For this, just use: 25For this, just use::
26 26
27echo "0x3 manf_id card_id 0 0 0 0 0 0 0" > \ 27 echo "0x3 manf_id card_id 0 0 0 0 0 0 0" > \
28 /sys/bus/pcmcia/drivers/{driver}/new_id 28 /sys/bus/pcmcia/drivers/{driver}/new_id
29 29
30after loading the driver. 30after loading the driver.
diff --git a/Documentation/pcmcia/index.rst b/Documentation/pcmcia/index.rst
new file mode 100644
index 000000000000..779c8527109e
--- /dev/null
+++ b/Documentation/pcmcia/index.rst
@@ -0,0 +1,20 @@
1:orphan:
2
3======
4pcmcia
5======
6
7.. toctree::
8 :maxdepth: 1
9
10 driver
11 devicetable
12 locking
13 driver-changes
14
15.. only:: subproject and html
16
17 Indices
18 =======
19
20 * :ref:`genindex`
diff --git a/Documentation/pcmcia/locking.txt b/Documentation/pcmcia/locking.rst
index b2c9b478906b..e35257139c89 100644
--- a/Documentation/pcmcia/locking.txt
+++ b/Documentation/pcmcia/locking.rst
@@ -1,3 +1,7 @@
1=======
2Locking
3=======
4
1This file explains the locking and exclusion scheme used in the PCCARD 5This file explains the locking and exclusion scheme used in the PCCARD
2and PCMCIA subsystems. 6and PCMCIA subsystems.
3 7
@@ -5,16 +9,21 @@ and PCMCIA subsystems.
5A) Overview, Locking Hierarchy: 9A) Overview, Locking Hierarchy:
6=============================== 10===============================
7 11
8pcmcia_socket_list_rwsem - protects only the list of sockets 12pcmcia_socket_list_rwsem
9- skt_mutex - serializes card insert / ejection 13 - protects only the list of sockets
10 - ops_mutex - serializes socket operation 14
15- skt_mutex
16 - serializes card insert / ejection
17
18 - ops_mutex
19 - serializes socket operation
11 20
12 21
13B) Exclusion 22B) Exclusion
14============ 23============
15 24
16The following functions and callbacks to struct pcmcia_socket must 25The following functions and callbacks to struct pcmcia_socket must
17be called with "skt_mutex" held: 26be called with "skt_mutex" held::
18 27
19 socket_detect_change() 28 socket_detect_change()
20 send_event() 29 send_event()
@@ -31,7 +40,7 @@ be called with "skt_mutex" held:
31 struct pcmcia_callback *callback 40 struct pcmcia_callback *callback
32 41
33The following functions and callbacks to struct pcmcia_socket must 42The following functions and callbacks to struct pcmcia_socket must
34be called with "ops_mutex" held: 43be called with "ops_mutex" held::
35 44
36 socket_reset() 45 socket_reset()
37 socket_setup() 46 socket_setup()
@@ -39,7 +48,7 @@ be called with "ops_mutex" held:
39 struct pccard_operations *ops 48 struct pccard_operations *ops
40 struct pccard_resource_ops *resource_ops; 49 struct pccard_resource_ops *resource_ops;
41 50
42Note that send_event() and struct pcmcia_callback *callback must not be 51Note that send_event() and `struct pcmcia_callback *callback` must not be
43called with "ops_mutex" held. 52called with "ops_mutex" held.
44 53
45 54
@@ -60,19 +69,23 @@ The resource_ops and their data are protected by ops_mutex.
60The "main" struct pcmcia_socket is protected as follows (read-only fields 69The "main" struct pcmcia_socket is protected as follows (read-only fields
61or single-use fields not mentioned): 70or single-use fields not mentioned):
62 71
63- by pcmcia_socket_list_rwsem: 72- by pcmcia_socket_list_rwsem::
73
64 struct list_head socket_list; 74 struct list_head socket_list;
65 75
66- by thread_lock: 76- by thread_lock::
77
67 unsigned int thread_events; 78 unsigned int thread_events;
68 79
69- by skt_mutex: 80- by skt_mutex::
81
70 u_int suspended_state; 82 u_int suspended_state;
71 void (*tune_bridge); 83 void (*tune_bridge);
72 struct pcmcia_callback *callback; 84 struct pcmcia_callback *callback;
73 int resume_status; 85 int resume_status;
74 86
75- by ops_mutex: 87- by ops_mutex::
88
76 socket_state_t socket; 89 socket_state_t socket;
77 u_int state; 90 u_int state;
78 u_short lock_count; 91 u_short lock_count;
@@ -100,7 +113,8 @@ The "main" struct pcmcia_device is protected as follows (read-only fields
100or single-use fields not mentioned): 113or single-use fields not mentioned):
101 114
102 115
103- by pcmcia_socket->ops_mutex: 116- by pcmcia_socket->ops_mutex::
117
104 struct list_head socket_device_list; 118 struct list_head socket_device_list;
105 struct config_t *function_config; 119 struct config_t *function_config;
106 u16 _irq:1; 120 u16 _irq:1;
@@ -111,7 +125,8 @@ or single-use fields not mentioned):
111 u16 suspended:1; 125 u16 suspended:1;
112 u16 _removed:1; 126 u16 _removed:1;
113 127
114- by the PCMCIA driver: 128- by the PCMCIA driver::
129
115 io_req_t io; 130 io_req_t io;
116 irq_req_t irq; 131 irq_req_t irq;
117 config_req_t conf; 132 config_req_t conf;
diff --git a/Documentation/platform/x86-laptop-drivers.txt b/Documentation/platform/x86-laptop-drivers.txt
deleted file mode 100644
index 01facd2590bb..000000000000
--- a/Documentation/platform/x86-laptop-drivers.txt
+++ /dev/null
@@ -1,18 +0,0 @@
1compal-laptop
2=============
3List of supported hardware:
4
5by Compal:
6 Compal FL90/IFL90
7 Compal FL91/IFL91
8 Compal FL92/JFL92
9 Compal FT00/IFT00
10
11by Dell:
12 Dell Vostro 1200
13 Dell Mini 9 (Inspiron 910)
14 Dell Mini 10 (Inspiron 1010)
15 Dell Mini 10v (Inspiron 1011)
16 Dell Mini 1012 (Inspiron 1012)
17 Dell Inspiron 11z (Inspiron 1110)
18 Dell Mini 12 (Inspiron 1210)
diff --git a/Documentation/powerpc/firmware-assisted-dump.txt b/Documentation/powerpc/firmware-assisted-dump.txt
index 18c5feef2577..0c41d6d463f3 100644
--- a/Documentation/powerpc/firmware-assisted-dump.txt
+++ b/Documentation/powerpc/firmware-assisted-dump.txt
@@ -59,7 +59,7 @@ as follows:
59 the default calculated size. Use this option if default 59 the default calculated size. Use this option if default
60 boot memory size is not sufficient for second kernel to 60 boot memory size is not sufficient for second kernel to
61 boot successfully. For syntax of crashkernel= parameter, 61 boot successfully. For syntax of crashkernel= parameter,
62 refer to Documentation/kdump/kdump.txt. If any offset is 62 refer to Documentation/kdump/kdump.rst. If any offset is
63 provided in crashkernel= parameter, it will be ignored 63 provided in crashkernel= parameter, it will be ignored
64 as fadump uses a predefined offset to reserve memory 64 as fadump uses a predefined offset to reserve memory
65 for boot memory dump preservation in case of a crash. 65 for boot memory dump preservation in case of a crash.
diff --git a/Documentation/powerpc/isa-versions.rst b/Documentation/powerpc/isa-versions.rst
index 812e20cc898c..66c24140ebf1 100644
--- a/Documentation/powerpc/isa-versions.rst
+++ b/Documentation/powerpc/isa-versions.rst
@@ -1,3 +1,5 @@
1:orphan:
2
1CPU to ISA Version Mapping 3CPU to ISA Version Mapping
2========================== 4==========================
3 5
diff --git a/Documentation/process/4.Coding.rst b/Documentation/process/4.Coding.rst
index 4b7a5ab3cec1..13dd893c9f88 100644
--- a/Documentation/process/4.Coding.rst
+++ b/Documentation/process/4.Coding.rst
@@ -298,7 +298,7 @@ enabled, a configurable percentage of memory allocations will be made to
298fail; these failures can be restricted to a specific range of code. 298fail; these failures can be restricted to a specific range of code.
299Running with fault injection enabled allows the programmer to see how the 299Running with fault injection enabled allows the programmer to see how the
300code responds when things go badly. See 300code responds when things go badly. See
301Documentation/fault-injection/fault-injection.txt for more information on 301Documentation/fault-injection/fault-injection.rst for more information on
302how to use this facility. 302how to use this facility.
303 303
304Other kinds of errors can be found with the "sparse" static analysis tool. 304Other kinds of errors can be found with the "sparse" static analysis tool.
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index fa864a51e6ea..f4a2198187f9 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -686,7 +686,7 @@ filesystems) should advertise this prominently in their prompt string::
686 ... 686 ...
687 687
688For full documentation on the configuration files, see the file 688For full documentation on the configuration files, see the file
689Documentation/kbuild/kconfig-language.txt. 689Documentation/kbuild/kconfig-language.rst.
690 690
691 691
69211) Data structures 69211) Data structures
diff --git a/Documentation/process/maintainer-pgp-guide.rst b/Documentation/process/maintainer-pgp-guide.rst
index 4bab7464ff8c..17db11b7ed48 100644
--- a/Documentation/process/maintainer-pgp-guide.rst
+++ b/Documentation/process/maintainer-pgp-guide.rst
@@ -238,7 +238,10 @@ your new subkey::
238 work. 238 work.
239 239
240 If for some reason you prefer to stay with RSA subkeys, just replace 240 If for some reason you prefer to stay with RSA subkeys, just replace
241 "ed25519" with "rsa2048" in the above command. 241 "ed25519" with "rsa2048" in the above command. Additionally, if you
242 plan to use a hardware device that does not support ED25519 ECC
243 keys, like Nitrokey Pro or a Yubikey, then you should use
244 "nistp256" instead or "ed25519."
242 245
243 246
244Back up your master key for disaster recovery 247Back up your master key for disaster recovery
@@ -432,23 +435,23 @@ Available smartcard devices
432 435
433Unless all your laptops and workstations have smartcard readers, the 436Unless all your laptops and workstations have smartcard readers, the
434easiest is to get a specialized USB device that implements smartcard 437easiest is to get a specialized USB device that implements smartcard
435functionality. There are several options available: 438functionality. There are several options available:
436 439
437- `Nitrokey Start`_: Open hardware and Free Software, based on FSI 440- `Nitrokey Start`_: Open hardware and Free Software, based on FSI
438 Japan's `Gnuk`_. Offers support for ECC keys, but fewest security 441 Japan's `Gnuk`_. One of the few available commercial devices that
439 features (such as resistance to tampering or some side-channel 442 support ED25519 ECC keys, but offer fewest security features (such as
440 attacks). 443 resistance to tampering or some side-channel attacks).
441- `Nitrokey Pro`_: Similar to the Nitrokey Start, but more 444- `Nitrokey Pro 2`_: Similar to the Nitrokey Start, but more
442 tamper-resistant and offers more security features, but no ECC 445 tamper-resistant and offers more security features. Pro 2 supports ECC
443 support. 446 cryptography (NISTP).
444- `Yubikey 4`_: proprietary hardware and software, but cheaper than 447- `Yubikey 5`_: proprietary hardware and software, but cheaper than
445 Nitrokey Pro and comes available in the USB-C form that is more useful 448 Nitrokey Pro and comes available in the USB-C form that is more useful
446 with newer laptops. Offers additional security features such as FIDO 449 with newer laptops. Offers additional security features such as FIDO
447 U2F, but no ECC. 450 U2F, among others, and now finally supports ECC keys (NISTP).
448 451
449`LWN has a good review`_ of some of the above models, as well as several 452`LWN has a good review`_ of some of the above models, as well as several
450others. If you want to use ECC keys, your best bet among commercially 453others. Your choice will depend on cost, shipping availability in your
451available devices is the Nitrokey Start. 454geographical region, and open/proprietary hardware considerations.
452 455
453.. note:: 456.. note::
454 457
@@ -457,8 +460,8 @@ available devices is the Nitrokey Start.
457 Foundation. 460 Foundation.
458 461
459.. _`Nitrokey Start`: https://shop.nitrokey.com/shop/product/nitrokey-start-6 462.. _`Nitrokey Start`: https://shop.nitrokey.com/shop/product/nitrokey-start-6
460.. _`Nitrokey Pro`: https://shop.nitrokey.com/shop/product/nitrokey-pro-3 463.. _`Nitrokey Pro 2`: https://shop.nitrokey.com/shop/product/nitrokey-pro-2-3
461.. _`Yubikey 4`: https://www.yubico.com/product/yubikey-4-series/ 464.. _`Yubikey 5`: https://www.yubico.com/products/yubikey-5-overview/
462.. _Gnuk: http://www.fsij.org/doc-gnuk/ 465.. _Gnuk: http://www.fsij.org/doc-gnuk/
463.. _`LWN has a good review`: https://lwn.net/Articles/736231/ 466.. _`LWN has a good review`: https://lwn.net/Articles/736231/
464.. _`qualify for a free Nitrokey Start`: https://www.kernel.org/nitrokey-digital-tokens-for-kernel-developers.html 467.. _`qualify for a free Nitrokey Start`: https://www.kernel.org/nitrokey-digital-tokens-for-kernel-developers.html
diff --git a/Documentation/process/submit-checklist.rst b/Documentation/process/submit-checklist.rst
index c88867b173d9..365efc9e4aa8 100644
--- a/Documentation/process/submit-checklist.rst
+++ b/Documentation/process/submit-checklist.rst
@@ -39,7 +39,7 @@ and elsewhere regarding submitting Linux kernel patches.
39 39
406) Any new or modified ``CONFIG`` options do not muck up the config menu and 406) Any new or modified ``CONFIG`` options do not muck up the config menu and
41 default to off unless they meet the exception criteria documented in 41 default to off unless they meet the exception criteria documented in
42 ``Documentation/kbuild/kconfig-language.txt`` Menu attributes: default value. 42 ``Documentation/kbuild/kconfig-language.rst`` Menu attributes: default value.
43 43
447) All new ``Kconfig`` options have help text. 447) All new ``Kconfig`` options have help text.
45 45
diff --git a/Documentation/riscv/index.rst b/Documentation/riscv/index.rst
new file mode 100644
index 000000000000..c4b906d9b5a7
--- /dev/null
+++ b/Documentation/riscv/index.rst
@@ -0,0 +1,17 @@
1:orphan:
2
3===================
4RISC-V architecture
5===================
6
7.. toctree::
8 :maxdepth: 1
9
10 pmu
11
12.. only:: subproject and html
13
14 Indices
15 =======
16
17 * :ref:`genindex`
diff --git a/Documentation/riscv/pmu.txt b/Documentation/riscv/pmu.rst
index b29f03a6d82f..acb216b99c26 100644
--- a/Documentation/riscv/pmu.txt
+++ b/Documentation/riscv/pmu.rst
@@ -1,5 +1,7 @@
1===================================
1Supporting PMUs on RISC-V platforms 2Supporting PMUs on RISC-V platforms
2========================================== 3===================================
4
3Alan Kao <alankao@andestech.com>, Mar 2018 5Alan Kao <alankao@andestech.com>, Mar 2018
4 6
5Introduction 7Introduction
@@ -77,13 +79,13 @@ Note that some features can be done in this stage as well:
77(2) privilege level setting (user space only, kernel space only, both); 79(2) privilege level setting (user space only, kernel space only, both);
78(3) destructor setting. Normally it is sufficient to apply *riscv_destroy_event*; 80(3) destructor setting. Normally it is sufficient to apply *riscv_destroy_event*;
79(4) tweaks for non-sampling events, which will be utilized by functions such as 81(4) tweaks for non-sampling events, which will be utilized by functions such as
80*perf_adjust_period*, usually something like the follows: 82 *perf_adjust_period*, usually something like the follows::
81 83
82if (!is_sampling_event(event)) { 84 if (!is_sampling_event(event)) {
83 hwc->sample_period = x86_pmu.max_period; 85 hwc->sample_period = x86_pmu.max_period;
84 hwc->last_period = hwc->sample_period; 86 hwc->last_period = hwc->sample_period;
85 local64_set(&hwc->period_left, hwc->sample_period); 87 local64_set(&hwc->period_left, hwc->sample_period);
86} 88 }
87 89
88In the case of *riscv_base_pmu*, only (3) is provided for now. 90In the case of *riscv_base_pmu*, only (3) is provided for now.
89 91
@@ -94,10 +96,10 @@ In the case of *riscv_base_pmu*, only (3) is provided for now.
943.1. Interrupt Initialization 963.1. Interrupt Initialization
95 97
96This often occurs at the beginning of the *event_init* method. In common 98This often occurs at the beginning of the *event_init* method. In common
97practice, this should be a code segment like 99practice, this should be a code segment like::
98 100
99int x86_reserve_hardware(void) 101 int x86_reserve_hardware(void)
100{ 102 {
101 int err = 0; 103 int err = 0;
102 104
103 if (!atomic_inc_not_zero(&pmc_refcount)) { 105 if (!atomic_inc_not_zero(&pmc_refcount)) {
@@ -114,7 +116,7 @@ int x86_reserve_hardware(void)
114 } 116 }
115 117
116 return err; 118 return err;
117} 119 }
118 120
119And the magic is in *reserve_pmc_hardware*, which usually does atomic 121And the magic is in *reserve_pmc_hardware*, which usually does atomic
120operations to make implemented IRQ accessible from some global function pointer. 122operations to make implemented IRQ accessible from some global function pointer.
@@ -128,28 +130,28 @@ which will be introduced in the next section.)
128 130
1293.2. IRQ Structure 1313.2. IRQ Structure
130 132
131Basically, a IRQ runs the following pseudo code: 133Basically, a IRQ runs the following pseudo code::
132 134
133for each hardware counter that triggered this overflow 135 for each hardware counter that triggered this overflow
134 136
135 get the event of this counter 137 get the event of this counter
136 138
137 // following two steps are defined as *read()*, 139 // following two steps are defined as *read()*,
138 // check the section Reading/Writing Counters for details. 140 // check the section Reading/Writing Counters for details.
139 count the delta value since previous interrupt 141 count the delta value since previous interrupt
140 update the event->count (# event occurs) by adding delta, and 142 update the event->count (# event occurs) by adding delta, and
141 event->hw.period_left by subtracting delta 143 event->hw.period_left by subtracting delta
142 144
143 if the event overflows 145 if the event overflows
144 sample data 146 sample data
145 set the counter appropriately for the next overflow 147 set the counter appropriately for the next overflow
146 148
147 if the event overflows again 149 if the event overflows again
148 too frequently, throttle this event 150 too frequently, throttle this event
149 fi 151 fi
150 fi 152 fi
151 153
152end for 154 end for
153 155
154However as of this writing, none of the RISC-V implementations have designed an 156However as of this writing, none of the RISC-V implementations have designed an
155interrupt for perf, so the details are to be completed in the future. 157interrupt for perf, so the details are to be completed in the future.
@@ -195,23 +197,26 @@ A normal flow of these state transitions are as follows:
195 At this stage, a general event is bound to a physical counter, if any. 197 At this stage, a general event is bound to a physical counter, if any.
196 The state changes to PERF_HES_STOPPED and PERF_HES_UPTODATE, because it is now 198 The state changes to PERF_HES_STOPPED and PERF_HES_UPTODATE, because it is now
197 stopped, and the (software) event count does not need updating. 199 stopped, and the (software) event count does not need updating.
198** *start* is then called, and the counter is enabled. 200
199 With flag PERF_EF_RELOAD, it writes an appropriate value to the counter (check 201 - *start* is then called, and the counter is enabled.
200 previous section for detail). 202 With flag PERF_EF_RELOAD, it writes an appropriate value to the counter (check
201 Nothing is written if the flag does not contain PERF_EF_RELOAD. 203 previous section for detail).
202 The state now is reset to none, because it is neither stopped nor updated 204 Nothing is written if the flag does not contain PERF_EF_RELOAD.
203 (the counting already started) 205 The state now is reset to none, because it is neither stopped nor updated
206 (the counting already started)
207
204* When being context-switched out, *del* is called. It then checks out all the 208* When being context-switched out, *del* is called. It then checks out all the
205 events in the PMU and calls *stop* to update their counts. 209 events in the PMU and calls *stop* to update their counts.
206** *stop* is called by *del*
207 and the perf core with flag PERF_EF_UPDATE, and it often shares the same
208 subroutine as *read* with the same logic.
209 The state changes to PERF_HES_STOPPED and PERF_HES_UPTODATE, again.
210 210
211** Life cycle of these two pairs: *add* and *del* are called repeatedly as 211 - *stop* is called by *del*
212 tasks switch in-and-out; *start* and *stop* is also called when the perf core 212 and the perf core with flag PERF_EF_UPDATE, and it often shares the same
213 needs a quick stop-and-start, for instance, when the interrupt period is being 213 subroutine as *read* with the same logic.
214 adjusted. 214 The state changes to PERF_HES_STOPPED and PERF_HES_UPTODATE, again.
215
216 - Life cycle of these two pairs: *add* and *del* are called repeatedly as
217 tasks switch in-and-out; *start* and *stop* is also called when the perf core
218 needs a quick stop-and-start, for instance, when the interrupt period is being
219 adjusted.
215 220
216Current implementation is sufficient for now and can be easily extended to 221Current implementation is sufficient for now and can be easily extended to
217features in the future. 222features in the future.
@@ -225,25 +230,26 @@ A. Related Structures
225 Both structures are designed to be read-only. 230 Both structures are designed to be read-only.
226 231
227 *struct pmu* defines some function pointer interfaces, and most of them take 232 *struct pmu* defines some function pointer interfaces, and most of them take
228*struct perf_event* as a main argument, dealing with perf events according to 233 *struct perf_event* as a main argument, dealing with perf events according to
229perf's internal state machine (check kernel/events/core.c for details). 234 perf's internal state machine (check kernel/events/core.c for details).
230 235
231 *struct riscv_pmu* defines PMU-specific parameters. The naming follows the 236 *struct riscv_pmu* defines PMU-specific parameters. The naming follows the
232convention of all other architectures. 237 convention of all other architectures.
233 238
234* struct perf_event: include/linux/perf_event.h 239* struct perf_event: include/linux/perf_event.h
235* struct hw_perf_event 240* struct hw_perf_event
236 241
237 The generic structure that represents perf events, and the hardware-related 242 The generic structure that represents perf events, and the hardware-related
238details. 243 details.
239 244
240* struct riscv_hw_events: arch/riscv/include/asm/perf_event.h 245* struct riscv_hw_events: arch/riscv/include/asm/perf_event.h
241 246
242 The structure that holds the status of events, has two fixed members: 247 The structure that holds the status of events, has two fixed members:
243the number of events and the array of the events. 248 the number of events and the array of the events.
244 249
245References 250References
246---------- 251----------
247 252
248[1] https://github.com/riscv/riscv-linux/pull/124 253[1] https://github.com/riscv/riscv-linux/pull/124
254
249[2] https://groups.google.com/a/groups.riscv.org/forum/#!topic/sw-dev/f19TmCNP6yA 255[2] https://groups.google.com/a/groups.riscv.org/forum/#!topic/sw-dev/f19TmCNP6yA
diff --git a/Documentation/scheduler/completion.txt b/Documentation/scheduler/completion.rst
index e5b9df4d8078..9f039b4f4b09 100644
--- a/Documentation/scheduler/completion.txt
+++ b/Documentation/scheduler/completion.rst
@@ -1,3 +1,4 @@
1================================================
1Completions - "wait for completion" barrier APIs 2Completions - "wait for completion" barrier APIs
2================================================ 3================================================
3 4
@@ -46,7 +47,7 @@ it has to wait for it.
46 47
47To use completions you need to #include <linux/completion.h> and 48To use completions you need to #include <linux/completion.h> and
48create a static or dynamic variable of type 'struct completion', 49create a static or dynamic variable of type 'struct completion',
49which has only two fields: 50which has only two fields::
50 51
51 struct completion { 52 struct completion {
52 unsigned int done; 53 unsigned int done;
@@ -57,7 +58,7 @@ This provides the ->wait waitqueue to place tasks on for waiting (if any), and
57the ->done completion flag for indicating whether it's completed or not. 58the ->done completion flag for indicating whether it's completed or not.
58 59
59Completions should be named to refer to the event that is being synchronized on. 60Completions should be named to refer to the event that is being synchronized on.
60A good example is: 61A good example is::
61 62
62 wait_for_completion(&early_console_added); 63 wait_for_completion(&early_console_added);
63 64
@@ -81,7 +82,7 @@ have taken place, even if these wait functions return prematurely due to a timeo
81or a signal triggering. 82or a signal triggering.
82 83
83Initializing of dynamically allocated completion objects is done via a call to 84Initializing of dynamically allocated completion objects is done via a call to
84init_completion(): 85init_completion()::
85 86
86 init_completion(&dynamic_object->done); 87 init_completion(&dynamic_object->done);
87 88
@@ -100,7 +101,8 @@ but be aware of other races.
100 101
101For static declaration and initialization, macros are available. 102For static declaration and initialization, macros are available.
102 103
103For static (or global) declarations in file scope you can use DECLARE_COMPLETION(): 104For static (or global) declarations in file scope you can use
105DECLARE_COMPLETION()::
104 106
105 static DECLARE_COMPLETION(setup_done); 107 static DECLARE_COMPLETION(setup_done);
106 DECLARE_COMPLETION(setup_done); 108 DECLARE_COMPLETION(setup_done);
@@ -111,7 +113,7 @@ initialized to 'not done' and doesn't require an init_completion() call.
111When a completion is declared as a local variable within a function, 113When a completion is declared as a local variable within a function,
112then the initialization should always use DECLARE_COMPLETION_ONSTACK() 114then the initialization should always use DECLARE_COMPLETION_ONSTACK()
113explicitly, not just to make lockdep happy, but also to make it clear 115explicitly, not just to make lockdep happy, but also to make it clear
114that limited scope had been considered and is intentional: 116that limited scope had been considered and is intentional::
115 117
116 DECLARE_COMPLETION_ONSTACK(setup_done) 118 DECLARE_COMPLETION_ONSTACK(setup_done)
117 119
@@ -140,11 +142,11 @@ Waiting for completions:
140------------------------ 142------------------------
141 143
142For a thread to wait for some concurrent activity to finish, it 144For a thread to wait for some concurrent activity to finish, it
143calls wait_for_completion() on the initialized completion structure: 145calls wait_for_completion() on the initialized completion structure::
144 146
145 void wait_for_completion(struct completion *done) 147 void wait_for_completion(struct completion *done)
146 148
147A typical usage scenario is: 149A typical usage scenario is::
148 150
149 CPU#1 CPU#2 151 CPU#1 CPU#2
150 152
@@ -192,17 +194,17 @@ A common problem that occurs is to have unclean assignment of return types,
192so take care to assign return-values to variables of the proper type. 194so take care to assign return-values to variables of the proper type.
193 195
194Checking for the specific meaning of return values also has been found 196Checking for the specific meaning of return values also has been found
195to be quite inaccurate, e.g. constructs like: 197to be quite inaccurate, e.g. constructs like::
196 198
197 if (!wait_for_completion_interruptible_timeout(...)) 199 if (!wait_for_completion_interruptible_timeout(...))
198 200
199... would execute the same code path for successful completion and for the 201... would execute the same code path for successful completion and for the
200interrupted case - which is probably not what you want. 202interrupted case - which is probably not what you want::
201 203
202 int wait_for_completion_interruptible(struct completion *done) 204 int wait_for_completion_interruptible(struct completion *done)
203 205
204This function marks the task TASK_INTERRUPTIBLE while it is waiting. 206This function marks the task TASK_INTERRUPTIBLE while it is waiting.
205If a signal was received while waiting it will return -ERESTARTSYS; 0 otherwise. 207If a signal was received while waiting it will return -ERESTARTSYS; 0 otherwise::
206 208
207 unsigned long wait_for_completion_timeout(struct completion *done, unsigned long timeout) 209 unsigned long wait_for_completion_timeout(struct completion *done, unsigned long timeout)
208 210
@@ -214,7 +216,7 @@ Timeouts are preferably calculated with msecs_to_jiffies() or usecs_to_jiffies()
214to make the code largely HZ-invariant. 216to make the code largely HZ-invariant.
215 217
216If the returned timeout value is deliberately ignored a comment should probably explain 218If the returned timeout value is deliberately ignored a comment should probably explain
217why (e.g. see drivers/mfd/wm8350-core.c wm8350_read_auxadc()). 219why (e.g. see drivers/mfd/wm8350-core.c wm8350_read_auxadc())::
218 220
219 long wait_for_completion_interruptible_timeout(struct completion *done, unsigned long timeout) 221 long wait_for_completion_interruptible_timeout(struct completion *done, unsigned long timeout)
220 222
@@ -225,14 +227,14 @@ jiffies if completion occurred.
225 227
226Further variants include _killable which uses TASK_KILLABLE as the 228Further variants include _killable which uses TASK_KILLABLE as the
227designated tasks state and will return -ERESTARTSYS if it is interrupted, 229designated tasks state and will return -ERESTARTSYS if it is interrupted,
228or 0 if completion was achieved. There is a _timeout variant as well: 230or 0 if completion was achieved. There is a _timeout variant as well::
229 231
230 long wait_for_completion_killable(struct completion *done) 232 long wait_for_completion_killable(struct completion *done)
231 long wait_for_completion_killable_timeout(struct completion *done, unsigned long timeout) 233 long wait_for_completion_killable_timeout(struct completion *done, unsigned long timeout)
232 234
233The _io variants wait_for_completion_io() behave the same as the non-_io 235The _io variants wait_for_completion_io() behave the same as the non-_io
234variants, except for accounting waiting time as 'waiting on IO', which has 236variants, except for accounting waiting time as 'waiting on IO', which has
235an impact on how the task is accounted in scheduling/IO stats: 237an impact on how the task is accounted in scheduling/IO stats::
236 238
237 void wait_for_completion_io(struct completion *done) 239 void wait_for_completion_io(struct completion *done)
238 unsigned long wait_for_completion_io_timeout(struct completion *done, unsigned long timeout) 240 unsigned long wait_for_completion_io_timeout(struct completion *done, unsigned long timeout)
@@ -243,11 +245,11 @@ Signaling completions:
243 245
244A thread that wants to signal that the conditions for continuation have been 246A thread that wants to signal that the conditions for continuation have been
245achieved calls complete() to signal exactly one of the waiters that it can 247achieved calls complete() to signal exactly one of the waiters that it can
246continue: 248continue::
247 249
248 void complete(struct completion *done) 250 void complete(struct completion *done)
249 251
250... or calls complete_all() to signal all current and future waiters: 252... or calls complete_all() to signal all current and future waiters::
251 253
252 void complete_all(struct completion *done) 254 void complete_all(struct completion *done)
253 255
@@ -268,7 +270,7 @@ probably are a design bug.
268 270
269Signaling completion from IRQ context is fine as it will appropriately 271Signaling completion from IRQ context is fine as it will appropriately
270lock with spin_lock_irqsave()/spin_unlock_irqrestore() and it will never 272lock with spin_lock_irqsave()/spin_unlock_irqrestore() and it will never
271sleep. 273sleep.
272 274
273 275
274try_wait_for_completion()/completion_done(): 276try_wait_for_completion()/completion_done():
@@ -276,14 +278,14 @@ try_wait_for_completion()/completion_done():
276 278
277The try_wait_for_completion() function will not put the thread on the wait 279The try_wait_for_completion() function will not put the thread on the wait
278queue but rather returns false if it would need to enqueue (block) the thread, 280queue but rather returns false if it would need to enqueue (block) the thread,
279else it consumes one posted completion and returns true. 281else it consumes one posted completion and returns true::
280 282
281 bool try_wait_for_completion(struct completion *done) 283 bool try_wait_for_completion(struct completion *done)
282 284
283Finally, to check the state of a completion without changing it in any way, 285Finally, to check the state of a completion without changing it in any way,
284call completion_done(), which returns false if there are no posted 286call completion_done(), which returns false if there are no posted
285completions that were not yet consumed by waiters (implying that there are 287completions that were not yet consumed by waiters (implying that there are
286waiters) and true otherwise; 288waiters) and true otherwise::
287 289
288 bool completion_done(struct completion *done) 290 bool completion_done(struct completion *done)
289 291
diff --git a/Documentation/scheduler/index.rst b/Documentation/scheduler/index.rst
new file mode 100644
index 000000000000..058be77a4c34
--- /dev/null
+++ b/Documentation/scheduler/index.rst
@@ -0,0 +1,29 @@
1:orphan:
2
3===============
4Linux Scheduler
5===============
6
7.. toctree::
8 :maxdepth: 1
9
10
11 completion
12 sched-arch
13 sched-bwc
14 sched-deadline
15 sched-design-CFS
16 sched-domains
17 sched-energy
18 sched-nice-design
19 sched-rt-group
20 sched-stats
21
22 text_files
23
24.. only:: subproject and html
25
26 Indices
27 =======
28
29 * :ref:`genindex`
diff --git a/Documentation/scheduler/sched-arch.txt b/Documentation/scheduler/sched-arch.rst
index a2f27bbf2cba..0eaec669790a 100644
--- a/Documentation/scheduler/sched-arch.txt
+++ b/Documentation/scheduler/sched-arch.rst
@@ -1,4 +1,6 @@
1 CPU Scheduler implementation hints for architecture specific code 1=================================================================
2CPU Scheduler implementation hints for architecture specific code
3=================================================================
2 4
3 Nick Piggin, 2005 5 Nick Piggin, 2005
4 6
@@ -35,9 +37,10 @@ Your cpu_idle routines need to obey the following rules:
354. The only time interrupts need to be disabled when checking 374. The only time interrupts need to be disabled when checking
36 need_resched is if we are about to sleep the processor until 38 need_resched is if we are about to sleep the processor until
37 the next interrupt (this doesn't provide any protection of 39 the next interrupt (this doesn't provide any protection of
38 need_resched, it prevents losing an interrupt). 40 need_resched, it prevents losing an interrupt):
41
42 4a. Common problem with this type of sleep appears to be::
39 43
40 4a. Common problem with this type of sleep appears to be:
41 local_irq_disable(); 44 local_irq_disable();
42 if (!need_resched()) { 45 if (!need_resched()) {
43 local_irq_enable(); 46 local_irq_enable();
@@ -51,10 +54,10 @@ Your cpu_idle routines need to obey the following rules:
51 although it may be reasonable to do some background work or enter 54 although it may be reasonable to do some background work or enter
52 a low CPU priority. 55 a low CPU priority.
53 56
54 5a. If TIF_POLLING_NRFLAG is set, and we do decide to enter 57 - 5a. If TIF_POLLING_NRFLAG is set, and we do decide to enter
55 an interrupt sleep, it needs to be cleared then a memory 58 an interrupt sleep, it needs to be cleared then a memory
56 barrier issued (followed by a test of need_resched with 59 barrier issued (followed by a test of need_resched with
57 interrupts disabled, as explained in 3). 60 interrupts disabled, as explained in 3).
58 61
59arch/x86/kernel/process.c has examples of both polling and 62arch/x86/kernel/process.c has examples of both polling and
60sleeping idle functions. 63sleeping idle functions.
@@ -71,4 +74,3 @@ sh64 - Is sleeping racy vs interrupts? (See #4a)
71 74
72sparc - IRQs on at this point(?), change local_irq_save to _disable. 75sparc - IRQs on at this point(?), change local_irq_save to _disable.
73 - TODO: needs secondary CPUs to disable preempt (See #1) 76 - TODO: needs secondary CPUs to disable preempt (See #1)
74
diff --git a/Documentation/scheduler/sched-bwc.txt b/Documentation/scheduler/sched-bwc.rst
index f6b1873f68ab..3a9064219656 100644
--- a/Documentation/scheduler/sched-bwc.txt
+++ b/Documentation/scheduler/sched-bwc.rst
@@ -1,8 +1,9 @@
1=====================
1CFS Bandwidth Control 2CFS Bandwidth Control
2===================== 3=====================
3 4
4[ This document only discusses CPU bandwidth control for SCHED_NORMAL. 5[ This document only discusses CPU bandwidth control for SCHED_NORMAL.
5 The SCHED_RT case is covered in Documentation/scheduler/sched-rt-group.txt ] 6 The SCHED_RT case is covered in Documentation/scheduler/sched-rt-group.rst ]
6 7
7CFS bandwidth control is a CONFIG_FAIR_GROUP_SCHED extension which allows the 8CFS bandwidth control is a CONFIG_FAIR_GROUP_SCHED extension which allows the
8specification of the maximum CPU bandwidth available to a group or hierarchy. 9specification of the maximum CPU bandwidth available to a group or hierarchy.
@@ -27,7 +28,8 @@ cpu.cfs_quota_us: the total available run-time within a period (in microseconds)
27cpu.cfs_period_us: the length of a period (in microseconds) 28cpu.cfs_period_us: the length of a period (in microseconds)
28cpu.stat: exports throttling statistics [explained further below] 29cpu.stat: exports throttling statistics [explained further below]
29 30
30The default values are: 31The default values are::
32
31 cpu.cfs_period_us=100ms 33 cpu.cfs_period_us=100ms
32 cpu.cfs_quota=-1 34 cpu.cfs_quota=-1
33 35
@@ -55,7 +57,8 @@ For efficiency run-time is transferred between the global pool and CPU local
55on large systems. The amount transferred each time such an update is required 57on large systems. The amount transferred each time such an update is required
56is described as the "slice". 58is described as the "slice".
57 59
58This is tunable via procfs: 60This is tunable via procfs::
61
59 /proc/sys/kernel/sched_cfs_bandwidth_slice_us (default=5ms) 62 /proc/sys/kernel/sched_cfs_bandwidth_slice_us (default=5ms)
60 63
61Larger slice values will reduce transfer overheads, while smaller values allow 64Larger slice values will reduce transfer overheads, while smaller values allow
@@ -66,6 +69,7 @@ Statistics
66A group's bandwidth statistics are exported via 3 fields in cpu.stat. 69A group's bandwidth statistics are exported via 3 fields in cpu.stat.
67 70
68cpu.stat: 71cpu.stat:
72
69- nr_periods: Number of enforcement intervals that have elapsed. 73- nr_periods: Number of enforcement intervals that have elapsed.
70- nr_throttled: Number of times the group has been throttled/limited. 74- nr_throttled: Number of times the group has been throttled/limited.
71- throttled_time: The total time duration (in nanoseconds) for which entities 75- throttled_time: The total time duration (in nanoseconds) for which entities
@@ -78,12 +82,15 @@ Hierarchical considerations
78The interface enforces that an individual entity's bandwidth is always 82The interface enforces that an individual entity's bandwidth is always
79attainable, that is: max(c_i) <= C. However, over-subscription in the 83attainable, that is: max(c_i) <= C. However, over-subscription in the
80aggregate case is explicitly allowed to enable work-conserving semantics 84aggregate case is explicitly allowed to enable work-conserving semantics
81within a hierarchy. 85within a hierarchy:
86
82 e.g. \Sum (c_i) may exceed C 87 e.g. \Sum (c_i) may exceed C
88
83[ Where C is the parent's bandwidth, and c_i its children ] 89[ Where C is the parent's bandwidth, and c_i its children ]
84 90
85 91
86There are two ways in which a group may become throttled: 92There are two ways in which a group may become throttled:
93
87 a. it fully consumes its own quota within a period 94 a. it fully consumes its own quota within a period
88 b. a parent's quota is fully consumed within its period 95 b. a parent's quota is fully consumed within its period
89 96
@@ -92,7 +99,7 @@ be allowed to until the parent's runtime is refreshed.
92 99
93Examples 100Examples
94-------- 101--------
951. Limit a group to 1 CPU worth of runtime. 1021. Limit a group to 1 CPU worth of runtime::
96 103
97 If period is 250ms and quota is also 250ms, the group will get 104 If period is 250ms and quota is also 250ms, the group will get
98 1 CPU worth of runtime every 250ms. 105 1 CPU worth of runtime every 250ms.
@@ -100,10 +107,10 @@ Examples
100 # echo 250000 > cpu.cfs_quota_us /* quota = 250ms */ 107 # echo 250000 > cpu.cfs_quota_us /* quota = 250ms */
101 # echo 250000 > cpu.cfs_period_us /* period = 250ms */ 108 # echo 250000 > cpu.cfs_period_us /* period = 250ms */
102 109
1032. Limit a group to 2 CPUs worth of runtime on a multi-CPU machine. 1102. Limit a group to 2 CPUs worth of runtime on a multi-CPU machine
104 111
105 With 500ms period and 1000ms quota, the group can get 2 CPUs worth of 112 With 500ms period and 1000ms quota, the group can get 2 CPUs worth of
106 runtime every 500ms. 113 runtime every 500ms::
107 114
108 # echo 1000000 > cpu.cfs_quota_us /* quota = 1000ms */ 115 # echo 1000000 > cpu.cfs_quota_us /* quota = 1000ms */
109 # echo 500000 > cpu.cfs_period_us /* period = 500ms */ 116 # echo 500000 > cpu.cfs_period_us /* period = 500ms */
@@ -112,11 +119,10 @@ Examples
112 119
1133. Limit a group to 20% of 1 CPU. 1203. Limit a group to 20% of 1 CPU.
114 121
115 With 50ms period, 10ms quota will be equivalent to 20% of 1 CPU. 122 With 50ms period, 10ms quota will be equivalent to 20% of 1 CPU::
116 123
117 # echo 10000 > cpu.cfs_quota_us /* quota = 10ms */ 124 # echo 10000 > cpu.cfs_quota_us /* quota = 10ms */
118 # echo 50000 > cpu.cfs_period_us /* period = 50ms */ 125 # echo 50000 > cpu.cfs_period_us /* period = 50ms */
119 126
120 By using a small period here we are ensuring a consistent latency 127 By using a small period here we are ensuring a consistent latency
121 response at the expense of burst capacity. 128 response at the expense of burst capacity.
122
diff --git a/Documentation/scheduler/sched-deadline.txt b/Documentation/scheduler/sched-deadline.rst
index a7514343b660..3391e86d810c 100644
--- a/Documentation/scheduler/sched-deadline.txt
+++ b/Documentation/scheduler/sched-deadline.rst
@@ -1,29 +1,29 @@
1 Deadline Task Scheduling 1========================
2 ------------------------ 2Deadline Task Scheduling
3 3========================
4CONTENTS 4
5======== 5.. CONTENTS
6 6
7 0. WARNING 7 0. WARNING
8 1. Overview 8 1. Overview
9 2. Scheduling algorithm 9 2. Scheduling algorithm
10 2.1 Main algorithm 10 2.1 Main algorithm
11 2.2 Bandwidth reclaiming 11 2.2 Bandwidth reclaiming
12 3. Scheduling Real-Time Tasks 12 3. Scheduling Real-Time Tasks
13 3.1 Definitions 13 3.1 Definitions
14 3.2 Schedulability Analysis for Uniprocessor Systems 14 3.2 Schedulability Analysis for Uniprocessor Systems
15 3.3 Schedulability Analysis for Multiprocessor Systems 15 3.3 Schedulability Analysis for Multiprocessor Systems
16 3.4 Relationship with SCHED_DEADLINE Parameters 16 3.4 Relationship with SCHED_DEADLINE Parameters
17 4. Bandwidth management 17 4. Bandwidth management
18 4.1 System-wide settings 18 4.1 System-wide settings
19 4.2 Task interface 19 4.2 Task interface
20 4.3 Default behavior 20 4.3 Default behavior
21 4.4 Behavior of sched_yield() 21 4.4 Behavior of sched_yield()
22 5. Tasks CPU affinity 22 5. Tasks CPU affinity
23 5.1 SCHED_DEADLINE and cpusets HOWTO 23 5.1 SCHED_DEADLINE and cpusets HOWTO
24 6. Future plans 24 6. Future plans
25 A. Test suite 25 A. Test suite
26 B. Minimal main() 26 B. Minimal main()
27 27
28 28
290. WARNING 290. WARNING
@@ -44,7 +44,7 @@ CONTENTS
44 44
45 45
462. Scheduling algorithm 462. Scheduling algorithm
47================== 47=======================
48 48
492.1 Main algorithm 492.1 Main algorithm
50------------------ 50------------------
@@ -80,7 +80,7 @@ CONTENTS
80 a "remaining runtime". These two parameters are initially set to 0; 80 a "remaining runtime". These two parameters are initially set to 0;
81 81
82 - When a SCHED_DEADLINE task wakes up (becomes ready for execution), 82 - When a SCHED_DEADLINE task wakes up (becomes ready for execution),
83 the scheduler checks if 83 the scheduler checks if::
84 84
85 remaining runtime runtime 85 remaining runtime runtime
86 ---------------------------------- > --------- 86 ---------------------------------- > ---------
@@ -97,7 +97,7 @@ CONTENTS
97 left unchanged; 97 left unchanged;
98 98
99 - When a SCHED_DEADLINE task executes for an amount of time t, its 99 - When a SCHED_DEADLINE task executes for an amount of time t, its
100 remaining runtime is decreased as 100 remaining runtime is decreased as::
101 101
102 remaining runtime = remaining runtime - t 102 remaining runtime = remaining runtime - t
103 103
@@ -112,7 +112,7 @@ CONTENTS
112 112
113 - When the current time is equal to the replenishment time of a 113 - When the current time is equal to the replenishment time of a
114 throttled task, the scheduling deadline and the remaining runtime are 114 throttled task, the scheduling deadline and the remaining runtime are
115 updated as 115 updated as::
116 116
117 scheduling deadline = scheduling deadline + period 117 scheduling deadline = scheduling deadline + period
118 remaining runtime = remaining runtime + runtime 118 remaining runtime = remaining runtime + runtime
@@ -129,7 +129,7 @@ CONTENTS
129 Reclamation of Unused Bandwidth) algorithm [15, 16, 17] and it is enabled 129 Reclamation of Unused Bandwidth) algorithm [15, 16, 17] and it is enabled
130 when flag SCHED_FLAG_RECLAIM is set. 130 when flag SCHED_FLAG_RECLAIM is set.
131 131
132 The following diagram illustrates the state names for tasks handled by GRUB: 132 The following diagram illustrates the state names for tasks handled by GRUB::
133 133
134 ------------ 134 ------------
135 (d) | Active | 135 (d) | Active |
@@ -168,7 +168,7 @@ CONTENTS
168 breaking the real-time guarantees. 168 breaking the real-time guarantees.
169 169
170 The 0-lag time for a task entering the ActiveNonContending state is 170 The 0-lag time for a task entering the ActiveNonContending state is
171 computed as 171 computed as::
172 172
173 (runtime * dl_period) 173 (runtime * dl_period)
174 deadline - --------------------- 174 deadline - ---------------------
@@ -183,7 +183,7 @@ CONTENTS
183 the task's utilization must be removed from the previous runqueue's active 183 the task's utilization must be removed from the previous runqueue's active
184 utilization and must be added to the new runqueue's active utilization. 184 utilization and must be added to the new runqueue's active utilization.
185 In order to avoid races between a task waking up on a runqueue while the 185 In order to avoid races between a task waking up on a runqueue while the
186 "inactive timer" is running on a different CPU, the "dl_non_contending" 186 "inactive timer" is running on a different CPU, the "dl_non_contending"
187 flag is used to indicate that a task is not on a runqueue but is active 187 flag is used to indicate that a task is not on a runqueue but is active
188 (so, the flag is set when the task blocks and is cleared when the 188 (so, the flag is set when the task blocks and is cleared when the
189 "inactive timer" fires or when the task wakes up). 189 "inactive timer" fires or when the task wakes up).
@@ -222,36 +222,36 @@ CONTENTS
222 222
223 223
224 Let's now see a trivial example of two deadline tasks with runtime equal 224 Let's now see a trivial example of two deadline tasks with runtime equal
225 to 4 and period equal to 8 (i.e., bandwidth equal to 0.5): 225 to 4 and period equal to 8 (i.e., bandwidth equal to 0.5)::
226 226
227 A Task T1 227 A Task T1
228 | 228 |
229 | | 229 | |
230 | | 230 | |
231 |-------- |---- 231 |-------- |----
232 | | V 232 | | V
233 |---|---|---|---|---|---|---|---|--------->t 233 |---|---|---|---|---|---|---|---|--------->t
234 0 1 2 3 4 5 6 7 8 234 0 1 2 3 4 5 6 7 8
235 235
236 236
237 A Task T2 237 A Task T2
238 | 238 |
239 | | 239 | |
240 | | 240 | |
241 | ------------------------| 241 | ------------------------|
242 | | V 242 | | V
243 |---|---|---|---|---|---|---|---|--------->t 243 |---|---|---|---|---|---|---|---|--------->t
244 0 1 2 3 4 5 6 7 8 244 0 1 2 3 4 5 6 7 8
245 245
246 246
247 A running_bw 247 A running_bw
248 | 248 |
249 1 ----------------- ------ 249 1 ----------------- ------
250 | | | 250 | | |
251 0.5- ----------------- 251 0.5- -----------------
252 | | 252 | |
253 |---|---|---|---|---|---|---|---|--------->t 253 |---|---|---|---|---|---|---|---|--------->t
254 0 1 2 3 4 5 6 7 8 254 0 1 2 3 4 5 6 7 8
255 255
256 256
257 - Time t = 0: 257 - Time t = 0:
@@ -284,7 +284,7 @@ CONTENTS
284 284
285 285
2862.3 Energy-aware scheduling 2862.3 Energy-aware scheduling
287------------------------ 287---------------------------
288 288
289 When cpufreq's schedutil governor is selected, SCHED_DEADLINE implements the 289 When cpufreq's schedutil governor is selected, SCHED_DEADLINE implements the
290 GRUB-PA [19] algorithm, reducing the CPU operating frequency to the minimum 290 GRUB-PA [19] algorithm, reducing the CPU operating frequency to the minimum
@@ -299,15 +299,20 @@ CONTENTS
2993. Scheduling Real-Time Tasks 2993. Scheduling Real-Time Tasks
300============================= 300=============================
301 301
302 * BIG FAT WARNING ****************************************************** 302
303 * 303
304 * This section contains a (not-thorough) summary on classical deadline 304 .. BIG FAT WARNING ******************************************************
305 * scheduling theory, and how it applies to SCHED_DEADLINE. 305
306 * The reader can "safely" skip to Section 4 if only interested in seeing 306 .. warning::
307 * how the scheduling policy can be used. Anyway, we strongly recommend 307
308 * to come back here and continue reading (once the urge for testing is 308 This section contains a (not-thorough) summary on classical deadline
309 * satisfied :P) to be sure of fully understanding all technical details. 309 scheduling theory, and how it applies to SCHED_DEADLINE.
310 ************************************************************************ 310 The reader can "safely" skip to Section 4 if only interested in seeing
311 how the scheduling policy can be used. Anyway, we strongly recommend
312 to come back here and continue reading (once the urge for testing is
313 satisfied :P) to be sure of fully understanding all technical details.
314
315 .. ************************************************************************
311 316
312 There are no limitations on what kind of task can exploit this new 317 There are no limitations on what kind of task can exploit this new
313 scheduling discipline, even if it must be said that it is particularly 318 scheduling discipline, even if it must be said that it is particularly
@@ -329,6 +334,7 @@ CONTENTS
329 sporadic with minimum inter-arrival time P is r_{j+1} >= r_j + P. Finally, 334 sporadic with minimum inter-arrival time P is r_{j+1} >= r_j + P. Finally,
330 d_j = r_j + D, where D is the task's relative deadline. 335 d_j = r_j + D, where D is the task's relative deadline.
331 Summing up, a real-time task can be described as 336 Summing up, a real-time task can be described as
337
332 Task = (WCET, D, P) 338 Task = (WCET, D, P)
333 339
334 The utilization of a real-time task is defined as the ratio between its 340 The utilization of a real-time task is defined as the ratio between its
@@ -352,13 +358,15 @@ CONTENTS
352 between the finishing time of a job and its absolute deadline). 358 between the finishing time of a job and its absolute deadline).
353 More precisely, it can be proven that using a global EDF scheduler the 359 More precisely, it can be proven that using a global EDF scheduler the
354 maximum tardiness of each task is smaller or equal than 360 maximum tardiness of each task is smaller or equal than
361
355 ((M − 1) · WCET_max − WCET_min)/(M − (M − 2) · U_max) + WCET_max 362 ((M − 1) · WCET_max − WCET_min)/(M − (M − 2) · U_max) + WCET_max
363
356 where WCET_max = max{WCET_i} is the maximum WCET, WCET_min=min{WCET_i} 364 where WCET_max = max{WCET_i} is the maximum WCET, WCET_min=min{WCET_i}
357 is the minimum WCET, and U_max = max{WCET_i/P_i} is the maximum 365 is the minimum WCET, and U_max = max{WCET_i/P_i} is the maximum
358 utilization[12]. 366 utilization[12].
359 367
3603.2 Schedulability Analysis for Uniprocessor Systems 3683.2 Schedulability Analysis for Uniprocessor Systems
361------------------------ 369----------------------------------------------------
362 370
363 If M=1 (uniprocessor system), or in case of partitioned scheduling (each 371 If M=1 (uniprocessor system), or in case of partitioned scheduling (each
364 real-time task is statically assigned to one and only one CPU), it is 372 real-time task is statically assigned to one and only one CPU), it is
@@ -370,7 +378,9 @@ CONTENTS
370 a task as WCET_i/min{D_i,P_i}, and EDF is able to respect all the deadlines 378 a task as WCET_i/min{D_i,P_i}, and EDF is able to respect all the deadlines
371 of all the tasks running on a CPU if the sum of the densities of the tasks 379 of all the tasks running on a CPU if the sum of the densities of the tasks
372 running on such a CPU is smaller or equal than 1: 380 running on such a CPU is smaller or equal than 1:
381
373 sum(WCET_i / min{D_i, P_i}) <= 1 382 sum(WCET_i / min{D_i, P_i}) <= 1
383
374 It is important to notice that this condition is only sufficient, and not 384 It is important to notice that this condition is only sufficient, and not
375 necessary: there are task sets that are schedulable, but do not respect the 385 necessary: there are task sets that are schedulable, but do not respect the
376 condition. For example, consider the task set {Task_1,Task_2} composed by 386 condition. For example, consider the task set {Task_1,Task_2} composed by
@@ -379,7 +389,9 @@ CONTENTS
379 (Task_1 is scheduled as soon as it is released, and finishes just in time 389 (Task_1 is scheduled as soon as it is released, and finishes just in time
380 to respect its deadline; Task_2 is scheduled immediately after Task_1, hence 390 to respect its deadline; Task_2 is scheduled immediately after Task_1, hence
381 its response time cannot be larger than 50ms + 10ms = 60ms) even if 391 its response time cannot be larger than 50ms + 10ms = 60ms) even if
392
382 50 / min{50,100} + 10 / min{100, 100} = 50 / 50 + 10 / 100 = 1.1 393 50 / min{50,100} + 10 / min{100, 100} = 50 / 50 + 10 / 100 = 1.1
394
383 Of course it is possible to test the exact schedulability of tasks with 395 Of course it is possible to test the exact schedulability of tasks with
384 D_i != P_i (checking a condition that is both sufficient and necessary), 396 D_i != P_i (checking a condition that is both sufficient and necessary),
385 but this cannot be done by comparing the total utilization or density with 397 but this cannot be done by comparing the total utilization or density with
@@ -399,7 +411,7 @@ CONTENTS
399 4 Linux uses an admission test based on the tasks' utilizations. 411 4 Linux uses an admission test based on the tasks' utilizations.
400 412
4013.3 Schedulability Analysis for Multiprocessor Systems 4133.3 Schedulability Analysis for Multiprocessor Systems
402------------------------ 414------------------------------------------------------
403 415
404 On multiprocessor systems with global EDF scheduling (non partitioned 416 On multiprocessor systems with global EDF scheduling (non partitioned
405 systems), a sufficient test for schedulability can not be based on the 417 systems), a sufficient test for schedulability can not be based on the
@@ -428,7 +440,9 @@ CONTENTS
428 between total utilization (or density) and a fixed constant. If all tasks 440 between total utilization (or density) and a fixed constant. If all tasks
429 have D_i = P_i, a sufficient schedulability condition can be expressed in 441 have D_i = P_i, a sufficient schedulability condition can be expressed in
430 a simple way: 442 a simple way:
443
431 sum(WCET_i / P_i) <= M - (M - 1) · U_max 444 sum(WCET_i / P_i) <= M - (M - 1) · U_max
445
432 where U_max = max{WCET_i / P_i}[10]. Notice that for U_max = 1, 446 where U_max = max{WCET_i / P_i}[10]. Notice that for U_max = 1,
433 M - (M - 1) · U_max becomes M - M + 1 = 1 and this schedulability condition 447 M - (M - 1) · U_max becomes M - M + 1 = 1 and this schedulability condition
434 just confirms the Dhall's effect. A more complete survey of the literature 448 just confirms the Dhall's effect. A more complete survey of the literature
@@ -447,7 +461,7 @@ CONTENTS
447 the tasks are limited. 461 the tasks are limited.
448 462
4493.4 Relationship with SCHED_DEADLINE Parameters 4633.4 Relationship with SCHED_DEADLINE Parameters
450------------------------ 464-----------------------------------------------
451 465
452 Finally, it is important to understand the relationship between the 466 Finally, it is important to understand the relationship between the
453 SCHED_DEADLINE scheduling parameters described in Section 2 (runtime, 467 SCHED_DEADLINE scheduling parameters described in Section 2 (runtime,
@@ -473,6 +487,7 @@ CONTENTS
473 this task, as it is not possible to respect its temporal constraints. 487 this task, as it is not possible to respect its temporal constraints.
474 488
475 References: 489 References:
490
476 1 - C. L. Liu and J. W. Layland. Scheduling algorithms for multiprogram- 491 1 - C. L. Liu and J. W. Layland. Scheduling algorithms for multiprogram-
477 ming in a hard-real-time environment. Journal of the Association for 492 ming in a hard-real-time environment. Journal of the Association for
478 Computing Machinery, 20(1), 1973. 493 Computing Machinery, 20(1), 1973.
@@ -550,7 +565,7 @@ CONTENTS
550 The interface used to control the CPU bandwidth that can be allocated 565 The interface used to control the CPU bandwidth that can be allocated
551 to -deadline tasks is similar to the one already used for -rt 566 to -deadline tasks is similar to the one already used for -rt
552 tasks with real-time group scheduling (a.k.a. RT-throttling - see 567 tasks with real-time group scheduling (a.k.a. RT-throttling - see
553 Documentation/scheduler/sched-rt-group.txt), and is based on readable/ 568 Documentation/scheduler/sched-rt-group.rst), and is based on readable/
554 writable control files located in procfs (for system wide settings). 569 writable control files located in procfs (for system wide settings).
555 Notice that per-group settings (controlled through cgroupfs) are still not 570 Notice that per-group settings (controlled through cgroupfs) are still not
556 defined for -deadline tasks, because more discussion is needed in order to 571 defined for -deadline tasks, because more discussion is needed in order to
@@ -596,11 +611,13 @@ CONTENTS
596 Specifying a periodic/sporadic task that executes for a given amount of 611 Specifying a periodic/sporadic task that executes for a given amount of
597 runtime at each instance, and that is scheduled according to the urgency of 612 runtime at each instance, and that is scheduled according to the urgency of
598 its own timing constraints needs, in general, a way of declaring: 613 its own timing constraints needs, in general, a way of declaring:
614
599 - a (maximum/typical) instance execution time, 615 - a (maximum/typical) instance execution time,
600 - a minimum interval between consecutive instances, 616 - a minimum interval between consecutive instances,
601 - a time constraint by which each instance must be completed. 617 - a time constraint by which each instance must be completed.
602 618
603 Therefore: 619 Therefore:
620
604 * a new struct sched_attr, containing all the necessary fields is 621 * a new struct sched_attr, containing all the necessary fields is
605 provided; 622 provided;
606 * the new scheduling related syscalls that manipulate it, i.e., 623 * the new scheduling related syscalls that manipulate it, i.e.,
@@ -658,21 +675,21 @@ CONTENTS
658------------------------------------ 675------------------------------------
659 676
660 An example of a simple configuration (pin a -deadline task to CPU0) 677 An example of a simple configuration (pin a -deadline task to CPU0)
661 follows (rt-app is used to create a -deadline task). 678 follows (rt-app is used to create a -deadline task)::
662 679
663 mkdir /dev/cpuset 680 mkdir /dev/cpuset
664 mount -t cgroup -o cpuset cpuset /dev/cpuset 681 mount -t cgroup -o cpuset cpuset /dev/cpuset
665 cd /dev/cpuset 682 cd /dev/cpuset
666 mkdir cpu0 683 mkdir cpu0
667 echo 0 > cpu0/cpuset.cpus 684 echo 0 > cpu0/cpuset.cpus
668 echo 0 > cpu0/cpuset.mems 685 echo 0 > cpu0/cpuset.mems
669 echo 1 > cpuset.cpu_exclusive 686 echo 1 > cpuset.cpu_exclusive
670 echo 0 > cpuset.sched_load_balance 687 echo 0 > cpuset.sched_load_balance
671 echo 1 > cpu0/cpuset.cpu_exclusive 688 echo 1 > cpu0/cpuset.cpu_exclusive
672 echo 1 > cpu0/cpuset.mem_exclusive 689 echo 1 > cpu0/cpuset.mem_exclusive
673 echo $$ > cpu0/tasks 690 echo $$ > cpu0/tasks
674 rt-app -t 100000:10000:d:0 -D5 (it is now actually superfluous to specify 691 rt-app -t 100000:10000:d:0 -D5 # it is now actually superfluous to specify
675 task affinity) 692 # task affinity
676 693
6776. Future plans 6946. Future plans
678=============== 695===============
@@ -711,7 +728,7 @@ Appendix A. Test suite
711 rt-app is available at: https://github.com/scheduler-tools/rt-app. 728 rt-app is available at: https://github.com/scheduler-tools/rt-app.
712 729
713 Thread parameters can be specified from the command line, with something like 730 Thread parameters can be specified from the command line, with something like
714 this: 731 this::
715 732
716 # rt-app -t 100000:10000:d -t 150000:20000:f:10 -D5 733 # rt-app -t 100000:10000:d -t 150000:20000:f:10 -D5
717 734
@@ -721,27 +738,27 @@ Appendix A. Test suite
721 of 5 seconds. 738 of 5 seconds.
722 739
723 More interestingly, configurations can be described with a json file that 740 More interestingly, configurations can be described with a json file that
724 can be passed as input to rt-app with something like this: 741 can be passed as input to rt-app with something like this::
725 742
726 # rt-app my_config.json 743 # rt-app my_config.json
727 744
728 The parameters that can be specified with the second method are a superset 745 The parameters that can be specified with the second method are a superset
729 of the command line options. Please refer to rt-app documentation for more 746 of the command line options. Please refer to rt-app documentation for more
730 details (<rt-app-sources>/doc/*.json). 747 details (`<rt-app-sources>/doc/*.json`).
731 748
732 The second testing application is a modification of schedtool, called 749 The second testing application is a modification of schedtool, called
733 schedtool-dl, which can be used to setup SCHED_DEADLINE parameters for a 750 schedtool-dl, which can be used to setup SCHED_DEADLINE parameters for a
734 certain pid/application. schedtool-dl is available at: 751 certain pid/application. schedtool-dl is available at:
735 https://github.com/scheduler-tools/schedtool-dl.git. 752 https://github.com/scheduler-tools/schedtool-dl.git.
736 753
737 The usage is straightforward: 754 The usage is straightforward::
738 755
739 # schedtool -E -t 10000000:100000000 -e ./my_cpuhog_app 756 # schedtool -E -t 10000000:100000000 -e ./my_cpuhog_app
740 757
741 With this, my_cpuhog_app is put to run inside a SCHED_DEADLINE reservation 758 With this, my_cpuhog_app is put to run inside a SCHED_DEADLINE reservation
742 of 10ms every 100ms (note that parameters are expressed in microseconds). 759 of 10ms every 100ms (note that parameters are expressed in microseconds).
743 You can also use schedtool to create a reservation for an already running 760 You can also use schedtool to create a reservation for an already running
744 application, given that you know its pid: 761 application, given that you know its pid::
745 762
746 # schedtool -E -t 10000000:100000000 my_app_pid 763 # schedtool -E -t 10000000:100000000 my_app_pid
747 764
@@ -750,43 +767,43 @@ Appendix B. Minimal main()
750 767
751 We provide in what follows a simple (ugly) self-contained code snippet 768 We provide in what follows a simple (ugly) self-contained code snippet
752 showing how SCHED_DEADLINE reservations can be created by a real-time 769 showing how SCHED_DEADLINE reservations can be created by a real-time
753 application developer. 770 application developer::
754 771
755 #define _GNU_SOURCE 772 #define _GNU_SOURCE
756 #include <unistd.h> 773 #include <unistd.h>
757 #include <stdio.h> 774 #include <stdio.h>
758 #include <stdlib.h> 775 #include <stdlib.h>
759 #include <string.h> 776 #include <string.h>
760 #include <time.h> 777 #include <time.h>
761 #include <linux/unistd.h> 778 #include <linux/unistd.h>
762 #include <linux/kernel.h> 779 #include <linux/kernel.h>
763 #include <linux/types.h> 780 #include <linux/types.h>
764 #include <sys/syscall.h> 781 #include <sys/syscall.h>
765 #include <pthread.h> 782 #include <pthread.h>
766 783
767 #define gettid() syscall(__NR_gettid) 784 #define gettid() syscall(__NR_gettid)
768 785
769 #define SCHED_DEADLINE 6 786 #define SCHED_DEADLINE 6
770 787
771 /* XXX use the proper syscall numbers */ 788 /* XXX use the proper syscall numbers */
772 #ifdef __x86_64__ 789 #ifdef __x86_64__
773 #define __NR_sched_setattr 314 790 #define __NR_sched_setattr 314
774 #define __NR_sched_getattr 315 791 #define __NR_sched_getattr 315
775 #endif 792 #endif
776 793
777 #ifdef __i386__ 794 #ifdef __i386__
778 #define __NR_sched_setattr 351 795 #define __NR_sched_setattr 351
779 #define __NR_sched_getattr 352 796 #define __NR_sched_getattr 352
780 #endif 797 #endif
781 798
782 #ifdef __arm__ 799 #ifdef __arm__
783 #define __NR_sched_setattr 380 800 #define __NR_sched_setattr 380
784 #define __NR_sched_getattr 381 801 #define __NR_sched_getattr 381
785 #endif 802 #endif
786 803
787 static volatile int done; 804 static volatile int done;
788 805
789 struct sched_attr { 806 struct sched_attr {
790 __u32 size; 807 __u32 size;
791 808
792 __u32 sched_policy; 809 __u32 sched_policy;
@@ -802,25 +819,25 @@ Appendix B. Minimal main()
802 __u64 sched_runtime; 819 __u64 sched_runtime;
803 __u64 sched_deadline; 820 __u64 sched_deadline;
804 __u64 sched_period; 821 __u64 sched_period;
805 }; 822 };
806 823
807 int sched_setattr(pid_t pid, 824 int sched_setattr(pid_t pid,
808 const struct sched_attr *attr, 825 const struct sched_attr *attr,
809 unsigned int flags) 826 unsigned int flags)
810 { 827 {
811 return syscall(__NR_sched_setattr, pid, attr, flags); 828 return syscall(__NR_sched_setattr, pid, attr, flags);
812 } 829 }
813 830
814 int sched_getattr(pid_t pid, 831 int sched_getattr(pid_t pid,
815 struct sched_attr *attr, 832 struct sched_attr *attr,
816 unsigned int size, 833 unsigned int size,
817 unsigned int flags) 834 unsigned int flags)
818 { 835 {
819 return syscall(__NR_sched_getattr, pid, attr, size, flags); 836 return syscall(__NR_sched_getattr, pid, attr, size, flags);
820 } 837 }
821 838
822 void *run_deadline(void *data) 839 void *run_deadline(void *data)
823 { 840 {
824 struct sched_attr attr; 841 struct sched_attr attr;
825 int x = 0; 842 int x = 0;
826 int ret; 843 int ret;
@@ -851,10 +868,10 @@ Appendix B. Minimal main()
851 868
852 printf("deadline thread dies [%ld]\n", gettid()); 869 printf("deadline thread dies [%ld]\n", gettid());
853 return NULL; 870 return NULL;
854 } 871 }
855 872
856 int main (int argc, char **argv) 873 int main (int argc, char **argv)
857 { 874 {
858 pthread_t thread; 875 pthread_t thread;
859 876
860 printf("main thread [%ld]\n", gettid()); 877 printf("main thread [%ld]\n", gettid());
@@ -868,4 +885,4 @@ Appendix B. Minimal main()
868 885
869 printf("main dies [%ld]\n", gettid()); 886 printf("main dies [%ld]\n", gettid());
870 return 0; 887 return 0;
871 } 888 }
diff --git a/Documentation/scheduler/sched-design-CFS.txt b/Documentation/scheduler/sched-design-CFS.rst
index d1328890ef28..53b30d1967cf 100644
--- a/Documentation/scheduler/sched-design-CFS.txt
+++ b/Documentation/scheduler/sched-design-CFS.rst
@@ -1,9 +1,10 @@
1 ============= 1=============
2 CFS Scheduler 2CFS Scheduler
3 ============= 3=============
4 4
5 5
61. OVERVIEW 61. OVERVIEW
7============
7 8
8CFS stands for "Completely Fair Scheduler," and is the new "desktop" process 9CFS stands for "Completely Fair Scheduler," and is the new "desktop" process
9scheduler implemented by Ingo Molnar and merged in Linux 2.6.23. It is the 10scheduler implemented by Ingo Molnar and merged in Linux 2.6.23. It is the
@@ -27,6 +28,7 @@ is its actual runtime normalized to the total number of running tasks.
27 28
28 29
292. FEW IMPLEMENTATION DETAILS 302. FEW IMPLEMENTATION DETAILS
31==============================
30 32
31In CFS the virtual runtime is expressed and tracked via the per-task 33In CFS the virtual runtime is expressed and tracked via the per-task
32p->se.vruntime (nanosec-unit) value. This way, it's possible to accurately 34p->se.vruntime (nanosec-unit) value. This way, it's possible to accurately
@@ -49,6 +51,7 @@ algorithm variants to recognize sleepers.
49 51
50 52
513. THE RBTREE 533. THE RBTREE
54==============
52 55
53CFS's design is quite radical: it does not use the old data structures for the 56CFS's design is quite radical: it does not use the old data structures for the
54runqueues, but it uses a time-ordered rbtree to build a "timeline" of future 57runqueues, but it uses a time-ordered rbtree to build a "timeline" of future
@@ -84,6 +87,7 @@ picked and the current task is preempted.
84 87
85 88
864. SOME FEATURES OF CFS 894. SOME FEATURES OF CFS
90========================
87 91
88CFS uses nanosecond granularity accounting and does not rely on any jiffies or 92CFS uses nanosecond granularity accounting and does not rely on any jiffies or
89other HZ detail. Thus the CFS scheduler has no notion of "timeslices" in the 93other HZ detail. Thus the CFS scheduler has no notion of "timeslices" in the
@@ -113,6 +117,7 @@ result.
113 117
114 118
1155. Scheduling policies 1195. Scheduling policies
120======================
116 121
117CFS implements three scheduling policies: 122CFS implements three scheduling policies:
118 123
@@ -137,6 +142,7 @@ SCHED_IDLE.
137 142
138 143
1396. SCHEDULING CLASSES 1446. SCHEDULING CLASSES
145======================
140 146
141The new CFS scheduler has been designed in such a way to introduce "Scheduling 147The new CFS scheduler has been designed in such a way to introduce "Scheduling
142Classes," an extensible hierarchy of scheduler modules. These modules 148Classes," an extensible hierarchy of scheduler modules. These modules
@@ -197,6 +203,7 @@ This is the (partial) list of the hooks:
197 203
198 204
1997. GROUP SCHEDULER EXTENSIONS TO CFS 2057. GROUP SCHEDULER EXTENSIONS TO CFS
206=====================================
200 207
201Normally, the scheduler operates on individual tasks and strives to provide 208Normally, the scheduler operates on individual tasks and strives to provide
202fair CPU time to each task. Sometimes, it may be desirable to group tasks and 209fair CPU time to each task. Sometimes, it may be desirable to group tasks and
@@ -219,7 +226,7 @@ SCHED_BATCH) tasks.
219 226
220When CONFIG_FAIR_GROUP_SCHED is defined, a "cpu.shares" file is created for each 227When CONFIG_FAIR_GROUP_SCHED is defined, a "cpu.shares" file is created for each
221group created using the pseudo filesystem. See example steps below to create 228group created using the pseudo filesystem. See example steps below to create
222task groups and modify their CPU share using the "cgroups" pseudo filesystem. 229task groups and modify their CPU share using the "cgroups" pseudo filesystem::
223 230
224 # mount -t tmpfs cgroup_root /sys/fs/cgroup 231 # mount -t tmpfs cgroup_root /sys/fs/cgroup
225 # mkdir /sys/fs/cgroup/cpu 232 # mkdir /sys/fs/cgroup/cpu
diff --git a/Documentation/scheduler/sched-domains.txt b/Documentation/scheduler/sched-domains.rst
index 4af80b1c05aa..f7504226f445 100644
--- a/Documentation/scheduler/sched-domains.txt
+++ b/Documentation/scheduler/sched-domains.rst
@@ -1,3 +1,7 @@
1=================
2Scheduler Domains
3=================
4
1Each CPU has a "base" scheduling domain (struct sched_domain). The domain 5Each CPU has a "base" scheduling domain (struct sched_domain). The domain
2hierarchy is built from these base domains via the ->parent pointer. ->parent 6hierarchy is built from these base domains via the ->parent pointer. ->parent
3MUST be NULL terminated, and domain structures should be per-CPU as they are 7MUST be NULL terminated, and domain structures should be per-CPU as they are
@@ -46,7 +50,9 @@ CPU's runqueue and the newly found busiest one and starts moving tasks from it
46to our runqueue. The exact number of tasks amounts to an imbalance previously 50to our runqueue. The exact number of tasks amounts to an imbalance previously
47computed while iterating over this sched domain's groups. 51computed while iterating over this sched domain's groups.
48 52
49*** Implementing sched domains *** 53Implementing sched domains
54==========================
55
50The "base" domain will "span" the first level of the hierarchy. In the case 56The "base" domain will "span" the first level of the hierarchy. In the case
51of SMT, you'll span all siblings of the physical CPU, with each group being 57of SMT, you'll span all siblings of the physical CPU, with each group being
52a single virtual CPU. 58a single virtual CPU.
diff --git a/Documentation/scheduler/sched-energy.txt b/Documentation/scheduler/sched-energy.rst
index 197d81f4b836..fce5858c9082 100644
--- a/Documentation/scheduler/sched-energy.txt
+++ b/Documentation/scheduler/sched-energy.rst
@@ -1,6 +1,6 @@
1 ======================= 1=======================
2 Energy Aware Scheduling 2Energy Aware Scheduling
3 ======================= 3=======================
4 4
51. Introduction 51. Introduction
6--------------- 6---------------
@@ -12,7 +12,7 @@ with a minimal impact on throughput. This document aims at providing an
12introduction on how EAS works, what are the main design decisions behind it, and 12introduction on how EAS works, what are the main design decisions behind it, and
13details what is needed to get it to run. 13details what is needed to get it to run.
14 14
15Before going any further, please note that at the time of writing: 15Before going any further, please note that at the time of writing::
16 16
17 /!\ EAS does not support platforms with symmetric CPU topologies /!\ 17 /!\ EAS does not support platforms with symmetric CPU topologies /!\
18 18
@@ -33,13 +33,13 @@ To make it clear from the start:
33 - power = energy/time = [joule/second] = [watt] 33 - power = energy/time = [joule/second] = [watt]
34 34
35The goal of EAS is to minimize energy, while still getting the job done. That 35The goal of EAS is to minimize energy, while still getting the job done. That
36is, we want to maximize: 36is, we want to maximize::
37 37
38 performance [inst/s] 38 performance [inst/s]
39 -------------------- 39 --------------------
40 power [W] 40 power [W]
41 41
42which is equivalent to minimizing: 42which is equivalent to minimizing::
43 43
44 energy [J] 44 energy [J]
45 ----------- 45 -----------
@@ -97,7 +97,7 @@ domains can contain duplicate elements.
97 97
98Example 1. 98Example 1.
99 Let us consider a platform with 12 CPUs, split in 3 performance domains 99 Let us consider a platform with 12 CPUs, split in 3 performance domains
100 (pd0, pd4 and pd8), organized as follows: 100 (pd0, pd4 and pd8), organized as follows::
101 101
102 CPUs: 0 1 2 3 4 5 6 7 8 9 10 11 102 CPUs: 0 1 2 3 4 5 6 7 8 9 10 11
103 PDs: |--pd0--|--pd4--|---pd8---| 103 PDs: |--pd0--|--pd4--|---pd8---|
@@ -108,6 +108,7 @@ Example 1.
108 containing 6 CPUs. The two root domains are denoted rd1 and rd2 in the 108 containing 6 CPUs. The two root domains are denoted rd1 and rd2 in the
109 above figure. Since pd4 intersects with both rd1 and rd2, it will be 109 above figure. Since pd4 intersects with both rd1 and rd2, it will be
110 present in the linked list '->pd' attached to each of them: 110 present in the linked list '->pd' attached to each of them:
111
111 * rd1->pd: pd0 -> pd4 112 * rd1->pd: pd0 -> pd4
112 * rd2->pd: pd4 -> pd8 113 * rd2->pd: pd4 -> pd8
113 114
@@ -159,9 +160,9 @@ Example 2.
159 Each performance domain has three Operating Performance Points (OPPs). 160 Each performance domain has three Operating Performance Points (OPPs).
160 The CPU capacity and power cost associated with each OPP is listed in 161 The CPU capacity and power cost associated with each OPP is listed in
161 the Energy Model table. The util_avg of P is shown on the figures 162 the Energy Model table. The util_avg of P is shown on the figures
162 below as 'PP'. 163 below as 'PP'::
163 164
164 CPU util. 165 CPU util.
165 1024 - - - - - - - Energy Model 166 1024 - - - - - - - Energy Model
166 +-----------+-------------+ 167 +-----------+-------------+
167 | Little | Big | 168 | Little | Big |
@@ -188,8 +189,7 @@ Example 2.
188 (which is coherent with the behaviour of the schedutil CPUFreq 189 (which is coherent with the behaviour of the schedutil CPUFreq
189 governor, see Section 6. for more details on this topic). 190 governor, see Section 6. for more details on this topic).
190 191
191 Case 1. P is migrated to CPU1 192 **Case 1. P is migrated to CPU1**::
192 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
193 193
194 1024 - - - - - - - 194 1024 - - - - - - -
195 195
@@ -207,8 +207,7 @@ Example 2.
207 CPU0 CPU1 CPU2 CPU3 207 CPU0 CPU1 CPU2 CPU3
208 208
209 209
210 Case 2. P is migrated to CPU3 210 **Case 2. P is migrated to CPU3**::
211 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212 211
213 1024 - - - - - - - 212 1024 - - - - - - -
214 213
@@ -226,8 +225,7 @@ Example 2.
226 CPU0 CPU1 CPU2 CPU3 225 CPU0 CPU1 CPU2 CPU3
227 226
228 227
229 Case 3. P stays on prev_cpu / CPU 0 228 **Case 3. P stays on prev_cpu / CPU 0**::
230 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
231 229
232 1024 - - - - - - - 230 1024 - - - - - - -
233 231
@@ -324,7 +322,9 @@ hardware properties and on other features of the kernel being enabled. This
324section lists these dependencies and provides hints as to how they can be met. 322section lists these dependencies and provides hints as to how they can be met.
325 323
326 324
327 6.1 - Asymmetric CPU topology 3256.1 - Asymmetric CPU topology
326^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
327
328 328
329As mentioned in the introduction, EAS is only supported on platforms with 329As mentioned in the introduction, EAS is only supported on platforms with
330asymmetric CPU topologies for now. This requirement is checked at run-time by 330asymmetric CPU topologies for now. This requirement is checked at run-time by
@@ -347,7 +347,8 @@ significant savings on SMP platforms have been observed yet. This restriction
347could be amended in the future if proven otherwise. 347could be amended in the future if proven otherwise.
348 348
349 349
350 6.2 - Energy Model presence 3506.2 - Energy Model presence
351^^^^^^^^^^^^^^^^^^^^^^^^^^^
351 352
352EAS uses the EM of a platform to estimate the impact of scheduling decisions on 353EAS uses the EM of a platform to estimate the impact of scheduling decisions on
353energy. So, your platform must provide power cost tables to the EM framework in 354energy. So, your platform must provide power cost tables to the EM framework in
@@ -358,7 +359,8 @@ Please also note that the scheduling domains need to be re-built after the
358EM has been registered in order to start EAS. 359EM has been registered in order to start EAS.
359 360
360 361
361 6.3 - Energy Model complexity 3626.3 - Energy Model complexity
363^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
362 364
363The task wake-up path is very latency-sensitive. When the EM of a platform is 365The task wake-up path is very latency-sensitive. When the EM of a platform is
364too complex (too many CPUs, too many performance domains, too many performance 366too complex (too many CPUs, too many performance domains, too many performance
@@ -388,7 +390,8 @@ two possible options:
388 hence enabling it to cope with larger EMs in reasonable time. 390 hence enabling it to cope with larger EMs in reasonable time.
389 391
390 392
391 6.4 - Schedutil governor 3936.4 - Schedutil governor
394^^^^^^^^^^^^^^^^^^^^^^^^
392 395
393EAS tries to predict at which OPP will the CPUs be running in the close future 396EAS tries to predict at which OPP will the CPUs be running in the close future
394in order to estimate their energy consumption. To do so, it is assumed that OPPs 397in order to estimate their energy consumption. To do so, it is assumed that OPPs
@@ -405,7 +408,8 @@ frequency requests and energy predictions.
405Using EAS with any other governor than schedutil is not supported. 408Using EAS with any other governor than schedutil is not supported.
406 409
407 410
408 6.5 Scale-invariant utilization signals 4116.5 Scale-invariant utilization signals
412^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
409 413
410In order to make accurate prediction across CPUs and for all performance 414In order to make accurate prediction across CPUs and for all performance
411states, EAS needs frequency-invariant and CPU-invariant PELT signals. These can 415states, EAS needs frequency-invariant and CPU-invariant PELT signals. These can
@@ -416,7 +420,8 @@ Using EAS on a platform that doesn't implement these two callbacks is not
416supported. 420supported.
417 421
418 422
419 6.6 Multithreading (SMT) 4236.6 Multithreading (SMT)
424^^^^^^^^^^^^^^^^^^^^^^^^
420 425
421EAS in its current form is SMT unaware and is not able to leverage 426EAS in its current form is SMT unaware and is not able to leverage
422multithreaded hardware to save energy. EAS considers threads as independent 427multithreaded hardware to save energy. EAS considers threads as independent
diff --git a/Documentation/scheduler/sched-nice-design.txt b/Documentation/scheduler/sched-nice-design.rst
index 3ac1e46d5365..0571f1b47e64 100644
--- a/Documentation/scheduler/sched-nice-design.txt
+++ b/Documentation/scheduler/sched-nice-design.rst
@@ -1,3 +1,7 @@
1=====================
2Scheduler Nice Design
3=====================
4
1This document explains the thinking about the revamped and streamlined 5This document explains the thinking about the revamped and streamlined
2nice-levels implementation in the new Linux scheduler. 6nice-levels implementation in the new Linux scheduler.
3 7
@@ -14,7 +18,7 @@ much stronger than they were before in 2.4 (and people were happy about
14that change), and we also intentionally calibrated the linear timeslice 18that change), and we also intentionally calibrated the linear timeslice
15rule so that nice +19 level would be _exactly_ 1 jiffy. To better 19rule so that nice +19 level would be _exactly_ 1 jiffy. To better
16understand it, the timeslice graph went like this (cheesy ASCII art 20understand it, the timeslice graph went like this (cheesy ASCII art
17alert!): 21alert!)::
18 22
19 23
20 A 24 A
diff --git a/Documentation/scheduler/sched-rt-group.txt b/Documentation/scheduler/sched-rt-group.rst
index c09f7a3fee66..d27d3f3712fd 100644
--- a/Documentation/scheduler/sched-rt-group.txt
+++ b/Documentation/scheduler/sched-rt-group.rst
@@ -1,18 +1,18 @@
1 Real-Time group scheduling 1==========================
2 -------------------------- 2Real-Time group scheduling
3==========================
3 4
4CONTENTS 5.. CONTENTS
5========
6 6
70. WARNING 7 0. WARNING
81. Overview 8 1. Overview
9 1.1 The problem 9 1.1 The problem
10 1.2 The solution 10 1.2 The solution
112. The interface 11 2. The interface
12 2.1 System-wide settings 12 2.1 System-wide settings
13 2.2 Default behaviour 13 2.2 Default behaviour
14 2.3 Basis for grouping tasks 14 2.3 Basis for grouping tasks
153. Future plans 15 3. Future plans
16 16
17 17
180. WARNING 180. WARNING
@@ -159,9 +159,11 @@ Consider two sibling groups A and B; both have 50% bandwidth, but A's
159period is twice the length of B's. 159period is twice the length of B's.
160 160
161* group A: period=100000us, runtime=50000us 161* group A: period=100000us, runtime=50000us
162
162 - this runs for 0.05s once every 0.1s 163 - this runs for 0.05s once every 0.1s
163 164
164* group B: period= 50000us, runtime=25000us 165* group B: period= 50000us, runtime=25000us
166
165 - this runs for 0.025s twice every 0.1s (or once every 0.05 sec). 167 - this runs for 0.025s twice every 0.1s (or once every 0.05 sec).
166 168
167This means that currently a while (1) loop in A will run for the full period of 169This means that currently a while (1) loop in A will run for the full period of
diff --git a/Documentation/scheduler/sched-stats.txt b/Documentation/scheduler/sched-stats.rst
index 8259b34a66ae..0cb0aa714545 100644
--- a/Documentation/scheduler/sched-stats.txt
+++ b/Documentation/scheduler/sched-stats.rst
@@ -1,3 +1,7 @@
1====================
2Scheduler Statistics
3====================
4
1Version 15 of schedstats dropped counters for some sched_yield: 5Version 15 of schedstats dropped counters for some sched_yield:
2yld_exp_empty, yld_act_empty and yld_both_empty. Otherwise, it is 6yld_exp_empty, yld_act_empty and yld_both_empty. Otherwise, it is
3identical to version 14. 7identical to version 14.
@@ -35,19 +39,23 @@ CPU statistics
35cpu<N> 1 2 3 4 5 6 7 8 9 39cpu<N> 1 2 3 4 5 6 7 8 9
36 40
37First field is a sched_yield() statistic: 41First field is a sched_yield() statistic:
42
38 1) # of times sched_yield() was called 43 1) # of times sched_yield() was called
39 44
40Next three are schedule() statistics: 45Next three are schedule() statistics:
46
41 2) This field is a legacy array expiration count field used in the O(1) 47 2) This field is a legacy array expiration count field used in the O(1)
42 scheduler. We kept it for ABI compatibility, but it is always set to zero. 48 scheduler. We kept it for ABI compatibility, but it is always set to zero.
43 3) # of times schedule() was called 49 3) # of times schedule() was called
44 4) # of times schedule() left the processor idle 50 4) # of times schedule() left the processor idle
45 51
46Next two are try_to_wake_up() statistics: 52Next two are try_to_wake_up() statistics:
53
47 5) # of times try_to_wake_up() was called 54 5) # of times try_to_wake_up() was called
48 6) # of times try_to_wake_up() was called to wake up the local cpu 55 6) # of times try_to_wake_up() was called to wake up the local cpu
49 56
50Next three are statistics describing scheduling latency: 57Next three are statistics describing scheduling latency:
58
51 7) sum of all time spent running by tasks on this processor (in jiffies) 59 7) sum of all time spent running by tasks on this processor (in jiffies)
52 8) sum of all time spent waiting to run by tasks on this processor (in 60 8) sum of all time spent waiting to run by tasks on this processor (in
53 jiffies) 61 jiffies)
@@ -67,24 +75,23 @@ The first field is a bit mask indicating what cpus this domain operates over.
67The next 24 are a variety of load_balance() statistics in grouped into types 75The next 24 are a variety of load_balance() statistics in grouped into types
68of idleness (idle, busy, and newly idle): 76of idleness (idle, busy, and newly idle):
69 77
70 1) # of times in this domain load_balance() was called when the 78 1) # of times in this domain load_balance() was called when the
71 cpu was idle 79 cpu was idle
72 2) # of times in this domain load_balance() checked but found 80 2) # of times in this domain load_balance() checked but found
73 the load did not require balancing when the cpu was idle 81 the load did not require balancing when the cpu was idle
74 3) # of times in this domain load_balance() tried to move one or 82 3) # of times in this domain load_balance() tried to move one or
75 more tasks and failed, when the cpu was idle 83 more tasks and failed, when the cpu was idle
76 4) sum of imbalances discovered (if any) with each call to 84 4) sum of imbalances discovered (if any) with each call to
77 load_balance() in this domain when the cpu was idle 85 load_balance() in this domain when the cpu was idle
78 5) # of times in this domain pull_task() was called when the cpu 86 5) # of times in this domain pull_task() was called when the cpu
79 was idle 87 was idle
80 6) # of times in this domain pull_task() was called even though 88 6) # of times in this domain pull_task() was called even though
81 the target task was cache-hot when idle 89 the target task was cache-hot when idle
82 7) # of times in this domain load_balance() was called but did 90 7) # of times in this domain load_balance() was called but did
83 not find a busier queue while the cpu was idle 91 not find a busier queue while the cpu was idle
84 8) # of times in this domain a busier queue was found while the 92 8) # of times in this domain a busier queue was found while the
85 cpu was idle but no busier group was found 93 cpu was idle but no busier group was found
86 94 9) # of times in this domain load_balance() was called when the
87 9) # of times in this domain load_balance() was called when the
88 cpu was busy 95 cpu was busy
89 10) # of times in this domain load_balance() checked but found the 96 10) # of times in this domain load_balance() checked but found the
90 load did not require balancing when busy 97 load did not require balancing when busy
@@ -117,21 +124,25 @@ of idleness (idle, busy, and newly idle):
117 was just becoming idle but no busier group was found 124 was just becoming idle but no busier group was found
118 125
119 Next three are active_load_balance() statistics: 126 Next three are active_load_balance() statistics:
127
120 25) # of times active_load_balance() was called 128 25) # of times active_load_balance() was called
121 26) # of times active_load_balance() tried to move a task and failed 129 26) # of times active_load_balance() tried to move a task and failed
122 27) # of times active_load_balance() successfully moved a task 130 27) # of times active_load_balance() successfully moved a task
123 131
124 Next three are sched_balance_exec() statistics: 132 Next three are sched_balance_exec() statistics:
133
125 28) sbe_cnt is not used 134 28) sbe_cnt is not used
126 29) sbe_balanced is not used 135 29) sbe_balanced is not used
127 30) sbe_pushed is not used 136 30) sbe_pushed is not used
128 137
129 Next three are sched_balance_fork() statistics: 138 Next three are sched_balance_fork() statistics:
139
130 31) sbf_cnt is not used 140 31) sbf_cnt is not used
131 32) sbf_balanced is not used 141 32) sbf_balanced is not used
132 33) sbf_pushed is not used 142 33) sbf_pushed is not used
133 143
134 Next three are try_to_wake_up() statistics: 144 Next three are try_to_wake_up() statistics:
145
135 34) # of times in this domain try_to_wake_up() awoke a task that 146 34) # of times in this domain try_to_wake_up() awoke a task that
136 last ran on a different cpu in this domain 147 last ran on a different cpu in this domain
137 35) # of times in this domain try_to_wake_up() moved a task to the 148 35) # of times in this domain try_to_wake_up() moved a task to the
@@ -139,10 +150,11 @@ of idleness (idle, busy, and newly idle):
139 36) # of times in this domain try_to_wake_up() started passive balancing 150 36) # of times in this domain try_to_wake_up() started passive balancing
140 151
141/proc/<pid>/schedstat 152/proc/<pid>/schedstat
142---------------- 153---------------------
143schedstats also adds a new /proc/<pid>/schedstat file to include some of 154schedstats also adds a new /proc/<pid>/schedstat file to include some of
144the same information on a per-process level. There are three fields in 155the same information on a per-process level. There are three fields in
145this file correlating for that process to: 156this file correlating for that process to:
157
146 1) time spent on the cpu 158 1) time spent on the cpu
147 2) time spent waiting on a runqueue 159 2) time spent waiting on a runqueue
148 3) # of timeslices run on this cpu 160 3) # of timeslices run on this cpu
@@ -151,4 +163,5 @@ A program could be easily written to make use of these extra fields to
151report on how well a particular process or set of processes is faring 163report on how well a particular process or set of processes is faring
152under the scheduler's policies. A simple version of such a program is 164under the scheduler's policies. A simple version of such a program is
153available at 165available at
166
154 http://eaglet.rain.com/rick/linux/schedstat/v12/latency.c 167 http://eaglet.rain.com/rick/linux/schedstat/v12/latency.c
diff --git a/Documentation/scheduler/text_files.rst b/Documentation/scheduler/text_files.rst
new file mode 100644
index 000000000000..0bc50307b241
--- /dev/null
+++ b/Documentation/scheduler/text_files.rst
@@ -0,0 +1,5 @@
1Scheduler pelt c program
2------------------------
3
4.. literalinclude:: sched-pelt.c
5 :language: c
diff --git a/Documentation/security/keys/core.rst b/Documentation/security/keys/core.rst
index 1b3c907980ad..bc561ca95c86 100644
--- a/Documentation/security/keys/core.rst
+++ b/Documentation/security/keys/core.rst
@@ -1687,10 +1687,12 @@ The structure has a number of fields, some of which are mandatory:
1687 attempted key link operation. If there is no match, -EINVAL is returned. 1687 attempted key link operation. If there is no match, -EINVAL is returned.
1688 1688
1689 1689
1690 * ``int (*asym_eds_op)(struct kernel_pkey_params *params, 1690 * ``asym_eds_op`` and ``asym_verify_signature``::
1691 const void *in, void *out);`` 1691
1692 ``int (*asym_verify_signature)(struct kernel_pkey_params *params, 1692 int (*asym_eds_op)(struct kernel_pkey_params *params,
1693 const void *in, const void *in2);`` 1693 const void *in, void *out);
1694 int (*asym_verify_signature)(struct kernel_pkey_params *params,
1695 const void *in, const void *in2);
1694 1696
1695 These methods are optional. If provided the first allows a key to be 1697 These methods are optional. If provided the first allows a key to be
1696 used to encrypt, decrypt or sign a blob of data, and the second allows a 1698 used to encrypt, decrypt or sign a blob of data, and the second allows a
@@ -1755,8 +1757,10 @@ The structure has a number of fields, some of which are mandatory:
1755 required crypto isn't available. 1757 required crypto isn't available.
1756 1758
1757 1759
1758 * ``int (*asym_query)(const struct kernel_pkey_params *params, 1760 * ``asym_query``::
1759 struct kernel_pkey_query *info);`` 1761
1762 int (*asym_query)(const struct kernel_pkey_params *params,
1763 struct kernel_pkey_query *info);
1760 1764
1761 This method is optional. If provided it allows information about the 1765 This method is optional. If provided it allows information about the
1762 public or asymmetric key held in the key to be determined. 1766 public or asymmetric key held in the key to be determined.
diff --git a/Documentation/security/keys/trusted-encrypted.rst b/Documentation/security/keys/trusted-encrypted.rst
index 7b35fcb58933..50ac8bcd6970 100644
--- a/Documentation/security/keys/trusted-encrypted.rst
+++ b/Documentation/security/keys/trusted-encrypted.rst
@@ -107,12 +107,14 @@ Where::
107 107
108Examples of trusted and encrypted key usage: 108Examples of trusted and encrypted key usage:
109 109
110Create and save a trusted key named "kmk" of length 32 bytes:: 110Create and save a trusted key named "kmk" of length 32 bytes.
111 111
112Note: When using a TPM 2.0 with a persistent key with handle 0x81000001, 112Note: When using a TPM 2.0 with a persistent key with handle 0x81000001,
113append 'keyhandle=0x81000001' to statements between quotes, such as 113append 'keyhandle=0x81000001' to statements between quotes, such as
114"new 32 keyhandle=0x81000001". 114"new 32 keyhandle=0x81000001".
115 115
116::
117
116 $ keyctl add trusted kmk "new 32" @u 118 $ keyctl add trusted kmk "new 32" @u
117 440502848 119 440502848
118 120
diff --git a/Documentation/sphinx/automarkup.py b/Documentation/sphinx/automarkup.py
new file mode 100644
index 000000000000..77e89c1956d7
--- /dev/null
+++ b/Documentation/sphinx/automarkup.py
@@ -0,0 +1,101 @@
1# SPDX-License-Identifier: GPL-2.0
2# Copyright 2019 Jonathan Corbet <corbet@lwn.net>
3#
4# Apply kernel-specific tweaks after the initial document processing
5# has been done.
6#
7from docutils import nodes
8from sphinx import addnodes
9from sphinx.environment import NoUri
10import re
11
12#
13# Regex nastiness. Of course.
14# Try to identify "function()" that's not already marked up some
15# other way. Sphinx doesn't like a lot of stuff right after a
16# :c:func: block (i.e. ":c:func:`mmap()`s" flakes out), so the last
17# bit tries to restrict matches to things that won't create trouble.
18#
19RE_function = re.compile(r'([\w_][\w\d_]+\(\))')
20
21#
22# Many places in the docs refer to common system calls. It is
23# pointless to try to cross-reference them and, as has been known
24# to happen, somebody defining a function by these names can lead
25# to the creation of incorrect and confusing cross references. So
26# just don't even try with these names.
27#
28Skipfuncs = [ 'open', 'close', 'read', 'write', 'fcntl', 'mmap'
29 'select', 'poll', 'fork', 'execve', 'clone', 'ioctl']
30
31#
32# Find all occurrences of function() and try to replace them with
33# appropriate cross references.
34#
35def markup_funcs(docname, app, node):
36 cdom = app.env.domains['c']
37 t = node.astext()
38 done = 0
39 repl = [ ]
40 for m in RE_function.finditer(t):
41 #
42 # Include any text prior to function() as a normal text node.
43 #
44 if m.start() > done:
45 repl.append(nodes.Text(t[done:m.start()]))
46 #
47 # Go through the dance of getting an xref out of the C domain
48 #
49 target = m.group(1)[:-2]
50 target_text = nodes.Text(target + '()')
51 xref = None
52 if target not in Skipfuncs:
53 lit_text = nodes.literal(classes=['xref', 'c', 'c-func'])
54 lit_text += target_text
55 pxref = addnodes.pending_xref('', refdomain = 'c',
56 reftype = 'function',
57 reftarget = target, modname = None,
58 classname = None)
59 #
60 # XXX The Latex builder will throw NoUri exceptions here,
61 # work around that by ignoring them.
62 #
63 try:
64 xref = cdom.resolve_xref(app.env, docname, app.builder,
65 'function', target, pxref, lit_text)
66 except NoUri:
67 xref = None
68 #
69 # Toss the xref into the list if we got it; otherwise just put
70 # the function text.
71 #
72 if xref:
73 repl.append(xref)
74 else:
75 repl.append(target_text)
76 done = m.end()
77 if done < len(t):
78 repl.append(nodes.Text(t[done:]))
79 return repl
80
81def auto_markup(app, doctree, name):
82 #
83 # This loop could eventually be improved on. Someday maybe we
84 # want a proper tree traversal with a lot of awareness of which
85 # kinds of nodes to prune. But this works well for now.
86 #
87 # The nodes.literal test catches ``literal text``, its purpose is to
88 # avoid adding cross-references to functions that have been explicitly
89 # marked with cc:func:.
90 #
91 for para in doctree.traverse(nodes.paragraph):
92 for node in para.traverse(nodes.Text):
93 if not isinstance(node.parent, nodes.literal):
94 node.parent.replace(node, markup_funcs(name, app, node))
95
96def setup(app):
97 app.connect('doctree-resolved', auto_markup)
98 return {
99 'parallel_read_safe': True,
100 'parallel_write_safe': True,
101 }
diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py
index cf13ff3a656c..cbac8e608dc4 100644
--- a/Documentation/sphinx/cdomain.py
+++ b/Documentation/sphinx/cdomain.py
@@ -48,7 +48,10 @@ major, minor, patch = sphinx.version_info[:3]
48 48
49def setup(app): 49def setup(app):
50 50
51 app.override_domain(CDomain) 51 if (major == 1 and minor < 8):
52 app.override_domain(CDomain)
53 else:
54 app.add_domain(CDomain, override=True)
52 55
53 return dict( 56 return dict(
54 version = __version__, 57 version = __version__,
diff --git a/Documentation/sphinx/requirements.txt b/Documentation/sphinx/requirements.txt
index 742be3e12619..14e29a0ae480 100644
--- a/Documentation/sphinx/requirements.txt
+++ b/Documentation/sphinx/requirements.txt
@@ -1,3 +1,3 @@
1docutils==0.12 1docutils
2Sphinx==1.4.9 2Sphinx==1.7.9
3sphinx_rtd_theme 3sphinx_rtd_theme
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index 5af8b131ccbc..1b2fe17cd2fa 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -154,7 +154,7 @@ is 0x15 and the full version number is 0x234, this file will contain
154the value 340 = 0x154. 154the value 340 = 0x154.
155 155
156See the type_of_loader and ext_loader_type fields in 156See the type_of_loader and ext_loader_type fields in
157Documentation/x86/boot.txt for additional information. 157Documentation/x86/boot.rst for additional information.
158 158
159============================================================== 159==============================================================
160 160
@@ -166,7 +166,7 @@ The complete bootloader version number. In the example above, this
166file will contain the value 564 = 0x234. 166file will contain the value 564 = 0x234.
167 167
168See the type_of_loader and ext_loader_ver fields in 168See the type_of_loader and ext_loader_ver fields in
169Documentation/x86/boot.txt for additional information. 169Documentation/x86/boot.rst for additional information.
170 170
171============================================================== 171==============================================================
172 172
diff --git a/Documentation/target/index.rst b/Documentation/target/index.rst
new file mode 100644
index 000000000000..b68f48982392
--- /dev/null
+++ b/Documentation/target/index.rst
@@ -0,0 +1,19 @@
1:orphan:
2
3==================
4TCM Virtual Device
5==================
6
7.. toctree::
8 :maxdepth: 1
9
10 tcmu-design
11 tcm_mod_builder
12 scripts
13
14.. only:: subproject and html
15
16 Indices
17 =======
18
19 * :ref:`genindex`
diff --git a/Documentation/target/scripts.rst b/Documentation/target/scripts.rst
new file mode 100644
index 000000000000..172d42b522e4
--- /dev/null
+++ b/Documentation/target/scripts.rst
@@ -0,0 +1,11 @@
1TCM mod builder script
2----------------------
3
4.. literalinclude:: tcm_mod_builder.py
5 :language: perl
6
7Target export device script
8---------------------------
9
10.. literalinclude:: target-export-device
11 :language: shell
diff --git a/Documentation/target/tcm_mod_builder.rst b/Documentation/target/tcm_mod_builder.rst
new file mode 100644
index 000000000000..9bfc9822e2bd
--- /dev/null
+++ b/Documentation/target/tcm_mod_builder.rst
@@ -0,0 +1,149 @@
1=========================================
2The TCM v4 fabric module script generator
3=========================================
4
5Greetings all,
6
7This document is intended to be a mini-HOWTO for using the tcm_mod_builder.py
8script to generate a brand new functional TCM v4 fabric .ko module of your very own,
9that once built can be immediately be loaded to start access the new TCM/ConfigFS
10fabric skeleton, by simply using::
11
12 modprobe $TCM_NEW_MOD
13 mkdir -p /sys/kernel/config/target/$TCM_NEW_MOD
14
15This script will create a new drivers/target/$TCM_NEW_MOD/, and will do the following
16
17 1) Generate new API callers for drivers/target/target_core_fabric_configs.c logic
18 ->make_tpg(), ->drop_tpg(), ->make_wwn(), ->drop_wwn(). These are created
19 into $TCM_NEW_MOD/$TCM_NEW_MOD_configfs.c
20 2) Generate basic infrastructure for loading/unloading LKMs and TCM/ConfigFS fabric module
21 using a skeleton struct target_core_fabric_ops API template.
22 3) Based on user defined T10 Proto_Ident for the new fabric module being built,
23 the TransportID / Initiator and Target WWPN related handlers for
24 SPC-3 persistent reservation are automatically generated in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
25 using drivers/target/target_core_fabric_lib.c logic.
26 4) NOP API calls for all other Data I/O path and fabric dependent attribute logic
27 in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
28
29tcm_mod_builder.py depends upon the mandatory '-p $PROTO_IDENT' and '-m
30$FABRIC_MOD_name' parameters, and actually running the script looks like::
31
32 target:/mnt/sdb/lio-core-2.6.git/Documentation/target# python tcm_mod_builder.py -p iSCSI -m tcm_nab5000
33 tcm_dir: /mnt/sdb/lio-core-2.6.git/Documentation/target/../../
34 Set fabric_mod_name: tcm_nab5000
35 Set fabric_mod_dir:
36 /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
37 Using proto_ident: iSCSI
38 Creating fabric_mod_dir:
39 /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
40 Writing file:
41 /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_base.h
42 Using tcm_mod_scan_fabric_ops:
43 /mnt/sdb/lio-core-2.6.git/Documentation/target/../../include/target/target_core_fabric_ops.h
44 Writing file:
45 /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.c
46 Writing file:
47 /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.h
48 Writing file:
49 /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_configfs.c
50 Writing file:
51 /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kbuild
52 Writing file:
53 /mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kconfig
54 Would you like to add tcm_nab5000to drivers/target/Kbuild..? [yes,no]: yes
55 Would you like to add tcm_nab5000to drivers/target/Kconfig..? [yes,no]: yes
56
57At the end of tcm_mod_builder.py. the script will ask to add the following
58line to drivers/target/Kbuild::
59
60 obj-$(CONFIG_TCM_NAB5000) += tcm_nab5000/
61
62and the same for drivers/target/Kconfig::
63
64 source "drivers/target/tcm_nab5000/Kconfig"
65
66#) Run 'make menuconfig' and select the new CONFIG_TCM_NAB5000 item::
67
68 <M> TCM_NAB5000 fabric module
69
70#) Build using 'make modules', once completed you will have::
71
72 target:/mnt/sdb/lio-core-2.6.git# ls -la drivers/target/tcm_nab5000/
73 total 1348
74 drwxr-xr-x 2 root root 4096 2010-10-05 03:23 .
75 drwxr-xr-x 9 root root 4096 2010-10-05 03:22 ..
76 -rw-r--r-- 1 root root 282 2010-10-05 03:22 Kbuild
77 -rw-r--r-- 1 root root 171 2010-10-05 03:22 Kconfig
78 -rw-r--r-- 1 root root 49 2010-10-05 03:23 modules.order
79 -rw-r--r-- 1 root root 738 2010-10-05 03:22 tcm_nab5000_base.h
80 -rw-r--r-- 1 root root 9096 2010-10-05 03:22 tcm_nab5000_configfs.c
81 -rw-r--r-- 1 root root 191200 2010-10-05 03:23 tcm_nab5000_configfs.o
82 -rw-r--r-- 1 root root 40504 2010-10-05 03:23 .tcm_nab5000_configfs.o.cmd
83 -rw-r--r-- 1 root root 5414 2010-10-05 03:22 tcm_nab5000_fabric.c
84 -rw-r--r-- 1 root root 2016 2010-10-05 03:22 tcm_nab5000_fabric.h
85 -rw-r--r-- 1 root root 190932 2010-10-05 03:23 tcm_nab5000_fabric.o
86 -rw-r--r-- 1 root root 40713 2010-10-05 03:23 .tcm_nab5000_fabric.o.cmd
87 -rw-r--r-- 1 root root 401861 2010-10-05 03:23 tcm_nab5000.ko
88 -rw-r--r-- 1 root root 265 2010-10-05 03:23 .tcm_nab5000.ko.cmd
89 -rw-r--r-- 1 root root 459 2010-10-05 03:23 tcm_nab5000.mod.c
90 -rw-r--r-- 1 root root 23896 2010-10-05 03:23 tcm_nab5000.mod.o
91 -rw-r--r-- 1 root root 22655 2010-10-05 03:23 .tcm_nab5000.mod.o.cmd
92 -rw-r--r-- 1 root root 379022 2010-10-05 03:23 tcm_nab5000.o
93 -rw-r--r-- 1 root root 211 2010-10-05 03:23 .tcm_nab5000.o.cmd
94
95#) Load the new module, create a lun_0 configfs group, and add new TCM Core
96 IBLOCK backstore symlink to port::
97
98 target:/mnt/sdb/lio-core-2.6.git# insmod drivers/target/tcm_nab5000.ko
99 target:/mnt/sdb/lio-core-2.6.git# mkdir -p /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0
100 target:/mnt/sdb/lio-core-2.6.git# cd /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0/
101 target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# ln -s /sys/kernel/config/target/core/iblock_0/lvm_test0 nab5000_port
102
103 target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# cd -
104 target:/mnt/sdb/lio-core-2.6.git# tree /sys/kernel/config/target/nab5000/
105 /sys/kernel/config/target/nab5000/
106 |-- discovery_auth
107 |-- iqn.foo
108 | `-- tpgt_1
109 | |-- acls
110 | |-- attrib
111 | |-- lun
112 | | `-- lun_0
113 | | |-- alua_tg_pt_gp
114 | | |-- alua_tg_pt_offline
115 | | |-- alua_tg_pt_status
116 | | |-- alua_tg_pt_write_md
117 | | `-- nab5000_port -> ../../../../../../target/core/iblock_0/lvm_test0
118 | |-- np
119 | `-- param
120 `-- version
121
122 target:/mnt/sdb/lio-core-2.6.git# lsmod
123 Module Size Used by
124 tcm_nab5000 3935 4
125 iscsi_target_mod 193211 0
126 target_core_stgt 8090 0
127 target_core_pscsi 11122 1
128 target_core_file 9172 2
129 target_core_iblock 9280 1
130 target_core_mod 228575 31
131 tcm_nab5000,iscsi_target_mod,target_core_stgt,target_core_pscsi,target_core_file,target_core_iblock
132 libfc 73681 0
133 scsi_debug 56265 0
134 scsi_tgt 8666 1 target_core_stgt
135 configfs 20644 2 target_core_mod
136
137----------------------------------------------------------------------
138
139Future TODO items
140=================
141
142 1) Add more T10 proto_idents
143 2) Make tcm_mod_dump_fabric_ops() smarter and generate function pointer
144 defs directly from include/target/target_core_fabric_ops.h:struct target_core_fabric_ops
145 structure members.
146
147October 5th, 2010
148
149Nicholas A. Bellinger <nab@linux-iscsi.org>
diff --git a/Documentation/target/tcm_mod_builder.txt b/Documentation/target/tcm_mod_builder.txt
deleted file mode 100644
index ae22f7005540..000000000000
--- a/Documentation/target/tcm_mod_builder.txt
+++ /dev/null
@@ -1,145 +0,0 @@
1>>>>>>>>>> The TCM v4 fabric module script generator <<<<<<<<<<
2
3Greetings all,
4
5This document is intended to be a mini-HOWTO for using the tcm_mod_builder.py
6script to generate a brand new functional TCM v4 fabric .ko module of your very own,
7that once built can be immediately be loaded to start access the new TCM/ConfigFS
8fabric skeleton, by simply using:
9
10 modprobe $TCM_NEW_MOD
11 mkdir -p /sys/kernel/config/target/$TCM_NEW_MOD
12
13This script will create a new drivers/target/$TCM_NEW_MOD/, and will do the following
14
15 *) Generate new API callers for drivers/target/target_core_fabric_configs.c logic
16 ->make_tpg(), ->drop_tpg(), ->make_wwn(), ->drop_wwn(). These are created
17 into $TCM_NEW_MOD/$TCM_NEW_MOD_configfs.c
18 *) Generate basic infrastructure for loading/unloading LKMs and TCM/ConfigFS fabric module
19 using a skeleton struct target_core_fabric_ops API template.
20 *) Based on user defined T10 Proto_Ident for the new fabric module being built,
21 the TransportID / Initiator and Target WWPN related handlers for
22 SPC-3 persistent reservation are automatically generated in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
23 using drivers/target/target_core_fabric_lib.c logic.
24 *) NOP API calls for all other Data I/O path and fabric dependent attribute logic
25 in $TCM_NEW_MOD/$TCM_NEW_MOD_fabric.c
26
27tcm_mod_builder.py depends upon the mandatory '-p $PROTO_IDENT' and '-m
28$FABRIC_MOD_name' parameters, and actually running the script looks like:
29
30target:/mnt/sdb/lio-core-2.6.git/Documentation/target# python tcm_mod_builder.py -p iSCSI -m tcm_nab5000
31tcm_dir: /mnt/sdb/lio-core-2.6.git/Documentation/target/../../
32Set fabric_mod_name: tcm_nab5000
33Set fabric_mod_dir:
34/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
35Using proto_ident: iSCSI
36Creating fabric_mod_dir:
37/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000
38Writing file:
39/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_base.h
40Using tcm_mod_scan_fabric_ops:
41/mnt/sdb/lio-core-2.6.git/Documentation/target/../../include/target/target_core_fabric_ops.h
42Writing file:
43/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.c
44Writing file:
45/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_fabric.h
46Writing file:
47/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/tcm_nab5000_configfs.c
48Writing file:
49/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kbuild
50Writing file:
51/mnt/sdb/lio-core-2.6.git/Documentation/target/../../drivers/target/tcm_nab5000/Kconfig
52Would you like to add tcm_nab5000to drivers/target/Kbuild..? [yes,no]: yes
53Would you like to add tcm_nab5000to drivers/target/Kconfig..? [yes,no]: yes
54
55At the end of tcm_mod_builder.py. the script will ask to add the following
56line to drivers/target/Kbuild:
57
58 obj-$(CONFIG_TCM_NAB5000) += tcm_nab5000/
59
60and the same for drivers/target/Kconfig:
61
62 source "drivers/target/tcm_nab5000/Kconfig"
63
64*) Run 'make menuconfig' and select the new CONFIG_TCM_NAB5000 item:
65
66 <M> TCM_NAB5000 fabric module
67
68*) Build using 'make modules', once completed you will have:
69
70target:/mnt/sdb/lio-core-2.6.git# ls -la drivers/target/tcm_nab5000/
71total 1348
72drwxr-xr-x 2 root root 4096 2010-10-05 03:23 .
73drwxr-xr-x 9 root root 4096 2010-10-05 03:22 ..
74-rw-r--r-- 1 root root 282 2010-10-05 03:22 Kbuild
75-rw-r--r-- 1 root root 171 2010-10-05 03:22 Kconfig
76-rw-r--r-- 1 root root 49 2010-10-05 03:23 modules.order
77-rw-r--r-- 1 root root 738 2010-10-05 03:22 tcm_nab5000_base.h
78-rw-r--r-- 1 root root 9096 2010-10-05 03:22 tcm_nab5000_configfs.c
79-rw-r--r-- 1 root root 191200 2010-10-05 03:23 tcm_nab5000_configfs.o
80-rw-r--r-- 1 root root 40504 2010-10-05 03:23 .tcm_nab5000_configfs.o.cmd
81-rw-r--r-- 1 root root 5414 2010-10-05 03:22 tcm_nab5000_fabric.c
82-rw-r--r-- 1 root root 2016 2010-10-05 03:22 tcm_nab5000_fabric.h
83-rw-r--r-- 1 root root 190932 2010-10-05 03:23 tcm_nab5000_fabric.o
84-rw-r--r-- 1 root root 40713 2010-10-05 03:23 .tcm_nab5000_fabric.o.cmd
85-rw-r--r-- 1 root root 401861 2010-10-05 03:23 tcm_nab5000.ko
86-rw-r--r-- 1 root root 265 2010-10-05 03:23 .tcm_nab5000.ko.cmd
87-rw-r--r-- 1 root root 459 2010-10-05 03:23 tcm_nab5000.mod.c
88-rw-r--r-- 1 root root 23896 2010-10-05 03:23 tcm_nab5000.mod.o
89-rw-r--r-- 1 root root 22655 2010-10-05 03:23 .tcm_nab5000.mod.o.cmd
90-rw-r--r-- 1 root root 379022 2010-10-05 03:23 tcm_nab5000.o
91-rw-r--r-- 1 root root 211 2010-10-05 03:23 .tcm_nab5000.o.cmd
92
93*) Load the new module, create a lun_0 configfs group, and add new TCM Core
94 IBLOCK backstore symlink to port:
95
96target:/mnt/sdb/lio-core-2.6.git# insmod drivers/target/tcm_nab5000.ko
97target:/mnt/sdb/lio-core-2.6.git# mkdir -p /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0
98target:/mnt/sdb/lio-core-2.6.git# cd /sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0/
99target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# ln -s /sys/kernel/config/target/core/iblock_0/lvm_test0 nab5000_port
100
101target:/sys/kernel/config/target/nab5000/iqn.foo/tpgt_1/lun/lun_0# cd -
102target:/mnt/sdb/lio-core-2.6.git# tree /sys/kernel/config/target/nab5000/
103/sys/kernel/config/target/nab5000/
104|-- discovery_auth
105|-- iqn.foo
106| `-- tpgt_1
107| |-- acls
108| |-- attrib
109| |-- lun
110| | `-- lun_0
111| | |-- alua_tg_pt_gp
112| | |-- alua_tg_pt_offline
113| | |-- alua_tg_pt_status
114| | |-- alua_tg_pt_write_md
115| | `-- nab5000_port -> ../../../../../../target/core/iblock_0/lvm_test0
116| |-- np
117| `-- param
118`-- version
119
120target:/mnt/sdb/lio-core-2.6.git# lsmod
121Module Size Used by
122tcm_nab5000 3935 4
123iscsi_target_mod 193211 0
124target_core_stgt 8090 0
125target_core_pscsi 11122 1
126target_core_file 9172 2
127target_core_iblock 9280 1
128target_core_mod 228575 31
129tcm_nab5000,iscsi_target_mod,target_core_stgt,target_core_pscsi,target_core_file,target_core_iblock
130libfc 73681 0
131scsi_debug 56265 0
132scsi_tgt 8666 1 target_core_stgt
133configfs 20644 2 target_core_mod
134
135----------------------------------------------------------------------
136
137Future TODO items:
138
139 *) Add more T10 proto_idents
140 *) Make tcm_mod_dump_fabric_ops() smarter and generate function pointer
141 defs directly from include/target/target_core_fabric_ops.h:struct target_core_fabric_ops
142 structure members.
143
144October 5th, 2010
145Nicholas A. Bellinger <nab@linux-iscsi.org>
diff --git a/Documentation/target/tcmu-design.txt b/Documentation/target/tcmu-design.rst
index 4cebc1ebf99a..a7b426707bf6 100644
--- a/Documentation/target/tcmu-design.txt
+++ b/Documentation/target/tcmu-design.rst
@@ -1,25 +1,30 @@
1Contents: 1====================
2 2TCM Userspace Design
31) TCM Userspace Design 3====================
4 a) Background 4
5 b) Benefits 5
6 c) Design constraints 6.. Contents:
7 d) Implementation overview 7
8 i. Mailbox 8 1) TCM Userspace Design
9 ii. Command ring 9 a) Background
10 iii. Data Area 10 b) Benefits
11 e) Device discovery 11 c) Design constraints
12 f) Device events 12 d) Implementation overview
13 g) Other contingencies 13 i. Mailbox
142) Writing a user pass-through handler 14 ii. Command ring
15 a) Discovering and configuring TCMU uio devices 15 iii. Data Area
16 b) Waiting for events on the device(s) 16 e) Device discovery
17 c) Managing the command ring 17 f) Device events
183) A final note 18 g) Other contingencies
19 2) Writing a user pass-through handler
20 a) Discovering and configuring TCMU uio devices
21 b) Waiting for events on the device(s)
22 c) Managing the command ring
23 3) A final note
19 24
20 25
21TCM Userspace Design 26TCM Userspace Design
22-------------------- 27====================
23 28
24TCM is another name for LIO, an in-kernel iSCSI target (server). 29TCM is another name for LIO, an in-kernel iSCSI target (server).
25Existing TCM targets run in the kernel. TCMU (TCM in Userspace) 30Existing TCM targets run in the kernel. TCMU (TCM in Userspace)
@@ -32,7 +37,8 @@ modules for file, block device, RAM or using another SCSI device as
32storage. These are called "backstores" or "storage engines". These 37storage. These are called "backstores" or "storage engines". These
33built-in modules are implemented entirely as kernel code. 38built-in modules are implemented entirely as kernel code.
34 39
35Background: 40Background
41----------
36 42
37In addition to modularizing the transport protocol used for carrying 43In addition to modularizing the transport protocol used for carrying
38SCSI commands ("fabrics"), the Linux kernel target, LIO, also modularizes 44SCSI commands ("fabrics"), the Linux kernel target, LIO, also modularizes
@@ -60,7 +66,8 @@ kernel, another approach is to create a userspace pass-through
60backstore for LIO, "TCMU". 66backstore for LIO, "TCMU".
61 67
62 68
63Benefits: 69Benefits
70--------
64 71
65In addition to allowing relatively easy support for RBD and GLFS, TCMU 72In addition to allowing relatively easy support for RBD and GLFS, TCMU
66will also allow easier development of new backstores. TCMU combines 73will also allow easier development of new backstores. TCMU combines
@@ -72,21 +79,25 @@ The disadvantage is there are more distinct components to configure, and
72potentially to malfunction. This is unavoidable, but hopefully not 79potentially to malfunction. This is unavoidable, but hopefully not
73fatal if we're careful to keep things as simple as possible. 80fatal if we're careful to keep things as simple as possible.
74 81
75Design constraints: 82Design constraints
83------------------
76 84
77- Good performance: high throughput, low latency 85- Good performance: high throughput, low latency
78- Cleanly handle if userspace: 86- Cleanly handle if userspace:
87
79 1) never attaches 88 1) never attaches
80 2) hangs 89 2) hangs
81 3) dies 90 3) dies
82 4) misbehaves 91 4) misbehaves
92
83- Allow future flexibility in user & kernel implementations 93- Allow future flexibility in user & kernel implementations
84- Be reasonably memory-efficient 94- Be reasonably memory-efficient
85- Simple to configure & run 95- Simple to configure & run
86- Simple to write a userspace backend 96- Simple to write a userspace backend
87 97
88 98
89Implementation overview: 99Implementation overview
100-----------------------
90 101
91The core of the TCMU interface is a memory region that is shared 102The core of the TCMU interface is a memory region that is shared
92between kernel and userspace. Within this region is: a control area 103between kernel and userspace. Within this region is: a control area
@@ -108,7 +119,8 @@ the region mapped at a different virtual address.
108 119
109See target_core_user.h for the struct definitions. 120See target_core_user.h for the struct definitions.
110 121
111The Mailbox: 122The Mailbox
123-----------
112 124
113The mailbox is always at the start of the shared memory region, and 125The mailbox is always at the start of the shared memory region, and
114contains a version, details about the starting offset and size of the 126contains a version, details about the starting offset and size of the
@@ -117,19 +129,27 @@ userspace (respectively) to put commands on the ring, and indicate
117when the commands are completed. 129when the commands are completed.
118 130
119version - 1 (userspace should abort if otherwise) 131version - 1 (userspace should abort if otherwise)
132
120flags: 133flags:
121- TCMU_MAILBOX_FLAG_CAP_OOOC: indicates out-of-order completion is 134 - TCMU_MAILBOX_FLAG_CAP_OOOC:
122 supported. See "The Command Ring" for details. 135 indicates out-of-order completion is supported.
123cmdr_off - The offset of the start of the command ring from the start 136 See "The Command Ring" for details.
124of the memory region, to account for the mailbox size. 137
125cmdr_size - The size of the command ring. This does *not* need to be a 138cmdr_off
126power of two. 139 The offset of the start of the command ring from the start
127cmd_head - Modified by the kernel to indicate when a command has been 140 of the memory region, to account for the mailbox size.
128placed on the ring. 141cmdr_size
129cmd_tail - Modified by userspace to indicate when it has completed 142 The size of the command ring. This does *not* need to be a
130processing of a command. 143 power of two.
131 144cmd_head
132The Command Ring: 145 Modified by the kernel to indicate when a command has been
146 placed on the ring.
147cmd_tail
148 Modified by userspace to indicate when it has completed
149 processing of a command.
150
151The Command Ring
152----------------
133 153
134Commands are placed on the ring by the kernel incrementing 154Commands are placed on the ring by the kernel incrementing
135mailbox.cmd_head by the size of the command, modulo cmdr_size, and 155mailbox.cmd_head by the size of the command, modulo cmdr_size, and
@@ -180,29 +200,31 @@ opcode it does not handle, it must set UNKNOWN_OP bit (bit 0) in
180hdr.uflags, update cmd_tail, and proceed with processing additional 200hdr.uflags, update cmd_tail, and proceed with processing additional
181commands, if any. 201commands, if any.
182 202
183The Data Area: 203The Data Area
204-------------
184 205
185This is shared-memory space after the command ring. The organization 206This is shared-memory space after the command ring. The organization
186of this area is not defined in the TCMU interface, and userspace 207of this area is not defined in the TCMU interface, and userspace
187should access only the parts referenced by pending iovs. 208should access only the parts referenced by pending iovs.
188 209
189 210
190Device Discovery: 211Device Discovery
212----------------
191 213
192Other devices may be using UIO besides TCMU. Unrelated user processes 214Other devices may be using UIO besides TCMU. Unrelated user processes
193may also be handling different sets of TCMU devices. TCMU userspace 215may also be handling different sets of TCMU devices. TCMU userspace
194processes must find their devices by scanning sysfs 216processes must find their devices by scanning sysfs
195class/uio/uio*/name. For TCMU devices, these names will be of the 217class/uio/uio*/name. For TCMU devices, these names will be of the
196format: 218format::
197 219
198tcm-user/<hba_num>/<device_name>/<subtype>/<path> 220 tcm-user/<hba_num>/<device_name>/<subtype>/<path>
199 221
200where "tcm-user" is common for all TCMU-backed UIO devices. <hba_num> 222where "tcm-user" is common for all TCMU-backed UIO devices. <hba_num>
201and <device_name> allow userspace to find the device's path in the 223and <device_name> allow userspace to find the device's path in the
202kernel target's configfs tree. Assuming the usual mount point, it is 224kernel target's configfs tree. Assuming the usual mount point, it is
203found at: 225found at::
204 226
205/sys/kernel/config/target/core/user_<hba_num>/<device_name> 227 /sys/kernel/config/target/core/user_<hba_num>/<device_name>
206 228
207This location contains attributes such as "hw_block_size", that 229This location contains attributes such as "hw_block_size", that
208userspace needs to know for correct operation. 230userspace needs to know for correct operation.
@@ -214,15 +236,16 @@ configure the device, if needed. The name cannot contain ':', due to
214LIO limitations. 236LIO limitations.
215 237
216For all devices so discovered, the user handler opens /dev/uioX and 238For all devices so discovered, the user handler opens /dev/uioX and
217calls mmap(): 239calls mmap()::
218 240
219mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0) 241 mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)
220 242
221where size must be equal to the value read from 243where size must be equal to the value read from
222/sys/class/uio/uioX/maps/map0/size. 244/sys/class/uio/uioX/maps/map0/size.
223 245
224 246
225Device Events: 247Device Events
248-------------
226 249
227If a new device is added or removed, a notification will be broadcast 250If a new device is added or removed, a notification will be broadcast
228over netlink, using a generic netlink family name of "TCM-USER" and a 251over netlink, using a generic netlink family name of "TCM-USER" and a
@@ -233,7 +256,8 @@ the LIO device, so that after determining the device is supported
233(based on subtype) it can take the appropriate action. 256(based on subtype) it can take the appropriate action.
234 257
235 258
236Other contingencies: 259Other contingencies
260-------------------
237 261
238Userspace handler process never attaches: 262Userspace handler process never attaches:
239 263
@@ -258,7 +282,7 @@ Userspace handler process is malicious:
258 282
259 283
260Writing a user pass-through handler (with example code) 284Writing a user pass-through handler (with example code)
261------------------------------------------------------- 285=======================================================
262 286
263A user process handing a TCMU device must support the following: 287A user process handing a TCMU device must support the following:
264 288
@@ -277,103 +301,103 @@ TCMU is designed so that multiple unrelated processes can manage TCMU
277devices separately. All handlers should make sure to only open their 301devices separately. All handlers should make sure to only open their
278devices, based opon a known subtype string. 302devices, based opon a known subtype string.
279 303
280a) Discovering and configuring TCMU UIO devices: 304a) Discovering and configuring TCMU UIO devices::
281 305
282(error checking omitted for brevity) 306 /* error checking omitted for brevity */
283 307
284int fd, dev_fd; 308 int fd, dev_fd;
285char buf[256]; 309 char buf[256];
286unsigned long long map_len; 310 unsigned long long map_len;
287void *map; 311 void *map;
288 312
289fd = open("/sys/class/uio/uio0/name", O_RDONLY); 313 fd = open("/sys/class/uio/uio0/name", O_RDONLY);
290ret = read(fd, buf, sizeof(buf)); 314 ret = read(fd, buf, sizeof(buf));
291close(fd); 315 close(fd);
292buf[ret-1] = '\0'; /* null-terminate and chop off the \n */ 316 buf[ret-1] = '\0'; /* null-terminate and chop off the \n */
293 317
294/* we only want uio devices whose name is a format we expect */ 318 /* we only want uio devices whose name is a format we expect */
295if (strncmp(buf, "tcm-user", 8)) 319 if (strncmp(buf, "tcm-user", 8))
296 exit(-1); 320 exit(-1);
297 321
298/* Further checking for subtype also needed here */ 322 /* Further checking for subtype also needed here */
299
300fd = open(/sys/class/uio/%s/maps/map0/size, O_RDONLY);
301ret = read(fd, buf, sizeof(buf));
302close(fd);
303str_buf[ret-1] = '\0'; /* null-terminate and chop off the \n */
304 323
305map_len = strtoull(buf, NULL, 0); 324 fd = open(/sys/class/uio/%s/maps/map0/size, O_RDONLY);
325 ret = read(fd, buf, sizeof(buf));
326 close(fd);
327 str_buf[ret-1] = '\0'; /* null-terminate and chop off the \n */
306 328
307dev_fd = open("/dev/uio0", O_RDWR); 329 map_len = strtoull(buf, NULL, 0);
308map = mmap(NULL, map_len, PROT_READ|PROT_WRITE, MAP_SHARED, dev_fd, 0);
309 330
331 dev_fd = open("/dev/uio0", O_RDWR);
332 map = mmap(NULL, map_len, PROT_READ|PROT_WRITE, MAP_SHARED, dev_fd, 0);
310 333
311b) Waiting for events on the device(s)
312
313while (1) {
314 char buf[4];
315 334
316 int ret = read(dev_fd, buf, 4); /* will block */ 335 b) Waiting for events on the device(s)
317 336
318 handle_device_events(dev_fd, map); 337 while (1) {
319} 338 char buf[4];
320 339
340 int ret = read(dev_fd, buf, 4); /* will block */
321 341
322c) Managing the command ring 342 handle_device_events(dev_fd, map);
323
324#include <linux/target_core_user.h>
325
326int handle_device_events(int fd, void *map)
327{
328 struct tcmu_mailbox *mb = map;
329 struct tcmu_cmd_entry *ent = (void *) mb + mb->cmdr_off + mb->cmd_tail;
330 int did_some_work = 0;
331
332 /* Process events from cmd ring until we catch up with cmd_head */
333 while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) {
334
335 if (tcmu_hdr_get_op(ent->hdr.len_op) == TCMU_OP_CMD) {
336 uint8_t *cdb = (void *)mb + ent->req.cdb_off;
337 bool success = true;
338
339 /* Handle command here. */
340 printf("SCSI opcode: 0x%x\n", cdb[0]);
341
342 /* Set response fields */
343 if (success)
344 ent->rsp.scsi_status = SCSI_NO_SENSE;
345 else {
346 /* Also fill in rsp->sense_buffer here */
347 ent->rsp.scsi_status = SCSI_CHECK_CONDITION;
348 } 343 }
349 }
350 else if (tcmu_hdr_get_op(ent->hdr.len_op) != TCMU_OP_PAD) {
351 /* Tell the kernel we didn't handle unknown opcodes */
352 ent->hdr.uflags |= TCMU_UFLAG_UNKNOWN_OP;
353 }
354 else {
355 /* Do nothing for PAD entries except update cmd_tail */
356 }
357
358 /* update cmd_tail */
359 mb->cmd_tail = (mb->cmd_tail + tcmu_hdr_get_len(&ent->hdr)) % mb->cmdr_size;
360 ent = (void *) mb + mb->cmdr_off + mb->cmd_tail;
361 did_some_work = 1;
362 }
363 344
364 /* Notify the kernel that work has been finished */
365 if (did_some_work) {
366 uint32_t buf = 0;
367 345
368 write(fd, &buf, 4); 346c) Managing the command ring::
369 } 347
370 348 #include <linux/target_core_user.h>
371 return 0; 349
372} 350 int handle_device_events(int fd, void *map)
351 {
352 struct tcmu_mailbox *mb = map;
353 struct tcmu_cmd_entry *ent = (void *) mb + mb->cmdr_off + mb->cmd_tail;
354 int did_some_work = 0;
355
356 /* Process events from cmd ring until we catch up with cmd_head */
357 while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) {
358
359 if (tcmu_hdr_get_op(ent->hdr.len_op) == TCMU_OP_CMD) {
360 uint8_t *cdb = (void *)mb + ent->req.cdb_off;
361 bool success = true;
362
363 /* Handle command here. */
364 printf("SCSI opcode: 0x%x\n", cdb[0]);
365
366 /* Set response fields */
367 if (success)
368 ent->rsp.scsi_status = SCSI_NO_SENSE;
369 else {
370 /* Also fill in rsp->sense_buffer here */
371 ent->rsp.scsi_status = SCSI_CHECK_CONDITION;
372 }
373 }
374 else if (tcmu_hdr_get_op(ent->hdr.len_op) != TCMU_OP_PAD) {
375 /* Tell the kernel we didn't handle unknown opcodes */
376 ent->hdr.uflags |= TCMU_UFLAG_UNKNOWN_OP;
377 }
378 else {
379 /* Do nothing for PAD entries except update cmd_tail */
380 }
381
382 /* update cmd_tail */
383 mb->cmd_tail = (mb->cmd_tail + tcmu_hdr_get_len(&ent->hdr)) % mb->cmdr_size;
384 ent = (void *) mb + mb->cmdr_off + mb->cmd_tail;
385 did_some_work = 1;
386 }
387
388 /* Notify the kernel that work has been finished */
389 if (did_some_work) {
390 uint32_t buf = 0;
391
392 write(fd, &buf, 4);
393 }
394
395 return 0;
396 }
373 397
374 398
375A final note 399A final note
376------------ 400============
377 401
378Please be careful to return codes as defined by the SCSI 402Please be careful to return codes as defined by the SCSI
379specifications. These are different than some values defined in the 403specifications. These are different than some values defined in the
diff --git a/Documentation/tee.txt b/Documentation/tee.txt
index 56ea85ffebf2..afacdf2fd1de 100644
--- a/Documentation/tee.txt
+++ b/Documentation/tee.txt
@@ -32,7 +32,7 @@ User space (the client) connects to the driver by opening /dev/tee[0-9]* or
32 memory. 32 memory.
33 33
34- TEE_IOC_VERSION lets user space know which TEE this driver handles and 34- TEE_IOC_VERSION lets user space know which TEE this driver handles and
35 the its capabilities. 35 its capabilities.
36 36
37- TEE_IOC_OPEN_SESSION opens a new session to a Trusted Application. 37- TEE_IOC_OPEN_SESSION opens a new session to a Trusted Application.
38 38
diff --git a/Documentation/timers/highres.txt b/Documentation/timers/highres.rst
index 8f9741592123..bde5eb7e5c9e 100644
--- a/Documentation/timers/highres.txt
+++ b/Documentation/timers/highres.rst
@@ -1,5 +1,6 @@
1=====================================================
1High resolution timers and dynamic ticks design notes 2High resolution timers and dynamic ticks design notes
2----------------------------------------------------- 3=====================================================
3 4
4Further information can be found in the paper of the OLS 2006 talk "hrtimers 5Further information can be found in the paper of the OLS 2006 talk "hrtimers
5and beyond". The paper is part of the OLS 2006 Proceedings Volume 1, which can 6and beyond". The paper is part of the OLS 2006 Proceedings Volume 1, which can
@@ -30,11 +31,12 @@ hrtimer base infrastructure
30--------------------------- 31---------------------------
31 32
32The hrtimer base infrastructure was merged into the 2.6.16 kernel. Details of 33The hrtimer base infrastructure was merged into the 2.6.16 kernel. Details of
33the base implementation are covered in Documentation/timers/hrtimers.txt. See 34the base implementation are covered in Documentation/timers/hrtimers.rst. See
34also figure #2 (OLS slides p. 15) 35also figure #2 (OLS slides p. 15)
35 36
36The main differences to the timer wheel, which holds the armed timer_list type 37The main differences to the timer wheel, which holds the armed timer_list type
37timers are: 38timers are:
39
38 - time ordered enqueueing into a rb-tree 40 - time ordered enqueueing into a rb-tree
39 - independent of ticks (the processing is based on nanoseconds) 41 - independent of ticks (the processing is based on nanoseconds)
40 42
@@ -55,7 +57,8 @@ merged into the 2.6.18 kernel.
55 57
56Further information about the Generic Time Of Day framework is available in the 58Further information about the Generic Time Of Day framework is available in the
57OLS 2005 Proceedings Volume 1: 59OLS 2005 Proceedings Volume 1:
58http://www.linuxsymposium.org/2005/linuxsymposium_procv1.pdf 60
61 http://www.linuxsymposium.org/2005/linuxsymposium_procv1.pdf
59 62
60The paper "We Are Not Getting Any Younger: A New Approach to Time and 63The paper "We Are Not Getting Any Younger: A New Approach to Time and
61Timers" was written by J. Stultz, D.V. Hart, & N. Aravamudan. 64Timers" was written by J. Stultz, D.V. Hart, & N. Aravamudan.
@@ -100,6 +103,7 @@ accounting, profiling, and high resolution timers.
100 103
101The management layer assigns one or more of the following functions to a clock 104The management layer assigns one or more of the following functions to a clock
102event device: 105event device:
106
103 - system global periodic tick (jiffies update) 107 - system global periodic tick (jiffies update)
104 - cpu local update_process_times 108 - cpu local update_process_times
105 - cpu local profiling 109 - cpu local profiling
@@ -244,6 +248,3 @@ extended to x86_64 and ARM already. Initial (work in progress) support is also
244available for MIPS and PowerPC. 248available for MIPS and PowerPC.
245 249
246 Thomas, Ingo 250 Thomas, Ingo
247
248
249
diff --git a/Documentation/timers/hpet.txt b/Documentation/timers/hpet.rst
index 895345ec513b..c9d05d3caaca 100644
--- a/Documentation/timers/hpet.txt
+++ b/Documentation/timers/hpet.rst
@@ -1,4 +1,6 @@
1 High Precision Event Timer Driver for Linux 1===========================================
2High Precision Event Timer Driver for Linux
3===========================================
2 4
3The High Precision Event Timer (HPET) hardware follows a specification 5The High Precision Event Timer (HPET) hardware follows a specification
4by Intel and Microsoft, revision 1. 6by Intel and Microsoft, revision 1.
diff --git a/Documentation/timers/hrtimers.txt b/Documentation/timers/hrtimers.rst
index 588d85724f10..c1c20a693e8f 100644
--- a/Documentation/timers/hrtimers.txt
+++ b/Documentation/timers/hrtimers.rst
@@ -1,6 +1,6 @@
1 1======================================================
2hrtimers - subsystem for high-resolution kernel timers 2hrtimers - subsystem for high-resolution kernel timers
3---------------------------------------------------- 3======================================================
4 4
5This patch introduces a new subsystem for high-resolution kernel timers. 5This patch introduces a new subsystem for high-resolution kernel timers.
6 6
@@ -146,7 +146,7 @@ the clock_getres() interface. This will return whatever real resolution
146a given clock has - be it low-res, high-res, or artificially-low-res. 146a given clock has - be it low-res, high-res, or artificially-low-res.
147 147
148hrtimers - testing and verification 148hrtimers - testing and verification
149---------------------------------- 149-----------------------------------
150 150
151We used the high-resolution clock subsystem ontop of hrtimers to verify 151We used the high-resolution clock subsystem ontop of hrtimers to verify
152the hrtimer implementation details in praxis, and we also ran the posix 152the hrtimer implementation details in praxis, and we also ran the posix
diff --git a/Documentation/timers/index.rst b/Documentation/timers/index.rst
new file mode 100644
index 000000000000..91f6f8263c48
--- /dev/null
+++ b/Documentation/timers/index.rst
@@ -0,0 +1,22 @@
1:orphan:
2
3======
4timers
5======
6
7.. toctree::
8 :maxdepth: 1
9
10 highres
11 hpet
12 hrtimers
13 no_hz
14 timekeeping
15 timers-howto
16
17.. only:: subproject and html
18
19 Indices
20 =======
21
22 * :ref:`genindex`
diff --git a/Documentation/timers/NO_HZ.txt b/Documentation/timers/no_hz.rst
index 9591092da5e0..065db217cb04 100644
--- a/Documentation/timers/NO_HZ.txt
+++ b/Documentation/timers/no_hz.rst
@@ -1,4 +1,6 @@
1 NO_HZ: Reducing Scheduling-Clock Ticks 1======================================
2NO_HZ: Reducing Scheduling-Clock Ticks
3======================================
2 4
3 5
4This document describes Kconfig options and boot parameters that can 6This document describes Kconfig options and boot parameters that can
@@ -28,7 +30,8 @@ by a third section on RCU-specific considerations, a fourth section
28discussing testing, and a fifth and final section listing known issues. 30discussing testing, and a fifth and final section listing known issues.
29 31
30 32
31NEVER OMIT SCHEDULING-CLOCK TICKS 33Never Omit Scheduling-Clock Ticks
34=================================
32 35
33Very old versions of Linux from the 1990s and the very early 2000s 36Very old versions of Linux from the 1990s and the very early 2000s
34are incapable of omitting scheduling-clock ticks. It turns out that 37are incapable of omitting scheduling-clock ticks. It turns out that
@@ -59,7 +62,8 @@ degrade your applications performance. If this describes your workload,
59you should read the following two sections. 62you should read the following two sections.
60 63
61 64
62OMIT SCHEDULING-CLOCK TICKS FOR IDLE CPUs 65Omit Scheduling-Clock Ticks For Idle CPUs
66=========================================
63 67
64If a CPU is idle, there is little point in sending it a scheduling-clock 68If a CPU is idle, there is little point in sending it a scheduling-clock
65interrupt. After all, the primary purpose of a scheduling-clock interrupt 69interrupt. After all, the primary purpose of a scheduling-clock interrupt
@@ -97,7 +101,8 @@ By default, CONFIG_NO_HZ_IDLE=y kernels boot with "nohz=on", enabling
97dyntick-idle mode. 101dyntick-idle mode.
98 102
99 103
100OMIT SCHEDULING-CLOCK TICKS FOR CPUs WITH ONLY ONE RUNNABLE TASK 104Omit Scheduling-Clock Ticks For CPUs With Only One Runnable Task
105================================================================
101 106
102If a CPU has only one runnable task, there is little point in sending it 107If a CPU has only one runnable task, there is little point in sending it
103a scheduling-clock interrupt because there is no other task to switch to. 108a scheduling-clock interrupt because there is no other task to switch to.
@@ -174,7 +179,8 @@ However, the drawbacks listed above mean that adaptive ticks should not
174(yet) be enabled by default. 179(yet) be enabled by default.
175 180
176 181
177RCU IMPLICATIONS 182RCU Implications
183================
178 184
179There are situations in which idle CPUs cannot be permitted to 185There are situations in which idle CPUs cannot be permitted to
180enter either dyntick-idle mode or adaptive-tick mode, the most 186enter either dyntick-idle mode or adaptive-tick mode, the most
@@ -199,7 +205,8 @@ scheduler will decide where to run them, which might or might not be
199where you want them to run. 205where you want them to run.
200 206
201 207
202TESTING 208Testing
209=======
203 210
204So you enable all the OS-jitter features described in this document, 211So you enable all the OS-jitter features described in this document,
205but do not see any change in your workload's behavior. Is this because 212but do not see any change in your workload's behavior. Is this because
@@ -222,9 +229,10 @@ We do not currently have a good way to remove OS jitter from single-CPU
222systems. 229systems.
223 230
224 231
225KNOWN ISSUES 232Known Issues
233============
226 234
227o Dyntick-idle slows transitions to and from idle slightly. 235* Dyntick-idle slows transitions to and from idle slightly.
228 In practice, this has not been a problem except for the most 236 In practice, this has not been a problem except for the most
229 aggressive real-time workloads, which have the option of disabling 237 aggressive real-time workloads, which have the option of disabling
230 dyntick-idle mode, an option that most of them take. However, 238 dyntick-idle mode, an option that most of them take. However,
@@ -248,13 +256,13 @@ o Dyntick-idle slows transitions to and from idle slightly.
248 this parameter effectively disables Turbo Mode on Intel 256 this parameter effectively disables Turbo Mode on Intel
249 CPUs, which can significantly reduce maximum performance. 257 CPUs, which can significantly reduce maximum performance.
250 258
251o Adaptive-ticks slows user/kernel transitions slightly. 259* Adaptive-ticks slows user/kernel transitions slightly.
252 This is not expected to be a problem for computationally intensive 260 This is not expected to be a problem for computationally intensive
253 workloads, which have few such transitions. Careful benchmarking 261 workloads, which have few such transitions. Careful benchmarking
254 will be required to determine whether or not other workloads 262 will be required to determine whether or not other workloads
255 are significantly affected by this effect. 263 are significantly affected by this effect.
256 264
257o Adaptive-ticks does not do anything unless there is only one 265* Adaptive-ticks does not do anything unless there is only one
258 runnable task for a given CPU, even though there are a number 266 runnable task for a given CPU, even though there are a number
259 of other situations where the scheduling-clock tick is not 267 of other situations where the scheduling-clock tick is not
260 needed. To give but one example, consider a CPU that has one 268 needed. To give but one example, consider a CPU that has one
@@ -275,7 +283,7 @@ o Adaptive-ticks does not do anything unless there is only one
275 283
276 Better handling of these sorts of situations is future work. 284 Better handling of these sorts of situations is future work.
277 285
278o A reboot is required to reconfigure both adaptive idle and RCU 286* A reboot is required to reconfigure both adaptive idle and RCU
279 callback offloading. Runtime reconfiguration could be provided 287 callback offloading. Runtime reconfiguration could be provided
280 if needed, however, due to the complexity of reconfiguring RCU at 288 if needed, however, due to the complexity of reconfiguring RCU at
281 runtime, there would need to be an earthshakingly good reason. 289 runtime, there would need to be an earthshakingly good reason.
@@ -283,12 +291,12 @@ o A reboot is required to reconfigure both adaptive idle and RCU
283 simply offloading RCU callbacks from all CPUs and pinning them 291 simply offloading RCU callbacks from all CPUs and pinning them
284 where you want them whenever you want them pinned. 292 where you want them whenever you want them pinned.
285 293
286o Additional configuration is required to deal with other sources 294* Additional configuration is required to deal with other sources
287 of OS jitter, including interrupts and system-utility tasks 295 of OS jitter, including interrupts and system-utility tasks
288 and processes. This configuration normally involves binding 296 and processes. This configuration normally involves binding
289 interrupts and tasks to particular CPUs. 297 interrupts and tasks to particular CPUs.
290 298
291o Some sources of OS jitter can currently be eliminated only by 299* Some sources of OS jitter can currently be eliminated only by
292 constraining the workload. For example, the only way to eliminate 300 constraining the workload. For example, the only way to eliminate
293 OS jitter due to global TLB shootdowns is to avoid the unmapping 301 OS jitter due to global TLB shootdowns is to avoid the unmapping
294 operations (such as kernel module unload operations) that 302 operations (such as kernel module unload operations) that
@@ -299,17 +307,17 @@ o Some sources of OS jitter can currently be eliminated only by
299 helpful, especially when combined with the mlock() and mlockall() 307 helpful, especially when combined with the mlock() and mlockall()
300 system calls. 308 system calls.
301 309
302o Unless all CPUs are idle, at least one CPU must keep the 310* Unless all CPUs are idle, at least one CPU must keep the
303 scheduling-clock interrupt going in order to support accurate 311 scheduling-clock interrupt going in order to support accurate
304 timekeeping. 312 timekeeping.
305 313
306o If there might potentially be some adaptive-ticks CPUs, there 314* If there might potentially be some adaptive-ticks CPUs, there
307 will be at least one CPU keeping the scheduling-clock interrupt 315 will be at least one CPU keeping the scheduling-clock interrupt
308 going, even if all CPUs are otherwise idle. 316 going, even if all CPUs are otherwise idle.
309 317
310 Better handling of this situation is ongoing work. 318 Better handling of this situation is ongoing work.
311 319
312o Some process-handling operations still require the occasional 320* Some process-handling operations still require the occasional
313 scheduling-clock tick. These operations include calculating CPU 321 scheduling-clock tick. These operations include calculating CPU
314 load, maintaining sched average, computing CFS entity vruntime, 322 load, maintaining sched average, computing CFS entity vruntime,
315 computing avenrun, and carrying out load balancing. They are 323 computing avenrun, and carrying out load balancing. They are
diff --git a/Documentation/timers/timekeeping.txt b/Documentation/timers/timekeeping.rst
index 2d1732b0a868..f83e98852e2c 100644
--- a/Documentation/timers/timekeeping.txt
+++ b/Documentation/timers/timekeeping.rst
@@ -1,5 +1,6 @@
1===========================================================
1Clock sources, Clock events, sched_clock() and delay timers 2Clock sources, Clock events, sched_clock() and delay timers
2----------------------------------------------------------- 3===========================================================
3 4
4This document tries to briefly explain some basic kernel timekeeping 5This document tries to briefly explain some basic kernel timekeeping
5abstractions. It partly pertains to the drivers usually found in 6abstractions. It partly pertains to the drivers usually found in
diff --git a/Documentation/timers/timers-howto.txt b/Documentation/timers/timers-howto.rst
index 038f8c77a076..7e3167bec2b1 100644
--- a/Documentation/timers/timers-howto.txt
+++ b/Documentation/timers/timers-howto.rst
@@ -1,5 +1,6 @@
1===================================================================
1delays - Information on the various kernel delay / sleep mechanisms 2delays - Information on the various kernel delay / sleep mechanisms
2------------------------------------------------------------------- 3===================================================================
3 4
4This document seeks to answer the common question: "What is the 5This document seeks to answer the common question: "What is the
5RightWay (TM) to insert a delay?" 6RightWay (TM) to insert a delay?"
@@ -17,7 +18,7 @@ code in an atomic context?" This should be followed closely by "Does
17it really need to delay in atomic context?" If so... 18it really need to delay in atomic context?" If so...
18 19
19ATOMIC CONTEXT: 20ATOMIC CONTEXT:
20 You must use the *delay family of functions. These 21 You must use the `*delay` family of functions. These
21 functions use the jiffie estimation of clock speed 22 functions use the jiffie estimation of clock speed
22 and will busy wait for enough loop cycles to achieve 23 and will busy wait for enough loop cycles to achieve
23 the desired delay: 24 the desired delay:
@@ -35,21 +36,26 @@ ATOMIC CONTEXT:
35 be refactored to allow for the use of msleep. 36 be refactored to allow for the use of msleep.
36 37
37NON-ATOMIC CONTEXT: 38NON-ATOMIC CONTEXT:
38 You should use the *sleep[_range] family of functions. 39 You should use the `*sleep[_range]` family of functions.
39 There are a few more options here, while any of them may 40 There are a few more options here, while any of them may
40 work correctly, using the "right" sleep function will 41 work correctly, using the "right" sleep function will
41 help the scheduler, power management, and just make your 42 help the scheduler, power management, and just make your
42 driver better :) 43 driver better :)
43 44
44 -- Backed by busy-wait loop: 45 -- Backed by busy-wait loop:
46
45 udelay(unsigned long usecs) 47 udelay(unsigned long usecs)
48
46 -- Backed by hrtimers: 49 -- Backed by hrtimers:
50
47 usleep_range(unsigned long min, unsigned long max) 51 usleep_range(unsigned long min, unsigned long max)
52
48 -- Backed by jiffies / legacy_timers 53 -- Backed by jiffies / legacy_timers
54
49 msleep(unsigned long msecs) 55 msleep(unsigned long msecs)
50 msleep_interruptible(unsigned long msecs) 56 msleep_interruptible(unsigned long msecs)
51 57
52 Unlike the *delay family, the underlying mechanism 58 Unlike the `*delay` family, the underlying mechanism
53 driving each of these calls varies, thus there are 59 driving each of these calls varies, thus there are
54 quirks you should be aware of. 60 quirks you should be aware of.
55 61
@@ -70,6 +76,7 @@ NON-ATOMIC CONTEXT:
70 - Why not msleep for (1ms - 20ms)? 76 - Why not msleep for (1ms - 20ms)?
71 Explained originally here: 77 Explained originally here:
72 http://lkml.org/lkml/2007/8/3/250 78 http://lkml.org/lkml/2007/8/3/250
79
73 msleep(1~20) may not do what the caller intends, and 80 msleep(1~20) may not do what the caller intends, and
74 will often sleep longer (~20 ms actual sleep for any 81 will often sleep longer (~20 ms actual sleep for any
75 value given in the 1~20ms range). In many cases this 82 value given in the 1~20ms range). In many cases this
diff --git a/Documentation/trace/coresight.txt b/Documentation/trace/coresight.txt
index efbc832146e7..b027d61b27a6 100644
--- a/Documentation/trace/coresight.txt
+++ b/Documentation/trace/coresight.txt
@@ -188,6 +188,49 @@ specific to that component only. "Implementation defined" customisations are
188expected to be accessed and controlled using those entries. 188expected to be accessed and controlled using those entries.
189 189
190 190
191Device Naming scheme
192------------------------
193The devices that appear on the "coresight" bus were named the same as their
194parent devices, i.e, the real devices that appears on AMBA bus or the platform bus.
195Thus the names were based on the Linux Open Firmware layer naming convention,
196which follows the base physical address of the device followed by the device
197type. e.g:
198
199root:~# ls /sys/bus/coresight/devices/
200 20010000.etf 20040000.funnel 20100000.stm 22040000.etm
201 22140000.etm 230c0000.funnel 23240000.etm 20030000.tpiu
202 20070000.etr 20120000.replicator 220c0000.funnel
203 23040000.etm 23140000.etm 23340000.etm
204
205However, with the introduction of ACPI support, the names of the real
206devices are a bit cryptic and non-obvious. Thus, a new naming scheme was
207introduced to use more generic names based on the type of the device. The
208following rules apply:
209
210 1) Devices that are bound to CPUs, are named based on the CPU logical
211 number.
212
213 e.g, ETM bound to CPU0 is named "etm0"
214
215 2) All other devices follow a pattern, "<device_type_prefix>N", where :
216
217 <device_type_prefix> - A prefix specific to the type of the device
218 N - a sequential number assigned based on the order
219 of probing.
220
221 e.g, tmc_etf0, tmc_etr0, funnel0, funnel1
222
223Thus, with the new scheme the devices could appear as :
224
225root:~# ls /sys/bus/coresight/devices/
226 etm0 etm1 etm2 etm3 etm4 etm5 funnel0
227 funnel1 funnel2 replicator0 stm0 tmc_etf0 tmc_etr0 tpiu0
228
229Some of the examples below might refer to old naming scheme and some
230to the newer scheme, to give a confirmation that what you see on your
231system is not unexpected. One must use the "names" as they appear on
232the system under specified locations.
233
191How to use the tracer modules 234How to use the tracer modules
192----------------------------- 235-----------------------------
193 236
@@ -326,16 +369,25 @@ amount of processor cores), the "cs_etm" PMU will be listed only once.
326A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is 369A Coresight PMU works the same way as any other PMU, i.e the name of the PMU is
327listed along with configuration options within forward slashes '/'. Since a 370listed along with configuration options within forward slashes '/'. Since a
328Coresight system will typically have more than one sink, the name of the sink to 371Coresight system will typically have more than one sink, the name of the sink to
329work with needs to be specified as an event option. Names for sink to choose 372work with needs to be specified as an event option.
330from are listed in sysFS under ($SYSFS)/bus/coresight/devices: 373On newer kernels the available sinks are listed in sysFS under:
374($SYSFS)/bus/event_source/devices/cs_etm/sinks/
375
376 root@localhost:/sys/bus/event_source/devices/cs_etm/sinks# ls
377 tmc_etf0 tmc_etr0 tpiu0
378
379On older kernels, this may need to be found from the list of coresight devices,
380available under ($SYSFS)/bus/coresight/devices/:
381
382 root:~# ls /sys/bus/coresight/devices/
383 etm0 etm1 etm2 etm3 etm4 etm5 funnel0
384 funnel1 funnel2 replicator0 stm0 tmc_etf0 tmc_etr0 tpiu0
331 385
332 root@linaro-nano:~# ls /sys/bus/coresight/devices/ 386 root@linaro-nano:~# perf record -e cs_etm/@tmc_etr0/u --per-thread program
333 20010000.etf 20040000.funnel 20100000.stm 22040000.etm
334 22140000.etm 230c0000.funnel 23240000.etm 20030000.tpiu
335 20070000.etr 20120000.replicator 220c0000.funnel
336 23040000.etm 23140000.etm 23340000.etm
337 387
338 root@linaro-nano:~# perf record -e cs_etm/@20070000.etr/u --per-thread program 388As mentioned above in section "Device Naming scheme", the names of the devices could
389look different from what is used in the example above. One must use the device names
390as it appears under the sysFS.
339 391
340The syntax within the forward slashes '/' is important. The '@' character 392The syntax within the forward slashes '/' is important. The '@' character
341tells the parser that a sink is about to be specified and that this is the sink 393tells the parser that a sink is about to be specified and that this is the sink
@@ -352,7 +404,7 @@ perf can be used to record and analyze trace of programs.
352Execution can be recorded using 'perf record' with the cs_etm event, 404Execution can be recorded using 'perf record' with the cs_etm event,
353specifying the name of the sink to record to, e.g: 405specifying the name of the sink to record to, e.g:
354 406
355 perf record -e cs_etm/@20070000.etr/u --per-thread 407 perf record -e cs_etm/@tmc_etr0/u --per-thread
356 408
357The 'perf report' and 'perf script' commands can be used to analyze execution, 409The 'perf report' and 'perf script' commands can be used to analyze execution,
358synthesizing instruction and branch events from the instruction trace. 410synthesizing instruction and branch events from the instruction trace.
@@ -381,7 +433,7 @@ sort example is from the AutoFDO tutorial (https://gcc.gnu.org/wiki/AutoFDO/Tuto
381 Bubble sorting array of 30000 elements 433 Bubble sorting array of 30000 elements
382 5910 ms 434 5910 ms
383 435
384 $ perf record -e cs_etm/@20070000.etr/u --per-thread taskset -c 2 ./sort 436 $ perf record -e cs_etm/@tmc_etr0/u --per-thread taskset -c 2 ./sort
385 Bubble sorting array of 30000 elements 437 Bubble sorting array of 30000 elements
386 12543 ms 438 12543 ms
387 [ perf record: Woken up 35 times to write data ] 439 [ perf record: Woken up 35 times to write data ]
@@ -405,7 +457,7 @@ than the program flow through the code.
405As with any other CoreSight component, specifics about the STM tracer can be 457As with any other CoreSight component, specifics about the STM tracer can be
406found in sysfs with more information on each entry being found in [1]: 458found in sysfs with more information on each entry being found in [1]:
407 459
408root@genericarmv8:~# ls /sys/bus/coresight/devices/20100000.stm 460root@genericarmv8:~# ls /sys/bus/coresight/devices/stm0
409enable_source hwevent_select port_enable subsystem uevent 461enable_source hwevent_select port_enable subsystem uevent
410hwevent_enable mgmt port_select traceid 462hwevent_enable mgmt port_select traceid
411root@genericarmv8:~# 463root@genericarmv8:~#
@@ -413,14 +465,14 @@ root@genericarmv8:~#
413Like any other source a sink needs to be identified and the STM enabled before 465Like any other source a sink needs to be identified and the STM enabled before
414being used: 466being used:
415 467
416root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20010000.etf/enable_sink 468root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/tmc_etf0/enable_sink
417root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/20100000.stm/enable_source 469root@genericarmv8:~# echo 1 > /sys/bus/coresight/devices/stm0/enable_source
418 470
419From there user space applications can request and use channels using the devfs 471From there user space applications can request and use channels using the devfs
420interface provided for that purpose by the generic STM API: 472interface provided for that purpose by the generic STM API:
421 473
422root@genericarmv8:~# ls -l /dev/20100000.stm 474root@genericarmv8:~# ls -l /dev/stm0
423crw------- 1 root root 10, 61 Jan 3 18:11 /dev/20100000.stm 475crw------- 1 root root 10, 61 Jan 3 18:11 /dev/stm0
424root@genericarmv8:~# 476root@genericarmv8:~#
425 477
426Details on how to use the generic STM API can be found here [2]. 478Details on how to use the generic STM API can be found here [2].
diff --git a/Documentation/trace/histogram.rst b/Documentation/trace/histogram.rst
index fb621a1c2638..8408670d0328 100644
--- a/Documentation/trace/histogram.rst
+++ b/Documentation/trace/histogram.rst
@@ -1010,7 +1010,7 @@ Extended error information
1010 1010
1011 For example, suppose we wanted to take a look at the relative 1011 For example, suppose we wanted to take a look at the relative
1012 weights in terms of skb length for each callpath that leads to a 1012 weights in terms of skb length for each callpath that leads to a
1013 netif_receieve_skb event when downloading a decent-sized file using 1013 netif_receive_skb event when downloading a decent-sized file using
1014 wget. 1014 wget.
1015 1015
1016 First we set up an initially paused stacktrace trigger on the 1016 First we set up an initially paused stacktrace trigger on the
@@ -1843,7 +1843,7 @@ practice, not every handler.action combination is currently supported;
1843if a given handler.action combination isn't supported, the hist 1843if a given handler.action combination isn't supported, the hist
1844trigger will fail with -EINVAL; 1844trigger will fail with -EINVAL;
1845 1845
1846The default 'handler.action' if none is explicity specified is as it 1846The default 'handler.action' if none is explicitly specified is as it
1847always has been, to simply update the set of values associated with an 1847always has been, to simply update the set of values associated with an
1848entry. Some applications, however, may want to perform additional 1848entry. Some applications, however, may want to perform additional
1849actions at that point, such as generate another event, or compare and 1849actions at that point, such as generate another event, or compare and
@@ -2088,7 +2088,7 @@ The following commonly-used handler.action pairs are available:
2088 and the saved values corresponding to the max are displayed 2088 and the saved values corresponding to the max are displayed
2089 following the rest of the fields. 2089 following the rest of the fields.
2090 2090
2091 If a snaphot was taken, there is also a message indicating that, 2091 If a snapshot was taken, there is also a message indicating that,
2092 along with the value and event that triggered the global maximum: 2092 along with the value and event that triggered the global maximum:
2093 2093
2094 # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist 2094 # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist
@@ -2176,7 +2176,7 @@ The following commonly-used handler.action pairs are available:
2176 hist trigger entry. 2176 hist trigger entry.
2177 2177
2178 Note that in this case the changed value is a global variable 2178 Note that in this case the changed value is a global variable
2179 associated withe current trace instance. The key of the specific 2179 associated with current trace instance. The key of the specific
2180 trace event that caused the value to change and the global value 2180 trace event that caused the value to change and the global value
2181 itself are displayed, along with a message stating that a snapshot 2181 itself are displayed, along with a message stating that a snapshot
2182 has been taken and where to find it. The user can use the key 2182 has been taken and where to find it. The user can use the key
@@ -2203,7 +2203,7 @@ The following commonly-used handler.action pairs are available:
2203 and the saved values corresponding to that value are displayed 2203 and the saved values corresponding to that value are displayed
2204 following the rest of the fields. 2204 following the rest of the fields.
2205 2205
2206 If a snaphot was taken, there is also a message indicating that, 2206 If a snapshot was taken, there is also a message indicating that,
2207 along with the value and event that triggered the snapshot:: 2207 along with the value and event that triggered the snapshot::
2208 2208
2209 # cat /sys/kernel/debug/tracing/events/tcp/tcp_probe/hist 2209 # cat /sys/kernel/debug/tracing/events/tcp/tcp_probe/hist
diff --git a/Documentation/trace/kprobetrace.rst b/Documentation/trace/kprobetrace.rst
index 235ce2ab131a..7d2b0178d3f3 100644
--- a/Documentation/trace/kprobetrace.rst
+++ b/Documentation/trace/kprobetrace.rst
@@ -189,6 +189,13 @@ events, you need to enable it.
189 echo 1 > /sys/kernel/debug/tracing/events/kprobes/myprobe/enable 189 echo 1 > /sys/kernel/debug/tracing/events/kprobes/myprobe/enable
190 echo 1 > /sys/kernel/debug/tracing/events/kprobes/myretprobe/enable 190 echo 1 > /sys/kernel/debug/tracing/events/kprobes/myretprobe/enable
191 191
192Use the following command to start tracing in an interval.
193::
194
195 # echo 1 > tracing_on
196 Open something...
197 # echo 0 > tracing_on
198
192And you can see the traced information via /sys/kernel/debug/tracing/trace. 199And you can see the traced information via /sys/kernel/debug/tracing/trace.
193:: 200::
194 201
diff --git a/Documentation/trace/uprobetracer.rst b/Documentation/trace/uprobetracer.rst
index 4346e23e3ae7..0b21305fabdc 100644
--- a/Documentation/trace/uprobetracer.rst
+++ b/Documentation/trace/uprobetracer.rst
@@ -152,10 +152,15 @@ events, you need to enable it by::
152 152
153 # echo 1 > events/uprobes/enable 153 # echo 1 > events/uprobes/enable
154 154
155Lets disable the event after sleeping for some time. 155Lets start tracing, sleep for some time and stop tracing.
156:: 156::
157 157
158 # echo 1 > tracing_on
158 # sleep 20 159 # sleep 20
160 # echo 0 > tracing_on
161
162Also, you can disable the event by::
163
159 # echo 0 > events/uprobes/enable 164 # echo 0 > events/uprobes/enable
160 165
161And you can see the traced information via /sys/kernel/debug/tracing/trace. 166And you can see the traced information via /sys/kernel/debug/tracing/trace.
diff --git a/Documentation/translations/it_IT/admin-guide/kernel-parameters.rst b/Documentation/translations/it_IT/admin-guide/kernel-parameters.rst
new file mode 100644
index 000000000000..0e36d82a92be
--- /dev/null
+++ b/Documentation/translations/it_IT/admin-guide/kernel-parameters.rst
@@ -0,0 +1,12 @@
1.. include:: ../disclaimer-ita.rst
2
3:Original: :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>`
4
5.. _it_kernelparameters:
6
7I parametri da linea di comando del kernel
8==========================================
9
10.. warning::
11
12 TODO ancora da tradurre
diff --git a/Documentation/translations/it_IT/doc-guide/sphinx.rst b/Documentation/translations/it_IT/doc-guide/sphinx.rst
index 793b5cc33403..1739cba8863e 100644
--- a/Documentation/translations/it_IT/doc-guide/sphinx.rst
+++ b/Documentation/translations/it_IT/doc-guide/sphinx.rst
@@ -35,8 +35,7 @@ Installazione Sphinx
35==================== 35====================
36 36
37I marcatori ReST utilizzati nei file in Documentation/ sono pensati per essere 37I marcatori ReST utilizzati nei file in Documentation/ sono pensati per essere
38processati da ``Sphinx`` nella versione 1.3 o superiore. Se desiderate produrre 38processati da ``Sphinx`` nella versione 1.3 o superiore.
39un documento PDF è raccomandato l'utilizzo di una versione superiore alle 1.4.6.
40 39
41Esiste uno script che verifica i requisiti Sphinx. Per ulteriori dettagli 40Esiste uno script che verifica i requisiti Sphinx. Per ulteriori dettagli
42consultate :ref:`it_sphinx-pre-install`. 41consultate :ref:`it_sphinx-pre-install`.
@@ -68,13 +67,13 @@ pacchettizzato dalla vostra distribuzione.
68 utilizzando LaTeX. Per una corretta interpretazione, è necessario aver 67 utilizzando LaTeX. Per una corretta interpretazione, è necessario aver
69 installato texlive con i pacchetti amdfonts e amsmath. 68 installato texlive con i pacchetti amdfonts e amsmath.
70 69
71Riassumendo, se volete installare la versione 1.4.9 di Sphinx dovete eseguire:: 70Riassumendo, se volete installare la versione 1.7.9 di Sphinx dovete eseguire::
72 71
73 $ virtualenv sphinx_1.4 72 $ virtualenv sphinx_1.7.9
74 $ . sphinx_1.4/bin/activate 73 $ . sphinx_1.7.9/bin/activate
75 (sphinx_1.4) $ pip install -r Documentation/sphinx/requirements.txt 74 (sphinx_1.7.9) $ pip install -r Documentation/sphinx/requirements.txt
76 75
77Dopo aver eseguito ``. sphinx_1.4/bin/activate``, il prompt cambierà per 76Dopo aver eseguito ``. sphinx_1.7.9/bin/activate``, il prompt cambierà per
78indicare che state usando il nuovo ambiente. Se aprite un nuova sessione, 77indicare che state usando il nuovo ambiente. Se aprite un nuova sessione,
79prima di generare la documentazione, dovrete rieseguire questo comando per 78prima di generare la documentazione, dovrete rieseguire questo comando per
80rientrare nell'ambiente virtuale. 79rientrare nell'ambiente virtuale.
@@ -120,8 +119,8 @@ l'installazione::
120 You should run: 119 You should run:
121 120
122 sudo dnf install -y texlive-luatex85 121 sudo dnf install -y texlive-luatex85
123 /usr/bin/virtualenv sphinx_1.4 122 /usr/bin/virtualenv sphinx_1.7.9
124 . sphinx_1.4/bin/activate 123 . sphinx_1.7.9/bin/activate
125 pip install -r Documentation/sphinx/requirements.txt 124 pip install -r Documentation/sphinx/requirements.txt
126 125
127 Can't build as 1 mandatory dependency is missing at ./scripts/sphinx-pre-install line 468. 126 Can't build as 1 mandatory dependency is missing at ./scripts/sphinx-pre-install line 468.
diff --git a/Documentation/translations/it_IT/kernel-hacking/hacking.rst b/Documentation/translations/it_IT/kernel-hacking/hacking.rst
index 7178e517af0a..24c592852bf1 100644
--- a/Documentation/translations/it_IT/kernel-hacking/hacking.rst
+++ b/Documentation/translations/it_IT/kernel-hacking/hacking.rst
@@ -755,7 +755,7 @@ anche per avere patch pulite, c'è del lavoro amministrativo da fare:
755- Solitamente vorrete un'opzione di configurazione per la vostra modifica 755- Solitamente vorrete un'opzione di configurazione per la vostra modifica
756 al kernel. Modificate ``Kconfig`` nella cartella giusta. Il linguaggio 756 al kernel. Modificate ``Kconfig`` nella cartella giusta. Il linguaggio
757 Config è facile con copia ed incolla, e c'è una completa documentazione 757 Config è facile con copia ed incolla, e c'è una completa documentazione
758 nel file ``Documentation/kbuild/kconfig-language.txt``. 758 nel file ``Documentation/kbuild/kconfig-language.rst``.
759 759
760 Nella descrizione della vostra opzione, assicuratevi di parlare sia agli 760 Nella descrizione della vostra opzione, assicuratevi di parlare sia agli
761 utenti esperti sia agli utente che non sanno nulla del vostro lavoro. 761 utenti esperti sia agli utente che non sanno nulla del vostro lavoro.
@@ -767,7 +767,7 @@ anche per avere patch pulite, c'è del lavoro amministrativo da fare:
767- Modificate il file ``Makefile``: le variabili CONFIG sono esportate qui, 767- Modificate il file ``Makefile``: le variabili CONFIG sono esportate qui,
768 quindi potete solitamente aggiungere una riga come la seguete 768 quindi potete solitamente aggiungere una riga come la seguete
769 "obj-$(CONFIG_xxx) += xxx.o". La sintassi è documentata nel file 769 "obj-$(CONFIG_xxx) += xxx.o". La sintassi è documentata nel file
770 ``Documentation/kbuild/makefiles.txt``. 770 ``Documentation/kbuild/makefiles.rst``.
771 771
772- Aggiungete voi stessi in ``CREDITS`` se avete fatto qualcosa di notevole, 772- Aggiungete voi stessi in ``CREDITS`` se avete fatto qualcosa di notevole,
773 solitamente qualcosa che supera il singolo file (comunque il vostro nome 773 solitamente qualcosa che supera il singolo file (comunque il vostro nome
diff --git a/Documentation/translations/it_IT/kernel-hacking/locking.rst b/Documentation/translations/it_IT/kernel-hacking/locking.rst
index 0ef31666663b..5fd8a1abd2be 100644
--- a/Documentation/translations/it_IT/kernel-hacking/locking.rst
+++ b/Documentation/translations/it_IT/kernel-hacking/locking.rst
@@ -468,7 +468,7 @@ e tutti gli oggetti che contiene. Ecco il codice::
468 if ((obj = kmalloc(sizeof(*obj), GFP_KERNEL)) == NULL) 468 if ((obj = kmalloc(sizeof(*obj), GFP_KERNEL)) == NULL)
469 return -ENOMEM; 469 return -ENOMEM;
470 470
471 strlcpy(obj->name, name, sizeof(obj->name)); 471 strscpy(obj->name, name, sizeof(obj->name));
472 obj->id = id; 472 obj->id = id;
473 obj->popularity = 0; 473 obj->popularity = 0;
474 474
@@ -678,7 +678,7 @@ Ecco il codice::
678 } 678 }
679 679
680 @@ -63,6 +94,7 @@ 680 @@ -63,6 +94,7 @@
681 strlcpy(obj->name, name, sizeof(obj->name)); 681 strscpy(obj->name, name, sizeof(obj->name));
682 obj->id = id; 682 obj->id = id;
683 obj->popularity = 0; 683 obj->popularity = 0;
684 + obj->refcnt = 1; /* The cache holds a reference */ 684 + obj->refcnt = 1; /* The cache holds a reference */
@@ -792,7 +792,7 @@ contatore stesso.
792 } 792 }
793 793
794 @@ -94,7 +76,7 @@ 794 @@ -94,7 +76,7 @@
795 strlcpy(obj->name, name, sizeof(obj->name)); 795 strscpy(obj->name, name, sizeof(obj->name));
796 obj->id = id; 796 obj->id = id;
797 obj->popularity = 0; 797 obj->popularity = 0;
798 - obj->refcnt = 1; /* The cache holds a reference */ 798 - obj->refcnt = 1; /* The cache holds a reference */
diff --git a/Documentation/translations/it_IT/process/4.Coding.rst b/Documentation/translations/it_IT/process/4.Coding.rst
index c05b89e616dd..a5e36aa60448 100644
--- a/Documentation/translations/it_IT/process/4.Coding.rst
+++ b/Documentation/translations/it_IT/process/4.Coding.rst
@@ -314,7 +314,7 @@ di allocazione di memoria sarà destinata al fallimento; questi fallimenti
314possono essere ridotti ad uno specifico pezzo di codice. Procedere con 314possono essere ridotti ad uno specifico pezzo di codice. Procedere con
315l'inserimento dei fallimenti attivo permette al programmatore di verificare 315l'inserimento dei fallimenti attivo permette al programmatore di verificare
316come il codice risponde quando le cose vanno male. Consultate: 316come il codice risponde quando le cose vanno male. Consultate:
317Documentation/fault-injection/fault-injection.txt per avere maggiori 317Documentation/fault-injection/fault-injection.rst per avere maggiori
318informazioni su come utilizzare questo strumento. 318informazioni su come utilizzare questo strumento.
319 319
320Altre tipologie di errori possono essere riscontrati con lo strumento di 320Altre tipologie di errori possono essere riscontrati con lo strumento di
diff --git a/Documentation/translations/it_IT/process/adding-syscalls.rst b/Documentation/translations/it_IT/process/adding-syscalls.rst
index e0a64b0688a7..c3a3439595a6 100644
--- a/Documentation/translations/it_IT/process/adding-syscalls.rst
+++ b/Documentation/translations/it_IT/process/adding-syscalls.rst
@@ -39,7 +39,7 @@ vostra interfaccia.
39 un qualche modo opaca. 39 un qualche modo opaca.
40 40
41 - Se dovete esporre solo delle informazioni sul sistema, un nuovo nodo in 41 - Se dovete esporre solo delle informazioni sul sistema, un nuovo nodo in
42 sysfs (vedere ``Documentation/translations/it_IT/filesystems/sysfs.txt``) o 42 sysfs (vedere ``Documentation/filesystems/sysfs.txt``) o
43 in procfs potrebbe essere sufficiente. Tuttavia, l'accesso a questi 43 in procfs potrebbe essere sufficiente. Tuttavia, l'accesso a questi
44 meccanismi richiede che il filesystem sia montato, il che potrebbe non 44 meccanismi richiede che il filesystem sia montato, il che potrebbe non
45 essere sempre vero (per esempio, in ambienti come namespace/sandbox/chroot). 45 essere sempre vero (per esempio, in ambienti come namespace/sandbox/chroot).
diff --git a/Documentation/translations/it_IT/process/coding-style.rst b/Documentation/translations/it_IT/process/coding-style.rst
index 5ef534c95e69..8995d2d19f20 100644
--- a/Documentation/translations/it_IT/process/coding-style.rst
+++ b/Documentation/translations/it_IT/process/coding-style.rst
@@ -696,7 +696,7 @@ nella stringa di titolo::
696 ... 696 ...
697 697
698Per la documentazione completa sui file di configurazione, consultate 698Per la documentazione completa sui file di configurazione, consultate
699il documento Documentation/translations/it_IT/kbuild/kconfig-language.txt 699il documento Documentation/kbuild/kconfig-language.rst
700 700
701 701
70211) Strutture dati 70211) Strutture dati
diff --git a/Documentation/translations/it_IT/process/howto.rst b/Documentation/translations/it_IT/process/howto.rst
index 9903ac7c566b..44e6077730e8 100644
--- a/Documentation/translations/it_IT/process/howto.rst
+++ b/Documentation/translations/it_IT/process/howto.rst
@@ -131,7 +131,7 @@ Di seguito una lista di file che sono presenti nei sorgente del kernel e che
131 "Linux kernel patch submission format" 131 "Linux kernel patch submission format"
132 http://linux.yyz.us/patch-format.html 132 http://linux.yyz.us/patch-format.html
133 133
134 :ref:`Documentation/process/translations/it_IT/stable-api-nonsense.rst <it_stable_api_nonsense>` 134 :ref:`Documentation/translations/it_IT/process/stable-api-nonsense.rst <it_stable_api_nonsense>`
135 135
136 Questo file descrive la motivazioni sottostanti la conscia decisione di 136 Questo file descrive la motivazioni sottostanti la conscia decisione di
137 non avere un API stabile all'interno del kernel, incluso cose come: 137 non avere un API stabile all'interno del kernel, incluso cose come:
diff --git a/Documentation/translations/it_IT/process/license-rules.rst b/Documentation/translations/it_IT/process/license-rules.rst
index f058e06996dc..4cd87a3a7bf9 100644
--- a/Documentation/translations/it_IT/process/license-rules.rst
+++ b/Documentation/translations/it_IT/process/license-rules.rst
@@ -303,7 +303,7 @@ essere categorizzate in:
303 LICENSES/dual 303 LICENSES/dual
304 304
305 I file in questa cartella contengono il testo completo della rispettiva 305 I file in questa cartella contengono il testo completo della rispettiva
306 licenza e i suoi `Metatags`_. I nomi dei file sono identici agli 306 licenza e i suoi `Metatag`_. I nomi dei file sono identici agli
307 identificatori di licenza SPDX che dovrebbero essere usati nei file 307 identificatori di licenza SPDX che dovrebbero essere usati nei file
308 sorgenti. 308 sorgenti.
309 309
@@ -326,19 +326,19 @@ essere categorizzate in:
326 326
327 Esempio del formato del file:: 327 Esempio del formato del file::
328 328
329 Valid-License-Identifier: MPL-1.1 329 Valid-License-Identifier: MPL-1.1
330 SPDX-URL: https://spdx.org/licenses/MPL-1.1.html 330 SPDX-URL: https://spdx.org/licenses/MPL-1.1.html
331 Usage-Guide: 331 Usage-Guide:
332 Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for 332 Do NOT use. The MPL-1.1 is not GPL2 compatible. It may only be used for
333 dual-licensed files where the other license is GPL2 compatible. 333 dual-licensed files where the other license is GPL2 compatible.
334 If you end up using this it MUST be used together with a GPL2 compatible 334 If you end up using this it MUST be used together with a GPL2 compatible
335 license using "OR". 335 license using "OR".
336 To use the Mozilla Public License version 1.1 put the following SPDX 336 To use the Mozilla Public License version 1.1 put the following SPDX
337 tag/value pair into a comment according to the placement guidelines in 337 tag/value pair into a comment according to the placement guidelines in
338 the licensing rules documentation: 338 the licensing rules documentation:
339 SPDX-License-Identifier: MPL-1.1 339 SPDX-License-Identifier: MPL-1.1
340 License-Text: 340 License-Text:
341 Full license text 341 Full license text
342 342
343| 343|
344 344
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 5281d53e57ee..ed1121d0ba84 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -1,6 +1,6 @@
1.. include:: ../disclaimer-ita.rst 1.. include:: ../disclaimer-ita.rst
2 2
3:Original: :ref:`Documentation/process/magic-numbers.rst <magicnumbers>` 3:Original: :ref:`Documentation/process/magic-number.rst <magicnumbers>`
4:Translator: Federico Vaga <federico.vaga@vaga.pv.it> 4:Translator: Federico Vaga <federico.vaga@vaga.pv.it>
5 5
6.. _it_magicnumbers: 6.. _it_magicnumbers:
diff --git a/Documentation/translations/it_IT/process/stable-kernel-rules.rst b/Documentation/translations/it_IT/process/stable-kernel-rules.rst
index 48e88e5ad2c5..4f206cee31a7 100644
--- a/Documentation/translations/it_IT/process/stable-kernel-rules.rst
+++ b/Documentation/translations/it_IT/process/stable-kernel-rules.rst
@@ -33,7 +33,7 @@ Regole sul tipo di patch che vengono o non vengono accettate nei sorgenti
33 - Non deve includere alcuna correzione "banale" (correzioni grammaticali, 33 - Non deve includere alcuna correzione "banale" (correzioni grammaticali,
34 pulizia dagli spazi bianchi, eccetera). 34 pulizia dagli spazi bianchi, eccetera).
35 - Deve rispettare le regole scritte in 35 - Deve rispettare le regole scritte in
36 :ref:`Documentation/translation/it_IT/process/submitting-patches.rst <it_submittingpatches>` 36 :ref:`Documentation/translations/it_IT/process/submitting-patches.rst <it_submittingpatches>`
37 - Questa patch o una equivalente deve esistere già nei sorgenti principali di 37 - Questa patch o una equivalente deve esistere già nei sorgenti principali di
38 Linux 38 Linux
39 39
@@ -43,7 +43,7 @@ Procedura per sottomettere patch per i sorgenti -stable
43 43
44 - Se la patch contiene modifiche a dei file nelle cartelle net/ o drivers/net, 44 - Se la patch contiene modifiche a dei file nelle cartelle net/ o drivers/net,
45 allora seguite le linee guida descritte in 45 allora seguite le linee guida descritte in
46 :ref:`Documentation/translation/it_IT/networking/netdev-FAQ.rst <it_netdev-FAQ>`; 46 :ref:`Documentation/translations/it_IT/networking/netdev-FAQ.rst <it_netdev-FAQ>`;
47 ma solo dopo aver verificato al seguente indirizzo che la patch non sia 47 ma solo dopo aver verificato al seguente indirizzo che la patch non sia
48 già in coda: 48 già in coda:
49 https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=*&q=&archive= 49 https://patchwork.ozlabs.org/bundle/davem/stable/?series=&submitter=&state=*&q=&archive=
diff --git a/Documentation/translations/it_IT/process/submit-checklist.rst b/Documentation/translations/it_IT/process/submit-checklist.rst
index 70e65a7b3620..ea74cae958d7 100644
--- a/Documentation/translations/it_IT/process/submit-checklist.rst
+++ b/Documentation/translations/it_IT/process/submit-checklist.rst
@@ -43,7 +43,7 @@ sottomissione delle patch, in particolare
43 43
446) Le opzioni ``CONFIG``, nuove o modificate, non scombussolano il menu 446) Le opzioni ``CONFIG``, nuove o modificate, non scombussolano il menu
45 di configurazione e sono preimpostate come disabilitate a meno che non 45 di configurazione e sono preimpostate come disabilitate a meno che non
46 soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.txt`` 46 soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.rst``
47 alla punto "Voci di menu: valori predefiniti". 47 alla punto "Voci di menu: valori predefiniti".
48 48
497) Tutte le nuove opzioni ``Kconfig`` hanno un messaggio di aiuto. 497) Tutte le nuove opzioni ``Kconfig`` hanno un messaggio di aiuto.
diff --git a/Documentation/translations/ko_KR/memory-barriers.txt b/Documentation/translations/ko_KR/memory-barriers.txt
index 5f3c74dcad43..a33c2a536542 100644
--- a/Documentation/translations/ko_KR/memory-barriers.txt
+++ b/Documentation/translations/ko_KR/memory-barriers.txt
@@ -569,7 +569,7 @@ ACQUIRE 는 해당 오í¼ë ˆì´ì…˜ì˜ 로드 부분ì—ë§Œ ì ìš©ë˜ê³  RELEASE ë
569 569
570 [*] 버스 ë§ˆìŠ¤í„°ë§ DMA 와 ì¼ê´€ì„±ì— 대해서는 다ìŒì„ 참고하시기 ë°”ëžë‹ˆë‹¤: 570 [*] 버스 ë§ˆìŠ¤í„°ë§ DMA 와 ì¼ê´€ì„±ì— 대해서는 다ìŒì„ 참고하시기 ë°”ëžë‹ˆë‹¤:
571 571
572 Documentation/PCI/pci.txt 572 Documentation/PCI/pci.rst
573 Documentation/DMA-API-HOWTO.txt 573 Documentation/DMA-API-HOWTO.txt
574 Documentation/DMA-API.txt 574 Documentation/DMA-API.txt
575 575
diff --git a/Documentation/translations/zh_CN/arm64/booting.txt b/Documentation/translations/zh_CN/arm64/booting.txt
index c1dd968c5ee9..3bfbf66e5a5e 100644
--- a/Documentation/translations/zh_CN/arm64/booting.txt
+++ b/Documentation/translations/zh_CN/arm64/booting.txt
@@ -1,4 +1,4 @@
1Chinese translated version of Documentation/arm64/booting.txt 1Chinese translated version of Documentation/arm64/booting.rst
2 2
3If you have any comment or update to the content, please contact the 3If you have any comment or update to the content, please contact the
4original document maintainer directly. However, if you have a problem 4original document maintainer directly. However, if you have a problem
@@ -10,7 +10,7 @@ M: Will Deacon <will.deacon@arm.com>
10zh_CN: Fu Wei <wefu@redhat.com> 10zh_CN: Fu Wei <wefu@redhat.com>
11C: 55f058e7574c3615dea4615573a19bdb258696c6 11C: 55f058e7574c3615dea4615573a19bdb258696c6
12--------------------------------------------------------------------- 12---------------------------------------------------------------------
13Documentation/arm64/booting.txt 的中文翻译 13Documentation/arm64/booting.rst 的中文翻译
14 14
15如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文 15如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文
16äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻 16äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻
diff --git a/Documentation/translations/zh_CN/arm64/legacy_instructions.txt b/Documentation/translations/zh_CN/arm64/legacy_instructions.txt
index 68362a1ab717..e295cf75f606 100644
--- a/Documentation/translations/zh_CN/arm64/legacy_instructions.txt
+++ b/Documentation/translations/zh_CN/arm64/legacy_instructions.txt
@@ -1,4 +1,4 @@
1Chinese translated version of Documentation/arm64/legacy_instructions.txt 1Chinese translated version of Documentation/arm64/legacy_instructions.rst
2 2
3If you have any comment or update to the content, please contact the 3If you have any comment or update to the content, please contact the
4original document maintainer directly. However, if you have a problem 4original document maintainer directly. However, if you have a problem
@@ -10,7 +10,7 @@ Maintainer: Punit Agrawal <punit.agrawal@arm.com>
10 Suzuki K. Poulose <suzuki.poulose@arm.com> 10 Suzuki K. Poulose <suzuki.poulose@arm.com>
11Chinese maintainer: Fu Wei <wefu@redhat.com> 11Chinese maintainer: Fu Wei <wefu@redhat.com>
12--------------------------------------------------------------------- 12---------------------------------------------------------------------
13Documentation/arm64/legacy_instructions.txt 的中文翻译 13Documentation/arm64/legacy_instructions.rst 的中文翻译
14 14
15如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文 15如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文
16äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻 16äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻
diff --git a/Documentation/translations/zh_CN/arm64/memory.txt b/Documentation/translations/zh_CN/arm64/memory.txt
index 19b3a52d5d94..be20f8228b91 100644
--- a/Documentation/translations/zh_CN/arm64/memory.txt
+++ b/Documentation/translations/zh_CN/arm64/memory.txt
@@ -1,4 +1,4 @@
1Chinese translated version of Documentation/arm64/memory.txt 1Chinese translated version of Documentation/arm64/memory.rst
2 2
3If you have any comment or update to the content, please contact the 3If you have any comment or update to the content, please contact the
4original document maintainer directly. However, if you have a problem 4original document maintainer directly. However, if you have a problem
@@ -9,7 +9,7 @@ or if there is a problem with the translation.
9Maintainer: Catalin Marinas <catalin.marinas@arm.com> 9Maintainer: Catalin Marinas <catalin.marinas@arm.com>
10Chinese maintainer: Fu Wei <wefu@redhat.com> 10Chinese maintainer: Fu Wei <wefu@redhat.com>
11--------------------------------------------------------------------- 11---------------------------------------------------------------------
12Documentation/arm64/memory.txt 的中文翻译 12Documentation/arm64/memory.rst 的中文翻译
13 13
14如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文 14如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文
15äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻 15äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻
diff --git a/Documentation/translations/zh_CN/arm64/silicon-errata.txt b/Documentation/translations/zh_CN/arm64/silicon-errata.txt
index 39477c75c4a4..440c59ac7dce 100644
--- a/Documentation/translations/zh_CN/arm64/silicon-errata.txt
+++ b/Documentation/translations/zh_CN/arm64/silicon-errata.txt
@@ -1,4 +1,4 @@
1Chinese translated version of Documentation/arm64/silicon-errata.txt 1Chinese translated version of Documentation/arm64/silicon-errata.rst
2 2
3If you have any comment or update to the content, please contact the 3If you have any comment or update to the content, please contact the
4original document maintainer directly. However, if you have a problem 4original document maintainer directly. However, if you have a problem
@@ -10,7 +10,7 @@ M: Will Deacon <will.deacon@arm.com>
10zh_CN: Fu Wei <wefu@redhat.com> 10zh_CN: Fu Wei <wefu@redhat.com>
11C: 1926e54f115725a9248d0c4c65c22acaf94de4c4 11C: 1926e54f115725a9248d0c4c65c22acaf94de4c4
12--------------------------------------------------------------------- 12---------------------------------------------------------------------
13Documentation/arm64/silicon-errata.txt 的中文翻译 13Documentation/arm64/silicon-errata.rst 的中文翻译
14 14
15如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文 15如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文
16äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻 16äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻
diff --git a/Documentation/translations/zh_CN/arm64/tagged-pointers.txt b/Documentation/translations/zh_CN/arm64/tagged-pointers.txt
index 2664d1bd5a1c..77ac3548a16d 100644
--- a/Documentation/translations/zh_CN/arm64/tagged-pointers.txt
+++ b/Documentation/translations/zh_CN/arm64/tagged-pointers.txt
@@ -1,4 +1,4 @@
1Chinese translated version of Documentation/arm64/tagged-pointers.txt 1Chinese translated version of Documentation/arm64/tagged-pointers.rst
2 2
3If you have any comment or update to the content, please contact the 3If you have any comment or update to the content, please contact the
4original document maintainer directly. However, if you have a problem 4original document maintainer directly. However, if you have a problem
@@ -9,7 +9,7 @@ or if there is a problem with the translation.
9Maintainer: Will Deacon <will.deacon@arm.com> 9Maintainer: Will Deacon <will.deacon@arm.com>
10Chinese maintainer: Fu Wei <wefu@redhat.com> 10Chinese maintainer: Fu Wei <wefu@redhat.com>
11--------------------------------------------------------------------- 11---------------------------------------------------------------------
12Documentation/arm64/tagged-pointers.txt 的中文翻译 12Documentation/arm64/tagged-pointers.rst 的中文翻译
13 13
14如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文 14如果想评论或更新本文的内容,请直接è”系原文档的维护者。如果你使用英文
15äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻 15äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯ä»¥å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻
diff --git a/Documentation/translations/zh_CN/basic_profiling.txt b/Documentation/translations/zh_CN/basic_profiling.txt
deleted file mode 100644
index 1e6bf0bdf8f5..000000000000
--- a/Documentation/translations/zh_CN/basic_profiling.txt
+++ /dev/null
@@ -1,71 +0,0 @@
1Chinese translated version of Documentation/basic_profiling
2
3If you have any comment or update to the content, please post to LKML directly.
4However, if you have problem communicating in English you can also ask the
5Chinese maintainer for help. Contact the Chinese maintainer, if this
6translation is outdated or there is problem with translation.
7
8Chinese maintainer: Liang Xie <xieliang@xiaomi.com>
9---------------------------------------------------------------------
10Documentation/basic_profiling的中文翻译
11
12如果想评论或更新本文的内容,请直接å‘信到LKMLã€‚å¦‚æžœä½ ä½¿ç”¨è‹±æ–‡äº¤æµæœ‰å›°éš¾çš„è¯ï¼Œä¹Ÿå¯
13以å‘中文版维护者求助。如果本翻译更新ä¸åŠæ—¶æˆ–者翻译存在问题,请è”系中文版维护者。
14
15中文版维护者: 谢良 Liang Xie <xieliang007@gmail.com>
16中文版翻译者: 谢良 Liang Xie <xieliang007@gmail.com>
17中文版校译者:
18以下为正文
19---------------------------------------------------------------------
20
21下é¢è¿™äº›è¯´æ˜ŽæŒ‡ä»¤éƒ½æ˜¯éžå¸¸åŸºç¡€çš„,如果你想进一步了解请阅读相关专业文档:)
22请ä¸è¦å†åœ¨æœ¬æ–‡æ¡£å¢žåŠ æ–°çš„å†…å®¹ï¼Œä½†å¯ä»¥ä¿®å¤æ–‡æ¡£ä¸­çš„错误:)(mbligh@aracnet.com)
23感谢John Levon,Dave Hansen等在撰写时的帮助
24
25<test> ç”¨äºŽè¡¨ç¤ºè¦æµ‹é‡çš„目标
26è¯·å…ˆç¡®ä¿æ‚¨å·²ç»æœ‰æ­£ç¡®çš„System.map / vmlinuxé…ç½®ï¼
27
28对于linux系统æ¥è¯´ï¼Œé…ç½®vmlinuz最容易的方法å¯èƒ½å°±æ˜¯ä½¿ç”¨â€œmake installâ€ï¼Œç„¶åŽä¿®æ”¹
29/sbin/installkernelå°†vmlinuxæ‹·è´åˆ°/boot目录,而System.map通常是默认安装好的
30
31Readprofile
32-----------
332.6系列内核需è¦ç‰ˆæœ¬ç›¸å¯¹è¾ƒæ–°çš„readprofile,比如util-linux 2.12a中包å«çš„,å¯ä»¥ä»Ž:
34
35http://www.kernel.org/pub/linux/utils/util-linux/ 下载
36
37大部分linuxå‘行版已ç»åŒ…å«äº†.
38
39å¯ç”¨readprofile需è¦åœ¨kernelå¯åŠ¨å‘½ä»¤è¡Œå¢žåŠ â€profile=2“
40
41clear readprofile -r
42 <test>
43dump output readprofile -m /boot/System.map > captured_profile
44
45Oprofile
46--------
47
48从http://oprofile.sourceforge.net/èŽ·å–æºä»£ç ï¼ˆè¯·å‚考Changes以获å–匹é…的版本)
49在kernelå¯åŠ¨å‘½ä»¤è¡Œå¢žåŠ â€œidle=pollâ€
50
51é…ç½®CONFIG_PROFILING=yå’ŒCONFIG_OPROFILE=yç„¶åŽé‡å¯è¿›å…¥æ–°kernel
52
53./configure --with-kernel-support
54make install
55
56想得到好的测é‡ç»“果,请确ä¿å¯ç”¨äº†æœ¬åœ°APIC特性。如果opreport显示有0Hz CPU,
57说明APIC特性没有开å¯ã€‚å¦å¤–注æ„idle=poll选项å¯èƒ½æœ‰æŸæ€§èƒ½ã€‚
58
59One time setup:
60 opcontrol --setup --vmlinux=/boot/vmlinux
61
62clear opcontrol --reset
63start opcontrol --start
64 <test>
65stop opcontrol --stop
66dump output opreport > output_file
67
68如果åªçœ‹kernel相关的报告结果,请è¿è¡Œå‘½ä»¤ opreport -l /boot/vmlinux > output_file
69
70通过reset选项å¯ä»¥æ¸…ç†è¿‡æœŸç»Ÿè®¡æ•°æ®ï¼Œç›¸å½“于é‡å¯çš„æ•ˆæžœã€‚
71
diff --git a/Documentation/translations/zh_CN/oops-tracing.txt b/Documentation/translations/zh_CN/oops-tracing.txt
index 93fa061cf9e4..368ddd05b304 100644
--- a/Documentation/translations/zh_CN/oops-tracing.txt
+++ b/Documentation/translations/zh_CN/oops-tracing.txt
@@ -53,7 +53,7 @@ cat /proc/kmsg > file, 然而你必须介入中止传输, kmsg是一个“æ°
53(2)用串å£ç»ˆç«¯å¯åŠ¨ï¼ˆè¯·å‚看Documentation/admin-guide/serial-console.rst),è¿è¡Œä¸€ä¸ªnull 53(2)用串å£ç»ˆç«¯å¯åŠ¨ï¼ˆè¯·å‚看Documentation/admin-guide/serial-console.rst),è¿è¡Œä¸€ä¸ªnull
54modem到å¦ä¸€å°æœºå™¨å¹¶ç”¨ä½ å–œæ¬¢çš„通讯工具获å–输出。Minicom工作地很好。 54modem到å¦ä¸€å°æœºå™¨å¹¶ç”¨ä½ å–œæ¬¢çš„通讯工具获å–输出。Minicom工作地很好。
55 55
56(3)使用Kdump(请å‚看Documentation/kdump/kdump.txt), 56(3)使用Kdump(请å‚看Documentation/kdump/kdump.rst),
57使用在Documentation/kdump/gdbmacros.txt中定义的dmesg gdbå®ï¼Œä»Žæ—§çš„内存中æå–内核 57使用在Documentation/kdump/gdbmacros.txt中定义的dmesg gdbå®ï¼Œä»Žæ—§çš„内存中æå–内核
58环形缓冲区。 58环形缓冲区。
59 59
diff --git a/Documentation/translations/zh_CN/process/4.Coding.rst b/Documentation/translations/zh_CN/process/4.Coding.rst
index 5301e9d55255..b82b1dde3122 100644
--- a/Documentation/translations/zh_CN/process/4.Coding.rst
+++ b/Documentation/translations/zh_CN/process/4.Coding.rst
@@ -205,7 +205,7 @@ Linus对这个问题给出了最佳答案:
205å¯ç”¨æ•…障注入åŽï¼Œå†…存分é…çš„å¯é…置百分比将失败;这些失败å¯ä»¥é™åˆ¶åœ¨ç‰¹å®šçš„ä»£ç  205å¯ç”¨æ•…障注入åŽï¼Œå†…存分é…çš„å¯é…置百分比将失败;这些失败å¯ä»¥é™åˆ¶åœ¨ç‰¹å®šçš„代ç 
206范围内。在å¯ç”¨äº†æ•…障注入的情况下è¿è¡Œï¼Œç¨‹åºå‘˜å¯ä»¥çœ‹åˆ°å½“情况æ¶åŒ–时代ç å¦‚ä½•å“ 206范围内。在å¯ç”¨äº†æ•…障注入的情况下è¿è¡Œï¼Œç¨‹åºå‘˜å¯ä»¥çœ‹åˆ°å½“情况æ¶åŒ–时代ç å¦‚何å“
207应。有关如何使用此工具的详细信æ¯ï¼Œè¯·å‚阅 207应。有关如何使用此工具的详细信æ¯ï¼Œè¯·å‚阅
208Documentation/fault-injection/fault-injection.txt。 208Documentation/fault-injection/fault-injection.rst。
209 209
210使用“sparseâ€é™æ€åˆ†æžå·¥å…·å¯ä»¥å‘现其他类型的错误。对于sparse,å¯ä»¥è­¦å‘Šç¨‹åºå‘˜ 210使用“sparseâ€é™æ€åˆ†æžå·¥å…·å¯ä»¥å‘现其他类型的错误。对于sparse,å¯ä»¥è­¦å‘Šç¨‹åºå‘˜
211用户空间和内核空间地å€ä¹‹é—´çš„æ··æ·†ã€big endianå’Œsmall endianæ•°é‡çš„æ··åˆã€åœ¨éœ€ 211用户空间和内核空间地å€ä¹‹é—´çš„æ··æ·†ã€big endianå’Œsmall endianæ•°é‡çš„æ··åˆã€åœ¨éœ€
@@ -241,7 +241,7 @@ scripts/coccinelleç›®å½•ä¸‹å·²ç»æ‰“包了相当多的内核“语义补ä¸â€ï¼
241 241
242任何添加新用户空间界é¢çš„代ç ï¼ˆåŒ…括新的sysfs或/proc文件)都应该包å«è¯¥ç•Œé¢çš„ 242任何添加新用户空间界é¢çš„代ç ï¼ˆåŒ…括新的sysfs或/proc文件)都应该包å«è¯¥ç•Œé¢çš„
243文档,该文档使用户空间开å‘人员能够知é“他们在使用什么。请å‚阅 243文档,该文档使用户空间开å‘人员能够知é“他们在使用什么。请å‚阅
244Documentation/abi/readme,了解如何格å¼åŒ–此文档以åŠéœ€è¦æä¾›å“ªäº›ä¿¡æ¯ã€‚ 244Documentation/ABI/README,了解如何格å¼åŒ–此文档以åŠéœ€è¦æä¾›å“ªäº›ä¿¡æ¯ã€‚
245 245
246文件 :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>` 246文件 :ref:`Documentation/admin-guide/kernel-parameters.rst <kernelparameters>`
247æè¿°äº†å†…æ ¸çš„æ‰€æœ‰å¼•å¯¼æ—¶é—´å‚æ•°ã€‚ä»»ä½•æ·»åŠ æ–°å‚æ•°çš„è¡¥ä¸éƒ½åº”该å‘该文件添加适当的 247æè¿°äº†å†…æ ¸çš„æ‰€æœ‰å¼•å¯¼æ—¶é—´å‚æ•°ã€‚ä»»ä½•æ·»åŠ æ–°å‚æ•°çš„è¡¥ä¸éƒ½åº”该å‘该文件添加适当的
diff --git a/Documentation/translations/zh_CN/process/coding-style.rst b/Documentation/translations/zh_CN/process/coding-style.rst
index 5479c591c2f7..4f6237392e65 100644
--- a/Documentation/translations/zh_CN/process/coding-style.rst
+++ b/Documentation/translations/zh_CN/process/coding-style.rst
@@ -599,7 +599,7 @@ Documentation/doc-guide/ å’Œ scripts/kernel-doc 以获得详细信æ¯ã€‚
599 depends on ADFS_FS 599 depends on ADFS_FS
600 ... 600 ...
601 601
602è¦æŸ¥çœ‹é…置文件的完整文档,请看 Documentation/kbuild/kconfig-language.txt。 602è¦æŸ¥çœ‹é…置文件的完整文档,请看 Documentation/kbuild/kconfig-language.rst。
603 603
604 604
60511) æ•°æ®ç»“æž„ 60511) æ•°æ®ç»“æž„
diff --git a/Documentation/translations/zh_CN/process/management-style.rst b/Documentation/translations/zh_CN/process/management-style.rst
index a181fa56d19e..c6a5bb285797 100644
--- a/Documentation/translations/zh_CN/process/management-style.rst
+++ b/Documentation/translations/zh_CN/process/management-style.rst
@@ -28,7 +28,7 @@ Linux内核管ç†é£Žæ ¼
28 28
29ä¸ç®¡æ€Žæ ·ï¼Œè¿™é‡Œæ˜¯ï¼š 29ä¸ç®¡æ€Žæ ·ï¼Œè¿™é‡Œæ˜¯ï¼š
30 30
31.. _decisions: 31.. _cn_decisions:
32 32
331)决策 331)决策
34------- 34-------
@@ -108,7 +108,7 @@ Linux内核管ç†é£Žæ ¼
108但是,为了åšå¥½ä½œä¸ºå†…核管ç†è€…的准备,最好记ä½ä¸è¦çƒ§æŽ‰ä»»ä½•æ¡¥æ¢ï¼Œä¸è¦è½°ç‚¸ä»»ä½• 108但是,为了åšå¥½ä½œä¸ºå†…核管ç†è€…的准备,最好记ä½ä¸è¦çƒ§æŽ‰ä»»ä½•æ¡¥æ¢ï¼Œä¸è¦è½°ç‚¸ä»»ä½•
109æ— è¾œçš„æ‘æ°‘,也ä¸è¦ç–远太多的内核开å‘äººå‘˜ã€‚äº‹å®žè¯æ˜Žï¼Œç–远人是相当容易的,而 109æ— è¾œçš„æ‘æ°‘,也ä¸è¦ç–远太多的内核开å‘äººå‘˜ã€‚äº‹å®žè¯æ˜Žï¼Œç–远人是相当容易的,而
110亲近一个ç–远的人是很难的。因此,“ç–远â€ç«‹å³å±žäºŽâ€œä¸å¯é€†â€çš„èŒƒç•´ï¼Œå¹¶æ ¹æ® 110亲近一个ç–远的人是很难的。因此,“ç–远â€ç«‹å³å±žäºŽâ€œä¸å¯é€†â€çš„范畴,并根æ®
111:ref:`decisions` æˆä¸ºç»ä¸å¯ä»¥åšçš„事情。 111:ref:`cn_decisions` æˆä¸ºç»ä¸å¯ä»¥åšçš„事情。
112 112
113è¿™é‡Œåªæœ‰å‡ ä¸ªç®€å•的规则: 113è¿™é‡Œåªæœ‰å‡ ä¸ªç®€å•的规则:
114 114
diff --git a/Documentation/translations/zh_CN/process/programming-language.rst b/Documentation/translations/zh_CN/process/programming-language.rst
index 51fd4ef48ea1..2a47a1d2ec20 100644
--- a/Documentation/translations/zh_CN/process/programming-language.rst
+++ b/Documentation/translations/zh_CN/process/programming-language.rst
@@ -8,21 +8,21 @@
8程åºè®¾è®¡è¯­è¨€ 8程åºè®¾è®¡è¯­è¨€
9============ 9============
10 10
11内核是用C语言 [c-language]_ 编写的。更准确地说,内核通常是用 ``gcc`` [gcc]_ 11内核是用C语言 :ref:`c-language <cn_c-language>` 编写的。更准确地说,内核通常是用 :ref:`gcc <cn_gcc>`
12在 ``-std=gnu89`` [gcc-c-dialect-options]_ 下编译的:ISO C90的 GNU 方言( 12在 ``-std=gnu89`` :ref:`gcc-c-dialect-options <cn_gcc-c-dialect-options>` 下编译的:ISO C90的 GNU 方言(
13包括一些C99特性) 13包括一些C99特性)
14 14
15è¿™ç§æ–¹è¨€åŒ…å«å¯¹è¯­è¨€ [gnu-extensions]_ 的许多扩展,当然,它们许多都在内核中使用。 15è¿™ç§æ–¹è¨€åŒ…å«å¯¹è¯­è¨€ :ref:`gnu-extensions <cn_gnu-extensions>` 的许多扩展,当然,它们许多都在内核中使用。
16 16
17对于一些体系结构,有一些使用 ``clang`` [clang]_ 和 ``icc`` [icc]_ 编译内核 17对于一些体系结构,有一些使用 :ref:`clang <cn_clang>` 和 :ref:`icc <cn_icc>` 编译内核
18的支æŒï¼Œå°½ç®¡åœ¨ç¼–写此文档时还没有完æˆï¼Œä»éœ€è¦ç¬¬ä¸‰æ–¹è¡¥ä¸ã€‚ 18的支æŒï¼Œå°½ç®¡åœ¨ç¼–写此文档时还没有完æˆï¼Œä»éœ€è¦ç¬¬ä¸‰æ–¹è¡¥ä¸ã€‚
19 19
20属性 20属性
21---- 21----
22 22
23åœ¨æ•´ä¸ªå†…æ ¸ä¸­ä½¿ç”¨çš„ä¸€ä¸ªå¸¸è§æ‰©å±•是属性(attributes) [gcc-attribute-syntax]_ 23åœ¨æ•´ä¸ªå†…æ ¸ä¸­ä½¿ç”¨çš„ä¸€ä¸ªå¸¸è§æ‰©å±•是属性(attributes) :ref:`gcc-attribute-syntax <cn_gcc-attribute-syntax>`
24属性å…许将实现定义的语义引入语言实体(如å˜é‡ã€å‡½æ•°æˆ–类型),而无需对语言进行 24属性å…许将实现定义的语义引入语言实体(如å˜é‡ã€å‡½æ•°æˆ–类型),而无需对语言进行
25é‡å¤§çš„语法更改(例如添加新关键字) [n2049]_ 25é‡å¤§çš„语法更改(例如添加新关键字) :ref:`n2049 <cn_n2049>`
26 26
27在æŸäº›æƒ…况下,属性是å¯é€‰çš„(å³ä¸æ”¯æŒè¿™äº›å±žæ€§çš„编译器ä»ç„¶åº”è¯¥ç”Ÿæˆæ­£ç¡®çš„代ç ï¼Œ 27在æŸäº›æƒ…况下,属性是å¯é€‰çš„(å³ä¸æ”¯æŒè¿™äº›å±žæ€§çš„编译器ä»ç„¶åº”è¯¥ç”Ÿæˆæ­£ç¡®çš„代ç ï¼Œ
28å³ä½¿å…¶é€Ÿåº¦è¾ƒæ…¢æˆ–执行的编译时检查/诊断次数ä¸å¤Ÿï¼‰ 28å³ä½¿å…¶é€Ÿåº¦è¾ƒæ…¢æˆ–执行的编译时检查/诊断次数ä¸å¤Ÿï¼‰
@@ -31,11 +31,42 @@
31``__attribute__((__pure__))`` ),以检测å¯ä»¥ä½¿ç”¨å“ªäº›å…³é”®å­—å’Œ/或缩短代ç , 具体 31``__attribute__((__pure__))`` ),以检测å¯ä»¥ä½¿ç”¨å“ªäº›å…³é”®å­—å’Œ/或缩短代ç , 具体
32请å‚阅 ``include/linux/compiler_attributes.h`` 32请å‚阅 ``include/linux/compiler_attributes.h``
33 33
34.. [c-language] http://www.open-std.org/jtc1/sc22/wg14/www/standards 34.. _cn_c-language:
35.. [gcc] https://gcc.gnu.org 35
36.. [clang] https://clang.llvm.org 36c-language
37.. [icc] https://software.intel.com/en-us/c-compilers 37 http://www.open-std.org/jtc1/sc22/wg14/www/standards
38.. [gcc-c-dialect-options] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html 38
39.. [gnu-extensions] https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html 39.. _cn_gcc:
40.. [gcc-attribute-syntax] https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html 40
41.. [n2049] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2049.pdf 41gcc
42 https://gcc.gnu.org
43
44.. _cn_clang:
45
46clang
47 https://clang.llvm.org
48
49.. _cn_icc:
50
51icc
52 https://software.intel.com/en-us/c-compilers
53
54.. _cn_gcc-c-dialect-options:
55
56c-dialect-options
57 https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
58
59.. _cn_gnu-extensions:
60
61gnu-extensions
62 https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html
63
64.. _cn_gcc-attribute-syntax:
65
66gcc-attribute-syntax
67 https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
68
69.. _cn_n2049:
70
71n2049
72 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2049.pdf
diff --git a/Documentation/translations/zh_CN/process/submit-checklist.rst b/Documentation/translations/zh_CN/process/submit-checklist.rst
index 89061aa8fdbe..f4785d2b0491 100644
--- a/Documentation/translations/zh_CN/process/submit-checklist.rst
+++ b/Documentation/translations/zh_CN/process/submit-checklist.rst
@@ -38,7 +38,7 @@ Linuxå†…æ ¸è¡¥ä¸æäº¤æ¸…å•
38 è¿è§„行为。 38 è¿è§„行为。
39 39
406) 任何新的或修改过的 ``CONFIG`` 选项都ä¸ä¼šå¼„è„é…ç½®èœå•ï¼Œå¹¶é»˜è®¤ä¸ºå…³é—­ï¼Œé™¤éž 406) 任何新的或修改过的 ``CONFIG`` 选项都ä¸ä¼šå¼„è„é…ç½®èœå•,并默认为关闭,除éž
41 å®ƒä»¬ç¬¦åˆ ``Documentation/kbuild/kconfig-language.txt`` 中记录的异常æ¡ä»¶, 41 å®ƒä»¬ç¬¦åˆ ``Documentation/kbuild/kconfig-language.rst`` 中记录的异常æ¡ä»¶,
42 èœå•属性:默认值. 42 èœå•属性:默认值.
43 43
447) 所有新的 ``kconfig`` 选项都有帮助文本。 447) 所有新的 ``kconfig`` 选项都有帮助文本。
diff --git a/Documentation/translations/zh_CN/process/submitting-drivers.rst b/Documentation/translations/zh_CN/process/submitting-drivers.rst
index 72c6cd935821..72f4f45c98de 100644
--- a/Documentation/translations/zh_CN/process/submitting-drivers.rst
+++ b/Documentation/translations/zh_CN/process/submitting-drivers.rst
@@ -22,7 +22,7 @@
22兴趣的是显å¡é©±åŠ¨ç¨‹åºï¼Œä½ ä¹Ÿè®¸åº”该访问 XFree86 项目(http://www.xfree86.org/) 22兴趣的是显å¡é©±åŠ¨ç¨‹åºï¼Œä½ ä¹Ÿè®¸åº”该访问 XFree86 项目(http://www.xfree86.org/)
23å’Œï¼æˆ– X.org 项目 (http://x.org)。 23å’Œï¼æˆ– X.org 项目 (http://x.org)。
24 24
25å¦è¯·å‚阅 Documentation/Documentation/translations/zh_CN/process/submitting-patches.rst 文档。 25å¦è¯·å‚阅 Documentation/translations/zh_CN/process/submitting-patches.rst 文档。
26 26
27 27
28分é…è®¾å¤‡å· 28分é…设备å·
diff --git a/Documentation/userspace-api/spec_ctrl.rst b/Documentation/userspace-api/spec_ctrl.rst
index 1129c7550a48..7ddd8f667459 100644
--- a/Documentation/userspace-api/spec_ctrl.rst
+++ b/Documentation/userspace-api/spec_ctrl.rst
@@ -49,6 +49,8 @@ If PR_SPEC_PRCTL is set, then the per-task control of the mitigation is
49available. If not set, prctl(PR_SET_SPECULATION_CTRL) for the speculation 49available. If not set, prctl(PR_SET_SPECULATION_CTRL) for the speculation
50misfeature will fail. 50misfeature will fail.
51 51
52.. _set_spec_ctrl:
53
52PR_SET_SPECULATION_CTRL 54PR_SET_SPECULATION_CTRL
53----------------------- 55-----------------------
54 56
diff --git a/Documentation/virtual/kvm/amd-memory-encryption.rst b/Documentation/virtual/kvm/amd-memory-encryption.rst
index 659bbc093b52..d18c97b4e140 100644
--- a/Documentation/virtual/kvm/amd-memory-encryption.rst
+++ b/Documentation/virtual/kvm/amd-memory-encryption.rst
@@ -241,6 +241,9 @@ Returns: 0 on success, -negative on error
241References 241References
242========== 242==========
243 243
244
245See [white-paper]_, [api-spec]_, [amd-apm]_ and [kvm-forum]_ for more info.
246
244.. [white-paper] http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf 247.. [white-paper] http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf
245.. [api-spec] http://support.amd.com/TechDocs/55766_SEV-KM_API_Specification.pdf 248.. [api-spec] http://support.amd.com/TechDocs/55766_SEV-KM_API_Specification.pdf
246.. [amd-apm] http://support.amd.com/TechDocs/24593.pdf (section 15.34) 249.. [amd-apm] http://support.amd.com/TechDocs/24593.pdf (section 15.34)
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 2a4531bb06bd..383b292966fa 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -2205,7 +2205,7 @@ max_vq. This is the maximum vector length available to the guest on
2205this vcpu, and determines which register slices are visible through 2205this vcpu, and determines which register slices are visible through
2206this ioctl interface. 2206this ioctl interface.
2207 2207
2208(See Documentation/arm64/sve.txt for an explanation of the "vq" 2208(See Documentation/arm64/sve.rst for an explanation of the "vq"
2209nomenclature.) 2209nomenclature.)
2210 2210
2211KVM_REG_ARM64_SVE_VLS is only accessible after KVM_ARM_VCPU_INIT. 2211KVM_REG_ARM64_SVE_VLS is only accessible after KVM_ARM_VCPU_INIT.
diff --git a/Documentation/virtual/kvm/devices/arm-vgic-its.txt b/Documentation/virtual/kvm/devices/arm-vgic-its.txt
index 4f0c9fc40365..eeaa95b893a8 100644
--- a/Documentation/virtual/kvm/devices/arm-vgic-its.txt
+++ b/Documentation/virtual/kvm/devices/arm-vgic-its.txt
@@ -103,7 +103,7 @@ Groups:
103The following ordering must be followed when restoring the GIC and the ITS: 103The following ordering must be followed when restoring the GIC and the ITS:
104a) restore all guest memory and create vcpus 104a) restore all guest memory and create vcpus
105b) restore all redistributors 105b) restore all redistributors
106c) provide the its base address 106c) provide the ITS base address
107 (KVM_DEV_ARM_VGIC_GRP_ADDR) 107 (KVM_DEV_ARM_VGIC_GRP_ADDR)
108d) restore the ITS in the following order: 108d) restore the ITS in the following order:
109 1. Restore GITS_CBASER 109 1. Restore GITS_CBASER
diff --git a/Documentation/vm/hwpoison.rst b/Documentation/vm/hwpoison.rst
index 09bd24a92784..a5c884293dac 100644
--- a/Documentation/vm/hwpoison.rst
+++ b/Documentation/vm/hwpoison.rst
@@ -13,32 +13,32 @@ kill the processes associated with it and avoid using it in the future.
13 13
14This patchkit implements the necessary infrastructure in the VM. 14This patchkit implements the necessary infrastructure in the VM.
15 15
16To quote the overview comment: 16To quote the overview comment::
17 17
18 * High level machine check handler. Handles pages reported by the 18 High level machine check handler. Handles pages reported by the
19 * hardware as being corrupted usually due to a 2bit ECC memory or cache 19 hardware as being corrupted usually due to a 2bit ECC memory or cache
20 * failure. 20 failure.
21 * 21
22 * This focusses on pages detected as corrupted in the background. 22 This focusses on pages detected as corrupted in the background.
23 * When the current CPU tries to consume corruption the currently 23 When the current CPU tries to consume corruption the currently
24 * running process can just be killed directly instead. This implies 24 running process can just be killed directly instead. This implies
25 * that if the error cannot be handled for some reason it's safe to 25 that if the error cannot be handled for some reason it's safe to
26 * just ignore it because no corruption has been consumed yet. Instead 26 just ignore it because no corruption has been consumed yet. Instead
27 * when that happens another machine check will happen. 27 when that happens another machine check will happen.
28 * 28
29 * Handles page cache pages in various states. The tricky part 29 Handles page cache pages in various states. The tricky part
30 * here is that we can access any page asynchronous to other VM 30 here is that we can access any page asynchronous to other VM
31 * users, because memory failures could happen anytime and anywhere, 31 users, because memory failures could happen anytime and anywhere,
32 * possibly violating some of their assumptions. This is why this code 32 possibly violating some of their assumptions. This is why this code
33 * has to be extremely careful. Generally it tries to use normal locking 33 has to be extremely careful. Generally it tries to use normal locking
34 * rules, as in get the standard locks, even if that means the 34 rules, as in get the standard locks, even if that means the
35 * error handling takes potentially a long time. 35 error handling takes potentially a long time.
36 * 36
37 * Some of the operations here are somewhat inefficient and have non 37 Some of the operations here are somewhat inefficient and have non
38 * linear algorithmic complexity, because the data structures have not 38 linear algorithmic complexity, because the data structures have not
39 * been optimized for this case. This is in particular the case 39 been optimized for this case. This is in particular the case
40 * for the mapping from a vma to a process. Since this case is expected 40 for the mapping from a vma to a process. Since this case is expected
41 * to be rare we hope we can get away with this. 41 to be rare we hope we can get away with this.
42 42
43The code consists of a the high level handler in mm/memory-failure.c, 43The code consists of a the high level handler in mm/memory-failure.c,
44a new page poison bit and various checks in the VM to handle poisoned 44a new page poison bit and various checks in the VM to handle poisoned
diff --git a/Documentation/vm/numa.rst b/Documentation/vm/numa.rst
index 0d830edae8fe..130f3cfa1c19 100644
--- a/Documentation/vm/numa.rst
+++ b/Documentation/vm/numa.rst
@@ -99,7 +99,7 @@ Local allocation will tend to keep subsequent access to the allocated memory
99as long as the task on whose behalf the kernel allocated some memory does not 99as long as the task on whose behalf the kernel allocated some memory does not
100later migrate away from that memory. The Linux scheduler is aware of the 100later migrate away from that memory. The Linux scheduler is aware of the
101NUMA topology of the platform--embodied in the "scheduling domains" data 101NUMA topology of the platform--embodied in the "scheduling domains" data
102structures [see Documentation/scheduler/sched-domains.txt]--and the scheduler 102structures [see Documentation/scheduler/sched-domains.rst]--and the scheduler
103attempts to minimize task migration to distant scheduling domains. However, 103attempts to minimize task migration to distant scheduling domains. However,
104the scheduler does not take a task's NUMA footprint into account directly. 104the scheduler does not take a task's NUMA footprint into account directly.
105Thus, under sufficient imbalance, tasks can migrate between nodes, remote 105Thus, under sufficient imbalance, tasks can migrate between nodes, remote
diff --git a/Documentation/watchdog/convert_drivers_to_kernel_api.txt b/Documentation/watchdog/convert_drivers_to_kernel_api.rst
index 9fffb2958d13..dd934cc08e40 100644
--- a/Documentation/watchdog/convert_drivers_to_kernel_api.txt
+++ b/Documentation/watchdog/convert_drivers_to_kernel_api.rst
@@ -1,7 +1,9 @@
1=========================================================
1Converting old watchdog drivers to the watchdog framework 2Converting old watchdog drivers to the watchdog framework
2by Wolfram Sang <w.sang@pengutronix.de>
3========================================================= 3=========================================================
4 4
5by Wolfram Sang <w.sang@pengutronix.de>
6
5Before the watchdog framework came into the kernel, every driver had to 7Before the watchdog framework came into the kernel, every driver had to
6implement the API on its own. Now, as the framework factored out the common 8implement the API on its own. Now, as the framework factored out the common
7components, those drivers can be lightened making it a user of the framework. 9components, those drivers can be lightened making it a user of the framework.
@@ -69,16 +71,16 @@ Here is a overview of the functions and probably needed actions:
69 -ENOIOCTLCMD, the IOCTLs of the framework will be tried, too. Any other error 71 -ENOIOCTLCMD, the IOCTLs of the framework will be tried, too. Any other error
70 is directly given to the user. 72 is directly given to the user.
71 73
72Example conversion: 74Example conversion::
73 75
74-static const struct file_operations s3c2410wdt_fops = { 76 -static const struct file_operations s3c2410wdt_fops = {
75- .owner = THIS_MODULE, 77 - .owner = THIS_MODULE,
76- .llseek = no_llseek, 78 - .llseek = no_llseek,
77- .write = s3c2410wdt_write, 79 - .write = s3c2410wdt_write,
78- .unlocked_ioctl = s3c2410wdt_ioctl, 80 - .unlocked_ioctl = s3c2410wdt_ioctl,
79- .open = s3c2410wdt_open, 81 - .open = s3c2410wdt_open,
80- .release = s3c2410wdt_release, 82 - .release = s3c2410wdt_release,
81-}; 83 -};
82 84
83Check the functions for device-specific stuff and keep it for later 85Check the functions for device-specific stuff and keep it for later
84refactoring. The rest can go. 86refactoring. The rest can go.
@@ -89,24 +91,24 @@ Remove the miscdevice
89 91
90Since the file_operations are gone now, you can also remove the 'struct 92Since the file_operations are gone now, you can also remove the 'struct
91miscdevice'. The framework will create it on watchdog_dev_register() called by 93miscdevice'. The framework will create it on watchdog_dev_register() called by
92watchdog_register_device(). 94watchdog_register_device()::
93 95
94-static struct miscdevice s3c2410wdt_miscdev = { 96 -static struct miscdevice s3c2410wdt_miscdev = {
95- .minor = WATCHDOG_MINOR, 97 - .minor = WATCHDOG_MINOR,
96- .name = "watchdog", 98 - .name = "watchdog",
97- .fops = &s3c2410wdt_fops, 99 - .fops = &s3c2410wdt_fops,
98-}; 100 -};
99 101
100 102
101Remove obsolete includes and defines 103Remove obsolete includes and defines
102------------------------------------ 104------------------------------------
103 105
104Because of the simplifications, a few defines are probably unused now. Remove 106Because of the simplifications, a few defines are probably unused now. Remove
105them. Includes can be removed, too. For example: 107them. Includes can be removed, too. For example::
106 108
107- #include <linux/fs.h> 109 - #include <linux/fs.h>
108- #include <linux/miscdevice.h> (if MODULE_ALIAS_MISCDEV is not used) 110 - #include <linux/miscdevice.h> (if MODULE_ALIAS_MISCDEV is not used)
109- #include <linux/uaccess.h> (if no custom IOCTLs are used) 111 - #include <linux/uaccess.h> (if no custom IOCTLs are used)
110 112
111 113
112Add the watchdog operations 114Add the watchdog operations
@@ -121,30 +123,30 @@ change the function header. Other changes are most likely not needed, because
121here simply happens the direct hardware access. If you have device-specific 123here simply happens the direct hardware access. If you have device-specific
122code left from the above steps, it should be refactored into these callbacks. 124code left from the above steps, it should be refactored into these callbacks.
123 125
124Here is a simple example: 126Here is a simple example::
125 127
126+static struct watchdog_ops s3c2410wdt_ops = { 128 +static struct watchdog_ops s3c2410wdt_ops = {
127+ .owner = THIS_MODULE, 129 + .owner = THIS_MODULE,
128+ .start = s3c2410wdt_start, 130 + .start = s3c2410wdt_start,
129+ .stop = s3c2410wdt_stop, 131 + .stop = s3c2410wdt_stop,
130+ .ping = s3c2410wdt_keepalive, 132 + .ping = s3c2410wdt_keepalive,
131+ .set_timeout = s3c2410wdt_set_heartbeat, 133 + .set_timeout = s3c2410wdt_set_heartbeat,
132+}; 134 +};
133 135
134A typical function-header change looks like: 136A typical function-header change looks like::
135 137
136-static void s3c2410wdt_keepalive(void) 138 -static void s3c2410wdt_keepalive(void)
137+static int s3c2410wdt_keepalive(struct watchdog_device *wdd) 139 +static int s3c2410wdt_keepalive(struct watchdog_device *wdd)
138 { 140 {
139... 141 ...
140+ 142 +
141+ return 0; 143 + return 0;
142 } 144 }
143 145
144... 146 ...
145 147
146- s3c2410wdt_keepalive(); 148 - s3c2410wdt_keepalive();
147+ s3c2410wdt_keepalive(&s3c2410_wdd); 149 + s3c2410wdt_keepalive(&s3c2410_wdd);
148 150
149 151
150Add the watchdog device 152Add the watchdog device
@@ -159,12 +161,12 @@ static variables. Those have to be converted to use the members in
159watchdog_device. Note that the timeout values are unsigned int. Some drivers 161watchdog_device. Note that the timeout values are unsigned int. Some drivers
160use signed int, so this has to be converted, too. 162use signed int, so this has to be converted, too.
161 163
162Here is a simple example for a watchdog device: 164Here is a simple example for a watchdog device::
163 165
164+static struct watchdog_device s3c2410_wdd = { 166 +static struct watchdog_device s3c2410_wdd = {
165+ .info = &s3c2410_wdt_ident, 167 + .info = &s3c2410_wdt_ident,
166+ .ops = &s3c2410wdt_ops, 168 + .ops = &s3c2410wdt_ops,
167+}; 169 +};
168 170
169 171
170Handle the 'nowayout' feature 172Handle the 'nowayout' feature
@@ -173,12 +175,12 @@ Handle the 'nowayout' feature
173A few drivers use nowayout statically, i.e. there is no module parameter for it 175A few drivers use nowayout statically, i.e. there is no module parameter for it
174and only CONFIG_WATCHDOG_NOWAYOUT determines if the feature is going to be 176and only CONFIG_WATCHDOG_NOWAYOUT determines if the feature is going to be
175used. This needs to be converted by initializing the status variable of the 177used. This needs to be converted by initializing the status variable of the
176watchdog_device like this: 178watchdog_device like this::
177 179
178 .status = WATCHDOG_NOWAYOUT_INIT_STATUS, 180 .status = WATCHDOG_NOWAYOUT_INIT_STATUS,
179 181
180Most drivers, however, also allow runtime configuration of nowayout, usually 182Most drivers, however, also allow runtime configuration of nowayout, usually
181by adding a module parameter. The conversion for this would be something like: 183by adding a module parameter. The conversion for this would be something like::
182 184
183 watchdog_set_nowayout(&s3c2410_wdd, nowayout); 185 watchdog_set_nowayout(&s3c2410_wdd, nowayout);
184 186
@@ -191,15 +193,15 @@ Register the watchdog device
191 193
192Replace misc_register(&miscdev) with watchdog_register_device(&watchdog_dev). 194Replace misc_register(&miscdev) with watchdog_register_device(&watchdog_dev).
193Make sure the return value gets checked and the error message, if present, 195Make sure the return value gets checked and the error message, if present,
194still fits. Also convert the unregister case. 196still fits. Also convert the unregister case::
195 197
196- ret = misc_register(&s3c2410wdt_miscdev); 198 - ret = misc_register(&s3c2410wdt_miscdev);
197+ ret = watchdog_register_device(&s3c2410_wdd); 199 + ret = watchdog_register_device(&s3c2410_wdd);
198 200
199... 201 ...
200 202
201- misc_deregister(&s3c2410wdt_miscdev); 203 - misc_deregister(&s3c2410wdt_miscdev);
202+ watchdog_unregister_device(&s3c2410_wdd); 204 + watchdog_unregister_device(&s3c2410_wdd);
203 205
204 206
205Update the Kconfig-entry 207Update the Kconfig-entry
@@ -207,7 +209,7 @@ Update the Kconfig-entry
207 209
208The entry for the driver now needs to select WATCHDOG_CORE: 210The entry for the driver now needs to select WATCHDOG_CORE:
209 211
210+ select WATCHDOG_CORE 212 + select WATCHDOG_CORE
211 213
212 214
213Create a patch and send it to upstream 215Create a patch and send it to upstream
@@ -215,4 +217,3 @@ Create a patch and send it to upstream
215 217
216Make sure you understood Documentation/process/submitting-patches.rst and send your patch to 218Make sure you understood Documentation/process/submitting-patches.rst and send your patch to
217linux-watchdog@vger.kernel.org. We are looking forward to it :) 219linux-watchdog@vger.kernel.org. We are looking forward to it :)
218
diff --git a/Documentation/watchdog/hpwdt.txt b/Documentation/watchdog/hpwdt.rst
index 55df692c5595..94a96371113e 100644
--- a/Documentation/watchdog/hpwdt.txt
+++ b/Documentation/watchdog/hpwdt.rst
@@ -1,7 +1,12 @@
1===========================
2HPE iLO NMI Watchdog Driver
3===========================
4
5for iLO based ProLiant Servers
6==============================
7
1Last reviewed: 08/20/2018 8Last reviewed: 08/20/2018
2 9
3 HPE iLO NMI Watchdog Driver
4 for iLO based ProLiant Servers
5 10
6 The HPE iLO NMI Watchdog driver is a kernel module that provides basic 11 The HPE iLO NMI Watchdog driver is a kernel module that provides basic
7 watchdog functionality and handler for the iLO "Generate NMI to System" 12 watchdog functionality and handler for the iLO "Generate NMI to System"
@@ -20,23 +25,26 @@ Last reviewed: 08/20/2018
20 25
21 The hpwdt driver also has the following module parameters: 26 The hpwdt driver also has the following module parameters:
22 27
23 soft_margin - allows the user to set the watchdog timer value. 28 ============ ================================================================
29 soft_margin allows the user to set the watchdog timer value.
24 Default value is 30 seconds. 30 Default value is 30 seconds.
25 timeout - an alias of soft_margin. 31 timeout an alias of soft_margin.
26 pretimeout - allows the user to set the watchdog pretimeout value. 32 pretimeout allows the user to set the watchdog pretimeout value.
27 This is the number of seconds before timeout when an 33 This is the number of seconds before timeout when an
28 NMI is delivered to the system. Setting the value to 34 NMI is delivered to the system. Setting the value to
29 zero disables the pretimeout NMI. 35 zero disables the pretimeout NMI.
30 Default value is 9 seconds. 36 Default value is 9 seconds.
31 nowayout - basic watchdog parameter that does not allow the timer to 37 nowayout basic watchdog parameter that does not allow the timer to
32 be restarted or an impending ASR to be escaped. 38 be restarted or an impending ASR to be escaped.
33 Default value is set when compiling the kernel. If it is set 39 Default value is set when compiling the kernel. If it is set
34 to "Y", then there is no way of disabling the watchdog once 40 to "Y", then there is no way of disabling the watchdog once
35 it has been started. 41 it has been started.
42 ============ ================================================================
36 43
37 NOTE: More information about watchdog drivers in general, including the ioctl 44 NOTE:
45 More information about watchdog drivers in general, including the ioctl
38 interface to /dev/watchdog can be found in 46 interface to /dev/watchdog can be found in
39 Documentation/watchdog/watchdog-api.txt and Documentation/IPMI.txt. 47 Documentation/watchdog/watchdog-api.rst and Documentation/IPMI.txt.
40 48
41 Due to limitations in the iLO hardware, the NMI pretimeout if enabled, 49 Due to limitations in the iLO hardware, the NMI pretimeout if enabled,
42 can only be set to 9 seconds. Attempts to set pretimeout to other 50 can only be set to 9 seconds. Attempts to set pretimeout to other
@@ -51,7 +59,7 @@ Last reviewed: 08/20/2018
51 and loop forever. This is generally not what a watchdog user wants. 59 and loop forever. This is generally not what a watchdog user wants.
52 60
53 For those wishing to learn more please see: 61 For those wishing to learn more please see:
54 Documentation/kdump/kdump.txt 62 Documentation/kdump/kdump.rst
55 Documentation/admin-guide/kernel-parameters.txt (panic=) 63 Documentation/admin-guide/kernel-parameters.txt (panic=)
56 Your Linux Distribution specific documentation. 64 Your Linux Distribution specific documentation.
57 65
@@ -63,4 +71,3 @@ Last reviewed: 08/20/2018
63 71
64 The HPE iLO NMI Watchdog Driver and documentation were originally developed 72 The HPE iLO NMI Watchdog Driver and documentation were originally developed
65 by Tom Mingarelli. 73 by Tom Mingarelli.
66
diff --git a/Documentation/watchdog/index.rst b/Documentation/watchdog/index.rst
new file mode 100644
index 000000000000..33a0de631e84
--- /dev/null
+++ b/Documentation/watchdog/index.rst
@@ -0,0 +1,25 @@
1:orphan:
2
3======================
4Linux Watchdog Support
5======================
6
7.. toctree::
8 :maxdepth: 1
9
10 hpwdt
11 mlx-wdt
12 pcwd-watchdog
13 watchdog-api
14 watchdog-kernel-api
15 watchdog-parameters
16 watchdog-pm
17 wdt
18 convert_drivers_to_kernel_api
19
20.. only:: subproject and html
21
22 Indices
23 =======
24
25 * :ref:`genindex`
diff --git a/Documentation/watchdog/mlx-wdt.txt b/Documentation/watchdog/mlx-wdt.rst
index 66eeb78505c3..bf5bafac47f0 100644
--- a/Documentation/watchdog/mlx-wdt.txt
+++ b/Documentation/watchdog/mlx-wdt.rst
@@ -1,5 +1,9 @@
1 Mellanox watchdog drivers 1=========================
2 for x86 based system switches 2Mellanox watchdog drivers
3=========================
4
5for x86 based system switches
6=============================
3 7
4This driver provides watchdog functionality for various Mellanox 8This driver provides watchdog functionality for various Mellanox
5Ethernet and Infiniband switch systems. 9Ethernet and Infiniband switch systems.
@@ -9,16 +13,16 @@ Mellanox watchdog device is implemented in a programmable logic device.
9There are 2 types of HW watchdog implementations. 13There are 2 types of HW watchdog implementations.
10 14
11Type 1: 15Type 1:
12Actual HW timeout can be defined as a power of 2 msec. 16 Actual HW timeout can be defined as a power of 2 msec.
13e.g. timeout 20 sec will be rounded up to 32768 msec. 17 e.g. timeout 20 sec will be rounded up to 32768 msec.
14The maximum timeout period is 32 sec (32768 msec.), 18 The maximum timeout period is 32 sec (32768 msec.),
15Get time-left isn't supported 19 Get time-left isn't supported
16 20
17Type 2: 21Type 2:
18Actual HW timeout is defined in sec. and it's the same as 22 Actual HW timeout is defined in sec. and it's the same as
19a user-defined timeout. 23 a user-defined timeout.
20Maximum timeout is 255 sec. 24 Maximum timeout is 255 sec.
21Get time-left is supported. 25 Get time-left is supported.
22 26
23Type 1 HW watchdog implementation exist in old systems and 27Type 1 HW watchdog implementation exist in old systems and
24all new systems have type 2 HW watchdog. 28all new systems have type 2 HW watchdog.
diff --git a/Documentation/watchdog/pcwd-watchdog.txt b/Documentation/watchdog/pcwd-watchdog.rst
index b8e60a441a43..405e2a370082 100644
--- a/Documentation/watchdog/pcwd-watchdog.txt
+++ b/Documentation/watchdog/pcwd-watchdog.rst
@@ -1,8 +1,13 @@
1===================================
2Berkshire Products PC Watchdog Card
3===================================
4
1Last reviewed: 10/05/2007 5Last reviewed: 10/05/2007
2 6
3 Berkshire Products PC Watchdog Card 7Support for ISA Cards Revision A and C
4 Support for ISA Cards Revision A and C 8=======================================
5 Documentation and Driver by Ken Hollis <kenji@bitgate.com> 9
10Documentation and Driver by Ken Hollis <kenji@bitgate.com>
6 11
7 The PC Watchdog is a card that offers the same type of functionality that 12 The PC Watchdog is a card that offers the same type of functionality that
8 the WDT card does, only it doesn't require an IRQ to run. Furthermore, 13 the WDT card does, only it doesn't require an IRQ to run. Furthermore,
@@ -33,6 +38,7 @@ Last reviewed: 10/05/2007
33 WDIOC_GETSUPPORT 38 WDIOC_GETSUPPORT
34 This returns the support of the card itself. This 39 This returns the support of the card itself. This
35 returns in structure "PCWDS" which returns: 40 returns in structure "PCWDS" which returns:
41
36 options = WDIOS_TEMPPANIC 42 options = WDIOS_TEMPPANIC
37 (This card supports temperature) 43 (This card supports temperature)
38 firmware_version = xxxx 44 firmware_version = xxxx
@@ -63,4 +69,3 @@ Last reviewed: 10/05/2007
63 69
64 -- Ken Hollis 70 -- Ken Hollis
65 (kenji@bitgate.com) 71 (kenji@bitgate.com)
66
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.rst
index 0e62ba33b7fb..c6c1e9fa9f73 100644
--- a/Documentation/watchdog/watchdog-api.txt
+++ b/Documentation/watchdog/watchdog-api.rst
@@ -1,7 +1,10 @@
1=============================
2The Linux Watchdog driver API
3=============================
4
1Last reviewed: 10/05/2007 5Last reviewed: 10/05/2007
2 6
3 7
4The Linux Watchdog driver API.
5 8
6Copyright 2002 Christer Weingel <wingel@nano-system.com> 9Copyright 2002 Christer Weingel <wingel@nano-system.com>
7 10
@@ -10,7 +13,8 @@ driver which is (c) Copyright 2000 Jakob Oestergaard <jakob@ostenfeld.dk>
10 13
11This document describes the state of the Linux 2.4.18 kernel. 14This document describes the state of the Linux 2.4.18 kernel.
12 15
13Introduction: 16Introduction
17============
14 18
15A Watchdog Timer (WDT) is a hardware circuit that can reset the 19A Watchdog Timer (WDT) is a hardware circuit that can reset the
16computer system in case of a software fault. You probably knew that 20computer system in case of a software fault. You probably knew that
@@ -30,7 +34,8 @@ drivers implement different, and sometimes incompatible, parts of it.
30This file is an attempt to document the existing usage and allow 34This file is an attempt to document the existing usage and allow
31future driver writers to use it as a reference. 35future driver writers to use it as a reference.
32 36
33The simplest API: 37The simplest API
38================
34 39
35All drivers support the basic mode of operation, where the watchdog 40All drivers support the basic mode of operation, where the watchdog
36activates as soon as /dev/watchdog is opened and will reboot unless 41activates as soon as /dev/watchdog is opened and will reboot unless
@@ -54,7 +59,8 @@ after the timeout has passed. Watchdog devices also usually support
54the nowayout module parameter so that this option can be controlled at 59the nowayout module parameter so that this option can be controlled at
55runtime. 60runtime.
56 61
57Magic Close feature: 62Magic Close feature
63===================
58 64
59If a driver supports "Magic Close", the driver will not disable the 65If a driver supports "Magic Close", the driver will not disable the
60watchdog unless a specific magic character 'V' has been sent to 66watchdog unless a specific magic character 'V' has been sent to
@@ -64,7 +70,8 @@ will assume that the daemon (and userspace in general) died, and will
64stop pinging the watchdog without disabling it first. This will then 70stop pinging the watchdog without disabling it first. This will then
65cause a reboot if the watchdog is not re-opened in sufficient time. 71cause a reboot if the watchdog is not re-opened in sufficient time.
66 72
67The ioctl API: 73The ioctl API
74=============
68 75
69All conforming drivers also support an ioctl API. 76All conforming drivers also support an ioctl API.
70 77
@@ -73,7 +80,7 @@ Pinging the watchdog using an ioctl:
73All drivers that have an ioctl interface support at least one ioctl, 80All drivers that have an ioctl interface support at least one ioctl,
74KEEPALIVE. This ioctl does exactly the same thing as a write to the 81KEEPALIVE. This ioctl does exactly the same thing as a write to the
75watchdog device, so the main loop in the above program could be 82watchdog device, so the main loop in the above program could be
76replaced with: 83replaced with::
77 84
78 while (1) { 85 while (1) {
79 ioctl(fd, WDIOC_KEEPALIVE, 0); 86 ioctl(fd, WDIOC_KEEPALIVE, 0);
@@ -82,14 +89,15 @@ replaced with:
82 89
83the argument to the ioctl is ignored. 90the argument to the ioctl is ignored.
84 91
85Setting and getting the timeout: 92Setting and getting the timeout
93===============================
86 94
87For some drivers it is possible to modify the watchdog timeout on the 95For some drivers it is possible to modify the watchdog timeout on the
88fly with the SETTIMEOUT ioctl, those drivers have the WDIOF_SETTIMEOUT 96fly with the SETTIMEOUT ioctl, those drivers have the WDIOF_SETTIMEOUT
89flag set in their option field. The argument is an integer 97flag set in their option field. The argument is an integer
90representing the timeout in seconds. The driver returns the real 98representing the timeout in seconds. The driver returns the real
91timeout used in the same variable, and this timeout might differ from 99timeout used in the same variable, and this timeout might differ from
92the requested one due to limitation of the hardware. 100the requested one due to limitation of the hardware::
93 101
94 int timeout = 45; 102 int timeout = 45;
95 ioctl(fd, WDIOC_SETTIMEOUT, &timeout); 103 ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
@@ -99,18 +107,19 @@ This example might actually print "The timeout was set to 60 seconds"
99if the device has a granularity of minutes for its timeout. 107if the device has a granularity of minutes for its timeout.
100 108
101Starting with the Linux 2.4.18 kernel, it is possible to query the 109Starting with the Linux 2.4.18 kernel, it is possible to query the
102current timeout using the GETTIMEOUT ioctl. 110current timeout using the GETTIMEOUT ioctl::
103 111
104 ioctl(fd, WDIOC_GETTIMEOUT, &timeout); 112 ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
105 printf("The timeout was is %d seconds\n", timeout); 113 printf("The timeout was is %d seconds\n", timeout);
106 114
107Pretimeouts: 115Pretimeouts
116===========
108 117
109Some watchdog timers can be set to have a trigger go off before the 118Some watchdog timers can be set to have a trigger go off before the
110actual time they will reset the system. This can be done with an NMI, 119actual time they will reset the system. This can be done with an NMI,
111interrupt, or other mechanism. This allows Linux to record useful 120interrupt, or other mechanism. This allows Linux to record useful
112information (like panic information and kernel coredumps) before it 121information (like panic information and kernel coredumps) before it
113resets. 122resets::
114 123
115 pretimeout = 10; 124 pretimeout = 10;
116 ioctl(fd, WDIOC_SETPRETIMEOUT, &pretimeout); 125 ioctl(fd, WDIOC_SETPRETIMEOUT, &pretimeout);
@@ -121,89 +130,113 @@ the pretimeout. So, for instance, if you set the timeout to 60 seconds
121and the pretimeout to 10 seconds, the pretimeout will go off in 50 130and the pretimeout to 10 seconds, the pretimeout will go off in 50
122seconds. Setting a pretimeout to zero disables it. 131seconds. Setting a pretimeout to zero disables it.
123 132
124There is also a get function for getting the pretimeout: 133There is also a get function for getting the pretimeout::
125 134
126 ioctl(fd, WDIOC_GETPRETIMEOUT, &timeout); 135 ioctl(fd, WDIOC_GETPRETIMEOUT, &timeout);
127 printf("The pretimeout was is %d seconds\n", timeout); 136 printf("The pretimeout was is %d seconds\n", timeout);
128 137
129Not all watchdog drivers will support a pretimeout. 138Not all watchdog drivers will support a pretimeout.
130 139
131Get the number of seconds before reboot: 140Get the number of seconds before reboot
141=======================================
132 142
133Some watchdog drivers have the ability to report the remaining time 143Some watchdog drivers have the ability to report the remaining time
134before the system will reboot. The WDIOC_GETTIMELEFT is the ioctl 144before the system will reboot. The WDIOC_GETTIMELEFT is the ioctl
135that returns the number of seconds before reboot. 145that returns the number of seconds before reboot::
136 146
137 ioctl(fd, WDIOC_GETTIMELEFT, &timeleft); 147 ioctl(fd, WDIOC_GETTIMELEFT, &timeleft);
138 printf("The timeout was is %d seconds\n", timeleft); 148 printf("The timeout was is %d seconds\n", timeleft);
139 149
140Environmental monitoring: 150Environmental monitoring
151========================
141 152
142All watchdog drivers are required return more information about the system, 153All watchdog drivers are required return more information about the system,
143some do temperature, fan and power level monitoring, some can tell you 154some do temperature, fan and power level monitoring, some can tell you
144the reason for the last reboot of the system. The GETSUPPORT ioctl is 155the reason for the last reboot of the system. The GETSUPPORT ioctl is
145available to ask what the device can do: 156available to ask what the device can do::
146 157
147 struct watchdog_info ident; 158 struct watchdog_info ident;
148 ioctl(fd, WDIOC_GETSUPPORT, &ident); 159 ioctl(fd, WDIOC_GETSUPPORT, &ident);
149 160
150the fields returned in the ident struct are: 161the fields returned in the ident struct are:
151 162
163 ================ =============================================
152 identity a string identifying the watchdog driver 164 identity a string identifying the watchdog driver
153 firmware_version the firmware version of the card if available 165 firmware_version the firmware version of the card if available
154 options a flags describing what the device supports 166 options a flags describing what the device supports
167 ================ =============================================
155 168
156the options field can have the following bits set, and describes what 169the options field can have the following bits set, and describes what
157kind of information that the GET_STATUS and GET_BOOT_STATUS ioctls can 170kind of information that the GET_STATUS and GET_BOOT_STATUS ioctls can
158return. [FIXME -- Is this correct?] 171return. [FIXME -- Is this correct?]
159 172
173 ================ =========================
160 WDIOF_OVERHEAT Reset due to CPU overheat 174 WDIOF_OVERHEAT Reset due to CPU overheat
175 ================ =========================
161 176
162The machine was last rebooted by the watchdog because the thermal limit was 177The machine was last rebooted by the watchdog because the thermal limit was
163exceeded 178exceeded:
164 179
180 ============== ==========
165 WDIOF_FANFAULT Fan failed 181 WDIOF_FANFAULT Fan failed
182 ============== ==========
166 183
167A system fan monitored by the watchdog card has failed 184A system fan monitored by the watchdog card has failed
168 185
186 ============= ================
169 WDIOF_EXTERN1 External relay 1 187 WDIOF_EXTERN1 External relay 1
188 ============= ================
170 189
171External monitoring relay/source 1 was triggered. Controllers intended for 190External monitoring relay/source 1 was triggered. Controllers intended for
172real world applications include external monitoring pins that will trigger 191real world applications include external monitoring pins that will trigger
173a reset. 192a reset.
174 193
194 ============= ================
175 WDIOF_EXTERN2 External relay 2 195 WDIOF_EXTERN2 External relay 2
196 ============= ================
176 197
177External monitoring relay/source 2 was triggered 198External monitoring relay/source 2 was triggered
178 199
200 ================ =====================
179 WDIOF_POWERUNDER Power bad/power fault 201 WDIOF_POWERUNDER Power bad/power fault
202 ================ =====================
180 203
181The machine is showing an undervoltage status 204The machine is showing an undervoltage status
182 205
206 =============== =============================
183 WDIOF_CARDRESET Card previously reset the CPU 207 WDIOF_CARDRESET Card previously reset the CPU
208 =============== =============================
184 209
185The last reboot was caused by the watchdog card 210The last reboot was caused by the watchdog card
186 211
212 ================ =====================
187 WDIOF_POWEROVER Power over voltage 213 WDIOF_POWEROVER Power over voltage
214 ================ =====================
188 215
189The machine is showing an overvoltage status. Note that if one level is 216The machine is showing an overvoltage status. Note that if one level is
190under and one over both bits will be set - this may seem odd but makes 217under and one over both bits will be set - this may seem odd but makes
191sense. 218sense.
192 219
220 =================== =====================
193 WDIOF_KEEPALIVEPING Keep alive ping reply 221 WDIOF_KEEPALIVEPING Keep alive ping reply
222 =================== =====================
194 223
195The watchdog saw a keepalive ping since it was last queried. 224The watchdog saw a keepalive ping since it was last queried.
196 225
226 ================ =======================
197 WDIOF_SETTIMEOUT Can set/get the timeout 227 WDIOF_SETTIMEOUT Can set/get the timeout
228 ================ =======================
198 229
199The watchdog can do pretimeouts. 230The watchdog can do pretimeouts.
200 231
232 ================ ================================
201 WDIOF_PRETIMEOUT Pretimeout (in seconds), get/set 233 WDIOF_PRETIMEOUT Pretimeout (in seconds), get/set
234 ================ ================================
202 235
203 236
204For those drivers that return any bits set in the option field, the 237For those drivers that return any bits set in the option field, the
205GETSTATUS and GETBOOTSTATUS ioctls can be used to ask for the current 238GETSTATUS and GETBOOTSTATUS ioctls can be used to ask for the current
206status, and the status at the last reboot, respectively. 239status, and the status at the last reboot, respectively::
207 240
208 int flags; 241 int flags;
209 ioctl(fd, WDIOC_GETSTATUS, &flags); 242 ioctl(fd, WDIOC_GETSTATUS, &flags);
@@ -216,22 +249,23 @@ Note that not all devices support these two calls, and some only
216support the GETBOOTSTATUS call. 249support the GETBOOTSTATUS call.
217 250
218Some drivers can measure the temperature using the GETTEMP ioctl. The 251Some drivers can measure the temperature using the GETTEMP ioctl. The
219returned value is the temperature in degrees fahrenheit. 252returned value is the temperature in degrees fahrenheit::
220 253
221 int temperature; 254 int temperature;
222 ioctl(fd, WDIOC_GETTEMP, &temperature); 255 ioctl(fd, WDIOC_GETTEMP, &temperature);
223 256
224Finally the SETOPTIONS ioctl can be used to control some aspects of 257Finally the SETOPTIONS ioctl can be used to control some aspects of
225the cards operation. 258the cards operation::
226 259
227 int options = 0; 260 int options = 0;
228 ioctl(fd, WDIOC_SETOPTIONS, &options); 261 ioctl(fd, WDIOC_SETOPTIONS, &options);
229 262
230The following options are available: 263The following options are available:
231 264
265 ================= ================================
232 WDIOS_DISABLECARD Turn off the watchdog timer 266 WDIOS_DISABLECARD Turn off the watchdog timer
233 WDIOS_ENABLECARD Turn on the watchdog timer 267 WDIOS_ENABLECARD Turn on the watchdog timer
234 WDIOS_TEMPPANIC Kernel panic on temperature trip 268 WDIOS_TEMPPANIC Kernel panic on temperature trip
269 ================= ================================
235 270
236[FIXME -- better explanations] 271[FIXME -- better explanations]
237
diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.rst
index 3a91ef5af044..864edbe932c1 100644
--- a/Documentation/watchdog/watchdog-kernel-api.txt
+++ b/Documentation/watchdog/watchdog-kernel-api.rst
@@ -1,5 +1,7 @@
1The Linux WatchDog Timer Driver Core kernel API.
2=============================================== 1===============================================
2The Linux WatchDog Timer Driver Core kernel API
3===============================================
4
3Last reviewed: 12-Feb-2013 5Last reviewed: 12-Feb-2013
4 6
5Wim Van Sebroeck <wim@iguana.be> 7Wim Van Sebroeck <wim@iguana.be>
@@ -9,7 +11,7 @@ Introduction
9This document does not describe what a WatchDog Timer (WDT) Driver or Device is. 11This document does not describe what a WatchDog Timer (WDT) Driver or Device is.
10It also does not describe the API which can be used by user space to communicate 12It also does not describe the API which can be used by user space to communicate
11with a WatchDog Timer. If you want to know this then please read the following 13with a WatchDog Timer. If you want to know this then please read the following
12file: Documentation/watchdog/watchdog-api.txt . 14file: Documentation/watchdog/watchdog-api.rst .
13 15
14So what does this document describe? It describes the API that can be used by 16So what does this document describe? It describes the API that can be used by
15WatchDog Timer Drivers that want to use the WatchDog Timer Driver Core 17WatchDog Timer Drivers that want to use the WatchDog Timer Driver Core
@@ -23,10 +25,10 @@ The API
23Each watchdog timer driver that wants to use the WatchDog Timer Driver Core 25Each watchdog timer driver that wants to use the WatchDog Timer Driver Core
24must #include <linux/watchdog.h> (you would have to do this anyway when 26must #include <linux/watchdog.h> (you would have to do this anyway when
25writing a watchdog device driver). This include file contains following 27writing a watchdog device driver). This include file contains following
26register/unregister routines: 28register/unregister routines::
27 29
28extern int watchdog_register_device(struct watchdog_device *); 30 extern int watchdog_register_device(struct watchdog_device *);
29extern void watchdog_unregister_device(struct watchdog_device *); 31 extern void watchdog_unregister_device(struct watchdog_device *);
30 32
31The watchdog_register_device routine registers a watchdog timer device. 33The watchdog_register_device routine registers a watchdog timer device.
32The parameter of this routine is a pointer to a watchdog_device structure. 34The parameter of this routine is a pointer to a watchdog_device structure.
@@ -40,9 +42,9 @@ The watchdog subsystem includes an registration deferral mechanism,
40which allows you to register an watchdog as early as you wish during 42which allows you to register an watchdog as early as you wish during
41the boot process. 43the boot process.
42 44
43The watchdog device structure looks like this: 45The watchdog device structure looks like this::
44 46
45struct watchdog_device { 47 struct watchdog_device {
46 int id; 48 int id;
47 struct device *parent; 49 struct device *parent;
48 const struct attribute_group **groups; 50 const struct attribute_group **groups;
@@ -62,9 +64,10 @@ struct watchdog_device {
62 struct watchdog_core_data *wd_data; 64 struct watchdog_core_data *wd_data;
63 unsigned long status; 65 unsigned long status;
64 struct list_head deferred; 66 struct list_head deferred;
65}; 67 };
66 68
67It contains following fields: 69It contains following fields:
70
68* id: set by watchdog_register_device, id 0 is special. It has both a 71* id: set by watchdog_register_device, id 0 is special. It has both a
69 /dev/watchdog0 cdev (dynamic major, minor 0) as well as the old 72 /dev/watchdog0 cdev (dynamic major, minor 0) as well as the old
70 /dev/watchdog miscdev. The id is set automatically when calling 73 /dev/watchdog miscdev. The id is set automatically when calling
@@ -114,9 +117,9 @@ It contains following fields:
114* deferred: entry in wtd_deferred_reg_list which is used to 117* deferred: entry in wtd_deferred_reg_list which is used to
115 register early initialized watchdogs. 118 register early initialized watchdogs.
116 119
117The list of watchdog operations is defined as: 120The list of watchdog operations is defined as::
118 121
119struct watchdog_ops { 122 struct watchdog_ops {
120 struct module *owner; 123 struct module *owner;
121 /* mandatory operations */ 124 /* mandatory operations */
122 int (*start)(struct watchdog_device *); 125 int (*start)(struct watchdog_device *);
@@ -129,7 +132,7 @@ struct watchdog_ops {
129 unsigned int (*get_timeleft)(struct watchdog_device *); 132 unsigned int (*get_timeleft)(struct watchdog_device *);
130 int (*restart)(struct watchdog_device *); 133 int (*restart)(struct watchdog_device *);
131 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long); 134 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
132}; 135 };
133 136
134It is important that you first define the module owner of the watchdog timer 137It is important that you first define the module owner of the watchdog timer
135driver's operations. This module owner will be used to lock the module when 138driver's operations. This module owner will be used to lock the module when
@@ -138,6 +141,7 @@ module and /dev/watchdog is still open).
138 141
139Some operations are mandatory and some are optional. The mandatory operations 142Some operations are mandatory and some are optional. The mandatory operations
140are: 143are:
144
141* start: this is a pointer to the routine that starts the watchdog timer 145* start: this is a pointer to the routine that starts the watchdog timer
142 device. 146 device.
143 The routine needs a pointer to the watchdog timer device structure as a 147 The routine needs a pointer to the watchdog timer device structure as a
@@ -146,51 +150,64 @@ are:
146Not all watchdog timer hardware supports the same functionality. That's why 150Not all watchdog timer hardware supports the same functionality. That's why
147all other routines/operations are optional. They only need to be provided if 151all other routines/operations are optional. They only need to be provided if
148they are supported. These optional routines/operations are: 152they are supported. These optional routines/operations are:
153
149* stop: with this routine the watchdog timer device is being stopped. 154* stop: with this routine the watchdog timer device is being stopped.
155
150 The routine needs a pointer to the watchdog timer device structure as a 156 The routine needs a pointer to the watchdog timer device structure as a
151 parameter. It returns zero on success or a negative errno code for failure. 157 parameter. It returns zero on success or a negative errno code for failure.
152 Some watchdog timer hardware can only be started and not be stopped. A 158 Some watchdog timer hardware can only be started and not be stopped. A
153 driver supporting such hardware does not have to implement the stop routine. 159 driver supporting such hardware does not have to implement the stop routine.
160
154 If a driver has no stop function, the watchdog core will set WDOG_HW_RUNNING 161 If a driver has no stop function, the watchdog core will set WDOG_HW_RUNNING
155 and start calling the driver's keepalive pings function after the watchdog 162 and start calling the driver's keepalive pings function after the watchdog
156 device is closed. 163 device is closed.
164
157 If a watchdog driver does not implement the stop function, it must set 165 If a watchdog driver does not implement the stop function, it must set
158 max_hw_heartbeat_ms. 166 max_hw_heartbeat_ms.
159* ping: this is the routine that sends a keepalive ping to the watchdog timer 167* ping: this is the routine that sends a keepalive ping to the watchdog timer
160 hardware. 168 hardware.
169
161 The routine needs a pointer to the watchdog timer device structure as a 170 The routine needs a pointer to the watchdog timer device structure as a
162 parameter. It returns zero on success or a negative errno code for failure. 171 parameter. It returns zero on success or a negative errno code for failure.
172
163 Most hardware that does not support this as a separate function uses the 173 Most hardware that does not support this as a separate function uses the
164 start function to restart the watchdog timer hardware. And that's also what 174 start function to restart the watchdog timer hardware. And that's also what
165 the watchdog timer driver core does: to send a keepalive ping to the watchdog 175 the watchdog timer driver core does: to send a keepalive ping to the watchdog
166 timer hardware it will either use the ping operation (when available) or the 176 timer hardware it will either use the ping operation (when available) or the
167 start operation (when the ping operation is not available). 177 start operation (when the ping operation is not available).
178
168 (Note: the WDIOC_KEEPALIVE ioctl call will only be active when the 179 (Note: the WDIOC_KEEPALIVE ioctl call will only be active when the
169 WDIOF_KEEPALIVEPING bit has been set in the option field on the watchdog's 180 WDIOF_KEEPALIVEPING bit has been set in the option field on the watchdog's
170 info structure). 181 info structure).
171* status: this routine checks the status of the watchdog timer device. The 182* status: this routine checks the status of the watchdog timer device. The
172 status of the device is reported with watchdog WDIOF_* status flags/bits. 183 status of the device is reported with watchdog WDIOF_* status flags/bits.
184
173 WDIOF_MAGICCLOSE and WDIOF_KEEPALIVEPING are reported by the watchdog core; 185 WDIOF_MAGICCLOSE and WDIOF_KEEPALIVEPING are reported by the watchdog core;
174 it is not necessary to report those bits from the driver. Also, if no status 186 it is not necessary to report those bits from the driver. Also, if no status
175 function is provided by the driver, the watchdog core reports the status bits 187 function is provided by the driver, the watchdog core reports the status bits
176 provided in the bootstatus variable of struct watchdog_device. 188 provided in the bootstatus variable of struct watchdog_device.
189
177* set_timeout: this routine checks and changes the timeout of the watchdog 190* set_timeout: this routine checks and changes the timeout of the watchdog
178 timer device. It returns 0 on success, -EINVAL for "parameter out of range" 191 timer device. It returns 0 on success, -EINVAL for "parameter out of range"
179 and -EIO for "could not write value to the watchdog". On success this 192 and -EIO for "could not write value to the watchdog". On success this
180 routine should set the timeout value of the watchdog_device to the 193 routine should set the timeout value of the watchdog_device to the
181 achieved timeout value (which may be different from the requested one 194 achieved timeout value (which may be different from the requested one
182 because the watchdog does not necessarily have a 1 second resolution). 195 because the watchdog does not necessarily have a 1 second resolution).
196
183 Drivers implementing max_hw_heartbeat_ms set the hardware watchdog heartbeat 197 Drivers implementing max_hw_heartbeat_ms set the hardware watchdog heartbeat
184 to the minimum of timeout and max_hw_heartbeat_ms. Those drivers set the 198 to the minimum of timeout and max_hw_heartbeat_ms. Those drivers set the
185 timeout value of the watchdog_device either to the requested timeout value 199 timeout value of the watchdog_device either to the requested timeout value
186 (if it is larger than max_hw_heartbeat_ms), or to the achieved timeout value. 200 (if it is larger than max_hw_heartbeat_ms), or to the achieved timeout value.
187 (Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the 201 (Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the
188 watchdog's info structure). 202 watchdog's info structure).
203
189 If the watchdog driver does not have to perform any action but setting the 204 If the watchdog driver does not have to perform any action but setting the
190 watchdog_device.timeout, this callback can be omitted. 205 watchdog_device.timeout, this callback can be omitted.
206
191 If set_timeout is not provided but, WDIOF_SETTIMEOUT is set, the watchdog 207 If set_timeout is not provided but, WDIOF_SETTIMEOUT is set, the watchdog
192 infrastructure updates the timeout value of the watchdog_device internally 208 infrastructure updates the timeout value of the watchdog_device internally
193 to the requested value. 209 to the requested value.
210
194 If the pretimeout feature is used (WDIOF_PRETIMEOUT), then set_timeout must 211 If the pretimeout feature is used (WDIOF_PRETIMEOUT), then set_timeout must
195 also take care of checking if pretimeout is still valid and set up the timer 212 also take care of checking if pretimeout is still valid and set up the timer
196 accordingly. This can't be done in the core without races, so it is the 213 accordingly. This can't be done in the core without races, so it is the
@@ -201,13 +218,16 @@ they are supported. These optional routines/operations are:
201 seconds before the actual timeout would happen. It returns 0 on success, 218 seconds before the actual timeout would happen. It returns 0 on success,
202 -EINVAL for "parameter out of range" and -EIO for "could not write value to 219 -EINVAL for "parameter out of range" and -EIO for "could not write value to
203 the watchdog". A value of 0 disables pretimeout notification. 220 the watchdog". A value of 0 disables pretimeout notification.
221
204 (Note: the WDIOF_PRETIMEOUT needs to be set in the options field of the 222 (Note: the WDIOF_PRETIMEOUT needs to be set in the options field of the
205 watchdog's info structure). 223 watchdog's info structure).
224
206 If the watchdog driver does not have to perform any action but setting the 225 If the watchdog driver does not have to perform any action but setting the
207 watchdog_device.pretimeout, this callback can be omitted. That means if 226 watchdog_device.pretimeout, this callback can be omitted. That means if
208 set_pretimeout is not provided but WDIOF_PRETIMEOUT is set, the watchdog 227 set_pretimeout is not provided but WDIOF_PRETIMEOUT is set, the watchdog
209 infrastructure updates the pretimeout value of the watchdog_device internally 228 infrastructure updates the pretimeout value of the watchdog_device internally
210 to the requested value. 229 to the requested value.
230
211* get_timeleft: this routines returns the time that's left before a reset. 231* get_timeleft: this routines returns the time that's left before a reset.
212* restart: this routine restarts the machine. It returns 0 on success or a 232* restart: this routine restarts the machine. It returns 0 on success or a
213 negative errno code for failure. 233 negative errno code for failure.
@@ -218,6 +238,7 @@ they are supported. These optional routines/operations are:
218 238
219The status bits should (preferably) be set with the set_bit and clear_bit alike 239The status bits should (preferably) be set with the set_bit and clear_bit alike
220bit-operations. The status bits that are defined are: 240bit-operations. The status bits that are defined are:
241
221* WDOG_ACTIVE: this status bit indicates whether or not a watchdog timer device 242* WDOG_ACTIVE: this status bit indicates whether or not a watchdog timer device
222 is active or not from user perspective. User space is expected to send 243 is active or not from user perspective. User space is expected to send
223 heartbeat requests to the driver while this flag is set. 244 heartbeat requests to the driver while this flag is set.
@@ -235,22 +256,30 @@ bit-operations. The status bits that are defined are:
235 256
236 To set the WDOG_NO_WAY_OUT status bit (before registering your watchdog 257 To set the WDOG_NO_WAY_OUT status bit (before registering your watchdog
237 timer device) you can either: 258 timer device) you can either:
259
238 * set it statically in your watchdog_device struct with 260 * set it statically in your watchdog_device struct with
261
239 .status = WATCHDOG_NOWAYOUT_INIT_STATUS, 262 .status = WATCHDOG_NOWAYOUT_INIT_STATUS,
263
240 (this will set the value the same as CONFIG_WATCHDOG_NOWAYOUT) or 264 (this will set the value the same as CONFIG_WATCHDOG_NOWAYOUT) or
241 * use the following helper function: 265 * use the following helper function::
242 static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout) 266
267 static inline void watchdog_set_nowayout(struct watchdog_device *wdd,
268 int nowayout)
269
270Note:
271 The WatchDog Timer Driver Core supports the magic close feature and
272 the nowayout feature. To use the magic close feature you must set the
273 WDIOF_MAGICCLOSE bit in the options field of the watchdog's info structure.
243 274
244Note: The WatchDog Timer Driver Core supports the magic close feature and
245the nowayout feature. To use the magic close feature you must set the
246WDIOF_MAGICCLOSE bit in the options field of the watchdog's info structure.
247The nowayout feature will overrule the magic close feature. 275The nowayout feature will overrule the magic close feature.
248 276
249To get or set driver specific data the following two helper functions should be 277To get or set driver specific data the following two helper functions should be
250used: 278used::
251 279
252static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data) 280 static inline void watchdog_set_drvdata(struct watchdog_device *wdd,
253static inline void *watchdog_get_drvdata(struct watchdog_device *wdd) 281 void *data)
282 static inline void *watchdog_get_drvdata(struct watchdog_device *wdd)
254 283
255The watchdog_set_drvdata function allows you to add driver specific data. The 284The watchdog_set_drvdata function allows you to add driver specific data. The
256arguments of this function are the watchdog device where you want to add the 285arguments of this function are the watchdog device where you want to add the
@@ -260,10 +289,11 @@ The watchdog_get_drvdata function allows you to retrieve driver specific data.
260The argument of this function is the watchdog device where you want to retrieve 289The argument of this function is the watchdog device where you want to retrieve
261data from. The function returns the pointer to the driver specific data. 290data from. The function returns the pointer to the driver specific data.
262 291
263To initialize the timeout field, the following function can be used: 292To initialize the timeout field, the following function can be used::
264 293
265extern int watchdog_init_timeout(struct watchdog_device *wdd, 294 extern int watchdog_init_timeout(struct watchdog_device *wdd,
266 unsigned int timeout_parm, struct device *dev); 295 unsigned int timeout_parm,
296 struct device *dev);
267 297
268The watchdog_init_timeout function allows you to initialize the timeout field 298The watchdog_init_timeout function allows you to initialize the timeout field
269using the module timeout parameter or by retrieving the timeout-sec property from 299using the module timeout parameter or by retrieving the timeout-sec property from
@@ -272,30 +302,33 @@ to set the default timeout value as timeout value in the watchdog_device and
272then use this function to set the user "preferred" timeout value. 302then use this function to set the user "preferred" timeout value.
273This routine returns zero on success and a negative errno code for failure. 303This routine returns zero on success and a negative errno code for failure.
274 304
275To disable the watchdog on reboot, the user must call the following helper: 305To disable the watchdog on reboot, the user must call the following helper::
276 306
277static inline void watchdog_stop_on_reboot(struct watchdog_device *wdd); 307 static inline void watchdog_stop_on_reboot(struct watchdog_device *wdd);
278 308
279To disable the watchdog when unregistering the watchdog, the user must call 309To disable the watchdog when unregistering the watchdog, the user must call
280the following helper. Note that this will only stop the watchdog if the 310the following helper. Note that this will only stop the watchdog if the
281nowayout flag is not set. 311nowayout flag is not set.
282 312
283static inline void watchdog_stop_on_unregister(struct watchdog_device *wdd); 313::
314
315 static inline void watchdog_stop_on_unregister(struct watchdog_device *wdd);
284 316
285To change the priority of the restart handler the following helper should be 317To change the priority of the restart handler the following helper should be
286used: 318used::
287 319
288void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority); 320 void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority);
289 321
290User should follow the following guidelines for setting the priority: 322User should follow the following guidelines for setting the priority:
323
291* 0: should be called in last resort, has limited restart capabilities 324* 0: should be called in last resort, has limited restart capabilities
292* 128: default restart handler, use if no other handler is expected to be 325* 128: default restart handler, use if no other handler is expected to be
293 available, and/or if restart is sufficient to restart the entire system 326 available, and/or if restart is sufficient to restart the entire system
294* 255: highest priority, will preempt all other restart handlers 327* 255: highest priority, will preempt all other restart handlers
295 328
296To raise a pretimeout notification, the following function should be used: 329To raise a pretimeout notification, the following function should be used::
297 330
298void watchdog_notify_pretimeout(struct watchdog_device *wdd) 331 void watchdog_notify_pretimeout(struct watchdog_device *wdd)
299 332
300The function can be called in the interrupt context. If watchdog pretimeout 333The function can be called in the interrupt context. If watchdog pretimeout
301governor framework (kbuild CONFIG_WATCHDOG_PRETIMEOUT_GOV symbol) is enabled, 334governor framework (kbuild CONFIG_WATCHDOG_PRETIMEOUT_GOV symbol) is enabled,
diff --git a/Documentation/watchdog/watchdog-parameters.rst b/Documentation/watchdog/watchdog-parameters.rst
new file mode 100644
index 000000000000..b121caae7798
--- /dev/null
+++ b/Documentation/watchdog/watchdog-parameters.rst
@@ -0,0 +1,736 @@
1==========================
2WatchDog Module Parameters
3==========================
4
5This file provides information on the module parameters of many of
6the Linux watchdog drivers. Watchdog driver parameter specs should
7be listed here unless the driver has its own driver-specific information
8file.
9
10See Documentation/admin-guide/kernel-parameters.rst for information on
11providing kernel parameters for builtin drivers versus loadable
12modules.
13
14-------------------------------------------------
15
16acquirewdt:
17 wdt_stop:
18 Acquire WDT 'stop' io port (default 0x43)
19 wdt_start:
20 Acquire WDT 'start' io port (default 0x443)
21 nowayout:
22 Watchdog cannot be stopped once started
23 (default=kernel config parameter)
24
25-------------------------------------------------
26
27advantechwdt:
28 wdt_stop:
29 Advantech WDT 'stop' io port (default 0x443)
30 wdt_start:
31 Advantech WDT 'start' io port (default 0x443)
32 timeout:
33 Watchdog timeout in seconds. 1<= timeout <=63, default=60.
34 nowayout:
35 Watchdog cannot be stopped once started
36 (default=kernel config parameter)
37
38-------------------------------------------------
39
40alim1535_wdt:
41 timeout:
42 Watchdog timeout in seconds. (0 < timeout < 18000, default=60
43 nowayout:
44 Watchdog cannot be stopped once started
45 (default=kernel config parameter)
46
47-------------------------------------------------
48
49alim7101_wdt:
50 timeout:
51 Watchdog timeout in seconds. (1<=timeout<=3600, default=30
52 use_gpio:
53 Use the gpio watchdog (required by old cobalt boards).
54 default=0/off/no
55 nowayout:
56 Watchdog cannot be stopped once started
57 (default=kernel config parameter)
58
59-------------------------------------------------
60
61ar7_wdt:
62 margin:
63 Watchdog margin in seconds (default=60)
64 nowayout:
65 Disable watchdog shutdown on close
66 (default=kernel config parameter)
67
68-------------------------------------------------
69
70armada_37xx_wdt:
71 timeout:
72 Watchdog timeout in seconds. (default=120)
73 nowayout:
74 Disable watchdog shutdown on close
75 (default=kernel config parameter)
76
77-------------------------------------------------
78
79at91rm9200_wdt:
80 wdt_time:
81 Watchdog time in seconds. (default=5)
82 nowayout:
83 Watchdog cannot be stopped once started
84 (default=kernel config parameter)
85
86-------------------------------------------------
87
88at91sam9_wdt:
89 heartbeat:
90 Watchdog heartbeats in seconds. (default = 15)
91 nowayout:
92 Watchdog cannot be stopped once started
93 (default=kernel config parameter)
94
95-------------------------------------------------
96
97bcm47xx_wdt:
98 wdt_time:
99 Watchdog time in seconds. (default=30)
100 nowayout:
101 Watchdog cannot be stopped once started
102 (default=kernel config parameter)
103
104-------------------------------------------------
105
106coh901327_wdt:
107 margin:
108 Watchdog margin in seconds (default 60s)
109
110-------------------------------------------------
111
112cpu5wdt:
113 port:
114 base address of watchdog card, default is 0x91
115 verbose:
116 be verbose, default is 0 (no)
117 ticks:
118 count down ticks, default is 10000
119
120-------------------------------------------------
121
122cpwd:
123 wd0_timeout:
124 Default watchdog0 timeout in 1/10secs
125 wd1_timeout:
126 Default watchdog1 timeout in 1/10secs
127 wd2_timeout:
128 Default watchdog2 timeout in 1/10secs
129
130-------------------------------------------------
131
132da9052wdt:
133 timeout:
134 Watchdog timeout in seconds. 2<= timeout <=131, default=2.048s
135 nowayout:
136 Watchdog cannot be stopped once started
137 (default=kernel config parameter)
138
139-------------------------------------------------
140
141davinci_wdt:
142 heartbeat:
143 Watchdog heartbeat period in seconds from 1 to 600, default 60
144
145-------------------------------------------------
146
147ebc-c384_wdt:
148 timeout:
149 Watchdog timeout in seconds. (1<=timeout<=15300, default=60)
150 nowayout:
151 Watchdog cannot be stopped once started
152
153-------------------------------------------------
154
155ep93xx_wdt:
156 nowayout:
157 Watchdog cannot be stopped once started
158 timeout:
159 Watchdog timeout in seconds. (1<=timeout<=3600, default=TBD)
160
161-------------------------------------------------
162
163eurotechwdt:
164 nowayout:
165 Watchdog cannot be stopped once started
166 (default=kernel config parameter)
167 io:
168 Eurotech WDT io port (default=0x3f0)
169 irq:
170 Eurotech WDT irq (default=10)
171 ev:
172 Eurotech WDT event type (default is `int`)
173
174-------------------------------------------------
175
176gef_wdt:
177 nowayout:
178 Watchdog cannot be stopped once started
179 (default=kernel config parameter)
180
181-------------------------------------------------
182
183geodewdt:
184 timeout:
185 Watchdog timeout in seconds. 1<= timeout <=131, default=60.
186 nowayout:
187 Watchdog cannot be stopped once started
188 (default=kernel config parameter)
189
190-------------------------------------------------
191
192i6300esb:
193 heartbeat:
194 Watchdog heartbeat in seconds. (1<heartbeat<2046, default=30)
195 nowayout:
196 Watchdog cannot be stopped once started
197 (default=kernel config parameter)
198
199-------------------------------------------------
200
201iTCO_wdt:
202 heartbeat:
203 Watchdog heartbeat in seconds.
204 (2<heartbeat<39 (TCO v1) or 613 (TCO v2), default=30)
205 nowayout:
206 Watchdog cannot be stopped once started
207 (default=kernel config parameter)
208
209-------------------------------------------------
210
211iTCO_vendor_support:
212 vendorsupport:
213 iTCO vendor specific support mode, default=0 (none),
214 1=SuperMicro Pent3, 2=SuperMicro Pent4+, 911=Broken SMI BIOS
215
216-------------------------------------------------
217
218ib700wdt:
219 timeout:
220 Watchdog timeout in seconds. 0<= timeout <=30, default=30.
221 nowayout:
222 Watchdog cannot be stopped once started
223 (default=kernel config parameter)
224
225-------------------------------------------------
226
227ibmasr:
228 nowayout:
229 Watchdog cannot be stopped once started
230 (default=kernel config parameter)
231
232-------------------------------------------------
233
234imx2_wdt:
235 timeout:
236 Watchdog timeout in seconds (default 60 s)
237 nowayout:
238 Watchdog cannot be stopped once started
239 (default=kernel config parameter)
240
241-------------------------------------------------
242
243indydog:
244 nowayout:
245 Watchdog cannot be stopped once started
246 (default=kernel config parameter)
247
248-------------------------------------------------
249
250iop_wdt:
251 nowayout:
252 Watchdog cannot be stopped once started
253 (default=kernel config parameter)
254
255-------------------------------------------------
256
257it8712f_wdt:
258 margin:
259 Watchdog margin in seconds (default 60)
260 nowayout:
261 Disable watchdog shutdown on close
262 (default=kernel config parameter)
263
264-------------------------------------------------
265
266it87_wdt:
267 nogameport:
268 Forbid the activation of game port, default=0
269 nocir:
270 Forbid the use of CIR (workaround for some buggy setups); set to 1 if
271system resets despite watchdog daemon running, default=0
272 exclusive:
273 Watchdog exclusive device open, default=1
274 timeout:
275 Watchdog timeout in seconds, default=60
276 testmode:
277 Watchdog test mode (1 = no reboot), default=0
278 nowayout:
279 Watchdog cannot be stopped once started
280 (default=kernel config parameter)
281
282-------------------------------------------------
283
284ixp4xx_wdt:
285 heartbeat:
286 Watchdog heartbeat in seconds (default 60s)
287 nowayout:
288 Watchdog cannot be stopped once started
289 (default=kernel config parameter)
290
291-------------------------------------------------
292
293ks8695_wdt:
294 wdt_time:
295 Watchdog time in seconds. (default=5)
296 nowayout:
297 Watchdog cannot be stopped once started
298 (default=kernel config parameter)
299
300-------------------------------------------------
301
302machzwd:
303 nowayout:
304 Watchdog cannot be stopped once started
305 (default=kernel config parameter)
306 action:
307 after watchdog resets, generate:
308 0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI
309
310-------------------------------------------------
311
312max63xx_wdt:
313 heartbeat:
314 Watchdog heartbeat period in seconds from 1 to 60, default 60
315 nowayout:
316 Watchdog cannot be stopped once started
317 (default=kernel config parameter)
318 nodelay:
319 Force selection of a timeout setting without initial delay
320 (max6373/74 only, default=0)
321
322-------------------------------------------------
323
324mixcomwd:
325 nowayout:
326 Watchdog cannot be stopped once started
327 (default=kernel config parameter)
328
329-------------------------------------------------
330
331mpc8xxx_wdt:
332 timeout:
333 Watchdog timeout in ticks. (0<timeout<65536, default=65535)
334 reset:
335 Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset
336 nowayout:
337 Watchdog cannot be stopped once started
338 (default=kernel config parameter)
339
340-------------------------------------------------
341
342mv64x60_wdt:
343 nowayout:
344 Watchdog cannot be stopped once started
345 (default=kernel config parameter)
346
347-------------------------------------------------
348
349ni903x_wdt:
350 timeout:
351 Initial watchdog timeout in seconds (0<timeout<516, default=60)
352 nowayout:
353 Watchdog cannot be stopped once started
354 (default=kernel config parameter)
355
356-------------------------------------------------
357
358nic7018_wdt:
359 timeout:
360 Initial watchdog timeout in seconds (0<timeout<464, default=80)
361 nowayout:
362 Watchdog cannot be stopped once started
363 (default=kernel config parameter)
364
365-------------------------------------------------
366
367nuc900_wdt:
368 heartbeat:
369 Watchdog heartbeats in seconds.
370 (default = 15)
371 nowayout:
372 Watchdog cannot be stopped once started
373 (default=kernel config parameter)
374
375-------------------------------------------------
376
377omap_wdt:
378 timer_margin:
379 initial watchdog timeout (in seconds)
380 early_enable:
381 Watchdog is started on module insertion (default=0
382 nowayout:
383 Watchdog cannot be stopped once started
384 (default=kernel config parameter)
385
386-------------------------------------------------
387
388orion_wdt:
389 heartbeat:
390 Initial watchdog heartbeat in seconds
391 nowayout:
392 Watchdog cannot be stopped once started
393 (default=kernel config parameter)
394
395-------------------------------------------------
396
397pc87413_wdt:
398 io:
399 pc87413 WDT I/O port (default: io).
400 timeout:
401 Watchdog timeout in minutes (default=timeout).
402 nowayout:
403 Watchdog cannot be stopped once started
404 (default=kernel config parameter)
405
406-------------------------------------------------
407
408pika_wdt:
409 heartbeat:
410 Watchdog heartbeats in seconds. (default = 15)
411 nowayout:
412 Watchdog cannot be stopped once started
413 (default=kernel config parameter)
414
415-------------------------------------------------
416
417pnx4008_wdt:
418 heartbeat:
419 Watchdog heartbeat period in seconds from 1 to 60, default 19
420 nowayout:
421 Set to 1 to keep watchdog running after device release
422
423-------------------------------------------------
424
425pnx833x_wdt:
426 timeout:
427 Watchdog timeout in Mhz. (68Mhz clock), default=2040000000 (30 seconds)
428 nowayout:
429 Watchdog cannot be stopped once started
430 (default=kernel config parameter)
431 start_enabled:
432 Watchdog is started on module insertion (default=1)
433
434-------------------------------------------------
435
436rc32434_wdt:
437 timeout:
438 Watchdog timeout value, in seconds (default=20)
439 nowayout:
440 Watchdog cannot be stopped once started
441 (default=kernel config parameter)
442
443-------------------------------------------------
444
445riowd:
446 riowd_timeout:
447 Watchdog timeout in minutes (default=1)
448
449-------------------------------------------------
450
451s3c2410_wdt:
452 tmr_margin:
453 Watchdog tmr_margin in seconds. (default=15)
454 tmr_atboot:
455 Watchdog is started at boot time if set to 1, default=0
456 nowayout:
457 Watchdog cannot be stopped once started
458 (default=kernel config parameter)
459 soft_noboot:
460 Watchdog action, set to 1 to ignore reboots, 0 to reboot
461 debug:
462 Watchdog debug, set to >1 for debug, (default 0)
463
464-------------------------------------------------
465
466sa1100_wdt:
467 margin:
468 Watchdog margin in seconds (default 60s)
469
470-------------------------------------------------
471
472sb_wdog:
473 timeout:
474 Watchdog timeout in microseconds (max/default 8388607 or 8.3ish secs)
475
476-------------------------------------------------
477
478sbc60xxwdt:
479 wdt_stop:
480 SBC60xx WDT 'stop' io port (default 0x45)
481 wdt_start:
482 SBC60xx WDT 'start' io port (default 0x443)
483 timeout:
484 Watchdog timeout in seconds. (1<=timeout<=3600, default=30)
485 nowayout:
486 Watchdog cannot be stopped once started
487 (default=kernel config parameter)
488
489-------------------------------------------------
490
491sbc7240_wdt:
492 timeout:
493 Watchdog timeout in seconds. (1<=timeout<=255, default=30)
494 nowayout:
495 Disable watchdog when closing device file
496
497-------------------------------------------------
498
499sbc8360:
500 timeout:
501 Index into timeout table (0-63) (default=27 (60s))
502 nowayout:
503 Watchdog cannot be stopped once started
504 (default=kernel config parameter)
505
506-------------------------------------------------
507
508sbc_epx_c3:
509 nowayout:
510 Watchdog cannot be stopped once started
511 (default=kernel config parameter)
512
513-------------------------------------------------
514
515sbc_fitpc2_wdt:
516 margin:
517 Watchdog margin in seconds (default 60s)
518 nowayout:
519 Watchdog cannot be stopped once started
520
521-------------------------------------------------
522
523sbsa_gwdt:
524 timeout:
525 Watchdog timeout in seconds. (default 10s)
526 action:
527 Watchdog action at the first stage timeout,
528 set to 0 to ignore, 1 to panic. (default=0)
529 nowayout:
530 Watchdog cannot be stopped once started
531 (default=kernel config parameter)
532
533-------------------------------------------------
534
535sc1200wdt:
536 isapnp:
537 When set to 0 driver ISA PnP support will be disabled (default=1)
538 io:
539 io port
540 timeout:
541 range is 0-255 minutes, default is 1
542 nowayout:
543 Watchdog cannot be stopped once started
544 (default=kernel config parameter)
545
546-------------------------------------------------
547
548sc520_wdt:
549 timeout:
550 Watchdog timeout in seconds. (1 <= timeout <= 3600, default=30)
551 nowayout:
552 Watchdog cannot be stopped once started
553 (default=kernel config parameter)
554
555-------------------------------------------------
556
557sch311x_wdt:
558 force_id:
559 Override the detected device ID
560 therm_trip:
561 Should a ThermTrip trigger the reset generator
562 timeout:
563 Watchdog timeout in seconds. 1<= timeout <=15300, default=60
564 nowayout:
565 Watchdog cannot be stopped once started
566 (default=kernel config parameter)
567
568-------------------------------------------------
569
570scx200_wdt:
571 margin:
572 Watchdog margin in seconds
573 nowayout:
574 Disable watchdog shutdown on close
575
576-------------------------------------------------
577
578shwdt:
579 clock_division_ratio:
580 Clock division ratio. Valid ranges are from 0x5 (1.31ms)
581 to 0x7 (5.25ms). (default=7)
582 heartbeat:
583 Watchdog heartbeat in seconds. (1 <= heartbeat <= 3600, default=30
584 nowayout:
585 Watchdog cannot be stopped once started
586 (default=kernel config parameter)
587
588-------------------------------------------------
589
590smsc37b787_wdt:
591 timeout:
592 range is 1-255 units, default is 60
593 nowayout:
594 Watchdog cannot be stopped once started
595 (default=kernel config parameter)
596
597-------------------------------------------------
598
599softdog:
600 soft_margin:
601 Watchdog soft_margin in seconds.
602 (0 < soft_margin < 65536, default=60)
603 nowayout:
604 Watchdog cannot be stopped once started
605 (default=kernel config parameter)
606 soft_noboot:
607 Softdog action, set to 1 to ignore reboots, 0 to reboot
608 (default=0)
609
610-------------------------------------------------
611
612stmp3xxx_wdt:
613 heartbeat:
614 Watchdog heartbeat period in seconds from 1 to 4194304, default 19
615
616-------------------------------------------------
617
618tegra_wdt:
619 heartbeat:
620 Watchdog heartbeats in seconds. (default = 120)
621 nowayout:
622 Watchdog cannot be stopped once started
623 (default=kernel config parameter)
624
625-------------------------------------------------
626
627ts72xx_wdt:
628 timeout:
629 Watchdog timeout in seconds. (1 <= timeout <= 8, default=8)
630 nowayout:
631 Disable watchdog shutdown on close
632
633-------------------------------------------------
634
635twl4030_wdt:
636 nowayout:
637 Watchdog cannot be stopped once started
638 (default=kernel config parameter)
639
640-------------------------------------------------
641
642txx9wdt:
643 timeout:
644 Watchdog timeout in seconds. (0<timeout<N, default=60)
645 nowayout:
646 Watchdog cannot be stopped once started
647 (default=kernel config parameter)
648
649-------------------------------------------------
650
651uniphier_wdt:
652 timeout:
653 Watchdog timeout in power of two seconds.
654 (1 <= timeout <= 128, default=64)
655 nowayout:
656 Watchdog cannot be stopped once started
657 (default=kernel config parameter)
658
659-------------------------------------------------
660
661w83627hf_wdt:
662 wdt_io:
663 w83627hf/thf WDT io port (default 0x2E)
664 timeout:
665 Watchdog timeout in seconds. 1 <= timeout <= 255, default=60.
666 nowayout:
667 Watchdog cannot be stopped once started
668 (default=kernel config parameter)
669
670-------------------------------------------------
671
672w83877f_wdt:
673 timeout:
674 Watchdog timeout in seconds. (1<=timeout<=3600, default=30)
675 nowayout:
676 Watchdog cannot be stopped once started
677 (default=kernel config parameter)
678
679-------------------------------------------------
680
681w83977f_wdt:
682 timeout:
683 Watchdog timeout in seconds (15..7635), default=45)
684 testmode:
685 Watchdog testmode (1 = no reboot), default=0
686 nowayout:
687 Watchdog cannot be stopped once started
688 (default=kernel config parameter)
689
690-------------------------------------------------
691
692wafer5823wdt:
693 timeout:
694 Watchdog timeout in seconds. 1 <= timeout <= 255, default=60.
695 nowayout:
696 Watchdog cannot be stopped once started
697 (default=kernel config parameter)
698
699-------------------------------------------------
700
701wdt285:
702 soft_margin:
703 Watchdog timeout in seconds (default=60)
704
705-------------------------------------------------
706
707wdt977:
708 timeout:
709 Watchdog timeout in seconds (60..15300, default=60)
710 testmode:
711 Watchdog testmode (1 = no reboot), default=0
712 nowayout:
713 Watchdog cannot be stopped once started
714 (default=kernel config parameter)
715
716-------------------------------------------------
717
718wm831x_wdt:
719 nowayout:
720 Watchdog cannot be stopped once started
721 (default=kernel config parameter)
722
723-------------------------------------------------
724
725wm8350_wdt:
726 nowayout:
727 Watchdog cannot be stopped once started
728 (default=kernel config parameter)
729
730-------------------------------------------------
731
732sun4v_wdt:
733 timeout_ms:
734 Watchdog timeout in milliseconds 1..180000, default=60000)
735 nowayout:
736 Watchdog cannot be stopped once started
diff --git a/Documentation/watchdog/watchdog-parameters.txt b/Documentation/watchdog/watchdog-parameters.txt
deleted file mode 100644
index 0b88e333f9e1..000000000000
--- a/Documentation/watchdog/watchdog-parameters.txt
+++ /dev/null
@@ -1,410 +0,0 @@
1This file provides information on the module parameters of many of
2the Linux watchdog drivers. Watchdog driver parameter specs should
3be listed here unless the driver has its own driver-specific information
4file.
5
6
7See Documentation/admin-guide/kernel-parameters.rst for information on
8providing kernel parameters for builtin drivers versus loadable
9modules.
10
11
12-------------------------------------------------
13acquirewdt:
14wdt_stop: Acquire WDT 'stop' io port (default 0x43)
15wdt_start: Acquire WDT 'start' io port (default 0x443)
16nowayout: Watchdog cannot be stopped once started
17 (default=kernel config parameter)
18-------------------------------------------------
19advantechwdt:
20wdt_stop: Advantech WDT 'stop' io port (default 0x443)
21wdt_start: Advantech WDT 'start' io port (default 0x443)
22timeout: Watchdog timeout in seconds. 1<= timeout <=63, default=60.
23nowayout: Watchdog cannot be stopped once started
24 (default=kernel config parameter)
25-------------------------------------------------
26alim1535_wdt:
27timeout: Watchdog timeout in seconds. (0 < timeout < 18000, default=60
28nowayout: Watchdog cannot be stopped once started
29 (default=kernel config parameter)
30-------------------------------------------------
31alim7101_wdt:
32timeout: Watchdog timeout in seconds. (1<=timeout<=3600, default=30
33use_gpio: Use the gpio watchdog (required by old cobalt boards).
34 default=0/off/no
35nowayout: Watchdog cannot be stopped once started
36 (default=kernel config parameter)
37-------------------------------------------------
38ar7_wdt:
39margin: Watchdog margin in seconds (default=60)
40nowayout: Disable watchdog shutdown on close
41 (default=kernel config parameter)
42-------------------------------------------------
43armada_37xx_wdt:
44timeout: Watchdog timeout in seconds. (default=120)
45nowayout: Disable watchdog shutdown on close
46 (default=kernel config parameter)
47-------------------------------------------------
48at91rm9200_wdt:
49wdt_time: Watchdog time in seconds. (default=5)
50nowayout: Watchdog cannot be stopped once started
51 (default=kernel config parameter)
52-------------------------------------------------
53at91sam9_wdt:
54heartbeat: Watchdog heartbeats in seconds. (default = 15)
55nowayout: Watchdog cannot be stopped once started
56 (default=kernel config parameter)
57-------------------------------------------------
58bcm47xx_wdt:
59wdt_time: Watchdog time in seconds. (default=30)
60nowayout: Watchdog cannot be stopped once started
61 (default=kernel config parameter)
62-------------------------------------------------
63coh901327_wdt:
64margin: Watchdog margin in seconds (default 60s)
65-------------------------------------------------
66cpu5wdt:
67port: base address of watchdog card, default is 0x91
68verbose: be verbose, default is 0 (no)
69ticks: count down ticks, default is 10000
70-------------------------------------------------
71cpwd:
72wd0_timeout: Default watchdog0 timeout in 1/10secs
73wd1_timeout: Default watchdog1 timeout in 1/10secs
74wd2_timeout: Default watchdog2 timeout in 1/10secs
75-------------------------------------------------
76da9052wdt:
77timeout: Watchdog timeout in seconds. 2<= timeout <=131, default=2.048s
78nowayout: Watchdog cannot be stopped once started
79 (default=kernel config parameter)
80-------------------------------------------------
81davinci_wdt:
82heartbeat: Watchdog heartbeat period in seconds from 1 to 600, default 60
83-------------------------------------------------
84ebc-c384_wdt:
85timeout: Watchdog timeout in seconds. (1<=timeout<=15300, default=60)
86nowayout: Watchdog cannot be stopped once started
87-------------------------------------------------
88ep93xx_wdt:
89nowayout: Watchdog cannot be stopped once started
90timeout: Watchdog timeout in seconds. (1<=timeout<=3600, default=TBD)
91-------------------------------------------------
92eurotechwdt:
93nowayout: Watchdog cannot be stopped once started
94 (default=kernel config parameter)
95io: Eurotech WDT io port (default=0x3f0)
96irq: Eurotech WDT irq (default=10)
97ev: Eurotech WDT event type (default is `int')
98-------------------------------------------------
99gef_wdt:
100nowayout: Watchdog cannot be stopped once started
101 (default=kernel config parameter)
102-------------------------------------------------
103geodewdt:
104timeout: Watchdog timeout in seconds. 1<= timeout <=131, default=60.
105nowayout: Watchdog cannot be stopped once started
106 (default=kernel config parameter)
107-------------------------------------------------
108i6300esb:
109heartbeat: Watchdog heartbeat in seconds. (1<heartbeat<2046, default=30)
110nowayout: Watchdog cannot be stopped once started
111 (default=kernel config parameter)
112-------------------------------------------------
113iTCO_wdt:
114heartbeat: Watchdog heartbeat in seconds.
115 (2<heartbeat<39 (TCO v1) or 613 (TCO v2), default=30)
116nowayout: Watchdog cannot be stopped once started
117 (default=kernel config parameter)
118-------------------------------------------------
119iTCO_vendor_support:
120vendorsupport: iTCO vendor specific support mode, default=0 (none),
121 1=SuperMicro Pent3, 2=SuperMicro Pent4+, 911=Broken SMI BIOS
122-------------------------------------------------
123ib700wdt:
124timeout: Watchdog timeout in seconds. 0<= timeout <=30, default=30.
125nowayout: Watchdog cannot be stopped once started
126 (default=kernel config parameter)
127-------------------------------------------------
128ibmasr:
129nowayout: Watchdog cannot be stopped once started
130 (default=kernel config parameter)
131-------------------------------------------------
132imx2_wdt:
133timeout: Watchdog timeout in seconds (default 60 s)
134nowayout: Watchdog cannot be stopped once started
135 (default=kernel config parameter)
136-------------------------------------------------
137indydog:
138nowayout: Watchdog cannot be stopped once started
139 (default=kernel config parameter)
140-------------------------------------------------
141iop_wdt:
142nowayout: Watchdog cannot be stopped once started
143 (default=kernel config parameter)
144-------------------------------------------------
145it8712f_wdt:
146margin: Watchdog margin in seconds (default 60)
147nowayout: Disable watchdog shutdown on close
148 (default=kernel config parameter)
149-------------------------------------------------
150it87_wdt:
151nogameport: Forbid the activation of game port, default=0
152nocir: Forbid the use of CIR (workaround for some buggy setups); set to 1 if
153system resets despite watchdog daemon running, default=0
154exclusive: Watchdog exclusive device open, default=1
155timeout: Watchdog timeout in seconds, default=60
156testmode: Watchdog test mode (1 = no reboot), default=0
157nowayout: Watchdog cannot be stopped once started
158 (default=kernel config parameter)
159-------------------------------------------------
160ixp4xx_wdt:
161heartbeat: Watchdog heartbeat in seconds (default 60s)
162nowayout: Watchdog cannot be stopped once started
163 (default=kernel config parameter)
164-------------------------------------------------
165ks8695_wdt:
166wdt_time: Watchdog time in seconds. (default=5)
167nowayout: Watchdog cannot be stopped once started
168 (default=kernel config parameter)
169-------------------------------------------------
170machzwd:
171nowayout: Watchdog cannot be stopped once started
172 (default=kernel config parameter)
173action: after watchdog resets, generate:
174 0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI
175-------------------------------------------------
176max63xx_wdt:
177heartbeat: Watchdog heartbeat period in seconds from 1 to 60, default 60
178nowayout: Watchdog cannot be stopped once started
179 (default=kernel config parameter)
180nodelay: Force selection of a timeout setting without initial delay
181 (max6373/74 only, default=0)
182-------------------------------------------------
183mixcomwd:
184nowayout: Watchdog cannot be stopped once started
185 (default=kernel config parameter)
186-------------------------------------------------
187mpc8xxx_wdt:
188timeout: Watchdog timeout in ticks. (0<timeout<65536, default=65535)
189reset: Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset
190nowayout: Watchdog cannot be stopped once started
191 (default=kernel config parameter)
192-------------------------------------------------
193mv64x60_wdt:
194nowayout: Watchdog cannot be stopped once started
195 (default=kernel config parameter)
196-------------------------------------------------
197ni903x_wdt:
198timeout: Initial watchdog timeout in seconds (0<timeout<516, default=60)
199nowayout: Watchdog cannot be stopped once started
200 (default=kernel config parameter)
201-------------------------------------------------
202nic7018_wdt:
203timeout: Initial watchdog timeout in seconds (0<timeout<464, default=80)
204nowayout: Watchdog cannot be stopped once started
205 (default=kernel config parameter)
206-------------------------------------------------
207nuc900_wdt:
208heartbeat: Watchdog heartbeats in seconds.
209 (default = 15)
210nowayout: Watchdog cannot be stopped once started
211 (default=kernel config parameter)
212-------------------------------------------------
213omap_wdt:
214timer_margin: initial watchdog timeout (in seconds)
215early_enable: Watchdog is started on module insertion (default=0
216nowayout: Watchdog cannot be stopped once started
217 (default=kernel config parameter)
218-------------------------------------------------
219orion_wdt:
220heartbeat: Initial watchdog heartbeat in seconds
221nowayout: Watchdog cannot be stopped once started
222 (default=kernel config parameter)
223-------------------------------------------------
224pc87413_wdt:
225io: pc87413 WDT I/O port (default: io).
226timeout: Watchdog timeout in minutes (default=timeout).
227nowayout: Watchdog cannot be stopped once started
228 (default=kernel config parameter)
229-------------------------------------------------
230pika_wdt:
231heartbeat: Watchdog heartbeats in seconds. (default = 15)
232nowayout: Watchdog cannot be stopped once started
233 (default=kernel config parameter)
234-------------------------------------------------
235pnx4008_wdt:
236heartbeat: Watchdog heartbeat period in seconds from 1 to 60, default 19
237nowayout: Set to 1 to keep watchdog running after device release
238-------------------------------------------------
239pnx833x_wdt:
240timeout: Watchdog timeout in Mhz. (68Mhz clock), default=2040000000 (30 seconds)
241nowayout: Watchdog cannot be stopped once started
242 (default=kernel config parameter)
243start_enabled: Watchdog is started on module insertion (default=1)
244-------------------------------------------------
245rc32434_wdt:
246timeout: Watchdog timeout value, in seconds (default=20)
247nowayout: Watchdog cannot be stopped once started
248 (default=kernel config parameter)
249-------------------------------------------------
250riowd:
251riowd_timeout: Watchdog timeout in minutes (default=1)
252-------------------------------------------------
253s3c2410_wdt:
254tmr_margin: Watchdog tmr_margin in seconds. (default=15)
255tmr_atboot: Watchdog is started at boot time if set to 1, default=0
256nowayout: Watchdog cannot be stopped once started
257 (default=kernel config parameter)
258soft_noboot: Watchdog action, set to 1 to ignore reboots, 0 to reboot
259debug: Watchdog debug, set to >1 for debug, (default 0)
260-------------------------------------------------
261sa1100_wdt:
262margin: Watchdog margin in seconds (default 60s)
263-------------------------------------------------
264sb_wdog:
265timeout: Watchdog timeout in microseconds (max/default 8388607 or 8.3ish secs)
266-------------------------------------------------
267sbc60xxwdt:
268wdt_stop: SBC60xx WDT 'stop' io port (default 0x45)
269wdt_start: SBC60xx WDT 'start' io port (default 0x443)
270timeout: Watchdog timeout in seconds. (1<=timeout<=3600, default=30)
271nowayout: Watchdog cannot be stopped once started
272 (default=kernel config parameter)
273-------------------------------------------------
274sbc7240_wdt:
275timeout: Watchdog timeout in seconds. (1<=timeout<=255, default=30)
276nowayout: Disable watchdog when closing device file
277-------------------------------------------------
278sbc8360:
279timeout: Index into timeout table (0-63) (default=27 (60s))
280nowayout: Watchdog cannot be stopped once started
281 (default=kernel config parameter)
282-------------------------------------------------
283sbc_epx_c3:
284nowayout: Watchdog cannot be stopped once started
285 (default=kernel config parameter)
286-------------------------------------------------
287sbc_fitpc2_wdt:
288margin: Watchdog margin in seconds (default 60s)
289nowayout: Watchdog cannot be stopped once started
290-------------------------------------------------
291sbsa_gwdt:
292timeout: Watchdog timeout in seconds. (default 10s)
293action: Watchdog action at the first stage timeout,
294 set to 0 to ignore, 1 to panic. (default=0)
295nowayout: Watchdog cannot be stopped once started
296 (default=kernel config parameter)
297-------------------------------------------------
298sc1200wdt:
299isapnp: When set to 0 driver ISA PnP support will be disabled (default=1)
300io: io port
301timeout: range is 0-255 minutes, default is 1
302nowayout: Watchdog cannot be stopped once started
303 (default=kernel config parameter)
304-------------------------------------------------
305sc520_wdt:
306timeout: Watchdog timeout in seconds. (1 <= timeout <= 3600, default=30)
307nowayout: Watchdog cannot be stopped once started
308 (default=kernel config parameter)
309-------------------------------------------------
310sch311x_wdt:
311force_id: Override the detected device ID
312therm_trip: Should a ThermTrip trigger the reset generator
313timeout: Watchdog timeout in seconds. 1<= timeout <=15300, default=60
314nowayout: Watchdog cannot be stopped once started
315 (default=kernel config parameter)
316-------------------------------------------------
317scx200_wdt:
318margin: Watchdog margin in seconds
319nowayout: Disable watchdog shutdown on close
320-------------------------------------------------
321shwdt:
322clock_division_ratio: Clock division ratio. Valid ranges are from 0x5 (1.31ms)
323 to 0x7 (5.25ms). (default=7)
324heartbeat: Watchdog heartbeat in seconds. (1 <= heartbeat <= 3600, default=30
325nowayout: Watchdog cannot be stopped once started
326 (default=kernel config parameter)
327-------------------------------------------------
328smsc37b787_wdt:
329timeout: range is 1-255 units, default is 60
330nowayout: Watchdog cannot be stopped once started
331 (default=kernel config parameter)
332-------------------------------------------------
333softdog:
334soft_margin: Watchdog soft_margin in seconds.
335 (0 < soft_margin < 65536, default=60)
336nowayout: Watchdog cannot be stopped once started
337 (default=kernel config parameter)
338soft_noboot: Softdog action, set to 1 to ignore reboots, 0 to reboot
339 (default=0)
340-------------------------------------------------
341stmp3xxx_wdt:
342heartbeat: Watchdog heartbeat period in seconds from 1 to 4194304, default 19
343-------------------------------------------------
344tegra_wdt:
345heartbeat: Watchdog heartbeats in seconds. (default = 120)
346nowayout: Watchdog cannot be stopped once started
347 (default=kernel config parameter)
348-------------------------------------------------
349ts72xx_wdt:
350timeout: Watchdog timeout in seconds. (1 <= timeout <= 8, default=8)
351nowayout: Disable watchdog shutdown on close
352-------------------------------------------------
353twl4030_wdt:
354nowayout: Watchdog cannot be stopped once started
355 (default=kernel config parameter)
356-------------------------------------------------
357txx9wdt:
358timeout: Watchdog timeout in seconds. (0<timeout<N, default=60)
359nowayout: Watchdog cannot be stopped once started
360 (default=kernel config parameter)
361-------------------------------------------------
362uniphier_wdt:
363timeout: Watchdog timeout in power of two seconds.
364 (1 <= timeout <= 128, default=64)
365nowayout: Watchdog cannot be stopped once started
366 (default=kernel config parameter)
367-------------------------------------------------
368w83627hf_wdt:
369wdt_io: w83627hf/thf WDT io port (default 0x2E)
370timeout: Watchdog timeout in seconds. 1 <= timeout <= 255, default=60.
371nowayout: Watchdog cannot be stopped once started
372 (default=kernel config parameter)
373-------------------------------------------------
374w83877f_wdt:
375timeout: Watchdog timeout in seconds. (1<=timeout<=3600, default=30)
376nowayout: Watchdog cannot be stopped once started
377 (default=kernel config parameter)
378-------------------------------------------------
379w83977f_wdt:
380timeout: Watchdog timeout in seconds (15..7635), default=45)
381testmode: Watchdog testmode (1 = no reboot), default=0
382nowayout: Watchdog cannot be stopped once started
383 (default=kernel config parameter)
384-------------------------------------------------
385wafer5823wdt:
386timeout: Watchdog timeout in seconds. 1 <= timeout <= 255, default=60.
387nowayout: Watchdog cannot be stopped once started
388 (default=kernel config parameter)
389-------------------------------------------------
390wdt285:
391soft_margin: Watchdog timeout in seconds (default=60)
392-------------------------------------------------
393wdt977:
394timeout: Watchdog timeout in seconds (60..15300, default=60)
395testmode: Watchdog testmode (1 = no reboot), default=0
396nowayout: Watchdog cannot be stopped once started
397 (default=kernel config parameter)
398-------------------------------------------------
399wm831x_wdt:
400nowayout: Watchdog cannot be stopped once started
401 (default=kernel config parameter)
402-------------------------------------------------
403wm8350_wdt:
404nowayout: Watchdog cannot be stopped once started
405 (default=kernel config parameter)
406-------------------------------------------------
407sun4v_wdt:
408timeout_ms: Watchdog timeout in milliseconds 1..180000, default=60000)
409nowayout: Watchdog cannot be stopped once started
410-------------------------------------------------
diff --git a/Documentation/watchdog/watchdog-pm.txt b/Documentation/watchdog/watchdog-pm.rst
index 7a4dd46e0d24..646e1f28f31f 100644
--- a/Documentation/watchdog/watchdog-pm.txt
+++ b/Documentation/watchdog/watchdog-pm.rst
@@ -1,5 +1,7 @@
1===============================================
1The Linux WatchDog Timer Power Management Guide 2The Linux WatchDog Timer Power Management Guide
2=============================================== 3===============================================
4
3Last reviewed: 17-Dec-2018 5Last reviewed: 17-Dec-2018
4 6
5Wolfram Sang <wsa+renesas@sang-engineering.com> 7Wolfram Sang <wsa+renesas@sang-engineering.com>
@@ -16,4 +18,5 @@ On resume, a watchdog timer shall be reset to its selected value to give
16userspace enough time to resume. [1] [2] 18userspace enough time to resume. [1] [2]
17 19
18[1] https://patchwork.kernel.org/patch/10252209/ 20[1] https://patchwork.kernel.org/patch/10252209/
21
19[2] https://patchwork.kernel.org/patch/10711625/ 22[2] https://patchwork.kernel.org/patch/10711625/
diff --git a/Documentation/watchdog/wdt.txt b/Documentation/watchdog/wdt.rst
index ed2f0b860869..d97b0361535b 100644
--- a/Documentation/watchdog/wdt.txt
+++ b/Documentation/watchdog/wdt.rst
@@ -1,11 +1,14 @@
1============================================================
2WDT Watchdog Timer Interfaces For The Linux Operating System
3============================================================
4
1Last Reviewed: 10/05/2007 5Last Reviewed: 10/05/2007
2 6
3 WDT Watchdog Timer Interfaces For The Linux Operating System 7Alan Cox <alan@lxorguk.ukuu.org.uk>
4 Alan Cox <alan@lxorguk.ukuu.org.uk>
5 8
6 ICS WDT501-P 9 - ICS WDT501-P
7 ICS WDT501-P (no fan tachometer) 10 - ICS WDT501-P (no fan tachometer)
8 ICS WDT500-P 11 - ICS WDT500-P
9 12
10All the interfaces provide /dev/watchdog, which when open must be written 13All the interfaces provide /dev/watchdog, which when open must be written
11to within a timeout or the machine will reboot. Each write delays the reboot 14to within a timeout or the machine will reboot. Each write delays the reboot
@@ -21,19 +24,26 @@ degrees Fahrenheit. Each read returns a single byte giving the temperature.
21The third interface logs kernel messages on additional alert events. 24The third interface logs kernel messages on additional alert events.
22 25
23The ICS ISA-bus wdt card cannot be safely probed for. Instead you need to 26The ICS ISA-bus wdt card cannot be safely probed for. Instead you need to
24pass IO address and IRQ boot parameters. E.g.: 27pass IO address and IRQ boot parameters. E.g.::
28
25 wdt.io=0x240 wdt.irq=11 29 wdt.io=0x240 wdt.irq=11
26 30
27Other "wdt" driver parameters are: 31Other "wdt" driver parameters are:
32
33 =========== ======================================================
28 heartbeat Watchdog heartbeat in seconds (default 60) 34 heartbeat Watchdog heartbeat in seconds (default 60)
29 nowayout Watchdog cannot be stopped once started (kernel 35 nowayout Watchdog cannot be stopped once started (kernel
30 build parameter) 36 build parameter)
31 tachometer WDT501-P Fan Tachometer support (0=disable, default=0) 37 tachometer WDT501-P Fan Tachometer support (0=disable, default=0)
32 type WDT501-P Card type (500 or 501, default=500) 38 type WDT501-P Card type (500 or 501, default=500)
39 =========== ======================================================
33 40
34Features 41Features
35-------- 42--------
36 WDT501P WDT500P 43
44================ ======= =======
45 WDT501P WDT500P
46================ ======= =======
37Reboot Timer X X 47Reboot Timer X X
38External Reboot X X 48External Reboot X X
39I/O Port Monitor o o 49I/O Port Monitor o o
@@ -42,9 +52,12 @@ Fan Speed X o
42Power Under X o 52Power Under X o
43Power Over X o 53Power Over X o
44Overheat X o 54Overheat X o
55================ ======= =======
45 56
46The external event interfaces on the WDT boards are not currently supported. 57The external event interfaces on the WDT boards are not currently supported.
47Minor numbers are however allocated for it. 58Minor numbers are however allocated for it.
48 59
49 60
50Example Watchdog Driver: see samples/watchdog/watchdog-simple.c 61Example Watchdog Driver:
62
63 see samples/watchdog/watchdog-simple.c
diff --git a/Documentation/x86/index.rst b/Documentation/x86/index.rst
index ae36fc5fc649..f2de1b2d3ac7 100644
--- a/Documentation/x86/index.rst
+++ b/Documentation/x86/index.rst
@@ -19,7 +19,6 @@ x86-specific Documentation
19 tlb 19 tlb
20 mtrr 20 mtrr
21 pat 21 pat
22 protection-keys
23 intel_mpx 22 intel_mpx
24 amd-memory-encryption 23 amd-memory-encryption
25 pti 24 pti
diff --git a/Documentation/x86/resctrl_ui.rst b/Documentation/x86/resctrl_ui.rst
index 225cfd4daaee..5368cedfb530 100644
--- a/Documentation/x86/resctrl_ui.rst
+++ b/Documentation/x86/resctrl_ui.rst
@@ -40,7 +40,7 @@ mount options are:
40 Enable the MBA Software Controller(mba_sc) to specify MBA 40 Enable the MBA Software Controller(mba_sc) to specify MBA
41 bandwidth in MBps 41 bandwidth in MBps
42 42
43L2 and L3 CDP are controlled seperately. 43L2 and L3 CDP are controlled separately.
44 44
45RDT features are orthogonal. A particular system may support only 45RDT features are orthogonal. A particular system may support only
46monitoring, only control, or both monitoring and control. Cache 46monitoring, only control, or both monitoring and control. Cache
@@ -118,7 +118,7 @@ related to allocation:
118 Corresponding region is pseudo-locked. No 118 Corresponding region is pseudo-locked. No
119 sharing allowed. 119 sharing allowed.
120 120
121Memory bandwitdh(MB) subdirectory contains the following files 121Memory bandwidth(MB) subdirectory contains the following files
122with respect to allocation: 122with respect to allocation:
123 123
124"min_bandwidth": 124"min_bandwidth":
@@ -209,7 +209,7 @@ All groups contain the following files:
209 CPUs to/from this group. As with the tasks file a hierarchy is 209 CPUs to/from this group. As with the tasks file a hierarchy is
210 maintained where MON groups may only include CPUs owned by the 210 maintained where MON groups may only include CPUs owned by the
211 parent CTRL_MON group. 211 parent CTRL_MON group.
212 When the resouce group is in pseudo-locked mode this file will 212 When the resource group is in pseudo-locked mode this file will
213 only be readable, reflecting the CPUs associated with the 213 only be readable, reflecting the CPUs associated with the
214 pseudo-locked region. 214 pseudo-locked region.
215 215
@@ -342,7 +342,7 @@ For cache resources we describe the portion of the cache that is available
342for allocation using a bitmask. The maximum value of the mask is defined 342for allocation using a bitmask. The maximum value of the mask is defined
343by each cpu model (and may be different for different cache levels). It 343by each cpu model (and may be different for different cache levels). It
344is found using CPUID, but is also provided in the "info" directory of 344is found using CPUID, but is also provided in the "info" directory of
345the resctrl file system in "info/{resource}/cbm_mask". X86 hardware 345the resctrl file system in "info/{resource}/cbm_mask". Intel hardware
346requires that these masks have all the '1' bits in a contiguous block. So 346requires that these masks have all the '1' bits in a contiguous block. So
3470x3, 0x6 and 0xC are legal 4-bit masks with two bits set, but 0x5, 0x9 3470x3, 0x6 and 0xC are legal 4-bit masks with two bits set, but 0x5, 0x9
348and 0xA are not. On a system with a 20-bit mask each bit represents 5% 348and 0xA are not. On a system with a 20-bit mask each bit represents 5%
@@ -380,7 +380,7 @@ where L2 external is 10GBps (hence aggregate L2 external bandwidth is
380240GBps) and L3 external bandwidth is 100GBps. Now a workload with '20 380240GBps) and L3 external bandwidth is 100GBps. Now a workload with '20
381threads, having 50% bandwidth, each consuming 5GBps' consumes the max L3 381threads, having 50% bandwidth, each consuming 5GBps' consumes the max L3
382bandwidth of 100GBps although the percentage value specified is only 50% 382bandwidth of 100GBps although the percentage value specified is only 50%
383<< 100%. Hence increasing the bandwidth percentage will not yeild any 383<< 100%. Hence increasing the bandwidth percentage will not yield any
384more bandwidth. This is because although the L2 external bandwidth still 384more bandwidth. This is because although the L2 external bandwidth still
385has capacity, the L3 external bandwidth is fully used. Also note that 385has capacity, the L3 external bandwidth is fully used. Also note that
386this would be dependent on number of cores the benchmark is run on. 386this would be dependent on number of cores the benchmark is run on.
@@ -398,7 +398,7 @@ In order to mitigate this and make the interface more user friendly,
398resctrl added support for specifying the bandwidth in MBps as well. The 398resctrl added support for specifying the bandwidth in MBps as well. The
399kernel underneath would use a software feedback mechanism or a "Software 399kernel underneath would use a software feedback mechanism or a "Software
400Controller(mba_sc)" which reads the actual bandwidth using MBM counters 400Controller(mba_sc)" which reads the actual bandwidth using MBM counters
401and adjust the memowy bandwidth percentages to ensure:: 401and adjust the memory bandwidth percentages to ensure::
402 402
403 "actual bandwidth < user specified bandwidth". 403 "actual bandwidth < user specified bandwidth".
404 404
@@ -418,16 +418,22 @@ L3 schemata file details (CDP enabled via mount option to resctrl)
418When CDP is enabled L3 control is split into two separate resources 418When CDP is enabled L3 control is split into two separate resources
419so you can specify independent masks for code and data like this:: 419so you can specify independent masks for code and data like this::
420 420
421 L3data:<cache_id0>=<cbm>;<cache_id1>=<cbm>;... 421 L3DATA:<cache_id0>=<cbm>;<cache_id1>=<cbm>;...
422 L3code:<cache_id0>=<cbm>;<cache_id1>=<cbm>;... 422 L3CODE:<cache_id0>=<cbm>;<cache_id1>=<cbm>;...
423 423
424L2 schemata file details 424L2 schemata file details
425------------------------ 425------------------------
426L2 cache does not support code and data prioritization, so the 426CDP is supported at L2 using the 'cdpl2' mount option. The schemata
427schemata format is always:: 427format is either::
428 428
429 L2:<cache_id0>=<cbm>;<cache_id1>=<cbm>;... 429 L2:<cache_id0>=<cbm>;<cache_id1>=<cbm>;...
430 430
431or
432
433 L2DATA:<cache_id0>=<cbm>;<cache_id1>=<cbm>;...
434 L2CODE:<cache_id0>=<cbm>;<cache_id1>=<cbm>;...
435
436
431Memory bandwidth Allocation (default mode) 437Memory bandwidth Allocation (default mode)
432------------------------------------------ 438------------------------------------------
433 439
@@ -671,8 +677,8 @@ allocations can overlap or not. The allocations specifies the maximum
671b/w that the group may be able to use and the system admin can configure 677b/w that the group may be able to use and the system admin can configure
672the b/w accordingly. 678the b/w accordingly.
673 679
674If the MBA is specified in MB(megabytes) then user can enter the max b/w in MB 680If resctrl is using the software controller (mba_sc) then user can enter the
675rather than the percentage values. 681max b/w in MB rather than the percentage values.
676:: 682::
677 683
678 # echo "L3:0=3;1=c\nMB:0=1024;1=500" > /sys/fs/resctrl/p0/schemata 684 # echo "L3:0=3;1=c\nMB:0=1024;1=500" > /sys/fs/resctrl/p0/schemata
diff --git a/Documentation/x86/x86_64/5level-paging.rst b/Documentation/x86/x86_64/5level-paging.rst
index ab88a4514163..44856417e6a5 100644
--- a/Documentation/x86/x86_64/5level-paging.rst
+++ b/Documentation/x86/x86_64/5level-paging.rst
@@ -20,7 +20,7 @@ physical address space. This "ought to be enough for anybody" ©.
20QEMU 2.9 and later support 5-level paging. 20QEMU 2.9 and later support 5-level paging.
21 21
22Virtual memory layout for 5-level paging is described in 22Virtual memory layout for 5-level paging is described in
23Documentation/x86/x86_64/mm.txt 23Documentation/x86/x86_64/mm.rst
24 24
25 25
26Enabling 5-level paging 26Enabling 5-level paging
diff --git a/Documentation/x86/x86_64/boot-options.rst b/Documentation/x86/x86_64/boot-options.rst
index 2f69836b8445..6a4285a3c7a4 100644
--- a/Documentation/x86/x86_64/boot-options.rst
+++ b/Documentation/x86/x86_64/boot-options.rst
@@ -9,7 +9,7 @@ only the AMD64 specific ones are listed here.
9 9
10Machine check 10Machine check
11============= 11=============
12Please see Documentation/x86/x86_64/machinecheck for sysfs runtime tunables. 12Please see Documentation/x86/x86_64/machinecheck.rst for sysfs runtime tunables.
13 13
14 mce=off 14 mce=off
15 Disable machine check 15 Disable machine check
@@ -89,7 +89,7 @@ APICs
89 Don't use the local APIC (alias for i386 compatibility) 89 Don't use the local APIC (alias for i386 compatibility)
90 90
91 pirq=... 91 pirq=...
92 See Documentation/x86/i386/IO-APIC.txt 92 See Documentation/x86/i386/IO-APIC.rst
93 93
94 noapictimer 94 noapictimer
95 Don't set up the APIC timer 95 Don't set up the APIC timer
diff --git a/Documentation/x86/x86_64/fake-numa-for-cpusets.rst b/Documentation/x86/x86_64/fake-numa-for-cpusets.rst
index a6926cd40f70..30108684ae87 100644
--- a/Documentation/x86/x86_64/fake-numa-for-cpusets.rst
+++ b/Documentation/x86/x86_64/fake-numa-for-cpusets.rst
@@ -18,7 +18,7 @@ For more information on the features of cpusets, see
18Documentation/cgroup-v1/cpusets.rst. 18Documentation/cgroup-v1/cpusets.rst.
19There are a number of different configurations you can use for your needs. For 19There are a number of different configurations you can use for your needs. For
20more information on the numa=fake command line option and its various ways of 20more information on the numa=fake command line option and its various ways of
21configuring fake nodes, see Documentation/x86/x86_64/boot-options.txt. 21configuring fake nodes, see Documentation/x86/x86_64/boot-options.rst.
22 22
23For the purposes of this introduction, we'll assume a very primitive NUMA 23For the purposes of this introduction, we'll assume a very primitive NUMA
24emulation setup of "numa=fake=4*512,". This will split our system memory into 24emulation setup of "numa=fake=4*512,". This will split our system memory into
diff --git a/Documentation/xilinx/eemi.txt b/Documentation/xilinx/eemi.rst
index 5f39b4ffdcd4..9dcbc6f18d75 100644
--- a/Documentation/xilinx/eemi.txt
+++ b/Documentation/xilinx/eemi.rst
@@ -1,6 +1,6 @@
1--------------------------------------------------------------------- 1====================================
2Xilinx Zynq MPSoC EEMI Documentation 2Xilinx Zynq MPSoC EEMI Documentation
3--------------------------------------------------------------------- 3====================================
4 4
5Xilinx Zynq MPSoC Firmware Interface 5Xilinx Zynq MPSoC Firmware Interface
6------------------------------------- 6-------------------------------------
@@ -21,7 +21,7 @@ The zynqmp-firmware driver maintain all EEMI APIs in zynqmp_eemi_ops
21structure. Any driver who want to communicate with PMC using EEMI APIs 21structure. Any driver who want to communicate with PMC using EEMI APIs
22can call zynqmp_pm_get_eemi_ops(). 22can call zynqmp_pm_get_eemi_ops().
23 23
24Example of EEMI ops: 24Example of EEMI ops::
25 25
26 /* zynqmp-firmware driver maintain all EEMI APIs */ 26 /* zynqmp-firmware driver maintain all EEMI APIs */
27 struct zynqmp_eemi_ops { 27 struct zynqmp_eemi_ops {
@@ -34,7 +34,7 @@ Example of EEMI ops:
34 .query_data = zynqmp_pm_query_data, 34 .query_data = zynqmp_pm_query_data,
35 }; 35 };
36 36
37Example of EEMI ops usage: 37Example of EEMI ops usage::
38 38
39 static const struct zynqmp_eemi_ops *eemi_ops; 39 static const struct zynqmp_eemi_ops *eemi_ops;
40 u32 ret_payload[PAYLOAD_ARG_CNT]; 40 u32 ret_payload[PAYLOAD_ARG_CNT];
diff --git a/Documentation/xilinx/index.rst b/Documentation/xilinx/index.rst
new file mode 100644
index 000000000000..01cc1a0714df
--- /dev/null
+++ b/Documentation/xilinx/index.rst
@@ -0,0 +1,17 @@
1:orphan:
2
3===========
4Xilinx FPGA
5===========
6
7.. toctree::
8 :maxdepth: 1
9
10 eemi
11
12.. only:: subproject and html
13
14 Indices
15 =======
16
17 * :ref:`genindex`
diff --git a/Kconfig b/Kconfig
index 48a80beab685..e10b3ee084d4 100644
--- a/Kconfig
+++ b/Kconfig
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2# 2#
3# For a description of the syntax of this configuration file, 3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.txt. 4# see Documentation/kbuild/kconfig-language.rst.
5# 5#
6mainmenu "Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration" 6mainmenu "Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration"
7 7
@@ -30,3 +30,5 @@ source "crypto/Kconfig"
30source "lib/Kconfig" 30source "lib/Kconfig"
31 31
32source "lib/Kconfig.debug" 32source "lib/Kconfig.debug"
33
34source "Documentation/Kconfig"
diff --git a/MAINTAINERS b/MAINTAINERS
index f9acdbac0001..43ca94856944 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3901,7 +3901,7 @@ F: Documentation/devicetree/bindings/hwmon/cirrus,lochnagar.txt
3901F: Documentation/devicetree/bindings/pinctrl/cirrus,lochnagar.txt 3901F: Documentation/devicetree/bindings/pinctrl/cirrus,lochnagar.txt
3902F: Documentation/devicetree/bindings/regulator/cirrus,lochnagar.txt 3902F: Documentation/devicetree/bindings/regulator/cirrus,lochnagar.txt
3903F: Documentation/devicetree/bindings/sound/cirrus,lochnagar.txt 3903F: Documentation/devicetree/bindings/sound/cirrus,lochnagar.txt
3904F: Documentation/hwmon/lochnagar 3904F: Documentation/hwmon/lochnagar.rst
3905 3905
3906CISCO FCOE HBA DRIVER 3906CISCO FCOE HBA DRIVER
3907M: Satish Kharat <satishkh@cisco.com> 3907M: Satish Kharat <satishkh@cisco.com>
@@ -4820,7 +4820,7 @@ S: Maintained
4820W: http://plugable.com/category/projects/udlfb/ 4820W: http://plugable.com/category/projects/udlfb/
4821F: drivers/video/fbdev/udlfb.c 4821F: drivers/video/fbdev/udlfb.c
4822F: include/video/udlfb.h 4822F: include/video/udlfb.h
4823F: Documentation/fb/udlfb.txt 4823F: Documentation/fb/udlfb.rst
4824 4824
4825DISTRIBUTED LOCK MANAGER (DLM) 4825DISTRIBUTED LOCK MANAGER (DLM)
4826M: Christine Caulfield <ccaulfie@redhat.com> 4826M: Christine Caulfield <ccaulfie@redhat.com>
@@ -6287,7 +6287,7 @@ FPGA DFL DRIVERS
6287M: Wu Hao <hao.wu@intel.com> 6287M: Wu Hao <hao.wu@intel.com>
6288L: linux-fpga@vger.kernel.org 6288L: linux-fpga@vger.kernel.org
6289S: Maintained 6289S: Maintained
6290F: Documentation/fpga/dfl.txt 6290F: Documentation/fpga/dfl.rst
6291F: include/uapi/linux/fpga-dfl.h 6291F: include/uapi/linux/fpga-dfl.h
6292F: drivers/fpga/dfl* 6292F: drivers/fpga/dfl*
6293 6293
@@ -7064,7 +7064,7 @@ F: drivers/media/usb/hdpvr/
7064HEWLETT PACKARD ENTERPRISE ILO NMI WATCHDOG DRIVER 7064HEWLETT PACKARD ENTERPRISE ILO NMI WATCHDOG DRIVER
7065M: Jerry Hoemann <jerry.hoemann@hpe.com> 7065M: Jerry Hoemann <jerry.hoemann@hpe.com>
7066S: Supported 7066S: Supported
7067F: Documentation/watchdog/hpwdt.txt 7067F: Documentation/watchdog/hpwdt.rst
7068F: drivers/watchdog/hpwdt.c 7068F: drivers/watchdog/hpwdt.c
7069 7069
7070HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa) 7070HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa)
@@ -7247,7 +7247,7 @@ F: drivers/net/ethernet/hp/hp100.*
7247HPET: High Precision Event Timers driver 7247HPET: High Precision Event Timers driver
7248M: Clemens Ladisch <clemens@ladisch.de> 7248M: Clemens Ladisch <clemens@ladisch.de>
7249S: Maintained 7249S: Maintained
7250F: Documentation/timers/hpet.txt 7250F: Documentation/timers/hpet.rst
7251F: drivers/char/hpet.c 7251F: drivers/char/hpet.c
7252F: include/linux/hpet.h 7252F: include/linux/hpet.h
7253F: include/uapi/linux/hpet.h 7253F: include/uapi/linux/hpet.h
@@ -7667,7 +7667,7 @@ IDE/ATAPI DRIVERS
7667M: Borislav Petkov <bp@alien8.de> 7667M: Borislav Petkov <bp@alien8.de>
7668L: linux-ide@vger.kernel.org 7668L: linux-ide@vger.kernel.org
7669S: Maintained 7669S: Maintained
7670F: Documentation/cdrom/ide-cd 7670F: Documentation/cdrom/ide-cd.rst
7671F: drivers/ide/ide-cd* 7671F: drivers/ide/ide-cd*
7672 7672
7673IDEAPAD LAPTOP EXTRAS DRIVER 7673IDEAPAD LAPTOP EXTRAS DRIVER
@@ -7980,7 +7980,7 @@ INTEL FRAMEBUFFER DRIVER (excluding 810 and 815)
7980M: Maik Broemme <mbroemme@libmpq.org> 7980M: Maik Broemme <mbroemme@libmpq.org>
7981L: linux-fbdev@vger.kernel.org 7981L: linux-fbdev@vger.kernel.org
7982S: Maintained 7982S: Maintained
7983F: Documentation/fb/intelfb.txt 7983F: Documentation/fb/intelfb.rst
7984F: drivers/video/fbdev/intelfb/ 7984F: drivers/video/fbdev/intelfb/
7985 7985
7986INTEL GPIO DRIVERS 7986INTEL GPIO DRIVERS
@@ -11359,7 +11359,7 @@ NXP FXAS21002C DRIVER
11359M: Rui Miguel Silva <rmfrfs@gmail.com> 11359M: Rui Miguel Silva <rmfrfs@gmail.com>
11360L: linux-iio@vger.kernel.org 11360L: linux-iio@vger.kernel.org
11361S: Maintained 11361S: Maintained
11362F: Documentation/devicetree/bindings/iio/gyroscope/fxas21002c.txt 11362F: Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt
11363F: drivers/iio/gyro/fxas21002c_core.c 11363F: drivers/iio/gyro/fxas21002c_core.c
11364F: drivers/iio/gyro/fxas21002c.h 11364F: drivers/iio/gyro/fxas21002c.h
11365F: drivers/iio/gyro/fxas21002c_i2c.c 11365F: drivers/iio/gyro/fxas21002c_i2c.c
@@ -12737,7 +12737,7 @@ M: Rodolfo Giometti <giometti@enneenne.com>
12737W: http://wiki.enneenne.com/index.php/LinuxPPS_support 12737W: http://wiki.enneenne.com/index.php/LinuxPPS_support
12738L: linuxpps@ml.enneenne.com (subscribers-only) 12738L: linuxpps@ml.enneenne.com (subscribers-only)
12739S: Maintained 12739S: Maintained
12740F: Documentation/pps/ 12740F: Documentation/driver-api/pps.rst
12741F: Documentation/devicetree/bindings/pps/pps-gpio.txt 12741F: Documentation/devicetree/bindings/pps/pps-gpio.txt
12742F: Documentation/ABI/testing/sysfs-pps 12742F: Documentation/ABI/testing/sysfs-pps
12743F: drivers/pps/ 12743F: drivers/pps/
@@ -12843,7 +12843,7 @@ L: netdev@vger.kernel.org
12843S: Maintained 12843S: Maintained
12844W: http://linuxptp.sourceforge.net/ 12844W: http://linuxptp.sourceforge.net/
12845F: Documentation/ABI/testing/sysfs-ptp 12845F: Documentation/ABI/testing/sysfs-ptp
12846F: Documentation/ptp/* 12846F: Documentation/driver-api/ptp.rst
12847F: drivers/net/phy/dp83640* 12847F: drivers/net/phy/dp83640*
12848F: drivers/ptp/* 12848F: drivers/ptp/*
12849F: include/linux/ptp_cl* 12849F: include/linux/ptp_cl*
@@ -14437,7 +14437,7 @@ M: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
14437L: linux-fbdev@vger.kernel.org 14437L: linux-fbdev@vger.kernel.org
14438S: Maintained 14438S: Maintained
14439F: drivers/video/fbdev/sm712* 14439F: drivers/video/fbdev/sm712*
14440F: Documentation/fb/sm712fb.txt 14440F: Documentation/fb/sm712fb.rst
14441 14441
14442SIMPLE FIRMWARE INTERFACE (SFI) 14442SIMPLE FIRMWARE INTERFACE (SFI)
14443M: Len Brown <lenb@kernel.org> 14443M: Len Brown <lenb@kernel.org>
@@ -14507,7 +14507,7 @@ SIS FRAMEBUFFER DRIVER
14507M: Thomas Winischhofer <thomas@winischhofer.net> 14507M: Thomas Winischhofer <thomas@winischhofer.net>
14508W: http://www.winischhofer.net/linuxsisvga.shtml 14508W: http://www.winischhofer.net/linuxsisvga.shtml
14509S: Maintained 14509S: Maintained
14510F: Documentation/fb/sisfb.txt 14510F: Documentation/fb/sisfb.rst
14511F: drivers/video/fbdev/sis/ 14511F: drivers/video/fbdev/sis/
14512F: include/video/sisfb.h 14512F: include/video/sisfb.h
14513 14513
@@ -16704,7 +16704,7 @@ M: Michal Januszewski <spock@gentoo.org>
16704L: linux-fbdev@vger.kernel.org 16704L: linux-fbdev@vger.kernel.org
16705W: https://github.com/mjanusz/v86d 16705W: https://github.com/mjanusz/v86d
16706S: Maintained 16706S: Maintained
16707F: Documentation/fb/uvesafb.txt 16707F: Documentation/fb/uvesafb.rst
16708F: drivers/video/fbdev/uvesafb.* 16708F: drivers/video/fbdev/uvesafb.*
16709 16709
16710VF610 NAND DRIVER 16710VF610 NAND DRIVER
diff --git a/arch/arc/plat-eznps/Kconfig b/arch/arc/plat-eznps/Kconfig
index 2eaecfb063a7..a376a50d3fea 100644
--- a/arch/arc/plat-eznps/Kconfig
+++ b/arch/arc/plat-eznps/Kconfig
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2# 2#
3# For a description of the syntax of this configuration file, 3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.txt. 4# see Documentation/kbuild/kconfig-language.rst.
5# 5#
6 6
7menuconfig ARC_PLAT_EZNPS 7menuconfig ARC_PLAT_EZNPS
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c87cc9a6fb3c..ad00e17d6988 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1293,7 +1293,7 @@ config SMP
1293 uniprocessor machines. On a uniprocessor machine, the kernel 1293 uniprocessor machines. On a uniprocessor machine, the kernel
1294 will run faster if you say N here. 1294 will run faster if you say N here.
1295 1295
1296 See also <file:Documentation/x86/i386/IO-APIC.txt>, 1296 See also <file:Documentation/x86/i386/IO-APIC.rst>,
1297 <file:Documentation/lockup-watchdogs.txt> and the SMP-HOWTO available at 1297 <file:Documentation/lockup-watchdogs.txt> and the SMP-HOWTO available at
1298 <http://tldp.org/HOWTO/SMP-HOWTO.html>. 1298 <http://tldp.org/HOWTO/SMP-HOWTO.html>.
1299 1299
@@ -2040,7 +2040,7 @@ config CRASH_DUMP
2040 kdump/kexec. The crash dump kernel must be compiled to a 2040 kdump/kexec. The crash dump kernel must be compiled to a
2041 memory address not used by the main kernel 2041 memory address not used by the main kernel
2042 2042
2043 For more details see Documentation/kdump/kdump.txt 2043 For more details see Documentation/kdump/kdump.rst
2044 2044
2045config AUTO_ZRELADDR 2045config AUTO_ZRELADDR
2046 bool "Auto calculation of the decompressed kernel image address" 2046 bool "Auto calculation of the decompressed kernel image address"
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c1734e444fb8..c085aec9459b 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -998,7 +998,7 @@ config CRASH_DUMP
998 reserved region and then later executed after a crash by 998 reserved region and then later executed after a crash by
999 kdump/kexec. 999 kdump/kexec.
1000 1000
1001 For more details see Documentation/kdump/kdump.txt 1001 For more details see Documentation/kdump/kdump.rst
1002 1002
1003config XEN_DOM0 1003config XEN_DOM0
1004 def_bool y 1004 def_bool y
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index c9e9a6978e73..8e79ce9c3f5c 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -83,7 +83,7 @@ static inline unsigned long efi_get_max_fdt_addr(unsigned long dram_base)
83 * guaranteed to cover the kernel Image. 83 * guaranteed to cover the kernel Image.
84 * 84 *
85 * Since the EFI stub is part of the kernel Image, we can relax the 85 * Since the EFI stub is part of the kernel Image, we can relax the
86 * usual requirements in Documentation/arm64/booting.txt, which still 86 * usual requirements in Documentation/arm64/booting.rst, which still
87 * apply to other bootloaders, and are required for some kernel 87 * apply to other bootloaders, and are required for some kernel
88 * configurations. 88 * configurations.
89 */ 89 */
diff --git a/arch/arm64/include/asm/image.h b/arch/arm64/include/asm/image.h
index e2c27a2278e9..c2b13213c720 100644
--- a/arch/arm64/include/asm/image.h
+++ b/arch/arm64/include/asm/image.h
@@ -27,7 +27,7 @@
27 27
28/* 28/*
29 * struct arm64_image_header - arm64 kernel image header 29 * struct arm64_image_header - arm64 kernel image header
30 * See Documentation/arm64/booting.txt for details 30 * See Documentation/arm64/booting.rst for details
31 * 31 *
32 * @code0: Executable code, or 32 * @code0: Executable code, or
33 * @mz_header alternatively used for part of MZ header 33 * @mz_header alternatively used for part of MZ header
diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h
index 3d448a0bb225..8b0ebce92427 100644
--- a/arch/arm64/include/uapi/asm/sigcontext.h
+++ b/arch/arm64/include/uapi/asm/sigcontext.h
@@ -146,7 +146,7 @@ struct sve_context {
146 * vector length beyond its initial architectural limit of 2048 bits 146 * vector length beyond its initial architectural limit of 2048 bits
147 * (16 quadwords). 147 * (16 quadwords).
148 * 148 *
149 * See linux/Documentation/arm64/sve.txt for a description of the VL/VQ 149 * See linux/Documentation/arm64/sve.rst for a description of the VL/VQ
150 * terminology. 150 * terminology.
151 */ 151 */
152#define SVE_VQ_BYTES __SVE_VQ_BYTES /* bytes per quadword */ 152#define SVE_VQ_BYTES __SVE_VQ_BYTES /* bytes per quadword */
diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c
index 07bf740bea91..2514fd6f12cb 100644
--- a/arch/arm64/kernel/kexec_image.c
+++ b/arch/arm64/kernel/kexec_image.c
@@ -53,7 +53,7 @@ static void *image_load(struct kimage *image,
53 53
54 /* 54 /*
55 * We require a kernel with an unambiguous Image header. Per 55 * We require a kernel with an unambiguous Image header. Per
56 * Documentation/booting.txt, this is the case when image_size 56 * Documentation/arm64/booting.rst, this is the case when image_size
57 * is non-zero (practically speaking, since v3.17). 57 * is non-zero (practically speaking, since v3.17).
58 */ 58 */
59 h = (struct arm64_image_header *)kernel; 59 h = (struct arm64_image_header *)kernel;
diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index eeb0471268a0..c5e6b70e1510 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2# 2#
3# For a description of the syntax of this configuration file, 3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.txt. 4# see Documentation/kbuild/kconfig-language.rst.
5# 5#
6 6
7config C6X 7config C6X
diff --git a/arch/m68k/q40/README b/arch/m68k/q40/README
index 93f4c4cd3c45..a4991d2d8af6 100644
--- a/arch/m68k/q40/README
+++ b/arch/m68k/q40/README
@@ -31,7 +31,7 @@ drivers used by the Q40, apart from the very obvious (console etc.):
31 char/joystick/* # most of this should work, not 31 char/joystick/* # most of this should work, not
32 # in default config.in 32 # in default config.in
33 block/q40ide.c # startup for ide 33 block/q40ide.c # startup for ide
34 ide* # see Documentation/ide/ide.txt 34 ide* # see Documentation/ide/ide.rst
35 floppy.c # normal PC driver, DMA emu in asm/floppy.h 35 floppy.c # normal PC driver, DMA emu in asm/floppy.h
36 # and arch/m68k/kernel/entry.S 36 # and arch/m68k/kernel/entry.S
37 # see drivers/block/README.fd 37 # see drivers/block/README.fd
diff --git a/arch/microblaze/Kconfig.debug b/arch/microblaze/Kconfig.debug
index 3a343188d86c..865527ac332a 100644
--- a/arch/microblaze/Kconfig.debug
+++ b/arch/microblaze/Kconfig.debug
@@ -1,6 +1,6 @@
1# SPDX-License-Identifier: GPL-2.0-only 1# SPDX-License-Identifier: GPL-2.0-only
2# For a description of the syntax of this configuration file, 2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt. 3# see Documentation/kbuild/kconfig-language.rst.
4 4
5config TRACE_IRQFLAGS_SUPPORT 5config TRACE_IRQFLAGS_SUPPORT
6 def_bool y 6 def_bool y
diff --git a/arch/microblaze/Kconfig.platform b/arch/microblaze/Kconfig.platform
index 5bf54c1d4f60..7795f90dad86 100644
--- a/arch/microblaze/Kconfig.platform
+++ b/arch/microblaze/Kconfig.platform
@@ -1,6 +1,6 @@
1# SPDX-License-Identifier: GPL-2.0-only 1# SPDX-License-Identifier: GPL-2.0-only
2# For a description of the syntax of this configuration file, 2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt. 3# see Documentation/kbuild/kconfig-language.rst.
4# 4#
5# Platform selection Kconfig menu for MicroBlaze targets 5# Platform selection Kconfig menu for MicroBlaze targets
6# 6#
diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 3299e287a477..fd0d0639454f 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0-only 1# SPDX-License-Identifier: GPL-2.0-only
2# 2#
3# For a description of the syntax of this configuration file, 3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.txt. 4# see Documentation/kbuild/kconfig-language.rst.
5# 5#
6 6
7config NDS32 7config NDS32
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 7cfb20555b10..bf326f0edd2f 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2# 2#
3# For a description of the syntax of this configuration file, 3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.txt. 4# see Documentation/kbuild/kconfig-language.rst.
5# 5#
6 6
7config OPENRISC 7config OPENRISC
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 8c1c636308c8..3b795a0cab62 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -898,7 +898,7 @@ config PPC_MEM_KEYS
898 page-based protections, but without requiring modification of the 898 page-based protections, but without requiring modification of the
899 page tables when an application changes protection domains. 899 page tables when an application changes protection domains.
900 900
901 For details, see Documentation/vm/protection-keys.rst 901 For details, see Documentation/core-api/protection-keys.rst
902 902
903 If unsure, say y. 903 If unsure, say y.
904 904
diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
index e0dbec780fe9..d23288c4abf6 100644
--- a/arch/powerpc/sysdev/Kconfig
+++ b/arch/powerpc/sysdev/Kconfig
@@ -1,6 +1,6 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2# For a description of the syntax of this configuration file, 2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt. 3# see Documentation/kbuild/kconfig-language.rst.
4# 4#
5 5
6config PPC4xx_PCI_EXPRESS 6config PPC4xx_PCI_EXPRESS
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 4961deaa3b1d..376bc759b9ab 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0-only 1# SPDX-License-Identifier: GPL-2.0-only
2# 2#
3# For a description of the syntax of this configuration file, 3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.txt. 4# see Documentation/kbuild/kconfig-language.rst.
5# 5#
6 6
7config 64BIT 7config 64BIT
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index b77f512bb176..ce1a28654507 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -623,7 +623,7 @@ config CRASH_DUMP
623 to a memory address not used by the main kernel using 623 to a memory address not used by the main kernel using
624 PHYSICAL_START. 624 PHYSICAL_START.
625 625
626 For more details see Documentation/kdump/kdump.txt 626 For more details see Documentation/kdump/kdump.rst
627 627
628config KEXEC_JUMP 628config KEXEC_JUMP
629 bool "kexec jump (EXPERIMENTAL)" 629 bool "kexec jump (EXPERIMENTAL)"
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5a72c98e60bc..dce10b18f4bc 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -399,7 +399,7 @@ config SMP
399 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power 399 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
400 Management" code will be disabled if you say Y here. 400 Management" code will be disabled if you say Y here.
401 401
402 See also <file:Documentation/x86/i386/IO-APIC.txt>, 402 See also <file:Documentation/x86/i386/IO-APIC.rst>,
403 <file:Documentation/lockup-watchdogs.txt> and the SMP-HOWTO available at 403 <file:Documentation/lockup-watchdogs.txt> and the SMP-HOWTO available at
404 <http://www.tldp.org/docs.html#howto>. 404 <http://www.tldp.org/docs.html#howto>.
405 405
@@ -1308,7 +1308,7 @@ config MICROCODE
1308 the Linux kernel. 1308 the Linux kernel.
1309 1309
1310 The preferred method to load microcode from a detached initrd is described 1310 The preferred method to load microcode from a detached initrd is described
1311 in Documentation/x86/microcode.txt. For that you need to enable 1311 in Documentation/x86/microcode.rst. For that you need to enable
1312 CONFIG_BLK_DEV_INITRD in order for the loader to be able to scan the 1312 CONFIG_BLK_DEV_INITRD in order for the loader to be able to scan the
1313 initrd for microcode blobs. 1313 initrd for microcode blobs.
1314 1314
@@ -1347,7 +1347,7 @@ config MICROCODE_OLD_INTERFACE
1347 It is inadequate because it runs too late to be able to properly 1347 It is inadequate because it runs too late to be able to properly
1348 load microcode on a machine and it needs special tools. Instead, you 1348 load microcode on a machine and it needs special tools. Instead, you
1349 should've switched to the early loading method with the initrd or 1349 should've switched to the early loading method with the initrd or
1350 builtin microcode by now: Documentation/x86/microcode.txt 1350 builtin microcode by now: Documentation/x86/microcode.rst
1351 1351
1352config X86_MSR 1352config X86_MSR
1353 tristate "/dev/cpu/*/msr - Model-specific register support" 1353 tristate "/dev/cpu/*/msr - Model-specific register support"
@@ -1496,7 +1496,7 @@ config X86_5LEVEL
1496 A kernel with the option enabled can be booted on machines that 1496 A kernel with the option enabled can be booted on machines that
1497 support 4- or 5-level paging. 1497 support 4- or 5-level paging.
1498 1498
1499 See Documentation/x86/x86_64/5level-paging.txt for more 1499 See Documentation/x86/x86_64/5level-paging.rst for more
1500 information. 1500 information.
1501 1501
1502 Say N if unsure. 1502 Say N if unsure.
@@ -1644,7 +1644,7 @@ config ARCH_MEMORY_PROBE
1644 depends on X86_64 && MEMORY_HOTPLUG 1644 depends on X86_64 && MEMORY_HOTPLUG
1645 help 1645 help
1646 This option enables a sysfs memory/probe interface for testing. 1646 This option enables a sysfs memory/probe interface for testing.
1647 See Documentation/memory-hotplug.txt for more information. 1647 See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
1648 If you are unsure how to answer this question, answer N. 1648 If you are unsure how to answer this question, answer N.
1649 1649
1650config ARCH_PROC_KCORE_TEXT 1650config ARCH_PROC_KCORE_TEXT
@@ -1801,7 +1801,7 @@ config MTRR
1801 You can safely say Y even if your machine doesn't have MTRRs, you'll 1801 You can safely say Y even if your machine doesn't have MTRRs, you'll
1802 just add about 9 KB to your kernel. 1802 just add about 9 KB to your kernel.
1803 1803
1804 See <file:Documentation/x86/mtrr.txt> for more information. 1804 See <file:Documentation/x86/mtrr.rst> for more information.
1805 1805
1806config MTRR_SANITIZER 1806config MTRR_SANITIZER
1807 def_bool y 1807 def_bool y
@@ -1913,7 +1913,7 @@ config X86_INTEL_MPX
1913 process and adds some branches to paths used during 1913 process and adds some branches to paths used during
1914 exec() and munmap(). 1914 exec() and munmap().
1915 1915
1916 For details, see Documentation/x86/intel_mpx.txt 1916 For details, see Documentation/x86/intel_mpx.rst
1917 1917
1918 If unsure, say N. 1918 If unsure, say N.
1919 1919
@@ -1929,7 +1929,7 @@ config X86_INTEL_MEMORY_PROTECTION_KEYS
1929 page-based protections, but without requiring modification of the 1929 page-based protections, but without requiring modification of the
1930 page tables when an application changes protection domains. 1930 page tables when an application changes protection domains.
1931 1931
1932 For details, see Documentation/x86/protection-keys.txt 1932 For details, see Documentation/core-api/protection-keys.rst
1933 1933
1934 If unsure, say y. 1934 If unsure, say y.
1935 1935
@@ -2055,7 +2055,7 @@ config CRASH_DUMP
2055 to a memory address not used by the main kernel or BIOS using 2055 to a memory address not used by the main kernel or BIOS using
2056 PHYSICAL_START, or it must be built as a relocatable image 2056 PHYSICAL_START, or it must be built as a relocatable image
2057 (CONFIG_RELOCATABLE=y). 2057 (CONFIG_RELOCATABLE=y).
2058 For more details see Documentation/kdump/kdump.txt 2058 For more details see Documentation/kdump/kdump.rst
2059 2059
2060config KEXEC_JUMP 2060config KEXEC_JUMP
2061 bool "kexec jump" 2061 bool "kexec jump"
@@ -2092,7 +2092,7 @@ config PHYSICAL_START
2092 the reserved region. In other words, it can be set based on 2092 the reserved region. In other words, it can be set based on
2093 the "X" value as specified in the "crashkernel=YM@XM" 2093 the "X" value as specified in the "crashkernel=YM@XM"
2094 command line boot parameter passed to the panic-ed 2094 command line boot parameter passed to the panic-ed
2095 kernel. Please take a look at Documentation/kdump/kdump.txt 2095 kernel. Please take a look at Documentation/kdump/kdump.rst
2096 for more details about crash dumps. 2096 for more details about crash dumps.
2097 2097
2098 Usage of bzImage for capturing the crash dump is recommended as 2098 Usage of bzImage for capturing the crash dump is recommended as
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 6791a3c97589..71c92db47c41 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -156,7 +156,7 @@ config IOMMU_DEBUG
156 code. When you use it make sure you have a big enough 156 code. When you use it make sure you have a big enough
157 IOMMU/AGP aperture. Most of the options enabled by this can 157 IOMMU/AGP aperture. Most of the options enabled by this can
158 be set more finegrained using the iommu= command line 158 be set more finegrained using the iommu= command line
159 options. See Documentation/x86/x86_64/boot-options.txt for more 159 options. See Documentation/x86/x86_64/boot-options.rst for more
160 details. 160 details.
161 161
162config IOMMU_LEAK 162config IOMMU_LEAK
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index be19f4199727..2c11c0f45d49 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -313,7 +313,7 @@ start_sys_seg: .word SYSSEG # obsolete and meaningless, but just
313 313
314type_of_loader: .byte 0 # 0 means ancient bootloader, newer 314type_of_loader: .byte 0 # 0 means ancient bootloader, newer
315 # bootloaders know to change this. 315 # bootloaders know to change this.
316 # See Documentation/x86/boot.txt for 316 # See Documentation/x86/boot.rst for
317 # assigned ids 317 # assigned ids
318 318
319# flags, unused bits must be zero (RFU) bit within loadflags 319# flags, unused bits must be zero (RFU) bit within loadflags
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index a829dd3117d0..0ea4831a72a4 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -8,7 +8,7 @@
8 * 8 *
9 * entry.S contains the system-call and fault low-level handling routines. 9 * entry.S contains the system-call and fault low-level handling routines.
10 * 10 *
11 * Some of this is documented in Documentation/x86/entry_64.txt 11 * Some of this is documented in Documentation/x86/entry_64.rst
12 * 12 *
13 * A note on terminology: 13 * A note on terminology:
14 * - iret frame: Architecture defined interrupt frame from SS to RIP 14 * - iret frame: Architecture defined interrupt frame from SS to RIP
diff --git a/arch/x86/include/asm/bootparam_utils.h b/arch/x86/include/asm/bootparam_utils.h
index f6f6ef436599..101eb944f13c 100644
--- a/arch/x86/include/asm/bootparam_utils.h
+++ b/arch/x86/include/asm/bootparam_utils.h
@@ -24,7 +24,7 @@ static void sanitize_boot_params(struct boot_params *boot_params)
24 * IMPORTANT NOTE TO BOOTLOADER AUTHORS: do not simply clear 24 * IMPORTANT NOTE TO BOOTLOADER AUTHORS: do not simply clear
25 * this field. The purpose of this field is to guarantee 25 * this field. The purpose of this field is to guarantee
26 * compliance with the x86 boot spec located in 26 * compliance with the x86 boot spec located in
27 * Documentation/x86/boot.txt . That spec says that the 27 * Documentation/x86/boot.rst . That spec says that the
28 * *whole* structure should be cleared, after which only the 28 * *whole* structure should be cleared, after which only the
29 * portion defined by struct setup_header (boot_params->hdr) 29 * portion defined by struct setup_header (boot_params->hdr)
30 * should be copied in. 30 * should be copied in.
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index 793c14c372cb..288b065955b7 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -48,7 +48,7 @@
48 48
49#define __START_KERNEL_map _AC(0xffffffff80000000, UL) 49#define __START_KERNEL_map _AC(0xffffffff80000000, UL)
50 50
51/* See Documentation/x86/x86_64/mm.txt for a description of the memory map. */ 51/* See Documentation/x86/x86_64/mm.rst for a description of the memory map. */
52 52
53#define __PHYSICAL_MASK_SHIFT 52 53#define __PHYSICAL_MASK_SHIFT 52
54 54
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h
index 88bca456da99..52e5f5f2240d 100644
--- a/arch/x86/include/asm/pgtable_64_types.h
+++ b/arch/x86/include/asm/pgtable_64_types.h
@@ -103,7 +103,7 @@ extern unsigned int ptrs_per_p4d;
103#define PGDIR_MASK (~(PGDIR_SIZE - 1)) 103#define PGDIR_MASK (~(PGDIR_SIZE - 1))
104 104
105/* 105/*
106 * See Documentation/x86/x86_64/mm.txt for a description of the memory map. 106 * See Documentation/x86/x86_64/mm.rst for a description of the memory map.
107 * 107 *
108 * Be very careful vs. KASLR when changing anything here. The KASLR address 108 * Be very careful vs. KASLR when changing anything here. The KASLR address
109 * range must not overlap with anything except the KASAN shadow area, which 109 * range must not overlap with anything except the KASAN shadow area, which
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 4ddadf672ab5..a0e52bd00ecc 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -59,7 +59,7 @@ static u8 amd_ucode_patch[PATCH_MAX_SIZE];
59 59
60/* 60/*
61 * Microcode patch container file is prepended to the initrd in cpio 61 * Microcode patch container file is prepended to the initrd in cpio
62 * format. See Documentation/x86/microcode.txt 62 * format. See Documentation/x86/microcode.rst
63 */ 63 */
64static const char 64static const char
65ucode_path[] __maybe_unused = "kernel/x86/microcode/AuthenticAMD.bin"; 65ucode_path[] __maybe_unused = "kernel/x86/microcode/AuthenticAMD.bin";
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
index 347fc0be76b2..5ebcd02cbca7 100644
--- a/arch/x86/kernel/kexec-bzimage64.c
+++ b/arch/x86/kernel/kexec-bzimage64.c
@@ -419,7 +419,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel,
419 efi_map_offset = params_cmdline_sz; 419 efi_map_offset = params_cmdline_sz;
420 efi_setup_data_offset = efi_map_offset + ALIGN(efi_map_sz, 16); 420 efi_setup_data_offset = efi_map_offset + ALIGN(efi_map_sz, 16);
421 421
422 /* Copy setup header onto bootparams. Documentation/x86/boot.txt */ 422 /* Copy setup header onto bootparams. Documentation/x86/boot.rst */
423 setup_header_size = 0x0202 + kernel[0x0201] - setup_hdr_offset; 423 setup_header_size = 0x0202 + kernel[0x0201] - setup_hdr_offset;
424 424
425 /* Is there a limit on setup header size? */ 425 /* Is there a limit on setup header size? */
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index bd17dbb15d6a..0e0b08008b5a 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -808,7 +808,7 @@ __used __visible void *trampoline_handler(struct pt_regs *regs)
808 continue; 808 continue;
809 /* 809 /*
810 * Return probes must be pushed on this hash list correct 810 * Return probes must be pushed on this hash list correct
811 * order (same as return order) so that it can be poped 811 * order (same as return order) so that it can be popped
812 * correctly. However, if we find it is pushed it incorrect 812 * correctly. However, if we find it is pushed it incorrect
813 * order, this means we find a function which should not be 813 * order, this means we find a function which should not be
814 * probed, because the wrong order entry is pushed on the 814 * probed, because the wrong order entry is pushed on the
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index dcd272dbd0a9..f62b498b18fb 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -70,7 +70,7 @@ void __init pci_iommu_alloc(void)
70} 70}
71 71
72/* 72/*
73 * See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel 73 * See <Documentation/x86/x86_64/boot-options.rst> for the iommu kernel
74 * parameter documentation. 74 * parameter documentation.
75 */ 75 */
76static __init int iommu_setup(char *p) 76static __init int iommu_setup(char *p)
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 91f6db92554c..4de9704c4aaf 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -712,7 +712,7 @@ void native_flush_tlb_others(const struct cpumask *cpumask,
712} 712}
713 713
714/* 714/*
715 * See Documentation/x86/tlb.txt for details. We choose 33 715 * See Documentation/x86/tlb.rst for details. We choose 33
716 * because it is large enough to cover the vast majority (at 716 * because it is large enough to cover the vast majority (at
717 * least 95%) of allocations, and is small enough that we are 717 * least 95%) of allocations, and is small enough that we are
718 * confident it will not cause too much overhead. Each single 718 * confident it will not cause too much overhead. Each single
diff --git a/arch/x86/platform/pvh/enlighten.c b/arch/x86/platform/pvh/enlighten.c
index 1861a2ba0f2b..c0a502f7e3a7 100644
--- a/arch/x86/platform/pvh/enlighten.c
+++ b/arch/x86/platform/pvh/enlighten.c
@@ -86,7 +86,7 @@ static void __init init_pvh_bootparams(bool xen_guest)
86 } 86 }
87 87
88 /* 88 /*
89 * See Documentation/x86/boot.txt. 89 * See Documentation/x86/boot.rst.
90 * 90 *
91 * Version 2.12 supports Xen entry point but we will use default x86/PC 91 * Version 2.12 supports Xen entry point but we will use default x86/PC
92 * environment (i.e. hardware_subarch 0). 92 * environment (i.e. hardware_subarch 0).
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 4e1e517a33bc..5f6158973289 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -331,7 +331,7 @@ config ACPI_CUSTOM_DSDT_FILE
331 depends on !STANDALONE 331 depends on !STANDALONE
332 help 332 help
333 This option supports a custom DSDT by linking it into the kernel. 333 This option supports a custom DSDT by linking it into the kernel.
334 See Documentation/acpi/dsdt-override.txt 334 See Documentation/admin-guide/acpi/dsdt-override.rst
335 335
336 Enter the full path name to the file which includes the AmlCode 336 Enter the full path name to the file which includes the AmlCode
337 or dsdt_aml_code declaration. 337 or dsdt_aml_code declaration.
@@ -353,7 +353,7 @@ config ACPI_TABLE_UPGRADE
353 This option provides functionality to upgrade arbitrary ACPI tables 353 This option provides functionality to upgrade arbitrary ACPI tables
354 via initrd. No functional change if no ACPI tables are passed via 354 via initrd. No functional change if no ACPI tables are passed via
355 initrd, therefore it's safe to say Y. 355 initrd, therefore it's safe to say Y.
356 See Documentation/acpi/initrd_table_override.txt for details 356 See Documentation/admin-guide/acpi/initrd_table_override.rst for details
357 357
358config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD 358config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD
359 bool "Override ACPI tables from built-in initrd" 359 bool "Override ACPI tables from built-in initrd"
@@ -363,7 +363,7 @@ config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD
363 This option provides functionality to override arbitrary ACPI tables 363 This option provides functionality to override arbitrary ACPI tables
364 from built-in uncompressed initrd. 364 from built-in uncompressed initrd.
365 365
366 See Documentation/acpi/initrd_table_override.txt for details 366 See Documentation/admin-guide/acpi/initrd_table_override.rst for details
367 367
368config ACPI_DEBUG 368config ACPI_DEBUG
369 bool "Debug Statements" 369 bool "Debug Statements"
@@ -372,7 +372,7 @@ config ACPI_DEBUG
372 output and increases the kernel size by around 50K. 372 output and increases the kernel size by around 50K.
373 373
374 Use the acpi.debug_layer and acpi.debug_level kernel command-line 374 Use the acpi.debug_layer and acpi.debug_level kernel command-line
375 parameters documented in Documentation/acpi/debug.txt and 375 parameters documented in Documentation/firmware-guide/acpi/debug.rst and
376 Documentation/admin-guide/kernel-parameters.rst to control the type and 376 Documentation/admin-guide/kernel-parameters.rst to control the type and
377 amount of debug output. 377 amount of debug output.
378 378
@@ -443,7 +443,7 @@ config ACPI_CUSTOM_METHOD
443 help 443 help
444 This debug facility allows ACPI AML methods to be inserted and/or 444 This debug facility allows ACPI AML methods to be inserted and/or
445 replaced without rebooting the system. For details refer to: 445 replaced without rebooting the system. For details refer to:
446 Documentation/acpi/method-customizing.txt. 446 Documentation/firmware-guide/acpi/method-customizing.rst.
447 447
448 NOTE: This option is security sensitive, because it allows arbitrary 448 NOTE: This option is security sensitive, because it allows arbitrary
449 kernel memory to be written to by root (uid=0) users, allowing them 449 kernel memory to be written to by root (uid=0) users, allowing them
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index c52c738e554a..dd61fdd400f0 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2# 2#
3# For a description of the syntax of this configuration file, 3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.txt. 4# see Documentation/kbuild/kconfig-language.rst.
5# 5#
6# Auxiliary display drivers configuration. 6# Auxiliary display drivers configuration.
7# 7#
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 20bb4bfa4be6..96ec7e0fc1ea 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -347,7 +347,7 @@ config CDROM_PKTCDVD
347 is possible. 347 is possible.
348 DVD-RW disks must be in restricted overwrite mode. 348 DVD-RW disks must be in restricted overwrite mode.
349 349
350 See the file <file:Documentation/cdrom/packet-writing.txt> 350 See the file <file:Documentation/cdrom/packet-writing.rst>
351 for further information on the use of this driver. 351 for further information on the use of this driver.
352 352
353 To compile this driver as a module, choose M here: the 353 To compile this driver as a module, choose M here: the
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 933268b8d6a5..ac42ae4651ce 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -7,7 +7,7 @@
7 License. See linux/COPYING for more information. 7 License. See linux/COPYING for more information.
8 8
9 Uniform CD-ROM driver for Linux. 9 Uniform CD-ROM driver for Linux.
10 See Documentation/cdrom/cdrom-standard.tex for usage information. 10 See Documentation/cdrom/cdrom-standard.rst for usage information.
11 11
12 The routines in the file provide a uniform interface between the 12 The routines in the file provide a uniform interface between the
13 software that uses CD-ROMs and the various low-level drivers that 13 software that uses CD-ROMs and the various low-level drivers that
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index d40ccc3af9e2..53446e39a32c 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0-only 1# SPDX-License-Identifier: GPL-2.0-only
2# 2#
3# For a description of the syntax of this configuration file, 3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.txt. 4# see Documentation/kbuild/kconfig-language.rst.
5# 5#
6 6
7menu "Firmware Drivers" 7menu "Firmware Drivers"
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 36f900d63979..e20e2956f620 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -141,7 +141,7 @@ config DRM_LOAD_EDID_FIRMWARE
141 monitor are unable to provide appropriate EDID data. Since this 141 monitor are unable to provide appropriate EDID data. Since this
142 feature is provided as a workaround for broken hardware, the 142 feature is provided as a workaround for broken hardware, the
143 default case is N. Details and instructions how to build your own 143 default case is N. Details and instructions how to build your own
144 EDID data are given in Documentation/EDID/HOWTO.txt. 144 EDID data are given in Documentation/EDID/howto.rst.
145 145
146config DRM_DP_CEC 146config DRM_DP_CEC
147 bool "Enable DisplayPort CEC-Tunneling-over-AUX HDMI support" 147 bool "Enable DisplayPort CEC-Tunneling-over-AUX HDMI support"
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index fdd2a62f9d52..9eada392df15 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -25,13 +25,13 @@ menuconfig IDE
25 To compile this driver as a module, choose M here: the 25 To compile this driver as a module, choose M here: the
26 module will be called ide-core. 26 module will be called ide-core.
27 27
28 For further information, please read <file:Documentation/ide/ide.txt>. 28 For further information, please read <file:Documentation/ide/ide.rst>.
29 29
30 If unsure, say N. 30 If unsure, say N.
31 31
32if IDE 32if IDE
33 33
34comment "Please see Documentation/ide/ide.txt for help/info on IDE drives" 34comment "Please see Documentation/ide/ide.rst for help/info on IDE drives"
35 35
36config IDE_XFER_MODE 36config IDE_XFER_MODE
37 bool 37 bool
@@ -163,7 +163,7 @@ config BLK_DEV_IDETAPE
163 along with other IDE devices, as "hdb" or "hdc", or something 163 along with other IDE devices, as "hdb" or "hdc", or something
164 similar, and will be mapped to a character device such as "ht0" 164 similar, and will be mapped to a character device such as "ht0"
165 (check the boot messages with dmesg). Be sure to consult the 165 (check the boot messages with dmesg). Be sure to consult the
166 <file:drivers/ide/ide-tape.c> and <file:Documentation/ide/ide.txt> 166 <file:drivers/ide/ide-tape.c> and <file:Documentation/ide/ide.rst>
167 files for usage information. 167 files for usage information.
168 168
169 To compile this driver as a module, choose M here: the 169 To compile this driver as a module, choose M here: the
@@ -251,7 +251,7 @@ config BLK_DEV_CMD640
251 251
252 The CMD640 chip is also used on add-in cards by Acculogic, and on 252 The CMD640 chip is also used on add-in cards by Acculogic, and on
253 the "CSA-6400E PCI to IDE controller" that some people have. For 253 the "CSA-6400E PCI to IDE controller" that some people have. For
254 details, read <file:Documentation/ide/ide.txt>. 254 details, read <file:Documentation/ide/ide.rst>.
255 255
256config BLK_DEV_CMD640_ENHANCED 256config BLK_DEV_CMD640_ENHANCED
257 bool "CMD640 enhanced support" 257 bool "CMD640 enhanced support"
@@ -259,7 +259,7 @@ config BLK_DEV_CMD640_ENHANCED
259 help 259 help
260 This option includes support for setting/autotuning PIO modes and 260 This option includes support for setting/autotuning PIO modes and
261 prefetch on CMD640 IDE interfaces. For details, read 261 prefetch on CMD640 IDE interfaces. For details, read
262 <file:Documentation/ide/ide.txt>. If you have a CMD640 IDE interface 262 <file:Documentation/ide/ide.rst>. If you have a CMD640 IDE interface
263 and your BIOS does not already do this for you, then say Y here. 263 and your BIOS does not already do this for you, then say Y here.
264 Otherwise say N. 264 Otherwise say N.
265 265
@@ -819,7 +819,7 @@ config BLK_DEV_ALI14XX
819 boot parameter. It enables support for the secondary IDE interface 819 boot parameter. It enables support for the secondary IDE interface
820 of the ALI M1439/1443/1445/1487/1489 chipsets, and permits faster 820 of the ALI M1439/1443/1445/1487/1489 chipsets, and permits faster
821 I/O speeds to be set as well. 821 I/O speeds to be set as well.
822 See the files <file:Documentation/ide/ide.txt> and 822 See the files <file:Documentation/ide/ide.rst> and
823 <file:drivers/ide/ali14xx.c> for more info. 823 <file:drivers/ide/ali14xx.c> for more info.
824 824
825config BLK_DEV_DTC2278 825config BLK_DEV_DTC2278
@@ -830,7 +830,7 @@ config BLK_DEV_DTC2278
830 This driver is enabled at runtime using the "dtc2278.probe" kernel 830 This driver is enabled at runtime using the "dtc2278.probe" kernel
831 boot parameter. It enables support for the secondary IDE interface 831 boot parameter. It enables support for the secondary IDE interface
832 of the DTC-2278 card, and permits faster I/O speeds to be set as 832 of the DTC-2278 card, and permits faster I/O speeds to be set as
833 well. See the <file:Documentation/ide/ide.txt> and 833 well. See the <file:Documentation/ide/ide.rst> and
834 <file:drivers/ide/dtc2278.c> files for more info. 834 <file:drivers/ide/dtc2278.c> files for more info.
835 835
836config BLK_DEV_HT6560B 836config BLK_DEV_HT6560B
@@ -841,7 +841,7 @@ config BLK_DEV_HT6560B
841 This driver is enabled at runtime using the "ht6560b.probe" kernel 841 This driver is enabled at runtime using the "ht6560b.probe" kernel
842 boot parameter. It enables support for the secondary IDE interface 842 boot parameter. It enables support for the secondary IDE interface
843 of the Holtek card, and permits faster I/O speeds to be set as well. 843 of the Holtek card, and permits faster I/O speeds to be set as well.
844 See the <file:Documentation/ide/ide.txt> and 844 See the <file:Documentation/ide/ide.rst> and
845 <file:drivers/ide/ht6560b.c> files for more info. 845 <file:drivers/ide/ht6560b.c> files for more info.
846 846
847config BLK_DEV_QD65XX 847config BLK_DEV_QD65XX
@@ -851,7 +851,7 @@ config BLK_DEV_QD65XX
851 help 851 help
852 This driver is enabled at runtime using the "qd65xx.probe" kernel 852 This driver is enabled at runtime using the "qd65xx.probe" kernel
853 boot parameter. It permits faster I/O speeds to be set. See the 853 boot parameter. It permits faster I/O speeds to be set. See the
854 <file:Documentation/ide/ide.txt> and <file:drivers/ide/qd65xx.c> 854 <file:Documentation/ide/ide.rst> and <file:drivers/ide/qd65xx.c>
855 for more info. 855 for more info.
856 856
857config BLK_DEV_UMC8672 857config BLK_DEV_UMC8672
@@ -862,7 +862,7 @@ config BLK_DEV_UMC8672
862 This driver is enabled at runtime using the "umc8672.probe" kernel 862 This driver is enabled at runtime using the "umc8672.probe" kernel
863 boot parameter. It enables support for the secondary IDE interface 863 boot parameter. It enables support for the secondary IDE interface
864 of the UMC-8672, and permits faster I/O speeds to be set as well. 864 of the UMC-8672, and permits faster I/O speeds to be set as well.
865 See the files <file:Documentation/ide/ide.txt> and 865 See the files <file:Documentation/ide/ide.rst> and
866 <file:drivers/ide/umc8672.c> for more info. 866 <file:drivers/ide/umc8672.c> for more info.
867 867
868endif 868endif
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 3b15adc6ce98..9d117936bee1 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -9,7 +9,7 @@
9 * May be copied or modified under the terms of the GNU General Public 9 * May be copied or modified under the terms of the GNU General Public
10 * License. See linux/COPYING for more information. 10 * License. See linux/COPYING for more information.
11 * 11 *
12 * See Documentation/cdrom/ide-cd for usage information. 12 * See Documentation/cdrom/ide-cd.rst for usage information.
13 * 13 *
14 * Suggestions are welcome. Patches that work are more welcome though. ;-) 14 * Suggestions are welcome. Patches that work are more welcome though. ;-)
15 * 15 *
diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c
index cd036e87335a..038e72a84b33 100644
--- a/drivers/isdn/mISDN/dsp_core.c
+++ b/drivers/isdn/mISDN/dsp_core.c
@@ -4,8 +4,6 @@
4 * Karsten Keil (keil@isdn4linux.de) 4 * Karsten Keil (keil@isdn4linux.de)
5 * 5 *
6 * This file is (c) under GNU PUBLIC LICENSE 6 * This file is (c) under GNU PUBLIC LICENSE
7 * For changes and modifications please read
8 * ../../../Documentation/isdn/mISDN.cert
9 * 7 *
10 * Thanks to Karsten Keil (great drivers) 8 * Thanks to Karsten Keil (great drivers)
11 * Cologne Chip (great chips) 9 * Cologne Chip (great chips)
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index 45254b3ef715..5ccac0b77f17 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -453,7 +453,7 @@ config DM_INIT
453 Enable "dm-mod.create=" parameter to create mapped devices at init time. 453 Enable "dm-mod.create=" parameter to create mapped devices at init time.
454 This option is useful to allow mounting rootfs without requiring an 454 This option is useful to allow mounting rootfs without requiring an
455 initramfs. 455 initramfs.
456 See Documentation/device-mapper/dm-init.txt for dm-mod.create="..." 456 See Documentation/device-mapper/dm-init.rst for dm-mod.create="..."
457 format. 457 format.
458 458
459 If unsure, say N. 459 If unsure, say N.
diff --git a/drivers/md/dm-init.c b/drivers/md/dm-init.c
index 728733a514c7..b65faef2c4b5 100644
--- a/drivers/md/dm-init.c
+++ b/drivers/md/dm-init.c
@@ -25,7 +25,7 @@ static char *create;
25 * Format: dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+] 25 * Format: dm-mod.create=<name>,<uuid>,<minor>,<flags>,<table>[,<table>+][;<name>,<uuid>,<minor>,<flags>,<table>[,<table>+]+]
26 * Table format: <start_sector> <num_sectors> <target_type> <target_args> 26 * Table format: <start_sector> <num_sectors> <target_type> <target_args>
27 * 27 *
28 * See Documentation/device-mapper/dm-init.txt for dm-mod.create="..." format 28 * See Documentation/device-mapper/dm-init.rst for dm-mod.create="..." format
29 * details. 29 * details.
30 */ 30 */
31 31
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 9fdef6897316..7a87a640f8ba 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3558,7 +3558,7 @@ static void raid_status(struct dm_target *ti, status_type_t type,
3558 * v1.5.0+: 3558 * v1.5.0+:
3559 * 3559 *
3560 * Sync action: 3560 * Sync action:
3561 * See Documentation/device-mapper/dm-raid.txt for 3561 * See Documentation/device-mapper/dm-raid.rst for
3562 * information on each of these states. 3562 * information on each of these states.
3563 */ 3563 */
3564 DMEMIT(" %s", sync_action); 3564 DMEMIT(" %s", sync_action);
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c
index 48fb0d41e03b..fb6d99dea31a 100644
--- a/drivers/media/usb/dvb-usb-v2/anysee.c
+++ b/drivers/media/usb/dvb-usb-v2/anysee.c
@@ -56,7 +56,7 @@ static int anysee_ctrl_msg(struct dvb_usb_device *d,
56 /* TODO FIXME: dvb_usb_generic_rw() fails rarely with error code -32 56 /* TODO FIXME: dvb_usb_generic_rw() fails rarely with error code -32
57 * (EPIPE, Broken pipe). Function supports currently msleep() as a 57 * (EPIPE, Broken pipe). Function supports currently msleep() as a
58 * parameter but I would not like to use it, since according to 58 * parameter but I would not like to use it, since according to
59 * Documentation/timers/timers-howto.txt it should not be used such 59 * Documentation/timers/timers-howto.rst it should not be used such
60 * short, under < 20ms, sleeps. Repeating failed message would be 60 * short, under < 20ms, sleeps. Repeating failed message would be
61 * better choice as not to add unwanted delays... 61 * better choice as not to add unwanted delays...
62 * Fixing that correctly is one of those or both; 62 * Fixing that correctly is one of those or both;
diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c
index 8a1428d4f138..bba49abb6750 100644
--- a/drivers/misc/lkdtm/core.c
+++ b/drivers/misc/lkdtm/core.c
@@ -15,7 +15,7 @@
15 * 15 *
16 * Debugfs support added by Simon Kagstrom <simon.kagstrom@netinsight.net> 16 * Debugfs support added by Simon Kagstrom <simon.kagstrom@netinsight.net>
17 * 17 *
18 * See Documentation/fault-injection/provoke-crashes.txt for instructions 18 * See Documentation/fault-injection/provoke-crashes.rst for instructions
19 */ 19 */
20#include "lkdtm.h" 20#include "lkdtm.h"
21#include <linux/fs.h> 21#include <linux/fs.h>
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index ef0e476b2525..49abbc52457d 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -48,7 +48,7 @@ config MTD_MS02NV
48 48
49 If you want to compile this driver as a module ( = code which can be 49 If you want to compile this driver as a module ( = code which can be
50 inserted in and removed from the running kernel whenever you want), 50 inserted in and removed from the running kernel whenever you want),
51 say M here and read <file:Documentation/kbuild/modules.txt>. 51 say M here and read <file:Documentation/kbuild/modules.rst>.
52 The module will be called ms02-nv. 52 The module will be called ms02-nv.
53 53
54config MTD_DATAFLASH 54config MTD_DATAFLASH
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 055f77c70fa3..030fed65393e 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1062,7 +1062,7 @@ static int ftgmac100_mii_probe(struct ftgmac100 *priv, phy_interface_t intf)
1062 } 1062 }
1063 1063
1064 /* Indicate that we support PAUSE frames (see comment in 1064 /* Indicate that we support PAUSE frames (see comment in
1065 * Documentation/networking/phy.txt) 1065 * Documentation/networking/phy.rst)
1066 */ 1066 */
1067 phy_support_asym_pause(phydev); 1067 phy_support_asym_pause(phydev);
1068 1068
diff --git a/drivers/net/ethernet/smsc/Kconfig b/drivers/net/ethernet/smsc/Kconfig
index d1b6a78557ec..9e1c3752b200 100644
--- a/drivers/net/ethernet/smsc/Kconfig
+++ b/drivers/net/ethernet/smsc/Kconfig
@@ -49,7 +49,7 @@ config SMC91X
49 This driver is also available as a module ( = code which can be 49 This driver is also available as a module ( = code which can be
50 inserted in and removed from the running kernel whenever you want). 50 inserted in and removed from the running kernel whenever you want).
51 The module will be called smc91x. If you want to compile it as a 51 The module will be called smc91x. If you want to compile it as a
52 module, say M here and read <file:Documentation/kbuild/modules.txt>. 52 module, say M here and read <file:Documentation/kbuild/modules.rst>.
53 53
54config PCMCIA_SMC91C92 54config PCMCIA_SMC91C92
55 tristate "SMC 91Cxx PCMCIA support" 55 tristate "SMC 91Cxx PCMCIA support"
@@ -86,7 +86,7 @@ config SMC911X
86 86
87 This driver is also available as a module. The module will be 87 This driver is also available as a module. The module will be
88 called smc911x. If you want to compile it as a module, say M 88 called smc911x. If you want to compile it as a module, say M
89 here and read <file:Documentation/kbuild/modules.txt> 89 here and read <file:Documentation/kbuild/modules.rst>
90 90
91config SMSC911X 91config SMSC911X
92 tristate "SMSC LAN911x/LAN921x families embedded ethernet support" 92 tristate "SMSC LAN911x/LAN921x families embedded ethernet support"
@@ -121,6 +121,6 @@ config SMSC9420
121 121
122 This driver is also available as a module. The module will be 122 This driver is also available as a module. The module will be
123 called smsc9420. If you want to compile it as a module, say M 123 called smsc9420. If you want to compile it as a module, say M
124 here and read <file:Documentation/kbuild/modules.txt> 124 here and read <file:Documentation/kbuild/modules.rst>
125 125
126endif # NET_VENDOR_SMSC 126endif # NET_VENDOR_SMSC
diff --git a/drivers/net/wireless/intel/iwlegacy/Kconfig b/drivers/net/wireless/intel/iwlegacy/Kconfig
index aa01c83e0060..e329fd7b09c0 100644
--- a/drivers/net/wireless/intel/iwlegacy/Kconfig
+++ b/drivers/net/wireless/intel/iwlegacy/Kconfig
@@ -32,7 +32,7 @@ config IWL4965
32 32
33 If you want to compile the driver as a module ( = code which can be 33 If you want to compile the driver as a module ( = code which can be
34 inserted in and removed from the running kernel whenever you want), 34 inserted in and removed from the running kernel whenever you want),
35 say M here and read <file:Documentation/kbuild/modules.txt>. The 35 say M here and read <file:Documentation/kbuild/modules.rst>. The
36 module will be called iwl4965. 36 module will be called iwl4965.
37 37
38config IWL3945 38config IWL3945
@@ -58,7 +58,7 @@ config IWL3945
58 58
59 If you want to compile the driver as a module ( = code which can be 59 If you want to compile the driver as a module ( = code which can be
60 inserted in and removed from the running kernel whenever you want), 60 inserted in and removed from the running kernel whenever you want),
61 say M here and read <file:Documentation/kbuild/modules.txt>. The 61 say M here and read <file:Documentation/kbuild/modules.rst>. The
62 module will be called iwl3945. 62 module will be called iwl3945.
63 63
64menu "iwl3945 / iwl4965 Debugging Options" 64menu "iwl3945 / iwl4965 Debugging Options"
diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig b/drivers/net/wireless/intel/iwlwifi/Kconfig
index e5528189163f..235349a33a3c 100644
--- a/drivers/net/wireless/intel/iwlwifi/Kconfig
+++ b/drivers/net/wireless/intel/iwlwifi/Kconfig
@@ -40,7 +40,7 @@ config IWLWIFI
40 40
41 If you want to compile the driver as a module ( = code which can be 41 If you want to compile the driver as a module ( = code which can be
42 inserted in and removed from the running kernel whenever you want), 42 inserted in and removed from the running kernel whenever you want),
43 say M here and read <file:Documentation/kbuild/modules.txt>. The 43 say M here and read <file:Documentation/kbuild/modules.rst>. The
44 module will be called iwlwifi. 44 module will be called iwlwifi.
45 45
46if IWLWIFI 46if IWLWIFI
diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig
index 24189c3399e0..1791830e7a71 100644
--- a/drivers/parport/Kconfig
+++ b/drivers/parport/Kconfig
@@ -1,7 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0-only 1# SPDX-License-Identifier: GPL-2.0-only
2# 2#
3# For a description of the syntax of this configuration file, 3# For a description of the syntax of this configuration file,
4# see Documentation/kbuild/kconfig-language.txt. 4# see Documentation/kbuild/kconfig-language.rst.
5# 5#
6# Parport configuration. 6# Parport configuration.
7# 7#
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 552bda167e7d..09d06b082f8b 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -64,7 +64,7 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
64 "be 0x%x\n", p_drv->name, did->prod_id[i], 64 "be 0x%x\n", p_drv->name, did->prod_id[i],
65 did->prod_id_hash[i], hash); 65 did->prod_id_hash[i], hash);
66 printk(KERN_DEBUG "pcmcia: see " 66 printk(KERN_DEBUG "pcmcia: see "
67 "Documentation/pcmcia/devicetable.txt for " 67 "Documentation/pcmcia/devicetable.rst for "
68 "details\n"); 68 "details\n");
69 } 69 }
70 did++; 70 did++;
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 5d5cc6111081..b7e5cee2aa26 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -433,9 +433,6 @@ config COMPAL_LAPTOP
433 It adds support for rfkill, Bluetooth, WLAN, LCD brightness, hwmon 433 It adds support for rfkill, Bluetooth, WLAN, LCD brightness, hwmon
434 and battery charging level control. 434 and battery charging level control.
435 435
436 For a (possibly incomplete) list of supported laptops, please refer
437 to: Documentation/platform/x86-laptop-drivers.txt
438
439config SONY_LAPTOP 436config SONY_LAPTOP
440 tristate "Sony Laptop Extras" 437 tristate "Sony Laptop Extras"
441 depends on ACPI 438 depends on ACPI
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 86ae1825cec1..e0c0cf462004 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2301,7 +2301,7 @@ static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
2301 * 2301 *
2302 * Delay for the requested amount of time as per the guidelines in: 2302 * Delay for the requested amount of time as per the guidelines in:
2303 * 2303 *
2304 * Documentation/timers/timers-howto.txt 2304 * Documentation/timers/timers-howto.rst
2305 * 2305 *
2306 * The assumption here is that regulators will never be enabled in 2306 * The assumption here is that regulators will never be enabled in
2307 * atomic context and therefore sleeping functions can be used. 2307 * atomic context and therefore sleeping functions can be used.
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 61da513fc0ed..f31b6b780eaf 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -183,7 +183,7 @@ config CHR_DEV_SCH
183 183
184 If you want to compile this as a module ( = code which can be 184 If you want to compile this as a module ( = code which can be
185 inserted in and removed from the running kernel whenever you want), 185 inserted in and removed from the running kernel whenever you want),
186 say M here and read <file:Documentation/kbuild/modules.txt> and 186 say M here and read <file:Documentation/kbuild/modules.rst> and
187 <file:Documentation/scsi/scsi.txt>. The module will be called ch.o. 187 <file:Documentation/scsi/scsi.txt>. The module will be called ch.o.
188 If unsure, say N. 188 If unsure, say N.
189 189
@@ -1474,7 +1474,7 @@ config ZFCP
1474 1474
1475 This driver is also available as a module. This module will be 1475 This driver is also available as a module. This module will be
1476 called zfcp. If you want to compile it as a module, say M here 1476 called zfcp. If you want to compile it as a module, say M here
1477 and read <file:Documentation/kbuild/modules.txt>. 1477 and read <file:Documentation/kbuild/modules.rst>.
1478 1478
1479config SCSI_PMCRAID 1479config SCSI_PMCRAID
1480 tristate "PMC SIERRA Linux MaxRAID adapter support" 1480 tristate "PMC SIERRA Linux MaxRAID adapter support"
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 8068520cf89e..ffd7e9506570 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -7765,7 +7765,7 @@ static void hpsa_free_pci_init(struct ctlr_info *h)
7765 hpsa_disable_interrupt_mode(h); /* pci_init 2 */ 7765 hpsa_disable_interrupt_mode(h); /* pci_init 2 */
7766 /* 7766 /*
7767 * call pci_disable_device before pci_release_regions per 7767 * call pci_disable_device before pci_release_regions per
7768 * Documentation/PCI/pci.txt 7768 * Documentation/PCI/pci.rst
7769 */ 7769 */
7770 pci_disable_device(h->pdev); /* pci_init 1 */ 7770 pci_disable_device(h->pdev); /* pci_init 1 */
7771 pci_release_regions(h->pdev); /* pci_init 2 */ 7771 pci_release_regions(h->pdev); /* pci_init 2 */
@@ -7848,7 +7848,7 @@ clean2: /* intmode+region, pci */
7848clean1: 7848clean1:
7849 /* 7849 /*
7850 * call pci_disable_device before pci_release_regions per 7850 * call pci_disable_device before pci_release_regions per
7851 * Documentation/PCI/pci.txt 7851 * Documentation/PCI/pci.rst
7852 */ 7852 */
7853 pci_disable_device(h->pdev); 7853 pci_disable_device(h->pdev);
7854 pci_release_regions(h->pdev); 7854 pci_release_regions(h->pdev);
diff --git a/drivers/staging/fieldbus/Documentation/fieldbus_dev.txt b/drivers/staging/fieldbus/Documentation/fieldbus_dev.txt
index 56af3f650fa3..89fb8e14676f 100644
--- a/drivers/staging/fieldbus/Documentation/fieldbus_dev.txt
+++ b/drivers/staging/fieldbus/Documentation/fieldbus_dev.txt
@@ -54,8 +54,8 @@ a limited few common behaviours and properties. This allows us to define
54a simple interface consisting of a character device and a set of sysfs files: 54a simple interface consisting of a character device and a set of sysfs files:
55 55
56See: 56See:
57Documentation/ABI/testing/sysfs-class-fieldbus-dev 57drivers/staging/fieldbus/Documentation/ABI/sysfs-class-fieldbus-dev
58Documentation/ABI/testing/fieldbus-dev-cdev 58drivers/staging/fieldbus/Documentation/ABI/fieldbus-dev-cdev
59 59
60Note that this simple interface does not provide a way to modify adapter 60Note that this simple interface does not provide a way to modify adapter
61configuration settings. It is therefore useful only for adapters that get their 61configuration settings. It is therefore useful only for adapters that get their
diff --git a/drivers/staging/sm750fb/Kconfig b/drivers/staging/sm750fb/Kconfig
index fb5a086bf9b1..8c0d8a873d5b 100644
--- a/drivers/staging/sm750fb/Kconfig
+++ b/drivers/staging/sm750fb/Kconfig
@@ -12,4 +12,4 @@ config FB_SM750
12 12
13 This driver is also available as a module. The module will be 13 This driver is also available as a module. The module will be
14 called sm750fb. If you want to compile it as a module, say M 14 called sm750fb. If you want to compile it as a module, say M
15 here and read <file:Documentation/kbuild/modules.txt>. 15 here and read <file:Documentation/kbuild/modules.rst>.
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index 3b1d312bb175..0e3e4dacbc12 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -95,7 +95,7 @@ config VT_HW_CONSOLE_BINDING
95 95
96 See <file:Documentation/console/console.txt> for more 96 See <file:Documentation/console/console.txt> for more
97 information. For framebuffer console users, please refer to 97 information. For framebuffer console users, please refer to
98 <file:Documentation/fb/fbcon.txt>. 98 <file:Documentation/fb/fbcon.rst>.
99 99
100config UNIX98_PTYS 100config UNIX98_PTYS
101 bool "Unix98 PTY support" if EXPERT 101 bool "Unix98 PTY support" if EXPERT
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index c97f270338bf..4a88e1ca25c0 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -16,7 +16,7 @@ config USB_EMI62
16 This code is also available as a module ( = code which can be 16 This code is also available as a module ( = code which can be
17 inserted in and removed from the running kernel whenever you want). 17 inserted in and removed from the running kernel whenever you want).
18 The module will be called audio. If you want to compile it as a 18 The module will be called audio. If you want to compile it as a
19 module, say M here and read <file:Documentation/kbuild/modules.txt>. 19 module, say M here and read <file:Documentation/kbuild/modules.rst>.
20 20
21config USB_EMI26 21config USB_EMI26
22 tristate "EMI 2|6 USB Audio interface support" 22 tristate "EMI 2|6 USB Audio interface support"
@@ -67,7 +67,7 @@ config USB_LEGOTOWER
67 inserted in and removed from the running kernel whenever you want). 67 inserted in and removed from the running kernel whenever you want).
68 The module will be called legousbtower. If you want to compile it as 68 The module will be called legousbtower. If you want to compile it as
69 a module, say M here and read 69 a module, say M here and read
70 <file:Documentation/kbuild/modules.txt>. 70 <file:Documentation/kbuild/modules.rst>.
71 71
72config USB_LCD 72config USB_LCD
73 tristate "USB LCD driver support" 73 tristate "USB LCD driver support"
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index e995c12d8e24..ff8892c38666 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1711,7 +1711,7 @@ EXPORT_SYMBOL_GPL(vhost_dev_ioctl);
1711 1711
1712/* TODO: This is really inefficient. We need something like get_user() 1712/* TODO: This is really inefficient. We need something like get_user()
1713 * (instruction directly accesses the data, with an exception table entry 1713 * (instruction directly accesses the data, with an exception table entry
1714 * returning -EFAULT). See Documentation/x86/exception-tables.txt. 1714 * returning -EFAULT). See Documentation/x86/exception-tables.rst.
1715 */ 1715 */
1716static int set_bit_to_user(int nr, void __user *addr) 1716static int set_bit_to_user(int nr, void __user *addr)
1717{ 1717{
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index b174af914e7a..6b2de93bd302 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -31,7 +31,7 @@ menuconfig FB
31 in the /dev directory, i.e. /dev/fb*. 31 in the /dev directory, i.e. /dev/fb*.
32 32
33 You need an utility program called fbset to make full use of frame 33 You need an utility program called fbset to make full use of frame
34 buffer devices. Please read <file:Documentation/fb/framebuffer.txt> 34 buffer devices. Please read <file:Documentation/fb/framebuffer.rst>
35 and the Framebuffer-HOWTO at 35 and the Framebuffer-HOWTO at
36 <http://www.munted.org.uk/programming/Framebuffer-HOWTO-1.3.html> for more 36 <http://www.munted.org.uk/programming/Framebuffer-HOWTO-1.3.html> for more
37 information. 37 information.
@@ -241,7 +241,7 @@ config FB_CIRRUS
241 If you have a PCI-based system, this enables support for these 241 If you have a PCI-based system, this enables support for these
242 chips: GD-543x, GD-544x, GD-5480. 242 chips: GD-543x, GD-544x, GD-5480.
243 243
244 Please read the file <file:Documentation/fb/cirrusfb.txt>. 244 Please read the file <file:Documentation/fb/cirrusfb.rst>.
245 245
246 Say N unless you have such a graphics board or plan to get one 246 Say N unless you have such a graphics board or plan to get one
247 before you next recompile the kernel. 247 before you next recompile the kernel.
@@ -289,7 +289,7 @@ config FB_ARMCLCD
289 289
290 If you want to compile this as a module (=code which can be 290 If you want to compile this as a module (=code which can be
291 inserted into and removed from the running kernel), say M 291 inserted into and removed from the running kernel), say M
292 here and read <file:Documentation/kbuild/modules.txt>. The module 292 here and read <file:Documentation/kbuild/modules.rst>. The module
293 will be called amba-clcd. 293 will be called amba-clcd.
294 294
295config FB_ACORN 295config FB_ACORN
@@ -615,7 +615,7 @@ config FB_UVESA
615 615
616 This driver generally provides more features than vesafb but 616 This driver generally provides more features than vesafb but
617 requires a userspace helper application called 'v86d'. See 617 requires a userspace helper application called 'v86d'. See
618 <file:Documentation/fb/uvesafb.txt> for more information. 618 <file:Documentation/fb/uvesafb.rst> for more information.
619 619
620 If unsure, say N. 620 If unsure, say N.
621 621
@@ -630,7 +630,7 @@ config FB_VESA
630 This is the frame buffer device driver for generic VESA 2.0 630 This is the frame buffer device driver for generic VESA 2.0
631 compliant graphic cards. The older VESA 1.2 cards are not supported. 631 compliant graphic cards. The older VESA 1.2 cards are not supported.
632 You will get a boot time penguin logo at no additional cost. Please 632 You will get a boot time penguin logo at no additional cost. Please
633 read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. 633 read <file:Documentation/fb/vesafb.rst>. If unsure, say Y.
634 634
635config FB_EFI 635config FB_EFI
636 bool "EFI-based Framebuffer Support" 636 bool "EFI-based Framebuffer Support"
@@ -828,7 +828,7 @@ config FB_PVR2
828 module load time. The parameters look like "video=pvr2:XXX", where 828 module load time. The parameters look like "video=pvr2:XXX", where
829 the meaning of XXX can be found at the end of the main source file 829 the meaning of XXX can be found at the end of the main source file
830 (<file:drivers/video/pvr2fb.c>). Please see the file 830 (<file:drivers/video/pvr2fb.c>). Please see the file
831 <file:Documentation/fb/pvr2fb.txt>. 831 <file:Documentation/fb/pvr2fb.rst>.
832 832
833config FB_OPENCORES 833config FB_OPENCORES
834 tristate "OpenCores VGA/LCD core 2.0 framebuffer support" 834 tristate "OpenCores VGA/LCD core 2.0 framebuffer support"
@@ -991,7 +991,7 @@ config FB_I810
991 module will be called i810fb. 991 module will be called i810fb.
992 992
993 For more information, please read 993 For more information, please read
994 <file:Documentation/fb/intel810.txt> 994 <file:Documentation/fb/intel810.rst>
995 995
996config FB_I810_GTF 996config FB_I810_GTF
997 bool "use VESA Generalized Timing Formula" 997 bool "use VESA Generalized Timing Formula"
@@ -1061,7 +1061,7 @@ config FB_INTEL
1061 To compile this driver as a module, choose M here: the 1061 To compile this driver as a module, choose M here: the
1062 module will be called intelfb. 1062 module will be called intelfb.
1063 1063
1064 For more information, please read <file:Documentation/fb/intelfb.txt> 1064 For more information, please read <file:Documentation/fb/intelfb.rst>
1065 1065
1066config FB_INTEL_DEBUG 1066config FB_INTEL_DEBUG
1067 bool "Intel driver Debug Messages" 1067 bool "Intel driver Debug Messages"
@@ -1098,7 +1098,7 @@ config FB_MATROX
1098 1098
1099 You can pass several parameters to the driver at boot time or at 1099 You can pass several parameters to the driver at boot time or at
1100 module load time. The parameters look like "video=matroxfb:XXX", and 1100 module load time. The parameters look like "video=matroxfb:XXX", and
1101 are described in <file:Documentation/fb/matroxfb.txt>. 1101 are described in <file:Documentation/fb/matroxfb.rst>.
1102 1102
1103config FB_MATROX_MILLENIUM 1103config FB_MATROX_MILLENIUM
1104 bool "Millennium I/II support" 1104 bool "Millennium I/II support"
@@ -1249,7 +1249,7 @@ config FB_ATY128
1249 help 1249 help
1250 This driver supports graphics boards with the ATI Rage128 chips. 1250 This driver supports graphics boards with the ATI Rage128 chips.
1251 Say Y if you have such a graphics board and read 1251 Say Y if you have such a graphics board and read
1252 <file:Documentation/fb/aty128fb.txt>. 1252 <file:Documentation/fb/aty128fb.rst>.
1253 1253
1254 To compile this driver as a module, choose M here: the 1254 To compile this driver as a module, choose M here: the
1255 module will be called aty128fb. 1255 module will be called aty128fb.
@@ -1511,7 +1511,7 @@ config FB_VOODOO1
1511 1511
1512 WARNING: Do not use any application that uses the 3D engine 1512 WARNING: Do not use any application that uses the 3D engine
1513 (namely glide) while using this driver. 1513 (namely glide) while using this driver.
1514 Please read the <file:Documentation/fb/sstfb.txt> for supported 1514 Please read the <file:Documentation/fb/sstfb.rst> for supported
1515 options and other important info support. 1515 options and other important info support.
1516 1516
1517config FB_VT8623 1517config FB_VT8623
@@ -1543,7 +1543,7 @@ config FB_TRIDENT
1543 There are also integrated versions of these chips called CyberXXXX, 1543 There are also integrated versions of these chips called CyberXXXX,
1544 CyberImage or CyberBlade. These chips are mostly found in laptops 1544 CyberImage or CyberBlade. These chips are mostly found in laptops
1545 but also on some motherboards including early VIA EPIA motherboards. 1545 but also on some motherboards including early VIA EPIA motherboards.
1546 For more information, read <file:Documentation/fb/tridentfb.txt> 1546 For more information, read <file:Documentation/fb/tridentfb.rst>
1547 1547
1548 Say Y if you have such a graphics board. 1548 Say Y if you have such a graphics board.
1549 1549
@@ -1757,7 +1757,7 @@ config FB_PXA
1757 This driver is also available as a module ( = code which can be 1757 This driver is also available as a module ( = code which can be
1758 inserted and removed from the running kernel whenever you want). The 1758 inserted and removed from the running kernel whenever you want). The
1759 module will be called pxafb. If you want to compile it as a module, 1759 module will be called pxafb. If you want to compile it as a module,
1760 say M here and read <file:Documentation/kbuild/modules.txt>. 1760 say M here and read <file:Documentation/kbuild/modules.rst>.
1761 1761
1762 If unsure, say N. 1762 If unsure, say N.
1763 1763
@@ -1783,7 +1783,7 @@ config FB_PXA_PARAMETERS
1783 single model of flatpanel then you can safely leave this 1783 single model of flatpanel then you can safely leave this
1784 option disabled. 1784 option disabled.
1785 1785
1786 <file:Documentation/fb/pxafb.txt> describes the available parameters. 1786 <file:Documentation/fb/pxafb.rst> describes the available parameters.
1787 1787
1788config PXA3XX_GCU 1788config PXA3XX_GCU
1789 tristate "PXA3xx 2D graphics accelerator driver" 1789 tristate "PXA3xx 2D graphics accelerator driver"
@@ -1838,7 +1838,7 @@ config FB_W100
1838 This driver is also available as a module ( = code which can be 1838 This driver is also available as a module ( = code which can be
1839 inserted and removed from the running kernel whenever you want). The 1839 inserted and removed from the running kernel whenever you want). The
1840 module will be called w100fb. If you want to compile it as a module, 1840 module will be called w100fb. If you want to compile it as a module,
1841 say M here and read <file:Documentation/kbuild/modules.txt>. 1841 say M here and read <file:Documentation/kbuild/modules.rst>.
1842 1842
1843 If unsure, say N. 1843 If unsure, say N.
1844 1844
@@ -1867,7 +1867,7 @@ config FB_TMIO
1867 This driver is also available as a module ( = code which can be 1867 This driver is also available as a module ( = code which can be
1868 inserted and removed from the running kernel whenever you want). The 1868 inserted and removed from the running kernel whenever you want). The
1869 module will be called tmiofb. If you want to compile it as a module, 1869 module will be called tmiofb. If you want to compile it as a module,
1870 say M here and read <file:Documentation/kbuild/modules.txt>. 1870 say M here and read <file:Documentation/kbuild/modules.rst>.
1871 1871
1872 If unsure, say N. 1872 If unsure, say N.
1873 1873
@@ -1914,7 +1914,7 @@ config FB_S3C2410
1914 This driver is also available as a module ( = code which can be 1914 This driver is also available as a module ( = code which can be
1915 inserted and removed from the running kernel whenever you want). The 1915 inserted and removed from the running kernel whenever you want). The
1916 module will be called s3c2410fb. If you want to compile it as a module, 1916 module will be called s3c2410fb. If you want to compile it as a module,
1917 say M here and read <file:Documentation/kbuild/modules.txt>. 1917 say M here and read <file:Documentation/kbuild/modules.rst>.
1918 1918
1919 If unsure, say N. 1919 If unsure, say N.
1920config FB_S3C2410_DEBUG 1920config FB_S3C2410_DEBUG
@@ -1951,7 +1951,7 @@ config FB_SM501
1951 This driver is also available as a module ( = code which can be 1951 This driver is also available as a module ( = code which can be
1952 inserted and removed from the running kernel whenever you want). The 1952 inserted and removed from the running kernel whenever you want). The
1953 module will be called sm501fb. If you want to compile it as a module, 1953 module will be called sm501fb. If you want to compile it as a module,
1954 say M here and read <file:Documentation/kbuild/modules.txt>. 1954 say M here and read <file:Documentation/kbuild/modules.rst>.
1955 1955
1956 If unsure, say N. 1956 If unsure, say N.
1957 1957
@@ -2284,7 +2284,7 @@ config FB_SM712
2284 2284
2285 This driver is also available as a module. The module will be 2285 This driver is also available as a module. The module will be
2286 called sm712fb. If you want to compile it as a module, say M 2286 called sm712fb. If you want to compile it as a module, say M
2287 here and read <file:Documentation/kbuild/modules.txt>. 2287 here and read <file:Documentation/kbuild/modules.rst>.
2288 2288
2289source "drivers/video/fbdev/omap/Kconfig" 2289source "drivers/video/fbdev/omap/Kconfig"
2290source "drivers/video/fbdev/omap2/Kconfig" 2290source "drivers/video/fbdev/omap2/Kconfig"
diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c
index c76bef078c75..1a555f70923a 100644
--- a/drivers/video/fbdev/matrox/matroxfb_base.c
+++ b/drivers/video/fbdev/matrox/matroxfb_base.c
@@ -2502,7 +2502,7 @@ MODULE_PARM_DESC(nobios, "Disables ROM BIOS (0 or 1=disabled) (default=do not ch
2502module_param(noinit, int, 0); 2502module_param(noinit, int, 0);
2503MODULE_PARM_DESC(noinit, "Disables W/SG/SD-RAM and bus interface initialization (0 or 1=do not initialize) (default=0)"); 2503MODULE_PARM_DESC(noinit, "Disables W/SG/SD-RAM and bus interface initialization (0 or 1=do not initialize) (default=0)");
2504module_param(memtype, int, 0); 2504module_param(memtype, int, 0);
2505MODULE_PARM_DESC(memtype, "Memory type for G200/G400 (see Documentation/fb/matroxfb.txt for explanation) (default=3 for G200, 0 for G400)"); 2505MODULE_PARM_DESC(memtype, "Memory type for G200/G400 (see Documentation/fb/matroxfb.rst for explanation) (default=3 for G200, 0 for G400)");
2506module_param(mtrr, int, 0); 2506module_param(mtrr, int, 0);
2507MODULE_PARM_DESC(mtrr, "This speeds up video memory accesses (0=disabled or 1) (default=1)"); 2507MODULE_PARM_DESC(mtrr, "This speeds up video memory accesses (0=disabled or 1) (default=1)");
2508module_param(sgram, int, 0); 2508module_param(sgram, int, 0);
diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index d59c8a59f582..4282cb117b92 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2068,7 +2068,7 @@ static int __init pxafb_setup_options(void)
2068#define pxafb_setup_options() (0) 2068#define pxafb_setup_options() (0)
2069 2069
2070module_param_string(options, g_options, sizeof(g_options), 0); 2070module_param_string(options, g_options, sizeof(g_options), 0);
2071MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)"); 2071MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.rst)");
2072#endif 2072#endif
2073 2073
2074#else 2074#else
diff --git a/drivers/video/fbdev/sh7760fb.c b/drivers/video/fbdev/sh7760fb.c
index 405715b60ec7..ab8fe838c776 100644
--- a/drivers/video/fbdev/sh7760fb.c
+++ b/drivers/video/fbdev/sh7760fb.c
@@ -6,7 +6,7 @@
6 * Manuel Lauss <mano@roarinelk.homelinux.net> 6 * Manuel Lauss <mano@roarinelk.homelinux.net>
7 * (c) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> 7 * (c) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
8 * 8 *
9 * PLEASE HAVE A LOOK AT Documentation/fb/sh7760fb.txt! 9 * PLEASE HAVE A LOOK AT Documentation/fb/sh7760fb.rst!
10 * 10 *
11 * Thanks to Siegfried Schaefer <s.schaefer at schaefer-edv.de> 11 * Thanks to Siegfried Schaefer <s.schaefer at schaefer-edv.de>
12 * for his original source and testing! 12 * for his original source and testing!
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index ffe754539f5a..6cad0b33d7ad 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -18,7 +18,7 @@ menuconfig WATCHDOG
18 reboot the machine) and a driver for hardware watchdog boards, which 18 reboot the machine) and a driver for hardware watchdog boards, which
19 are more robust and can also keep track of the temperature inside 19 are more robust and can also keep track of the temperature inside
20 your computer. For details, read 20 your computer. For details, read
21 <file:Documentation/watchdog/watchdog-api.txt> in the kernel source. 21 <file:Documentation/watchdog/watchdog-api.rst> in the kernel source.
22 22
23 The watchdog is usually used together with the watchdog daemon 23 The watchdog is usually used together with the watchdog daemon
24 which is available from 24 which is available from
@@ -1870,7 +1870,7 @@ config BOOKE_WDT
1870 Watchdog driver for PowerPC Book-E chips, such as the Freescale 1870 Watchdog driver for PowerPC Book-E chips, such as the Freescale
1871 MPC85xx SOCs and the IBM PowerPC 440. 1871 MPC85xx SOCs and the IBM PowerPC 440.
1872 1872
1873 Please see Documentation/watchdog/watchdog-api.txt for 1873 Please see Documentation/watchdog/watchdog-api.rst for
1874 more information. 1874 more information.
1875 1875
1876config BOOKE_WDT_DEFAULT_TIMEOUT 1876config BOOKE_WDT_DEFAULT_TIMEOUT
@@ -2019,7 +2019,7 @@ config PCWATCHDOG
2019 This card simply watches your kernel to make sure it doesn't freeze, 2019 This card simply watches your kernel to make sure it doesn't freeze,
2020 and if it does, it reboots your computer after a certain amount of 2020 and if it does, it reboots your computer after a certain amount of
2021 time. This driver is like the WDT501 driver but for different 2021 time. This driver is like the WDT501 driver but for different
2022 hardware. Please read <file:Documentation/watchdog/pcwd-watchdog.txt>. The PC 2022 hardware. Please read <file:Documentation/watchdog/pcwd-watchdog.rst>. The PC
2023 watchdog cards can be ordered from <http://www.berkprod.com/>. 2023 watchdog cards can be ordered from <http://www.berkprod.com/>.
2024 2024
2025 To compile this driver as a module, choose M here: the 2025 To compile this driver as a module, choose M here: the
diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c
index 13c817ea1d6a..f5713030d0f7 100644
--- a/drivers/watchdog/smsc37b787_wdt.c
+++ b/drivers/watchdog/smsc37b787_wdt.c
@@ -36,7 +36,7 @@
36 * mknod /dev/watchdog c 10 130 36 * mknod /dev/watchdog c 10 130
37 * 37 *
38 * For an example userspace keep-alive daemon, see: 38 * For an example userspace keep-alive daemon, see:
39 * Documentation/watchdog/wdt.txt 39 * Documentation/watchdog/wdt.rst
40 */ 40 */
41 41
42#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 42#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 84f2b3642ab0..5eb175933a5b 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -12,7 +12,7 @@
12#define ACPI_MAX_STRING 80 12#define ACPI_MAX_STRING 80
13 13
14/* 14/*
15 * Please update drivers/acpi/debug.c and Documentation/acpi/debug.txt 15 * Please update drivers/acpi/debug.c and Documentation/firmware-guide/acpi/debug.rst
16 * if you add to this list. 16 * if you add to this list.
17 */ 17 */
18#define ACPI_BUS_COMPONENT 0x00010000 18#define ACPI_BUS_COMPONENT 0x00010000
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index f14e587c5d5d..5e0eadf7de55 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -153,7 +153,7 @@ struct dentry_operations {
153 * Locking rules for dentry_operations callbacks are to be found in 153 * Locking rules for dentry_operations callbacks are to be found in
154 * Documentation/filesystems/Locking. Keep it updated! 154 * Documentation/filesystems/Locking. Keep it updated!
155 * 155 *
156 * FUrther descriptions are found in Documentation/filesystems/vfs.txt. 156 * FUrther descriptions are found in Documentation/filesystems/vfs.rst.
157 * Keep it updated too! 157 * Keep it updated too!
158 */ 158 */
159 159
@@ -568,7 +568,7 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper)
568 * If dentry is on a union/overlay, then return the underlying, real dentry. 568 * If dentry is on a union/overlay, then return the underlying, real dentry.
569 * Otherwise return the dentry itself. 569 * Otherwise return the dentry itself.
570 * 570 *
571 * See also: Documentation/filesystems/vfs.txt 571 * See also: Documentation/filesystems/vfs.rst
572 */ 572 */
573static inline struct dentry *d_real(struct dentry *dentry, 573static inline struct dentry *d_real(struct dentry *dentry,
574 const struct inode *inode) 574 const struct inode *inode)
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h
index 7e6c77740413..e525f6957c49 100644
--- a/include/linux/fault-inject.h
+++ b/include/linux/fault-inject.h
@@ -11,7 +11,7 @@
11 11
12/* 12/*
13 * For explanation of the elements of this struct, see 13 * For explanation of the elements of this struct, see
14 * Documentation/fault-injection/fault-injection.txt 14 * Documentation/fault-injection/fault-injection.rst
15 */ 15 */
16struct fault_attr { 16struct fault_attr {
17 unsigned long probability; 17 unsigned long probability;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f7fdfe93e25d..c564cf3f48d9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1769,7 +1769,7 @@ struct block_device_operations;
1769/* 1769/*
1770 * These flags control the behavior of the remap_file_range function pointer. 1770 * These flags control the behavior of the remap_file_range function pointer.
1771 * If it is called with len == 0 that means "remap to end of source file". 1771 * If it is called with len == 0 that means "remap to end of source file".
1772 * See Documentation/filesystems/vfs.txt for more details about this call. 1772 * See Documentation/filesystems/vfs.rst for more details about this call.
1773 * 1773 *
1774 * REMAP_FILE_DEDUP: only remap if contents identical (i.e. deduplicate) 1774 * REMAP_FILE_DEDUP: only remap if contents identical (i.e. deduplicate)
1775 * REMAP_FILE_CAN_SHORTEN: caller can handle a shortened request 1775 * REMAP_FILE_CAN_SHORTEN: caller can handle a shortened request
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
index d476ff0c10df..4933187d5b9a 100644
--- a/include/linux/fs_context.h
+++ b/include/linux/fs_context.h
@@ -81,7 +81,7 @@ struct fs_parameter {
81 * Superblock creation fills in ->root whereas reconfiguration begins with this 81 * Superblock creation fills in ->root whereas reconfiguration begins with this
82 * already set. 82 * already set.
83 * 83 *
84 * See Documentation/filesystems/mounting.txt 84 * See Documentation/filesystems/mount_api.txt
85 */ 85 */
86struct fs_context { 86struct fs_context {
87 const struct fs_context_operations *ops; 87 const struct fs_context_operations *ops;
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 3908353deec6..35e15dfd4155 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -21,7 +21,7 @@
21 * @cond: Break condition (usually involving @val) 21 * @cond: Break condition (usually involving @val)
22 * @sleep_us: Maximum time to sleep between reads in us (0 22 * @sleep_us: Maximum time to sleep between reads in us (0
23 * tight-loops). Should be less than ~20ms since usleep_range 23 * tight-loops). Should be less than ~20ms since usleep_range
24 * is used (see Documentation/timers/timers-howto.txt). 24 * is used (see Documentation/timers/timers-howto.rst).
25 * @timeout_us: Timeout in us, 0 means never timeout 25 * @timeout_us: Timeout in us, 0 means never timeout
26 * 26 *
27 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either 27 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
@@ -60,7 +60,7 @@
60 * @cond: Break condition (usually involving @val) 60 * @cond: Break condition (usually involving @val)
61 * @delay_us: Time to udelay between reads in us (0 tight-loops). Should 61 * @delay_us: Time to udelay between reads in us (0 tight-loops). Should
62 * be less than ~10us since udelay is used (see 62 * be less than ~10us since udelay is used (see
63 * Documentation/timers/timers-howto.txt). 63 * Documentation/timers/timers-howto.rst).
64 * @timeout_us: Timeout in us, 0 means never timeout 64 * @timeout_us: Timeout in us, 0 means never timeout
65 * 65 *
66 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either 66 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 47f58cfb6a19..df1318d85f7d 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -77,7 +77,7 @@
77 * state. This is called immediately after commit_creds(). 77 * state. This is called immediately after commit_creds().
78 * 78 *
79 * Security hooks for mount using fs_context. 79 * Security hooks for mount using fs_context.
80 * [See also Documentation/filesystems/mounting.txt] 80 * [See also Documentation/filesystems/mount_api.txt]
81 * 81 *
82 * @fs_context_dup: 82 * @fs_context_dup:
83 * Allocate and attach a security structure to sc->security. This pointer 83 * Allocate and attach a security structure to sc->security. This pointer
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 38e1369e8bd0..dfe493ac692d 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -110,7 +110,7 @@ struct reg_sequence {
110 * @cond: Break condition (usually involving @val) 110 * @cond: Break condition (usually involving @val)
111 * @sleep_us: Maximum time to sleep between reads in us (0 111 * @sleep_us: Maximum time to sleep between reads in us (0
112 * tight-loops). Should be less than ~20ms since usleep_range 112 * tight-loops). Should be less than ~20ms since usleep_range
113 * is used (see Documentation/timers/timers-howto.txt). 113 * is used (see Documentation/timers/timers-howto.rst).
114 * @timeout_us: Timeout in us, 0 means never timeout 114 * @timeout_us: Timeout in us, 0 means never timeout
115 * 115 *
116 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read 116 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
@@ -152,7 +152,7 @@ struct reg_sequence {
152 * @cond: Break condition (usually involving @val) 152 * @cond: Break condition (usually involving @val)
153 * @sleep_us: Maximum time to sleep between reads in us (0 153 * @sleep_us: Maximum time to sleep between reads in us (0
154 * tight-loops). Should be less than ~20ms since usleep_range 154 * tight-loops). Should be less than ~20ms since usleep_range
155 * is used (see Documentation/timers/timers-howto.txt). 155 * is used (see Documentation/timers/timers-howto.rst).
156 * @timeout_us: Timeout in us, 0 means never timeout 156 * @timeout_us: Timeout in us, 0 means never timeout
157 * 157 *
158 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read 158 * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_field_read
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 0f42a7b82d18..b7a8de88b3c0 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -36,7 +36,7 @@ struct config_t;
36struct net_device; 36struct net_device;
37 37
38/* dynamic device IDs for PCMCIA device drivers. See 38/* dynamic device IDs for PCMCIA device drivers. See
39 * Documentation/pcmcia/driver.txt for details. 39 * Documentation/pcmcia/driver.rst for details.
40*/ 40*/
41struct pcmcia_dynids { 41struct pcmcia_dynids {
42 struct mutex lock; 42 struct mutex lock;
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 4039cb117733..7cf7dbbfa131 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -187,7 +187,7 @@ struct pcmcia_socket {
187 unsigned int sysfs_events; 187 unsigned int sysfs_events;
188 188
189 /* For the non-trivial interaction between these locks, 189 /* For the non-trivial interaction between these locks,
190 * see Documentation/pcmcia/locking.txt */ 190 * see Documentation/pcmcia/locking.rst */
191 struct mutex skt_mutex; 191 struct mutex skt_mutex;
192 struct mutex ops_mutex; 192 struct mutex ops_mutex;
193 193
diff --git a/init/Kconfig b/init/Kconfig
index d3a1df424ce4..d3ad48272924 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -787,7 +787,7 @@ menuconfig CGROUPS
787 use with process control subsystems such as Cpusets, CFS, memory 787 use with process control subsystems such as Cpusets, CFS, memory
788 controls or device isolation. 788 controls or device isolation.
789 See 789 See
790 - Documentation/scheduler/sched-design-CFS.txt (CFS) 790 - Documentation/scheduler/sched-design-CFS.rst (CFS)
791 - Documentation/cgroup-v1/ (features for grouping, isolation 791 - Documentation/cgroup-v1/ (features for grouping, isolation
792 and resource control) 792 and resource control)
793 793
@@ -880,7 +880,7 @@ config CFS_BANDWIDTH
880 tasks running within the fair group scheduler. Groups with no limit 880 tasks running within the fair group scheduler. Groups with no limit
881 set are considered to be unconstrained and will run with no 881 set are considered to be unconstrained and will run with no
882 restriction. 882 restriction.
883 See Documentation/scheduler/sched-bwc.txt for more information. 883 See Documentation/scheduler/sched-bwc.rst for more information.
884 884
885config RT_GROUP_SCHED 885config RT_GROUP_SCHED
886 bool "Group scheduling for SCHED_RR/FIFO" 886 bool "Group scheduling for SCHED_RR/FIFO"
@@ -891,7 +891,7 @@ config RT_GROUP_SCHED
891 to task groups. If enabled, it will also make it impossible to 891 to task groups. If enabled, it will also make it impossible to
892 schedule realtime tasks for non-root users until you allocate 892 schedule realtime tasks for non-root users until you allocate
893 realtime bandwidth for them. 893 realtime bandwidth for them.
894 See Documentation/scheduler/sched-rt-group.txt for more information. 894 See Documentation/scheduler/sched-rt-group.rst for more information.
895 895
896endif #CGROUP_SCHED 896endif #CGROUP_SCHED
897 897
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 8b5bb2ac16e2..ef5b9f6b1d42 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -726,7 +726,7 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se,
726 * refill the runtime and set the deadline a period in the future, 726 * refill the runtime and set the deadline a period in the future,
727 * because keeping the current (absolute) deadline of the task would 727 * because keeping the current (absolute) deadline of the task would
728 * result in breaking guarantees promised to other tasks (refer to 728 * result in breaking guarantees promised to other tasks (refer to
729 * Documentation/scheduler/sched-deadline.txt for more information). 729 * Documentation/scheduler/sched-deadline.rst for more information).
730 * 730 *
731 * This function returns true if: 731 * This function returns true if:
732 * 732 *
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 06d9c9d70385..b0c5f6ca9a5c 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1701,7 +1701,7 @@ config LKDTM
1701 called lkdtm. 1701 called lkdtm.
1702 1702
1703 Documentation on how to use the module can be found in 1703 Documentation on how to use the module can be found in
1704 Documentation/fault-injection/provoke-crashes.txt 1704 Documentation/fault-injection/provoke-crashes.rst
1705 1705
1706config TEST_LIST_SORT 1706config TEST_LIST_SORT
1707 tristate "Linked list sorting test" 1707 tristate "Linked list sorting test"
diff --git a/lib/list_sort.c b/lib/list_sort.c
index 712ed1f4eb64..52f0c258c895 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -157,9 +157,11 @@ static void merge_final(void *priv, cmp_func cmp, struct list_head *head,
157 * 157 *
158 * The number of pending lists of size 2^k is determined by the 158 * The number of pending lists of size 2^k is determined by the
159 * state of bit k of "count" plus two extra pieces of information: 159 * state of bit k of "count" plus two extra pieces of information:
160 *
160 * - The state of bit k-1 (when k == 0, consider bit -1 always set), and 161 * - The state of bit k-1 (when k == 0, consider bit -1 always set), and
161 * - Whether the higher-order bits are zero or non-zero (i.e. 162 * - Whether the higher-order bits are zero or non-zero (i.e.
162 * is count >= 2^(k+1)). 163 * is count >= 2^(k+1)).
164 *
163 * There are six states we distinguish. "x" represents some arbitrary 165 * There are six states we distinguish. "x" represents some arbitrary
164 * bits, and "y" represents some arbitrary non-zero bits: 166 * bits, and "y" represents some arbitrary non-zero bits:
165 * 0: 00x: 0 pending of size 2^k; x pending of sizes < 2^k 167 * 0: 00x: 0 pending of size 2^k; x pending of sizes < 2^k
diff --git a/mm/Kconfig b/mm/Kconfig
index f0c76ba47695..ef6efedc5921 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -166,7 +166,7 @@ config MEMORY_HOTPLUG_DEFAULT_ONLINE
166 onlining policy (/sys/devices/system/memory/auto_online_blocks) which 166 onlining policy (/sys/devices/system/memory/auto_online_blocks) which
167 determines what happens to newly added memory regions. Policy setting 167 determines what happens to newly added memory regions. Policy setting
168 can always be changed at runtime. 168 can always be changed at runtime.
169 See Documentation/memory-hotplug.txt for more information. 169 See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
170 170
171 Say Y here if you want all hot-plugged memory blocks to appear in 171 Say Y here if you want all hot-plugged memory blocks to appear in
172 'online' state by default. 172 'online' state by default.
diff --git a/net/bridge/netfilter/Kconfig b/net/bridge/netfilter/Kconfig
index c3ad90c43801..36a98d36d339 100644
--- a/net/bridge/netfilter/Kconfig
+++ b/net/bridge/netfilter/Kconfig
@@ -114,7 +114,7 @@ config BRIDGE_EBT_LIMIT
114 equivalent of the iptables limit match. 114 equivalent of the iptables limit match.
115 115
116 If you want to compile it as a module, say M here and read 116 If you want to compile it as a module, say M here and read
117 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 117 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
118 118
119config BRIDGE_EBT_MARK 119config BRIDGE_EBT_MARK
120 tristate "ebt: mark filter support" 120 tristate "ebt: mark filter support"
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 3e6494269501..69e76d677f9e 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -308,7 +308,7 @@ config IP_NF_RAW
308 and OUTPUT chains. 308 and OUTPUT chains.
309 309
310 If you want to compile it as a module, say M here and read 310 If you want to compile it as a module, say M here and read
311 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 311 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
312 312
313# security table for MAC policy 313# security table for MAC policy
314config IP_NF_SECURITY 314config IP_NF_SECURITY
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
index f7c6f5be9f76..6120a7800975 100644
--- a/net/ipv6/netfilter/Kconfig
+++ b/net/ipv6/netfilter/Kconfig
@@ -241,7 +241,7 @@ config IP6_NF_RAW
241 and OUTPUT chains. 241 and OUTPUT chains.
242 242
243 If you want to compile it as a module, say M here and read 243 If you want to compile it as a module, say M here and read
244 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 244 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
245 245
246# security table for MAC policy 246# security table for MAC policy
247config IP6_NF_SECURITY 247config IP6_NF_SECURITY
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 66cc11742355..1837734ce85b 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -1056,7 +1056,7 @@ config NETFILTER_XT_TARGET_TRACE
1056 the tables, chains, rules. 1056 the tables, chains, rules.
1057 1057
1058 If you want to compile it as a module, say M here and read 1058 If you want to compile it as a module, say M here and read
1059 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1059 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
1060 1060
1061config NETFILTER_XT_TARGET_SECMARK 1061config NETFILTER_XT_TARGET_SECMARK
1062 tristate '"SECMARK" target support' 1062 tristate '"SECMARK" target support'
@@ -1115,7 +1115,7 @@ config NETFILTER_XT_MATCH_ADDRTYPE
1115 eg. UNICAST, LOCAL, BROADCAST, ... 1115 eg. UNICAST, LOCAL, BROADCAST, ...
1116 1116
1117 If you want to compile it as a module, say M here and read 1117 If you want to compile it as a module, say M here and read
1118 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1118 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
1119 1119
1120config NETFILTER_XT_MATCH_BPF 1120config NETFILTER_XT_MATCH_BPF
1121 tristate '"bpf" match support' 1121 tristate '"bpf" match support'
@@ -1160,7 +1160,7 @@ config NETFILTER_XT_MATCH_COMMENT
1160 comments in your iptables ruleset. 1160 comments in your iptables ruleset.
1161 1161
1162 If you want to compile it as a module, say M here and read 1162 If you want to compile it as a module, say M here and read
1163 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1163 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
1164 1164
1165config NETFILTER_XT_MATCH_CONNBYTES 1165config NETFILTER_XT_MATCH_CONNBYTES
1166 tristate '"connbytes" per-connection counter match support' 1166 tristate '"connbytes" per-connection counter match support'
@@ -1171,7 +1171,7 @@ config NETFILTER_XT_MATCH_CONNBYTES
1171 number of bytes and/or packets for each direction within a connection. 1171 number of bytes and/or packets for each direction within a connection.
1172 1172
1173 If you want to compile it as a module, say M here and read 1173 If you want to compile it as a module, say M here and read
1174 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1174 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
1175 1175
1176config NETFILTER_XT_MATCH_CONNLABEL 1176config NETFILTER_XT_MATCH_CONNLABEL
1177 tristate '"connlabel" match support' 1177 tristate '"connlabel" match support'
@@ -1237,7 +1237,7 @@ config NETFILTER_XT_MATCH_DCCP
1237 and DCCP flags. 1237 and DCCP flags.
1238 1238
1239 If you want to compile it as a module, say M here and read 1239 If you want to compile it as a module, say M here and read
1240 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1240 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
1241 1241
1242config NETFILTER_XT_MATCH_DEVGROUP 1242config NETFILTER_XT_MATCH_DEVGROUP
1243 tristate '"devgroup" match support' 1243 tristate '"devgroup" match support'
@@ -1473,7 +1473,7 @@ config NETFILTER_XT_MATCH_QUOTA
1473 byte counter. 1473 byte counter.
1474 1474
1475 If you want to compile it as a module, say M here and read 1475 If you want to compile it as a module, say M here and read
1476 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1476 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
1477 1477
1478config NETFILTER_XT_MATCH_RATEEST 1478config NETFILTER_XT_MATCH_RATEEST
1479 tristate '"rateest" match support' 1479 tristate '"rateest" match support'
@@ -1497,7 +1497,7 @@ config NETFILTER_XT_MATCH_REALM
1497 in tc world. 1497 in tc world.
1498 1498
1499 If you want to compile it as a module, say M here and read 1499 If you want to compile it as a module, say M here and read
1500 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1500 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
1501 1501
1502config NETFILTER_XT_MATCH_RECENT 1502config NETFILTER_XT_MATCH_RECENT
1503 tristate '"recent" match support' 1503 tristate '"recent" match support'
@@ -1519,7 +1519,7 @@ config NETFILTER_XT_MATCH_SCTP
1519 and SCTP chunk types. 1519 and SCTP chunk types.
1520 1520
1521 If you want to compile it as a module, say M here and read 1521 If you want to compile it as a module, say M here and read
1522 <file:Documentation/kbuild/modules.txt>. If unsure, say `N'. 1522 <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
1523 1523
1524config NETFILTER_XT_MATCH_SOCKET 1524config NETFILTER_XT_MATCH_SOCKET
1525 tristate '"socket" match support' 1525 tristate '"socket" match support'
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index b93bb7bdb04a..b83e16ade4d2 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -17,7 +17,7 @@ menuconfig TIPC
17 This protocol support is also available as a module ( = code which 17 This protocol support is also available as a module ( = code which
18 can be inserted in and removed from the running kernel whenever you 18 can be inserted in and removed from the running kernel whenever you
19 want). The module will be called tipc. If you want to compile it 19 want). The module will be called tipc. If you want to compile it
20 as a module, say M here and read <file:Documentation/kbuild/modules.txt>. 20 as a module, say M here and read <file:Documentation/kbuild/modules.rst>.
21 21
22 If in doubt, say N. 22 If in doubt, say N.
23 23
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index f641bb0aa63f..ee58cde8ee3b 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -68,7 +68,7 @@ endef
68 68
69###### 69######
70# gcc support functions 70# gcc support functions
71# See documentation in Documentation/kbuild/makefiles.txt 71# See documentation in Documentation/kbuild/makefiles.rst
72 72
73# cc-cross-prefix 73# cc-cross-prefix
74# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) 74# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
@@ -210,7 +210,7 @@ objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o)))
210# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies 210# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies
211# including used config symbols 211# including used config symbols
212# if_changed_rule - as if_changed but execute rule instead 212# if_changed_rule - as if_changed but execute rule instead
213# See Documentation/kbuild/makefiles.txt for more info 213# See Documentation/kbuild/makefiles.rst for more info
214 214
215ifneq ($(KBUILD_NOCMDDEP),1) 215ifneq ($(KBUILD_NOCMDDEP),1)
216# Check if both arguments are the same including their order. Result is empty 216# Check if both arguments are the same including their order. Result is empty
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index b6a54bdf0965..a316d368b697 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -6,7 +6,7 @@
6# 6#
7# Both C and C++ are supported, but preferred language is C for such utilities. 7# Both C and C++ are supported, but preferred language is C for such utilities.
8# 8#
9# Sample syntax (see Documentation/kbuild/makefiles.txt for reference) 9# Sample syntax (see Documentation/kbuild/makefiles.rst for reference)
10# hostprogs-y := bin2hex 10# hostprogs-y := bin2hex
11# Will compile bin2hex.c and create an executable named bin2hex 11# Will compile bin2hex.c and create an executable named bin2hex
12# 12#
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 342c7c781ba5..a6d436809bf5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5712,7 +5712,7 @@ sub process {
5712 # ignore udelay's < 10, however 5712 # ignore udelay's < 10, however
5713 if (! ($delay < 10) ) { 5713 if (! ($delay < 10) ) {
5714 CHK("USLEEP_RANGE", 5714 CHK("USLEEP_RANGE",
5715 "usleep_range is preferred over udelay; see Documentation/timers/timers-howto.txt\n" . $herecurr); 5715 "usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst\n" . $herecurr);
5716 } 5716 }
5717 if ($delay > 2000) { 5717 if ($delay > 2000) {
5718 WARN("LONG_UDELAY", 5718 WARN("LONG_UDELAY",
@@ -5724,7 +5724,7 @@ sub process {
5724 if ($line =~ /\bmsleep\s*\((\d+)\);/) { 5724 if ($line =~ /\bmsleep\s*\((\d+)\);/) {
5725 if ($1 < 20) { 5725 if ($1 < 20) {
5726 WARN("MSLEEP", 5726 WARN("MSLEEP",
5727 "msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt\n" . $herecurr); 5727 "msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst\n" . $herecurr);
5728 } 5728 }
5729 } 5729 }
5730 5730
@@ -6115,11 +6115,11 @@ sub process {
6115 my $max = $7; 6115 my $max = $7;
6116 if ($min eq $max) { 6116 if ($min eq $max) {
6117 WARN("USLEEP_RANGE", 6117 WARN("USLEEP_RANGE",
6118 "usleep_range should not use min == max args; see Documentation/timers/timers-howto.txt\n" . "$here\n$stat\n"); 6118 "usleep_range should not use min == max args; see Documentation/timers/timers-howto.rst\n" . "$here\n$stat\n");
6119 } elsif ($min =~ /^\d+$/ && $max =~ /^\d+$/ && 6119 } elsif ($min =~ /^\d+$/ && $max =~ /^\d+$/ &&
6120 $min > $max) { 6120 $min > $max) {
6121 WARN("USLEEP_RANGE", 6121 WARN("USLEEP_RANGE",
6122 "usleep_range args reversed, use min then max; see Documentation/timers/timers-howto.txt\n" . "$here\n$stat\n"); 6122 "usleep_range args reversed, use min then max; see Documentation/timers/timers-howto.rst\n" . "$here\n$stat\n");
6123 } 6123 }
6124 } 6124 }
6125 6125
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check
index 63e9542656f1..7784c54aa38b 100755
--- a/scripts/documentation-file-ref-check
+++ b/scripts/documentation-file-ref-check
@@ -8,15 +8,30 @@ use warnings;
8use strict; 8use strict;
9use Getopt::Long qw(:config no_auto_abbrev); 9use Getopt::Long qw(:config no_auto_abbrev);
10 10
11# NOTE: only add things here when the file was gone, but the text wants
12# to mention a past documentation file, for example, to give credits for
13# the original work.
14my %false_positives = (
15 "Documentation/scsi/scsi_mid_low_api.txt" => "Documentation/Configure.help",
16 "drivers/vhost/vhost.c" => "Documentation/virtual/lguest/lguest.c",
17);
18
11my $scriptname = $0; 19my $scriptname = $0;
12$scriptname =~ s,.*/([^/]+/),$1,; 20$scriptname =~ s,.*/([^/]+/),$1,;
13 21
14# Parse arguments 22# Parse arguments
15my $help = 0; 23my $help = 0;
16my $fix = 0; 24my $fix = 0;
25my $warn = 0;
26
27if (! -d ".git") {
28 printf "Warning: can't check if file exists, as this is not a git tree";
29 exit 0;
30}
17 31
18GetOptions( 32GetOptions(
19 'fix' => \$fix, 33 'fix' => \$fix,
34 'warn' => \$warn,
20 'h|help|usage' => \$help, 35 'h|help|usage' => \$help,
21); 36);
22 37
@@ -75,6 +90,9 @@ while (<IN>) {
75 # Skip this script 90 # Skip this script
76 next if ($f eq $scriptname); 91 next if ($f eq $scriptname);
77 92
93 # Ignore the dir where documentation will be built
94 next if ($ln =~ m,\b(\S*)Documentation/output,);
95
78 if ($ln =~ m,\b(\S*)(Documentation/[A-Za-z0-9\_\.\,\~/\*\[\]\?+-]*)(.*),) { 96 if ($ln =~ m,\b(\S*)(Documentation/[A-Za-z0-9\_\.\,\~/\*\[\]\?+-]*)(.*),) {
79 my $prefix = $1; 97 my $prefix = $1;
80 my $ref = $2; 98 my $ref = $2;
@@ -109,7 +127,7 @@ while (<IN>) {
109 # Remove sched-pelt false-positive 127 # Remove sched-pelt false-positive
110 next if ($fulref =~ m,^Documentation/scheduler/sched-pelt$,); 128 next if ($fulref =~ m,^Documentation/scheduler/sched-pelt$,);
111 129
112 # Discard some build examples from Documentation/target/tcm_mod_builder.txt 130 # Discard some build examples from Documentation/target/tcm_mod_builder.rst
113 next if ($fulref =~ m,mnt/sdb/lio-core-2.6.git/Documentation/target,); 131 next if ($fulref =~ m,mnt/sdb/lio-core-2.6.git/Documentation/target,);
114 132
115 # Check if exists, evaluating wildcards 133 # Check if exists, evaluating wildcards
@@ -119,13 +137,20 @@ while (<IN>) {
119 if ($f =~ m/tools/) { 137 if ($f =~ m/tools/) {
120 my $path = $f; 138 my $path = $f;
121 $path =~ s,(.*)/.*,$1,; 139 $path =~ s,(.*)/.*,$1,;
122 next if (grep -e, glob("$path/$ref $path/$fulref")); 140 next if (grep -e, glob("$path/$ref $path/../$ref $path/$fulref"));
141 }
142
143 # Discard known false-positives
144 if (defined($false_positives{$f})) {
145 next if ($false_positives{$f} eq $fulref);
123 } 146 }
124 147
125 if ($fix) { 148 if ($fix) {
126 if (!($ref =~ m/(scripts|Kconfig|Kbuild)/)) { 149 if (!($ref =~ m/(scripts|Kconfig|Kbuild)/)) {
127 $broken_ref{$ref}++; 150 $broken_ref{$ref}++;
128 } 151 }
152 } elsif ($warn) {
153 print STDERR "Warning: $f references a file that doesn't exist: $fulref\n";
129 } else { 154 } else {
130 print STDERR "$f: $fulref\n"; 155 print STDERR "$f: $fulref\n";
131 } 156 }
@@ -141,6 +166,10 @@ print "Auto-fixing broken references. Please double-check the results\n";
141foreach my $ref (keys %broken_ref) { 166foreach my $ref (keys %broken_ref) {
142 my $new =$ref; 167 my $new =$ref;
143 168
169 my $basedir = ".";
170 # On translations, only seek inside the translations directory
171 $basedir = $1 if ($ref =~ m,(Documentation/translations/[^/]+),);
172
144 # get just the basename 173 # get just the basename
145 $new =~ s,.*/,,; 174 $new =~ s,.*/,,;
146 175
@@ -148,31 +177,40 @@ foreach my $ref (keys %broken_ref) {
148 177
149 # usual reason for breakage: DT file moved around 178 # usual reason for breakage: DT file moved around
150 if ($ref =~ /devicetree/) { 179 if ($ref =~ /devicetree/) {
151 my $search = $new; 180 # usual reason for breakage: DT file renamed to .yaml
152 $search =~ s,^.*/,,; 181 if (!$f) {
153 $f = qx(find Documentation/devicetree/ -iname "*$search*") if ($search); 182 my $new_ref = $ref;
183 $new_ref =~ s/\.txt$/.yaml/;
184 $f=$new_ref if (-f $new_ref);
185 }
186
154 if (!$f) { 187 if (!$f) {
155 # Manufacturer name may have changed 188 my $search = $new;
156 $search =~ s/^.*,//; 189 $search =~ s,^.*/,,;
157 $f = qx(find Documentation/devicetree/ -iname "*$search*") if ($search); 190 $f = qx(find Documentation/devicetree/ -iname "*$search*") if ($search);
191 if (!$f) {
192 # Manufacturer name may have changed
193 $search =~ s/^.*,//;
194 $f = qx(find Documentation/devicetree/ -iname "*$search*") if ($search);
195 }
158 } 196 }
159 } 197 }
160 198
161 # usual reason for breakage: file renamed to .rst 199 # usual reason for breakage: file renamed to .rst
162 if (!$f) { 200 if (!$f) {
163 $new =~ s/\.txt$/.rst/; 201 $new =~ s/\.txt$/.rst/;
164 $f=qx(find . -iname $new) if ($new); 202 $f=qx(find $basedir -iname $new) if ($new);
165 } 203 }
166 204
167 # usual reason for breakage: use dash or underline 205 # usual reason for breakage: use dash or underline
168 if (!$f) { 206 if (!$f) {
169 $new =~ s/[-_]/[-_]/g; 207 $new =~ s/[-_]/[-_]/g;
170 $f=qx(find . -iname $new) if ($new); 208 $f=qx(find $basedir -iname $new) if ($new);
171 } 209 }
172 210
173 # Wild guess: seek for the same name on another place 211 # Wild guess: seek for the same name on another place
174 if (!$f) { 212 if (!$f) {
175 $f = qx(find . -iname $new) if ($new); 213 $f = qx(find $basedir -iname $new) if ($new);
176 } 214 }
177 215
178 my @find = split /\s+/, $f; 216 my @find = split /\s+/, $f;
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 1f9266dadedf..09fd6fa18e1a 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -1114,7 +1114,7 @@ static void sym_check_print_recursive(struct symbol *last_sym)
1114 } 1114 }
1115 1115
1116 fprintf(stderr, 1116 fprintf(stderr,
1117 "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n" 1117 "For a resolution refer to Documentation/kbuild/kconfig-language.rst\n"
1118 "subsection \"Kconfig recursive dependency limitations\"\n" 1118 "subsection \"Kconfig recursive dependency limitations\"\n"
1119 "\n"); 1119 "\n");
1120 1120
diff --git a/scripts/kconfig/tests/err_recursive_dep/expected_stderr b/scripts/kconfig/tests/err_recursive_dep/expected_stderr
index 84679b104655..c9f4abf9a791 100644
--- a/scripts/kconfig/tests/err_recursive_dep/expected_stderr
+++ b/scripts/kconfig/tests/err_recursive_dep/expected_stderr
@@ -1,38 +1,38 @@
1Kconfig:11:error: recursive dependency detected! 1Kconfig:11:error: recursive dependency detected!
2Kconfig:11: symbol B is selected by B 2Kconfig:11: symbol B is selected by B
3For a resolution refer to Documentation/kbuild/kconfig-language.txt 3For a resolution refer to Documentation/kbuild/kconfig-language.rst
4subsection "Kconfig recursive dependency limitations" 4subsection "Kconfig recursive dependency limitations"
5 5
6Kconfig:5:error: recursive dependency detected! 6Kconfig:5:error: recursive dependency detected!
7Kconfig:5: symbol A depends on A 7Kconfig:5: symbol A depends on A
8For a resolution refer to Documentation/kbuild/kconfig-language.txt 8For a resolution refer to Documentation/kbuild/kconfig-language.rst
9subsection "Kconfig recursive dependency limitations" 9subsection "Kconfig recursive dependency limitations"
10 10
11Kconfig:17:error: recursive dependency detected! 11Kconfig:17:error: recursive dependency detected!
12Kconfig:17: symbol C1 depends on C2 12Kconfig:17: symbol C1 depends on C2
13Kconfig:21: symbol C2 depends on C1 13Kconfig:21: symbol C2 depends on C1
14For a resolution refer to Documentation/kbuild/kconfig-language.txt 14For a resolution refer to Documentation/kbuild/kconfig-language.rst
15subsection "Kconfig recursive dependency limitations" 15subsection "Kconfig recursive dependency limitations"
16 16
17Kconfig:32:error: recursive dependency detected! 17Kconfig:32:error: recursive dependency detected!
18Kconfig:32: symbol D2 is selected by D1 18Kconfig:32: symbol D2 is selected by D1
19Kconfig:27: symbol D1 depends on D2 19Kconfig:27: symbol D1 depends on D2
20For a resolution refer to Documentation/kbuild/kconfig-language.txt 20For a resolution refer to Documentation/kbuild/kconfig-language.rst
21subsection "Kconfig recursive dependency limitations" 21subsection "Kconfig recursive dependency limitations"
22 22
23Kconfig:37:error: recursive dependency detected! 23Kconfig:37:error: recursive dependency detected!
24Kconfig:37: symbol E1 depends on E2 24Kconfig:37: symbol E1 depends on E2
25Kconfig:42: symbol E2 is implied by E1 25Kconfig:42: symbol E2 is implied by E1
26For a resolution refer to Documentation/kbuild/kconfig-language.txt 26For a resolution refer to Documentation/kbuild/kconfig-language.rst
27subsection "Kconfig recursive dependency limitations" 27subsection "Kconfig recursive dependency limitations"
28 28
29Kconfig:60:error: recursive dependency detected! 29Kconfig:60:error: recursive dependency detected!
30Kconfig:60: symbol G depends on G 30Kconfig:60: symbol G depends on G
31For a resolution refer to Documentation/kbuild/kconfig-language.txt 31For a resolution refer to Documentation/kbuild/kconfig-language.rst
32subsection "Kconfig recursive dependency limitations" 32subsection "Kconfig recursive dependency limitations"
33 33
34Kconfig:51:error: recursive dependency detected! 34Kconfig:51:error: recursive dependency detected!
35Kconfig:51: symbol F2 depends on F1 35Kconfig:51: symbol F2 depends on F1
36Kconfig:49: symbol F1 default value contains F2 36Kconfig:49: symbol F1 default value contains F2
37For a resolution refer to Documentation/kbuild/kconfig-language.txt 37For a resolution refer to Documentation/kbuild/kconfig-language.rst
38subsection "Kconfig recursive dependency limitations" 38subsection "Kconfig recursive dependency limitations"
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 3350e498b4ce..6b03012750da 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -249,7 +249,7 @@ my @highlights_rst = (
249 [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], 249 [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"],
250 [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], 250 [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"],
251 [$type_fp_param, "**\$1\\\\(\\\\)**"], 251 [$type_fp_param, "**\$1\\\\(\\\\)**"],
252 [$type_func, "\\:c\\:func\\:`\$1()`"], 252 [$type_func, "\$1()"],
253 [$type_enum, "\\:c\\:type\\:`\$1 <\$2>`"], 253 [$type_enum, "\\:c\\:type\\:`\$1 <\$2>`"],
254 [$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"], 254 [$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"],
255 [$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"], 255 [$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"],
@@ -285,7 +285,7 @@ use constant {
285 OUTPUT_INTERNAL => 4, # output non-exported symbols 285 OUTPUT_INTERNAL => 4, # output non-exported symbols
286}; 286};
287my $output_selection = OUTPUT_ALL; 287my $output_selection = OUTPUT_ALL;
288my $show_not_found = 0; 288my $show_not_found = 0; # No longer used
289 289
290my @export_file_list; 290my @export_file_list;
291 291
@@ -435,7 +435,7 @@ while ($ARGV[0] =~ m/^--?(.*)/) {
435 } elsif ($cmd eq 'enable-lineno') { 435 } elsif ($cmd eq 'enable-lineno') {
436 $enable_lineno = 1; 436 $enable_lineno = 1;
437 } elsif ($cmd eq 'show-not-found') { 437 } elsif ($cmd eq 'show-not-found') {
438 $show_not_found = 1; 438 $show_not_found = 1; # A no-op but don't fail
439 } else { 439 } else {
440 # Unknown argument 440 # Unknown argument
441 usage(); 441 usage();
@@ -2163,12 +2163,14 @@ sub process_file($) {
2163 } 2163 }
2164 2164
2165 # Make sure we got something interesting. 2165 # Make sure we got something interesting.
2166 if ($initial_section_counter == $section_counter) { 2166 if ($initial_section_counter == $section_counter && $
2167 if ($output_mode ne "none") { 2167 output_mode ne "none") {
2168 print STDERR "${file}:1: warning: no structured comments found\n"; 2168 if ($output_selection == OUTPUT_INCLUDE) {
2169 print STDERR "${file}:1: warning: '$_' not found\n"
2170 for keys %function_table;
2169 } 2171 }
2170 if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) { 2172 else {
2171 print STDERR " Was looking for '$_'.\n" for keys %function_table; 2173 print STDERR "${file}:1: warning: no structured comments found\n";
2172 } 2174 }
2173 } 2175 }
2174} 2176}
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 9be208db88d3..f230e65329a2 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -2,11 +2,15 @@
2# SPDX-License-Identifier: GPL-2.0-or-later 2# SPDX-License-Identifier: GPL-2.0-or-later
3use strict; 3use strict;
4 4
5# Copyright (c) 2017 Mauro Carvalho Chehab <mchehab@kernel.org> 5# Copyright (c) 2017-2019 Mauro Carvalho Chehab <mchehab@kernel.org>
6# 6#
7 7
8my $conf = "Documentation/conf.py"; 8my $prefix = "./";
9my $requirement_file = "Documentation/sphinx/requirements.txt"; 9$prefix = "$ENV{'srctree'}/" if ($ENV{'srctree'});
10
11my $conf = $prefix . "Documentation/conf.py";
12my $requirement_file = $prefix . "Documentation/sphinx/requirements.txt";
13my $virtenv_prefix = "sphinx_";
10 14
11# 15#
12# Static vars 16# Static vars
@@ -20,7 +24,8 @@ my $need_symlink = 0;
20my $need_sphinx = 0; 24my $need_sphinx = 0;
21my $rec_sphinx_upgrade = 0; 25my $rec_sphinx_upgrade = 0;
22my $install = ""; 26my $install = "";
23my $virtenv_dir = "sphinx_"; 27my $virtenv_dir = "";
28my $min_version;
24 29
25# 30#
26# Command line arguments 31# Command line arguments
@@ -28,6 +33,7 @@ my $virtenv_dir = "sphinx_";
28 33
29my $pdf = 1; 34my $pdf = 1;
30my $virtualenv = 1; 35my $virtualenv = 1;
36my $version_check = 0;
31 37
32# 38#
33# List of required texlive packages on Fedora and OpenSuse 39# List of required texlive packages on Fedora and OpenSuse
@@ -221,7 +227,6 @@ sub get_sphinx_fname()
221 227
222sub check_sphinx() 228sub check_sphinx()
223{ 229{
224 my $min_version;
225 my $rec_version; 230 my $rec_version;
226 my $cur_version; 231 my $cur_version;
227 232
@@ -247,7 +252,7 @@ sub check_sphinx()
247 252
248 die "Can't get recommended sphinx version from $requirement_file" if (!$min_version); 253 die "Can't get recommended sphinx version from $requirement_file" if (!$min_version);
249 254
250 $virtenv_dir .= $rec_version; 255 $virtenv_dir = $virtenv_prefix . $rec_version;
251 256
252 my $sphinx = get_sphinx_fname(); 257 my $sphinx = get_sphinx_fname();
253 return if ($sphinx eq ""); 258 return if ($sphinx eq "");
@@ -268,20 +273,22 @@ sub check_sphinx()
268 273
269 die "$sphinx didn't return its version" if (!$cur_version); 274 die "$sphinx didn't return its version" if (!$cur_version);
270 275
271 printf "Sphinx version %s (minimal: %s, recommended >= %s)\n",
272 $cur_version, $min_version, $rec_version;
273
274 if ($cur_version lt $min_version) { 276 if ($cur_version lt $min_version) {
275 print "Warning: Sphinx version should be >= $min_version\n\n"; 277 printf "ERROR: Sphinx version is %s. It should be >= %s (recommended >= %s)\n",
278 $cur_version, $min_version, $rec_version;;
276 $need_sphinx = 1; 279 $need_sphinx = 1;
277 return; 280 return;
278 } 281 }
279 282
280 if ($cur_version lt $rec_version) { 283 if ($cur_version lt $rec_version) {
284 printf "Sphinx version %s\n", $cur_version;
281 print "Warning: It is recommended at least Sphinx version $rec_version.\n"; 285 print "Warning: It is recommended at least Sphinx version $rec_version.\n";
282 print " To upgrade, use:\n\n";
283 $rec_sphinx_upgrade = 1; 286 $rec_sphinx_upgrade = 1;
287 return;
284 } 288 }
289
290 # On version check mode, just assume Sphinx has all mandatory deps
291 exit (0) if ($version_check);
285} 292}
286 293
287# 294#
@@ -566,27 +573,18 @@ sub check_distros()
566 573
567sub check_needs() 574sub check_needs()
568{ 575{
576 # Check for needed programs/tools
577 check_sphinx();
578
569 if ($system_release) { 579 if ($system_release) {
570 print "Detected OS: $system_release.\n"; 580 print "Detected OS: $system_release.\n\n";
571 } else { 581 } else {
572 print "Unknown OS\n"; 582 print "Unknown OS\n\n";
573 } 583 }
574 584
575 # RHEL 7.x and clones have Sphinx version 1.1.x and incomplete texlive 585 print "To upgrade Sphinx, use:\n\n" if ($rec_sphinx_upgrade);
576 if (($system_release =~ /Red Hat Enterprise Linux/) ||
577 ($system_release =~ /CentOS/) ||
578 ($system_release =~ /Scientific Linux/) ||
579 ($system_release =~ /Oracle Linux Server/)) {
580 $virtualenv = 1;
581 $pdf = 0;
582
583 printf("NOTE: On this distro, Sphinx and TexLive shipped versions are incompatible\n");
584 printf("with doc build. So, use Sphinx via a Python virtual environment.\n\n");
585 printf("This script can't install a TexLive version that would provide PDF.\n");
586 }
587 586
588 # Check for needed programs/tools 587 # Check for needed programs/tools
589 check_sphinx();
590 check_perl_module("Pod::Usage", 0); 588 check_perl_module("Pod::Usage", 0);
591 check_program("make", 0); 589 check_program("make", 0);
592 check_program("gcc", 0); 590 check_program("gcc", 0);
@@ -604,18 +602,24 @@ sub check_needs()
604 which("sphinx-build-3"); 602 which("sphinx-build-3");
605 } 603 }
606 if ($need_sphinx || $rec_sphinx_upgrade) { 604 if ($need_sphinx || $rec_sphinx_upgrade) {
607 my $activate = "$virtenv_dir/bin/activate"; 605 my $min_activate = "$ENV{'PWD'}/${virtenv_prefix}${min_version}/bin/activate";
608 if (-e "$ENV{'PWD'}/$activate") { 606 my @activates = glob "$ENV{'PWD'}/${virtenv_prefix}*/bin/activate";
609 printf "\nNeed to activate virtualenv with:\n"; 607
610 printf "\t. $activate\n"; 608 @activates = sort {$b cmp $a} @activates;
609
610 if ($need_sphinx && scalar @activates > 0 && $activates[0] ge $min_activate) {
611 printf "\nNeed to activate a compatible Sphinx version on virtualenv with:\n";
612 printf "\t. $activates[0]\n";
613 exit (1);
611 } else { 614 } else {
615 my $rec_activate = "$virtenv_dir/bin/activate";
612 my $virtualenv = findprog("virtualenv-3"); 616 my $virtualenv = findprog("virtualenv-3");
613 $virtualenv = findprog("virtualenv-3.5") if (!$virtualenv); 617 $virtualenv = findprog("virtualenv-3.5") if (!$virtualenv);
614 $virtualenv = findprog("virtualenv") if (!$virtualenv); 618 $virtualenv = findprog("virtualenv") if (!$virtualenv);
615 $virtualenv = "virtualenv" if (!$virtualenv); 619 $virtualenv = "virtualenv" if (!$virtualenv);
616 620
617 printf "\t$virtualenv $virtenv_dir\n"; 621 printf "\t$virtualenv $virtenv_dir\n";
618 printf "\t. $activate\n"; 622 printf "\t. $rec_activate\n";
619 printf "\tpip install -r $requirement_file\n"; 623 printf "\tpip install -r $requirement_file\n";
620 624
621 $need++ if (!$rec_sphinx_upgrade); 625 $need++ if (!$rec_sphinx_upgrade);
@@ -623,7 +627,7 @@ sub check_needs()
623 } 627 }
624 printf "\n"; 628 printf "\n";
625 629
626 print "All optional dependenties are met.\n" if (!$optional); 630 print "All optional dependencies are met.\n" if (!$optional);
627 631
628 if ($need == 1) { 632 if ($need == 1) {
629 die "Can't build as $need mandatory dependency is missing"; 633 die "Can't build as $need mandatory dependency is missing";
@@ -645,8 +649,14 @@ while (@ARGV) {
645 $virtualenv = 0; 649 $virtualenv = 0;
646 } elsif ($arg eq "--no-pdf"){ 650 } elsif ($arg eq "--no-pdf"){
647 $pdf = 0; 651 $pdf = 0;
652 } elsif ($arg eq "--version-check"){
653 $version_check = 1;
648 } else { 654 } else {
649 print "Usage:\n\t$0 <--no-virtualenv> <--no-pdf>\n\n"; 655 print "Usage:\n\t$0 <--no-virtualenv> <--no-pdf> <--version-check>\n\n";
656 print "Where:\n";
657 print "\t--no-virtualenv\t- Recommend installing Sphinx instead of using a virtualenv\n";
658 print "\t--version-check\t- if version is compatible, don't check for missing dependencies\n";
659 print "\t--no-pdf\t- don't check for dependencies required to build PDF docs\n\n";
650 exit -1; 660 exit -1;
651 } 661 }
652} 662}
diff --git a/security/Kconfig b/security/Kconfig
index 466cc1f8ffed..06a30851511a 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -63,7 +63,7 @@ config PAGE_TABLE_ISOLATION
63 ensuring that the majority of kernel addresses are not mapped 63 ensuring that the majority of kernel addresses are not mapped
64 into userspace. 64 into userspace.
65 65
66 See Documentation/x86/pti.txt for more details. 66 See Documentation/x86/pti.rst for more details.
67 67
68config SECURITY_INFINIBAND 68config SECURITY_INFINIBAND
69 bool "Infiniband Security Hooks" 69 bool "Infiniband Security Hooks"
diff --git a/sound/oss/dmasound/Kconfig b/sound/oss/dmasound/Kconfig
index 12e42165b4a5..1a3339859840 100644
--- a/sound/oss/dmasound/Kconfig
+++ b/sound/oss/dmasound/Kconfig
@@ -11,7 +11,7 @@ config DMASOUND_ATARI
11 This driver is also available as a module ( = code which can be 11 This driver is also available as a module ( = code which can be
12 inserted in and removed from the running kernel whenever you 12 inserted in and removed from the running kernel whenever you
13 want). If you want to compile it as a module, say M here and read 13 want). If you want to compile it as a module, say M here and read
14 <file:Documentation/kbuild/modules.txt>. 14 <file:Documentation/kbuild/modules.rst>.
15 15
16config DMASOUND_PAULA 16config DMASOUND_PAULA
17 tristate "Amiga DMA sound support" 17 tristate "Amiga DMA sound support"
@@ -25,7 +25,7 @@ config DMASOUND_PAULA
25 This driver is also available as a module ( = code which can be 25 This driver is also available as a module ( = code which can be
26 inserted in and removed from the running kernel whenever you 26 inserted in and removed from the running kernel whenever you
27 want). If you want to compile it as a module, say M here and read 27 want). If you want to compile it as a module, say M here and read
28 <file:Documentation/kbuild/modules.txt>. 28 <file:Documentation/kbuild/modules.rst>.
29 29
30config DMASOUND_Q40 30config DMASOUND_Q40
31 tristate "Q40 sound support" 31 tristate "Q40 sound support"
@@ -39,7 +39,7 @@ config DMASOUND_Q40
39 This driver is also available as a module ( = code which can be 39 This driver is also available as a module ( = code which can be
40 inserted in and removed from the running kernel whenever you 40 inserted in and removed from the running kernel whenever you
41 want). If you want to compile it as a module, say M here and read 41 want). If you want to compile it as a module, say M here and read
42 <file:Documentation/kbuild/modules.txt>. 42 <file:Documentation/kbuild/modules.rst>.
43 43
44config DMASOUND 44config DMASOUND
45 tristate 45 tristate
diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h
index b9bdf45889da..b1c27615b805 100644
--- a/sound/soc/sof/ops.h
+++ b/sound/soc/sof/ops.h
@@ -369,7 +369,7 @@ static inline const struct snd_sof_dsp_ops
369 * @cond: Break condition (usually involving @val) 369 * @cond: Break condition (usually involving @val)
370 * @sleep_us: Maximum time to sleep between reads in us (0 370 * @sleep_us: Maximum time to sleep between reads in us (0
371 * tight-loops). Should be less than ~20ms since usleep_range 371 * tight-loops). Should be less than ~20ms since usleep_range
372 * is used (see Documentation/timers/timers-howto.txt). 372 * is used (see Documentation/timers/timers-howto.rst).
373 * @timeout_us: Timeout in us, 0 means never timeout 373 * @timeout_us: Timeout in us, 0 means never timeout
374 * 374 *
375 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either 375 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
diff --git a/tools/include/linux/err.h b/tools/include/linux/err.h
index 2f5a12b88a86..25f2bb3a991d 100644
--- a/tools/include/linux/err.h
+++ b/tools/include/linux/err.h
@@ -20,7 +20,7 @@
20 * Userspace note: 20 * Userspace note:
21 * The same principle works for userspace, because 'error' pointers 21 * The same principle works for userspace, because 'error' pointers
22 * fall down to the unused hole far from user space, as described 22 * fall down to the unused hole far from user space, as described
23 * in Documentation/x86/x86_64/mm.txt for x86_64 arch: 23 * in Documentation/x86/x86_64/mm.rst for x86_64 arch:
24 * 24 *
25 * 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm hole caused by [48:63] sign extension 25 * 0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm hole caused by [48:63] sign extension
26 * ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole 26 * ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole
diff --git a/tools/objtool/Documentation/stack-validation.txt b/tools/objtool/Documentation/stack-validation.txt
index 4dd11a554b9b..de094670050b 100644
--- a/tools/objtool/Documentation/stack-validation.txt
+++ b/tools/objtool/Documentation/stack-validation.txt
@@ -21,7 +21,7 @@ instructions). Similarly, it knows how to follow switch statements, for
21which gcc sometimes uses jump tables. 21which gcc sometimes uses jump tables.
22 22
23(Objtool also has an 'orc generate' subcommand which generates debuginfo 23(Objtool also has an 'orc generate' subcommand which generates debuginfo
24for the ORC unwinder. See Documentation/x86/orc-unwinder.txt in the 24for the ORC unwinder. See Documentation/x86/orc-unwinder.rst in the
25kernel tree for more details.) 25kernel tree for more details.)
26 26
27 27
@@ -101,7 +101,7 @@ b) ORC (Oops Rewind Capability) unwind table generation
101 band. So it doesn't affect runtime performance and it can be 101 band. So it doesn't affect runtime performance and it can be
102 reliable even when interrupts or exceptions are involved. 102 reliable even when interrupts or exceptions are involved.
103 103
104 For more details, see Documentation/x86/orc-unwinder.txt. 104 For more details, see Documentation/x86/orc-unwinder.rst.
105 105
106c) Higher live patching compatibility rate 106c) Higher live patching compatibility rate
107 107
diff --git a/tools/testing/fault-injection/failcmd.sh b/tools/testing/fault-injection/failcmd.sh
index 29a6c63c5a15..78dac34264be 100644
--- a/tools/testing/fault-injection/failcmd.sh
+++ b/tools/testing/fault-injection/failcmd.sh
@@ -42,7 +42,7 @@ OPTIONS
42 --interval=value, --space=value, --verbose=value, --task-filter=value, 42 --interval=value, --space=value, --verbose=value, --task-filter=value,
43 --stacktrace-depth=value, --require-start=value, --require-end=value, 43 --stacktrace-depth=value, --require-start=value, --require-end=value,
44 --reject-start=value, --reject-end=value, --ignore-gfp-wait=value 44 --reject-start=value, --reject-end=value, --ignore-gfp-wait=value
45 See Documentation/fault-injection/fault-injection.txt for more 45 See Documentation/fault-injection/fault-injection.rst for more
46 information 46 information
47 47
48 failslab options: 48 failslab options:
diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c
index 5d546dcdbc80..480995bceefa 100644
--- a/tools/testing/selftests/x86/protection_keys.c
+++ b/tools/testing/selftests/x86/protection_keys.c
@@ -1,6 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2/* 2/*
3 * Tests x86 Memory Protection Keys (see Documentation/x86/protection-keys.txt) 3 * Tests x86 Memory Protection Keys (see Documentation/core-api/protection-keys.rst)
4 * 4 *
5 * There are examples in here of: 5 * There are examples in here of:
6 * * how to set protection keys on memory 6 * * how to set protection keys on memory