Re: [PATCH 2/3] arm64: lib: improve copy performance when size is ge 128 bytes

2021-03-23 Thread Will Deacon
On Tue, Mar 23, 2021 at 12:08:56PM +, Robin Murphy wrote: > On 2021-03-23 07:34, Yang Yingliang wrote: > > When copy over 128 bytes, src/dst is added after > > each ldp/stp instruction, it will cost more time. > > To improve this, we only add src/dst after load > > or store 64 bytes. > > This

Re: [PATCH] arm64: cpuinfo: Fix a typo

2021-03-22 Thread Will Deacon
On Sat, 20 Mar 2021 03:58:48 +0530, Bhaskar Chowdhury wrote: > s/acurate/accurate/ Applied to arm64 (for-next/fixes), thanks! [1/1] arm64: cpuinfo: Fix a typo https://git.kernel.org/arm64/c/d1296f1265f7 Cheers, -- Will https://fixes.arm64.dev https://next.arm64.dev

Re: [PATCH v3 0/1] correct the inside linear map range during hotplug check

2021-03-22 Thread Will Deacon
On Tue, 16 Feb 2021 10:03:50 -0500, Pavel Tatashin wrote: > v3: - Sync with linux-next where arch_get_mappable_range() was > introduced. > v2: - Added test-by Tyler Hicks > - Addressed comments from Anshuman Khandual: moved check under > IS_ENABLED(CONFIG_RANDOMIZE_BASE),

Re: [PATCH] Documentation: arm64/acpi : clarify arm64 support of IBFT

2021-03-22 Thread Will Deacon
On Tue, 16 Mar 2021 12:50:41 -0600, Tom Saeger wrote: > In commit 94bccc340710 ("iscsi_ibft: make ISCSI_IBFT dependson ACPI instead > of ISCSI_IBFT_FIND") Kconfig was disentangled to make ISCSI_IBFT selection > not depend on x86. > > Update arm64 acpi documentation, changing IBFT support status

Re: [PATCH] arm64: kdump: update ppos when reading elfcorehdr

2021-03-22 Thread Will Deacon
On Fri, 19 Mar 2021 16:50:54 -0400, Pavel Tatashin wrote: > The ppos points to a position in the old kernel memory (and in case of > arm64 in the crash kernel since elfcorehdr is passed as a segment). The > function should update the ppos by the amount that was read. This bug is > not exposed by

Re: [PATCH] arm64: stacktrace: don't trace arch_stack_walk()

2021-03-22 Thread Will Deacon
On Fri, 19 Mar 2021 18:41:06 +, Mark Rutland wrote: > We recently converted arm64 to use arch_stack_walk() in commit: > > 5fc57df2f6fd ("arm64: stacktrace: Convert to ARCH_STACKWALK") > > The core stacktrace code expects that (when tracing the current task) > arch_stack_walk() starts a

Re: [PATCH v6 32/38] KVM: arm64: Introduce KVM_PGTABLE_S2_NOFWB stage 2 flag

