On 16/11/15 15:53, Ard Biesheuvel wrote:
> On 16 November 2015 at 14:11, Marc Zyngier wrote:
>> Add the panic handler, together with the small bits of assembly
>> code to call the kernel's panic implementation.
>>
>> Signed-off-by: Marc Zyngier
>> ---
On 16/11/15 14:16, Mark Rutland wrote:
>> diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
>> index 06d3e20..cdc2a96 100644
>> --- a/arch/arm64/kvm/hyp/switch.c
>> +++ b/arch/arm64/kvm/hyp/switch.c
>> @@ -140,3 +140,38 @@ int __hyp_text __guest_run(struct kvm_vcpu *vcpu)
>>
On 16 November 2015 at 14:11, Marc Zyngier wrote:
> Add the panic handler, together with the small bits of assembly
> code to call the kernel's panic implementation.
>
> Signed-off-by: Marc Zyngier
> ---
> arch/arm64/kvm/hyp/hyp-entry.S | 11
Currently __kvm_hyp_panic uses %p for values which are not pointers,
such as the ESR value. This can confusingly lead to "(null)" being
printed for the value.
Use %x instead, and only use %p for host pointers.
Signed-off-by: Mark Rutland
Acked-by: Marc Zyngier
On 16/11/15 14:32, Mark Rutland wrote:
+ /* Call panic for real */
+ while (1) {
+ unsigned long str_va = (unsigned long)__hyp_panic_string;
+
+ str_va -= HYP_PAGE_OFFSET;
+ str_va += PAGE_OFFSET;
+ __hyp_do_panic(str_va,
On 16/11/15 14:27, Mark Rutland wrote:
> On Mon, Nov 16, 2015 at 01:11:55PM +, Marc Zyngier wrote:
>> In order to run C code in HYP, we must make sure that the kernel's
>> RO section in mapped into HYP (otherwise things break badly).
>
> Somewhat tangential, but do we have any strong
> diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
> index 06d3e20..cdc2a96 100644
> --- a/arch/arm64/kvm/hyp/switch.c
> +++ b/arch/arm64/kvm/hyp/switch.c
> @@ -140,3 +140,38 @@ int __hyp_text __guest_run(struct kvm_vcpu *vcpu)
>
> return exit_code;
> }
> +
> +static
In order to expose the various EL2 services that are private to
the hypervisor, add a new hyp.h file.
So far, it only contains mundane things such as section annotation
and VA manipulation.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/hyp.h | 31
This is it. We remove all of the code that has now been rewritten.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/Makefile |2 -
arch/arm64/kvm/hyp.S| 1071 +--
arch/arm64/kvm/vgic-v2-switch.S | 134 -
As we've now switched to the new world switch implementation,
remove the weak attributes, as nobody is supposed to override
it anymore.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/debug-sr.c | 5 ++---
arch/arm64/kvm/hyp/hyp-entry.S | 3 ---
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 +++-
arch/arm64/kvm/hyp/fpsimd.S |
Implement the timer save restore as a direct translation of
the assembly code version.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/Makefile | 1 +
arch/arm64/kvm/hyp/hyp.h | 3 ++
arch/arm64/kvm/hyp/timer-sr.c | 68
From: Mark Rutland
Rather than crafting custom macros for reading/writing each system
register provide generics accessors, read_sysreg and write_sysreg, for
this purpose.
Unlike read_cpuid, calls to read_exception_reg are never expected
to be optimized away or replaced
Implement the 32bit system register save restore as a direct
translation of the assembly code version.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/hyp.h | 2 ++
arch/arm64/kvm/hyp/sysreg-sr.c | 41 +
2 files changed, 43
Implement the system registe save restore as a direct translation of
the assembly code version.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/Makefile| 1 +
arch/arm64/kvm/hyp/hyp.h | 3 ++
arch/arm64/kvm/hyp/sysreg-sr.c | 90
Once upon a time, the KVM/arm64 world switch was a nice, clean, lean
and mean piece of hand-crafted assembly code. Over time, features have
crept in, the code has become harder to maintain, and the smallest
change is a pain to introduce. The VHE patches are a prime example of
why this doesn't work
Add the entry points for HYP mode (both for hypercalls and
exception handling).
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/Makefile| 1 +
arch/arm64/kvm/hyp/hyp-entry.S | 189 +
2 files changed, 190 insertions(+)
Implement the vgic-v3 save restore as a direct translation of
the assembly code version.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/Makefile | 1 +
arch/arm64/kvm/hyp/hyp.h| 3 +
arch/arm64/kvm/hyp/vgic-v3-sr.c | 222
As we've now rewritten most of our code-base in C, most of the
KVM-specific code in asm-offset.c is useless. Delete-time again!
Signed-off-by: Marc Zyngier
---
arch/arm64/kernel/asm-offsets.c | 39 ---
1 file changed, 39 deletions(-)
KVM so far relies on code patching, and is likely to use it more
in the future. The main issue is that our alternative system works
at the instruction level, while we'd like to have alternatives at
the function level.
In order to cope with this, add the "hyp_alternate_select" macro that
outputs a
Having the system register numbers as #defines has been a pain
since day one, as the ordering is pretty fragile, and moving
things around leads to renumbering and epic conflict resolutions.
Now that we're mostly acessing the sysreg file in C, an enum is
a much better type to use, and we can clean
Implement the core of the world switch in C. Not everything is there
yet, and there is nothing to re-enter the world switch either.
But this already outlines the code structure well enough.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/Makefile | 1 +
So far, we've implemented the new world switch with a completely
different namespace, so that we could have both implementation
compiled in.
Let's take things one step further by adding weak aliases that
have the same names as the original implementation. The weak
attributes allows the new
Contrary to the previous patch, the guest entry is fairly different
from its assembly counterpart, mostly because it is only concerned
with saving/restoring the GP registers, and nothing else.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/Makefile | 1 +
Add the panic handler, together with the small bits of assembly
code to call the kernel's panic implementation.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/hyp-entry.S | 11 ++-
arch/arm64/kvm/hyp/hyp.h | 1 +
arch/arm64/kvm/hyp/switch.c| 35
Implement the TLB handling as a direct translation of the assembly
code version.
Signed-off-by: Marc Zyngier
---
arch/arm64/kvm/hyp/Makefile | 1 +
arch/arm64/kvm/hyp/tlb.c| 72 +
2 files changed, 73 insertions(+)
create
If we call __kvm_hyp_panic while a guest context is active, we call
__restore_sysregs before acquiring the system register values for the
panic, in the process throwing away the PAR_EL1 value at the point of
the panic.
This patch modifies __kvm_hyp_panic to stash the PAR_EL1 value prior to
Cortex-A57 parts up to r1p2 can misreport Stage 2 translation faults
when a Stage 1 permission fault or device alignment fault should
have been reported.
This patch implements the workaround (which is to validate that the
Stage-1 translation actually succeeds) by using code patching.
Here's a couple of fixes for KVM/arm64:
- The first one addresses a misinterpretation of the architecture
spec, leading to the mishandling of I/O accesses generated from an
AArch32 guest using banked registers.
- The second one is a workaround for a Cortex-A57 erratum.
Both patches are
When running a 32bit guest under a 64bit hypervisor, the ARMv8
architecture defines a mapping of the 32bit registers in the 64bit
space. This includes banked registers that are being demultiplexed
over the 64bit ones.
On exception caused by an operation involving a 32bit register, the
HW exposes
Hi
This series is supposed to bring support for 16-bit VMID offered by
the ARMv8.1 architecture extension into KVM.
The first to patches are clean-up to make kvm_arm.h fit into assembly
code nicely. The third patch modifies KVM code to recognise and use
16-bit VMID.
Thanks!
Vladimir Murzin
The ARMv8.1 architecture extension allows to choose between 8-bit and
16-bit of VMID, so use this capability for KVM.
Signed-off-by: Vladimir Murzin
---
arch/arm/include/asm/kvm_arm.h |2 +-
arch/arm/include/asm/kvm_mmu.h |5 +
arch/arm/kvm/arm.c
Since commit a987370 "arm64: KVM: Fix stage-2 PGD allocation to have
per-page refcounting" there is no reference to S2_PGD_ORDER, so kill it
for the good.
Signed-off-by: Vladimir Murzin
---
arch/arm/include/asm/kvm_arm.h |1 -
arch/arm/kvm/mmu.c |
kvm_arm.h is included from both C code and assembly code; however some
definitions in this header supplied with U/UL/ULL suffixes which might
confuse assembly once they got evaluated.
We have _AC macro for such cases, so just wrap problem places with it.
Signed-off-by: Vladimir Murzin
34 matches
Mail list logo