Hi Quentin,
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 0019b2309f70..0cc4b295e525 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -299,6 +299,17 @@ static int pkvm_share_hyp(phys_addr_t start, phys_addr_t
> end)
> return 0;
> }
>
> +int
Hey Marc,
that all makes sense:
Reviewed-by: David Brazdil
> @@ -2137,8 +2142,15 @@ static int __init early_kvm_mode_cfg(char *arg)
> return 0;
> }
>
> - if (strcmp(arg, "nvhe") == 0 && !WARN_ON(is_kernel_in_hyp_mode()))
> + if (
Perret
Fixes: 90134ac9cabb6 ("KVM: arm64: Protect the .hyp sections from the host")
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/mem_protect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
b/arch/arm64/kvm/hyp/nvhe/mem
and
then checking that the upper bound is in the same memblock.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/mem_protect.c | 11 ---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
index
Hi, here is an off-by-one bug fix and a very minor improvement for
the range_is_memory function in hyp.
David Brazdil (2):
KVM: arm64: Fix off-by-one in range_is_memory
KVM: arm64: Minor optimization of range_is_memory
arch/arm64/kvm/hyp/nvhe/mem_protect.c | 11 ---
1 file changed
arm64: Generate hyp relocation data")
Cc:
Reported-by: Will Deacon
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/gen-hyprel.c | 18 ++
1 file changed, 18 insertions(+)
diff --git a/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c
b/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c
index ea
Thanks for writing the fix, Marc! There are no corner cases in this code so
if it boots, that should be a good indicator that all BE inputs were converted.
Just one little thing I noticed below, otherwise:
Acked-by: David Brazdil
> arch/arm64/kvm/hyp/nvhe/Makefile | 1 +
> arch/arm
104135011.2063104-1-...@kernel.org
> [3] https://lore.kernel.org/r/2021032811.2455113-1-...@kernel.org
Pretty cool! Left a few minor comments here and there, other than that:
Acked-by: David Brazdil
___
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
On Mon, Jan 18, 2021 at 09:45:30AM +, Marc Zyngier wrote:
> Given that the early cpufeature infrastructure has borrowed quite
> a lot of code from the kaslr implementation, let's reimplement
> the matching of the "nokaslr" option with it.
>
> Signed-off-by: Marc
On Mon, Jan 18, 2021 at 09:45:29AM +, Marc Zyngier wrote:
> For completeness, let's document the HVC_VHE_RESTART stub.
>
> Signed-off-by: Marc Zyngier
Acked-by: David Brazdil
> ---
> Documentation/virt/kvm/arm/hyp-abi.rst | 9 +
> 1 file changed, 9 insertions(
Zyngier
Acked-by: David Brazdil
> ---
> arch/arm64/kernel/idreg-override.c | 20
> 1 file changed, 20 insertions(+)
>
> diff --git a/arch/arm64/kernel/idreg-override.c
> b/arch/arm64/kernel/idreg-override.c
> index 75d9845f489b..16bc8b3b93ae 100644
> -
On Mon, Jan 18, 2021 at 09:45:26AM +, Marc Zyngier wrote:
> Finally we can check whether VHE is disabled on the command line,
> and not enable it if that's the user's wish.
>
> Signed-off-by: Marc Zyngier
Acked-by: David Brazdil
> ---
> arch/arm64/kern
override val/mask pair.
>
> No features are currently defined, so no expected change in
> functionality.
>
> Signed-off-by: Marc Zyngier
Acked-by: David Brazdil
> ---
> arch/arm64/kernel/Makefile | 2 +-
> arch/arm64/kernel/head.S | 1
On Mon, Jan 18, 2021 at 09:45:16AM +, Marc Zyngier wrote:
> As we are about to change the way a VHE system boots, let's
> provide the core helper, in the form of a stub hypercall that
> enables VHE and replicates the full EL1 context at EL2, thanks
> to EL1 and VHE-EL2 being extremely similar.
Zyngier
> ---
> arch/arm64/include/asm/el2_setup.h | 24
> 1 file changed, 12 insertions(+), 12 deletions(-)
Acked-by: David Brazdil
___
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
On Fri, Jan 15, 2021 at 05:18:24PM +, Elena Petrova wrote:
> From: George Popescu
>
> If an out of bounds happens inside the hyp/nVHE code, the ubsan_out_of_bounds
> handler stores the logging data inside the kvm_ubsan_buffer. The one
> responsible
> for printing is the kernel
On Fri, Jan 15, 2021 at 05:18:30PM +, Elena Petrova wrote:
> From: George-Aurelian Popescu
>
> Test the UBsan functionality inside hyp/nVHE.
> Because modules are not supported inside of hyp/nVHE code, the default
> testing module for UBSan can not be used.
> New functions have to be defined
On Fri, Jan 15, 2021 at 05:18:23PM +, Elena Petrova wrote:
> From: George Popescu
>
> Share a buffer between the kernel and the hyp/nVHE code by using the
> macros from kvm_debug_buffer.h.
> The hyp/nVHE code requires a write index which counts how many elements
> have been writtens inside
he ones defined in kernel-proper lib/ubsan.c.
>
> In this way, enabling UBSAN_MISC won't cause a link error.
The commit message needs to be updated - UBSAN_MISC does not exist any longer.
Also "nVHe" is a typo.
Other than that:
Acked-by: David Brazdil
>
> Signed-off-by: Elena Petr
On Tue, Dec 29, 2020 at 05:16:41PM +, Marc Zyngier wrote:
> Hi David,
>
> On 2020-12-29 16:00, David Brazdil wrote:
> > The KVM/arm64 PSCI relay assumes that SYSTEM_OFF and SYSTEM_RESET should
> > not return, as dictated by the PSCI spec. However, there is firmware out
&
The KVM/arm64 PSCI relay assumes that SYSTEM_OFF and SYSTEM_RESET should
not return, as dictated by the PSCI spec. However, there is firmware out
there which breaks this assumption, leading to a hyp panic. Make KVM
more robust to broken firmware by allowing these to return.
Signed-off-by: David
Hyp code used the hyp_symbol_addr helper to force PC-relative addressing
because absolute addressing results in kernel VAs due to the way hyp
code is linked. This is not true anymore, so remove the helper and
update all of its users.
Acked-by: Ard Biesheuvel
Signed-off-by: David Brazdil
Storing a function pointer in hyp now generates relocation information
used at early boot to convert the address to hyp VA. The existing
alternative-based conversion mechanism is therefore obsolete. Remove it
and simplify its users.
Acked-by: Ard Biesheuvel
Signed-off-by: David Brazdil
accordingly.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_mmu.h | 42 --
arch/arm64/kvm/hyp/nvhe/host.S | 29 +++--
arch/arm64/kvm/hyp/nvhe/hyp-init.S | 2 --
3 files changed, 31 insertions(+), 42 deletions(-)
diff --git a/arch/arm64
with addend + . The linker of
`vmlinux` will therefore fill the slot accordingly.
This relocation data will be used at runtime to convert the kernel VAs
at those positions to hyp VAs.
Signed-off-by: David Brazdil
---
arch/arm64/kernel/vmlinux.lds.S | 11 +
arch/arm64/kvm/hyp/nvhe/Makefile
as an anchor. The linker of `vmlinux` will place the symbols together
with the sections.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/hyp_image.h | 29 +++--
arch/arm64/kvm/hyp/nvhe/hyp.lds.S | 4 ++--
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/arch
We will need to recognize pointers in .rodata specific to hyp, so
establish a .hyp.rodata ELF section. Merge it with the existing
.hyp.data..ro_after_init as they are treated the same at runtime.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/sections.h | 2 +-
arch/arm64/kernel
/hyp-reloc_v1
-David
David Brazdil (8):
KVM: arm64: Rename .idmap.text in hyp linker script
KVM: arm64: Set up .hyp.rodata ELF section
KVM: arm64: Add symbol at the beginning of each hyp section
KVM: arm64: Generate hyp relocation data
KVM: arm64: Apply hyp relocations at runtime
KVM
-by: David Brazdil
---
arch/arm64/configs/defconfig | 1 +
arch/arm64/include/asm/kvm_mmu.h | 1 +
arch/arm64/include/asm/sections.h | 1 +
arch/arm64/kernel/smp.c | 4 +++-
arch/arm64/kvm/va_layout.c| 28
5 files changed, 34 insertions(+), 1
-unit-tests or starting any VM and subsequent soft lockup on a Cortex
A72 device.
Fixes: 30c953911c43 ("kvm: arm64: Set up hyp percpu data for nVHE")
Signed-off-by: Jamie Iles
Signed-off-by: Marc Zyngier
Acked-by: David Brazdil
Cc: David Brazdil
Cc: Marc Zyngier
Cc: Will Deacon
L
-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/hyp-init.S | 2 +-
arch/arm64/kvm/hyp/nvhe/hyp.lds.S | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-init.S
b/arch/arm64/kvm/hyp/nvhe/hyp-init.S
index 31b060a44045..68fd64f2313e 100644
--- a/arch/arm64
Hey, relized I never replied to this...
On Tue, Nov 24, 2020 at 03:08:20PM +0100, Ard Biesheuvel wrote:
> On Thu, 19 Nov 2020 at 17:26, David Brazdil wrote:
> >
> > Hyp code used to use absolute addressing via a constant pool to obtain
> > the kernel VA of 3 symbols - pani
Hey Marc,
On Thu, Dec 03, 2020 at 07:23:19PM +, Marc Zyngier wrote:
> On Wed, 2 Dec 2020 18:40:56 +0000, David Brazdil wrote:
> > As we progress towards being able to keep guest state private to the
> > host running nVHE hypervisor, this series allows the hypervisor to
>
Minor cleanup removing unused includes.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/psci-relay.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/arm64/kvm/hyp/nvhe/psci-relay.c
b/arch/arm64/kvm/hyp/nvhe/psci-relay.c
index 0d6f4aa39621..1f7237e45148 100644
--- a/arch
Move function for skipping host instruction in the host trap handler to
a header file containing analogical helpers for guests.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/include/hyp/adjust_pc.h | 9 +
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 12 ++--
2 files
init_hyp_physvirt_offset() computes PA from a kernel VA. Conversion to
kernel linear-map is required first but the code used kvm_ksym_ref() for
this purpose. Under VHE that is a NOP and resulted in a runtime warning.
Replace kvm_ksym_ref with lm_alias.
Reported-by: Qian Cai
Signed-off-by: David
Small cleanup moving declarations of hyp-exported variables to
kvm_host.h and using macros to avoid having to refer to them with
kvm_nvhe_sym() in host.
No functional change intended.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_host.h | 6 ++
arch/arm64/kvm/arm.c
Computing the hyp VA layout is redundant when the kernel runs in EL2 and
hyp shares its VA mappings. Make calling kvm_compute_layout()
conditional on not just CONFIG_KVM but also !is_kernel_in_hyp_mode().
Signed-off-by: David Brazdil
---
arch/arm64/kernel/smp.c | 2 +-
1 file changed, 1
if any
concerns arise. The remaining patches are minor cleanups from review.
-David
David Brazdil (6):
kvm: arm64: Prevent use of invalid PSCI v0.1 function IDs
kvm: arm64: Use lm_alias in nVHE-only VA conversion
kvm: arm64: Skip computing hyp VA layout for VHE
kvm: arm64: Minor cleanup
.
Reported-by: Mark Rutland
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_host.h| 20 +++
arch/arm64/kvm/arm.c | 14 +---
arch/arm64/kvm/hyp/nvhe/psci-relay.c | 53 +---
3 files changed, 70 insertions(+), 17 deletions(-)
diff
Hi Qian,
> > +/*
> > + * Store a hyp VA <-> PA offset into a hyp-owned variable.
> > + */
> > +static void init_hyp_physvirt_offset(void)
> > +{
> > + extern s64 kvm_nvhe_sym(hyp_physvirt_offset);
> > + u64 kern_va, hyp_va;
> > +
> > + /* Compute the offset from the hyp VA and PA of a
On Thu, Dec 03, 2020 at 10:47:12AM +, Mark Rutland wrote:
> On Wed, Dec 02, 2020 at 06:41:02PM +0000, David Brazdil wrote:
> > Make it possible to retrieve a copy of the psci_0_1_function_ids struct.
> > This is useful for KVM if it is configured to intercept host's PSCI SMCs.
Add a handler of SYSTEM_SUSPEND host PSCI SMCs. The semantics are
equivalent to CPU_SUSPEND, typically called on the last online CPU.
Reuse the same entry point and boot args struct as CPU_SUSPEND.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/hyp-init.S | 2 +-
arch/arm64/kvm/hyp
returning ERET to the provided PC in EL1.
There is a simple atomic lock around the boot args struct. If it is
already locked, CPU_ON will return PENDING_ON error code.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/hyp-init.S | 48 +++
arch/arm64/kvm/hyp/nvhe/psci-relay.c | 115
features were not checked
against the finalized capabilities.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/arm.c | 19 +++
arch/arm64/kvm/hyp/nvhe/hyp-smp.c | 16
2 files changed, 35 insertions(+)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm
at the point of KVM
init and KVM will not allow cores not present at init to boot. That
said, the function is never used after KVM is initialized.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/virt.h | 18 ++
arch/arm64/kvm/arm.c | 9 ++---
2 files changed
.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_asm.h | 2 --
arch/arm64/include/asm/kvm_mmu.h | 24
arch/arm64/kvm/arm.c | 4 +---
arch/arm64/kvm/hyp/nvhe/hyp-init.S | 9 ++---
4 files changed, 31 insertions(+), 8 deletions(-)
diff
KVM by default keeps the stub vector installed and installs the nVHE
vector only briefly for init and later on demand. Change this policy
to install the vector at init and then never uninstall it if the kernel
was given the protected KVM command line parameter.
Signed-off-by: David Brazdil
.
Refactor __do_hyp_init to accept its parameters in a struct. This
prepares the code for KVM booting cores as well as removes any limits on
the number of __do_hyp_init arguments.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_asm.h | 6 ++
arch/arm64/include/asm/kvm_hyp.h | 2
only this_cpu_ptr() was supported by setting TPIDR_EL2.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/percpu.h | 6 ++
arch/arm64/kernel/image-vars.h| 3 +++
arch/arm64/kvm/hyp/nvhe/Makefile | 3 ++-
arch/arm64/kvm/hyp/nvhe/hyp-smp.c | 24
4 files
of HCR
flags to use while the nVHE vector is installed when the kernel was
booted with the protected flag enabled. Switch back to the default HCR
flags when switching back to the stub vector.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_arm.h | 1 +
arch/arm64/kvm/hyp/nvhe/hyp
in the section and they are never
changed by hyp afterwards.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/sections.h | 1 +
arch/arm64/kernel/vmlinux.lds.S | 10 ++
arch/arm64/kvm/arm.c | 8
arch/arm64/kvm/hyp/nvhe/hyp.lds.S | 1 +
4 files changed, 20 insertions
Expose the boolean value whether the system is running with KVM in
protected mode (nVHE + kernel param). CPU capability was selected over
a global variable to allow use in alternatives.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/cpucaps.h | 3 ++-
arch/arm64/include/asm
struct psci_boot_args
to store the state upon powerup, with each CPU having separate structs
for CPU_ON and CPU_SUSPEND so that CPU_SUSPEND can operate locklessly
and so that a CPU_ON call targeting a CPU cannot interfere with
a concurrent CPU_SUSPEND call on that CPU.
Signed-off-by: David Brazdil
Make it possible to retrieve a copy of the psci_0_1_function_ids struct.
This is useful for KVM if it is configured to intercept host's PSCI SMCs.
Signed-off-by: David Brazdil
---
drivers/firmware/psci/psci.c | 12 +---
include/linux/psci.h | 9 +
2 files changed, 14
Signed-off-by: David Brazdil
---
Documentation/admin-guide/kernel-parameters.txt | 10 ++
arch/arm64/include/asm/kvm_host.h | 9 +
arch/arm64/kvm/arm.c| 16
3 files changed, 35 insertions(+)
diff --git a/Documentation/admin-gu
code after the trap handler would have returned.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/host.S | 9 +
1 file changed, 9 insertions(+)
diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S
index 2b56f0bdf874..a820dfdc9c25 100644
--- a/arch/arm64/kvm
In preparation for adding a CPU entry point in nVHE hyp code, extract
most of __do_hyp_init hypervisor initialization code into a common
helper function. This will be invoked by the entry point to install KVM
on the newly booted CPU.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/hyp
atomic
* make cpu_logical_map ro_after_init
David Brazdil (26):
kvm: arm64: Add kvm-arm.mode early kernel parameter
kvm: arm64: Add ARM64_KVM_PROTECTED_MODE CPU capability
psci: Support psci_ops.get_version for v0.1
psci: Split functions to v0.1 and v0.2+ variants
psci: Replace
for arguments and results, other GPRs are
preserved.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/host.S | 38 ++
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 35 ---
2 files changed, 70 insertions(+), 3 deletions(-)
diff --git a/arch/arm64
s checking.
Signed-off-by: David Brazdil
---
drivers/firmware/psci/psci.c | 29 ++---
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index 13b9ed71b446..593fdd0e09a2 100644
--- a/drivers/firmware/psci/ps
-by: David Brazdil
---
arch/arm64/include/asm/smp.h | 4 ++--
arch/arm64/kernel/setup.c| 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h
index 2e7f529ec5a6..bcb01ca15325 100644
--- a/arch/arm64/include/asm/smp.h
is currently unused so this has no effect on
existing functionality.
Acked-by: Mark Rutland
Signed-off-by: David Brazdil
---
drivers/firmware/psci/psci.c | 13 ++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index
and can be used when booting new
cores.
Take the opportunity to move copying the T0SZ value from idmap_t0sz in
KVM init rather than in .hyp.idmap.text. This avoids the need for the
idmap_t0sz symbol alias.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_asm.h | 2 ++
arch/arm64
* SYSTEM_RESET
* SYSTEM_RESET2
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/psci-relay.c | 42 +++-
1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/hyp/nvhe/psci-relay.c
b/arch/arm64/kvm/hyp/nvhe/psci-relay.c
index 70b42f433449
-off-by: David Brazdil
---
drivers/firmware/psci/psci.c | 94 +++-
1 file changed, 60 insertions(+), 34 deletions(-)
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index ace5b9ac676c..13b9ed71b446 100644
--- a/drivers/firmware/psci/psci.c
No functional change intended. Size of el2_setup increased by
148 bytes due to duplication.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/el2_setup.h | 182 +
arch/arm64/kernel/head.S | 144 +++
2 files changed, 198 insertions
Add a host-initialized constant to KVM nVHE hyp code for converting
between EL2 linear map virtual addresses and physical addresses.
Also add `__hyp_pa` macro that performs the conversion.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/psci-relay.c | 3 +++
arch/arm64/kvm/va_layout.c
+), the SMC is handled by the PSCI handler. For now, all
SMCs return PSCI_RET_NOT_SUPPORTED.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_hyp.h | 2 +
arch/arm64/kvm/arm.c | 25 -
.../arm64/kvm/hyp/include/nvhe/trap_handler.h | 18
arch
On Fri, Nov 27, 2020 at 10:14:33AM +, Lorenzo Pieralisi wrote:
> On Thu, Nov 26, 2020 at 03:54:14PM +0000, David Brazdil wrote:
> > Forward the following PSCI SMCs issued by host to EL3 as they do not
> > require the hypervisor's intervention. This assumes that EL3 correctly
On Thu, Nov 26, 2020 at 05:28:38PM +, Mark Rutland wrote:
> On Thu, Nov 26, 2020 at 03:54:01PM +0000, David Brazdil wrote:
> > CPU index should never be negative. Change the signature of
> > (set_)cpu_logical_map to take an unsigned int.
> >
> > S
> > > be just me, but if you agree please update so that it doesn't give remote
> > > idea that it is not valid on VHE enabled hardware.
> > >
> > > I was trying to run this on the hardware and was trying to understand the
> > > details on how to do that.
> >
> > I see what you're saying, but
Hey Mark,
> > diff --git a/arch/arm64/include/asm/memory.h
> > b/arch/arm64/include/asm/memory.h
> > index cd61239bae8c..54a22cb5b17b 100644
> > --- a/arch/arm64/include/asm/memory.h
> > +++ b/arch/arm64/include/asm/memory.h
> > @@ -152,6 +152,19 @@
> > #define MT_S2_FWB_NORMAL 6
> > #define
Hey Mark,
> In the head.S code, this was under an ifdef CONFIG_ARM_GIC_V3, but that
> ifdef wasn't carried into the macro here, or into its use below. I'm not
> sure of the impact, but that does seem to be a functional change.
>
> > +
> > +.macro __init_el2_hstr
> > + msr hstr_el2, xzr
Hey Sudeep,
> > +static unsigned int find_cpu_id(u64 mpidr)
> > +{
> > + unsigned int i;
> > +
> > + /* Reject invalid MPIDRs */
> > + if (mpidr & ~MPIDR_HWID_BITMASK)
> > + return INVALID_CPU_ID;
> > +
> > + for (i = 0; i < NR_CPUS; i++) {
>
> I may not have understood the
On Fri, Nov 27, 2020 at 04:51:59PM +, Sudeep Holla wrote:
> On Thu, Nov 26, 2020 at 03:54:14PM +0000, David Brazdil wrote:
> > Forward the following PSCI SMCs issued by host to EL3 as they do not
> > require the hypervisor's intervention. This assumes that EL3 correctly
> >
Hey Sudeep,
> > diff --git a/Documentation/admin-guide/kernel-parameters.txt
> > b/Documentation/admin-guide/kernel-parameters.txt
> > index 526d65d8573a..06c89975c29c 100644
> > --- a/Documentation/admin-guide/kernel-parameters.txt
> > +++ b/Documentation/admin-guide/kernel-parameters.txt
> >
> @@ -1227,9 +1229,16 @@ static int set_id_aa64pfr0_el1(struct kvm_vcpu *vcpu,
> (csv2 && arm64_get_spectre_v2_state() != SPECTRE_UNAFFECTED))
> return -EINVAL;
>
> - /* We can only differ with CSV2, and anything else is an error */
> + /* Same thing for CSV3 */
>
KVM currently initializes MAIR_EL2 to the value of MAIR_EL1. In
preparation for initializing MAIR_EL2 before MAIR_EL1, move the constant
into a shared header file. Since it is used for EL1 and EL2, rename to
MAIR_ELx_SET.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/memory.h | 13
SMCs.
Capability ARM64_PROTECTED_KVM is set if the param is passed, CONFIG_KVM
is enabled and the kernel was not booted with VHE.
Signed-off-by: David Brazdil
---
.../admin-guide/kernel-parameters.txt | 5
arch/arm64/include/asm/cpucaps.h | 3 +-
arch/arm64/include/asm
features were not checked
against the finalized capabilities.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/arm.c | 19 +++
arch/arm64/kvm/hyp/nvhe/hyp-smp.c | 16
2 files changed, 35 insertions(+)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm
only this_cpu_ptr() was supported by setting TPIDR_EL2.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/percpu.h | 6 ++
arch/arm64/kernel/image-vars.h| 3 +++
arch/arm64/kvm/hyp/nvhe/Makefile | 3 ++-
arch/arm64/kvm/hyp/nvhe/hyp-smp.c | 24
4 files
in the section and they are never
changed by hyp afterwards.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/sections.h | 1 +
arch/arm64/kernel/vmlinux.lds.S | 10 ++
arch/arm64/kvm/arm.c | 8
arch/arm64/kvm/hyp/nvhe/hyp.lds.S | 1 +
4 files changed, 20 insertions
.
Refactor __do_hyp_init to accept its parameters in a struct. This
prepares the code for KVM booting cores as well as removes any limits on
the number of __do_hyp_init arguments.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_asm.h | 6 ++
arch/arm64/include/asm/kvm_hyp.h | 2
KVM by default keeps the stub vector installed and installs the nVHE
vector only briefly for init and later on demand. Change this policy
to install the vector at init and then never uninstall it if the kernel
was given the protected KVM command line parameter.
Signed-off-by: David Brazdil
.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_asm.h | 2 --
arch/arm64/include/asm/kvm_mmu.h | 26 +-
arch/arm64/kvm/arm.c | 4 +---
arch/arm64/kvm/hyp/nvhe/hyp-init.S | 9 ++---
4 files changed, 32 insertions(+), 9 deletions(-)
diff
.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/hyp-init.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-init.S
b/arch/arm64/kvm/hyp/nvhe/hyp-init.S
index b11a9d7db677..17b58dbc3a2f 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-init.S
+++ b/arch
code after the trap handler would have returned.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/host.S | 9 +
1 file changed, 9 insertions(+)
diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S
index 2b56f0bdf874..a820dfdc9c25 100644
--- a/arch/arm64/kvm
Function IDs used by PSCI are configurable for v0.1 via DT/APCI. If the
host is using PSCI v0.1, KVM's host PSCI proxy needs to use the same IDs.
Expose the array holding the information with a read-only accessor.
Signed-off-by: David Brazdil
---
drivers/firmware/psci/psci.c | 16
is currently unused so this has no effect on
existing functionality.
Signed-off-by: David Brazdil
---
drivers/firmware/psci/psci.c | 7 +++
1 file changed, 7 insertions(+)
diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c
index 00af99b6f97c..213c68418a65 100644
--- a/drivers
+), the SMC is handled by the PSCI handler. For now, all
SMCs return PSCI_RET_NOT_SUPPORTED.
Signed-off-by: David Brazdil
---
arch/arm64/include/asm/kvm_hyp.h | 2 +
arch/arm64/kvm/arm.c | 29 -
.../arm64/kvm/hyp/include/nvhe/trap_handler.h | 18 +++
arch
racing them for the same
boot args struct, CPU_SUSPEND uses a different struct instance and entry
point. Each entry point selects the corresponding struct to restore host
boot args from. This avoids the need for locking in CPU_SUSPEND.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/hyp
returning ERET to the provided PC in EL1.
There is a simple atomic lock around the boot args struct. If it is
already locked, CPU_ON will return PENDING_ON error code.
Signed-off-by: David Brazdil
---
arch/arm64/kvm/hyp/nvhe/hyp-init.S | 30
arch/arm64/kvm/hyp/nvhe/psci-relay.c | 109
> > > > +/*
> > > > + * Memory types available.
> > > > + *
> > > > + * IMPORTANT: MT_NORMAL must be index 0 since vm_get_page_prot() may
> > > > 'or' in
> > > > + * the MT_NORMAL_TAGGED memory type for PROT_MTE mappings.
> > > > Note
> > > > + * that protection_map[] only
On Mon, Nov 23, 2020 at 03:27:01PM +, Marc Zyngier wrote:
> On Mon, 16 Nov 2020 20:43:09 +,
> David Brazdil wrote:
> >
> > When the a CPU is booted in EL2, the kernel checks for VHE support and
> > initializes the CPU core accordingly. For nVHE it also insta
On Mon, Nov 23, 2020 at 02:20:07PM +, Marc Zyngier wrote:
> On Mon, 16 Nov 2020 20:43:00 +,
> David Brazdil wrote:
> >
> > Once we start initializing KVM on newly booted cores before the rest of
> > the kernel, parameters to __do_hyp_init will need to be provide
On Mon, Nov 23, 2020 at 01:52:54PM +, Marc Zyngier wrote:
> On Mon, 16 Nov 2020 20:42:58 +,
> David Brazdil wrote:
> >
> > KVM currently initializes MAIR_EL2 to the value of MAIR_EL1. In
> > preparation for initializing MAIR_EL2 before MAIR_EL1, move the constant
On Mon, Nov 23, 2020 at 02:02:50PM +, 'Quentin Perret' via kernel-team
wrote:
> On Monday 23 Nov 2020 at 12:57:23 (+), David Brazdil wrote:
> > > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> > > index 882eb383bd75..391cf6753a13 100644
> > &
> +int copy_ftr_reg(u32 id, struct arm64_ftr_reg *dst)
> +{
> + struct arm64_ftr_reg *regp = get_arm64_ftr_reg(id);
> +
> + if (!regp)
> + return -EINVAL;
> +
> + memcpy(dst, regp, sizeof(*regp));
> +
> + return 0;
> +}
> +
> #define read_sysreg_case(r) \
> case
On Tue, Nov 17, 2020 at 06:15:49PM +, 'Quentin Perret' via kernel-team
wrote:
> In order to allow the usage of code shared by the host and the hyp in
> static inline library function, allow the usage of kvm_nvhe_sym() at el2
> by defaulting to the raw symbol name.
>
> Signed-off-by: Quentin
1 - 100 of 332 matches
Mail list logo