2021-03-22 Thread Will Deacon
PTE_S2_MEMATTR(MT_S2_ ## attr); \ Given that this isn't used outside of pgtable.c, I wonder if we should move it in there, as it's a pretty low-level thing to do now that it takes the 'has_fwb' parameter. But regardless, Acked-by: Will Deacon Will

Re: [PATCH v6 33/38] KVM: arm64: Introduce KVM_PGTABLE_S2_IDMAP stage 2 flag

2021-03-22 Thread Will Deacon
o > avoid programming errors. > > Suggested-by: Will Deacon > Signed-off-by: Quentin Perret > --- > arch/arm64/include/asm/kvm_pgtable.h | 2 ++ > arch/arm64/kvm/hyp/pgtable.c | 3 +++ > 2 files changed, 5 insertions(+) > > diff --git a/arch/arm64/include/asm/kv

Re: [PATCH v6 29/38] KVM: arm64: Use page-table to track page ownership

2021-03-22 Thread Will Deacon
--- > arch/arm64/include/asm/kvm_pgtable.h | 20 + > arch/arm64/kvm/hyp/pgtable.c | 126 ++- > 2 files changed, 122 insertions(+), 24 deletions(-) Acked-by: Will Deacon Will

Re: [PATCH v6 14/38] KVM: arm64: Provide __flush_dcache_area at EL2

2021-03-22 Thread Will Deacon
> 5 files changed, 24 insertions(+), 1 deletion(-) > create mode 100644 arch/arm64/kvm/hyp/nvhe/cache.S Acked-by: Will Deacon Will

Re: [PATCH v6 13/38] KVM: arm64: Enable access to sanitized CPU features at EL2

2021-03-22 Thread Will Deacon
_regs.c | 19 +++ > 5 files changed, 59 insertions(+) > create mode 100644 arch/arm64/include/asm/kvm_cpufeature.h Acked-by: Will Deacon Will

Re: [PATCH] Documentation: arm64/acpi : clarify arm64 support of IBFT

2021-03-18 Thread Will Deacon
[+Lorenzo] On Tue, Mar 16, 2021 at 12:50:41PM -0600, Tom Saeger wrote: > In commit 94bccc340710 ("iscsi_ibft: make ISCSI_IBFT dependson ACPI instead > of ISCSI_IBFT_FIND") Kconfig was disentangled to make ISCSI_IBFT selection > not depend on x86. > > Update arm64 acpi documentation, changing

Re: [PATCH 1/2] KVM: arm64: Introduce KVM_PGTABLE_S2_NOFWB Stage-2 flag

2021-03-17 Thread Will Deacon
On Wed, Mar 17, 2021 at 02:17:13PM +, Quentin Perret wrote: > In order to further configure stage-2 page-tables, pass flags to the > init function using a new enum. > > The first of these flags allows to disable FWB even if the hardware > supports it as we will need to do so for the host

Re: [PATCH v5 14/36] KVM: arm64: Provide __flush_dcache_area at EL2

2021-03-15 Thread Will Deacon
On Mon, Mar 15, 2021 at 04:56:21PM +, Quentin Perret wrote: > On Monday 15 Mar 2021 at 16:33:23 (+), Will Deacon wrote: > > On Mon, Mar 15, 2021 at 02:35:14PM +, Quentin Perret wrote: > > > We will need to do cache maintenance at EL2 soon, so compile a copy of > &g

Re: [PATCH v5 29/36] KVM: arm64: Use page-table to track page ownership

2021-03-15 Thread Will Deacon
On Mon, Mar 15, 2021 at 04:53:18PM +, Quentin Perret wrote: > On Monday 15 Mar 2021 at 16:36:19 (+), Will Deacon wrote: > > On Mon, Mar 15, 2021 at 02:35:29PM +, Quentin Perret wrote: > > > As the host stage 2 will be identity mapped, all the .hyp memory regions &

Re: [PATCH v5 29/36] KVM: arm64: Use page-table to track page ownership

2021-03-15 Thread Will Deacon
On Mon, Mar 15, 2021 at 02:35:29PM +, Quentin Perret wrote: > As the host stage 2 will be identity mapped, all the .hyp memory regions > and/or memory pages donated to protected guestis will have to marked > invalid in the host stage 2 page-table. At the same time, the hypervisor > will need a

Re: [PATCH v5 14/36] KVM: arm64: Provide __flush_dcache_area at EL2

2021-03-15 Thread Will Deacon
On Mon, Mar 15, 2021 at 02:35:14PM +, Quentin Perret wrote: > We will need to do cache maintenance at EL2 soon, so compile a copy of > __flush_dcache_area at EL2, and provide a copy of arm64_ftr_reg_ctrel0 > as it is needed by the read_ctr macro. > > Signed-off-by: Quentin Perret > --- >

Re: [PATCH v5 32/36] KVM: arm64: Provide sanitized mmfr* registers at EL2

2021-03-15 Thread Will Deacon
> arch/arm64/kvm/sys_regs.c | 2 ++ > 2 files changed, 4 insertions(+) Acked-by: Will Deacon Will

Re: [PATCH v5 31/36] KVM: arm64: Add kvm_pgtable_stage2_find_range()

2021-03-15 Thread Will Deacon
h | 29 + > arch/arm64/kvm/hyp/pgtable.c | 89 ++-- > 2 files changed, 114 insertions(+), 4 deletions(-) Acked-by: Will Deacon Will

Re: [PATCH] arm64: csum: cast to the proper type

2021-03-15 Thread Will Deacon
On Sun, 14 Mar 2021 20:26:50 -0500, Alex Elder wrote: > The last line of ip_fast_csum() calls csum_fold(), forcing the > type of the argument passed to be u32. But csum_fold() takes a > __wsum argument (which is __u32 __bitwise for arm64). As long > as we're forcing the cast, cast it to the

[GIT PULL] arm64: Fixes for -rc3

2021-03-12 Thread Will Deacon
(1): arm64: perf: Fix 64-bit event counter read truncation Wei Yongjun (1): perf/arm_dmc620_pmu: Fix error return code in dmc620_pmu_device_probe() Will Deacon (2): arm64: cpufeatures: Fix handling of CONFIG_CMDLINE for idreg overrides arm64: Drop support for CMDLINE_EXTEND arch/ar

Re: [PATCH -next] perf/arm_dmc620_pmu: Fix error return code in dmc620_pmu_device_probe()

2021-03-12 Thread Will Deacon
On Fri, 12 Mar 2021 08:04:21 +, 'Wei Yongjun wrote: > Fix to return negative error code -ENOMEM from the error handling > case instead of 0, as done elsewhere in this function. Applied to arm64 (for-next/fixes), thanks! [1/1] perf/arm_dmc620_pmu: Fix error return code in

Re: [PATCH v4 28/34] KVM: arm64: Use page-table to track page ownership

2021-03-12 Thread Will Deacon
On Fri, Mar 12, 2021 at 10:13:26AM +, Quentin Perret wrote: > On Friday 12 Mar 2021 at 09:32:06 (+), Will Deacon wrote: > > I'm not saying to use the VMID directly, just that allocating half of the > > pte feels a bit OTT given that the state of things after th

Re: [PATCH v4 30/34] KVM: arm64: Add kvm_pgtable_stage2_find_range()

2021-03-12 Thread Will Deacon
On Fri, Mar 12, 2021 at 05:32:13AM +, Quentin Perret wrote: > On Thursday 11 Mar 2021 at 19:04:07 (+), Will Deacon wrote: > > On Wed, Mar 10, 2021 at 05:57:47PM +, Quentin Perret wrote: > > > + for (level = pgt->start_level; level < KVM_P

Re: [PATCH v4 28/34] KVM: arm64: Use page-table to track page ownership

2021-03-12 Thread Will Deacon
On Fri, Mar 12, 2021 at 06:23:00AM +, Quentin Perret wrote: > On Thursday 11 Mar 2021 at 18:38:36 (+), Will Deacon wrote: > > On Wed, Mar 10, 2021 at 05:57:45PM +, Quentin Perret wrote: > > > As the host stage 2 will be identity mapped, all the .hyp memory regions &

Re: [PATCH v4 13/34] KVM: arm64: Enable access to sanitized CPU features at EL2

2021-03-12 Thread Will Deacon
On Fri, Mar 12, 2021 at 06:34:09AM +, Quentin Perret wrote: > On Thursday 11 Mar 2021 at 19:36:39 (+), Will Deacon wrote: > > On Wed, Mar 10, 2021 at 05:57:30PM +, Quentin Perret wrote: > > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > &

Re: [PATCH v4 13/34] KVM: arm64: Enable access to sanitized CPU features at EL2

2021-03-11 Thread Will Deacon
On Wed, Mar 10, 2021 at 05:57:30PM +, Quentin Perret wrote: > Introduce the infrastructure in KVM enabling to copy CPU feature > registers into EL2-owned data-structures, to allow reading sanitised > values directly at EL2 in nVHE. > > Given that only a subset of these features are being read

Re: [PATCH v4 34/34] KVM: arm64: Protect the .hyp sections from the host

2021-03-11 Thread Will Deacon
> arch/arm64/kvm/hyp/include/nvhe/mem_protect.h | 2 + > arch/arm64/kvm/hyp/nvhe/hyp-main.c| 9 > arch/arm64/kvm/hyp/nvhe/mem_protect.c | 33 + > 5 files changed, 91 insertions(+) Acked-by: Will Deacon Will

Re: [PATCH v4 31/34] KVM: arm64: Wrap the host with a stage 2

2021-03-11 Thread Will Deacon
arch/arm64/kvm/hyp/nvhe/switch.c | 7 +- > arch/arm64/kvm/hyp/nvhe/tlb.c | 4 +- > 12 files changed, 319 insertions(+), 7 deletions(-) > create mode 100644 arch/arm64/kvm/hyp/include/nvhe/mem_protect.h > create mode 100644 arch/arm64/kvm/hyp/nvhe/mem_protect.c I like this a lot more now, thanks: Acked-by: Will Deacon Will

Re: [PATCH v4 30/34] KVM: arm64: Add kvm_pgtable_stage2_find_range()

2021-03-11 Thread Will Deacon
On Wed, Mar 10, 2021 at 05:57:47PM +, Quentin Perret wrote: > Since the host stage 2 will be identity mapped, and since it will own > most of memory, it would preferable for performance to try and use large > block mappings whenever that is possible. To ease this, introduce a new > helper in

Re: [PATCH v4 29/34] KVM: arm64: Refactor stage2_map_set_prot_attr()

2021-03-11 Thread Will Deacon
64 size, > .arg= _data, > }; > > - ret = stage2_map_set_prot_attr(prot, _data); > + ret = stage2_set_prot_attr(prot, _data.attr); > if (ret) > return ret; (nit: this is now different to hyp_map_set_prot_attr() -- can we do the same thing there, please?) With that: Acked-by: Will Deacon Will

Re: [PATCH v4 28/34] KVM: arm64: Use page-table to track page ownership

2021-03-11 Thread Will Deacon
On Wed, Mar 10, 2021 at 05:57:45PM +, Quentin Perret wrote: > As the host stage 2 will be identity mapped, all the .hyp memory regions > and/or memory pages donated to protected guestis will have to marked > invalid in the host stage 2 page-table. At the same time, the hypervisor > will need a

Re: [PATCH v4 27/34] KVM: arm64: Always zero invalid PTEs

2021-03-11 Thread Will Deacon
hy do you exclude bit 1 from this range? > it entirely by ensuring to cache the anchor's child upfront. > > Suggested-by: Will Deacon > Signed-off-by: Quentin Perret > --- > arch/arm64/kvm/hyp/pgtable.c | 26 -- > 1 file changed, 16 insertions(+),

Re: [PATCH v4 17/34] KVM: arm64: Elevate hypervisor mappings creation at EL2

2021-03-11 Thread Will Deacon
--- > arch/arm64/kvm/mmu.c | 43 ++-- > 3 files changed, 120 insertions(+), 12 deletions(-) Acked-by: Will Deacon Will

Re: [PATCH v4 15/34] arm64: asm: Provide set_sctlr_el2 macro

2021-03-11 Thread Will Deacon
rch/arm64/include/asm/assembler.h | 14 +++--- > 1 file changed, 11 insertions(+), 3 deletions(-) Acked-by: Will Deacon Will

Re: [PATCH v4 16/34] KVM: arm64: Prepare the creation of s1 mappings at EL2

2021-03-11 Thread Will Deacon
rvisor side of things. In other words, this only implements the > new hypercalls, but does not make use of them from the host yet. The > host-side changes will follow in a subsequent patch. > > Credits to Will for __pkvm_init_switch_pgd. > > Co-authored-by: Will Deacon > S

Re: [PATCH v4 12/34] KVM: arm64: Introduce a Hyp buddy page allocator

2021-03-11 Thread Will Deacon
ode 100644 arch/arm64/kvm/hyp/nvhe/page_alloc.c Eventually, we can replace the refcount with refcount_t, but for now this looks pretty good: Acked-by: Will Deacon Will

Re: [PATCH v4 11/34] KVM: arm64: Stub CONFIG_DEBUG_LIST at Hyp

2021-03-11 Thread Will Deacon
> + struct list_head *next) > +{ > + return true; > +} > + > +bool __list_del_entry_valid(struct list_head *entry) > +{ > + return true; > +} > +#endif This isn't any worse than disabling DEBUG_LIST for the EL2 object, so as an initial implementation: Acked-by: Will Deacon but we really should have the debug list checks on (probably unconditionally) for the EL2 code in my opinion. Will

