2222 */
2323u64 hv_do_hypercall (u64 control , void * input , void * output )
2424{
25- struct arm_smccc_res res ;
2625 u64 input_address ;
2726 u64 output_address ;
2827
2928 input_address = input ? virt_to_phys (input ) : 0 ;
3029 output_address = output ? virt_to_phys (output ) : 0 ;
3130
32- arm_smccc_1_1_hvc (HV_FUNC_ID , control ,
33- input_address , output_address , & res );
34- return res .a0 ;
31+ return hv_do_hvc (control , input_address , output_address );
3532}
3633EXPORT_SYMBOL_GPL (hv_do_hypercall );
3734
@@ -40,19 +37,25 @@ EXPORT_SYMBOL_GPL(hv_do_hypercall);
4037 * with arguments in registers instead of physical memory.
4138 * Avoids the overhead of virt_to_phys for simple hypercalls.
4239 */
43-
4440u64 hv_do_fast_hypercall8 (u16 code , u64 input )
4541{
46- struct arm_smccc_res res ;
4742 u64 control ;
4843
4944 control = (u64 )code | HV_HYPERCALL_FAST_BIT ;
50-
51- arm_smccc_1_1_hvc (HV_FUNC_ID , control , input , & res );
52- return res .a0 ;
45+ return hv_do_hvc (control , input );
5346}
5447EXPORT_SYMBOL_GPL (hv_do_fast_hypercall8 );
5548
49+ union hv_hypercall_status {
50+ u64 as_uint64 ;
51+ struct {
52+ u16 status ;
53+ u16 reserved ;
54+ u16 reps_completed ; /* Low 12 bits */
55+ u16 reserved2 ;
56+ };
57+ };
58+
5659/*
5760 * hv_do_fast_hypercall16 -- Invoke the specified hypercall
5861 * with arguments in registers instead of physical memory.
@@ -75,25 +78,24 @@ EXPORT_SYMBOL_GPL(hv_do_fast_hypercall16);
7578 */
7679void hv_set_vpreg (u32 msr , u64 value )
7780{
78- struct arm_smccc_res res ;
81+ union hv_hypercall_status status ;
7982
80- arm_smccc_1_1_hvc ( HV_FUNC_ID ,
83+ status . as_uint64 = hv_do_hvc (
8184 HVCALL_SET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT |
8285 HV_HYPERCALL_REP_COMP_1 ,
8386 HV_PARTITION_ID_SELF ,
8487 HV_VP_INDEX_SELF ,
8588 msr ,
8689 0 ,
8790 value ,
88- 0 ,
89- & res );
91+ 0 );
9092
9193 /*
9294 * Something is fundamentally broken in the hypervisor if
9395 * setting a VP register fails. There's really no way to
9496 * continue as a guest VM, so panic.
9597 */
96- BUG_ON (! hv_result_success ( res . a0 ) );
98+ BUG_ON (status . status != HV_STATUS_SUCCESS );
9799}
98100EXPORT_SYMBOL_GPL (hv_set_vpreg );
99101
@@ -106,31 +108,22 @@ EXPORT_SYMBOL_GPL(hv_set_vpreg);
106108
107109void hv_get_vpreg_128 (u32 msr , struct hv_get_vp_registers_output * result )
108110{
109- struct arm_smccc_1_2_regs args ;
110- struct arm_smccc_1_2_regs res ;
111+ u64 status ;
111112
112- args .a0 = HV_FUNC_ID ;
113- args .a1 = HVCALL_GET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT |
114- HV_HYPERCALL_REP_COMP_1 ;
115- args .a2 = HV_PARTITION_ID_SELF ;
116- args .a3 = HV_VP_INDEX_SELF ;
117- args .a4 = msr ;
118-
119- /*
120- * Use the SMCCC 1.2 interface because the results are in registers
121- * beyond X0-X3.
122- */
123- arm_smccc_1_2_hvc (& args , & res );
113+ status = hv_do_hvc_fast_get (
114+ HVCALL_GET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT |
115+ HV_HYPERCALL_REP_COMP_1 ,
116+ HV_PARTITION_ID_SELF ,
117+ HV_VP_INDEX_SELF ,
118+ msr ,
119+ result );
124120
125121 /*
126122 * Something is fundamentally broken in the hypervisor if
127123 * getting a VP register fails. There's really no way to
128124 * continue as a guest VM, so panic.
129125 */
130- BUG_ON (!hv_result_success (res .a0 ));
131-
132- result -> as64 .low = res .a6 ;
133- result -> as64 .high = res .a7 ;
126+ BUG_ON ((status & HV_HYPERCALL_RESULT_MASK ) != HV_STATUS_SUCCESS );
134127}
135128EXPORT_SYMBOL_GPL (hv_get_vpreg_128 );
136129
0 commit comments