Re: [PATCH V2 2/7] arm64: mm: Flip kernel VA space

2018-01-02 Thread Steve Capper
On Mon, Dec 18, 2017 at 09:47:31PM +, Steve Capper wrote: > Put the direct linear map in the lower addresses of the kernel VA range > and everything else in the higher ranges. > > This allows us to make room for an inline KASAN shadow that operates > under both 48 and 52 bit

Re: [PATCH v3 14/19] KVM: arm/arm64: Move HYP IO VAs to the "idmap" range

2017-12-20 Thread Steve Capper
Hi Marc, On Mon, Dec 18, 2017 at 05:39:21PM +, Marc Zyngier wrote: > We so far mapped our HYP IO (which is essencially the GICv2 control > registers) using the same method as for memory. It recently appeared > that is a bit unsafe: > > we compute the HYP VA using the kern_hyp_va helper, but t

Re: [PATCH v3 05/19] arm64: alternatives: Add dynamic patching feature

2017-12-19 Thread Steve Capper
Hi Marc, On Mon, Dec 18, 2017 at 05:39:12PM +, Marc Zyngier wrote: > We've so far relied on a patching infrastructure that only gave us > a single alternative, without any way to finely control what gets > patched. For a single feature, this is an all or nothing thing. > > It would be interes

[PATCH V2 5/7] arm64: dump: Make kernel page table dumper dynamic again

2017-12-18 Thread Steve Capper
can be computed at boot time. Signed-off-by: Steve Capper --- arch/arm64/mm/dump.c | 58 ++-- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index d1814b247d4b..4a3e71046cb2 100644 --- a

[PATCH V2 6/7] arm64: mm: Make VA_BITS variable, introduce VA_BITS_MIN

2017-12-18 Thread Steve Capper
ional page table levels are required for the idmap. We used to check for #ifdef CONFIG_ARM64_VA_BITS_48 which does not work when moving up to 52-bits. Signed-off-by: Steve Capper --- arch/arm64/Kconfig | 4 arch/arm64/include/asm/assembler.h | 2 +- arch/arm64/include

[PATCH V2 4/7] arm64: mm: Replace fixed map BUILD_BUG_ON's with BUG_ON's

2017-12-18 Thread Steve Capper
In order to prepare for a variable VA_BITS we need to account for a variable size VMEMMAP which in turn means the position of the fixed map is variable at compile time. Thus, we need to replace the BUILD_BUG_ON's that check the fixed map position with BUG_ON's. Signed-off-by: St

[PATCH V2 2/7] arm64: mm: Flip kernel VA space

2017-12-18 Thread Steve Capper
age table dumper. These are all small changes, that need to take place atomically, so they are bundled into this commit. Signed-off-by: Steve Capper --- arch/arm64/Makefile | 2 +- arch/arm64/include/asm/memory.h | 10 +- arch/arm64/include/asm/pgtable.h | 2 +- arch/arm64

[PATCH V2 7/7] arm64: mm: Add 48/52-bit kernel VA support

2017-12-18 Thread Steve Capper
-by: Steve Capper --- arch/arm64/Kconfig | 8 arch/arm64/include/asm/memory.h | 4 arch/arm64/mm/proc.S| 13 + 3 files changed, 25 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 5a42edc18718..3fa5342849dc 100644 --- a/a

[PATCH V2 0/7] 52-bit kernel VAs for arm64

2017-12-18 Thread Steve Capper
dules, kImage etc are now retained, * 4.15-rc4 is used as a base as it includes a fix from V1 that has been merged already, * HASLR patch series is used as a base meaning HYP VA fixes are no longer required. Steve Capper (7): arm/arm64: KVM: Formalise end of direct linear map arm64: mm:

[PATCH V2 3/7] arm64: kasan: Switch to using KASAN_SHADOW_OFFSET

2017-12-18 Thread Steve Capper
igned-off-by: Steve Capper --- Documentation/arm64/kasan-offsets.sh | 17 + arch/arm64/Kconfig | 10 ++ arch/arm64/Makefile | 7 --- arch/arm64/include/asm/kasan.h | 21 - arch/arm64/include/asm/memory

