]> asedeno.scripts.mit.edu Git - linux.git/commit
MIPS: Hardcode cpu_has_* where known at compile time due to ISA
authorPaul Burton <paul.burton@mips.com>
Mon, 12 Jun 2017 18:54:23 +0000 (11:54 -0700)
committerPaul Burton <paul.burton@mips.com>
Tue, 24 Jul 2018 21:09:13 +0000 (14:09 -0700)
commit93e01942a6eb1ce730b42158d0d6c6531fe29ca0
tree000cbf6bc7b216cb325f613c3174a2196bf96970
parentc24f5762d374b7f2aae31b7a393bdfa66ed06d8b
MIPS: Hardcode cpu_has_* where known at compile time due to ISA

Many architectural features have over time moved from being optional to
either be required or removed by newer architecture releases. This means
that in many cases we can know at compile time whether a feature will be
supported or not purely due to the knowledge we have about the ISA the
kernel build is targeting.

This patch introduces a bunch of utility macros for checking for
supported options, ASEs & combinations of those with ISA revisions. It
then makes use of these in the default definitions of cpu_has_* macros.
The result is that many of the macros become compile-time constant,
allowing more optimisation opportunities for the compiler - particularly
with kernels built for later ISA revisions.

To demonstrate the effect of this patch, the following table shows the
size in bytes of the kernel binary as reported by scripts/bloat-o-meter
for v4.12-rc4 maltasmvp_defconfig kernels with & without this patch. A
variant of maltasmvp_defconfig with CONFIG_CPU_MIPS32_R6 selected is
also shown, to demonstrate that MIPSr6 systems benefit more due to extra
features becoming required by that architecture revision. Builds of
pistachio_defconfig are also shown, as although this is a MIPSr2
platform it doesn't hardcode any features in a machine-specific
cpu-feature-overrides.h, which allows it to gain more from this patch
than the equivalent Malta r2 build.

     Config         | Before  | After   |  Change
    ----------------|---------|---------|---------
     maltasmvp      | 7248316 | 7247714 |    -602
     maltasmvp + r6 | 6955595 | 6950777 |   -4818
     pistachio      | 8650977 | 8363898 | -287079

Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/16360/
Cc: Joshua Kinard <kumba@gentoo.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
arch/mips/include/asm/cpu-features.h