Commit Graph

71 Commits

Author SHA1 Message Date
Diep Quynh
944f9ff0e8 ARM64: configs: Disable zswap, vnswap
Signed-off-by: Diep Quynh <remilia.1505@gmail.com>
2020-08-19 11:34:37 +05:30
Diep Quynh
a1179e073a ARM64: configs: Enable zram, zstd compressor
Signed-off-by: Diep Quynh <remilia.1505@gmail.com>
Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
2020-08-19 11:34:37 +05:30
Diep Quynh
c771c0ae02 ARM64: configs: Enable IRQ time accounting
Account for extra IRQ load from such events like display rendering, touch events, etc...
that needs bandwidth raise for optimal performance

Signed-off-by: Diep Quynh <remilia.1505@gmail.com>
Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
2020-08-19 11:34:37 +05:30
Diep Quynh
e86408a967 ARM64: configs: Disable exynos-dm debugging for exynos-ss
Using debuggers on clock scaling unit causes performance degradation
on production units. Let's disable it from now

Signed-off-by: Diep Quynh <remilia.1505@gmail.com>
Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
2020-08-19 11:34:37 +05:30
kerneltoast
6595426214 ARM64: configs: Define cpumasks
Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
2020-08-19 11:34:23 +05:30
Sultan Alsawaf
a71c1ead58 cpumask: Add cpumasks for big and LITTLE CPU clusters
Add cpu_lp_mask and cpu_perf_mask to represent the CPUs that belong to
each cluster in a dual-cluster, heterogeneous system.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
2020-08-18 23:10:21 +05:30
Jesse Chan
5b4d3225d2 ARM64: configs: Disable FIFS 2020-08-18 22:09:25 +05:30
prashantpaddune
bbfaf01718 defconfig: Enable BOEFFLA_WL_BLOCKER 2020-08-18 22:03:08 +05:30
Diep Quynh
21ca15f70d ARM64: configs: Enable DriveDroid storage support 2020-08-18 21:44:06 +05:30
prashantpaddune
7fff0e9951 ARM64: configs: Enable Power Efficient Workqueue 2020-08-18 21:34:02 +05:30
djb77
d81ef26cef defconfig: Enable USB_CONFIGFS_MASS_STORAGE 2020-08-18 21:29:50 +05:30
BlackGunZ
224a46cc60 arm64: kernel: Default debugging to off 2020-08-18 21:21:56 +05:30
BlackGunZ
78e7b9059a ARM64: configs: Disable some more debugging functions 2020-08-18 21:21:28 +05:30
prashantpaddune
48bd579a3a defconfigs: Enable wireguard 2020-08-18 21:19:07 +05:30
prashantpaddune
671d649fa8 A750FNPUU4CTE3 2020-08-18 17:44:51 +05:30
prashantpaddune
afd412249c dts: increase minimum freq 2020-04-09 14:54:44 +05:30
prashantpaddune
669172a5fa fix my stupid typo 2020-04-08 16:24:30 +05:30
prashantpaddune
bb1e083ed4 defconfig: Enable state notifier 2020-04-08 12:48:37 +02:00
prashantpaddune
6a799beaa1 dtb: Lower the min freq limit of the CPU
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:35:20 +02:00
djb77
bf7da277a5 defconfig: Enable SCHEDUTIL Governor 2020-04-08 11:30:30 +02:00
djb77
b1f1dfd69b cpufreq: Add BIOSHOCK governor
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:29:27 +02:00
djb77
4987f7b57e cpufreq: Add DARKNESS governor
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:28:29 +02:00
engstk
7233c6d23a cpufreq: Add BLU_ACTIVE governor
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:25:10 +02:00
Joe Maples
12c22648f0 block: Add Maple I/O Scheduler
Adapted to State Notifier by @farovitus

Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:24:18 +02:00
andip71
de23aa06ae block: Add ZEN v2 scheduler
Signed-off-by: andip71 <andreasp@gmx.de>
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:23:50 +02:00
andip71
2770b840af block: Add VR scheduler
Signed-off-by: andip71 <andreasp@gmx.de>
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:23:18 +02:00
andip71
e14797c423 block: Add TRIPNDROID scheduler
Signed-off-by: andip71 <andreasp@gmx.de>
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:22:45 +02:00
andip71
62f3029a5c block: Add SIOPLUS scheduler
Signed-off-by: andip71 <andreasp@gmx.de>
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:22:13 +02:00
andip71
5d4baa68a8 block: Add FIFO scheduler
Signed-off-by: andip71 <andreasp@gmx.de>
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:21:39 +02:00
andip71
b8a7393f07 block: Add SIO scheduler
Signed-off-by: andip71 <andreasp@gmx.de>
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:20:51 +02:00
andip71
f2225b03b6 block: add FIOPS scheduler
Signed-off-by: andip71 <andreasp@gmx.de>
Signed-off-by: djb77 <dwayne.bakewell@gmail.com>
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:19:48 +02:00
DarkLord1731
bb02460a50 defconfig: Enable BFQ IO Scheduler
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:18:14 +02:00
DarkLord1731
9252298ae9 defconfig: Enable available cpu governors, deadline IO scheduler and TCP algorithms 2020-04-08 11:16:14 +02:00
prashantpaddune
7b285d6d30 defconfig:fix CC_STACKPROTECTOR_STRONG override warning
Signed-off-by: prashantpaddune <elonpras@my.smccd.edu>
2020-04-08 11:12:19 +02:00
prashantpaddune
aba2d18cee arm64: smp: fix compile errors 2020-04-07 18:00:22 +05:30
Cristian Marussi
f5c517bbcb arm64: smp: fix smp_send_stop() behaviour
commit d0bab0c39e32d39a8c5cddca72e5b4a3059fe050 upstream.

