@@ -1084,9 +1084,6 @@ static int pvm_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
10841084 case MSR_PVM_RETU_RIP :
10851085 msr_info -> data = pvm -> msr_retu_rip_plus2 - 2 ;
10861086 break ;
1087- case MSR_PVM_RETS_RIP :
1088- msr_info -> data = pvm -> msr_rets_rip_plus2 - 2 ;
1089- break ;
10901087 case MSR_PVM_LINEAR_ADDRESS_RANGE :
10911088 msr_info -> data = pvm -> msr_linear_address_range ;
10921089 break ;
@@ -1234,9 +1231,6 @@ static int pvm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
12341231 case MSR_PVM_RETU_RIP :
12351232 pvm -> msr_retu_rip_plus2 = msr_info -> data + 2 ;
12361233 break ;
1237- case MSR_PVM_RETS_RIP :
1238- pvm -> msr_rets_rip_plus2 = msr_info -> data + 2 ;
1239- break ;
12401234 case MSR_PVM_LINEAR_ADDRESS_RANGE :
12411235 if (!pvm_check_and_set_msr_linear_address_range (pvm , msr_info -> data ))
12421236 return 1 ;
@@ -1573,7 +1567,7 @@ static int __do_pvm_event(struct kvm_vcpu *vcpu, bool user, int vector,
15731567 * the hypervisor to meet the requirement stipulated above in
15741568 * case it is on the path to ERETU.
15751569 *
1576- * When forced back to handle_synthetic_instruction_return (),
1570+ * When forced back to handle_synthetic_instruction_return_user (),
15771571 * SWITCH_FLAGS_IRQ_WIN will be cleared in kvm_set_rflags() or
15781572 * unhandled NMI/MCE will be reinjected.
15791573 */
@@ -1776,16 +1770,15 @@ static void pvm_setup_mce(struct kvm_vcpu *vcpu)
17761770{
17771771}
17781772
1779- static int handle_synthetic_instruction_return (struct kvm_vcpu * vcpu , bool user )
1773+ static int handle_synthetic_instruction_return_user (struct kvm_vcpu * vcpu )
17801774{
17811775 struct vcpu_pvm * pvm = to_pvm (vcpu );
17821776 struct pvm_vcpu_struct * pvcs ;
17831777 unsigned long rflags ;
17841778 u32 pending_async_exceptions ;
17851779
17861780 /* switch to user mode before rsp changed. */
1787- if (user )
1788- switch_to_umod (vcpu );
1781+ switch_to_umod (vcpu );
17891782
17901783 pvcs = pvm_get_vcpu_struct (pvm );
17911784 if (!pvcs ) {
@@ -1794,21 +1787,16 @@ static int handle_synthetic_instruction_return(struct kvm_vcpu *vcpu, bool user)
17941787 }
17951788
17961789 pending_async_exceptions = pvcs -> event_vector ;
1797- if (user )
1798- pvcs -> event_vector = PVM_PVCS_EVENT_VECTOR_STD ;
1799- else
1800- pvcs -> event_vector = 0 ;
1790+ pvcs -> event_vector = PVM_PVCS_EVENT_VECTOR_STD ; // Clear other bits
18011791
18021792 kvm_rip_write (vcpu , pvcs -> rip );
18031793 kvm_rcx_write (vcpu , pvcs -> rcx );
18041794 kvm_r11_write (vcpu , pvcs -> r11 );
18051795 rflags = pvcs -> eflags ;
18061796
1807- if (user ) {
1808- pvm -> hw_cs = pvcs -> user_cs | USER_RPL ;
1809- pvm -> hw_ss = pvcs -> user_ss | USER_RPL ;
1810- pvm_write_guest_gs_base (pvm , pvcs -> user_gsbase );
1811- }
1797+ pvm -> hw_cs = pvcs -> user_cs | USER_RPL ;
1798+ pvm -> hw_ss = pvcs -> user_ss | USER_RPL ;
1799+ pvm_write_guest_gs_base (pvm , pvcs -> user_gsbase );
18121800
18131801 pvm_put_vcpu_struct (pvm , true);
18141802
@@ -1819,9 +1807,9 @@ static int handle_synthetic_instruction_return(struct kvm_vcpu *vcpu, bool user)
18191807 kvm_set_rflags (vcpu , rflags );
18201808
18211809 if (pending_async_exceptions & PVM_PVCS_EVENT_VECTOR_MCE )
1822- __do_pvm_event (vcpu , user , MC_VECTOR , false, 0 );
1810+ do_pvm_event (vcpu , MC_VECTOR , false, 0 );
18231811 if (pending_async_exceptions & PVM_PVCS_EVENT_VECTOR_NMI )
1824- __do_pvm_event (vcpu , user , NMI_VECTOR , false, 0 );
1812+ do_pvm_event (vcpu , NMI_VECTOR , false, 0 );
18251813
18261814 return 1 ;
18271815}
@@ -2094,9 +2082,7 @@ static int handle_exit_syscall(struct kvm_vcpu *vcpu)
20942082 return __do_pvm_event (vcpu , true, PVM_SYSCALL_VECTOR , false, 0 );
20952083
20962084 if (rip == pvm -> msr_retu_rip_plus2 )
2097- return handle_synthetic_instruction_return (vcpu , true);
2098- if (rip == pvm -> msr_rets_rip_plus2 )
2099- return handle_synthetic_instruction_return (vcpu , false);
2085+ return handle_synthetic_instruction_return_user (vcpu );
21002086
21012087 a0 = kvm_rbx_read (vcpu );
21022088 a1 = kvm_r10_read (vcpu );
@@ -2398,8 +2384,6 @@ static u32 pvm_get_syscall_exit_reason(struct kvm_vcpu *vcpu)
23982384 if (is_smod (pvm )) {
23992385 if (rip == pvm -> msr_retu_rip_plus2 )
24002386 return PVM_EXIT_REASONS_ERETU ;
2401- else if (rip == pvm -> msr_rets_rip_plus2 )
2402- return PVM_EXIT_REASONS_ERETS ;
24032387 else
24042388 return PVM_EXIT_REASONS_HYPERCALL ;
24052389 }
@@ -2853,7 +2837,6 @@ static void pvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
28532837 pvm -> msr_vcpu_struct = 0 ;
28542838 pvm -> msr_event_entry = 0 ;
28552839 pvm -> msr_retu_rip_plus2 = 0 ;
2856- pvm -> msr_rets_rip_plus2 = 0 ;
28572840 pvm_set_default_msr_linear_address_range (pvm );
28582841}
28592842
0 commit comments