RE: [Intel-wired-lan] [PATCH 01/27] timecounter: Make cyclecounter struct part of timecounter struct

2018-01-08 Thread Brown, Aaron F
> From: Intel-wired-lan [mailto:intel-wired-lan-boun...@osuosl.org] On > Behalf Of Sagar Arun Kamble > Sent: Thursday, December 14, 2017 11:38 PM > To: linux-ker...@vger.kernel.org > Cc: alsa-de...@alsa-project.org; linux-r...@vger.kernel.org; > net...@vger.kernel.org; Richard Cochran ; > Stephen B

Re: [PATCH] arm64: Implement branch predictor hardening for Falkor

2018-01-08 Thread Shanker Donthineni
Hi Will/Catalin, Please drop https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?h=kpti&id=79ad24ef6c260efa0614896b15e67f4829448e32 in which you've removed FALKOR MIDR change. I've posted v2 patch series including typo fix & FALKOR MIDR patch which is already available in up

[PATCH v2 1/2] arm64: Define cputype macros for Falkor CPU

2018-01-08 Thread Shanker Donthineni
Add cputype definition macros for Qualcomm Datacenter Technologies Falkor CPU in cputype.h. It's unfortunate that the first revision of the Falkor CPU used the wrong part number 0x800, got fixed in v2 chip with part number 0xC00, and would be used the same value for future revisions. Signed-off-by

[PATCH v2 2/2] arm64: Implement branch predictor hardening for Falkor

2018-01-08 Thread Shanker Donthineni
Falkor is susceptible to branch predictor aliasing and can theoretically be attacked by malicious code. This patch implements a mitigation for these attacks, preventing any malicious entries from affecting other victim contexts. Signed-off-by: Shanker Donthineni --- Changes since v1: Corrected

Re: [PATCH] arm64: Implement branch predictor hardening for Falkor

2018-01-08 Thread Shanker Donthineni
Hi Will, On 01/08/2018 12:44 PM, Will Deacon wrote: > On Mon, Jan 08, 2018 at 05:09:33PM +, Will Deacon wrote: >> On Fri, Jan 05, 2018 at 02:28:59PM -0600, Shanker Donthineni wrote: >>> Falkor is susceptible to branch predictor aliasing and can >>> theoretically be attacked by malicious code.

Re: [PATCH] arm64: Implement branch predictor hardening for Falkor

2018-01-08 Thread Will Deacon
On Mon, Jan 08, 2018 at 05:09:33PM +, Will Deacon wrote: > On Fri, Jan 05, 2018 at 02:28:59PM -0600, Shanker Donthineni wrote: > > Falkor is susceptible to branch predictor aliasing and can > > theoretically be attacked by malicious code. This patch > > implements a mitigation for these attacks

Re: [PATCH] arm64: KVM: Hide PMU from guests when disabled

