* [PATCH 2/2] powerpc/bpf: use unsigned division instruction for 64-bit operations
From: Naveen N. Rao @ 2019-06-12 18:51 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann; +Cc: netdev, bpf, linuxppc-dev
In-Reply-To: <cover.1560364574.git.naveen.n.rao@linux.vnet.ibm.com>
BPF_ALU64 div/mod operations are currently using signed division, unlike
BPF_ALU32 operations. Fix the same. DIV64 and MOD64 overflow tests pass
with this fix.
Fixes: 156d0e290e969c ("powerpc/ebpf/jit: Implement JIT compiler for extended BPF")
Cc: stable@vger.kernel.org # v4.8+
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/ppc-opcode.h | 1 +
arch/powerpc/net/bpf_jit.h | 2 +-
arch/powerpc/net/bpf_jit_comp64.c | 8 ++++----
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 23f7ed796f38..49d65cd08ee0 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -342,6 +342,7 @@
#define PPC_INST_MADDLD 0x10000033
#define PPC_INST_DIVWU 0x7c000396
#define PPC_INST_DIVD 0x7c0003d2
+#define PPC_INST_DIVDU 0x7c000392
#define PPC_INST_RLWINM 0x54000000
#define PPC_INST_RLWINM_DOT 0x54000001
#define PPC_INST_RLWIMI 0x50000000
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index dcac37745b05..1e932898d430 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -116,7 +116,7 @@
___PPC_RA(a) | IMM_L(i))
#define PPC_DIVWU(d, a, b) EMIT(PPC_INST_DIVWU | ___PPC_RT(d) | \
___PPC_RA(a) | ___PPC_RB(b))
-#define PPC_DIVD(d, a, b) EMIT(PPC_INST_DIVD | ___PPC_RT(d) | \
+#define PPC_DIVDU(d, a, b) EMIT(PPC_INST_DIVDU | ___PPC_RT(d) | \
___PPC_RA(a) | ___PPC_RB(b))
#define PPC_AND(d, a, b) EMIT(PPC_INST_AND | ___PPC_RA(d) | \
___PPC_RS(a) | ___PPC_RB(b))
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index 0ebd946f178b..b0fa4723d6fb 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -399,12 +399,12 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
case BPF_ALU64 | BPF_DIV | BPF_X: /* dst /= src */
case BPF_ALU64 | BPF_MOD | BPF_X: /* dst %= src */
if (BPF_OP(code) == BPF_MOD) {
- PPC_DIVD(b2p[TMP_REG_1], dst_reg, src_reg);
+ PPC_DIVDU(b2p[TMP_REG_1], dst_reg, src_reg);
PPC_MULD(b2p[TMP_REG_1], src_reg,
b2p[TMP_REG_1]);
PPC_SUB(dst_reg, dst_reg, b2p[TMP_REG_1]);
} else
- PPC_DIVD(dst_reg, dst_reg, src_reg);
+ PPC_DIVDU(dst_reg, dst_reg, src_reg);
break;
case BPF_ALU | BPF_MOD | BPF_K: /* (u32) dst %= (u32) imm */
case BPF_ALU | BPF_DIV | BPF_K: /* (u32) dst /= (u32) imm */
@@ -432,7 +432,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
break;
case BPF_ALU64:
if (BPF_OP(code) == BPF_MOD) {
- PPC_DIVD(b2p[TMP_REG_2], dst_reg,
+ PPC_DIVDU(b2p[TMP_REG_2], dst_reg,
b2p[TMP_REG_1]);
PPC_MULD(b2p[TMP_REG_1],
b2p[TMP_REG_1],
@@ -440,7 +440,7 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image,
PPC_SUB(dst_reg, dst_reg,
b2p[TMP_REG_1]);
} else
- PPC_DIVD(dst_reg, dst_reg,
+ PPC_DIVDU(dst_reg, dst_reg,
b2p[TMP_REG_1]);
break;
}
--
2.21.0
^ permalink raw reply related
* Re: [PATCH kernel v3 0/3] powerpc/ioda2: Yet another attempt to allow DMA masks between 32 and 59
From: Shawn Anastasio @ 2019-06-12 19:14 UTC (permalink / raw)
To: Oliver O'Halloran
Cc: Alexey Kardashevskiy, Alistair Popple, Sam Bobroff, linuxppc-dev,
David Gibson
In-Reply-To: <CAOSf1CEoEgWwD2qmBHiCG0B4JjmS0g=SUqm+OEYsbvv11QSARw@mail.gmail.com>
On 6/12/19 1:16 AM, Oliver O'Halloran wrote:
> On Wed, Jun 12, 2019 at 3:06 PM Shawn Anastasio <shawn@anastas.io> wrote:
>>
>> On 6/5/19 11:11 PM, Shawn Anastasio wrote:
>>> On 5/30/19 2:03 AM, Alexey Kardashevskiy wrote:
>>>> This is an attempt to allow DMA masks between 32..59 which are not large
>>>> enough to use either a PHB3 bypass mode or a sketchy bypass. Depending
>>>> on the max order, up to 40 is usually available.
>>>>
>>>>
>>>> This is based on v5.2-rc2.
>>>>
>>>> Please comment. Thanks.
>>>
>>> I have tested this patch set with an AMD GPU that's limited to <64bit
>>> DMA (I believe it's 40 or 42 bit). It successfully allows the card to
>>> operate without falling back to 32-bit DMA mode as it does without
>>> the patches.
>>>
>>> Relevant kernel log message:
>>> ```
>>> [ 0.311211] pci 0033:01 : [PE# 00] Enabling 64-bit DMA bypass
>>> ```
>>>
>>> Tested-by: Shawn Anastasio <shawn@anastas.io>
>>
>> After a few days of further testing, I've started to run into stability
>> issues with the patch applied and used with an AMD GPU. Specifically,
>> the system sometimes spontaneously crashes. Not just EEH errors either,
>> the whole system shuts down in what looks like a checkstop.
>
> Any specific workload? Checkstops are harder to debug without a system
> in the failed state so we'd need to replicate that locally to get a
> decent idea what's up.
I haven't been able to pinpoint the exact cause. The first time it
happened was after about 4 days of uptime while playing a 1080p
video in mpv. The second time was about 5 minutes after booting up
while restoring a firefox session.
^ permalink raw reply
* Re: [PATCH kernel v3 0/3] powerpc/ioda2: Yet another attempt to allow DMA masks between 32 and 59
From: Shawn Anastasio @ 2019-06-12 19:15 UTC (permalink / raw)
To: Alexey Kardashevskiy, linuxppc-dev
Cc: Sam Bobroff, Alistair Popple, Oliver O'Halloran, David Gibson
In-Reply-To: <5ad2a281-6b31-a990-ea9c-06d4c331cd23@ozlabs.ru>
On 6/12/19 2:07 AM, Alexey Kardashevskiy wrote:
>
>
> On 12/06/2019 15:05, Shawn Anastasio wrote:
>> On 6/5/19 11:11 PM, Shawn Anastasio wrote:
>>> On 5/30/19 2:03 AM, Alexey Kardashevskiy wrote:
>>>> This is an attempt to allow DMA masks between 32..59 which are not large
>>>> enough to use either a PHB3 bypass mode or a sketchy bypass. Depending
>>>> on the max order, up to 40 is usually available.
>>>>
>>>>
>>>> This is based on v5.2-rc2.
>>>>
>>>> Please comment. Thanks.
>>>
>>> I have tested this patch set with an AMD GPU that's limited to <64bit
>>> DMA (I believe it's 40 or 42 bit). It successfully allows the card to
>>> operate without falling back to 32-bit DMA mode as it does without
>>> the patches.
>>>
>>> Relevant kernel log message:
>>> ```
>>> [ 0.311211] pci 0033:01 : [PE# 00] Enabling 64-bit DMA bypass
>>> ```
>>>
>>> Tested-by: Shawn Anastasio <shawn@anastas.io>
>>
>> After a few days of further testing, I've started to run into stability
>> issues with the patch applied and used with an AMD GPU. Specifically,
>> the system sometimes spontaneously crashes. Not just EEH errors either,
>> the whole system shuts down in what looks like a checkstop.
>>
>> Perhaps some subtle corruption is occurring?
>
> Have you tried this?
>
> https://patchwork.ozlabs.org/patch/1113506/
I have not. I'll give it a shot and try it out for a few days to see
if I'm able to reproduce the crashes.
^ permalink raw reply
* Re: [BISECTED REGRESSION] b43legacy broken on G4 PowerBook
From: Larry Finger @ 2019-06-12 19:41 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Aaro Koskinen, linux-wireless, linux-kernel, Christian Zigotzky,
linuxppc-dev
In-Reply-To: <20190612065558.GA19585@lst.de>
On 6/12/19 1:55 AM, Christoph Hellwig wrote:
>
> Ooops, yes. But I think we could just enable ZONE_DMA on 32-bit
> powerpc. Crude enablement hack below:
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 8c1c636308c8..1dd71a98b70c 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -372,7 +372,7 @@ config PPC_ADV_DEBUG_DAC_RANGE
>
> config ZONE_DMA
> bool
> - default y if PPC_BOOK3E_64
> + default y
>
> config PGTABLE_LEVELS
> int
>
With the patch for Kconfig above, and the original patch setting
ARCH_ZONE_DMA_BITS to 30, everything works.
Do you have any ideas on what should trigger the change in ARCH_ZONE_BITS?
Should it be CONFIG_PPC32 defined, or perhaps CONFIG_G4_CPU defined?
Larry
^ permalink raw reply
* Re: [BISECTED REGRESSION] b43legacy broken on G4 PowerBook
From: Benjamin Herrenschmidt @ 2019-06-12 21:59 UTC (permalink / raw)
To: Larry Finger, Christoph Hellwig
Cc: linuxppc-dev, Christian Zigotzky, linux-wireless, linux-kernel,
Aaro Koskinen
In-Reply-To: <d6d82c0d-4a40-a191-0414-6b9a64547f65@lwfinger.net>
On Wed, 2019-06-12 at 14:41 -0500, Larry Finger wrote:
> On 6/12/19 1:55 AM, Christoph Hellwig wrote:
> >
> > Ooops, yes. But I think we could just enable ZONE_DMA on 32-bit
> > powerpc. Crude enablement hack below:
> >
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index 8c1c636308c8..1dd71a98b70c 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -372,7 +372,7 @@ config PPC_ADV_DEBUG_DAC_RANGE
> >
> > config ZONE_DMA
> > bool
> > - default y if PPC_BOOK3E_64
> > + default y
> >
> > config PGTABLE_LEVELS
> > int
> >
>
> With the patch for Kconfig above, and the original patch setting
> ARCH_ZONE_DMA_BITS to 30, everything works.
>
> Do you have any ideas on what should trigger the change in ARCH_ZONE_BITS?
> Should it be CONFIG_PPC32 defined, or perhaps CONFIG_G4_CPU defined?
I think CONFIG_PPC32 is fine
Ben.
^ permalink raw reply
* [PATCH v4 12/28] docs: kbuild: convert docs to ReST and rename to *.rst
From: Mauro Carvalho Chehab @ 2019-06-12 17:52 UTC (permalink / raw)
To: Linux Doc Mailing List
Cc: linux-wireless, linux-fbdev, Emmanuel Grumbach, Stanislaw Gruszka,
Vignesh Raghavendra, Greg Kroah-Hartman, bridge, Palmer Dabbelt,
alsa-devel, dri-devel, Ofer Levi, Masahiro Yamada, Harry Wei,
Paul Mackerras, Miquel Raynal, Mauro Carvalho Chehab,
linux-kbuild, linux-riscv, Vincent Chen, Aurelien Jacquiot,
Jonas Bonn, Alex Shi, linux-c6x-dev, linux-scsi, Jonathan Corbet,
Bartlomiej Zolnierkiewicz, netdev, Marek Vasut, coreteam,
Federico Vaga, Mark Salter, Alexey Kuznetsov, linux-snps-arc,
Roopa Prabhu, Pablo Neira Ayuso, devel, Albert Ou, Johannes Berg,
Intel Linux Wireless, Nikolay Aleksandrov, James E.J. Bottomley,
Jozsef Kadlecsik, linuxppc-dev, Mauro Carvalho Chehab, openrisc,
Greentime Hu, linux-mtd, Takashi Iwai, Jaroslav Kysela,
Stafford Horne, Stefan Kristiansson, Kalle Valo, Jon Maloy,
Michal Simek, Michal Marek, tipc-discussion, Teddy Wang,
Martin K. Petersen, Hideaki YOSHIFUJI, Vineet Gupta, linux-usb,
Florian Westphal, linux-kernel, Sudip Mukherjee,
Miguel Ojeda Sandonis, netfilter-devel, Richard Weinberger,
Ying Xue, Luca Coelho, Brian Norris, David Woodhouse,
David S. Miller
In-Reply-To: <cover.1560361364.git.mchehab+samsung@kernel.org>
The kbuild documentation clearly shows that the documents
there are written at different times: some use markdown,
some use their own peculiar logic to split sections.
Convert everything to ReST without affecting too much
the author's style and avoiding adding uneeded markups.
The conversion is actually:
- add blank lines and identation in order to identify paragraphs;
- fix tables markups;
- add some lists markups;
- mark literal blocks;
- adjust title markups.
At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
Documentation/admin-guide/README.rst | 2 +-
| 5 +-
Documentation/kbuild/index.rst | 27 +
Documentation/kbuild/issues.rst | 11 +
.../kbuild/{kbuild.txt => kbuild.rst} | 119 ++--
...nfig-language.txt => kconfig-language.rst} | 232 ++++----
...anguage.txt => kconfig-macro-language.rst} | 37 +-
.../kbuild/{kconfig.txt => kconfig.rst} | 136 +++--
.../kbuild/{makefiles.txt => makefiles.rst} | 530 +++++++++++-------
.../kbuild/{modules.txt => modules.rst} | 168 +++---
Documentation/kernel-hacking/hacking.rst | 4 +-
Documentation/process/coding-style.rst | 2 +-
Documentation/process/submit-checklist.rst | 2 +-
.../it_IT/kernel-hacking/hacking.rst | 4 +-
.../it_IT/process/coding-style.rst | 2 +-
.../it_IT/process/submit-checklist.rst | 2 +-
.../zh_CN/process/coding-style.rst | 2 +-
.../zh_CN/process/submit-checklist.rst | 2 +-
Kconfig | 2 +-
arch/arc/plat-eznps/Kconfig | 2 +-
arch/c6x/Kconfig | 2 +-
arch/microblaze/Kconfig.debug | 2 +-
arch/microblaze/Kconfig.platform | 2 +-
arch/nds32/Kconfig | 2 +-
arch/openrisc/Kconfig | 2 +-
arch/powerpc/sysdev/Kconfig | 2 +-
arch/riscv/Kconfig | 2 +-
drivers/auxdisplay/Kconfig | 2 +-
drivers/firmware/Kconfig | 2 +-
drivers/mtd/devices/Kconfig | 2 +-
drivers/net/ethernet/smsc/Kconfig | 6 +-
drivers/net/wireless/intel/iwlegacy/Kconfig | 4 +-
drivers/net/wireless/intel/iwlwifi/Kconfig | 2 +-
drivers/parport/Kconfig | 2 +-
drivers/scsi/Kconfig | 4 +-
drivers/staging/sm750fb/Kconfig | 2 +-
drivers/usb/misc/Kconfig | 4 +-
drivers/video/fbdev/Kconfig | 14 +-
net/bridge/netfilter/Kconfig | 2 +-
net/ipv4/netfilter/Kconfig | 2 +-
net/ipv6/netfilter/Kconfig | 2 +-
net/netfilter/Kconfig | 16 +-
net/tipc/Kconfig | 2 +-
scripts/Kbuild.include | 4 +-
scripts/Makefile.host | 2 +-
scripts/kconfig/symbol.c | 2 +-
.../tests/err_recursive_dep/expected_stderr | 14 +-
sound/oss/dmasound/Kconfig | 6 +-
48 files changed, 840 insertions(+), 561 deletions(-)
rename Documentation/kbuild/{headers_install.txt => headers_install.rst} (96%)
create mode 100644 Documentation/kbuild/index.rst
create mode 100644 Documentation/kbuild/issues.rst
rename Documentation/kbuild/{kbuild.txt => kbuild.rst} (72%)
rename Documentation/kbuild/{kconfig-language.txt => kconfig-language.rst} (85%)
rename Documentation/kbuild/{kconfig-macro-language.txt => kconfig-macro-language.rst} (94%)
rename Documentation/kbuild/{kconfig.txt => kconfig.rst} (80%)
rename Documentation/kbuild/{makefiles.txt => makefiles.rst} (83%)
rename Documentation/kbuild/{modules.txt => modules.rst} (84%)
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
"make tinyconfig" Configure the tiniest possible kernel.
You can find more information on using the Linux kernel config tools
- in Documentation/kbuild/kconfig.txt.
+ in Documentation/kbuild/kconfig.rst.
- NOTES on ``make config``:
diff --git a/Documentation/kbuild/headers_install.txt b/Documentation/kbuild/headers_install.rst
similarity index 96%
rename from Documentation/kbuild/headers_install.txt
rename to 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 @@
+=============================================
Exporting kernel headers for use by userspace
=============================================
@@ -22,14 +23,14 @@ older kernel.
The "make headers_install" command can be run in the top level directory of the
kernel source code (or using a standard out-of-tree build). It takes two
-optional arguments:
+optional arguments::
make headers_install ARCH=i386 INSTALL_HDR_PATH=/usr
ARCH indicates which architecture to produce headers for, and defaults to the
current architecture. The linux/asm directory of the exported kernel headers
is platform-specific, to see a complete list of supported architectures use
-the command:
+the command::
ls -d include/asm-* | sed 's/.*-//'
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 @@
+:orphan:
+
+===================
+Kernel Build System
+===================
+
+.. toctree::
+ :maxdepth: 1
+
+ kconfig-language
+ kconfig-macro-language
+
+ kbuild
+ kconfig
+ makefiles
+ modules
+
+ headers_install
+
+ issues
+
+.. only:: subproject and html
+
+ Indices
+ =======
+
+ * :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 @@
+Recursion issue #1
+------------------
+
+ .. include:: Kconfig.recursion-issue-01
+ :literal:
+
+Recursion issue #2
+------------------
+
+ .. include:: Kconfig.recursion-issue-02
+ :literal:
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.rst
similarity index 72%
rename from Documentation/kbuild/kbuild.txt
rename to Documentation/kbuild/kbuild.rst
index 9c230ea71963..e774e760522d 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.rst
@@ -1,13 +1,19 @@
+======
+Kbuild
+======
+
+
Output files
+============
modules.order
---------------------------------------------------
+-------------
This file records the order in which modules appear in Makefiles. This
is used by modprobe to deterministically resolve aliases that match
multiple modules.
modules.builtin
---------------------------------------------------
+---------------
This file lists all modules that are built into the kernel. This is used
by modprobe to not fail when trying to load something builtin.
@@ -18,84 +24,90 @@ Unlike modinfo of a separate module, all fields are prefixed with module name.
Environment variables
+=====================
KCPPFLAGS
---------------------------------------------------
+---------
Additional options to pass when preprocessing. The preprocessing options
will be used in all cases where kbuild does preprocessing including
building C files and assembler files.
KAFLAGS
---------------------------------------------------
+-------
Additional options to the assembler (for built-in and modules).
AFLAGS_MODULE
---------------------------------------------------
+-------------
Additional module specific options to use for $(AS).
AFLAGS_KERNEL
---------------------------------------------------
+-------------
Additional options for $(AS) when used for assembler
code for code that is compiled as built-in.
KCFLAGS
---------------------------------------------------
+-------
Additional options to the C compiler (for built-in and modules).
CFLAGS_KERNEL
---------------------------------------------------
+-------------
Additional options for $(CC) when used to compile
code that is compiled as built-in.
CFLAGS_MODULE
---------------------------------------------------
+-------------
Additional module specific options to use for $(CC).
LDFLAGS_MODULE
---------------------------------------------------
+--------------
Additional options used for $(LD) when linking modules.
HOSTCFLAGS
---------------------------------------------------
+----------
Additional flags to be passed to $(HOSTCC) when building host programs.
HOSTCXXFLAGS
---------------------------------------------------
+------------
Additional flags to be passed to $(HOSTCXX) when building host programs.
HOSTLDFLAGS
---------------------------------------------------
+-----------
Additional flags to be passed when linking host programs.
HOSTLDLIBS
---------------------------------------------------
+----------
Additional libraries to link against when building host programs.
KBUILD_KCONFIG
---------------------------------------------------
+--------------
Set the top-level Kconfig file to the value of this environment
variable. The default name is "Kconfig".
KBUILD_VERBOSE
---------------------------------------------------
+--------------
Set the kbuild verbosity. Can be assigned same values as "V=...".
+
See make help for the full list.
+
Setting "V=..." takes precedence over KBUILD_VERBOSE.
KBUILD_EXTMOD
---------------------------------------------------
+-------------
Set the directory to look for the kernel source when building external
modules.
+
Setting "M=..." takes precedence over KBUILD_EXTMOD.
KBUILD_OUTPUT
---------------------------------------------------
+-------------
Specify the output directory when building the kernel.
+
The output directory can also be specified using "O=...".
+
Setting "O=..." takes precedence over KBUILD_OUTPUT.
KBUILD_DEBARCH
---------------------------------------------------
+--------------
For the deb-pkg target, allows overriding the normal heuristics deployed by
deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
the 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
architecture.
ARCH
---------------------------------------------------
+----
Set ARCH to the architecture to be built.
+
In most cases the name of the architecture is the same as the
directory name found in the arch/ directory.
+
But some architectures such as x86 and sparc have aliases.
-x86: i386 for 32 bit, x86_64 for 64 bit
-sh: sh for 32 bit, sh64 for 64 bit
-sparc: sparc32 for 32 bit, sparc64 for 64 bit
+
+- x86: i386 for 32 bit, x86_64 for 64 bit
+- sh: sh for 32 bit, sh64 for 64 bit
+- sparc: sparc32 for 32 bit, sparc64 for 64 bit
CROSS_COMPILE
---------------------------------------------------
+-------------
Specify an optional fixed part of the binutils filename.
CROSS_COMPILE can be a part of the filename or the full path.
CROSS_COMPILE is also used for ccache in some setups.
CF
---------------------------------------------------
+--
Additional options for sparse.
-CF is often used on the command-line like this:
+
+CF is often used on the command-line like this::
make CF=-Wbitwise C=2
INSTALL_PATH
---------------------------------------------------
+------------
INSTALL_PATH specifies where to place the updated kernel and system map
images. Default is /boot, but you can set it to other values.
INSTALLKERNEL
---------------------------------------------------
+-------------
Install script called when using "make install".
The default name is "installkernel".
The script will be called with the following arguments:
- $1 - kernel version
- $2 - kernel image file
- $3 - kernel map file
- $4 - default install path (use root directory if blank)
+ - $1 - kernel version
+ - $2 - kernel image file
+ - $3 - kernel map file
+ - $4 - default install path (use root directory if blank)
The implementation of "make install" is architecture specific
and it may differ from the above.
@@ -149,32 +165,33 @@ INSTALLKERNEL is provided to enable the possibility to
specify a custom installer when cross compiling a kernel.
MODLIB
---------------------------------------------------
+------
Specify where to install modules.
-The default value is:
+The default value is::
$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
The value can be overridden in which case the default value is ignored.
INSTALL_MOD_PATH
---------------------------------------------------
+----------------
INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
relocations required by build roots. This is not defined in the
makefile but the argument can be passed to make if needed.
INSTALL_MOD_STRIP
---------------------------------------------------
+-----------------
INSTALL_MOD_STRIP, if defined, will cause modules to be
stripped after they are installed. If INSTALL_MOD_STRIP is '1', then
the default option --strip-debug will be used. Otherwise,
INSTALL_MOD_STRIP value will be used as the options to the strip command.
INSTALL_HDR_PATH
---------------------------------------------------
+----------------
INSTALL_HDR_PATH specifies where to install user space headers when
executing "make headers_*".
-The default value is:
+
+The default value is::
$(objtree)/usr
@@ -184,65 +201,65 @@ The output directory is often set using "O=..." on the commandline.
The value can be overridden in which case the default value is ignored.
KBUILD_SIGN_PIN
---------------------------------------------------
+---------------
This variable allows a passphrase or PIN to be passed to the sign-file
utility when signing kernel modules, if the private key requires such.
KBUILD_MODPOST_WARN
---------------------------------------------------
+-------------------
KBUILD_MODPOST_WARN can be set to avoid errors in case of undefined
symbols in the final module linking stage. It changes such errors
into warnings.
KBUILD_MODPOST_NOFINAL
---------------------------------------------------
+----------------------
KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
This is solely useful to speed up test compiles.
KBUILD_EXTRA_SYMBOLS
---------------------------------------------------
+--------------------
For modules that use symbols from other modules.
See more details in modules.txt.
ALLSOURCE_ARCHS
---------------------------------------------------
+---------------
For tags/TAGS/cscope targets, you can specify more than one arch
-to be included in the databases, separated by blank space. E.g.:
+to be included in the databases, separated by blank space. E.g.::
$ make ALLSOURCE_ARCHS="x86 mips arm" tags
-To get all available archs you can also specify all. E.g.:
+To get all available archs you can also specify all. E.g.::
$ make ALLSOURCE_ARCHS=all tags
KBUILD_ENABLE_EXTRA_GCC_CHECKS
---------------------------------------------------
+------------------------------
If enabled over the make command line with "W=1", it turns on additional
gcc -W... options for more extensive build-time checking.
KBUILD_BUILD_TIMESTAMP
---------------------------------------------------
+----------------------
Setting this to a date string overrides the timestamp used in the
UTS_VERSION definition (uname -v in the running kernel). The value has to
be a string that can be passed to date -d. The default value
is the output of the date command at one point during build.
KBUILD_BUILD_USER, KBUILD_BUILD_HOST
---------------------------------------------------
+------------------------------------
These two variables allow to override the user@host string displayed during
boot and in /proc/version. The default value is the output of the commands
whoami and host, respectively.
KBUILD_LDS
---------------------------------------------------
+----------
The linker script with full path. Assigned by the top-level Makefile.
KBUILD_VMLINUX_OBJS
---------------------------------------------------
+-------------------
All object files for vmlinux. They are linked to vmlinux in the same
order as listed in KBUILD_VMLINUX_OBJS.
KBUILD_VMLINUX_LIBS
---------------------------------------------------
+-------------------
All .a "lib" files for vmlinux. KBUILD_VMLINUX_OBJS and KBUILD_VMLINUX_LIBS
together specify all the object files used to link vmlinux.
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.rst
similarity index 85%
rename from Documentation/kbuild/kconfig-language.txt
rename to 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 @@
+================
+Kconfig Language
+================
+
Introduction
------------
The configuration database is a collection of configuration options
-organized in a tree structure:
+organized in a tree structure::
+- Code maturity level options
| +- Prompt for development and/or incomplete code/drivers
@@ -25,9 +29,9 @@ Menu entries
------------
Most entries define a config option; all other entries help to organize
-them. A single configuration option is defined like this:
+them. A single configuration option is defined like this::
-config MODVERSIONS
+ config MODVERSIONS
bool "Set version information on all module symbols"
depends on MODULES
help
@@ -52,10 +56,12 @@ applicable everywhere (see syntax).
Every config option must have a type. There are only two basic types:
tristate and string; the other types are based on these two. The type
definition optionally accepts an input prompt, so these two examples
- are equivalent:
+ are equivalent::
bool "Networking support"
- and
+
+ and::
+
bool
prompt "Networking support"
@@ -98,8 +104,10 @@ applicable everywhere (see syntax).
d) Hardware or infrastructure that everybody expects, such as CONFIG_NET
or CONFIG_BLOCK. These are rare exceptions.
-- type definition + default value:
+- type definition + default value::
+
"def_bool"/"def_tristate" <expr> ["if" <expr>]
+
This is a shorthand notation for a type definition plus a value.
Optionally dependencies for this default value can be added with "if".
@@ -107,11 +115,13 @@ applicable everywhere (see syntax).
This defines a dependency for this menu entry. If multiple
dependencies are defined, they are connected with '&&'. Dependencies
are applied to all other options within this menu entry (which also
- accept an "if" expression), so these two examples are equivalent:
+ accept an "if" expression), so these two examples are equivalent::
bool "foo" if BAR
default y if BAR
- and
+
+ and::
+
depends on BAR
bool "foo"
default y
@@ -124,6 +134,7 @@ applicable everywhere (see syntax).
times, the limit is set to the largest selection.
Reverse dependencies can only be used with boolean or tristate
symbols.
+
Note:
select should be used with care. select will force
a symbol to a value without visiting the dependencies.
@@ -139,24 +150,26 @@ applicable everywhere (see syntax).
symbol except that the "implied" symbol's value may still be set to n
from a direct dependency or with a visible prompt.
- Given the following example:
+ Given the following example::
- config FOO
+ config FOO
tristate
imply BAZ
- config BAZ
+ config BAZ
tristate
depends on BAR
The following values are possible:
+ === === ============= ==============
FOO BAR BAZ's default choice for BAZ
- --- --- ------------- --------------
+ === === ============= ==============
n y n N/m/y
m y m M/y/n
y y y Y/n
y n * N
+ === === ============= ==============
This is useful e.g. with multiple drivers that want to indicate their
ability to hook into a secondary subsystem while allowing the user to
@@ -208,9 +221,9 @@ Menu dependencies
Dependencies define the visibility of a menu entry and can also reduce
the input range of tristate symbols. The tristate logic used in the
expressions uses one more state than normal boolean logic to express the
-module state. Dependency expressions have the following syntax:
+module state. Dependency expressions have the following syntax::
-<expr> ::= <symbol> (1)
+ <expr> ::= <symbol> (1)
<symbol> '=' <symbol> (2)
<symbol> '!=' <symbol> (3)
<symbol1> '<' <symbol2> (4)
@@ -222,7 +235,7 @@ module state. Dependency expressions have the following syntax:
<expr> '&&' <expr> (7)
<expr> '||' <expr> (8)
-Expressions are listed in decreasing order of precedence.
+Expressions are listed in decreasing order of precedence.
(1) Convert the symbol into an expression. Boolean and tristate symbols
are simply converted into the respective expression values. All
@@ -255,15 +268,15 @@ Menu structure
--------------
The position of a menu entry in the tree is determined in two ways. First
-it can be specified explicitly:
+it can be specified explicitly::
-menu "Network device support"
+ menu "Network device support"
depends on NET
-config NETDEVICES
+ config NETDEVICES
...
-endmenu
+ endmenu
All entries within the "menu" ... "endmenu" block become a submenu of
"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
can be made a submenu of it. First, the previous (parent) symbol must
be part of the dependency list and then one of these two conditions
must be true:
+
- the child entry must become invisible, if the parent is set to 'n'
-- the child entry must only be visible, if the parent is visible
+- the child entry must only be visible, if the parent is visible::
-config MODULES
+ config MODULES
bool "Enable loadable module support"
-config MODVERSIONS
+ config MODVERSIONS
bool "Set version information on all module symbols"
depends on MODULES
-comment "module support disabled"
+ comment "module support disabled"
depends on !MODULES
MODVERSIONS directly depends on MODULES, this means it's only visible if
@@ -299,6 +313,7 @@ Kconfig syntax
The configuration file describes a series of menu entries, where every
line starts with a keyword (except help texts). The following keywords
end a menu entry:
+
- config
- menuconfig
- choice/endchoice
@@ -306,17 +321,17 @@ end a menu entry:
- menu/endmenu
- if/endif
- source
+
The first five also start the definition of a menu entry.
-config:
-
+config::
"config" <symbol>
<config options>
This defines a config symbol <symbol> and accepts any of above
attributes as options.
-menuconfig:
+menuconfig::
"menuconfig" <symbol>
<config options>
@@ -325,43 +340,43 @@ hint to front ends, that all suboptions should be displayed as a
separate list of options. To make sure all the suboptions will really
show up under the menuconfig entry and not outside of it, every item
from the <config options> list must depend on the menuconfig symbol.
-In practice, this is achieved by using one of the next two constructs:
+In practice, this is achieved by using one of the next two constructs::
-(1):
-menuconfig M
-if M
- config C1
- config C2
-endif
+ (1):
+ menuconfig M
+ if M
+ config C1
+ config C2
+ endif
-(2):
-menuconfig M
-config C1
- depends on M
-config C2
- depends on M
+ (2):
+ menuconfig M
+ config C1
+ depends on M
+ config C2
+ depends on M
In the following examples (3) and (4), C1 and C2 still have the M
dependency, but will not appear under menuconfig M anymore, because
-of C0, which doesn't depend on M:
+of C0, which doesn't depend on M::
-(3):
-menuconfig M
- config C0
-if M
- config C1
- config C2
-endif
+ (3):
+ menuconfig M
+ config C0
+ if M
+ config C1
+ config C2
+ endif
-(4):
-menuconfig M
-config C0
-config C1
- depends on M
-config C2
- depends on M
+ (4):
+ menuconfig M
+ config C0
+ config C1
+ depends on M
+ config C2
+ depends on M
-choices:
+choices::
"choice" [symbol]
<choice options>
@@ -387,7 +402,7 @@ definitions of that choice. If a [symbol] is associated to the choice,
then you may define the same choice (i.e. with the same entries) in another
place.
-comment:
+comment::
"comment" <prompt>
<comment options>
@@ -396,7 +411,7 @@ This defines a comment which is displayed to the user during the
configuration process and is also echoed to the output files. The only
possible options are dependencies.
-menu:
+menu::
"menu" <prompt>
<menu options>
@@ -407,7 +422,7 @@ This defines a menu block, see "Menu structure" above for more
information. The only possible options are dependencies and "visible"
attributes.
-if:
+if::
"if" <expr>
<if block>
@@ -416,13 +431,13 @@ if:
This defines an if block. The dependency expression <expr> is appended
to all enclosed menu entries.
-source:
+source::
"source" <prompt>
This reads the specified configuration file. This file is always parsed.
-mainmenu:
+mainmenu::
"mainmenu" <prompt>
@@ -452,20 +467,21 @@ that is defined in a common Kconfig file and selected by the relevant
architectures.
An example is the generic IOMAP functionality.
-We would in lib/Kconfig see:
+We would in lib/Kconfig see::
-# Generic IOMAP is used to ...
-config HAVE_GENERIC_IOMAP
+ # Generic IOMAP is used to ...
+ config HAVE_GENERIC_IOMAP
-config GENERIC_IOMAP
+ config GENERIC_IOMAP
depends on HAVE_GENERIC_IOMAP && FOO
-And in lib/Makefile we would see:
-obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
+And in lib/Makefile we would see::
-For each architecture using the generic IOMAP functionality we would see:
+ obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
-config X86
+For each architecture using the generic IOMAP functionality we would see::
+
+ config X86
select ...
select HAVE_GENERIC_IOMAP
select ...
@@ -484,25 +500,25 @@ Adding features that need compiler support
There are several features that need compiler support. The recommended way
to describe the dependency on the compiler feature is to use "depends on"
-followed by a test macro.
+followed by a test macro::
-config STACKPROTECTOR
+ config STACKPROTECTOR
bool "Stack Protector buffer overflow detection"
depends on $(cc-option,-fstack-protector)
...
If you need to expose a compiler capability to makefiles and/or C source files,
-CC_HAS_ is the recommended prefix for the config option.
+`CC_HAS_` is the recommended prefix for the config option::
-config CC_HAS_STACKPROTECTOR_NONE
+ config CC_HAS_STACKPROTECTOR_NONE
def_bool $(cc-option,-fno-stack-protector)
Build as module only
~~~~~~~~~~~~~~~~~~~~
To restrict a component build to module-only, qualify its config symbol
-with "depends on m". E.g.:
+with "depends on m". E.g.::
-config FOO
+ config FOO
depends on BAR && m
limits FOO to module (=m) or disabled (=n).
@@ -529,18 +545,18 @@ Simple Kconfig recursive issue
Read: Documentation/kbuild/Kconfig.recursion-issue-01
-Test with:
+Test with::
-make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
+ make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig
Cumulative Kconfig recursive issue
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Read: Documentation/kbuild/Kconfig.recursion-issue-02
-Test with:
+Test with::
-make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
+ make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-02 allnoconfig
Practical solutions to kconfig recursive issue
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -551,7 +567,9 @@ historical issues resolved through these different solutions.
a) Remove any superfluous "select FOO" or "depends on FOO"
b) Match dependency semantics:
+
b1) Swap all "select FOO" to "depends on FOO" or,
+
b2) Swap all "depends on FOO" to "select FOO"
The resolution to a) can be tested with the sample Kconfig file
@@ -566,8 +584,9 @@ Documentation/kbuild/Kconfig.recursion-issue-02.
Below is a list of examples of prior fixes for these types of recursive issues;
all errors appear to involve one or more select's and one or more "depends on".
+============ ===================================
commit fix
-====== ===
+============ ===================================
06b718c01208 select A -> depends on A
c22eacfe82f9 depends on A -> depends on B
6a91e854442c select A -> depends on A
@@ -590,6 +609,7 @@ d9f9ab51e55e select A -> depends on A
0c51a4d8abd6 depends on A -> select A (3)
e98062ed6dc4 select A -> depends on A (3)
91e5d284a7f1 select A -> (null)
+============ ===================================
(1) Partial (or no) quote of error.
(2) That seems to be the gist of that fix.
@@ -616,11 +636,11 @@ Semantics of Kconfig
~~~~~~~~~~~~~~~~~~~~
The use of Kconfig is broad, Linux is now only one of Kconfig's users:
-one study has completed a broad analysis of Kconfig use in 12 projects [0].
+one study has completed a broad analysis of Kconfig use in 12 projects [0]_.
Despite its widespread use, and although this document does a reasonable job
in documenting basic Kconfig syntax a more precise definition of Kconfig
semantics is welcomed. One project deduced Kconfig semantics through
-the use of the xconfig configurator [1]. Work should be done to confirm if
+the use of the xconfig configurator [1]_. Work should be done to confirm if
the deduced semantics matches our intended Kconfig design goals.
Having 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
express in boolean abstraction of the inferred semantics of Kconfig to
translate Kconfig logic into boolean formulas and run a SAT solver on this to
find dead code / features (always inactive), 114 dead features were found in
-Linux using this methodology [1] (Section 8: Threats to validity).
+Linux using this methodology [1]_ (Section 8: Threats to validity).
Confirming this could prove useful as Kconfig stands as one of the the leading
-industrial variability modeling languages [1] [2]. Its study would help
+industrial variability modeling languages [1]_ [2]_. Its study would help
evaluate practical uses of such languages, their use was only theoretical
and real world requirements were not well understood. As it stands though
only reverse engineering techniques have been used to deduce semantics from
-variability modeling languages such as Kconfig [3].
+variability modeling languages such as Kconfig [3]_.
-[0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
-[1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
-[2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
-[3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf
+.. [0] http://www.eng.uwaterloo.ca/~shshe/kconfig_semantics.pdf
+.. [1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
+.. [2] http://gsd.uwaterloo.ca/sites/default/files/ase241-berger_0.pdf
+.. [3] http://gsd.uwaterloo.ca/sites/default/files/icse2011.pdf
Full SAT solver for Kconfig
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Although SAT solvers [0] haven't yet been used by Kconfig directly, as noted in
-the previous subsection, work has been done however to express in boolean
+Although SAT solvers [4]_ haven't yet been used by Kconfig directly, as noted
+in the previous subsection, work has been done however to express in boolean
abstraction the inferred semantics of Kconfig to translate Kconfig logic into
-boolean formulas and run a SAT solver on it [1]. Another known related project
-is CADOS [2] (former VAMOS [3]) and the tools, mainly undertaker [4], which has
-been introduced first with [5]. The basic concept of undertaker is to exract
-variability models from Kconfig, and put them together with a propositional
-formula extracted from CPP #ifdefs and build-rules into a SAT solver in order
-to find dead code, dead files, and dead symbols. If using a SAT solver is
-desirable on Kconfig one approach would be to evaluate repurposing such efforts
-somehow on Kconfig. There is enough interest from mentors of existing projects
-to not only help advise how to integrate this work upstream but also help
-maintain it long term. Interested developers should visit:
+boolean formulas and run a SAT solver on it [5]_. Another known related project
+is CADOS [6]_ (former VAMOS [7]_) and the tools, mainly undertaker [8]_, which
+has been introduced first with [9]_. The basic concept of undertaker is to
+exract variability models from Kconfig, and put them together with a
+propositional formula extracted from CPP #ifdefs and build-rules into a SAT
+solver in order to find dead code, dead files, and dead symbols. If using a SAT
+solver is desirable on Kconfig one approach would be to evaluate repurposing
+such efforts somehow on Kconfig. There is enough interest from mentors of
+existing projects to not only help advise how to integrate this work upstream
+but also help maintain it long term. Interested developers should visit:
http://kernelnewbies.org/KernelProjects/kconfig-sat
-[0] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
-[1] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
-[2] https://cados.cs.fau.de
-[3] https://vamos.cs.fau.de
-[4] https://undertaker.cs.fau.de
-[5] https://www4.cs.fau.de/Publications/2011/tartler_11_eurosys.pdf
+.. [4] http://www.cs.cornell.edu/~sabhar/chapters/SATSolvers-KR-Handbook.pdf
+.. [5] http://gsd.uwaterloo.ca/sites/default/files/vm-2013-berger.pdf
+.. [6] https://cados.cs.fau.de
+.. [7] https://vamos.cs.fau.de
+.. [8] https://undertaker.cs.fau.de
+.. [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
similarity index 94%
rename from Documentation/kbuild/kconfig-macro-language.txt
rename to 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 @@
+======================
+Kconfig macro language
+======================
+
Concept
-------
@@ -7,7 +11,7 @@ targets and prerequisites. The other is a macro language for performing textual
substitution.
There is clear distinction between the two language stages. For example, you
-can write a makefile like follows:
+can write a makefile like follows::
APP := foo
SRC := foo.c
@@ -17,7 +21,7 @@ can write a makefile like follows:
$(CC) -o $(APP) $(SRC)
The macro language replaces the variable references with their expanded form,
-and handles as if the source file were input like follows:
+and handles as if the source file were input like follows::
foo: foo.c
gcc -o foo foo.c
@@ -26,7 +30,7 @@ Then, Make analyzes the dependency graph and determines the targets to be
updated.
The idea is quite similar in Kconfig - it is possible to describe a Kconfig
-file like this:
+file like this::
CC := gcc
@@ -34,7 +38,7 @@ file like this:
def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC))
The macro language in Kconfig processes the source file into the following
-intermediate:
+intermediate::
config CC_HAS_FOO
def_bool y
@@ -69,7 +73,7 @@ variable. The righthand side of += is expanded immediately if the lefthand
side was originally defined as a simple variable. Otherwise, its evaluation is
deferred.
-The variable reference can take parameters, in the following form:
+The variable reference can take parameters, in the following form::
$(name,arg1,arg2,arg3)
@@ -141,7 +145,7 @@ Make vs Kconfig
Kconfig adopts Make-like macro language, but the function call syntax is
slightly different.
-A function call in Make looks like this:
+A function call in Make looks like this::
$(func-name arg1,arg2,arg3)
@@ -149,14 +153,14 @@ The function name and the first argument are separated by at least one
whitespace. Then, leading whitespaces are trimmed from the first argument,
while whitespaces in the other arguments are kept. You need to use a kind of
trick to start the first parameter with spaces. For example, if you want
-to make "info" function print " hello", you can write like follows:
+to make "info" function print " hello", you can write like follows::
empty :=
space := $(empty) $(empty)
$(info $(space)$(space)hello)
Kconfig uses only commas for delimiters, and keeps all whitespaces in the
-function call. Some people prefer putting a space after each comma delimiter:
+function call. Some people prefer putting a space after each comma delimiter::
$(func-name, arg1, arg2, arg3)
@@ -166,7 +170,7 @@ Make - for example, $(subst .c, .o, $(sources)) is a typical mistake; it
replaces ".c" with " .o".
In Make, a user-defined function is referenced by using a built-in function,
-'call', like this:
+'call', like this::
$(call my-func,arg1,arg2,arg3)
@@ -179,12 +183,12 @@ Likewise, $(info hello, world) prints "hello, world" to stdout. You could say
this is _useful_ inconsistency.
In Kconfig, for simpler implementation and grammatical consistency, commas that
-appear in the $( ) context are always delimiters. It means
+appear in the $( ) context are always delimiters. It means::
$(shell, echo hello, world)
is an error because it is passing two parameters where the 'shell' function
-accepts only one. To pass commas in arguments, you can use the following trick:
+accepts only one. To pass commas in arguments, you can use the following trick::
comma := ,
$(shell, echo hello$(comma) world)
@@ -195,7 +199,7 @@ Caveats
A variable (or function) cannot be expanded across tokens. So, you cannot use
a variable as a shorthand for an expression that consists of multiple tokens.
-The following works:
+The following works::
RANGE_MIN := 1
RANGE_MAX := 3
@@ -204,7 +208,7 @@ The following works:
int "foo"
range $(RANGE_MIN) $(RANGE_MAX)
-But, the following does not work:
+But, the following does not work::
RANGES := 1 3
@@ -213,7 +217,7 @@ But, the following does not work:
range $(RANGES)
A variable cannot be expanded to any keyword in Kconfig. The following does
-not work:
+not work::
MY_TYPE := tristate
@@ -223,7 +227,8 @@ not work:
Obviously from the design, $(shell command) is expanded in the textual
substitution phase. You cannot pass symbols to the 'shell' function.
-The following does not work as expected.
+
+The following does not work as expected::
config ENDIAN_FLAG
string
@@ -234,7 +239,7 @@ The following does not work as expected.
def_bool $(shell $(srctree)/scripts/gcc-check-flag ENDIAN_FLAG)
Instead, you can do like follows so that any function call is statically
-expanded.
+expanded::
config CC_HAS_ENDIAN_FLAG
bool
diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.rst
similarity index 80%
rename from Documentation/kbuild/kconfig.txt
rename to Documentation/kbuild/kconfig.rst
index 68c82914c0f3..88129af7e539 100644
--- a/Documentation/kbuild/kconfig.txt
+++ b/Documentation/kbuild/kconfig.rst
@@ -1,4 +1,8 @@
-This file contains some assistance for using "make *config".
+===================
+Kconfig make config
+===================
+
+This file contains some assistance for using `make *config`.
Use "make help" to list all of the possible configuration targets.
@@ -6,9 +10,8 @@ The xconfig ('qconf'), menuconfig ('mconf'), and nconfig ('nconf')
programs also have embedded help text. Be sure to check that for
navigation, search, and other general help text.
-======================================================================
General
---------------------------------------------------
+-------
New kernel releases often introduce new config symbols. Often more
important, new kernel releases may rename config symbols. When
@@ -17,51 +20,55 @@ this happens, using a previously working .config file and running
for you, so you may find that you need to see what NEW kernel
symbols have been introduced.
-To see a list of new config symbols, use
+To see a list of new config symbols, use::
cp user/some/old.config .config
make listnewconfig
and the config program will list any new symbols, one per line.
-Alternatively, you can use the brute force method:
+Alternatively, you can use the brute force method::
make oldconfig
scripts/diffconfig .config.old .config | less
-______________________________________________________________________
-Environment variables for '*config'
+----------------------------------------------------------------------
+
+Environment variables for `*config`
KCONFIG_CONFIG
---------------------------------------------------
+--------------
This environment variable can be used to specify a default kernel config
file name to override the default name of ".config".
KCONFIG_OVERWRITECONFIG
---------------------------------------------------
+-----------------------
If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not
break symlinks when .config is a symlink to somewhere else.
-CONFIG_
---------------------------------------------------
-If you set CONFIG_ in the environment, Kconfig will prefix all symbols
+`CONFIG_`
+---------
+If you set `CONFIG_` in the environment, Kconfig will prefix all symbols
with its value when saving the configuration, instead of using the default,
-"CONFIG_".
+`CONFIG_`.
+
+----------------------------------------------------------------------
-______________________________________________________________________
Environment variables for '{allyes/allmod/allno/rand}config'
KCONFIG_ALLCONFIG
---------------------------------------------------
+-----------------
(partially based on lkml email from/by Rob Landley, re: miniconfig)
+
--------------------------------------------------
+
The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also
use the environment variable KCONFIG_ALLCONFIG as a flag or a filename
that contains config symbols that the user requires to be set to a
specific value. If KCONFIG_ALLCONFIG is used without a filename where
-KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", "make *config"
+KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", `make *config`
checks for a file named "all{yes/mod/no/def/random}.config"
-(corresponding to the *config command that was used) for symbol values
+(corresponding to the `*config` command that was used) for symbol values
that are to be forced. If this file is not found, it checks for a
file named "all.config" to contain forced values.
@@ -74,43 +81,55 @@ This 'KCONFIG_ALLCONFIG' file is a config file which contains
(usually a subset of all) preset config symbols. These variable
settings are still subject to normal dependency checks.
-Examples:
+Examples::
+
KCONFIG_ALLCONFIG=custom-notebook.config make allnoconfig
-or
+
+or::
+
KCONFIG_ALLCONFIG=mini.config make allnoconfig
-or
+
+or::
+
make KCONFIG_ALLCONFIG=mini.config allnoconfig
These examples will disable most options (allnoconfig) but enable or
disable the options that are explicitly listed in the specified
mini-config files.
-______________________________________________________________________
+----------------------------------------------------------------------
+
Environment variables for 'randconfig'
KCONFIG_SEED
---------------------------------------------------
+------------
You can set this to the integer value used to seed the RNG, if you want
to somehow debug the behaviour of the kconfig parser/frontends.
If not set, the current time will be used.
KCONFIG_PROBABILITY
---------------------------------------------------
+-------------------
This variable can be used to skew the probabilities. This variable can
be unset or empty, or set to three different formats:
+
+ ======================= ================== =====================
KCONFIG_PROBABILITY y:n split y:m:n split
- -----------------------------------------------------------------
+ ======================= ================== =====================
unset or empty 50 : 50 33 : 33 : 34
N N : 100-N N/2 : N/2 : 100-N
[1] N:M N+M : 100-(N+M) N : M : 100-(N+M)
[2] N:M:L N : 100-N M : L : 100-(M+L)
+ ======================= ================== =====================
where N, M and L are integers (in base 10) in the range [0,100], and so
that:
+
[1] N+M is in the range [0,100]
+
[2] M+L is in the range [0,100]
-Examples:
+Examples::
+
KCONFIG_PROBABILITY=10
10% of booleans will be set to 'y', 90% to 'n'
5% of tristates will be set to 'y', 5% to 'm', 90% to 'n'
@@ -121,34 +140,36 @@ Examples:
10% of booleans will be set to 'y', 90% to 'n'
15% of tristates will be set to 'y', 15% to 'm', 70% to 'n'
-______________________________________________________________________
+----------------------------------------------------------------------
+
Environment variables for 'syncconfig'
KCONFIG_NOSILENTUPDATE
---------------------------------------------------
+----------------------
If this variable has a non-blank value, it prevents silent kernel
config updates (requires explicit updates).
KCONFIG_AUTOCONFIG
---------------------------------------------------
+------------------
This environment variable can be set to specify the path & name of the
"auto.conf" file. Its default value is "include/config/auto.conf".
KCONFIG_TRISTATE
---------------------------------------------------
+----------------
This environment variable can be set to specify the path & name of the
"tristate.conf" file. Its default value is "include/config/tristate.conf".
KCONFIG_AUTOHEADER
---------------------------------------------------
+------------------
This environment variable can be set to specify the path & name of the
"autoconf.h" (header) file.
Its default value is "include/generated/autoconf.h".
-======================================================================
+----------------------------------------------------------------------
+
menuconfig
---------------------------------------------------
+----------
SEARCHING for CONFIG symbols
@@ -158,7 +179,8 @@ Searching in menuconfig:
names, so you have to know something close to what you are
looking for.
- Example:
+ Example::
+
/hotplug
This lists all config symbols that contain "hotplug",
e.g., HOTPLUG_CPU, MEMORY_HOTPLUG.
@@ -166,48 +188,55 @@ Searching in menuconfig:
For search help, enter / followed by TAB-TAB (to highlight
<Help>) and Enter. This will tell you that you can also use
regular expressions (regexes) in the search string, so if you
- are not interested in MEMORY_HOTPLUG, you could try
+ are not interested in MEMORY_HOTPLUG, you could try::
/^hotplug
When searching, symbols are sorted thus:
+
- first, exact matches, sorted alphabetically (an exact match
is when the search matches the complete symbol name);
- then, other matches, sorted alphabetically.
+
For example: ^ATH.K matches:
+
ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG
[...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...]
+
of which only ATH5K and ATH9K match exactly and so are sorted
first (and in alphabetical order), then come all other symbols,
sorted in alphabetical order.
-______________________________________________________________________
+----------------------------------------------------------------------
+
User interface options for 'menuconfig'
MENUCONFIG_COLOR
---------------------------------------------------
+----------------
It is possible to select different color themes using the variable
-MENUCONFIG_COLOR. To select a theme use:
+MENUCONFIG_COLOR. To select a theme use::
make MENUCONFIG_COLOR=<theme> menuconfig
-Available themes are:
- mono => selects colors suitable for monochrome displays
- blackbg => selects a color scheme with black background
- classic => theme with blue background. The classic look
- bluetitle => a LCD friendly version of classic. (default)
+Available themes are::
+
+ - mono => selects colors suitable for monochrome displays
+ - blackbg => selects a color scheme with black background
+ - classic => theme with blue background. The classic look
+ - bluetitle => a LCD friendly version of classic. (default)
MENUCONFIG_MODE
---------------------------------------------------
+---------------
This mode shows all sub-menus in one large tree.
-Example:
+Example::
+
make MENUCONFIG_MODE=single_menu menuconfig
+----------------------------------------------------------------------
-======================================================================
nconfig
---------------------------------------------------
+-------
nconfig is an alternate text-based configurator. It lists function
keys across the bottom of the terminal (window) that execute commands.
@@ -231,16 +260,16 @@ Searching in nconfig:
given string or regular expression (regex).
NCONFIG_MODE
---------------------------------------------------
+------------
This mode shows all sub-menus in one large tree.
-Example:
+Example::
make NCONFIG_MODE=single_menu nconfig
+----------------------------------------------------------------------
-======================================================================
xconfig
---------------------------------------------------
+-------
Searching in xconfig:
@@ -260,13 +289,12 @@ Searching in xconfig:
to return to the main menu.
-======================================================================
+----------------------------------------------------------------------
+
gconfig
---------------------------------------------------
+-------
Searching in gconfig:
There is no search command in gconfig. However, gconfig does
have several different viewing choices, modes, and options.
-
-###
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.rst
similarity index 83%
rename from Documentation/kbuild/makefiles.txt
rename to Documentation/kbuild/makefiles.rst
index d65ad5746f94..9274cdcc9bd2 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.rst
@@ -1,8 +1,10 @@
+======================
Linux Kernel Makefiles
+======================
This document describes the Linux kernel Makefiles.
-=== Table of Contents
+.. Table of Contents
=== 1 Overview
=== 2 Who does what
@@ -54,9 +56,10 @@ This document describes the Linux kernel Makefiles.
=== 10 Credits
=== 11 TODO
-=== 1 Overview
+1 Overview
+==========
-The Makefiles have five parts:
+The Makefiles have five parts::
Makefile the top Makefile.
.config the kernel configuration file.
@@ -85,7 +88,8 @@ scripts/Makefile.* contains all the definitions/rules etc. that
are used to build the kernel based on the kbuild makefiles.
-=== 2 Who does what
+2 Who does what
+===============
People have four different relationships with the kernel Makefiles.
@@ -110,7 +114,8 @@ These people need to know about all aspects of the kernel Makefiles.
This document is aimed towards normal developers and arch developers.
-=== 3 The kbuild files
+3 The kbuild files
+==================
Most Makefiles within the kernel are kbuild Makefiles that use the
kbuild infrastructure. This chapter introduces the syntax used in the
@@ -122,7 +127,8 @@ file will be used.
Section 3.1 "Goal definitions" is a quick intro, further chapters provide
more details, with real examples.
---- 3.1 Goal definitions
+3.1 Goal definitions
+--------------------
Goal definitions are the main part (heart) of the kbuild Makefile.
These lines define the files to be built, any special compilation
@@ -130,7 +136,8 @@ more details, with real examples.
The most simple kbuild makefile contains one line:
- Example:
+ Example::
+
obj-y += foo.o
This tells kbuild that there is one object in that directory, named
@@ -139,14 +146,16 @@ more details, with real examples.
If foo.o shall be built as a module, the variable obj-m is used.
Therefore the following pattern is often used:
- Example:
+ Example::
+
obj-$(CONFIG_FOO) += foo.o
$(CONFIG_FOO) evaluates to either y (for built-in) or m (for module).
If CONFIG_FOO is neither y nor m, then the file will not be compiled
nor linked.
---- 3.2 Built-in object goals - obj-y
+3.2 Built-in object goals - obj-y
+---------------------------------
The kbuild Makefile specifies object files for vmlinux
in the $(obj-y) lists. These lists depend on the kernel
@@ -167,14 +176,16 @@ more details, with real examples.
order may e.g. change the order in which your SCSI
controllers are detected, and thus your disks are renumbered.
- Example:
+ Example::
+
#drivers/isdn/i4l/Makefile
# Makefile for the kernel ISDN subsystem and device drivers.
# Each configuration option enables a list of files.
obj-$(CONFIG_ISDN_I4L) += isdn.o
obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
---- 3.3 Loadable module goals - obj-m
+3.3 Loadable module goals - obj-m
+---------------------------------
$(obj-m) specifies object files which are built as loadable
kernel modules.
@@ -183,7 +194,8 @@ more details, with real examples.
files. In the case of one source file, the kbuild makefile
simply adds the file to $(obj-m).
- Example:
+ Example::
+
#drivers/isdn/i4l/Makefile
obj-$(CONFIG_ISDN_PPP_BSDCOMP) += isdn_bsdcomp.o
@@ -195,7 +207,8 @@ more details, with real examples.
module from, so you have to tell it by setting a $(<module_name>-y)
variable.
- Example:
+ Example::
+
#drivers/isdn/i4l/Makefile
obj-$(CONFIG_ISDN_I4L) += isdn.o
isdn-y := isdn_net_lib.o isdn_v110.o isdn_common.o
@@ -205,10 +218,11 @@ more details, with real examples.
"$(LD) -r" on the list of these files to generate isdn.o.
Due to kbuild recognizing $(<module_name>-y) for composite objects,
- you can use the value of a CONFIG_ symbol to optionally include an
+ you can use the value of a `CONFIG_` symbol to optionally include an
object file as part of a composite object.
- Example:
+ Example::
+
#fs/ext2/Makefile
obj-$(CONFIG_EXT2_FS) += ext2.o
ext2-y := balloc.o dir.o file.o ialloc.o inode.o ioctl.o \
@@ -225,12 +239,14 @@ more details, with real examples.
kbuild will build an ext2.o file for you out of the individual
parts and then link this into built-in.a, as you would expect.
---- 3.4 Objects which export symbols
+3.4 Objects which export symbols
+--------------------------------
No special notation is required in the makefiles for
modules exporting symbols.
---- 3.5 Library file goals - lib-y
+3.5 Library file goals - lib-y
+------------------------------
Objects listed with obj-* are used for modules, or
combined in a built-in.a for that specific directory.
@@ -247,18 +263,21 @@ more details, with real examples.
and to be part of a library. Therefore the same directory
may contain both a built-in.a and a lib.a file.
- Example:
+ Example::
+
#arch/x86/lib/Makefile
lib-y := delay.o
This will create a library lib.a based on delay.o. For kbuild to
actually recognize that there is a lib.a being built, the directory
shall be listed in libs-y.
+
See also "6.4 List directories to visit when descending".
- Use of lib-y is normally restricted to lib/ and arch/*/lib.
+ Use of lib-y is normally restricted to `lib/` and `arch/*/lib`.
---- 3.6 Descending down in directories
+3.6 Descending down in directories
+----------------------------------
A Makefile is only responsible for building objects in its own
directory. Files in subdirectories should be taken care of by
@@ -270,7 +289,8 @@ more details, with real examples.
ext2 lives in a separate directory, and the Makefile present in fs/
tells kbuild to descend down using the following assignment.
- Example:
+ Example::
+
#fs/Makefile
obj-$(CONFIG_EXT2_FS) += ext2/
@@ -281,11 +301,12 @@ more details, with real examples.
the directory, it is the Makefile in the subdirectory that
specifies what is modular and what is built-in.
- It is good practice to use a CONFIG_ variable when assigning directory
+ It is good practice to use a `CONFIG_` variable when assigning directory
names. This allows kbuild to totally skip the directory if the
- corresponding CONFIG_ option is neither 'y' nor 'm'.
+ corresponding `CONFIG_` option is neither 'y' nor 'm'.
---- 3.7 Compilation flags
+3.7 Compilation flags
+---------------------
ccflags-y, asflags-y and ldflags-y
These three flags apply only to the kbuild makefile in which they
@@ -297,7 +318,8 @@ more details, with real examples.
ccflags-y specifies options for compiling with $(CC).
- Example:
+ Example::
+
# drivers/acpi/acpica/Makefile
ccflags-y := -Os -D_LINUX -DBUILDING_ACPICA
ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT
@@ -308,13 +330,15 @@ more details, with real examples.
asflags-y specifies options for assembling with $(AS).
- Example:
+ Example::
+
#arch/sparc/kernel/Makefile
asflags-y := -ansi
ldflags-y specifies options for linking with $(LD).
- Example:
+ Example::
+
#arch/cris/boot/compressed/Makefile
ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds
@@ -325,18 +349,19 @@ more details, with real examples.
Options specified using subdir-* are added to the commandline before
the options specified using the non-subdir variants.
- Example:
+ Example::
+
subdir-ccflags-y := -Werror
CFLAGS_$@, AFLAGS_$@
-
CFLAGS_$@ and AFLAGS_$@ only apply to commands in current
kbuild makefile.
$(CFLAGS_$@) specifies per-file options for $(CC). The $@
part has a literal value which specifies the file that it is for.
- Example:
+ Example::
+
# drivers/scsi/Makefile
CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF
CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ \
@@ -347,24 +372,27 @@ more details, with real examples.
$(AFLAGS_$@) is a similar feature for source files in assembly
languages.
- Example:
+ Example::
+
# arch/arm/kernel/Makefile
AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
---- 3.9 Dependency tracking
+3.9 Dependency tracking
+-----------------------
Kbuild tracks dependencies on the following:
- 1) All prerequisite files (both *.c and *.h)
- 2) CONFIG_ options used in all prerequisite files
+ 1) All prerequisite files (both `*.c` and `*.h`)
+ 2) `CONFIG_` options used in all prerequisite files
3) Command-line used to compile target
Thus, if you change an option to $(CC) all affected files will
be re-compiled.
---- 3.10 Special Rules
+3.10 Special Rules
+------------------
Special rules are used when the kbuild infrastructure does
not provide the required support. A typical example is
@@ -379,43 +407,47 @@ more details, with real examples.
Two variables are used when defining special rules:
- $(src)
- $(src) is a relative path which points to the directory
- where the Makefile is located. Always use $(src) when
- referring to files located in the src tree.
+ $(src)
+ $(src) is a relative path which points to the directory
+ where the Makefile is located. Always use $(src) when
+ referring to files located in the src tree.
- $(obj)
- $(obj) is a relative path which points to the directory
- where the target is saved. Always use $(obj) when
- referring to generated files.
+ $(obj)
+ $(obj) is a relative path which points to the directory
+ where the target is saved. Always use $(obj) when
+ referring to generated files.
+
+ Example::
- Example:
#drivers/scsi/Makefile
$(obj)/53c8xx_d.h: $(src)/53c7,8xx.scr $(src)/script_asm.pl
$(CPP) -DCHIP=810 - < $< | ... $(src)/script_asm.pl
- This is a special rule, following the normal syntax
- required by make.
- The target file depends on two prerequisite files. References
- to the target file are prefixed with $(obj), references
- to prerequisites are referenced with $(src) (because they are not
- generated files).
-
- $(kecho)
- echoing information to user in a rule is often a good practice
- but when execution "make -s" one does not expect to see any output
- except for warnings/errors.
- To support this kbuild defines $(kecho) which will echo out the
- text following $(kecho) to stdout except if "make -s" is used.
-
- Example:
+ This is a special rule, following the normal syntax
+ required by make.
+
+ The target file depends on two prerequisite files. References
+ to the target file are prefixed with $(obj), references
+ to prerequisites are referenced with $(src) (because they are not
+ generated files).
+
+ $(kecho)
+ echoing information to user in a rule is often a good practice
+ but when execution "make -s" one does not expect to see any output
+ except for warnings/errors.
+ To support this kbuild defines $(kecho) which will echo out the
+ text following $(kecho) to stdout except if "make -s" is used.
+
+ Example::
+
#arch/blackfin/boot/Makefile
$(obj)/vmImage: $(obj)/vmlinux.gz
$(call if_changed,uimage)
@$(kecho) 'Kernel: $@ is ready'
---- 3.11 $(CC) support functions
+3.11 $(CC) support functions
+----------------------------
The kernel may be built with several different versions of
$(CC), each supporting a unique set of features and options.
@@ -425,10 +457,11 @@ more details, with real examples.
as-option
as-option is used to check if $(CC) -- when used to compile
- assembler (*.S) files -- supports the given option. An optional
+ assembler (`*.S`) files -- supports the given option. An optional
second option may be specified if the first option is not supported.
- Example:
+ Example::
+
#arch/sh/Makefile
cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),)
@@ -437,6 +470,21 @@ more details, with real examples.
The second argument is optional, and if supplied will be used
if first argument is not supported.
+ cc-ldoption
+ cc-ldoption is used to check if $(CC) when used to link object files
+ supports the given option. An optional second option may be
+ specified if first option are not supported.
+
+ Example::
+
+ #arch/x86/kernel/Makefile
+ vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+
+ In the above example, vsyscall-flags will be assigned the option
+ -Wl$(comma)--hash-style=sysv if it is supported by $(CC).
+ The second argument is optional, and if supplied will be used
+ if first argument is not supported.
+
as-instr
as-instr checks if the assembler reports a specific instruction
and then outputs either option1 or option2
@@ -447,7 +495,8 @@ more details, with real examples.
cc-option is used to check if $(CC) supports a given option, and if
not supported to use an optional second option.
- Example:
+ Example::
+
#arch/x86/Makefile
cflags-y += $(call cc-option,-march=pentium-mmx,-march=i586)
@@ -461,7 +510,8 @@ more details, with real examples.
cc-option-yn is used to check if gcc supports a given option
and return 'y' if supported, otherwise 'n'.
- Example:
+ Example::
+
#arch/ppc/Makefile
biarch := $(call cc-option-yn, -m32)
aflags-$(biarch) += -a32
@@ -479,7 +529,8 @@ more details, with real examples.
because gcc 4.4 and later accept any unknown -Wno-* option and only
warn about it if there is another warning in the source file.
- Example:
+ Example::
+
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
In the above example, -Wno-unused-but-set-variable will be added to
@@ -490,7 +541,8 @@ more details, with real examples.
if version expression is true, or the fifth (if given) if the version
expression is false.
- Example:
+ Example::
+
#fs/reiserfs/Makefile
ccflags-y := $(call cc-ifversion, -lt, 0402, -O1)
@@ -515,7 +567,8 @@ more details, with real examples.
build (host arch is different from target arch). And if CROSS_COMPILE
is already set then leave it with the old value.
- Example:
+ Example::
+
#arch/m68k/Makefile
ifneq ($(SUBARCH),$(ARCH))
ifeq ($(CROSS_COMPILE),)
@@ -523,7 +576,8 @@ more details, with real examples.
endif
endif
---- 3.12 $(LD) support functions
+3.12 $(LD) support functions
+----------------------------
ld-option
ld-option is used to check if $(LD) supports the supplied option.
@@ -531,12 +585,14 @@ more details, with real examples.
The second argument is an optional option that can be used if the
first option is not supported by $(LD).
- Example:
+ Example::
+
#Makefile
LDFLAGS_vmlinux += $(call ld-option, -X)
-=== 4 Host Program support
+4 Host Program support
+======================
Kbuild supports building executables on the host for use during the
compilation stage.
@@ -550,21 +606,24 @@ This can be done in two ways. Either add the dependency in a rule,
or utilise the variable $(always).
Both possibilities are described in the following.
---- 4.1 Simple Host Program
+4.1 Simple Host Program
+-----------------------
In some cases there is a need to compile and run a program on the
computer where the build is running.
The following line tells kbuild that the program bin2hex shall be
built on the build host.
- Example:
+ Example::
+
hostprogs-y := bin2hex
Kbuild assumes in the above example that bin2hex is made from a single
c-source file named bin2hex.c located in the same directory as
the Makefile.
---- 4.2 Composite Host Programs
+4.2 Composite Host Programs
+---------------------------
Host programs can be made up based on composite objects.
The syntax used to define composite objects for host programs is
@@ -572,7 +631,8 @@ Both possibilities are described in the following.
$(<executable>-objs) lists all objects used to link the final
executable.
- Example:
+ Example::
+
#scripts/lxdialog/Makefile
hostprogs-y := lxdialog
lxdialog-objs := checklist.o lxdialog.o
@@ -580,16 +640,19 @@ Both possibilities are described in the following.
Objects with extension .o are compiled from the corresponding .c
files. In the above example, checklist.c is compiled to checklist.o
and lxdialog.c is compiled to lxdialog.o.
+
Finally, the two .o files are linked to the executable, lxdialog.
Note: The syntax <executable>-y is not permitted for host-programs.
---- 4.3 Using C++ for host programs
+4.3 Using C++ for host programs
+-------------------------------
kbuild offers support for host programs written in C++. This was
introduced solely to support kconfig, and is not recommended
for general use.
- Example:
+ Example::
+
#scripts/kconfig/Makefile
hostprogs-y := qconf
qconf-cxxobjs := qconf.o
@@ -600,13 +663,15 @@ Both possibilities are described in the following.
If qconf is composed of a mixture of .c and .cc files, then an
additional line can be used to identify this.
- Example:
+ Example::
+
#scripts/kconfig/Makefile
hostprogs-y := qconf
qconf-cxxobjs := qconf.o
qconf-objs := check.o
---- 4.4 Controlling compiler options for host programs
+4.4 Controlling compiler options for host programs
+--------------------------------------------------
When compiling host programs, it is possible to set specific flags.
The programs will always be compiled utilising $(HOSTCC) passed
@@ -614,27 +679,31 @@ Both possibilities are described in the following.
To set flags that will take effect for all host programs created
in that Makefile, use the variable HOST_EXTRACFLAGS.
- Example:
+ Example::
+
#scripts/lxdialog/Makefile
HOST_EXTRACFLAGS += -I/usr/include/ncurses
To set specific flags for a single file the following construction
is used:
- Example:
+ Example::
+
#arch/ppc64/boot/Makefile
HOSTCFLAGS_piggyback.o := -DKERNELBASE=$(KERNELBASE)
It is also possible to specify additional options to the linker.
- Example:
+ Example::
+
#scripts/kconfig/Makefile
HOSTLDLIBS_qconf := -L$(QTDIR)/lib
When linking qconf, it will be passed the extra option
"-L$(QTDIR)/lib".
---- 4.5 When host programs are actually built
+4.5 When host programs are actually built
+-----------------------------------------
Kbuild will only build host-programs when they are referenced
as a prerequisite.
@@ -642,7 +711,8 @@ Both possibilities are described in the following.
(1) List the prerequisite explicitly in a special rule.
- Example:
+ Example::
+
#drivers/pci/Makefile
hostprogs-y := gen-devlist
$(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist
@@ -653,11 +723,13 @@ Both possibilities are described in the following.
the host programs in special rules must be prefixed with $(obj).
(2) Use $(always)
+
When there is no suitable special rule, and the host program
shall be built when a makefile is entered, the $(always)
variable shall be used.
- Example:
+ Example::
+
#scripts/lxdialog/Makefile
hostprogs-y := lxdialog
always := $(hostprogs-y)
@@ -665,11 +737,13 @@ Both possibilities are described in the following.
This will tell kbuild to build lxdialog even if not referenced in
any rule.
---- 4.6 Using hostprogs-$(CONFIG_FOO)
+4.6 Using hostprogs-$(CONFIG_FOO)
+---------------------------------
A typical pattern in a Kbuild file looks like this:
- Example:
+ Example::
+
#scripts/Makefile
hostprogs-$(CONFIG_KALLSYMS) += kallsyms
@@ -679,7 +753,8 @@ Both possibilities are described in the following.
like hostprogs-y. But only hostprogs-y is recommended to be used
when no CONFIG symbols are involved.
-=== 5 Kbuild clean infrastructure
+5 Kbuild clean infrastructure
+=============================
"make clean" deletes most generated files in the obj tree where the kernel
is 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
Additional files can be specified in kbuild makefiles by use of $(clean-files).
- Example:
+ Example::
+
#lib/Makefile
clean-files := crc32table.h
@@ -701,7 +777,8 @@ Makefile, except if prefixed with $(objtree).
To delete a directory hierarchy use:
- Example:
+ Example::
+
#scripts/package/Makefile
clean-dirs := $(objtree)/debian/
@@ -711,7 +788,8 @@ subdirectories.
To exclude certain files from make clean, use the $(no-clean-files) variable.
This is only a special case used in the top level Kbuild file:
- Example:
+ Example::
+
#Kbuild
no-clean-files := $(bounds-file) $(offsets-file)
@@ -719,7 +797,8 @@ Usually kbuild descends down in subdirectories due to "obj-* := dir/",
but in the architecture makefiles where the kbuild infrastructure
is not sufficient this sometimes needs to be explicit.
- Example:
+ Example::
+
#arch/x86/boot/Makefile
subdir- := compressed/
@@ -729,7 +808,8 @@ directory compressed/ when "make clean" is executed.
To support the clean infrastructure in the Makefiles that build the
final bootimage there is an optional target named archclean:
- Example:
+ Example::
+
#arch/x86/Makefile
archclean:
$(Q)$(MAKE) $(clean)=arch/x86/boot
@@ -745,7 +825,8 @@ is not operational at that point.
Note 2: All directories listed in core-y, libs-y, drivers-y and net-y will
be visited during "make clean".
-=== 6 Architecture Makefiles
+6 Architecture Makefiles
+========================
The top level Makefile sets up the environment and does the preparation,
before 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
a few targets.
When kbuild executes, the following steps are followed (roughly):
+
1) Configuration of the kernel => produce .config
2) Store kernel version in include/linux/version.h
3) Updating all other prerequisites to the target prepare:
@@ -773,37 +855,45 @@ When kbuild executes, the following steps are followed (roughly):
- Preparing initrd images and the like
---- 6.1 Set variables to tweak the build to the architecture
+6.1 Set variables to tweak the build to the architecture
+--------------------------------------------------------
- LDFLAGS Generic $(LD) options
+ LDFLAGS
+ Generic $(LD) options
Flags used for all invocations of the linker.
Often specifying the emulation is sufficient.
- Example:
+ Example::
+
#arch/s390/Makefile
LDFLAGS := -m elf_s390
+
Note: ldflags-y can be used to further customise
the flags used. See chapter 3.7.
- LDFLAGS_vmlinux Options for $(LD) when linking vmlinux
+ LDFLAGS_vmlinux
+ Options for $(LD) when linking vmlinux
LDFLAGS_vmlinux is used to specify additional flags to pass to
the linker when linking the final vmlinux image.
LDFLAGS_vmlinux uses the LDFLAGS_$@ support.
- Example:
+ Example::
+
#arch/x86/Makefile
LDFLAGS_vmlinux := -e stext
- OBJCOPYFLAGS objcopy flags
+ OBJCOPYFLAGS
+ objcopy flags
When $(call if_changed,objcopy) is used to translate a .o file,
the flags specified in OBJCOPYFLAGS will be used.
$(call if_changed,objcopy) is often used to generate raw binaries on
vmlinux.
- Example:
+ Example::
+
#arch/s390/Makefile
OBJCOPYFLAGS := -O binary
@@ -814,30 +904,34 @@ When kbuild executes, the following steps are followed (roughly):
In this example, the binary $(obj)/image is a binary version of
vmlinux. The usage of $(call if_changed,xxx) will be described later.
- KBUILD_AFLAGS $(AS) assembler flags
+ KBUILD_AFLAGS
+ $(AS) assembler flags
Default value - see top level Makefile
Append or modify as required per architecture.
- Example:
+ Example::
+
#arch/sparc64/Makefile
KBUILD_AFLAGS += -m64 -mcpu=ultrasparc
- KBUILD_CFLAGS $(CC) compiler flags
+ KBUILD_CFLAGS
+ $(CC) compiler flags
Default value - see top level Makefile
Append or modify as required per architecture.
Often, the KBUILD_CFLAGS variable depends on the configuration.
- Example:
+ Example::
+
#arch/x86/boot/compressed/Makefile
cflags-$(CONFIG_X86_32) := -march=i386
cflags-$(CONFIG_X86_64) := -mcmodel=small
KBUILD_CFLAGS += $(cflags-y)
Many arch Makefiles dynamically run the target C compiler to
- probe supported options:
+ probe supported options::
#arch/x86/Makefile
@@ -853,32 +947,39 @@ When kbuild executes, the following steps are followed (roughly):
The first example utilises the trick that a config option expands
to 'y' when selected.
- KBUILD_AFLAGS_KERNEL $(AS) options specific for built-in
+ KBUILD_AFLAGS_KERNEL
+ $(AS) options specific for built-in
$(KBUILD_AFLAGS_KERNEL) contains extra C compiler flags used to compile
resident kernel code.
- KBUILD_AFLAGS_MODULE Options for $(AS) when building modules
+ KBUILD_AFLAGS_MODULE
+ Options for $(AS) when building modules
$(KBUILD_AFLAGS_MODULE) is used to add arch-specific options that
are used for $(AS).
+
From commandline AFLAGS_MODULE shall be used (see kbuild.txt).
- KBUILD_CFLAGS_KERNEL $(CC) options specific for built-in
+ KBUILD_CFLAGS_KERNEL
+ $(CC) options specific for built-in
$(KBUILD_CFLAGS_KERNEL) contains extra C compiler flags used to compile
resident kernel code.
- KBUILD_CFLAGS_MODULE Options for $(CC) when building modules
+ KBUILD_CFLAGS_MODULE
+ Options for $(CC) when building modules
$(KBUILD_CFLAGS_MODULE) is used to add arch-specific options that
are used for $(CC).
From commandline CFLAGS_MODULE shall be used (see kbuild.txt).
- KBUILD_LDFLAGS_MODULE Options for $(LD) when linking modules
+ KBUILD_LDFLAGS_MODULE
+ Options for $(LD) when linking modules
$(KBUILD_LDFLAGS_MODULE) is used to add arch-specific options
used when linking modules. This is often a linker script.
+
From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
KBUILD_ARFLAGS Options for $(AR) when creating archives
@@ -894,7 +995,8 @@ When kbuild executes, the following steps are followed (roughly):
means for an architecture to override the defaults.
---- 6.2 Add prerequisites to archheaders:
+6.2 Add prerequisites to archheaders
+------------------------------------
The archheaders: rule is used to generate header files that
may be installed into user space by "make header_install" or
@@ -907,13 +1009,15 @@ When kbuild executes, the following steps are followed (roughly):
architecture itself.
---- 6.3 Add prerequisites to archprepare:
+6.3 Add prerequisites to archprepare
+------------------------------------
The archprepare: rule is used to list prerequisites that need to be
built before starting to descend down in the subdirectories.
This is usually used for header files containing assembler constants.
- Example:
+ Example::
+
#arch/arm/Makefile
archprepare: maketools
@@ -923,7 +1027,8 @@ When kbuild executes, the following steps are followed (roughly):
generating offset header files.
---- 6.4 List directories to visit when descending
+6.4 List directories to visit when descending
+---------------------------------------------
An arch Makefile cooperates with the top Makefile to define variables
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):
machinery is all architecture-independent.
- head-y, init-y, core-y, libs-y, drivers-y, net-y
+ head-y, init-y, core-y, libs-y, drivers-y, net-y
+ $(head-y) lists objects to be linked first in vmlinux.
- $(head-y) lists objects to be linked first in vmlinux.
- $(libs-y) lists directories where a lib.a archive can be located.
- The rest list directories where a built-in.a object file can be
- located.
+ $(libs-y) lists directories where a lib.a archive can be located.
- $(init-y) objects will be located after $(head-y).
- Then the rest follows in this order:
- $(core-y), $(libs-y), $(drivers-y) and $(net-y).
+ The rest list directories where a built-in.a object file can be
+ located.
- The top level Makefile defines values for all generic directories,
- and arch/$(ARCH)/Makefile only adds architecture-specific directories.
+ $(init-y) objects will be located after $(head-y).
+
+ Then the rest follows in this order:
+
+ $(core-y), $(libs-y), $(drivers-y) and $(net-y).
+
+ The top level Makefile defines values for all generic directories,
+ and arch/$(ARCH)/Makefile only adds architecture-specific
+ directories.
+
+ Example::
- Example:
#arch/sparc64/Makefile
core-y += arch/sparc64/kernel/
libs-y += arch/sparc64/prom/ arch/sparc64/lib/
drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/
---- 6.5 Architecture-specific boot images
+6.5 Architecture-specific boot images
+-------------------------------------
An arch Makefile specifies goals that take the vmlinux file, compress
it, wrap it in bootstrapping code, and copy the resulting files
@@ -970,7 +1081,8 @@ When kbuild executes, the following steps are followed (roughly):
arch/$(ARCH)/Makefile, and use the full path when calling down
into the arch/$(ARCH)/boot/Makefile.
- Example:
+ Example::
+
#arch/x86/Makefile
boot := arch/x86/boot
bzImage: vmlinux
@@ -983,7 +1095,8 @@ When kbuild executes, the following steps are followed (roughly):
but executing "make help" will list all relevant targets.
To support this, $(archhelp) must be defined.
- Example:
+ Example::
+
#arch/x86/Makefile
define archhelp
echo '* bzImage - Image (arch/$(ARCH)/boot/bzImage)'
@@ -997,25 +1110,30 @@ When kbuild executes, the following steps are followed (roughly):
Add a new prerequisite to all: to select a default goal different
from vmlinux.
- Example:
+ Example::
+
#arch/x86/Makefile
all: bzImage
When "make" is executed without arguments, bzImage will be built.
---- 6.6 Building non-kbuild targets
+6.6 Building non-kbuild targets
+-------------------------------
extra-y
-
extra-y specifies additional targets created in the current
- directory, in addition to any targets specified by obj-*.
+ directory, in addition to any targets specified by `obj-*`.
Listing all targets in extra-y is required for two purposes:
+
1) Enable kbuild to check changes in command lines
+
- When $(call if_changed,xxx) is used
+
2) kbuild knows what files to delete during "make clean"
- Example:
+ Example::
+
#arch/x86/kernel/Makefile
extra-y := head.o init_task.o
@@ -1023,16 +1141,17 @@ When kbuild executes, the following steps are followed (roughly):
shall be built, but shall not be linked as part of built-in.a.
---- 6.7 Commands useful for building a boot image
+6.7 Commands useful for building a boot image
+---------------------------------------------
- Kbuild provides a few macros that are useful when building a
- boot image.
+ Kbuild provides a few macros that are useful when building a
+ boot image.
if_changed
-
if_changed is the infrastructure used for the following commands.
- Usage:
+ Usage::
+
target: source(s) FORCE
$(call if_changed,ld/objcopy/gzip/...)
@@ -1050,12 +1169,16 @@ When kbuild executes, the following steps are followed (roughly):
Note: It is a typical mistake to forget the FORCE prerequisite.
Another common pitfall is that whitespace is sometimes
significant; for instance, the below will fail (note the extra space
- after the comma):
+ after the comma)::
+
target: source(s) FORCE
- #WRONG!# $(call if_changed, ld/objcopy/gzip/...)
- Note: if_changed should not be used more than once per target.
+ **WRONG!** $(call if_changed, ld/objcopy/gzip/...)
+
+ Note:
+ if_changed should not be used more than once per target.
It stores the executed command in a corresponding .cmd
+
file and multiple calls would result in overwrites and
unwanted results when the target is up to date and only the
tests on changed commands trigger execution of commands.
@@ -1063,7 +1186,8 @@ When kbuild executes, the following steps are followed (roughly):
ld
Link target. Often, LDFLAGS_$@ is used to set specific options to ld.
- Example:
+ Example::
+
#arch/x86/boot/Makefile
LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
LDFLAGS_setup := -Ttext 0x0 -s --oformat binary -e begtext
@@ -1077,12 +1201,15 @@ When kbuild executes, the following steps are followed (roughly):
LDFLAGS_$@ syntax - one for each potential target.
$(targets) are assigned all potential targets, by which kbuild knows
the targets and will:
+
1) check for commandline changes
2) delete target during make clean
The ": %: %.o" part of the prerequisite is a shorthand that
frees us from listing the setup.o and bootsect.o files.
- Note: It is a common mistake to forget the "targets :=" assignment,
+
+ Note:
+ It is a common mistake to forget the "targets :=" assignment,
resulting in the target file being recompiled for no
obvious reason.
@@ -1094,7 +1221,8 @@ When kbuild executes, the following steps are followed (roughly):
gzip
Compress target. Use maximum compression to compress target.
- Example:
+ Example::
+
#arch/x86/boot/compressed/Makefile
$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
$(call if_changed,gzip)
@@ -1105,26 +1233,30 @@ When kbuild executes, the following steps are followed (roughly):
in an init section in the image. Platform code *must* copy the
blob to non-init memory prior to calling unflatten_device_tree().
- To use this command, simply add *.dtb into obj-y or targets, or make
- some other target depend on %.dtb
+ To use this command, simply add `*.dtb` into obj-y or targets, or make
+ some other target depend on `%.dtb`
- A central rule exists to create $(obj)/%.dtb from $(src)/%.dts;
+ A central rule exists to create `$(obj)/%.dtb` from `$(src)/%.dts`;
architecture Makefiles do no need to explicitly write out that rule.
- Example:
+ Example::
+
targets += $(dtb-y)
DTC_FLAGS ?= -p 1024
---- 6.8 Custom kbuild commands
+6.8 Custom kbuild commands
+--------------------------
When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand
of a command is normally displayed.
To enable this behaviour for custom commands kbuild requires
- two variables to be set:
- quiet_cmd_<command> - what shall be echoed
- cmd_<command> - the command to execute
+ two variables to be set::
+
+ quiet_cmd_<command> - what shall be echoed
+ cmd_<command> - the command to execute
+
+ Example::
- Example:
#
quiet_cmd_image = BUILD $@
cmd_image = $(obj)/tools/build $(BUILDFLAGS) \
@@ -1135,9 +1267,9 @@ When kbuild executes, the following steps are followed (roughly):
$(call if_changed,image)
@echo 'Kernel: $@ is ready'
- When updating the $(obj)/bzImage target, the line
+ When updating the $(obj)/bzImage target, the line:
- BUILD arch/x86/boot/bzImage
+ BUILD arch/x86/boot/bzImage
will be displayed with "make KBUILD_VERBOSE=0".
@@ -1148,9 +1280,10 @@ When kbuild executes, the following steps are followed (roughly):
arch/$(ARCH)/kernel/vmlinux.lds is used.
The script is a preprocessed variant of the file vmlinux.lds.S
located in the same directory.
- kbuild knows .lds files and includes a rule *lds.S -> *lds.
+ kbuild knows .lds files and includes a rule `*lds.S` -> `*lds`.
+
+ Example::
- Example:
#arch/x86/kernel/Makefile
always := vmlinux.lds
@@ -1162,17 +1295,19 @@ When kbuild executes, the following steps are followed (roughly):
The assignment to $(CPPFLAGS_vmlinux.lds) tells kbuild to use the
specified options when building the target vmlinux.lds.
- When building the *.lds target, kbuild uses the variables:
- KBUILD_CPPFLAGS : Set in top-level Makefile
- cppflags-y : May be set in the kbuild makefile
- CPPFLAGS_$(@F) : Target-specific flags.
- Note that the full filename is used in this
- assignment.
+ When building the `*.lds` target, kbuild uses the variables::
- The kbuild infrastructure for *lds files is used in several
+ KBUILD_CPPFLAGS : Set in top-level Makefile
+ cppflags-y : May be set in the kbuild makefile
+ CPPFLAGS_$(@F) : Target-specific flags.
+ Note that the full filename is used in this
+ assignment.
+
+ The kbuild infrastructure for `*lds` files is used in several
architecture-specific files.
---- 6.10 Generic header files
+6.10 Generic header files
+-------------------------
The directory include/asm-generic contains the header files
that may be shared between individual architectures.
@@ -1180,7 +1315,8 @@ When kbuild executes, the following steps are followed (roughly):
to list the file in the Kbuild file.
See "7.2 generic-y" for further info on syntax etc.
---- 6.11 Post-link pass
+6.11 Post-link pass
+-------------------
If the file arch/xxx/Makefile.postlink exists, this makefile
will be invoked for post-link objects (vmlinux and modules.ko)
@@ -1195,15 +1331,17 @@ When kbuild executes, the following steps are followed (roughly):
For example, powerpc uses this to check relocation sanity of
the linked vmlinux file.
-=== 7 Kbuild syntax for exported headers
+7 Kbuild syntax for exported headers
+------------------------------------
The kernel includes a set of headers that is exported to userspace.
Many headers can be exported as-is but other headers require a
minimal pre-processing before they are ready for user-space.
The pre-processing does:
+
- drop kernel-specific annotations
- drop include of compiler.h
-- drop all sections that are kernel internal (guarded by ifdef __KERNEL__)
+- drop all sections that are kernel internal (guarded by `ifdef __KERNEL__`)
All headers under include/uapi/, include/generated/uapi/,
arch/<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
arch/<arch>/include/asm/ to list asm files coming from asm-generic.
See subsequent chapter for the syntax of the Kbuild file.
---- 7.1 no-export-headers
+7.1 no-export-headers
+---------------------
no-export-headers is essentially used by include/uapi/linux/Kbuild to
avoid exporting specific headers (e.g. kvm.h) on architectures that do
not support it. It should be avoided as much as possible.
---- 7.2 generic-y
+7.2 generic-y
+-------------
If an architecture uses a verbatim copy of a header from
include/asm-generic then this is listed in the file
arch/$(ARCH)/include/asm/Kbuild like this:
- Example:
+ Example::
+
#arch/x86/include/asm/Kbuild
generic-y += termios.h
generic-y += rtc.h
During the prepare phase of the build a wrapper include
- file is generated in the directory:
+ file is generated in the directory::
arch/$(ARCH)/include/generated/asm
When a header is exported where the architecture uses
the generic header a similar wrapper is generated as part
- of the set of exported headers in the directory:
+ of the set of exported headers in the directory::
usr/include/asm
The generated wrapper will in both cases look like the following:
- Example: termios.h
+ Example: termios.h::
+
#include <asm-generic/termios.h>
---- 7.3 generated-y
+7.3 generated-y
+---------------
If an architecture generates other header files alongside generic-y
wrappers, generated-y specifies them.
@@ -1254,11 +1397,13 @@ See subsequent chapter for the syntax of the Kbuild file.
This prevents them being treated as stale asm-generic wrappers and
removed.
- Example:
+ Example::
+
#arch/x86/include/asm/Kbuild
generated-y += syscalls_32.h
---- 7.4 mandatory-y
+7.4 mandatory-y
+---------------
mandatory-y is essentially used by include/(uapi/)asm-generic/Kbuild
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.
The convention is to list one subdir per line and
preferably in alphabetic order.
-=== 8 Kbuild Variables
+8 Kbuild Variables
+==================
The top Makefile exports the following variables:
VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
-
These variables define the current kernel version. A few arch
Makefiles actually use these values directly; they should use
$(KERNELRELEASE) instead.
@@ -1289,32 +1434,28 @@ The top Makefile exports the following variables:
such as "-pre4", and is often blank.
KERNELRELEASE
-
$(KERNELRELEASE) is a single string such as "2.4.0-pre4", suitable
for constructing installation directory names or showing in
version strings. Some arch Makefiles use it for this purpose.
ARCH
-
This variable defines the target architecture, such as "i386",
"arm", or "sparc". Some kbuild Makefiles test $(ARCH) to
determine which files to compile.
By default, the top Makefile sets $(ARCH) to be the same as the
host system architecture. For a cross build, a user may
- override the value of $(ARCH) on the command line:
+ override the value of $(ARCH) on the command line::
make ARCH=m68k ...
INSTALL_PATH
-
This variable defines a place for the arch Makefiles to install
the resident kernel image and System.map file.
Use this for architecture-specific install targets.
INSTALL_MOD_PATH, MODLIB
-
$(INSTALL_MOD_PATH) specifies a prefix to $(MODLIB) for module
installation. This variable is not defined in the Makefile but
may be passed in by the user if desired.
@@ -1325,7 +1466,6 @@ The top Makefile exports the following variables:
override this value on the command line if desired.
INSTALL_MOD_STRIP
-
If this variable is specified, it will cause modules to be stripped
after they are installed. If INSTALL_MOD_STRIP is '1', then the
default option --strip-debug will be used. Otherwise, the
@@ -1333,7 +1473,8 @@ The top Makefile exports the following variables:
command.
-=== 9 Makefile language
+9 Makefile language
+===================
The kernel Makefiles are designed to be run with GNU Make. The Makefiles
use only the documented features of GNU Make, but they do use many
@@ -1352,18 +1493,17 @@ time the left-hand side is used.
There are some cases where "=" is appropriate. Usually, though, ":="
is the right choice.
-=== 10 Credits
+10 Credits
+==========
-Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net>
-Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
-Updates by Sam Ravnborg <sam@ravnborg.org>
-Language QA by Jan Engelhardt <jengelh@gmx.de>
+- Original version made by Michael Elizabeth Chastain, <mailto:mec@shout.net>
+- Updates by Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
+- Updates by Sam Ravnborg <sam@ravnborg.org>
+- Language QA by Jan Engelhardt <jengelh@gmx.de>
-=== 11 TODO
+11 TODO
+=======
- Describe how kbuild supports shipped files with _shipped.
- Generating offset header files.
- Add more variables to section 7?
-
-
-
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.rst
similarity index 84%
rename from Documentation/kbuild/modules.txt
rename to Documentation/kbuild/modules.rst
index 80295c613e37..24e763482650 100644
--- a/Documentation/kbuild/modules.txt
+++ b/Documentation/kbuild/modules.rst
@@ -1,8 +1,10 @@
+=========================
Building External Modules
+=========================
This document describes how to build an out-of-tree kernel module.
-=== Table of Contents
+.. Table of Contents
=== 1 Introduction
=== 2 How to Build External Modules
@@ -31,7 +33,8 @@ This document describes how to build an out-of-tree kernel module.
-=== 1. Introduction
+1. Introduction
+===============
"kbuild" is the build system used by the Linux kernel. Modules must use
kbuild to stay compatible with changes in the build infrastructure and
@@ -48,7 +51,8 @@ easily accomplished, and a complete example will be presented in
section 3.
-=== 2. How to Build External Modules
+2. How to Build External Modules
+================================
To build external modules, you must have a prebuilt kernel available
that contains the configuration and header files used in the build.
@@ -65,25 +69,27 @@ NOTE: "modules_prepare" will not build Module.symvers even if
CONFIG_MODVERSIONS is set; therefore, a full kernel build needs to be
executed to make module versioning work.
---- 2.1 Command Syntax
+2.1 Command Syntax
+==================
- The command to build an external module is:
+ The command to build an external module is::
$ make -C <path_to_kernel_src> M=$PWD
The kbuild system knows that an external module is being built
due to the "M=<dir>" option given in the command.
- To build against the running kernel use:
+ To build against the running kernel use::
$ make -C /lib/modules/`uname -r`/build M=$PWD
Then to install the module(s) just built, add the target
- "modules_install" to the command:
+ "modules_install" to the command::
$ make -C /lib/modules/`uname -r`/build M=$PWD modules_install
---- 2.2 Options
+2.2 Options
+===========
($KDIR refers to the path of the kernel source directory.)
@@ -100,7 +106,8 @@ executed to make module versioning work.
directory where the external module (kbuild file) is
located.
---- 2.3 Targets
+2.3 Targets
+===========
When building an external module, only a subset of the "make"
targets are available.
@@ -130,26 +137,29 @@ executed to make module versioning work.
help
List the available targets for external modules.
---- 2.4 Building Separate Files
+2.4 Building Separate Files
+===========================
It is possible to build single files that are part of a module.
This works equally well for the kernel, a module, and even for
external modules.
- Example (The module foo.ko, consist of bar.o and baz.o):
+ Example (The module foo.ko, consist of bar.o and baz.o)::
+
make -C $KDIR M=$PWD bar.lst
make -C $KDIR M=$PWD baz.o
make -C $KDIR M=$PWD foo.ko
make -C $KDIR M=$PWD ./
-=== 3. Creating a Kbuild File for an External Module
+3. Creating a Kbuild File for an External Module
+================================================
In the last section we saw the command to build a module for the
running kernel. The module is not actually built, however, because a
build file is required. Contained in this file will be the name of
the module(s) being built, along with the list of requisite source
-files. The file may be as simple as a single line:
+files. The file may be as simple as a single line::
obj-m := <module_name>.o
@@ -157,15 +167,15 @@ The kbuild system will build <module_name>.o from <module_name>.c,
and, after linking, will result in the kernel module <module_name>.ko.
The above line can be put in either a "Kbuild" file or a "Makefile."
When the module is built from multiple sources, an additional line is
-needed listing the files:
+needed listing the files::
<module_name>-y := <src1>.o <src2>.o ...
NOTE: Further documentation describing the syntax used by kbuild is
-located in Documentation/kbuild/makefiles.txt.
+located in Documentation/kbuild/makefiles.rst.
The examples below demonstrate how to create a build file for the
-module 8123.ko, which is built from the following files:
+module 8123.ko, which is built from the following files::
8123_if.c
8123_if.h
@@ -181,7 +191,8 @@ module 8123.ko, which is built from the following files:
but should be filtered out from kbuild due to possible name
clashes.
- Example 1:
+ Example 1::
+
--> filename: Makefile
ifneq ($(KERNELRELEASE),)
# kbuild part of makefile
@@ -209,14 +220,16 @@ module 8123.ko, which is built from the following files:
line; the second pass is by the kbuild system, which is
initiated by the parameterized "make" in the default target.
---- 3.2 Separate Kbuild File and Makefile
+3.2 Separate Kbuild File and Makefile
+-------------------------------------
In newer versions of the kernel, kbuild will first look for a
file named "Kbuild," and only if that is not found, will it
then look for a makefile. Utilizing a "Kbuild" file allows us
to split up the makefile from example 1 into two files:
- Example 2:
+ Example 2::
+
--> filename: Kbuild
obj-m := 8123.o
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:
The next example shows a backward compatible version.
- Example 3:
+ Example 3::
+
--> filename: Kbuild
obj-m := 8123.o
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:
makefiles, to be used when the "make" and kbuild parts are
split into separate files.
---- 3.3 Binary Blobs
+3.3 Binary Blobs
+----------------
Some external modules need to include an object file as a blob.
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:
Throughout this section, 8123_bin.o_shipped has been used to
build the kernel module 8123.ko; it has been included as
- 8123_bin.o.
+ 8123_bin.o::
8123-y := 8123_if.o 8123_pci.o 8123_bin.o
@@ -285,11 +300,12 @@ module 8123.ko, which is built from the following files:
files and the binary file, kbuild will pick up different rules
when creating the object file for the module.
---- 3.4 Building Multiple Modules
+3.4 Building Multiple Modules
+=============================
kbuild supports building multiple modules with a single build
file. For example, if you wanted to build two modules, foo.ko
- and bar.ko, the kbuild lines would be:
+ and bar.ko, the kbuild lines would be::
obj-m := foo.o bar.o
foo-y := <foo_srcs>
@@ -298,7 +314,8 @@ module 8123.ko, which is built from the following files:
It is that simple!
-=== 4. Include Files
+4. Include Files
+================
Within the kernel, header files are kept in standard locations
according to the following rule:
@@ -310,22 +327,25 @@ according to the following rule:
of the kernel that are located in different directories, then
the file is placed in include/linux/.
- NOTE: There are two notable exceptions to this rule: larger
- subsystems have their own directory under include/, such as
- include/scsi; and architecture specific headers are located
- under arch/$(ARCH)/include/.
+ NOTE:
+ There are two notable exceptions to this rule: larger
+ subsystems have their own directory under include/, such as
+ include/scsi; and architecture specific headers are located
+ under arch/$(ARCH)/include/.
---- 4.1 Kernel Includes
+4.1 Kernel Includes
+-------------------
To include a header file located under include/linux/, simply
- use:
+ use::
#include <linux/module.h>
kbuild will add options to "gcc" so the relevant directories
are searched.
---- 4.2 Single Subdirectory
+4.2 Single Subdirectory
+-----------------------
External modules tend to place header files in a separate
include/ directory where their source is located, although this
@@ -334,7 +354,7 @@ according to the following rule:
Using the example from section 3, if we moved 8123_if.h to a
subdirectory named include, the resulting kbuild file would
- look like:
+ look like::
--> filename: Kbuild
obj-m := 8123.o
@@ -346,23 +366,24 @@ according to the following rule:
the path. This is a limitation of kbuild: there must be no
space present.
---- 4.3 Several Subdirectories
+4.3 Several Subdirectories
+--------------------------
kbuild can handle files that are spread over several directories.
- Consider the following example:
+ Consider the following example::
- .
- |__ src
- | |__ complex_main.c
- | |__ hal
- | |__ hardwareif.c
- | |__ include
- | |__ hardwareif.h
- |__ include
- |__ complex.h
+ .
+ |__ src
+ | |__ complex_main.c
+ | |__ hal
+ | |__ hardwareif.c
+ | |__ include
+ | |__ hardwareif.h
+ |__ include
+ |__ complex.h
To build the module complex.ko, we then need the following
- kbuild file:
+ kbuild file::
--> filename: Kbuild
obj-m := complex.o
@@ -385,7 +406,8 @@ according to the following rule:
file is located.
-=== 5. Module Installation
+5. Module Installation
+======================
Modules which are included in the kernel are installed in the
directory:
@@ -396,11 +418,12 @@ And external modules are installed in:
/lib/modules/$(KERNELRELEASE)/extra/
---- 5.1 INSTALL_MOD_PATH
+5.1 INSTALL_MOD_PATH
+--------------------
Above are the default directories but as always some level of
customization is possible. A prefix can be added to the
- installation path using the variable INSTALL_MOD_PATH:
+ installation path using the variable INSTALL_MOD_PATH::
$ make INSTALL_MOD_PATH=/frodo modules_install
=> Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel/
@@ -410,20 +433,22 @@ And external modules are installed in:
calling "make." This has effect when installing both in-tree
and out-of-tree modules.
---- 5.2 INSTALL_MOD_DIR
+5.2 INSTALL_MOD_DIR
+-------------------
External modules are by default installed to a directory under
/lib/modules/$(KERNELRELEASE)/extra/, but you may wish to
locate modules for a specific functionality in a separate
directory. For this purpose, use INSTALL_MOD_DIR to specify an
- alternative name to "extra."
+ alternative name to "extra."::
$ make INSTALL_MOD_DIR=gandalf -C $KDIR \
M=$PWD modules_install
=> Install dir: /lib/modules/$(KERNELRELEASE)/gandalf/
-=== 6. Module Versioning
+6. Module Versioning
+====================
Module versioning is enabled by the CONFIG_MODVERSIONS tag, and is used
as a simple ABI consistency check. A CRC value of the full prototype
@@ -435,14 +460,16 @@ module.
Module.symvers contains a list of all exported symbols from a kernel
build.
---- 6.1 Symbols From the Kernel (vmlinux + modules)
+6.1 Symbols From the Kernel (vmlinux + modules)
+-----------------------------------------------
During a kernel build, a file named Module.symvers will be
generated. Module.symvers contains all exported symbols from
the kernel and compiled modules. For each symbol, the
corresponding CRC value is also stored.
- The syntax of the Module.symvers file is:
+ The syntax of the Module.symvers file is::
+
<CRC> <Symbol> <module>
0x2d036834 scsi_remove_host drivers/scsi/scsi_mod
@@ -451,10 +478,12 @@ build.
would read 0x00000000.
Module.symvers serves two purposes:
+
1) It lists all exported symbols from vmlinux and all modules.
2) It lists the CRC if CONFIG_MODVERSIONS is enabled.
---- 6.2 Symbols and External Modules
+6.2 Symbols and External Modules
+--------------------------------
When building an external module, the build system needs access
to the symbols from the kernel to check if all external symbols
@@ -481,17 +510,17 @@ build.
foo.ko needs symbols from bar.ko, you can use a
common top-level kbuild file so both modules are
compiled in the same build. Consider the following
- directory layout:
+ directory layout::
- ./foo/ <= contains foo.ko
- ./bar/ <= contains bar.ko
+ ./foo/ <= contains foo.ko
+ ./bar/ <= contains bar.ko
- The top-level kbuild file would then look like:
+ The top-level kbuild file would then look like::
- #./Kbuild (or ./Makefile):
- obj-y := foo/ bar/
+ #./Kbuild (or ./Makefile):
+ obj-y := foo/ bar/
- And executing
+ And executing::
$ make -C $KDIR M=$PWD
@@ -518,14 +547,16 @@ build.
initialization of its symbol tables.
-=== 7. Tips & Tricks
+7. Tips & Tricks
+================
---- 7.1 Testing for CONFIG_FOO_BAR
+7.1 Testing for CONFIG_FOO_BAR
+------------------------------
- Modules often need to check for certain CONFIG_ options to
+ Modules often need to check for certain `CONFIG_` options to
decide if a specific feature is included in the module. In
- kbuild this is done by referencing the CONFIG_ variable
- directly.
+ kbuild this is done by referencing the `CONFIG_` variable
+ directly::
#fs/ext2/Makefile
obj-$(CONFIG_EXT2_FS) += ext2.o
@@ -534,8 +565,7 @@ build.
ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o
External modules have traditionally used "grep" to check for
- specific CONFIG_ settings directly in .config. This usage is
+ specific `CONFIG_` settings directly in .config. This usage is
broken. As introduced before, external modules should use
kbuild for building and can therefore use the same methods as
- in-tree modules when testing for CONFIG_ definitions.
-
+ in-tree modules when testing for `CONFIG_` definitions.
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:
- Usually you want a configuration option for your kernel hack. Edit
``Kconfig`` in the appropriate directory. The Config language is
simple to use by cut and paste, and there's complete documentation in
- ``Documentation/kbuild/kconfig-language.txt``.
+ ``Documentation/kbuild/kconfig-language.rst``.
In your description of the option, make sure you address both the
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:
- Edit the ``Makefile``: the CONFIG variables are exported here so you
can usually just add a "obj-$(CONFIG_xxx) += xxx.o" line. The syntax
- is documented in ``Documentation/kbuild/makefiles.txt``.
+ is documented in ``Documentation/kbuild/makefiles.rst``.
- Put yourself in ``CREDITS`` if you've done something noteworthy,
usually beyond a single file (your name should be at the top of the
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::
...
For full documentation on the configuration files, see the file
-Documentation/kbuild/kconfig-language.txt.
+Documentation/kbuild/kconfig-language.rst.
11) Data structures
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.
6) Any new or modified ``CONFIG`` options do not muck up the config menu and
default to off unless they meet the exception criteria documented in
- ``Documentation/kbuild/kconfig-language.txt`` Menu attributes: default value.
+ ``Documentation/kbuild/kconfig-language.rst`` Menu attributes: default value.
7) All new ``Kconfig`` options have help text.
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:
- Solitamente vorrete un'opzione di configurazione per la vostra modifica
al kernel. Modificate ``Kconfig`` nella cartella giusta. Il linguaggio
Config è facile con copia ed incolla, e c'è una completa documentazione
- nel file ``Documentation/kbuild/kconfig-language.txt``.
+ nel file ``Documentation/kbuild/kconfig-language.rst``.
Nella descrizione della vostra opzione, assicuratevi di parlare sia agli
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:
- Modificate il file ``Makefile``: le variabili CONFIG sono esportate qui,
quindi potete solitamente aggiungere una riga come la seguete
"obj-$(CONFIG_xxx) += xxx.o". La sintassi è documentata nel file
- ``Documentation/kbuild/makefiles.txt``.
+ ``Documentation/kbuild/makefiles.rst``.
- Aggiungete voi stessi in ``CREDITS`` se avete fatto qualcosa di notevole,
solitamente qualcosa che supera il singolo file (comunque il vostro nome
diff --git a/Documentation/translations/it_IT/process/coding-style.rst b/Documentation/translations/it_IT/process/coding-style.rst
index a6559d25a23d..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::
...
Per la documentazione completa sui file di configurazione, consultate
-il documento Documentation/kbuild/kconfig-language.txt
+il documento Documentation/kbuild/kconfig-language.rst
11) Strutture dati
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
6) Le opzioni ``CONFIG``, nuove o modificate, non scombussolano il menu
di configurazione e sono preimpostate come disabilitate a meno che non
- soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.txt``
+ soddisfino i criteri descritti in ``Documentation/kbuild/kconfig-language.rst``
alla punto "Voci di menu: valori predefiniti".
7) Tutte le nuove opzioni ``Kconfig`` hanno un messaggio di aiuto.
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 以获得详细信息。
depends on ADFS_FS
...
-要查看配置文件的完整文档,请看 Documentation/kbuild/kconfig-language.txt。
+要查看配置文件的完整文档,请看 Documentation/kbuild/kconfig-language.rst。
11) 数据结构
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内核补丁提交清单
违规行为。
6) 任何新的或修改过的 ``CONFIG`` 选项都不会弄脏配置菜单,并默认为关闭,除非
- 它们符合 ``Documentation/kbuild/kconfig-language.txt`` 中记录的异常条件,
+ 它们符合 ``Documentation/kbuild/kconfig-language.rst`` 中记录的异常条件,
菜单属性:默认值.
7) 所有新的 ``kconfig`` 选项都有帮助文本。
diff --git a/Kconfig b/Kconfig
index 990b0c390dfc..e10b3ee084d4 100644
--- a/Kconfig
+++ b/Kconfig
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
#
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
mainmenu "Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration"
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 @@
# SPDX-License-Identifier: GPL-2.0
#
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
menuconfig ARC_PLAT_EZNPS
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 @@
# SPDX-License-Identifier: GPL-2.0
#
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
config C6X
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 @@
# SPDX-License-Identifier: GPL-2.0-only
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
config TRACE_IRQFLAGS_SUPPORT
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 @@
# SPDX-License-Identifier: GPL-2.0-only
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
# Platform selection Kconfig menu for MicroBlaze targets
#
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 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
config 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 @@
# SPDX-License-Identifier: GPL-2.0
#
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
config OPENRISC
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 @@
# SPDX-License-Identifier: GPL-2.0
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
config 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 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
config 64BIT
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 @@
# SPDX-License-Identifier: GPL-2.0
#
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
# Auxiliary display drivers configuration.
#
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 9026df923542..35078c6f334a 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
menu "Firmware Drivers"
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
If you want to compile this driver as a module ( = code which can be
inserted in and removed from the running kernel whenever you want),
- say M here and read <file:Documentation/kbuild/modules.txt>.
+ say M here and read <file:Documentation/kbuild/modules.rst>.
The module will be called ms02-nv.
config MTD_DATAFLASH
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
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called smc91x. If you want to compile it as a
- module, say M here and read <file:Documentation/kbuild/modules.txt>.
+ module, say M here and read <file:Documentation/kbuild/modules.rst>.
config PCMCIA_SMC91C92
tristate "SMC 91Cxx PCMCIA support"
@@ -86,7 +86,7 @@ config SMC911X
This driver is also available as a module. The module will be
called smc911x. If you want to compile it as a module, say M
- here and read <file:Documentation/kbuild/modules.txt>
+ here and read <file:Documentation/kbuild/modules.rst>
config SMSC911X
tristate "SMSC LAN911x/LAN921x families embedded ethernet support"
@@ -121,6 +121,6 @@ config SMSC9420
This driver is also available as a module. The module will be
called smsc9420. If you want to compile it as a module, say M
- here and read <file:Documentation/kbuild/modules.txt>
+ here and read <file:Documentation/kbuild/modules.rst>
endif # 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
If you want to compile the driver as a module ( = code which can be
inserted in and removed from the running kernel whenever you want),
- say M here and read <file:Documentation/kbuild/modules.txt>. The
+ say M here and read <file:Documentation/kbuild/modules.rst>. The
module will be called iwl4965.
config IWL3945
@@ -58,7 +58,7 @@ config IWL3945
If you want to compile the driver as a module ( = code which can be
inserted in and removed from the running kernel whenever you want),
- say M here and read <file:Documentation/kbuild/modules.txt>. The
+ say M here and read <file:Documentation/kbuild/modules.rst>. The
module will be called iwl3945.
menu "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
If you want to compile the driver as a module ( = code which can be
inserted in and removed from the running kernel whenever you want),
- say M here and read <file:Documentation/kbuild/modules.txt>. The
+ say M here and read <file:Documentation/kbuild/modules.rst>. The
module will be called iwlwifi.
if 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 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
+# see Documentation/kbuild/kconfig-language.rst.
#
# Parport configuration.
#
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 73bce9b6d037..75f66f8ad3ea 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -161,7 +161,7 @@ config CHR_DEV_SCH
If you want to compile this as a module ( = code which can be
inserted in and removed from the running kernel whenever you want),
- say M here and read <file:Documentation/kbuild/modules.txt> and
+ say M here and read <file:Documentation/kbuild/modules.rst> and
<file:Documentation/scsi/scsi.txt>. The module will be called ch.o.
If unsure, say N.
@@ -1487,7 +1487,7 @@ config ZFCP
This driver is also available as a module. This module will be
called zfcp. If you want to compile it as a module, say M here
- and read <file:Documentation/kbuild/modules.txt>.
+ and read <file:Documentation/kbuild/modules.rst>.
config SCSI_PMCRAID
tristate "PMC SIERRA Linux MaxRAID adapter support"
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
This driver is also available as a module. The module will be
called sm750fb. If you want to compile it as a module, say M
- here and read <file:Documentation/kbuild/modules.txt>.
+ here and read <file:Documentation/kbuild/modules.rst>.
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
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called audio. If you want to compile it as a
- module, say M here and read <file:Documentation/kbuild/modules.txt>.
+ module, say M here and read <file:Documentation/kbuild/modules.rst>.
config USB_EMI26
tristate "EMI 2|6 USB Audio interface support"
@@ -67,7 +67,7 @@ config USB_LEGOTOWER
inserted in and removed from the running kernel whenever you want).
The module will be called legousbtower. If you want to compile it as
a module, say M here and read
- <file:Documentation/kbuild/modules.txt>.
+ <file:Documentation/kbuild/modules.rst>.
config USB_LCD
tristate "USB LCD driver support"
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 2315a5b72d71..702d6d53fb55 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -289,7 +289,7 @@ config FB_ARMCLCD
If you want to compile this as a module (=code which can be
inserted into and removed from the running kernel), say M
- here and read <file:Documentation/kbuild/modules.txt>. The module
+ here and read <file:Documentation/kbuild/modules.rst>. The module
will be called amba-clcd.
config FB_ACORN
@@ -1757,7 +1757,7 @@ config FB_PXA
This driver is also available as a module ( = code which can be
inserted and removed from the running kernel whenever you want). The
module will be called pxafb. If you want to compile it as a module,
- say M here and read <file:Documentation/kbuild/modules.txt>.
+ say M here and read <file:Documentation/kbuild/modules.rst>.
If unsure, say N.
@@ -1838,7 +1838,7 @@ config FB_W100
This driver is also available as a module ( = code which can be
inserted and removed from the running kernel whenever you want). The
module will be called w100fb. If you want to compile it as a module,
- say M here and read <file:Documentation/kbuild/modules.txt>.
+ say M here and read <file:Documentation/kbuild/modules.rst>.
If unsure, say N.
@@ -1867,7 +1867,7 @@ config FB_TMIO
This driver is also available as a module ( = code which can be
inserted and removed from the running kernel whenever you want). The
module will be called tmiofb. If you want to compile it as a module,
- say M here and read <file:Documentation/kbuild/modules.txt>.
+ say M here and read <file:Documentation/kbuild/modules.rst>.
If unsure, say N.
@@ -1913,7 +1913,7 @@ config FB_S3C2410
This driver is also available as a module ( = code which can be
inserted and removed from the running kernel whenever you want). The
module will be called s3c2410fb. If you want to compile it as a module,
- say M here and read <file:Documentation/kbuild/modules.txt>.
+ say M here and read <file:Documentation/kbuild/modules.rst>.
If unsure, say N.
config FB_S3C2410_DEBUG
@@ -1950,7 +1950,7 @@ config FB_SM501
This driver is also available as a module ( = code which can be
inserted and removed from the running kernel whenever you want). The
module will be called sm501fb. If you want to compile it as a module,
- say M here and read <file:Documentation/kbuild/modules.txt>.
+ say M here and read <file:Documentation/kbuild/modules.rst>.
If unsure, say N.
@@ -2283,7 +2283,7 @@ config FB_SM712
This driver is also available as a module. The module will be
called sm712fb. If you want to compile it as a module, say M
- here and read <file:Documentation/kbuild/modules.txt>.
+ here and read <file:Documentation/kbuild/modules.rst>.
source "drivers/video/fbdev/omap/Kconfig"
source "drivers/video/fbdev/omap2/Kconfig"
diff --git a/net/bridge/netfilter/Kconfig b/net/bridge/netfilter/Kconfig
index f4fb0b9b927d..d978f6d820f3 100644
--- a/net/bridge/netfilter/Kconfig
+++ b/net/bridge/netfilter/Kconfig
@@ -128,7 +128,7 @@ config BRIDGE_EBT_LIMIT
equivalent of the iptables limit match.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
config BRIDGE_EBT_MARK
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
and OUTPUT chains.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
# security table for MAC policy
config 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
and OUTPUT chains.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
# security table for MAC policy
config IP6_NF_SECURITY
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 21025c2c605b..dd2af7be3eea 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -1056,7 +1056,7 @@ config NETFILTER_XT_TARGET_TRACE
the tables, chains, rules.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
config NETFILTER_XT_TARGET_SECMARK
tristate '"SECMARK" target support'
@@ -1115,7 +1115,7 @@ config NETFILTER_XT_MATCH_ADDRTYPE
eg. UNICAST, LOCAL, BROADCAST, ...
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
config NETFILTER_XT_MATCH_BPF
tristate '"bpf" match support'
@@ -1160,7 +1160,7 @@ config NETFILTER_XT_MATCH_COMMENT
comments in your iptables ruleset.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
config NETFILTER_XT_MATCH_CONNBYTES
tristate '"connbytes" per-connection counter match support'
@@ -1171,7 +1171,7 @@ config NETFILTER_XT_MATCH_CONNBYTES
number of bytes and/or packets for each direction within a connection.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
config NETFILTER_XT_MATCH_CONNLABEL
tristate '"connlabel" match support'
@@ -1237,7 +1237,7 @@ config NETFILTER_XT_MATCH_DCCP
and DCCP flags.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
config NETFILTER_XT_MATCH_DEVGROUP
tristate '"devgroup" match support'
@@ -1473,7 +1473,7 @@ config NETFILTER_XT_MATCH_QUOTA
byte counter.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
config NETFILTER_XT_MATCH_RATEEST
tristate '"rateest" match support'
@@ -1497,7 +1497,7 @@ config NETFILTER_XT_MATCH_REALM
in tc world.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
config NETFILTER_XT_MATCH_RECENT
tristate '"recent" match support'
@@ -1519,7 +1519,7 @@ config NETFILTER_XT_MATCH_SCTP
and SCTP chunk types.
If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>. If unsure, say `N'.
+ <file:Documentation/kbuild/modules.rst>. If unsure, say `N'.
config NETFILTER_XT_MATCH_SOCKET
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
This protocol support is also available as a module ( = code which
can be inserted in and removed from the running kernel whenever you
want). The module will be called tipc. If you want to compile it
- as a module, say M here and read <file:Documentation/kbuild/modules.txt>.
+ as a module, say M here and read <file:Documentation/kbuild/modules.rst>.
If in doubt, say N.
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
######
# gcc support functions
-# See documentation in Documentation/kbuild/makefiles.txt
+# See documentation in Documentation/kbuild/makefiles.rst
# cc-cross-prefix
# 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)))
# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies
# including used config symbols
# if_changed_rule - as if_changed but execute rule instead
-# See Documentation/kbuild/makefiles.txt for more info
+# See Documentation/kbuild/makefiles.rst for more info
ifneq ($(KBUILD_NOCMDDEP),1)
# 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 @@
#
# Both C and C++ are supported, but preferred language is C for such utilities.
#
-# Sample syntax (see Documentation/kbuild/makefiles.txt for reference)
+# Sample syntax (see Documentation/kbuild/makefiles.rst for reference)
# hostprogs-y := bin2hex
# Will compile bin2hex.c and create an executable named bin2hex
#
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)
}
fprintf(stderr,
- "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n"
+ "For a resolution refer to Documentation/kbuild/kconfig-language.rst\n"
"subsection \"Kconfig recursive dependency limitations\"\n"
"\n");
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 @@
Kconfig:11:error: recursive dependency detected!
Kconfig:11: symbol B is selected by B
-For a resolution refer to Documentation/kbuild/kconfig-language.txt
+For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"
Kconfig:5:error: recursive dependency detected!
Kconfig:5: symbol A depends on A
-For a resolution refer to Documentation/kbuild/kconfig-language.txt
+For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"
Kconfig:17:error: recursive dependency detected!
Kconfig:17: symbol C1 depends on C2
Kconfig:21: symbol C2 depends on C1
-For a resolution refer to Documentation/kbuild/kconfig-language.txt
+For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"
Kconfig:32:error: recursive dependency detected!
Kconfig:32: symbol D2 is selected by D1
Kconfig:27: symbol D1 depends on D2
-For a resolution refer to Documentation/kbuild/kconfig-language.txt
+For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"
Kconfig:37:error: recursive dependency detected!
Kconfig:37: symbol E1 depends on E2
Kconfig:42: symbol E2 is implied by E1
-For a resolution refer to Documentation/kbuild/kconfig-language.txt
+For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"
Kconfig:60:error: recursive dependency detected!
Kconfig:60: symbol G depends on G
-For a resolution refer to Documentation/kbuild/kconfig-language.txt
+For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"
Kconfig:51:error: recursive dependency detected!
Kconfig:51: symbol F2 depends on F1
Kconfig:49: symbol F1 default value contains F2
-For a resolution refer to Documentation/kbuild/kconfig-language.txt
+For a resolution refer to Documentation/kbuild/kconfig-language.rst
subsection "Kconfig recursive dependency limitations"
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
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you
want). If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>.
+ <file:Documentation/kbuild/modules.rst>.
config DMASOUND_PAULA
tristate "Amiga DMA sound support"
@@ -25,7 +25,7 @@ config DMASOUND_PAULA
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you
want). If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>.
+ <file:Documentation/kbuild/modules.rst>.
config DMASOUND_Q40
tristate "Q40 sound support"
@@ -39,7 +39,7 @@ config DMASOUND_Q40
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you
want). If you want to compile it as a module, say M here and read
- <file:Documentation/kbuild/modules.txt>.
+ <file:Documentation/kbuild/modules.rst>.
config DMASOUND
tristate
--
2.21.0
^ permalink raw reply related
* Re: [PATCH v3 1/3] powerpc/powernv: Add OPAL API interface to get secureboot state
From: Nayna @ 2019-06-12 21:08 UTC (permalink / raw)
To: Daniel Axtens, Nayna Jain, linuxppc-dev, linux-efi,
linux-integrity, linux-kernel
Cc: Ard Biesheuvel, Eric Richter, Claudio Carvalho, Mimi Zohar,
Matthew Garret, Paul Mackerras, Jeremy Kerr
In-Reply-To: <87ftofpbth.fsf@dja-thinkpad.axtens.net>
[-- Attachment #1: Type: text/plain, Size: 3869 bytes --]
On 06/12/2019 02:17 AM, Daniel Axtens wrote:
> Nayna Jain <nayna@linux.ibm.com> writes:
>
>> From: Claudio Carvalho <cclaudio@linux.ibm.com>
>>
>> The X.509 certificates trusted by the platform and other information
>> required to secure boot the OS kernel are wrapped in secure variables,
>> which are controlled by OPAL.
>>
>> This patch adds support to read OPAL secure variables through
>> OPAL_SECVAR_GET call. It returns the metadata and data for a given secure
>> variable based on the unique key.
>>
>> Since OPAL can support different types of backend which can vary in the
>> variable interpretation, a new OPAL API call named OPAL_SECVAR_BACKEND, is
>> added to retrieve the supported backend version. This helps the consumer
>> to know how to interpret the variable.
>>
> (Firstly, apologies that I haven't got around to asking about this yet!)
>
> Are pluggable/versioned backend a good idea?
>
> There are a few things that worry me about the idea:
>
> - It adds complexity in crypto (or crypto-adjacent) code, and that
> increases the likelihood that we'll accidentally add a bug with bad
> consequences.
Sorry, I think I am not clear on what exactly you mean here.Can you
please elaborate or give specifics ?
>
> - Under what circumstances would would we change the kernel-visible
> behaviour of skiboot? Are we expecting to change the behaviour,
> content or names of the variables in future? Otherwise the only
> relevant change I can think of is a change to hardware platforms, and
> I'm not sure how a change in hardware would lead to change in
> behaviour in the kernel. Wouldn't Skiboot hide h/w differences?
Backends are intended to be an agreement for firmware, kernel and
userspace on what the format of variables are, what variables should be
expected, how they should be signed, etc. Though we don't expect it to
happen very often, we want to anticipate possible changes in the
firmware which may affect the kernel such as new features, support of
new authentication mechanisms, addition of new variables. Corresponding
skiboot patches are on -
https://lists.ozlabs.org/pipermail/skiboot/2019-June/014641.html
>
> - If we are worried about a long-term-future change to how secure-boot
> works, would it be better to just add more get/set calls to opal at
> the point at which we actually implement the new system?
The intention is to avoid to re-implement the key/value interface for
each scheme. Do you mean to deprecate the old APIs and add new APIs with
every scheme ?
>
> - UEFI added EFI_VARIABLE_AUTHENTICATION_3 in a way that - as far
> as I know - didn't break backwards compatibility. Is there a reason
> we cannot add features that way instead? (It also dropped v1 of the
> authentication header.)
>
> - What is the correct fallback behaviour if a kernel receives a result
> that it does not expect? If a kernel expecting BackendV1 is instead
> informed that it is running on BackendV2, then the cannot access the
> secure variable at all, so it cannot load keys that are potentially
> required to successfully boot (e.g. to validate the module for
> network card or graphics!)
The backend is declaredby the firmware, and is set at compile-time. The
kernel queriesfirmware on whichbackend is in use, and the backend will
not change at runtime.If the backend in use by the firmware is not
supported by the kernel (e.g. kernel is too old), the kernel does not
attempt to read any secure variables, as it won't understand what the
format is. This is a secure boot failure condition, as we cannot verify
the next kernel. With addition of new backends in the skiboot, the
support will be added to the kernel. Note: skiboot and skiroot should
always be in sync with backend support.
Thanks & Regards,
- Nayna
[-- Attachment #2: Type: text/html, Size: 10781 bytes --]
^ permalink raw reply
* Re: [PATCH v3 1/3] powerpc/powernv: Add OPAL API interface to get secureboot state
From: Daniel Axtens @ 2019-06-12 23:04 UTC (permalink / raw)
To: Nayna, Nayna Jain, linuxppc-dev, linux-efi, linux-integrity,
linux-kernel
Cc: Ard Biesheuvel, Eric Richter, Claudio Carvalho, Mimi Zohar,
Matthew Garret, Paul Mackerras, Jeremy Kerr
In-Reply-To: <eaa37bd0-a77d-d70a-feb5-c0e73ce231bf@linux.vnet.ibm.com>
Hi Nayna,
>>> Since OPAL can support different types of backend which can vary in the
>>> variable interpretation, a new OPAL API call named OPAL_SECVAR_BACKEND, is
>>> added to retrieve the supported backend version. This helps the consumer
>>> to know how to interpret the variable.
>>>
>> (Firstly, apologies that I haven't got around to asking about this yet!)
>>
>> Are pluggable/versioned backend a good idea?
>>
>> There are a few things that worry me about the idea:
>>
>> - It adds complexity in crypto (or crypto-adjacent) code, and that
>> increases the likelihood that we'll accidentally add a bug with bad
>> consequences.
>
> Sorry, I think I am not clear on what exactly you mean here.Can you
> please elaborate or give specifics ?
Cryptosystems with greater flexibility can have new kinds of
vulnerabilities arise from the greater complexity. The first sort of
thing that comes to mind is a downgrade attack like from TLS. I think
you're protected from this because the mode cannot be negotiatied at run
time, but in general it's security sensitive code so I'd like it to be
as simple as possible.
>> - If we are worried about a long-term-future change to how secure-boot
>> works, would it be better to just add more get/set calls to opal at
>> the point at which we actually implement the new system?
>
> The intention is to avoid to re-implement the key/value interface for
> each scheme. Do you mean to deprecate the old APIs and add new APIs with
> every scheme ?
Yes, because I expect the scheme would change very, very rarely.
>> - Under what circumstances would would we change the kernel-visible
>> behaviour of skiboot? Are we expecting to change the behaviour,
>> content or names of the variables in future? Otherwise the only
>> relevant change I can think of is a change to hardware platforms, and
>> I'm not sure how a change in hardware would lead to change in
>> behaviour in the kernel. Wouldn't Skiboot hide h/w differences?
>
> Backends are intended to be an agreement for firmware, kernel and
> userspace on what the format of variables are, what variables should be
> expected, how they should be signed, etc. Though we don't expect it to
> happen very often, we want to anticipate possible changes in the
> firmware which may affect the kernel such as new features, support of
> new authentication mechanisms, addition of new variables. Corresponding
> skiboot patches are on -
> https://lists.ozlabs.org/pipermail/skiboot/2019-June/014641.html
I still feel like this is holding onto ongoing complexity for very
little gain, but perhaps this is because I can't picture a specific
change that would actually require a wholesale change to the scheme.
You mention new features, support for new authentication mechanisms, and
addition of new variables.
- New features is a bit too generic to answer specifically. In general
I accept that there exists some new feature that would be
sufficiently backwards-incompatible as to require a new version. I
just can't think of one off the top of my head and so I'm not
convinced it's worth the complexity. Did you have something in mind?
- By support for new authentication mechanisms, I assume you mean new
mechanisms for authenticating variable updates? This is communicated
in edk2 via the attributes field. Looking at patch 5 from the skiboot
series:
+ * When the attribute EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS is set,
+ * then the Data buffer shall begin with an instance of a complete (and
+ * serialized) EFI_VARIABLE_AUTHENTICATION_2 descriptor.
Could a new authentication scheme be communicated by setting a
different attribute value? Or are we not carrying attributes in the
metadata blob?
- For addition of new variables, I'm confused as to why this would
require a new API - wouldn't it just be exposed in the normal way via
opal_secvar_get(_next)?
I guess I also somewhat object to calling it a 'backend' if we're using
it as a version scheme. I think the skiboot storage backends are true
backends - they provide different implementations of the same
functionality with the same API, but this seems like you're using it to
indicate different functionality. It seems like we're using it as if it
were called OPAL_SECVAR_VERSION.
>> - What is the correct fallback behaviour if a kernel receives a result
>> that it does not expect? If a kernel expecting BackendV1 is instead
>> informed that it is running on BackendV2, then the cannot access the
>> secure variable at all, so it cannot load keys that are potentially
>> required to successfully boot (e.g. to validate the module for
>> network card or graphics!)
>
> The backend is declaredby the firmware, and is set at compile-time. The
> kernel queriesfirmware on whichbackend is in use, and the backend will
> not change at runtime.If the backend in use by the firmware is not
> supported by the kernel (e.g. kernel is too old), the kernel does not
> attempt to read any secure variables, as it won't understand what the
> format is. This is a secure boot failure condition, as we cannot verify
> the next kernel. With addition of new backends in the skiboot, the
> support will be added to the kernel. Note: skiboot and skiroot should
> always be in sync with backend support.
Seems reasonable. I'm thinking specifically about the kernel loaded
after skiroot; and yes, on reflection just failing to boot is the only
sensible thing you can do.
Regards,
Daniel
^ permalink raw reply
* Re: [PATCH] KVM: PPC: Book3S HV: Fix r3 corruption in h_set_dabr()
From: Michael Neuling @ 2019-06-13 0:16 UTC (permalink / raw)
To: Cédric Le Goater, mpe; +Cc: linuxppc-dev, kvm-ppc, Suraj Jitindar Singh
In-Reply-To: <c648ec86-8af6-c61f-b430-8e4f7f19225d@kaod.org>
On Wed, 2019-06-12 at 09:43 +0200, Cédric Le Goater wrote:
> On 12/06/2019 09:22, Michael Neuling wrote:
> > In commit c1fe190c0672 ("powerpc: Add force enable of DAWR on P9
> > option") I screwed up some assembler and corrupted a pointer in
> > r3. This resulted in crashes like the below from Cédric:
> >
> > [ 44.374746] BUG: Kernel NULL pointer dereference at 0x000013bf
> > [ 44.374848] Faulting instruction address: 0xc00000000010b044
> > [ 44.374906] Oops: Kernel access of bad area, sig: 11 [#1]
> > [ 44.374951] LE PAGE_SIZE=64K MMU=Radix MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
> > [ 44.375018] Modules linked in: vhost_net vhost tap xt_CHECKSUM iptable_mangle xt_MASQUERADE iptable_nat nf_nat xt_conntrack nf_conntrack nf_defrag_ipv6 libcrc32c nf_defrag_ipv4 ipt_REJECT nf_reject_ipv4 xt_tcpudp bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter bpfilter vmx_crypto crct10dif_vpmsum crc32c_vpmsum kvm_hv kvm sch_fq_codel ip_tables x_tables autofs4 virtio_net net_failover virtio_scsi failover
> > [ 44.375401] CPU: 8 PID: 1771 Comm: qemu-system-ppc Kdump: loaded Not tainted 5.2.0-rc4+ #3
> > [ 44.375500] NIP: c00000000010b044 LR: c0080000089dacf4 CTR: c00000000010aff4
> > [ 44.375604] REGS: c00000179b397710 TRAP: 0300 Not tainted (5.2.0-rc4+)
> > [ 44.375691] MSR: 800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 42244842 XER: 00000000
> > [ 44.375815] CFAR: c00000000010aff8 DAR: 00000000000013bf DSISR: 42000000 IRQMASK: 0
> > [ 44.375815] GPR00: c0080000089dd6bc c00000179b3979a0 c008000008a04300 ffffffffffffffff
> > [ 44.375815] GPR04: 0000000000000000 0000000000000003 000000002444b05d c0000017f11c45d0
> > [ 44.375815] GPR08: 078000003e018dfe 0000000000000028 0000000000000001 0000000000000075
> > [ 44.375815] GPR12: c00000000010aff4 c000000007ff6300 0000000000000000 0000000000000000
> > [ 44.375815] GPR16: 0000000000000000 c0000017f11d0000 00000000ffffffff c0000017f11ca7a8
> > [ 44.375815] GPR20: c0000017f11c42ec ffffffffffffffff 0000000000000000 000000000000000a
> > [ 44.375815] GPR24: fffffffffffffffc 0000000000000000 c0000017f11c0000 c000000001a77ed8
> > [ 44.375815] GPR28: c00000179af70000 fffffffffffffffc c0080000089ff170 c00000179ae88540
> > [ 44.376673] NIP [c00000000010b044] kvmppc_h_set_dabr+0x50/0x68
> > [ 44.376754] LR [c0080000089dacf4] kvmppc_pseries_do_hcall+0xa3c/0xeb0 [kvm_hv]
> > [ 44.376849] Call Trace:
> > [ 44.376886] [c00000179b3979a0] [c0000017f11c0000] 0xc0000017f11c0000 (unreliable)
> > [ 44.376982] [c00000179b397a10] [c0080000089dd6bc] kvmppc_vcpu_run_hv+0x694/0xec0 [kvm_hv]
> > [ 44.377084] [c00000179b397ae0] [c0080000093f8bcc] kvmppc_vcpu_run+0x34/0x48 [kvm]
> > [ 44.377185] [c00000179b397b00] [c0080000093f522c] kvm_arch_vcpu_ioctl_run+0x2f4/0x400 [kvm]
> > [ 44.377286] [c00000179b397b90] [c0080000093e3618] kvm_vcpu_ioctl+0x460/0x850 [kvm]
> > [ 44.377384] [c00000179b397d00] [c0000000004ba6c4] do_vfs_ioctl+0xe4/0xb40
> > [ 44.377464] [c00000179b397db0] [c0000000004bb1e4] ksys_ioctl+0xc4/0x110
> > [ 44.377547] [c00000179b397e00] [c0000000004bb258] sys_ioctl+0x28/0x80
> > [ 44.377628] [c00000179b397e20] [c00000000000b888] system_call+0x5c/0x70
> > [ 44.377712] Instruction dump:
> > [ 44.377765] 4082fff4 4c00012c 38600000 4e800020 e96280c0 896b0000 2c2b0000 3860ffff
> > [ 44.377862] 4d820020 50852e74 508516f6 78840724 <f88313c0> f8a313c8 7c942ba6 7cbc2ba6
> >
> > This fixes the problem by only changing r3 when we are returning
> > immediately.
> >
> > Signed-off-by: Michael Neuling <mikey@neuling.org>
> > Reported-by: Cédric Le Goater <clg@kaod.org>
>
> On nested, I still see :
>
> [ 94.609274] Oops: Exception in kernel mode, sig: 4 [#1]
> [ 94.609432] LE PAGE_SIZE=64K MMU=Radix MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
> [ 94.609596] Modules linked in: vhost_net vhost tap xt_CHECKSUM iptable_mangle xt_MASQUERADE iptable_nat nf_nat xt_conntrack nf_conntrack nf_defrag_ipv6 libcrc32c nf_defrag_ipv4 ipt_REJECT nf_reject_ipv4 xt_tcpudp bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter bpfilter vmx_crypto kvm_hv crct10dif_vpmsum crc32c_vpmsum kvm sch_fq_codel ip_tables x_tables autofs4 virtio_net virtio_scsi net_failover failover
> [ 94.610179] CPU: 12 PID: 2026 Comm: qemu-system-ppc Kdump: loaded Not tainted 5.2.0-rc4+ #6
> [ 94.610290] NIP: c00000000010b050 LR: c008000008bbacf4 CTR: c00000000010aff4
> [ 94.610400] REGS: c0000017913d7710 TRAP: 0700 Not tainted (5.2.0-rc4+)
> [ 94.610493] MSR: 800000000284b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 42224842 XER: 00000000
> [ 94.610671] CFAR: c00000000010b030 IRQMASK: 0
> [ 94.610671] GPR00: c008000008bbd6bc c0000017913d79a0 c008000008be4300 c000001791376220
> [ 94.610671] GPR04: 0000000000000000 0000000000000003 00000000f679892e c0000017911045d0
> [ 94.610671] GPR08: 078000003e018dfe 0000000000000028 0000000000000001 0000000000000075
> [ 94.610671] GPR12: c00000000010aff4 c000000007ff1300 0000000000000000 0000000000000000
> [ 94.610671] GPR16: 0000000000000000 c000001791110000 00000000ffffffff c00000179110a7a8
> [ 94.610671] GPR20: c0000017911042ec ffffffffffffffff 0000000000000000 000000000000000a
> [ 94.610671] GPR24: fffffffffffffffc 0000000000000000 c000001791100000 c000000001a77ed8
> [ 94.610671] GPR28: c0000017925d0000 fffffffffffffffc c008000008bdf170 c000001791376220
> [ 94.611818] NIP [c00000000010b050] kvmppc_h_set_dabr+0x5c/0x6c
> [ 94.611932] LR [c008000008bbacf4] kvmppc_pseries_do_hcall+0xa3c/0xeb0 [kvm_hv]
> [ 94.612064] Call Trace:
> [ 94.612115] [c0000017913d79a0] [c000001791100000] 0xc000001791100000 (unreliable)
> [ 94.612252] [c0000017913d7a10] [c008000008bbd6bc] kvmppc_vcpu_run_hv+0x694/0xec0 [kvm_hv]
> [ 94.612394] [c0000017913d7ae0] [c0080000091e8bcc] kvmppc_vcpu_run+0x34/0x48 [kvm]
> [ 94.612536] [c0000017913d7b00] [c0080000091e522c] kvm_arch_vcpu_ioctl_run+0x2f4/0x400 [kvm]
> [ 94.612674] [c0000017913d7b90] [c0080000091d3618] kvm_vcpu_ioctl+0x460/0x850 [kvm]
> [ 94.612821] [c0000017913d7d00] [c0000000004ba6d4] do_vfs_ioctl+0xe4/0xb40
> [ 94.612935] [c0000017913d7db0] [c0000000004bb1f4] ksys_ioctl+0xc4/0x110
> [ 94.613051] [c0000017913d7e00] [c0000000004bb268] sys_ioctl+0x28/0x80
> [ 94.613160] [c0000017913d7e20] [c00000000000b888] system_call+0x5c/0x70
> [ 94.613267] Instruction dump:
> [ 94.613335] 4e800020 e96280c0 896b0000 2c2b0000 4082000c 3860ffff 4e800020 50852e74
> [ 94.613470] 508516f6 78840724 f88313c0 f8a313c8 <7c942ba6> 7cbc2ba6 38600000 4e800020
>
>
> Here is the asm dump:
>
>
> 3:
> /* Emulate H_SET_DABR/X on P8 for the sake of compat mode guests */
> rlwimi r5, r4, 5, DAWRX_DR | DAWRX_DW
> c00000000010b03c: 74 2e 85 50 rlwimi r5,r4,5,25,26
> rlwimi r5, r4, 2, DAWRX_WT
> c00000000010b040: f6 16 85 50 rlwimi r5,r4,2,27,27
> clrrdi r4, r4, 3
> c00000000010b044: 24 07 84 78 rldicr r4,r4,0,60
> std r4, VCPU_DAWR(r3)
> c00000000010b048: c0 13 83 f8 std r4,5056(r3)
> std r5, VCPU_DAWRX(r3)
> c00000000010b04c: c8 13 a3 f8 std r5,5064(r3)
> mtspr SPRN_DAWR, r4
> c00000000010b050: a6 2b 94 7c mtspr 180,r4
> mtspr SPRN_DAWRX, r5
> c00000000010b054: a6 2b bc 7c mtspr 188,r5
> li r3, 0
> c00000000010b058: 00 00 60 38 li r3,0
> blr
> c00000000010b05c: 20 00 80 4e blr
It's the `mtspr SPRN_DAWR, r4` as you're HV=0. I'm not sure how nested works
in that regard. Is the level above suppose to trap and emulate that?
I'm surprised that's changed by this patch.
Mikey
>
> C.
>
>
> > --
> > mpe: This is for 5.2 fixes
> > ---
> > arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > index 139027c62d..f781ee1458 100644
> > --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > @@ -2519,8 +2519,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
> > LOAD_REG_ADDR(r11, dawr_force_enable)
> > lbz r11, 0(r11)
> > cmpdi r11, 0
> > + bne 3f
> > li r3, H_HARDWARE
> > - beqlr
> > + blr
> > +3:
> > /* Emulate H_SET_DABR/X on P8 for the sake of compat mode guests */
> > rlwimi r5, r4, 5, DAWRX_DR | DAWRX_DW
> > rlwimi r5, r4, 2, DAWRX_WT
> >
^ permalink raw reply
* Re: [PATCH] KVM: PPC: Book3S HV: Fix r3 corruption in h_set_dabr()
From: Suraj Jitindar Singh @ 2019-06-13 0:39 UTC (permalink / raw)
To: Michael Neuling, Cédric Le Goater, mpe
Cc: linuxppc-dev, kvm-ppc, Suraj Jitindar Singh
In-Reply-To: <605bc6844ebb0ce2bf9dea906b707359500ceb4f.camel@neuling.org>
On Thu, 2019-06-13 at 10:16 +1000, Michael Neuling wrote:
> On Wed, 2019-06-12 at 09:43 +0200, Cédric Le Goater wrote:
> > On 12/06/2019 09:22, Michael Neuling wrote:
> > > In commit c1fe190c0672 ("powerpc: Add force enable of DAWR on P9
> > > option") I screwed up some assembler and corrupted a pointer in
> > > r3. This resulted in crashes like the below from Cédric:
> > >
> > > [ 44.374746] BUG: Kernel NULL pointer dereference at
> > > 0x000013bf
> > > [ 44.374848] Faulting instruction address: 0xc00000000010b044
> > > [ 44.374906] Oops: Kernel access of bad area, sig: 11 [#1]
> > > [ 44.374951] LE PAGE_SIZE=64K MMU=Radix MMU=Hash SMP
> > > NR_CPUS=2048 NUMA pSeries
> > > [ 44.375018] Modules linked in: vhost_net vhost tap
> > > xt_CHECKSUM iptable_mangle xt_MASQUERADE iptable_nat nf_nat
> > > xt_conntrack nf_conntrack nf_defrag_ipv6 libcrc32c nf_defrag_ipv4
> > > ipt_REJECT nf_reject_ipv4 xt_tcpudp bridge stp llc ebtable_filter
> > > ebtables ip6table_filter ip6_tables iptable_filter bpfilter
> > > vmx_crypto crct10dif_vpmsum crc32c_vpmsum kvm_hv kvm sch_fq_codel
> > > ip_tables x_tables autofs4 virtio_net net_failover virtio_scsi
> > > failover
> > > [ 44.375401] CPU: 8 PID: 1771 Comm: qemu-system-ppc Kdump:
> > > loaded Not tainted 5.2.0-rc4+ #3
> > > [ 44.375500] NIP: c00000000010b044 LR: c0080000089dacf4 CTR:
> > > c00000000010aff4
> > > [ 44.375604] REGS: c00000179b397710 TRAP: 0300 Not
> > > tainted (5.2.0-rc4+)
> > > [ 44.375691] MSR: 800000000280b033
> > > <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 42244842 XER: 00000000
> > > [ 44.375815] CFAR: c00000000010aff8 DAR: 00000000000013bf
> > > DSISR: 42000000 IRQMASK: 0
> > > [ 44.375815] GPR00: c0080000089dd6bc c00000179b3979a0
> > > c008000008a04300 ffffffffffffffff
> > > [ 44.375815] GPR04: 0000000000000000 0000000000000003
> > > 000000002444b05d c0000017f11c45d0
> > > [ 44.375815] GPR08: 078000003e018dfe 0000000000000028
> > > 0000000000000001 0000000000000075
> > > [ 44.375815] GPR12: c00000000010aff4 c000000007ff6300
> > > 0000000000000000 0000000000000000
> > > [ 44.375815] GPR16: 0000000000000000 c0000017f11d0000
> > > 00000000ffffffff c0000017f11ca7a8
> > > [ 44.375815] GPR20: c0000017f11c42ec ffffffffffffffff
> > > 0000000000000000 000000000000000a
> > > [ 44.375815] GPR24: fffffffffffffffc 0000000000000000
> > > c0000017f11c0000 c000000001a77ed8
> > > [ 44.375815] GPR28: c00000179af70000 fffffffffffffffc
> > > c0080000089ff170 c00000179ae88540
> > > [ 44.376673] NIP [c00000000010b044]
> > > kvmppc_h_set_dabr+0x50/0x68
> > > [ 44.376754] LR [c0080000089dacf4]
> > > kvmppc_pseries_do_hcall+0xa3c/0xeb0 [kvm_hv]
> > > [ 44.376849] Call Trace:
> > > [ 44.376886] [c00000179b3979a0] [c0000017f11c0000]
> > > 0xc0000017f11c0000 (unreliable)
> > > [ 44.376982] [c00000179b397a10] [c0080000089dd6bc]
> > > kvmppc_vcpu_run_hv+0x694/0xec0 [kvm_hv]
> > > [ 44.377084] [c00000179b397ae0] [c0080000093f8bcc]
> > > kvmppc_vcpu_run+0x34/0x48 [kvm]
> > > [ 44.377185] [c00000179b397b00] [c0080000093f522c]
> > > kvm_arch_vcpu_ioctl_run+0x2f4/0x400 [kvm]
> > > [ 44.377286] [c00000179b397b90] [c0080000093e3618]
> > > kvm_vcpu_ioctl+0x460/0x850 [kvm]
> > > [ 44.377384] [c00000179b397d00] [c0000000004ba6c4]
> > > do_vfs_ioctl+0xe4/0xb40
> > > [ 44.377464] [c00000179b397db0] [c0000000004bb1e4]
> > > ksys_ioctl+0xc4/0x110
> > > [ 44.377547] [c00000179b397e00] [c0000000004bb258]
> > > sys_ioctl+0x28/0x80
> > > [ 44.377628] [c00000179b397e20] [c00000000000b888]
> > > system_call+0x5c/0x70
> > > [ 44.377712] Instruction dump:
> > > [ 44.377765] 4082fff4 4c00012c 38600000 4e800020 e96280c0
> > > 896b0000 2c2b0000 3860ffff
> > > [ 44.377862] 4d820020 50852e74 508516f6 78840724 <f88313c0>
> > > f8a313c8 7c942ba6 7cbc2ba6
> > >
> > > This fixes the problem by only changing r3 when we are returning
> > > immediately.
> > >
> > > Signed-off-by: Michael Neuling <mikey@neuling.org>
> > > Reported-by: Cédric Le Goater <clg@kaod.org>
> >
> > On nested, I still see :
> >
> > [ 94.609274] Oops: Exception in kernel mode, sig: 4 [#1]
> > [ 94.609432] LE PAGE_SIZE=64K MMU=Radix MMU=Hash SMP NR_CPUS=2048
> > NUMA pSeries
> > [ 94.609596] Modules linked in: vhost_net vhost tap xt_CHECKSUM
> > iptable_mangle xt_MASQUERADE iptable_nat nf_nat xt_conntrack
> > nf_conntrack nf_defrag_ipv6 libcrc32c nf_defrag_ipv4 ipt_REJECT
> > nf_reject_ipv4 xt_tcpudp bridge stp llc ebtable_filter ebtables
> > ip6table_filter ip6_tables iptable_filter bpfilter vmx_crypto
> > kvm_hv crct10dif_vpmsum crc32c_vpmsum kvm sch_fq_codel ip_tables
> > x_tables autofs4 virtio_net virtio_scsi net_failover failover
> > [ 94.610179] CPU: 12 PID: 2026 Comm: qemu-system-ppc Kdump:
> > loaded Not tainted 5.2.0-rc4+ #6
> > [ 94.610290] NIP: c00000000010b050 LR: c008000008bbacf4 CTR:
> > c00000000010aff4
> > [ 94.610400] REGS: c0000017913d7710 TRAP: 0700 Not
> > tainted (5.2.0-rc4+)
> > [ 94.610493] MSR: 800000000284b033
> > <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 42224842 XER: 00000000
> > [ 94.610671] CFAR: c00000000010b030 IRQMASK: 0
> > [ 94.610671] GPR00: c008000008bbd6bc c0000017913d79a0
> > c008000008be4300 c000001791376220
> > [ 94.610671] GPR04: 0000000000000000 0000000000000003
> > 00000000f679892e c0000017911045d0
> > [ 94.610671] GPR08: 078000003e018dfe 0000000000000028
> > 0000000000000001 0000000000000075
> > [ 94.610671] GPR12: c00000000010aff4 c000000007ff1300
> > 0000000000000000 0000000000000000
> > [ 94.610671] GPR16: 0000000000000000 c000001791110000
> > 00000000ffffffff c00000179110a7a8
> > [ 94.610671] GPR20: c0000017911042ec ffffffffffffffff
> > 0000000000000000 000000000000000a
> > [ 94.610671] GPR24: fffffffffffffffc 0000000000000000
> > c000001791100000 c000000001a77ed8
> > [ 94.610671] GPR28: c0000017925d0000 fffffffffffffffc
> > c008000008bdf170 c000001791376220
> > [ 94.611818] NIP [c00000000010b050] kvmppc_h_set_dabr+0x5c/0x6c
> > [ 94.611932] LR [c008000008bbacf4]
> > kvmppc_pseries_do_hcall+0xa3c/0xeb0 [kvm_hv]
> > [ 94.612064] Call Trace:
> > [ 94.612115] [c0000017913d79a0] [c000001791100000]
> > 0xc000001791100000 (unreliable)
> > [ 94.612252] [c0000017913d7a10] [c008000008bbd6bc]
> > kvmppc_vcpu_run_hv+0x694/0xec0 [kvm_hv]
> > [ 94.612394] [c0000017913d7ae0] [c0080000091e8bcc]
> > kvmppc_vcpu_run+0x34/0x48 [kvm]
> > [ 94.612536] [c0000017913d7b00] [c0080000091e522c]
> > kvm_arch_vcpu_ioctl_run+0x2f4/0x400 [kvm]
> > [ 94.612674] [c0000017913d7b90] [c0080000091d3618]
> > kvm_vcpu_ioctl+0x460/0x850 [kvm]
> > [ 94.612821] [c0000017913d7d00] [c0000000004ba6d4]
> > do_vfs_ioctl+0xe4/0xb40
> > [ 94.612935] [c0000017913d7db0] [c0000000004bb1f4]
> > ksys_ioctl+0xc4/0x110
> > [ 94.613051] [c0000017913d7e00] [c0000000004bb268]
> > sys_ioctl+0x28/0x80
> > [ 94.613160] [c0000017913d7e20] [c00000000000b888]
> > system_call+0x5c/0x70
> > [ 94.613267] Instruction dump:
> > [ 94.613335] 4e800020 e96280c0 896b0000 2c2b0000 4082000c
> > 3860ffff 4e800020 50852e74
> > [ 94.613470] 508516f6 78840724 f88313c0 f8a313c8 <7c942ba6>
> > 7cbc2ba6 38600000 4e800020
> >
> >
> > Here is the asm dump:
> >
> >
> > 3:
> > /* Emulate H_SET_DABR/X on P8 for the sake of compat mode
> > guests */
> > rlwimi r5, r4, 5, DAWRX_DR | DAWRX_DW
> > c00000000010b03c: 74 2e 85 50 rlwimi r5,r4,5,25,26
> > rlwimi r5, r4, 2, DAWRX_WT
> > c00000000010b040: f6 16 85 50 rlwimi r5,r4,2,27,27
> > clrrdi r4, r4, 3
> > c00000000010b044: 24 07 84 78 rldicr r4,r4,0,60
> > std r4, VCPU_DAWR(r3)
> > c00000000010b048: c0 13 83 f8 std r4,5056(r3)
> > std r5, VCPU_DAWRX(r3)
> > c00000000010b04c: c8 13 a3 f8 std r5,5064(r3)
> > mtspr SPRN_DAWR, r4
> > c00000000010b050: a6 2b 94 7c mtspr 180,r4
> > mtspr SPRN_DAWRX, r5
> > c00000000010b054: a6 2b bc 7c mtspr 188,r5
> > li r3, 0
> > c00000000010b058: 00 00 60 38 li r3,0
> > blr
> > c00000000010b05c: 20 00 80 4e blr
>
> It's the `mtspr SPRN_DAWR, r4` as you're HV=0. I'm not sure how
> nested works
> in that regard. Is the level above suppose to trap and emulate
> that?
>
Yeah so as a nested hypervisor we need to avoid that call to mtspr
SPRN_DAWR since it's HV privileged and we run with HV = 0.
The fix will be to check kvmhv_on_pseries() before doing the write. In
fact we should avoid the write any time we call the function from _not_
real mode.
I'll submit a fix for the KVM side. Doesn't look like this is anything
to do with Mikey's patch, was always broken as far as I can tell.
> I'm surprised that's changed by this patch.
>
> Mikey
>
>
> >
> > C.
> >
> >
> > > --
> > > mpe: This is for 5.2 fixes
> > > ---
> > > arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > > b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > > index 139027c62d..f781ee1458 100644
> > > --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > > +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > > @@ -2519,8 +2519,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
> > > LOAD_REG_ADDR(r11, dawr_force_enable)
> > > lbz r11, 0(r11)
> > > cmpdi r11, 0
> > > + bne 3f
> > > li r3, H_HARDWARE
> > > - beqlr
> > > + blr
> > > +3:
> > > /* Emulate H_SET_DABR/X on P8 for the sake of compat
> > > mode guests */
> > > rlwimi r5, r4, 5, DAWRX_DR | DAWRX_DW
> > > rlwimi r5, r4, 2, DAWRX_WT
> > >
>
>
^ permalink raw reply
* [PATCH v2] KVM: PPC: Book3S HV: Fix r3 corruption in h_set_dabr()
From: Michael Neuling @ 2019-06-13 1:13 UTC (permalink / raw)
To: mpe; +Cc: mikey, kvm-ppc, Cédric Le Goater, sjitindarsingh,
linuxppc-dev
Commit c1fe190c0672 ("powerpc: Add force enable of DAWR on P9
option") screwed up some assembler and corrupted a pointer in
r3. This resulted in crashes like the below:
[ 44.374746] BUG: Kernel NULL pointer dereference at 0x000013bf
[ 44.374848] Faulting instruction address: 0xc00000000010b044
[ 44.374906] Oops: Kernel access of bad area, sig: 11 [#1]
[ 44.374951] LE PAGE_SIZE=64K MMU=Radix MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
[ 44.375018] Modules linked in: vhost_net vhost tap xt_CHECKSUM iptable_mangle xt_MASQUERADE iptable_nat nf_nat xt_conntrack nf_conntrack nf_defrag_ipv6 libcrc32c nf_defrag_ipv4 ipt_REJECT nf_reject_ipv4 xt_tcpudp bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter bpfilter vmx_crypto crct10dif_vpmsum crc32c_vpmsum kvm_hv kvm sch_fq_codel ip_tables x_tables autofs4 virtio_net net_failover virtio_scsi failover
[ 44.375401] CPU: 8 PID: 1771 Comm: qemu-system-ppc Kdump: loaded Not tainted 5.2.0-rc4+ #3
[ 44.375500] NIP: c00000000010b044 LR: c0080000089dacf4 CTR: c00000000010aff4
[ 44.375604] REGS: c00000179b397710 TRAP: 0300 Not tainted (5.2.0-rc4+)
[ 44.375691] MSR: 800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 42244842 XER: 00000000
[ 44.375815] CFAR: c00000000010aff8 DAR: 00000000000013bf DSISR: 42000000 IRQMASK: 0
[ 44.375815] GPR00: c0080000089dd6bc c00000179b3979a0 c008000008a04300 ffffffffffffffff
[ 44.375815] GPR04: 0000000000000000 0000000000000003 000000002444b05d c0000017f11c45d0
[ 44.375815] GPR08: 078000003e018dfe 0000000000000028 0000000000000001 0000000000000075
[ 44.375815] GPR12: c00000000010aff4 c000000007ff6300 0000000000000000 0000000000000000
[ 44.375815] GPR16: 0000000000000000 c0000017f11d0000 00000000ffffffff c0000017f11ca7a8
[ 44.375815] GPR20: c0000017f11c42ec ffffffffffffffff 0000000000000000 000000000000000a
[ 44.375815] GPR24: fffffffffffffffc 0000000000000000 c0000017f11c0000 c000000001a77ed8
[ 44.375815] GPR28: c00000179af70000 fffffffffffffffc c0080000089ff170 c00000179ae88540
[ 44.376673] NIP [c00000000010b044] kvmppc_h_set_dabr+0x50/0x68
[ 44.376754] LR [c0080000089dacf4] kvmppc_pseries_do_hcall+0xa3c/0xeb0 [kvm_hv]
[ 44.376849] Call Trace:
[ 44.376886] [c00000179b3979a0] [c0000017f11c0000] 0xc0000017f11c0000 (unreliable)
[ 44.376982] [c00000179b397a10] [c0080000089dd6bc] kvmppc_vcpu_run_hv+0x694/0xec0 [kvm_hv]
[ 44.377084] [c00000179b397ae0] [c0080000093f8bcc] kvmppc_vcpu_run+0x34/0x48 [kvm]
[ 44.377185] [c00000179b397b00] [c0080000093f522c] kvm_arch_vcpu_ioctl_run+0x2f4/0x400 [kvm]
[ 44.377286] [c00000179b397b90] [c0080000093e3618] kvm_vcpu_ioctl+0x460/0x850 [kvm]
[ 44.377384] [c00000179b397d00] [c0000000004ba6c4] do_vfs_ioctl+0xe4/0xb40
[ 44.377464] [c00000179b397db0] [c0000000004bb1e4] ksys_ioctl+0xc4/0x110
[ 44.377547] [c00000179b397e00] [c0000000004bb258] sys_ioctl+0x28/0x80
[ 44.377628] [c00000179b397e20] [c00000000000b888] system_call+0x5c/0x70
[ 44.377712] Instruction dump:
[ 44.377765] 4082fff4 4c00012c 38600000 4e800020 e96280c0 896b0000 2c2b0000 3860ffff
[ 44.377862] 4d820020 50852e74 508516f6 78840724 <f88313c0> f8a313c8 7c942ba6 7cbc2ba6
Fix the bug by only changing r3 when we are returning immediately.
Fixes: c1fe190c0672 ("powerpc: Add force enable of DAWR on P9 option")
Signed-off-by: Michael Neuling <mikey@neuling.org>
Reported-by: Cédric Le Goater <clg@kaod.org>
--
mpe: This is for 5.2 fixes
v2: Review from Christophe Leroy
- De-Mikey/Cedric-ify commit message
- Add "Fixes:"
- Other trivial commit messages changes
- No code change
---
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 139027c62d..f781ee1458 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -2519,8 +2519,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
LOAD_REG_ADDR(r11, dawr_force_enable)
lbz r11, 0(r11)
cmpdi r11, 0
+ bne 3f
li r3, H_HARDWARE
- beqlr
+ blr
+3:
/* Emulate H_SET_DABR/X on P8 for the sake of compat mode guests */
rlwimi r5, r4, 5, DAWRX_DR | DAWRX_DW
rlwimi r5, r4, 2, DAWRX_WT
--
2.21.0
^ permalink raw reply related
* Re: [PATCH] KVM: PPC: Book3S HV: Fix r3 corruption in h_set_dabr()
From: Michael Neuling @ 2019-06-13 1:50 UTC (permalink / raw)
To: Suraj Jitindar Singh, Cédric Le Goater, mpe
Cc: linuxppc-dev, kvm-ppc, Suraj Jitindar Singh
In-Reply-To: <1560386385.1924.2.camel@gmail.com>
> > > 3:
> > > /* Emulate H_SET_DABR/X on P8 for the sake of compat mode
> > > guests */
> > > rlwimi r5, r4, 5, DAWRX_DR | DAWRX_DW
> > > c00000000010b03c: 74 2e 85 50 rlwimi r5,r4,5,25,26
> > > rlwimi r5, r4, 2, DAWRX_WT
> > > c00000000010b040: f6 16 85 50 rlwimi r5,r4,2,27,27
> > > clrrdi r4, r4, 3
> > > c00000000010b044: 24 07 84 78 rldicr r4,r4,0,60
> > > std r4, VCPU_DAWR(r3)
> > > c00000000010b048: c0 13 83 f8 std r4,5056(r3)
> > > std r5, VCPU_DAWRX(r3)
> > > c00000000010b04c: c8 13 a3 f8 std r5,5064(r3)
> > > mtspr SPRN_DAWR, r4
> > > c00000000010b050: a6 2b 94 7c mtspr 180,r4
> > > mtspr SPRN_DAWRX, r5
> > > c00000000010b054: a6 2b bc 7c mtspr 188,r5
> > > li r3, 0
> > > c00000000010b058: 00 00 60 38 li r3,0
> > > blr
> > > c00000000010b05c: 20 00 80 4e blr
> >
> > It's the `mtspr SPRN_DAWR, r4` as you're HV=0. I'm not sure how
> > nested works
> > in that regard. Is the level above suppose to trap and emulate
> > that?
> >
>
> Yeah so as a nested hypervisor we need to avoid that call to mtspr
> SPRN_DAWR since it's HV privileged and we run with HV = 0.
>
> The fix will be to check kvmhv_on_pseries() before doing the write. In
> fact we should avoid the write any time we call the function from _not_
> real mode.
>
> I'll submit a fix for the KVM side. Doesn't look like this is anything
> to do with Mikey's patch, was always broken as far as I can tell.
Thanks Suraj.
Mikey
^ permalink raw reply
* RE: [RFC/RFT PATCH v2] ASoC: fsl_esai: Revert "ETDR and TX0~5 registers are non volatile"
From: S.j. Wang @ 2019-06-13 3:00 UTC (permalink / raw)
To: Nicolin Chen, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, timur@kernel.org,
lgirdwood@gmail.com, linuxppc-dev@lists.ozlabs.org,
Xiubo.Lee@gmail.com, tiwai@suse.com, perex@perex.cz,
festevam@gmail.com, linux-kernel@vger.kernel.org
Hi
>
> Commit 8973112aa41b ("ASoC: fsl_esai: ETDR and TX0~5 registers are non
> volatile") removed TX data registers from the volatile_reg list and appended
> default values for them. However, being data registers of TX, they should
> not have been removed from the list because they should not be cached --
> see the following reason.
>
> When doing regcache_sync(), this operation might accidentally write some
> dirty data to these registers, in case that cached data happen to be
> different from the default ones, which might also result in a channel shift or
> swap situation, since the number of write-via-sync operations at ETDR
> would very unlikely match the channel number.
>
> So this patch reverts the original commit to keep TX data registers in
> volatile_reg list in order to prevent them from being written by
> regcache_sync().
>
> Note: this revert is not a complete revert as it keeps those macros of
> registers remaining in the default value list while the original commit also
> changed other entries in the list. And this patch isn't very necessary to Cc
> stable tree since there has been always a FIFO reset operation around the
> regcache_sync() call, even prior to this reverted commit.
>
> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
> Cc: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> Hi Mark,
> In case there's no objection against the patch, I'd still like to wait for a
> Tested-by from NXP folks before submitting it. Thanks!
bool regmap_volatile(struct regmap *map, unsigned int reg)
{
if (!map->format.format_write && !regmap_readable(map, reg))
return false;
Actually with this patch, the regcache_sync will write the 0 to ETDR, even
It is declared volatile, the reason is that in regmap_volatile(), the first
condition
(!map->format.format_write && !regmap_readable(map, reg)) is true.
So the regmap_volatile will return false.
And in regcache_reg_needs_sync(), because there is no default value
It will return true, then the ETDR need be synced, and be written 0.
Here is the code for regcache_default_sync()
static int regcache_default_sync(struct regmap *map, unsigned int min,
unsigned int max)
{
unsigned int reg;
for (reg = min; reg <= max; reg += map->reg_stride) {
unsigned int val;
int ret;
if (regmap_volatile(map, reg) ||
!regmap_writeable(map, reg))
continue;
ret = regcache_read(map, reg, &val);
if (ret)
return ret;
if (!regcache_reg_needs_sync(map, reg, val))
continue;
map->cache_bypass = true;
ret = _regmap_write(map, reg, val);
map->cache_bypass = false;
Best regards
Wang shengjiu
^ permalink raw reply
* Re: [PATCH] powerpc: Enable kernel XZ compression option on PPC_85xx
From: Daniel Axtens @ 2019-06-13 3:25 UTC (permalink / raw)
To: Pawel Dembicki
Cc: Christian Lamparter, linux-kernel, Pawel Dembicki, Paul Mackerras,
linuxppc-dev
In-Reply-To: <20190603164115.27471-1-paweldembicki@gmail.com>
Pawel Dembicki <paweldembicki@gmail.com> writes:
> Enable kernel XZ compression option on PPC_85xx. Tested with
> simpleImage on TP-Link TL-WDR4900 (Freescale P1014 processor).
>
> Suggested-by: Christian Lamparter <chunkeey@gmail.com>
> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
> ---
> arch/powerpc/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 8c1c636308c8..daf4cb968922 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -196,7 +196,7 @@ config PPC
> select HAVE_IOREMAP_PROT
> select HAVE_IRQ_EXIT_ON_IRQ_STACK
> select HAVE_KERNEL_GZIP
> - select HAVE_KERNEL_XZ if PPC_BOOK3S || 44x
> + select HAVE_KERNEL_XZ if PPC_BOOK3S || 44x || PPC_85xx
(I'm not super well versed in the compression stuff, so apologies if
this is a dumb question.) If it's this simple, is there any reason we
can't turn it on generally, or convert it to a blacklist of platforms
known not to work?
Regards,
Daniel
> select HAVE_KPROBES
> select HAVE_KPROBES_ON_FTRACE
> select HAVE_KRETPROBES
> --
> 2.20.1
^ permalink raw reply
* [PATCH v2] Powerpc/Watchpoint: Restore nvgprs while returning from exception
From: Ravi Bangoria @ 2019-06-13 3:30 UTC (permalink / raw)
To: mpe
Cc: ravi.bangoria, mikey, linux-kernel, npiggin, paulus, aneesh.kumar,
mahesh, naveen.n.rao, linuxppc-dev
Powerpc hw triggers watchpoint before executing the instruction. To
make trigger-after-execute behavior, kernel emulates the instruction.
If the instruction is 'load something into non-volatile register',
exception handler should restore emulated register state while
returning back, otherwise there will be register state corruption.
Ex, Adding a watchpoint on a list can corrput the list:
# cat /proc/kallsyms | grep kthread_create_list
c00000000121c8b8 d kthread_create_list
Add watchpoint on kthread_create_list->prev:
# perf record -e mem:0xc00000000121c8c0
Run some workload such that new kthread gets invoked. Ex, I just
logged out from console:
list_add corruption. next->prev should be prev (c000000001214e00), \
but was c00000000121c8b8. (next=c00000000121c8b8).
WARNING: CPU: 59 PID: 309 at lib/list_debug.c:25 __list_add_valid+0xb4/0xc0
CPU: 59 PID: 309 Comm: kworker/59:0 Kdump: loaded Not tainted 5.1.0-rc7+ #69
...
NIP __list_add_valid+0xb4/0xc0
LR __list_add_valid+0xb0/0xc0
Call Trace:
__list_add_valid+0xb0/0xc0 (unreliable)
__kthread_create_on_node+0xe0/0x260
kthread_create_on_node+0x34/0x50
create_worker+0xe8/0x260
worker_thread+0x444/0x560
kthread+0x160/0x1a0
ret_from_kernel_thread+0x5c/0x70
List corruption happened because it uses 'load into non-volatile
register' instruction:
Snippet from __kthread_create_on_node:
c000000000136be8: addis r29,r2,-19
c000000000136bec: ld r29,31424(r29)
if (!__list_add_valid(new, prev, next))
c000000000136bf0: mr r3,r30
c000000000136bf4: mr r5,r28
c000000000136bf8: mr r4,r29
c000000000136bfc: bl c00000000059a2f8 <__list_add_valid+0x8>
Register state from WARN_ON():
GPR00: c00000000059a3a0 c000007ff23afb50 c000000001344e00 0000000000000075
GPR04: 0000000000000000 0000000000000000 0000001852af8bc1 0000000000000000
GPR08: 0000000000000001 0000000000000007 0000000000000006 00000000000004aa
GPR12: 0000000000000000 c000007ffffeb080 c000000000137038 c000005ff62aaa00
GPR16: 0000000000000000 0000000000000000 c000007fffbe7600 c000007fffbe7370
GPR20: c000007fffbe7320 c000007fffbe7300 c000000001373a00 0000000000000000
GPR24: fffffffffffffef7 c00000000012e320 c000007ff23afcb0 c000000000cb8628
GPR28: c00000000121c8b8 c000000001214e00 c000007fef5b17e8 c000007fef5b17c0
Watchpoint hit at 0xc000000000136bec.
addis r29,r2,-19
=> r29 = 0xc000000001344e00 + (-19 << 16)
=> r29 = 0xc000000001214e00
ld r29,31424(r29)
=> r29 = *(0xc000000001214e00 + 31424)
=> r29 = *(0xc00000000121c8c0)
0xc00000000121c8c0 is where we placed a watchpoint and thus this
instruction was emulated by emulate_step. But because handle_dabr_fault
did not restore emulated register state, r29 still contains stale
value in above register state.
Fixes: 5aae8a5370802 ("powerpc, hw_breakpoints: Implement hw_breakpoints for 64-bit server processors")
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: stable@vger.kernel.org # 2.6.36+
---
v1: https://lkml.org/lkml/2019/6/10/1058
v1->v2:
Successful do_page_fault returns using ret_from_except_lite at
the same place where handle_dabr_fault also returns. v1 messed
up with do_page_fault return path. Fix that in v2.
arch/powerpc/kernel/exceptions-64s.S | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 6b86055..2546427 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -1746,7 +1746,7 @@ handle_page_fault:
addi r3,r1,STACK_FRAME_OVERHEAD
bl do_page_fault
cmpdi r3,0
- beq+ 12f
+ beq+ ret_from_except_lite
bl save_nvgprs
mr r5,r3
addi r3,r1,STACK_FRAME_OVERHEAD
@@ -1761,7 +1761,12 @@ handle_dabr_fault:
ld r5,_DSISR(r1)
addi r3,r1,STACK_FRAME_OVERHEAD
bl do_break
-12: b ret_from_except_lite
+ /*
+ * do_break may have changed the nv-gprs while haldling
+ * breakpoint. If so, we need to restore them with their
+ * updated values. Don't use ret_from_except_lite here.
+ */
+ b ret_from_except
#ifdef CONFIG_PPC_BOOK3S_64
--
1.8.3.1
^ permalink raw reply related
* Re: [RFC/RFT PATCH v2] ASoC: fsl_esai: Revert "ETDR and TX0~5 registers are non volatile"
From: Nicolin Chen @ 2019-06-13 3:54 UTC (permalink / raw)
To: S.j. Wang
Cc: alsa-devel@alsa-project.org, timur@kernel.org,
Xiubo.Lee@gmail.com, linuxppc-dev@lists.ozlabs.org,
tiwai@suse.com, lgirdwood@gmail.com, perex@perex.cz,
broonie@kernel.org, festevam@gmail.com,
linux-kernel@vger.kernel.org
In-Reply-To: <VE1PR04MB6479D4B1D5F00B07C5CECC5BE3EF0@VE1PR04MB6479.eurprd04.prod.outlook.com>
Hi Shengjiu,
On Thu, Jun 13, 2019 at 03:00:58AM +0000, S.j. Wang wrote:
> > Commit 8973112aa41b ("ASoC: fsl_esai: ETDR and TX0~5 registers are non
> > volatile") removed TX data registers from the volatile_reg list and appended
> > default values for them. However, being data registers of TX, they should
> > not have been removed from the list because they should not be cached --
> > see the following reason.
> >
> > When doing regcache_sync(), this operation might accidentally write some
> > dirty data to these registers, in case that cached data happen to be
> > different from the default ones, which might also result in a channel shift or
> > swap situation, since the number of write-via-sync operations at ETDR
> > would very unlikely match the channel number.
> >
> > So this patch reverts the original commit to keep TX data registers in
> > volatile_reg list in order to prevent them from being written by
> > regcache_sync().
> >
> > Note: this revert is not a complete revert as it keeps those macros of
> > registers remaining in the default value list while the original commit also
> > changed other entries in the list. And this patch isn't very necessary to Cc
> > stable tree since there has been always a FIFO reset operation around the
> > regcache_sync() call, even prior to this reverted commit.
> >
> > Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
> > Cc: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> > Hi Mark,
> > In case there's no objection against the patch, I'd still like to wait for a
> > Tested-by from NXP folks before submitting it. Thanks!
>
> bool regmap_volatile(struct regmap *map, unsigned int reg)
> {
> if (!map->format.format_write && !regmap_readable(map, reg))
> return false;
>
>
> Actually with this patch, the regcache_sync will write the 0 to ETDR, even
> It is declared volatile, the reason is that in regmap_volatile(), the first
> condition
>
> (!map->format.format_write && !regmap_readable(map, reg)) is true.
>
> So the regmap_volatile will return false.
Interesting finding.....so a write-only register will not be treated
as a volatile register (to avoid regcache_sync) at all....
> And in regcache_reg_needs_sync(), because there is no default value
> It will return true, then the ETDR need be synced, and be written 0.
Looks like either way of keeping them in or out of volatile_reg list
might have the same result of having a data being written, while our
current code at least would not force to write 0.
So I think having a FIFO reset won't be a bad idea at all. And since
our suspend/resume() functions are already doing regcache_sync() with
a FIFO reset, we can just reuse that code for your reset routine.
Thanks a lot
Nicolin
^ permalink raw reply
* Re: [PATCH v2 0/4] Additional fixes on Talitos driver
From: Christophe Leroy @ 2019-06-13 4:57 UTC (permalink / raw)
To: Horia Geanta, Herbert Xu, David S. Miller
Cc: linuxppc-dev@lists.ozlabs.org, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <VI1PR0402MB348583D36921F9DEC4E0DA2698EC0@VI1PR0402MB3485.eurprd04.prod.outlook.com>
Le 12/06/2019 à 15:59, Horia Geanta a écrit :
> On 6/12/2019 8:52 AM, Christophe Leroy wrote:
>>
>>
>> Le 11/06/2019 à 18:30, Horia Geanta a écrit :
>>> On 6/11/2019 6:40 PM, Christophe Leroy wrote:
>>>>
>>>>
>>>> Le 11/06/2019 à 17:37, Horia Geanta a écrit :
>>>>> On 6/11/2019 5:39 PM, Christophe Leroy wrote:
>>>>>> This series is the last set of fixes for the Talitos driver.
>>>>>>
>>>>>> We now get a fully clean boot on both SEC1 (SEC1.2 on mpc885) and
>>>>>> SEC2 (SEC2.2 on mpc8321E) with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS:
>>>>>>
>>>>> I am getting below failures on a sec 3.3.2 (p1020rdb) for hmac(sha384) and
>>>>> hmac(sha512):
>>>>
>>>> Is that new with this series or did you already have it before ?
>>>>
>>> Looks like this happens with or without this series.
>>
>> Found the issue, that's in
>> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b8fbdc2bc4e71b62646031d5df5f08aafe15d5ad
>>
>> CONFIG_CRYPTO_DEV_TALITOS_SEC2 should be CONFIG_CRYPTO_DEV_TALITOS2 instead.
>>
>> Just sent a patch to fix it.
>>
> Thanks, I've tested it and the hmac failures go away.
>
> However, testing gets stuck.
> Seems there is another issue lurking in the driver.
>
> Used cryptodev-2.6/master with the following on top:
> crypto: testmgr - add some more preemption points
> https://patchwork.kernel.org/patch/10972337/
> crypto: talitos - fix max key size for sha384 and sha512
> https://patchwork.kernel.org/patch/10988473/
>
> [...]
> alg: skcipher: skipping comparison tests for ecb-3des-talitos because ecb(des3_ede-generic) is unavailable
> INFO: task cryptomgr_test:314 blocked for more than 120 seconds.
> Not tainted 5.2.0-rc1-g905bfd415e8a #1
> "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> cryptomgr_test D 0 314 2 0x00000800
> Call Trace:
> [e78337e0] [00000004] 0x4 (unreliable)
> [e78338a8] [c08a6e5c] __schedule+0x20c/0x4d4
> [e78338f8] [c08a7158] schedule+0x34/0xc8
> [e7833908] [c08aa5ec] schedule_timeout+0x1d4/0x350
> [e7833958] [c08a7be4] wait_for_common+0xa0/0x164
> [e7833998] [c03a7b14] do_ahash_op+0xa4/0xc4
> [e78339b8] [c03aba00] test_ahash_vec_cfg+0x188/0x5e4
> [e7833aa8] [c03ac1c8] test_hash_vs_generic_impl+0x1b0/0x2b4
> [e7833de8] [c03ac498] __alg_test_hash+0x1cc/0x2d0
> [e7833e28] [c03a9fb4] alg_test.part.37+0x8c/0x3ac
> [e7833ef8] [c03a54d0] cryptomgr_test+0x4c/0x54
> [e7833f08] [c006c410] kthread+0xf8/0x124
> [e7833f38] [c001227c] ret_from_kernel_thread+0x14/0x1c
>
> addr2line on c03aba00 points to crypto/testmgr.c:1335
>
> 1327) if (cfg->finalization_type == FINALIZATION_TYPE_DIGEST ||
> 1328) vec->digest_error) {
> 1329) /* Just using digest() */
> 1330) ahash_request_set_callback(req, req_flags, crypto_req_done,
> 1331) &wait);
> 1332) ahash_request_set_crypt(req, tsgl->sgl, result, vec->psize);
> 1333) err = do_ahash_op(crypto_ahash_digest, req, &wait, cfg->nosimd);
> 1334) if (err) {
> -> 1335) if (err == vec->digest_error)
> 1336) return 0;
> 1337) pr_err("alg: ahash: %s digest() failed on test vector %s; expected_error=%d, actual_error=%d, cfg=\"%s\"\n",
> 1338) driver, vec_name, vec->digest_error, err,
> 1339) cfg->name);
> 1340) return err;
> 1341) }
> 1342) if (vec->digest_error) {
> 1343) pr_err("alg: ahash: %s digest() unexpectedly succeeded on test vector %s; expected_error=%d, cfg=\"%s\"\n",
> 1344) driver, vec_name, vec->digest_error, cfg->name);
> 1345) return -EINVAL;
> 1346) }
> 1347) goto result_ready;
> 1348) }
>
> Seems that for some reason driver does not receive the interrupt from HW,
> thus completion callback does not run.
>
> Tried with or without current patch series, no change in behaviour.
>
> If you cannot reproduce and don't have any idea, I'll try the hard way
> (git bisect).
I cannot reproduce, both mpc885 and mpc8321e boot fine, and don't have
any idea at first.
I know the SEC1 behaves that way when you submit zero-length data.
Christophe
>
> Thanks,
> Horia
>
^ permalink raw reply
* Re: [PATCH 0/2] powerpc/bpf: DIV64 instruction fix
From: Sandipan Das @ 2019-06-13 5:06 UTC (permalink / raw)
To: Naveen N. Rao
Cc: netdev, bpf, linuxppc-dev, Alexei Starovoitov, Daniel Borkmann
In-Reply-To: <cover.1560364574.git.naveen.n.rao@linux.vnet.ibm.com>
On 13/06/19 12:21 AM, Naveen N. Rao wrote:
> The first patch updates DIV64 overflow tests to properly detect error
> conditions. The second patch fixes powerpc64 JIT to generate the proper
> unsigned division instruction for BPF_ALU64.
>
> - Naveen
>
> Naveen N. Rao (2):
> bpf: fix div64 overflow tests to properly detect errors
> powerpc/bpf: use unsigned division instruction for 64-bit operations
>
> arch/powerpc/include/asm/ppc-opcode.h | 1 +
> arch/powerpc/net/bpf_jit.h | 2 +-
> arch/powerpc/net/bpf_jit_comp64.c | 8 ++++----
> .../testing/selftests/bpf/verifier/div_overflow.c | 14 ++++++++++----
> 4 files changed, 16 insertions(+), 9 deletions(-)
>
For the series
Acked-by: Sandipan Das <sandipan@linux.ibm.com>
^ permalink raw reply
* Re: [BISECTED REGRESSION] b43legacy broken on G4 PowerBook
From: Christoph Hellwig @ 2019-06-13 7:29 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Aaro Koskinen, linux-wireless, linux-kernel, Christian Zigotzky,
linuxppc-dev, Christoph Hellwig, Larry Finger
In-Reply-To: <05db995c55ad7c1002124374c139d2c0812ad034.camel@kernel.crashing.org>
On Thu, Jun 13, 2019 at 07:59:51AM +1000, Benjamin Herrenschmidt wrote:
> > With the patch for Kconfig above, and the original patch setting
> > ARCH_ZONE_DMA_BITS to 30, everything works.
> >
> > Do you have any ideas on what should trigger the change in ARCH_ZONE_BITS?
> > Should it be CONFIG_PPC32 defined, or perhaps CONFIG_G4_CPU defined?
>
> I think CONFIG_PPC32 is fine
I'll cook up a patch unless someone beats me to it.
^ permalink raw reply
* Re: [PATCH 0/1] PPC32: fix ptrace() access to FPU registers
From: Daniel Axtens @ 2019-06-13 7:59 UTC (permalink / raw)
To: Radu Rendec, linuxppc-dev; +Cc: Radu Rendec, Paul Mackerras, Oleg Nesterov
In-Reply-To: <20190610232758.19010-1-radu.rendec@gmail.com>
Radu Rendec <radu.rendec@gmail.com> writes:
> Hi Everyone,
>
> I'm following up on the ptrace() problem that I reported a few days ago.
> I believe my version of the code handles all cases correctly. While the
> problem essentially boils down to dividing the fpidx by 2 on PPC32, it
> becomes tricky when the same code must work correctly on both PPC32 and
> PPC64.
>
> One other thing that I believe was handled incorrectly in the previous
> version is the unused half of fpscr on PPC32. Note that while PT_FPSCR
> is defined as (PT_FPR0 + 2*32 + 1), making only the upper half visible,
> PT_FPR0 + 2*32 still corresponds to a possible address that userspace
> can pass. In that case, comparing fpidx to (PT_FPSCR - PT_FPR0) would
> cause an invalid access to the FPU registers array.
>
> I tested the patch on 4.9.179, but that part of the code is identical in
> recent kernels so it should work just the same.
I've been looking into this. Something is definitely up, but I'm not
sure that we want to fix it in exactly the way you identified. I'll keep
you updated.
Regards,
Daniel
>
> I wrote a simple test program than can be used to quickly test (on an
> x86_64 host) that all cases are handled correctly for both PPC32/PPC64.
> The code is included below.
>
> I also tested with gdbserver (test patch included below) and verified
> that it generates two ptrace() calls for each FPU register, with
> addresses between 0xc0 and 0x1bc.
>
> 8<--------------- Makefile ---------------------------------------------
> .PHONY: all clean
>
> all: ptrace-fpregs-32 ptrace-fpregs-64
>
> ptrace-fpregs-32: ptrace-fpregs.c
> $(CC) -o ptrace-fpregs-32 -Wall -O2 -m32 ptrace-fpregs.c
>
> ptrace-fpregs-64: ptrace-fpregs.c
> $(CC) -o ptrace-fpregs-64 -Wall -O2 ptrace-fpregs.c
>
> clean:
> rm -f ptrace-fpregs-32 ptrace-fpregs-64
> 8<--------------- ptrace-fpregs.c --------------------------------------
> #include <stdio.h>
> #include <errno.h>
>
> #define PT_FPR0 48
>
> #ifndef __x86_64
>
> #define PT_FPR31 (PT_FPR0 + 2*31)
> #define PT_FPSCR (PT_FPR0 + 2*32 + 1)
>
> #else
>
> #define PT_FPSCR (PT_FPR0 + 32)
>
> #endif
>
> int test_access(unsigned long addr)
> {
> int ret;
>
> do {
> unsigned long index, fpidx;
>
> ret = -EIO;
>
> /* convert to index and check */
> index = addr / sizeof(long);
> if ((addr & (sizeof(long) - 1)) || (index > PT_FPSCR))
> break;
>
> if (index < PT_FPR0) {
> ret = printf("ptrace_put_reg(%lu)", index);
> break;
> }
>
> ret = 0;
> #ifndef __x86_64
> if (index == PT_FPSCR - 1) {
> /* corner case for PPC32; do nothing */
> printf("corner_case");
> break;
> }
> #endif
> if (index == PT_FPSCR) {
> printf("fpscr");
> break;
> }
>
> /*
> * FPR is always 64-bit; on PPC32, userspace does two 32-bit
> * accesses. Add bit2 to allow accessing the upper half on
> * 32-bit; on 64-bit, bit2 is always 0 (we validate it above).
> */
> fpidx = (addr - PT_FPR0 * sizeof(long)) / 8;
> printf("TS_FPR[%lu] + %lu", fpidx, addr & 4);
> break;
> } while (0);
>
> return ret;
> }
>
> int main(void)
> {
> unsigned long addr;
> int rc;
>
> for (addr = 0; addr < PT_FPSCR * sizeof(long) + 16; addr++) {
> printf("0x%04lx: ", addr);
> rc = test_access(addr);
> if (rc < 0)
> printf("!err!");
> printf("\t<%d>\n", rc);
> }
>
> return 0;
> }
> 8<--------------- gdb.patch --------------------------------------------
> --- gdb/gdbserver/linux-low.c.orig 2019-06-10 11:45:53.810882669 -0400
> +++ gdb/gdbserver/linux-low.c 2019-06-10 11:49:32.272929766 -0400
> @@ -4262,6 +4262,8 @@ store_register (struct regcache *regcach
> pid = lwpid_of (get_thread_lwp (current_inferior));
> for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
> {
> + printf("writing register #%d offset %d at address %#x\n",
> + regno, i, (unsigned int)regaddr);
> errno = 0;
> ptrace (PTRACE_POKEUSER, pid,
> /* Coerce to a uintptr_t first to avoid potential gcc warning
> 8<----------------------------------------------------------------------
>
> Radu Rendec (1):
> PPC32: fix ptrace() access to FPU registers
>
> arch/powerpc/kernel/ptrace.c | 85 ++++++++++++++++++++++--------------
> 1 file changed, 52 insertions(+), 33 deletions(-)
>
> --
> 2.20.1
^ permalink raw reply
* [PATCH] powerpc: enable a 30-bit ZONE_DMA for 32-bit pmac
From: Christoph Hellwig @ 2019-06-13 8:24 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: Larry.Finger, linuxppc-dev, linux-kernel, aaro.koskinen
With the strict dma mask checking introduced with the switch to
the generic DMA direct code common wifi chips on 32-bit powerbooks
stopped working. Add a 30-bit ZONE_DMA to the 32-bit pmac builds
to allow them to reliably allocate dma coherent memory.
Fixes: 65a21b71f948 ("powerpc/dma: remove dma_nommu_dma_supported")
Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/powerpc/include/asm/page.h | 7 +++++++
arch/powerpc/mm/mem.c | 3 ++-
arch/powerpc/platforms/powermac/Kconfig | 1 +
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index b8286a2013b4..0d52f57fca04 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -319,6 +319,13 @@ struct vm_area_struct;
#endif /* __ASSEMBLY__ */
#include <asm/slice.h>
+/*
+ * Allow 30-bit DMA for very limited Broadcom wifi chips on many powerbooks.
+ */
+#ifdef CONFIG_PPC32
+#define ARCH_ZONE_DMA_BITS 30
+#else
#define ARCH_ZONE_DMA_BITS 31
+#endif
#endif /* _ASM_POWERPC_PAGE_H */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index cba29131bccc..2540d3b2588c 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -248,7 +248,8 @@ void __init paging_init(void)
(long int)((top_of_ram - total_ram) >> 20));
#ifdef CONFIG_ZONE_DMA
- max_zone_pfns[ZONE_DMA] = min(max_low_pfn, 0x7fffffffUL >> PAGE_SHIFT);
+ max_zone_pfns[ZONE_DMA] = min(max_low_pfn,
+ ((1UL << ARCH_ZONE_DMA_BITS) - 1) >> PAGE_SHIFT);
#endif
max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
#ifdef CONFIG_HIGHMEM
diff --git a/arch/powerpc/platforms/powermac/Kconfig b/arch/powerpc/platforms/powermac/Kconfig
index f834a19ed772..c02d8c503b29 100644
--- a/arch/powerpc/platforms/powermac/Kconfig
+++ b/arch/powerpc/platforms/powermac/Kconfig
@@ -7,6 +7,7 @@ config PPC_PMAC
select PPC_INDIRECT_PCI if PPC32
select PPC_MPC106 if PPC32
select PPC_NATIVE
+ select ZONE_DMA if PPC32
default y
config PPC_PMAC64
--
2.20.1
^ permalink raw reply related
* Re: [PATCH v8 1/7] iommu: enhance IOMMU default DMA mode build options
From: Leizhen (ThunderTown) @ 2019-06-13 8:30 UTC (permalink / raw)
To: John Garry, Jean-Philippe Brucker, Robin Murphy, Will Deacon,
Joerg Roedel, Jonathan Corbet, linux-doc, Sebastian Ott,
Gerald Schaefer, Martin Schwidefsky, Heiko Carstens,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Tony Luck, Fenghua Yu, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H . Peter Anvin, David Woodhouse, iommu,
linux-kernel, linux-s390, linuxppc-dev, x86, linux-ia64
Cc: Linuxarm, Hanjun Guo
In-Reply-To: <55d0e30c-5bca-41fc-5bf0-4366dc387afd@huawei.com>
On 2019/5/31 18:42, John Garry wrote:
>
>>>> -config IOMMU_DEFAULT_PASSTHROUGH
>>>> - bool "IOMMU passthrough by default"
>>>> +choice
>>>> + prompt "IOMMU default DMA mode"
>>>> depends on IOMMU_API
>>>> - help
>>>> - Enable passthrough by default, removing the need to pass in
>>>> - iommu.passthrough=on or iommu=pt through command line. If this
>>>> - is enabled, you can still disable with iommu.passthrough=off
>>>> - or iommu=nopt depending on the architecture.
>>>> + default IOMMU_DEFAULT_STRICT
>>>> + help
>>>> + This option allows IOMMU DMA mode to be chose at build time, to
>>>
>>> As before:
>>> /s/chose/chosen/, /s/allows IOMMU/allows an IOMMU/
>> I'm sorry that the previous version was not modified.
>>
>>>
>>>> + override the default DMA mode of each ARCHs, removing the need to
>>>
>>> Again, as before:
>>> ARCHs should be singular
>> OK
>>
>>>
>>>> + pass in kernel parameters through command line. You can still use
>>>> + ARCHs specific boot options to override this option again.
>
> *
>
>>>> +
>>>> +config IOMMU_DEFAULT_PASSTHROUGH
>>>> + bool "passthrough"
>>>> + help
>>>> + In this mode, the DMA access through IOMMU without any addresses
>>>> + translation. That means, the wrong or illegal DMA access can not
>>>> + be caught, no error information will be reported.
>>>>
>>>> If unsure, say N here.
>>>>
>>>> +config IOMMU_DEFAULT_LAZY
>>>> + bool "lazy"
>>>> + help
>>>> + Support lazy mode, where for every IOMMU DMA unmap operation, the
>>>> + flush operation of IOTLB and the free operation of IOVA are deferred.
>>>> + They are only guaranteed to be done before the related IOVA will be
>>>> + reused.
>>>
>>> why no advisory on how to set if unsure?
>> Because the LAZY and STRICT have their own advantages and disadvantages.
>>
>> Should I say: If unsure, keep the default。
>
> Maybe. So you could put this in the help for the choice, * above, and remove the advisory on IOMMU_DEFAULT_PASSTHROUGH.
OK, I'll revise it according to this idea in v9.
>
> However the maintainer may have a different view.
>
> Thanks,
> John
>
>>
>>>
>>>> +
>>>> +config IOMMU_DEFAULT_STRICT
>>>> + bool "strict"
>>>> + help
>>>> + For every IOMMU DMA unmap operation, the flush operation of IOTLB and
>>>> + the free operation of IOVA are guaranteed to be done in the unmap
>>>> + function.
>>>> +
>>>> + This mode is safer than the two above, but it maybe slower in some
>>>> + high performace scenarios.
>>>
>>> and here?
>
>
> .
>
^ permalink raw reply
* [PATCH 4.14 23/81] EDAC/mpc85xx: Prevent building as a module
From: Greg Kroah-Hartman @ 2019-06-13 8:33 UTC (permalink / raw)
To: linux-kernel
Cc: Sasha Levin, Borislav Petkov, Greg Kroah-Hartman,
Mauro Carvalho Chehab, stable, linuxppc-dev, morbidrsa,
James Morse, Johannes Thumshirn, linux-edac
In-Reply-To: <20190613075649.074682929@linuxfoundation.org>
[ Upstream commit 2b8358a951b1e2a534a54924cd8245e58a1c5fb8 ]
The mpc85xx EDAC driver can be configured as a module but then fails to
build because it uses two unexported symbols:
ERROR: ".pci_find_hose_for_OF_device" [drivers/edac/mpc85xx_edac_mod.ko] undefined!
ERROR: ".early_find_capability" [drivers/edac/mpc85xx_edac_mod.ko] undefined!
We don't want to export those symbols just for this driver, so make the
driver only configurable as a built-in.
This seems to have been broken since at least
c92132f59806 ("edac/85xx: Add PCIe error interrupt edac support")
(Nov 2013).
[ bp: make it depend on EDAC=y so that the EDAC core doesn't get built
as a module. ]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: linuxppc-dev@ozlabs.org
Cc: morbidrsa@gmail.com
Link: https://lkml.kernel.org/r/20190502141941.12927-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/edac/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 96afb2aeed18..aaaa8ce8d3fd 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -246,8 +246,8 @@ config EDAC_PND2
micro-server but may appear on others in the future.
config EDAC_MPC85XX
- tristate "Freescale MPC83xx / MPC85xx"
- depends on FSL_SOC
+ bool "Freescale MPC83xx / MPC85xx"
+ depends on FSL_SOC && EDAC=y
help
Support for error detection and correction on the Freescale
MPC8349, MPC8560, MPC8540, MPC8548, T4240
--
2.20.1
^ permalink raw reply related
* [PATCH 4.19 029/118] EDAC/mpc85xx: Prevent building as a module
From: Greg Kroah-Hartman @ 2019-06-13 8:32 UTC (permalink / raw)
To: linux-kernel
Cc: Sasha Levin, Borislav Petkov, Greg Kroah-Hartman,
Mauro Carvalho Chehab, stable, linuxppc-dev, morbidrsa,
James Morse, Johannes Thumshirn, linux-edac
In-Reply-To: <20190613075643.642092651@linuxfoundation.org>
[ Upstream commit 2b8358a951b1e2a534a54924cd8245e58a1c5fb8 ]
The mpc85xx EDAC driver can be configured as a module but then fails to
build because it uses two unexported symbols:
ERROR: ".pci_find_hose_for_OF_device" [drivers/edac/mpc85xx_edac_mod.ko] undefined!
ERROR: ".early_find_capability" [drivers/edac/mpc85xx_edac_mod.ko] undefined!
We don't want to export those symbols just for this driver, so make the
driver only configurable as a built-in.
This seems to have been broken since at least
c92132f59806 ("edac/85xx: Add PCIe error interrupt edac support")
(Nov 2013).
[ bp: make it depend on EDAC=y so that the EDAC core doesn't get built
as a module. ]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: linuxppc-dev@ozlabs.org
Cc: morbidrsa@gmail.com
Link: https://lkml.kernel.org/r/20190502141941.12927-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/edac/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 57304b2e989f..b00cc03ad6b6 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -250,8 +250,8 @@ config EDAC_PND2
micro-server but may appear on others in the future.
config EDAC_MPC85XX
- tristate "Freescale MPC83xx / MPC85xx"
- depends on FSL_SOC
+ bool "Freescale MPC83xx / MPC85xx"
+ depends on FSL_SOC && EDAC=y
help
Support for error detection and correction on the Freescale
MPC8349, MPC8560, MPC8540, MPC8548, T4240
--
2.20.1
^ permalink raw reply related
* [PATCH v9 1/7] iommu: enhance IOMMU default DMA mode build options
From: Zhen Lei @ 2019-06-13 8:42 UTC (permalink / raw)
To: Jean-Philippe Brucker, John Garry, Robin Murphy, Will Deacon,
Joerg Roedel, Jonathan Corbet, linux-doc, Sebastian Ott,
Gerald Schaefer, Martin Schwidefsky, Heiko Carstens,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Tony Luck, Fenghua Yu, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H . Peter Anvin, David Woodhouse, iommu,
linux-kernel, linux-s390, linuxppc-dev, x86, linux-ia64
Cc: Zhen Lei
In-Reply-To: <20190613084240.16768-1-thunder.leizhen@huawei.com>
First, add build option IOMMU_DEFAULT_{LAZY|STRICT}, so that we have the
opportunity to set {lazy|strict} mode as default at build time. Then put
the three config options in an choice, make people can only choose one of
the three at a time.
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/iommu/Kconfig | 44 ++++++++++++++++++++++++++++++++++++--------
drivers/iommu/iommu.c | 3 ++-
2 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 83664db5221df02..fe715fb295c6ed2 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -75,16 +75,44 @@ config IOMMU_DEBUGFS
debug/iommu directory, and then populate a subdirectory with
entries as required.
-config IOMMU_DEFAULT_PASSTHROUGH
- bool "IOMMU passthrough by default"
+choice
+ prompt "IOMMU default DMA mode"
depends on IOMMU_API
- help
- Enable passthrough by default, removing the need to pass in
- iommu.passthrough=on or iommu=pt through command line. If this
- is enabled, you can still disable with iommu.passthrough=off
- or iommu=nopt depending on the architecture.
+ default IOMMU_DEFAULT_STRICT
+ help
+ This option allows an IOMMU DMA mode to be chosen at build time, to
+ override the default DMA mode of each ARCH, removing the need to
+ pass in kernel parameters through command line. You can still use
+ ARCH specific boot options to override this option again.
- If unsure, say N here.
+ If unsure, keep the default.
+
+config IOMMU_DEFAULT_PASSTHROUGH
+ bool "passthrough"
+ help
+ In this mode, the DMA access through IOMMU without any addresses
+ translation. That means, the wrong or illegal DMA access can not
+ be caught, no error information will be reported.
+
+config IOMMU_DEFAULT_LAZY
+ bool "lazy"
+ help
+ Support lazy mode, where for every IOMMU DMA unmap operation, the
+ flush operation of IOTLB and the free operation of IOVA are deferred.
+ They are only guaranteed to be done before the related IOVA will be
+ reused.
+
+config IOMMU_DEFAULT_STRICT
+ bool "strict"
+ help
+ For every IOMMU DMA unmap operation, the flush operation of IOTLB and
+ the free operation of IOVA are guaranteed to be done in the unmap
+ function.
+
+ This mode is safer than the two above, but it maybe slower in some
+ high performace scenarios.
+
+endchoice
config OF_IOMMU
def_bool y
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index f9cacce909d3ae9..05171dd0bd03aee 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -31,7 +31,8 @@
#else
static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA;
#endif
-static bool iommu_dma_strict __read_mostly = true;
+static bool iommu_dma_strict __read_mostly =
+ IS_ENABLED(CONFIG_IOMMU_DEFAULT_STRICT);
struct iommu_group {
struct kobject kobj;
--
1.8.3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox