Re: [RFC PATCH 6/8] arm64/sve: Move sve_pffr() to fpsimd.h and make inline

2018-04-25 Thread Catalin Marinas
On Fri, Apr 20, 2018 at 05:46:40PM +0100, Dave P Martin wrote: > In order to make sve_save_state()/sve_load_state() more easily > reusable and to get rid of a potential branch on context switch > critical paths, this patch makes sve_pffr() inline and moves it to > fpsimd.h. > > must be included i

Re: [RFC PATCH 5/8] arm64/sve: Switch sve_pffr() argument from task to thread

2018-04-25 Thread Catalin Marinas
On Fri, Apr 20, 2018 at 05:46:39PM +0100, Dave P Martin wrote: > sve_pffr(), which is used to derive the base address used for > low-level SVE save/restore routines, currently takes the relevant > task_struct as an argument. > > The only accessed fields are actually part of thread_struct, so > thi

Re: [RFC PATCH 4/8] arm64/sve: Move read_zcr_features() out of cpufeature.h

2018-04-25 Thread Catalin Marinas
On Fri, Apr 20, 2018 at 05:46:38PM +0100, Dave P Martin wrote: > Having read_zcr_features() inline in cpufeature.h results in that > header requiring #includes which make it hard to include > elsewhere without triggering header inclusion > cycles. > > This is not a hot-path function and arguably

Re: [PATCH v2 09/17] kvm: arm64: Make stage2 page table layout dynamic

2018-04-25 Thread Suzuki K Poulose
On 25/04/18 17:35, Julien Grall wrote: Hi Suzuki, On 27/03/18 14:15, Suzuki K Poulose wrote: So far we had a static stage2 page table handling code, based on a fixed IPA of 40bits. As we prepare for a configurable IPA size per VM, make the our stage2 page table code dynamic to do the right thin

Re: [PATCH v2 09/17] kvm: arm64: Make stage2 page table layout dynamic

2018-04-25 Thread Julien Grall
Hi Suzuki, On 27/03/18 14:15, Suzuki K Poulose wrote: So far we had a static stage2 page table handling code, based on a fixed IPA of 40bits. As we prepare for a configurable IPA size per VM, make the our stage2 page table code dynamic to do the right thing for a given VM. Support for the IPA s

Re: [PATCH v2 13/17] kvm: arm/arm64: Allow tuning the physical address size for VM

2018-04-25 Thread Suzuki K Poulose
On 25/04/18 17:10, Julien Grall wrote: Hi Suzuki, On 27/03/18 14:15, Suzuki K Poulose wrote: Allow specifying the physical address size for a new VM via the kvm_type argument for KVM_CREATE_VM ioctl. This allows us to finalise the stage2 page table format as early as possible and hence perform

[PATCH 3/3] KVM: arm/arm64: vgic: fix possible spectre-v1 in vgic_mmio_read_apr()

2018-04-25 Thread Mark Rutland
It's possible for userspace to control n. Sanitize n when using it as an array index. Note that while it appears that n must be bound to the interval [0,3] due to the way it is extracted from addr, we cannot guarantee that compiler transformations (and/or future refactoring) will ensure this is th

[PATCH 2/3] KVM: arm/arm64: vgic: fix possible spectre-v1 in vgic_get_irq()

2018-04-25 Thread Mark Rutland
It's possible for userspace to control intid. Sanitize intid when using it as an array index. At the same time, sort the includes when adding . Found by smatch. Signed-off-by: Mark Rutland Cc: Christoffer Dall Cc: Marc Zyngier Cc: kvmarm@lists.cs.columbia.edu --- virt/kvm/arm/vgic/vgic.c | 1

[PATCH 1/3] arm64: fix possible spectre-v1 in ptrace_hbp_get_event()

2018-04-25 Thread Mark Rutland
It's possible for userspace to control idx. Sanitize idx when using it as an array index. Found by smatch. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/kernel/ptrace.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/ar

[PATCH 0/3] arm64/kvm spectre-v1 fixes

2018-04-25 Thread Mark Rutland
These patches fix arm64-specific potential spectre-v1 gadgets found by smatch when run over v4.17-rc2. I'm still building up my smatch database, so it's possible that there are further gadgets to be found. For the moment I've ignored issues which appear to be cross-architecture. Thanks, Mark. M

Re: [PATCH v2 13/17] kvm: arm/arm64: Allow tuning the physical address size for VM

2018-04-25 Thread Julien Grall
Hi Suzuki, On 27/03/18 14:15, Suzuki K Poulose wrote: Allow specifying the physical address size for a new VM via the kvm_type argument for KVM_CREATE_VM ioctl. This allows us to finalise the stage2 page table format as early as possible and hence perform the right checks on the memory slots wit

Re: [PATCH 0/5] KVM/arm fixes for 4.17-rc2

2018-04-25 Thread Radim Krčmář
2018-04-20 17:07+0100, Marc Zyngier: > Radim, Paolo, > > Here is the first batch of KVM/arm fixes post 4.17 merge window. Not a > lot to report, apart from the slightly scary VMID allocation race that > has been sitting there from day 1. > > Please pull. Pulled, thanks. _

Re: [PATCHv3 11/11] arm64: docs: document pointer authentication

2018-04-25 Thread Catalin Marinas
On Tue, Apr 17, 2018 at 07:37:35PM +0100, Mark Rutland wrote: > +Basic support > +- > + > +When CONFIG_ARM64_PTR_AUTH is selected, and relevant HW support is > +present, the kernel will assign a random APIAKey value to each process > +at exec*() time. This key is shared by all threads w

Re: [PATCHv3 07/11] arm64: add basic pointer authentication support

2018-04-25 Thread Catalin Marinas
Hi Mark, On Tue, Apr 17, 2018 at 07:37:31PM +0100, Mark Rutland wrote: > diff --git a/arch/arm64/include/asm/mmu_context.h > b/arch/arm64/include/asm/mmu_context.h > index 39ec0b8a689e..caf0d3010112 100644 > --- a/arch/arm64/include/asm/mmu_context.h > +++ b/arch/arm64/include/asm/mmu_context.h >

[PATCH kvmtool 3/3] arm/gic: move GICv2M gadget size into private header

2018-04-25 Thread Andre Przywara
The header files in arm/aarch*/include/asm/ are directly copied from Linux, so we can't just put our own definitions in there. Move the GICv2M MMIO frame size into a more private header, to avoid breaking the build once the header files are synced from Linux. Signed-off-by: Andre Przywara --- ar

[PATCH kvmtool 2/3] arm/gic: avoid GICv2m MMIO frame overlap

2018-04-25 Thread Andre Przywara
Currently we accidentally overlap the GICv2m MMIO frame with the CPU interface region. Fix this by moving the v2m frame below the CPUI region. Signed-off-by: Andre Przywara --- arm/gic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/gic.c b/arm/gic.c index dd4d747d..238

[PATCH kvmtool 0/3] arm/gic: minor fixes to ITS and GICv2m

2018-04-25 Thread Andre Przywara
Three minor fixes I stumbled upon when hacking around in kvmtool. Not sure how the v2m support actually worked at the moment. We might want to look at some MMIO space allocation algorithm to use for the GIC as well, possibly merging it with the virtio MMIO allocation we already have in place (virti

[PATCH kvmtool 1/3] arm/gic: remove extra 64K from ITS allocation

2018-04-25 Thread Andre Przywara
The KVM_VGIC_V3_ITS_SIZE macro from the Linux API header file already covers the doorbell page, so we don't need to add that extra page size in our code. Signed-off-by: Andre Przywara --- arm/gic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arm/gic.c b/arm/gic.c inde