diff options
Diffstat (limited to 'arch/arm64/kvm/hyp.S')
-rw-r--r-- | arch/arm64/kvm/hyp.S | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S index 3b47c36e10ff..2c56012cb2d2 100644 --- a/arch/arm64/kvm/hyp.S +++ b/arch/arm64/kvm/hyp.S | |||
@@ -694,6 +694,24 @@ __hyp_panic_str: | |||
694 | 694 | ||
695 | .align 2 | 695 | .align 2 |
696 | 696 | ||
697 | /* | ||
698 | * u64 kvm_call_hyp(void *hypfn, ...); | ||
699 | * | ||
700 | * This is not really a variadic function in the classic C-way and care must | ||
701 | * be taken when calling this to ensure parameters are passed in registers | ||
702 | * only, since the stack will change between the caller and the callee. | ||
703 | * | ||
704 | * Call the function with the first argument containing a pointer to the | ||
705 | * function you wish to call in Hyp mode, and subsequent arguments will be | ||
706 | * passed as x0, x1, and x2 (a maximum of 3 arguments in addition to the | ||
707 | * function pointer can be passed). The function being called must be mapped | ||
708 | * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are | ||
709 | * passed in r0 and r1. | ||
710 | * | ||
711 | * A function pointer with a value of 0 has a special meaning, and is | ||
712 | * used to implement __hyp_get_vectors in the same way as in | ||
713 | * arch/arm64/kernel/hyp_stub.S. | ||
714 | */ | ||
697 | ENTRY(kvm_call_hyp) | 715 | ENTRY(kvm_call_hyp) |
698 | hvc #0 | 716 | hvc #0 |
699 | ret | 717 | ret |
@@ -737,7 +755,12 @@ el1_sync: // Guest trapped into EL2 | |||
737 | pop x2, x3 | 755 | pop x2, x3 |
738 | pop x0, x1 | 756 | pop x0, x1 |
739 | 757 | ||
740 | push lr, xzr | 758 | /* Check for __hyp_get_vectors */ |
759 | cbnz x0, 1f | ||
760 | mrs x0, vbar_el2 | ||
761 | b 2f | ||
762 | |||
763 | 1: push lr, xzr | ||
741 | 764 | ||
742 | /* | 765 | /* |
743 | * Compute the function address in EL2, and shuffle the parameters. | 766 | * Compute the function address in EL2, and shuffle the parameters. |
@@ -750,7 +773,7 @@ el1_sync: // Guest trapped into EL2 | |||
750 | blr lr | 773 | blr lr |
751 | 774 | ||
752 | pop lr, xzr | 775 | pop lr, xzr |
753 | eret | 776 | 2: eret |
754 | 777 | ||
755 | el1_trap: | 778 | el1_trap: |
756 | /* | 779 | /* |