On a system with only one CPU online, when another one CPU panics while
starting-up, smp_send_stop() will fail to send any STOP message to the
other already online core, resulting in a system still responsive and
alive at the end of the panic procedure.

[  186.700083] CPU3: shutdown
[  187.075462] CPU2: shutdown
[  187.162869] CPU1: shutdown
[  188.689998] ------------[ cut here ]------------
[  188.691645] kernel BUG at arch/arm64/kernel/cpufeature.c:886!
[  188.692079] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[  188.692444] Modules linked in:
[  188.693031] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 5.6.0-rc4-00001-g338d25c35a98 #104
[  188.693175] Hardware name: Foundation-v8A (DT)
[  188.693492] pstate: 200001c5 (nzCv dAIF -PAN -UAO)
[  188.694183] pc : has_cpuid_feature+0xf0/0x348
[  188.694311] lr : verify_local_elf_hwcaps+0x84/0xe8
[  188.694410] sp : ffff800011b1bf60
[  188.694536] x29: ffff800011b1bf60 x28: 0000000000000000
[  188.694707] x27: 0000000000000000 x26: 0000000000000000
[  188.694801] x25: 0000000000000000 x24: ffff80001189a25c
[  188.694905] x23: 0000000000000000 x22: 0000000000000000
[  188.694996] x21: ffff8000114aa018 x20: ffff800011156a38
[  188.695089] x19: ffff800010c944a0 x18: 0000000000000004
[  188.695187] x17: 0000000000000000 x16: 0000000000000000
[  188.695280] x15: 0000249dbde5431e x14: 0262cbe497efa1fa
[  188.695371] x13: 0000000000000002 x12: 0000000000002592
[  188.695472] x11: 0000000000000080 x10: 00400032b5503510
[  188.695572] x9 : 0000000000000000 x8 : ffff800010c80204
[  188.695659] x7 : 00000000410fd0f0 x6 : 0000000000000001
[  188.695750] x5 : 00000000410fd0f0 x4 : 0000000000000000
[  188.695836] x3 : 0000000000000000 x2 : ffff8000100939d8
[  188.695919] x1 : 0000000000180420 x0 : 0000000000180480
[  188.696253] Call trace:
[  188.696410]  has_cpuid_feature+0xf0/0x348
[  188.696504]  verify_local_elf_hwcaps+0x84/0xe8
[  188.696591]  check_local_cpu_capabilities+0x44/0x128
[  188.696666]  secondary_start_kernel+0xf4/0x188
[  188.697150] Code: 52805001 72a00301 6b01001f 54000ec0 (d4210000)
[  188.698639] ---[ end trace 3f12ca47652f7b72 ]---
[  188.699160] Kernel panic - not syncing: Attempted to kill the idle task!
[  188.699546] Kernel Offset: disabled
[  188.699828] CPU features: 0x00004,20c02008
[  188.700012] Memory Limit: none
[  188.700538] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---