Re: [PATCH v4 06/34] KVM: arm64: Factor memory allocation out of pgtable.c

2021-03-11 Thread Will Deacon
sertions(+), 42 deletions(-) Thanks, looks good to me now: Acked-by: Will Deacon Will

Re: [RFC] mm: Enable generic pfn_valid() to handle early sections with memmap holes

2021-03-11 Thread Will Deacon
On Thu, Mar 11, 2021 at 01:22:53PM +0530, Anshuman Khandual wrote: > On 3/8/21 2:25 PM, Mike Rapoport wrote: > > On Mon, Mar 08, 2021 at 08:57:53AM +0530, Anshuman Khandual wrote: > >> Platforms like arm and arm64 have redefined pfn_valid() because their early > >> memory sections might have

Re: [PATCH v4 13/14] dt-bindings: of: Add restricted DMA pool

2021-03-10 Thread Will Deacon
Hi Claire, On Tue, Feb 09, 2021 at 02:21:30PM +0800, Claire Chang wrote: > Introduce the new compatible string, restricted-dma-pool, for restricted > DMA. One can specify the address and length of the restricted DMA memory > region by restricted-dma-pool in the reserved-memory node. > >

Re: [PATCH] arm64: perf: Fix 64-bit event counter read truncation

2021-03-10 Thread Will Deacon
On Tue, 9 Mar 2021 17:44:12 -0700, Rob Herring wrote: > Commit 0fdf1bb75953 ("arm64: perf: Avoid PMXEV* indirection") changed > armv8pmu_read_evcntr() to return a u32 instead of u64. The result is > silent truncation of the event counter when using 64-bit counters. Given > the offending commit