[PATCH V2 1/7] arm/arm64: KVM: Formalise end of direct linear map

2017-12-18 Thread Steve Capper
be ~0UL Signed-off-by: Steve Capper --- arch/arm/include/asm/memory.h | 1 + arch/arm64/include/asm/memory.h | 1 + virt/kvm/arm/mmu.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index

Re: [PATCH 05/12] arm64: mm: Remove VMALLOC checks from update_mapping_prot(.)

2017-12-12 Thread Steve Capper
Hi Ard, On Mon, Dec 04, 2017 at 04:01:09PM +, Ard Biesheuvel wrote: > On 4 December 2017 at 14:13, Steve Capper wrote: > > update_mapping_prot assumes that it will be used on the VA for the > > kernel .text section. (Via the check virt >= VMALLOC_START) > > > &g

Re: [PATCH 01/12] KVM: arm/arm64: vgic: Remove spurious call to kern_hyp_va

2017-12-12 Thread Steve Capper
On Mon, Dec 04, 2017 at 02:30:28PM +, Suzuki K Poulose wrote: > On 04/12/17 14:13, Steve Capper wrote: > > In save_elrsr(.), we use the following technique to ascertain the > > address of the vgic global state: > > (kern_hyp_va(&kvm_vgic_global_state))->nr_lr &

Re: [PATCH 07/12] arm64: mm: Place kImage at bottom of VA space

2017-12-12 Thread Steve Capper
On Mon, Dec 04, 2017 at 06:12:13PM +, Steve Capper wrote: > On Mon, Dec 04, 2017 at 05:27:10PM +, Ard Biesheuvel wrote: > > On 4 December 2017 at 17:18, Steve Capper wrote: > > > Hi Ard, > > > > > > On Mon, Dec 04, 2017 at 04:25:18PM +, Ard Biesheu

Re: [PATCH 04/12] arm64: Initialise high_memory global variable earlier

2017-12-12 Thread Steve Capper
On Mon, Dec 11, 2017 at 12:00:22PM +, Catalin Marinas wrote: > On Mon, Dec 04, 2017 at 02:13:05PM +0000, Steve Capper wrote: > > The high_memory global variable is used by > > cma_declare_contiguous(.) before it is defined. > > > > We don't notice this as we co

Re: [PATCH 07/12] arm64: mm: Place kImage at bottom of VA space

2017-12-04 Thread Steve Capper
On Mon, Dec 04, 2017 at 05:27:10PM +, Ard Biesheuvel wrote: > On 4 December 2017 at 17:18, Steve Capper wrote: > > Hi Ard, > > > > On Mon, Dec 04, 2017 at 04:25:18PM +, Ard Biesheuvel wrote: > >> On 4 December 2017 at 14:13, Steve Capper wrote: > >>

Re: [PATCH 07/12] arm64: mm: Place kImage at bottom of VA space

2017-12-04 Thread Steve Capper
On Mon, Dec 04, 2017 at 05:18:09PM +, Steve Capper wrote: > Hi Ard, > [...] > IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and

Re: [PATCH 07/12] arm64: mm: Place kImage at bottom of VA space

2017-12-04 Thread Steve Capper
Hi Ard, On Mon, Dec 04, 2017 at 04:25:18PM +, Ard Biesheuvel wrote: > On 4 December 2017 at 14:13, Steve Capper wrote: > > Re-arrange the kernel memory map s.t. the kernel image resides in the > > bottom 514MB of memory. > > I guess this breaks KASLR entirely, no?

[PATCH 12/12] arm64: mm: Add 48/52-bit kernel VA support

2017-12-04 Thread Steve Capper
-by: Steve Capper --- arch/arm64/Kconfig | 8 arch/arm64/include/asm/memory.h | 5 + arch/arm64/mm/kasan_init.c | 3 +++ arch/arm64/mm/proc.S| 21 + 4 files changed, 37 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kcon

[PATCH 09/12] arm64: dump: Make kernel page table dumper dynamic again

