Host registers a1-a7 are caller-saved according to the RISC-V calling convention and need not be preserved across the world switch, including the NACL path. Remove their redundant save and restore operations, saving 14 load/store instructions per guest entry/exit pair. Signed-off-by: Tan Chi --- arch/riscv/kvm/vcpu_switch.S | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/arch/riscv/kvm/vcpu_switch.S b/arch/riscv/kvm/vcpu_switch.S index 47686bcb21e..6613451fee1 100644 --- a/arch/riscv/kvm/vcpu_switch.S +++ b/arch/riscv/kvm/vcpu_switch.S @@ -12,20 +12,13 @@ #include .macro SAVE_HOST_GPRS - /* Save Host GPRs (except A0 and T0-T6) */ + /* Save Host GPRs (except A0-A7 and T0-T6) */ REG_S ra, (KVM_ARCH_HOST_RA)(a0) REG_S sp, (KVM_ARCH_HOST_SP)(a0) REG_S gp, (KVM_ARCH_HOST_GP)(a0) REG_S tp, (KVM_ARCH_HOST_TP)(a0) REG_S s0, (KVM_ARCH_HOST_S0)(a0) REG_S s1, (KVM_ARCH_HOST_S1)(a0) - REG_S a1, (KVM_ARCH_HOST_A1)(a0) - REG_S a2, (KVM_ARCH_HOST_A2)(a0) - REG_S a3, (KVM_ARCH_HOST_A3)(a0) - REG_S a4, (KVM_ARCH_HOST_A4)(a0) - REG_S a5, (KVM_ARCH_HOST_A5)(a0) - REG_S a6, (KVM_ARCH_HOST_A6)(a0) - REG_S a7, (KVM_ARCH_HOST_A7)(a0) REG_S s2, (KVM_ARCH_HOST_S2)(a0) REG_S s3, (KVM_ARCH_HOST_S3)(a0) REG_S s4, (KVM_ARCH_HOST_S4)(a0) @@ -161,20 +154,13 @@ .endm .macro RESTORE_HOST_GPRS - /* Restore Host GPRs (except A0 and T0-T6) */ + /* Restore Host GPRs (except A0-A7 and T0-T6) */ REG_L ra, (KVM_ARCH_HOST_RA)(a0) REG_L sp, (KVM_ARCH_HOST_SP)(a0) REG_L gp, (KVM_ARCH_HOST_GP)(a0) REG_L tp, (KVM_ARCH_HOST_TP)(a0) REG_L s0, (KVM_ARCH_HOST_S0)(a0) REG_L s1, (KVM_ARCH_HOST_S1)(a0) - REG_L a1, (KVM_ARCH_HOST_A1)(a0) - REG_L a2, (KVM_ARCH_HOST_A2)(a0) - REG_L a3, (KVM_ARCH_HOST_A3)(a0) - REG_L a4, (KVM_ARCH_HOST_A4)(a0) - REG_L a5, (KVM_ARCH_HOST_A5)(a0) - REG_L a6, (KVM_ARCH_HOST_A6)(a0) - REG_L a7, (KVM_ARCH_HOST_A7)(a0) REG_L s2, (KVM_ARCH_HOST_S2)(a0) REG_L s3, (KVM_ARCH_HOST_S3)(a0) REG_L s4, (KVM_ARCH_HOST_S4)(a0) base-commit: ffdc855900a894034a63a46d699e0326dea3c991 -- 2.43.0