Re: [PATCH V2] arm64/mm: Fix __enable_mmu() for new TGRAN range values

2021-03-10 Thread Will Deacon
On Wed, 10 Mar 2021 11:23:10 +0530, Anshuman Khandual wrote: > As per ARM ARM DDI 0487G.a, when FEAT_LPA2 is implemented, ID_AA64MMFR0_EL1 > might contain a range of values to describe supported translation granules > (4K and 16K pages sizes in particular) instead of just enabled or disabled >

Re: [PATCH] arm64: mm: fix runtime fallback to 48-bt VA when 52-bit VA is enabled

2021-03-10 Thread Will Deacon
On Tue, Mar 09, 2021 at 07:32:16PM -0500, Mark Salter wrote: > I ran into an early boot soft lockup on a Qualcomm Amberwing using a v5.11 > kernel configured for 52-bit VA. This turned into a panic with a v5.12-rc2 > kernel. > > The problem is that when we fall back to 48-bit VA, idmap_t0sz is

Re: [PATCH] arm64: kasan: fix page_alloc tagging with DEBUG_VIRTUAL

2021-03-09 Thread Will Deacon
On Mon, 8 Mar 2021 17:10:23 +0100, Andrey Konovalov wrote: > When CONFIG_DEBUG_VIRTUAL is enabled, the default page_to_virt() macro > implementation from include/linux/mm.h is used. That definition doesn't > account for KASAN tags, which leads to no tags on page_alloc allocations. > > Provide an

Re: [PATCH] arm64/mm: Fix __enable_mmu() for new TGRAN range values