2017-12-04 Thread Steve Capper
can be computed at boot time. Signed-off-by: Steve Capper --- arch/arm64/mm/dump.c | 51 +++ 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index e5d1b5f432fe..c50af666c407 100644 --- a

[PATCH 10/12] arm64: mm: Make VA_BITS variable, introduce VA_BITS_MIN

2017-12-04 Thread Steve Capper
ional page table levels are required for the idmap. We used to check for #ifdef CONFIG_ARM64_VA_BITS_48 which does not work when moving up to 52-bits. Signed-off-by: Steve Capper --- arch/arm64/include/asm/assembler.h | 2 +- arch/arm64/include/asm/efi.h | 4 ++-- arch/arm64/include/asm

[PATCH 11/12] arm64: KVM: Add support for an alternative VA space

2017-12-04 Thread Steve Capper
!VHE and idmap is high and VA size is big. Using the above predicates means we have to add two instructions to kern_hyp_va. Signed-off-by: Steve Capper --- arch/arm64/Kconfig | 4 arch/arm64/include/asm/cpucaps.h | 4 +++- arch/arm64/include/asm/kvm_mmu.h | 47

[PATCH 08/12] arm64: kasan: Switch to using KASAN_SHADOW_OFFSET

2017-12-04 Thread Steve Capper
igned-off-by: Steve Capper --- Documentation/arm64/kasan-offsets.sh | 17 + arch/arm64/Kconfig | 10 ++ arch/arm64/Makefile | 7 --- arch/arm64/include/asm/kasan.h | 24 +++- arch/arm64/include/asm/pgtabl

[PATCH 06/12] arm64: mm: Flip kernel VA space

2017-12-04 Thread Steve Capper
flip logic These are all small changes, that need to take place atomically, so they are bundled into this commit. Signed-off-by: Steve Capper --- arch/arm64/Makefile | 2 +- arch/arm64/include/asm/memory.h | 10 +- arch/arm64/include/asm/pgtable.h | 2 +- arch/arm64/kernel

[PATCH 02/12] arm64: KVM: Enforce injective kern_hyp_va mappings

2017-12-04 Thread Steve Capper
gned-off-by: Steve Capper --- arch/arm64/include/asm/cpucaps.h | 2 +- arch/arm64/include/asm/kvm_mmu.h | 36 +--- arch/arm64/kernel/cpufeature.c | 8 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/arch/arm64/include/asm/cpucaps.h b/ar

[PATCH 05/12] arm64: mm: Remove VMALLOC checks from update_mapping_prot(.)

2017-12-04 Thread Steve Capper
via mark_linear_text_alias_ro(.). We "get away" with this as the direct linear mapping currently follows the VA for the kernel text, so the check passes. This patch removes the check in update_mapping_prot allowing us to move the kernel VA layout without spuriously firing the warning. Signed-off-by:

[PATCH 07/12] arm64: mm: Place kImage at bottom of VA space

2017-12-04 Thread Steve Capper
such as KASAN shadow and sparsemem map are placed above the fixed size objects. This means that kernel addresses are now no longer directly dependent on VA space size. Signed-off-by: Steve Capper --- arch/arm64/include/asm/memory.h | 17 + arch/arm64/include/asm/pgtable.h | 4

[PATCH 00/12] 52-bit kernel VAs for arm64

2017-12-04 Thread Steve Capper
iting the support, I unearthed some subtle bugs in the KVM HYP mapping logic and these are addressed in the first two patches of this series. This patch series applies to 4.15-rc2, and the early pagetable patches I posted earlier: http://lists.infradead.org/pipermail/linux-arm-kernel/2017-November

[PATCH 04/12] arm64: Initialise high_memory global variable earlier

2017-12-04 Thread Steve Capper
space and the linear map is moved to the bottom of the kernel VA space. This patch moves the initialisation of high_memory before it used. Signed-off-by: Steve Capper --- arch/arm64/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64

[PATCH 01/12] KVM: arm/arm64: vgic: Remove spurious call to kern_hyp_va