2018-01-08 Thread Christoffer Dall
On Mon, Jan 08, 2018 at 03:56:29PM +0100, Andrew Jones wrote: > On Mon, Jan 08, 2018 at 03:18:15PM +0100, Christoffer Dall wrote: > > Hi Drew, > > > > On Sat, Nov 25, 2017 at 06:40:31PM +0100, Andrew Jones wrote: > > > Since commit 93390c0a1b20 ("arm64: KVM: Hide unsupported AArch64 CPU > > > feat

Re: [PATCH v6 14/16] firmware: arm_sdei: Discover SDEI support via ACPI

2018-01-08 Thread Lorenzo Pieralisi
On Mon, Jan 08, 2018 at 03:38:16PM +, James Morse wrote: > SDEI defines a new ACPI table to indicate the presence of the interface. > The conduit is discovered in the same way as PSCI. > > For ACPI we need to create the platform device ourselves as SDEI doesn't > have an entry in the DSDT. >

Re: [PATCH] arm64: Implement branch predictor hardening for Falkor

2018-01-08 Thread Shanker Donthineni
Hi Andrew, On 01/08/2018 03:28 AM, Andrew Jones wrote: > Hi Shanker, > > On Fri, Jan 05, 2018 at 02:28:59PM -0600, Shanker Donthineni wrote: > ... >> diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c >> index cb0fb37..daf53a5 100644 >> --- a/arch/arm64/kernel/cpu_errata

Re: [PATCH v6 11/16] firmware: arm_sdei: Add support for CPU and system power states

2018-01-08 Thread Lorenzo Pieralisi
On Mon, Jan 08, 2018 at 03:38:13PM +, James Morse wrote: [...] > +/* When entering idle, mask/unmask events for this cpu */ Just mentioning (since I know you know), this notifier is called also through syscore_ops so it is not just idle (CPUidle or Suspend-to-idle). > +static int sdei_pm_no

Re: [PATCH] arm64: Implement branch predictor hardening for Falkor

2018-01-08 Thread Will Deacon
On Fri, Jan 05, 2018 at 02:28:59PM -0600, Shanker Donthineni wrote: > Falkor is susceptible to branch predictor aliasing and can > theoretically be attacked by malicious code. This patch > implements a mitigation for these attacks, preventing any > malicious entries from affecting other victim cont

Re: [PATCH v5 13/13] KVM: arm64: Emulate RAS error registers and set HCR_EL2's TERR & TEA

2018-01-08 Thread James Morse
Hi, On 15/12/17 15:51, James Morse wrote: > From: Dongjiu Geng > > ARMv8.2 adds a new bit HCR_EL2.TEA which routes synchronous external > aborts to EL2, and adds a trap control bit HCR_EL2.TERR which traps > all Non-secure EL1&0 error record accesses to EL2. > > This patch enables the two bits

Re: [PATCH v5 07/13] KVM: arm/arm64: mask/unmask daif around VHE guests

2018-01-08 Thread James Morse
Hi, On 15/12/17 15:50, James Morse wrote: > Non-VHE systems take an exception to EL2 in order to world-switch into the > guest. When returning from the guest KVM implicitly restores the DAIF > flags when it returns to the kernel at EL1. > > With VHE none of this exception-level jumping happens, s

Re: [PATCH v6 13/16] arm64: acpi: Remove __init from acpi_psci_use_hvc() for use by SDEI

2018-01-08 Thread Lorenzo Pieralisi
On Mon, Jan 08, 2018 at 03:38:15PM +, James Morse wrote: > SDEI inherits the 'use hvc' bit that is also used by PSCI. PSCI does all > its initialisation early, SDEI does its late. > > Remove the __init annotation from acpi_psci_use_hvc(). > > Signed-off-by: James Morse > Acked-by: Catalin Ma

[PATCH v6 10/16] arm64: kernel: Add arch-specific SDEI entry code and CPU masking

2018-01-08 Thread James Morse
The Software Delegated Exception Interface (SDEI) is an ARM standard for registering callbacks from the platform firmware into the OS. This is typically used to implement RAS notifications. Such notifications enter the kernel at the registered entry-point with the register values of the interrupte

[PATCH v6 05/16] KVM: arm64: Stop save/restoring host tpidr_el1 on VHE

2018-01-08 Thread James Morse
Now that a VHE host uses tpidr_el2 for the cpu offset we no longer need KVM to save/restore tpidr_el1. Move this from the 'common' code into the non-vhe code. While we're at it, on VHE we don't need to save the ELR or SPSR as kernel_entry in entry.S will have pushed these onto the kernel stack, and

[PATCH v6 16/16] arm64: sdei: Add trampoline code for remapping the kernel

2018-01-08 Thread James Morse
When CONFIG_UNMAP_KERNEL_AT_EL0 is set the SDEI entry point and the rest of the kernel may be unmapped when we take an event. If this may be the case, use an entry trampoline that can switch to the kernel page tables. We can't use the provided PSTATE to determine whether to switch page tables as w

[PATCH v6 09/16] arm64: uaccess: Add PAN helper

2018-01-08 Thread James Morse
Add __uaccess_{en,dis}able_hw_pan() helpers to set/clear the PSTATE.PAN bit. Signed-off-by: James Morse --- arch/arm64/include/asm/uaccess.h | 12 arch/arm64/kernel/suspend.c | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/uacce

[PATCH v6 07/16] firmware: arm_sdei: Add driver for Software Delegated Exceptions

2018-01-08 Thread James Morse
The Software Delegated Exception Interface (SDEI) is an ARM standard for registering callbacks from the platform firmware into the OS. This is typically used to implement firmware notifications (such as firmware-first RAS) or promote an IRQ that has been promoted to a firmware-assisted NMI. Add th

[PATCH v6 12/16] firmware: arm_sdei: add support for CPU private events

2018-01-08 Thread James Morse
Private SDE events are per-cpu, and need to be registered and enabled on each CPU. Hide this detail from the caller by adapting our {,un}register and {en,dis}able calls to send an IPI to each CPU if the event is private. CPU private events are unregistered when the CPU is powered-off, and re-regi

[PATCH v6 14/16] firmware: arm_sdei: Discover SDEI support via ACPI

2018-01-08 Thread James Morse
SDEI defines a new ACPI table to indicate the presence of the interface. The conduit is discovered in the same way as PSCI. For ACPI we need to create the platform device ourselves as SDEI doesn't have an entry in the DSDT. The SDEI platform device should be created after ACPI has been initialise

[PATCH v6 08/16] arm64: Add vmap_stack header file

2018-01-08 Thread James Morse
Today the arm64 arch code allocates an extra IRQ stack per-cpu. If we also have SDEI and VMAP stacks we need two extra per-cpu VMAP stacks. Move the VMAP stack allocation out to a helper in a new header file. This avoids missing THREADINFO_GFP, or getting the all-important alignment wrong. Signed

[PATCH v6 15/16] arm64: mmu: add the entry trampolines start/end section markers into sections.h

2018-01-08 Thread James Morse
SDEI needs to calculate an offset in the trampoline page too. Move the extern char[] to sections.h. This patch just moves code around. Signed-off-by: James Morse --- (fixed typo in commit message) arch/arm64/include/asm/sections.h | 1 + arch/arm64/mm/mmu.c | 2 -- 2 files change

[PATCH v6 03/16] KVM: arm64: Change hyp_panic()s dependency on tpidr_el2

2018-01-08 Thread James Morse
Make tpidr_el2 a cpu-offset for per-cpu variables in the same way the host uses tpidr_el1. This lets tpidr_el{1,2} have the same value, and on VHE they can be the same register. KVM calls hyp_panic() when anything unexpected happens. This may occur while a guest owns the EL1 registers. KVM stashes

[PATCH v6 11/16] firmware: arm_sdei: Add support for CPU and system power states

2018-01-08 Thread James Morse
When a CPU enters an idle lower-power state or is powering off, we need to mask SDE events so that no events can be delivered while we are messing with the MMU as the registered entry points won't be valid. If the system reboots, we want to unregister all events and mask the CPUs. For kexec this a

[PATCH v6 06/16] Docs: dt: add devicetree binding for describing arm64 SDEI firmware

2018-01-08 Thread James Morse
The Software Delegated Exception Interface (SDEI) is an ARM standard for registering callbacks from the platform firmware into the OS. This is typically used to implement RAS notifications, or from an IRQ that has been promoted to a firmware-assisted NMI. Add a new devicetree binding to describe t

[PATCH v6 13/16] arm64: acpi: Remove __init from acpi_psci_use_hvc() for use by SDEI

2018-01-08 Thread James Morse
SDEI inherits the 'use hvc' bit that is also used by PSCI. PSCI does all its initialisation early, SDEI does its late. Remove the __init annotation from acpi_psci_use_hvc(). Signed-off-by: James Morse Acked-by: Catalin Marinas --- The function name is unchanged as this bit is named 'PSCI_USE_HV

[PATCH v6 04/16] arm64: alternatives: use tpidr_el2 on VHE hosts

2018-01-08 Thread James Morse
Now that KVM uses tpidr_el2 in the same way as Linux's cpu_offset in tpidr_el1, merge the two. This saves KVM from save/restoring tpidr_el1 on VHE hosts, and allows future code to blindly access per-cpu variables without triggering world-switch. Signed-off-by: James Morse Reviewed-by: Christoffer

[PATCH v6 02/16] KVM: arm/arm64: Convert kvm_host_cpu_state to a static per-cpu allocation

2018-01-08 Thread James Morse
kvm_host_cpu_state is a per-cpu allocation made from kvm_arch_init() used to store the host EL1 registers when KVM switches to a guest. Make it easier for ASM to generate pointers into this per-cpu memory by making it a static allocation. Signed-off-by: James Morse Acked-by: Christoffer Dall --

[PATCH v6 01/16] KVM: arm64: Store vcpu on the stack during __guest_enter()

2018-01-08 Thread James Morse
KVM uses tpidr_el2 as its private vcpu register, which makes sense for non-vhe world switch as only KVM can access this register. This means vhe Linux has to use tpidr_el1, which KVM has to save/restore as part of the host context. If the SDEI handler code runs behind KVMs back, it mustn't access

[PATCH v6 00/16] arm64/firmware: Software Delegated Exception Interface

2018-01-08 Thread James Morse
This series is rebased onto arm64's kpti-base tag, with v2 of Will's kpti series[0]. The changes were only due to code moving around, but its now all been tested together. As before patches 15 and 16 contain the extra kpti trampoline stuff. The Software Delegated Exception Interface (SDEI) is an A

Re: [PATCH] arm64: KVM: Hide PMU from guests when disabled

2018-01-08 Thread Andrew Jones
On Mon, Jan 08, 2018 at 03:18:15PM +0100, Christoffer Dall wrote: > Hi Drew, > > On Sat, Nov 25, 2017 at 06:40:31PM +0100, Andrew Jones wrote: > > Since commit 93390c0a1b20 ("arm64: KVM: Hide unsupported AArch64 CPU > > features from guests") we can hide cpu features from guests. Apply > > this to

Re: [PATCH v5 00/30] ARM Scalable Vector Extension (SVE)

2018-01-08 Thread Yury Norov
e that this is SVE-related issue because if I disable ARM64_SVE in config, everything becomes working. I didn't get deep enough into this yet, and most probably there's some stupid reason for crashing apps on my side, but in mail list I found some sve-related patches that I cannot ap

Re: [PATCH] arm64: KVM: Hide PMU from guests when disabled

2018-01-08 Thread Christoffer Dall
Hi Drew, On Sat, Nov 25, 2017 at 06:40:31PM +0100, Andrew Jones wrote: > Since commit 93390c0a1b20 ("arm64: KVM: Hide unsupported AArch64 CPU > features from guests") we can hide cpu features from guests. Apply > this to a long standing issue where guests see a PMU available, but > it's not, becau

[PATCH v2] KVM: arm/arm64: vgic-its: Fix vgicv4 init

2018-01-08 Thread Eric Auger
Commit 3d1ad640f8c94 ("KVM: arm/arm64: Fix GICv4 ITS initialization issues") moved the vgic_supports_direct_msis() check in vgic_v4_init(). However when vgic_v4_init is called from vgic_its_create(), the has_its field is not yet set. Hence vgic_supports_direct_msis returns false and vgic_v4_init do

Re: [PATCH] arm64: Implement branch predictor hardening for Falkor

2018-01-08 Thread Andrew Jones
Hi Shanker, On Fri, Jan 05, 2018 at 02:28:59PM -0600, Shanker Donthineni wrote: ... > diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c > index cb0fb37..daf53a5 100644 > --- a/arch/arm64/kernel/cpu_errata.c > +++ b/arch/arm64/kernel/cpu_errata.c > @@ -54,6 +54,8 @@ stati