[root@arch ~]# echo Helo
Helo
[root@arch ~]# cat /proc/cpuinfo | grep proce
processor	: 0

Make smp_send_stop() account also for the online status of the calling CPU
while evaluating how many CPUs are effectively online: this way, the right
number of STOPs is sent, so enforcing a proper freeze of the system at the
end of panic even under the above conditions.

Fixes: 08e875c16a16c ("arm64: SMP support")
Reported-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 14:23:10 +02:00
Dirk Behme
f873620d53 arm64: kbuild: remove compressed images on 'make ARCH=arm64 (dist)clean'
commit d7bbd6c1b01cb5dd13c245d4586a83145c1d5f52 upstream.

Since v4.3-rc1 commit 0723c05fb75e44 ("arm64: enable more compressed
Image formats"), it is possible to build Image.{bz2,lz4,lzma,lzo}
AArch64 images. However, the commit missed adding support for removing
those images on 'make ARCH=arm64 (dist)clean'.

Fix this by adding them to the target list.
Make sure to match the order of the recipes in the makefile.

Cc: stable@vger.kernel.org # v4.3+
Fixes: 0723c05fb75e44 ("arm64: enable more compressed Image formats")
Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 13:48:08 +02:00
Andre Przywara
63007051e1 arm64: dts: juno: Fix UART frequency
[ Upstream commit 39a1a8941b27c37f79508426e27a2ec29829d66c ]

Older versions of the Juno *SoC* TRM [1] recommended that the UART clock
source should be 7.2738 MHz, whereas the *system* TRM [2] stated a more
correct value of 7.3728 MHz. Somehow the wrong value managed to end up in
our DT.

Doing a prime factorisation, a modulo divide by 115200 and trying
to buy a 7.2738 MHz crystal at your favourite electronics dealer suggest
that the old value was actually a typo. The actual UART clock is driven
by a PLL, configured via a parameter in some board.txt file in the
firmware, which reads 7.37 MHz (sic!).

Fix this to correct the baud rate divisor calculation on the Juno board.

[1] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0515b.b/DDI0515B_b_juno_arm_development_platform_soc_trm.pdf
[2] http://infocenter.arm.com/help/topic/com.arm.doc.100113_0000_07_en/arm_versatile_express_juno_development_platform_(v2m_juno)_technical_reference_manual_100113_0000_07_en.pdf

Fixes: 71f867ec130e ("arm64: Add Juno board device tree.")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 13:44:22 +02:00
Dinh Nguyen
a9059f17cc arm64: dts: agilex/stratix10: fix pmu interrupt numbers
[ Upstream commit 210de0e996aee8e360ccc9e173fe7f0a7ed2f695 ]

Fix up the correct interrupt numbers for the PMU unit on Agilex
and Stratix10.

Fixes: 78cd6a9d8e15 ("arm64: dts: Add base stratix 10 dtsi")
Cc: linux-stable <stable@vger.kernel.org>
Reported-by: Meng Li <Meng.Li@windriver.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 13:38:23 +02:00
Yunfeng Ye
9a0a49d325 arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill()
[ Upstream commit bfcef4ab1d7ee8921bc322109b1692036cc6cbe0 ]

In cases like suspend-to-disk and suspend-to-ram, a large number of CPU
cores need to be shut down. At present, the CPU hotplug operation is
serialised, and the CPU cores can only be shut down one by one. In this
process, if PSCI affinity_info() does not return LEVEL_OFF quickly,
cpu_psci_cpu_kill() needs to wait for 10ms. If hundreds of CPU cores
need to be shut down, it will take a long time.

Normally, there is no need to wait 10ms in cpu_psci_cpu_kill(). So
change the wait interval from 10 ms to max 1 ms and use usleep_range()
instead of msleep() for more accurate timer.

In addition, reducing the time interval will increase the messages
output, so remove the "Retry ..." message, instead, track time and
output to the the sucessful message.

Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 13:20:51 +02:00
Suzuki K Poulose
7e8778d6dc arm64: smp: Handle errors reported by the firmware
[ Upstream commit f357b3a7e17af7736d67d8267edc1ed3d1dd9391 ]

The __cpu_up() routine ignores the errors reported by the firmware
for a CPU bringup operation and looks for the error status set by the
booting CPU. If the CPU never entered the kernel, we could end up
in assuming stale error status, which otherwise would have been
set/cleared appropriately by the booting CPU.

Reported-by: Steve Capper <steve.capper@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 12:41:12 +02:00
Hari Vyas
fc56e16041 arm64: fix for bad_mode() handler to always result in panic
commit e4ba15debcfd27f60d43da940a58108783bff2a6 upstream.

The bad_mode() handler is called if we encounter an uunknown exception,
with the expectation that the subsequent call to panic() will halt the
system. Unfortunately, if the exception calling bad_mode() is taken from
EL0, then the call to die() can end up killing the current user task and
calling schedule() instead of falling through to panic().

Remove the die() call altogether, since we really want to bring down the
machine in this "impossible" case.

Signed-off-by: Hari Vyas <hari.vyas@broadcom.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 12:36:56 +02:00
Pavel Tatashin
63dc5494aa arm64: uaccess: Ensure PAN is re-enabled after unhandled uaccess fault
commit 94bb804e1e6f0a9a77acf20d7c70ea141c6c821e upstream.

A number of our uaccess routines ('__arch_clear_user()' and
'__arch_copy_{in,from,to}_user()') fail to re-enable PAN if they
encounter an unhandled fault whilst accessing userspace.

For CPUs implementing both hardware PAN and UAO, this bug has no effect
when both extensions are in use by the kernel.

For CPUs implementing hardware PAN but not UAO, this means that a kernel
using hardware PAN may execute portions of code with PAN inadvertently
disabled, opening us up to potential security vulnerabilities that rely
on userspace access from within the kernel which would usually be
prevented by this mechanism. In other words, parts of the kernel run the
same way as they would on a CPU without PAN implemented/emulated at all.

For CPUs not implementing hardware PAN and instead relying on software
emulation via 'CONFIG_ARM64_SW_TTBR0_PAN=y', the impact is unfortunately
much worse. Calling 'schedule()' with software PAN disabled means that
the next task will execute in the kernel using the page-table and ASID
of the previous process even after 'switch_mm()', since the actual
hardware switch is deferred until return to userspace. At this point, or
if there is a intermediate call to 'uaccess_enable()', the page-table
and ASID of the new process are installed. Sadly, due to the changes
introduced by KPTI, this is not an atomic operation and there is a very
small window (two instructions) where the CPU is configured with the
page-table of the old task and the ASID of the new task; a speculative
access in this state is disastrous because it would corrupt the TLB
entries for the new task with mappings from the previous address space.

As Pavel explains:

  | I was able to reproduce memory corruption problem on Broadcom's SoC
  | ARMv8-A like this:
  |
  | Enable software perf-events with PERF_SAMPLE_CALLCHAIN so userland's
  | stack is accessed and copied.
  |
  | The test program performed the following on every CPU and forking
  | many processes:
  |
  |	unsigned long *map = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE,
  |				  MAP_SHARED | MAP_ANONYMOUS, -1, 0);
  |	map[0] = getpid();
  |	sched_yield();
  |	if (map[0] != getpid()) {
  |		fprintf(stderr, "Corruption detected!");
  |	}
  |	munmap(map, PAGE_SIZE);
  |
  | From time to time I was getting map[0] to contain pid for a
  | different process.

