@@ -341,7 +341,7 @@ static int kvm_trap_handle_gspr(struct kvm_vcpu *vcpu)
341
341
* 2) Execute CACOP/IDLE instructions;
342
342
* 3) Access to unimplemented CSRs/IOCSRs.
343
343
*/
344
- static int kvm_handle_gspr (struct kvm_vcpu * vcpu )
344
+ static int kvm_handle_gspr (struct kvm_vcpu * vcpu , int ecode )
345
345
{
346
346
int ret = RESUME_GUEST ;
347
347
enum emulation_result er = EMULATE_DONE ;
@@ -705,12 +705,12 @@ static int kvm_handle_rdwr_fault(struct kvm_vcpu *vcpu, bool write)
705
705
return ret ;
706
706
}
707
707
708
- static int kvm_handle_read_fault (struct kvm_vcpu * vcpu )
708
+ static int kvm_handle_read_fault (struct kvm_vcpu * vcpu , int ecode )
709
709
{
710
710
return kvm_handle_rdwr_fault (vcpu , false);
711
711
}
712
712
713
- static int kvm_handle_write_fault (struct kvm_vcpu * vcpu )
713
+ static int kvm_handle_write_fault (struct kvm_vcpu * vcpu , int ecode )
714
714
{
715
715
return kvm_handle_rdwr_fault (vcpu , true);
716
716
}
@@ -726,11 +726,12 @@ int kvm_complete_user_service(struct kvm_vcpu *vcpu, struct kvm_run *run)
726
726
/**
727
727
* kvm_handle_fpu_disabled() - Guest used fpu however it is disabled at host
728
728
* @vcpu: Virtual CPU context.
729
+ * @ecode: Exception code.
729
730
*
730
731
* Handle when the guest attempts to use fpu which hasn't been allowed
731
732
* by the root context.
732
733
*/
733
- static int kvm_handle_fpu_disabled (struct kvm_vcpu * vcpu )
734
+ static int kvm_handle_fpu_disabled (struct kvm_vcpu * vcpu , int ecode )
734
735
{
735
736
struct kvm_run * run = vcpu -> run ;
736
737
@@ -783,11 +784,12 @@ static long kvm_save_notify(struct kvm_vcpu *vcpu)
783
784
/*
784
785
* kvm_handle_lsx_disabled() - Guest used LSX while disabled in root.
785
786
* @vcpu: Virtual CPU context.
787
+ * @ecode: Exception code.
786
788
*
787
789
* Handle when the guest attempts to use LSX when it is disabled in the root
788
790
* context.
789
791
*/
790
- static int kvm_handle_lsx_disabled (struct kvm_vcpu * vcpu )
792
+ static int kvm_handle_lsx_disabled (struct kvm_vcpu * vcpu , int ecode )
791
793
{
792
794
if (kvm_own_lsx (vcpu ))
793
795
kvm_queue_exception (vcpu , EXCCODE_INE , 0 );
@@ -798,19 +800,20 @@ static int kvm_handle_lsx_disabled(struct kvm_vcpu *vcpu)
798
800
/*
799
801
* kvm_handle_lasx_disabled() - Guest used LASX while disabled in root.
800
802
* @vcpu: Virtual CPU context.
803
+ * @ecode: Exception code.
801
804
*
802
805
* Handle when the guest attempts to use LASX when it is disabled in the root
803
806
* context.
804
807
*/
805
- static int kvm_handle_lasx_disabled (struct kvm_vcpu * vcpu )
808
+ static int kvm_handle_lasx_disabled (struct kvm_vcpu * vcpu , int ecode )
806
809
{
807
810
if (kvm_own_lasx (vcpu ))
808
811
kvm_queue_exception (vcpu , EXCCODE_INE , 0 );
809
812
810
813
return RESUME_GUEST ;
811
814
}
812
815
813
- static int kvm_handle_lbt_disabled (struct kvm_vcpu * vcpu )
816
+ static int kvm_handle_lbt_disabled (struct kvm_vcpu * vcpu , int ecode )
814
817
{
815
818
if (kvm_own_lbt (vcpu ))
816
819
kvm_queue_exception (vcpu , EXCCODE_INE , 0 );
@@ -872,7 +875,7 @@ static void kvm_handle_service(struct kvm_vcpu *vcpu)
872
875
kvm_write_reg (vcpu , LOONGARCH_GPR_A0 , ret );
873
876
}
874
877
875
- static int kvm_handle_hypercall (struct kvm_vcpu * vcpu )
878
+ static int kvm_handle_hypercall (struct kvm_vcpu * vcpu , int ecode )
876
879
{
877
880
int ret ;
878
881
larch_inst inst ;
@@ -932,16 +935,14 @@ static int kvm_handle_hypercall(struct kvm_vcpu *vcpu)
932
935
/*
933
936
* LoongArch KVM callback handling for unimplemented guest exiting
934
937
*/
935
- static int kvm_fault_ni (struct kvm_vcpu * vcpu )
938
+ static int kvm_fault_ni (struct kvm_vcpu * vcpu , int ecode )
936
939
{
937
- unsigned int ecode , inst ;
938
- unsigned long estat , badv ;
940
+ unsigned int inst ;
941
+ unsigned long badv ;
939
942
940
943
/* Fetch the instruction */
941
944
inst = vcpu -> arch .badi ;
942
945
badv = vcpu -> arch .badv ;
943
- estat = vcpu -> arch .host_estat ;
944
- ecode = (estat & CSR_ESTAT_EXC ) >> CSR_ESTAT_EXC_SHIFT ;
945
946
kvm_err ("ECode: %d PC=%#lx Inst=0x%08x BadVaddr=%#lx ESTAT=%#lx\n" ,
946
947
ecode , vcpu -> arch .pc , inst , badv , read_gcsr_estat ());
947
948
kvm_arch_vcpu_dump_regs (vcpu );
@@ -966,5 +967,5 @@ static exit_handle_fn kvm_fault_tables[EXCCODE_INT_START] = {
966
967
967
968
int kvm_handle_fault (struct kvm_vcpu * vcpu , int fault )
968
969
{
969
- return kvm_fault_tables [fault ](vcpu );
970
+ return kvm_fault_tables [fault ](vcpu , fault );
970
971
}
0 commit comments