2021-03-09 Thread Will Deacon
On Mon, Mar 08, 2021 at 02:42:00PM +, Marc Zyngier wrote: > On Fri, 05 Mar 2021 14:36:09 +, > Anshuman Khandual wrote: > > - switch (cpuid_feature_extract_unsigned_field(mmfr0, tgran_2)) { > > - default: > > - case 1: > > + tgran_2 = cpuid_feature_extract_unsigned_field(mmfr0,

Re: [PATCH] drivers/arch_numa: remove rebudant setup_per_cpu_areas()

2021-03-09 Thread Will Deacon
; HAVE_SETUP_PER_CPU_AREA. > > Signed-off-by: Pingfan Liu > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Cc: Atish Patra > Cc: linux-kernel@vger.kernel.org > To: linux-arm-ker...@lists.infradead.org > --- >

Re: [PATCH V5 1/2] topology: Allow multiple entities to provide sched_freq_tick() callback

2021-03-09 Thread Will Deacon
On Tue, Mar 09, 2021 at 09:46:43AM +0530, Viresh Kumar wrote: > On 08-03-21, 14:52, Will Deacon wrote: > > On Mon, Mar 01, 2021 at 12:21:17PM +0530, Viresh Kumar wrote: > > > +EXPORT_SYMBOL_GPL(topology_set_scale_freq_source); > > > > I don't get why you nee

Re: [PATCH V3 0/2] arm64/mm: Fix pfn_valid() for ZONE_DEVICE based memory

2021-03-08 Thread Will Deacon
. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Ard Biesheuvel > Cc: Mark Rutland > Cc: James Morse > Cc: Robin Murphy > Cc: Jérôme Glisse > Cc: Dan Williams > Cc: David Hildenbrand > Cc: Mike Rapoport > Cc: Veronika Kabatova > Cc: linux-arm-ker...@l

Re: [PATCH 1/2] KVM: arm64: Distinguish cases of allocating memcache more precisely

2021-03-08 Thread Will Deacon
On Mon, Jan 25, 2021 at 10:10:43PM +0800, Yanan Wang wrote: > With a guest translation fault, we don't really need the memcache pages > when only installing a new entry to the existing page table or replacing > the table entry with a block entry. And with a guest permission fault, > we also don't

Re: [PATCH 2/2] KVM: arm64: Skip the cache flush when coalescing tables into a block

2021-03-08 Thread Will Deacon
On Mon, Jan 25, 2021 at 10:10:44PM +0800, Yanan Wang wrote: > After dirty-logging is stopped for a VM configured with huge mappings, > KVM will recover the table mappings back to block mappings. As we only > replace the existing page tables with a block entry and the cacheability > has not been

Re: [PATCH V5 1/2] topology: Allow multiple entities to provide sched_freq_tick() callback

2021-03-08 Thread Will Deacon
85 ++-- > include/linux/arch_topology.h | 14 +++- > 4 files changed, 134 insertions(+), 80 deletions(-) For the arm64 bits: Acked-by: Will Deacon However... > diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c > index de8587cc119e..8f62db

Re: [PATCH v2 0/2] Fix arm64 CONFIG_CMDLINE handling and remove CMDLINE_EXTEND

2021-03-08 Thread Will Deacon
On Wed, 3 Mar 2021 13:49:25 +, Will Deacon wrote: > This is version two of the series I previously posted here: > > https://lore.kernel.org/r/20210225125921.13147-1-w...@kernel.org > > The main change since v1 is that, rather than "fix" the FDT code to > fol

Re: [PATCH] arm64/mm: Drop redundant ARCH_WANT_HUGE_PMD_SHARE

2021-03-08 Thread Will Deacon
On Mon, 1 Mar 2021 10:36:32 +0530, Anshuman Khandual wrote: > There is already an ARCH_WANT_HUGE_PMD_SHARE which is being selected for > applicable configurations. Hence just drop the other redundant entry. Applied to arm64 (for-next/fixes), thanks! [1/1] arm64/mm: Drop redundant

Re: [PATCH] arm64/mm: Drop THP conditionality from FORCE_MAX_ZONEORDER

2021-03-08 Thread Will Deacon
On Mon, 1 Mar 2021 16:55:14 +0530, Anshuman Khandual wrote: > Currently without THP being enabled, MAX_ORDER via FORCE_MAX_ZONEORDER gets > reduced to 11, which falls below HUGETLB_PAGE_ORDER for certain 16K and 64K > page size configurations. This is problematic which throws up the following >

Re: [PATCH] KVM: arm64: Don't use cbz/adr with external symbols

2021-03-08 Thread Will Deacon
sues/1317 > Reported-by: Nathan Chancellor > Suggested-by: Marc Zyngier > Suggested-by: Ard Biesheuvel > Signed-off-by: Sami Tolvanen > --- > arch/arm64/kvm/hyp/entry.S | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) Acked-by: Will Deacon Will

Re: [PATCH v3 29/32] KVM: arm64: Wrap the host with a stage 2

2021-03-08 Thread Will Deacon
On Mon, Mar 08, 2021 at 01:38:07PM +, Quentin Perret wrote: > On Monday 08 Mar 2021 at 12:46:07 (+), Will Deacon wrote: > > > > > +static int host_stage2_idmap(u64 addr) > > > > > +{ > > > > > + enum kvm_pgtable_prot prot = KV

Re: [PATCH] arm64/mm: Fix __enable_mmu() for new TGRAN range values

2021-03-08 Thread Will Deacon
ptable > >> range of values (depending on whether the field is signed or unsigned) now > >> represented with ID_AA64MMFR0_TGRAN_SUPPORTED_[MIN..MAX] pair. While here, > >> also fix similar situations in EFI stub and KVM as well. > >> > >> Cc: Catalin M

Re: [PATCH] Documentation/features: mark BATCHED_UNMAP_TLB_FLUSH doesn't apply to ARM64

2021-03-08 Thread Will Deacon
quot; for this kind of features which are > not needed on some architectures. > > Cc: Mel Gorman > Cc: Andy Lutomirski > Cc: Catalin Marinas > Cc: Will Deacon > Signed-off-by: Barry Song > --- > Documentation/features/arch-support.txt| 1 + > Document

Re: [PATCH v3 29/32] KVM: arm64: Wrap the host with a stage 2

2021-03-08 Thread Will Deacon
On Mon, Mar 08, 2021 at 09:22:29AM +, Quentin Perret wrote: > On Friday 05 Mar 2021 at 19:29:06 (+), Will Deacon wrote: > > On Tue, Mar 02, 2021 at 02:59:59PM +, Quentin Perret wrote: > > > +static __always_inline void __load_host_stage2(void) > > > +{ >

Re: [PATCH v3 29/32] KVM: arm64: Wrap the host with a stage 2

2021-03-05 Thread Will Deacon
On Tue, Mar 02, 2021 at 02:59:59PM +, Quentin Perret wrote: > When KVM runs in protected nVHE mode, make use of a stage 2 page-table > to give the hypervisor some control over the host memory accesses. The > host stage 2 is created lazily using large block mappings if possible, > and will

Re: [PATCH v3 32/32] KVM: arm64: Protect the .hyp sections from the host

2021-03-05 Thread Will Deacon
T_NONE in MMIO range. > + */ > + if (!find_mem_range(start, ) || !find_mem_range(end, )) > + return -EINVAL; > + if (r1.start != r2.start) > + return -EINVAL; Feels like this should be in a helper to determine whether or not a range is solely covered by memory. Either way: Acked-by: Will Deacon Will

Re: [PATCH v3 26/32] KVM: arm64: Introduce PROT_NONE mappings for stage 2

2021-03-05 Thread Will Deacon
On Fri, Mar 05, 2021 at 09:52:12AM +, Quentin Perret wrote: > On Thursday 04 Mar 2021 at 20:00:45 (+), Will Deacon wrote: > > On Tue, Mar 02, 2021 at 02:59:56PM +, Quentin Perret wrote: > > > Once we start unmapping portions of memory from the host stage 2

Re: [PATCH v3 31/32] KVM: arm64: Disable PMU support in protected mode

2021-03-05 Thread Will Deacon
we currently do not have a use-case for it. > > Signed-off-by: Quentin Perret > --- > arch/arm64/kvm/perf.c | 3 ++- > arch/arm64/kvm/pmu.c | 8 > 2 files changed, 6 insertions(+), 5 deletions(-) Acked-by: Will Deacon Will

Re: [PATCH v3 28/32] KVM: arm64: Add kvm_pgtable_stage2_idmap_greedy()

2021-03-05 Thread Will Deacon
On Fri, Mar 05, 2021 at 03:03:36PM +, Quentin Perret wrote: > On Friday 05 Mar 2021 at 14:39:42 (+), Will Deacon wrote: > > On Tue, Mar 02, 2021 at 02:59:58PM +, Quentin Perret wrote: > > > + /* Reduce the kvm_mem_range to a granule size */ > > > + ret = __

Re: [PATCH v3 28/32] KVM: arm64: Add kvm_pgtable_stage2_idmap_greedy()

2021-03-05 Thread Will Deacon
On Tue, Mar 02, 2021 at 02:59:58PM +, Quentin Perret wrote: > Add a new map function to the KVM page-table library that allows to > greedily create block identity-mappings. This will be useful to create > lazily the host stage 2 page-table as it will own most of memory and > will always be

Re: [PATCH v6] ARM: Implement SLS mitigation

2021-03-05 Thread Will Deacon
s > Suggested-by: Nathan Chancellor > Suggested-by: David Laight > Suggested-by: Will Deacon I'm still reasonably opposed to this patch, so please don't add my "Suggested-by" here as, if I were to suggest anything, it would be not to apply this patch :) I still don't see why SLS

Re: [PATCH v3 30/32] KVM: arm64: Page-align the .hyp sections

2021-03-04 Thread Will Deacon
off-by: Quentin Perret > --- > arch/arm64/kernel/vmlinux.lds.S | 22 +- > 1 file changed, 9 insertions(+), 13 deletions(-) With the typo fixed: Acked-by: Will Deacon Will

Re: [PATCH v3 27/32] KVM: arm64: Refactor stage2_map_set_prot_attr()

2021-03-04 Thread Will Deacon
On Tue, Mar 02, 2021 at 02:59:57PM +, Quentin Perret wrote: > In order to ease its re-use in other code paths, refactor > stage2_map_set_prot_attr() to not depend on a stage2_map_data struct. > No functional change intended. > > Signed-off-by: Quentin Perret > --- >

Re: [PATCH v3 26/32] KVM: arm64: Introduce PROT_NONE mappings for stage 2

2021-03-04 Thread Will Deacon
On Tue, Mar 02, 2021 at 02:59:56PM +, Quentin Perret wrote: > Once we start unmapping portions of memory from the host stage 2 (such > as e.g. the hypervisor memory sections, or pages that belong to > protected guests), we will need a way to track page ownership. And > given that all mappings

Re: [PATCH v3 24/32] KVM: arm64: Reserve memory for host stage 2

2021-03-04 Thread Will Deacon
otal_pages(); > + > /* Allow 1 GiB for private mappings */ > res += __hyp_pgtable_max_pages(SZ_1G >> PAGE_SHIFT); > > return res; > } > + > +static inline unsigned long host_s2_mem_pgtable_pages(void) > +{ > + return __hyp_pgtable_total_pages() + 16; Is this 16 due to the possibility of a concatenated pgd? If so, please add a comment to that effect. With that: Acked-by: Will Deacon Will

Re: [PATCH v3 25/32] KVM: arm64: Sort the hypervisor memblocks

2021-03-04 Thread Will Deacon
eserved_mem.c | 19 +++ > 1 file changed, 19 insertions(+) Acked-by: Will Deacon Will

Re: [PATCH v3 23/32] KVM: arm64: Make memcache anonymous in pgtable allocator

2021-03-04 Thread Will Deacon
ertions(+), 5 deletions(-) Acked-by: Will Deacon Will

Re: [PATCH v3 22/32] KVM: arm64: Refactor __populate_fault_info()

2021-03-04 Thread Will Deacon
!= ESR_ELx_EC_DABT_LOW && ec != ESR_ELx_EC_IABT_LOW) > + return true; > + > + if (!__get_fault_info(esr, >arch.fault)) > + return false; > + > return true; Just return __get_fault_info(esr, >arch.fault); here. With that: Acked-by: Will Deacon Will

Re: [PATCH v3 20/32] KVM: arm64: Refactor kvm_arm_setup_stage2()

2021-03-04 Thread Will Deacon
big header in v2, thanks! Acked-by: Will Deacon Will

Re: [PATCH v3 16/32] KVM: arm64: Elevate hypervisor mappings creation at EL2

2021-03-04 Thread Will Deacon
On Tue, Mar 02, 2021 at 02:59:46PM +, Quentin Perret wrote: > Previous commits have introduced infrastructure to enable the EL2 code > to manage its own stage 1 mappings. However, this was preliminary work, > and none of it is currently in use. > > Put all of this together by elevating the

Re: [PATCH v3 15/32] KVM: arm64: Prepare the creation of s1 mappings at EL2

2021-03-04 Thread Will Deacon
; the hypervisor side of things. In other words, this only implements the > new hypercalls, but does not make use of them from the host yet. The > host-side changes will follow in a subsequent patch. > > Credits to Will for __pkvm_init_switch_pgd. > > Co-authored-by: Will Deac

Re: [PATCH v3 12/32] KVM: arm64: Introduce a Hyp buddy page allocator

2021-03-04 Thread Will Deacon
On Tue, Mar 02, 2021 at 02:59:42PM +, Quentin Perret wrote: > When memory protection is enabled, the hyp code will require a basic > form of memory management in order to allocate and free memory pages at > EL2. This is needed for various use-cases, including the creation of hyp > mappings or

Re: [PATCH v3 10/32] KVM: arm64: Introduce an early Hyp page allocator

2021-03-04 Thread Will Deacon
reate mode 100644 arch/arm64/kvm/hyp/include/nvhe/early_alloc.h > create mode 100644 arch/arm64/kvm/hyp/include/nvhe/memory.h > create mode 100644 arch/arm64/kvm/hyp/nvhe/early_alloc.c Acked-by: Will Deacon Will

Re: [PATCH v3 07/32] KVM: arm64: Introduce a BSS section for use at Hyp

2021-03-04 Thread Will Deacon
ch/arm64/kernel/vmlinux.lds.S | 52 --- > arch/arm64/kvm/arm.c | 14 - > arch/arm64/kvm/hyp/nvhe/hyp.lds.S | 1 + > 4 files changed, 49 insertions(+), 19 deletions(-) Acked-by: Will Deacon Will

Re: [PATCH v3 06/32] KVM: arm64: Factor memory allocation out of pgtable.c

2021-03-04 Thread Will Deacon
:Convert a physical address into a virtual address as > + * accessible in the current context. s/as accessible/mapped/ With those changes: Acked-by: Will Deacon Will

Re: [PATCH v3 04/32] KVM: arm64: Initialize kvm_nvhe_init_params early

2021-03-04 Thread Will Deacon
> 1 file changed, 18 insertions(+), 12 deletions(-) Acked-by: Will Deacon Will

Re: [PATCH V2 1/2] arm64/mm: Fix pfn_valid() for ZONE_DEVICE based memory

2021-03-04 Thread Will Deacon
On Thu, Mar 04, 2021 at 09:12:31AM +0100, David Hildenbrand wrote: > On 04.03.21 04:31, Anshuman Khandual wrote: > > On 3/4/21 2:54 AM, Will Deacon wrote: > > > On Wed, Mar 03, 2021 at 07:04:33PM +, Catalin Marinas wrote: > > > > On Thu, Feb 11, 2021 at 01:35

Re: [PATCH v2 1/2] arm64: cpufeatures: Fix handling of CONFIG_CMDLINE for idreg overrides

2021-03-04 Thread Will Deacon
On Wed, Mar 03, 2021 at 04:30:21PM -0600, Rob Herring wrote: > On Wed, Mar 3, 2021 at 7:50 AM Will Deacon wrote: > > > > The built-in kernel commandline (CONFIG_CMDLINE) can be configured in > > three different ways: > > > > 1. CMDLINE_FORCE: Use CONFIG_CMDLI

Re: [PATCH] KVM: arm64: Fix unaligned addr case in mmu walking

2021-03-04 Thread Will Deacon
-223,7 +223,7 @@ static inline int __kvm_pgtable_visit(struct > > > kvm_pgtable_walk_data *data, > > > > goto out; > > > > > > > > if (!table) { > > > > - data->addr += kvm_granule_size(level); > > > > + data->addr = ALIGN(data->addr, kvm_granule_size(level)); > > > > What if previous data->addr is already aligned with > > kvm_granule_size(level)? > > Hence a deadloop? Am I missing anything else? > > Indeed, well spotted. I'll revert to your original suggestion > if everybody agrees... Heh, yeah, at least one of us is awake. For the original patch, with the updated (including typo fix) commit message: Acked-by: Will Deacon If that still counts for anything! Will

Re: [PATCH V2 1/2] arm64/mm: Fix pfn_valid() for ZONE_DEVICE based memory

2021-03-03 Thread Will Deacon
On Wed, Mar 03, 2021 at 07:04:33PM +, Catalin Marinas wrote: > On Thu, Feb 11, 2021 at 01:35:56PM +0100, David Hildenbrand wrote: > > On 11.02.21 13:10, Anshuman Khandual wrote: > > > On 2/11/21 5:23 PM, Will Deacon wrote: > > > > ... and dropped. These pa

Re: [PATCH] KVM: arm64: Fix unaligned addr case in mmu walking

2021-03-03 Thread Will Deacon
truct > kvm_pgtable_walk_data *data, > goto out; > > if (!table) { > - data->addr += kvm_granule_size(level); > + data->addr = ALIGN(data->addr, kvm_granule_size(level)); > goto out; > } If Jia is happy with it, please feel free to add: Acked-by: Will Deacon Will

Re: [PATCH v10 10/16] KVM: x86: Introduce KVM_GET_SHARED_PAGES_LIST ioctl

2021-03-03 Thread Will Deacon
[+Marc] On Tue, Mar 02, 2021 at 02:55:43PM +, Ashish Kalra wrote: > On Fri, Feb 26, 2021 at 09:44:41AM -0800, Sean Christopherson wrote: > > On Fri, Feb 26, 2021, Ashish Kalra wrote: > > > On Thu, Feb 25, 2021 at 02:59:27PM -0800, Steve Rutherford wrote: > > > > On Thu, Feb 25, 2021 at 12:20

Re: [PATCH v2 4/7] cmdline: Add capability to prepend the command line

2021-03-03 Thread Will Deacon
On Tue, Mar 02, 2021 at 05:25:20PM +, Christophe Leroy wrote: > This patchs adds an option of prepend a text to the command > line instead of appending it. > > Signed-off-by: Christophe Leroy > --- > include/linux/cmdline.h | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > >

Re: [PATCH v2 1/7] cmdline: Add generic function to build command line.

2021-03-03 Thread Will Deacon
On Wed, Mar 03, 2021 at 06:57:09PM +0100, Christophe Leroy wrote: > Le 03/03/2021 à 18:46, Will Deacon a écrit : > > On Wed, Mar 03, 2021 at 06:38:16PM +0100, Christophe Leroy wrote: > > > Le 03/03/2021 à 18:28, Will Deacon a écrit : > > > > On Tue, Mar 02, 2021 a

Re: [PATCH v2 1/7] cmdline: Add generic function to build command line.

2021-03-03 Thread Will Deacon
On Tue, Mar 02, 2021 at 05:25:17PM +, Christophe Leroy wrote: > This code provides architectures with a way to build command line > based on what is built in the kernel and what is handed over by the > bootloader, based on selected compile-time options. > > Signed-off-by: Christophe Leroy >

Re: [PATCH v2 6/7] cmdline: Gives architectures opportunity to use generically defined boot cmdline manipulation

2021-03-03 Thread Will Deacon
On Tue, Mar 02, 2021 at 05:25:22PM +, Christophe Leroy wrote: > Most architectures have similar boot command line manipulation > options. This patchs adds the definition in init/Kconfig, gated by > CONFIG_HAVE_CMDLINE that the architectures can select to use them. > > In order to use this, a

Re: [PATCH v2 1/7] cmdline: Add generic function to build command line.

2021-03-03 Thread Will Deacon
On Wed, Mar 03, 2021 at 06:38:16PM +0100, Christophe Leroy wrote: > Le 03/03/2021 à 18:28, Will Deacon a écrit : > > On Tue, Mar 02, 2021 at 05:25:17PM +, Christophe Leroy wrote: > > > This code provides architectures with a way to build command line > > > based on

Re: [PATCH v2 1/7] cmdline: Add generic function to build command line.

2021-03-03 Thread Will Deacon
On Tue, Mar 02, 2021 at 05:25:17PM +, Christophe Leroy wrote: > This code provides architectures with a way to build command line > based on what is built in the kernel and what is handed over by the > bootloader, based on selected compile-time options. > > Signed-off-by: Christophe Leroy >

[PATCH v2 0/2] Fix arm64 CONFIG_CMDLINE handling and remove CMDLINE_EXTEND

2021-03-03 Thread Will Deacon
nk Rowand Cc: Arnd Bergmann Cc: Palmer Dabbelt Cc: Greg Kroah-Hartman Cc: Catalin Marinas Cc: Cc: Cc: Will Deacon (2): arm64: cpufeatures: Fix handling of CONFIG_CMDLINE for idreg overrides arm64: Drop support for CMDLINE_EXTEND arch/arm64/Kconfig | 6 - arch/arm64

[PATCH v2 2/2] arm64: Drop support for CMDLINE_EXTEND

2021-03-03 Thread Will Deacon
/ Cc: Max Uvarov Cc: Rob Herring Cc: Ard Biesheuvel Cc: Marc Zyngier Cc: Doug Anderson Cc: Tyler Hicks Cc: Frank Rowand Cc: Catalin Marinas Link: https://lore.kernel.org/r/CAL_JsqJX=TCCs7=gg486r9tn4nyscmtclnfqjf9crskkpq-...@mail.gmail.com Signed-off-by: Will Deacon --- arch/arm64/Kconfig

[PATCH v2 1/2] arm64: cpufeatures: Fix handling of CONFIG_CMDLINE for idreg overrides

2021-03-03 Thread Will Deacon
and following the same logic as that used by the EFI stub. Reviewed-by: Marc Zyngier Fixes: 33200303553d ("arm64: cpufeature: Add an early command-line cpufeature override facility") Signed-off-by: Will Deacon --- arch/arm64/kernel/idreg-override.c | 44 +---

Re: [PATCH] recordmcount: Fix the wrong use of w* in arm64_is_fake_mcount()

2021-03-03 Thread Will Deacon
On Tue, Mar 02, 2021 at 05:33:35PM -0500, Steven Rostedt wrote: > On Tue, 2 Mar 2021 17:30:58 -0500 > Steven Rostedt wrote: > > > I just realized that I received this patch twice, and thought it was the > > same patch! Chen was three days ahead of you, so he get's the credit ;-) > > > >

Re: [PATCH] KVM: arm64: Fix unaligned addr case in mmu walking

2021-03-03 Thread Will Deacon
On Wed, Mar 03, 2021 at 09:54:25AM +, Marc Zyngier wrote: > Hi Jia, > > On Wed, 03 Mar 2021 02:42:25 +, > Jia He wrote: > > > > If the start addr is not aligned with the granule size of that level. > > loop step size should be adjusted to boundary instead of simple > >

Re: [PATCH] KVM: arm64: Fix unaligned addr case in mmu walking

2021-03-03 Thread Will Deacon
On Wed, Mar 03, 2021 at 10:42:25AM +0800, Jia He wrote: > If the start addr is not aligned with the granule size of that level. > loop step size should be adjusted to boundary instead of simple > kvm_granual_size(level) increment. Otherwise, some mmu entries might miss > the chance to be walked

<    1   2   3   4   5   6   7   8   9   10   >