Ensure that PAN is re-enabled when returning after an unhandled user
fault from our uaccess routines.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Cc: <stable@vger.kernel.org>
Fixes: 338d4f49d6f7 ("arm64: kernel: Add support for Privileged Access Never")
Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
[will: rewrote commit message]
[will: backport for 4.4.y stable kernels]
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 12:33:30 +02:00
Rob Herring
4a40e93e57 arm64: dts: amd: Fix SPI bus warnings
[ Upstream commit e9f0878c4b2004ac19581274c1ae4c61ae3ca70e ]

dtc has new checks for SPI buses. Fix the warnings in node names.

arch/arm64/boot/dts/amd/amd-overdrive.dtb: Warning (spi_bus_bridge): /smb/ssp@e1030000: node name for SPI buses should be 'spi'
arch/arm64/boot/dts/amd/amd-overdrive-rev-b0.dtb: Warning (spi_bus_bridge): /smb/ssp@e1030000: node name for SPI buses should be 'spi'
arch/arm64/boot/dts/amd/amd-overdrive-rev-b1.dtb: Warning (spi_bus_bridge): /smb/ssp@e1030000: node name for SPI buses should be 'spi'

Cc: Brijesh Singh <brijeshkumar.singh@amd.com>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 12:30:49 +02:00
prashantpaddune
40c2bb494f arch:arm64:mm: fix errors 2020-04-07 11:52:03 +05:30
Suzuki K Poulose
1d46b4c484 arm64: Rename cpuid_feature field extract routines
commit 28c5dcb22f90113dea101b0421bc6971bccb7a74 upstream

