diff options
| author | Russell King <rmk+kernel@armlinux.org.uk> | 2018-05-15 12:04:10 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@armlinux.org.uk> | 2018-05-31 06:09:03 -0400 |
| commit | b800acfc70d9fb81fbd6df70f2cf5e20f70023d0 (patch) | |
| tree | 41031cd094feab970a12814d9e603774e884dfd1 | |
| parent | 3c908e16396d130608e831b7fac4b167a2ede6ba (diff) | |
ARM: KVM: Add SMCCC_ARCH_WORKAROUND_1 fast handling
We want SMCCC_ARCH_WORKAROUND_1 to be fast. As fast as possible.
So let's intercept it as early as we can by testing for the
function call number as soon as we've identified a HVC call
coming from the guest.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Boot-tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
| -rw-r--r-- | arch/arm/kvm/hyp/hyp-entry.S | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/arm/kvm/hyp/hyp-entry.S b/arch/arm/kvm/hyp/hyp-entry.S index 918a05dd2d63..aa3f9a9837ac 100644 --- a/arch/arm/kvm/hyp/hyp-entry.S +++ b/arch/arm/kvm/hyp/hyp-entry.S | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #include <linux/arm-smccc.h> | ||
| 19 | #include <linux/linkage.h> | 20 | #include <linux/linkage.h> |
| 20 | #include <asm/kvm_arm.h> | 21 | #include <asm/kvm_arm.h> |
| 21 | #include <asm/kvm_asm.h> | 22 | #include <asm/kvm_asm.h> |
| @@ -202,7 +203,7 @@ hyp_hvc: | |||
| 202 | lsr r2, r2, #16 | 203 | lsr r2, r2, #16 |
| 203 | and r2, r2, #0xff | 204 | and r2, r2, #0xff |
| 204 | cmp r2, #0 | 205 | cmp r2, #0 |
| 205 | bne guest_trap @ Guest called HVC | 206 | bne guest_hvc_trap @ Guest called HVC |
| 206 | 207 | ||
| 207 | /* | 208 | /* |
| 208 | * Getting here means host called HVC, we shift parameters and branch | 209 | * Getting here means host called HVC, we shift parameters and branch |
| @@ -253,6 +254,20 @@ THUMB( orr lr, #1) | |||
| 253 | pop {r2, lr} | 254 | pop {r2, lr} |
| 254 | eret | 255 | eret |
| 255 | 256 | ||
| 257 | guest_hvc_trap: | ||
| 258 | movw r2, #:lower16:ARM_SMCCC_ARCH_WORKAROUND_1 | ||
| 259 | movt r2, #:upper16:ARM_SMCCC_ARCH_WORKAROUND_1 | ||
| 260 | ldr r0, [sp] @ Guest's r0 | ||
| 261 | teq r0, r2 | ||
| 262 | bne guest_trap | ||
| 263 | add sp, sp, #12 | ||
| 264 | @ Returns: | ||
| 265 | @ r0 = 0 | ||
| 266 | @ r1 = HSR value (perfectly predictable) | ||
| 267 | @ r2 = ARM_SMCCC_ARCH_WORKAROUND_1 | ||
| 268 | mov r0, #0 | ||
| 269 | eret | ||
| 270 | |||
| 256 | guest_trap: | 271 | guest_trap: |
| 257 | load_vcpu r0 @ Load VCPU pointer to r0 | 272 | load_vcpu r0 @ Load VCPU pointer to r0 |
| 258 | 273 | ||