2017-12-04 Thread Steve Capper
or. Cc: James Morse Suggested-by: Marc Zyngier Signed-off-by: Steve Capper --- arch/arm/include/asm/kvm_hyp.h | 2 ++ arch/arm64/include/asm/kvm_hyp.h | 10 ++ virt/kvm/arm/hyp/vgic-v2-sr.c| 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/arm/incl

[PATCH 03/12] arm/arm64: KVM: Formalise end of direct linear map

2017-12-04 Thread Steve Capper
be ~0UL Signed-off-by: Steve Capper --- arch/arm/include/asm/memory.h | 1 + arch/arm64/include/asm/memory.h | 1 + virt/kvm/arm/mmu.c | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index

Re: [PATCH 05/21] arm64: KVM: Implement timer save/restore

2015-11-23 Thread Steve Capper
On Mon, Nov 16, 2015 at 01:11:43PM +, Marc Zyngier wrote: > Implement the timer save restore as a direct translation of > the assembly code version. Hi Marc, some comments below. Cheers, -- Steve > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/hyp/Makefile | 1 + > arch/arm64/kv

Re: [PATCH 04/21] arm64: KVM: Implement vgic-v3 save/restore

2015-11-20 Thread Steve Capper
On Mon, Nov 16, 2015 at 01:11:42PM +, Marc Zyngier wrote: > Implement the vgic-v3 save restore as a direct translation of > the assembly code version. I think there's a couple of typos below Marc. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/hyp/Makefile | 1 + > arch/arm64

Re: [PATCH 03/21] arm64: KVM: Implement vgic-v2 save/restore

2015-11-20 Thread Steve Capper
On Mon, Nov 16, 2015 at 01:11:41PM +, Marc Zyngier wrote: > Implement the vgic-v2 save restore as a direct translation of > the assembly code version. Hi Marc, I have one comment below: Cheers, -- Steve > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/Makefile | 1 + > ar

Re: [PATCH 12/21] arm64: KVM: Implement fpsimd save/restore

2015-11-17 Thread Steve Capper
On 17 November 2015 at 11:25, Marc Zyngier wrote: > On 17/11/15 11:13, Steve Capper wrote: >> On 16 November 2015 at 13:11, Marc Zyngier wrote: >>> Implement the fpsimd save restore, keeping the lazy part in >>> assembler (as returning to C would be overkill). >>

Re: [PATCH 12/21] arm64: KVM: Implement fpsimd save/restore

2015-11-17 Thread Steve Capper
On 16 November 2015 at 13:11, Marc Zyngier wrote: > Implement the fpsimd save restore, keeping the lazy part in > assembler (as returning to C would be overkill). > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/hyp/Makefile | 1 + > arch/arm64/kvm/hyp/entry.S | 32 ++

Re: [PATCH 12/14] arm64: Check for selected granule support

2015-08-13 Thread Steve Capper
On 13 August 2015 at 12:34, Suzuki K. Poulose wrote: > From: "Suzuki K. Poulose" > > Ensure that the selected page size is supported by the > CPU(s). > > Cc: Mark Rutland > Cc: Catalin Marinas > Cc: Will Deacon > Signed-off-by: Suzuki K. Poulose > --- > arch/arm64/include/asm/sysreg.h |6

Re: [PATCH] arm64: Don't report clear pmds and puds as huge

2015-07-01 Thread Steve Capper
On 1 July 2015 at 14:28, Catalin Marinas wrote: > On Wed, Jul 01, 2015 at 02:18:31PM +0100, Catalin Marinas wrote: >> On Wed, Jul 01, 2015 at 02:08:31PM +0200, Christoffer Dall wrote: >> > diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c >> > index 2de9d2e..0eeb4f09 100644 >>

Re: [PATCH] arm64: Don't report clear pmds and puds as huge

2015-07-01 Thread Steve Capper
, let's change the behavior. > > Cc: sta...@vger.kernel.org Thanks Christoffer. It may be worth adding: Fixes: 084bd29810a5 ("ARM64: mm: HugeTLB support.") And, please feel free to add: Reviewed-by: Steve Capper > Signed-off-by: Christoffer Dall > --- > arch/arm64/