Now that we have a clear understanding of the sign of a feature,
rename the routines to reflect the sign, so that it is not misused.
The cpuid_feature_extract_field() now accepts a 'sign' parameter.

This makes sure that the arm64_ftr_value() extracts the feature
field properly for signed fields.

Cc: stable@vger.kernel.org # v4.4
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 08:13:34 +02:00
Suzuki K Poulose
1c5423a633 arm64: capabilities: Handle sign of the feature bit
commit ff96f7bc7bf6393eef8ff2bde1279715ce13343a usptream

Use the appropriate accessor for the feature bit by keeping
track of the sign of the feature.

This is a pre-requisite for the commit 28c5dcb22f90 upstream,
which fixes the arm64_ftr_value() for signed feature fields.

Cc: stable@vger.kernel.org # v4.4
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 08:09:57 +02:00
Will Deacon
d6cfd0cce7 arm64: compat: Allow single-byte watchpoints on all addresses
commit 849adec41203ac5837c40c2d7e08490ffdef3c2c upstream.

Commit d968d2b801d8 ("ARM: 7497/1: hw_breakpoint: allow single-byte
watchpoints on all addresses") changed the validation requirements for
hardware watchpoints on arch/arm/. Update our compat layer to implement
the same relaxation.

Cc: <stable@vger.kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-06 20:50:03 +02:00
Will Deacon
064fe34afc arm64: cpufeature: Fix feature comparison for CTR_EL0.{CWG,ERG}
commit 147b9635e6347104b91f48ca9dca61eb0fbf2a54 upstream.

If CTR_EL0.{CWG,ERG} are 0b0000 then they must be interpreted to have
their architecturally maximum values, which defeats the use of
FTR_HIGHER_SAFE when sanitising CPU ID registers on heterogeneous
machines.

Introduce FTR_HIGHER_OR_ZERO_SAFE so that these fields effectively
saturate at zero.

Fixes: 3c739b571084 ("arm64: Keep track of CPU feature registers")
Cc: <stable@vger.kernel.org> # 4.4.y only
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-06 20:27:55 +02:00
Will Deacon
c88e6c2af2 arm64: cpufeature: Fix CTR_EL0 field definitions
commit be68a8aaf925aaf35574260bf820bb09d2f9e07f upstream.

Our field definitions for CTR_EL0 suffer from a number of problems:

  - The IDC and DIC fields are missing, which causes us to enable CTR
    trapping on CPUs with either of these returning non-zero values.

  - The ERG is FTR_LOWER_SAFE, whereas it should be treated like CWG as
    FTR_HIGHER_SAFE so that applications can use it to avoid false sharing.

  - [nit] A RES1 field is described as "RAO"

This patch updates the CTR_EL0 field definitions to fix these issues.

Cc: <stable@vger.kernel.org> # 4.4.y only
Cc: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-06 20:27:52 +02:00