2323 */
2424u64 hv_do_hypercall (u64 control , void * input , void * output )
2525{
26- struct arm_smccc_res res ;
2726 u64 input_address ;
2827 u64 output_address ;
2928
3029 input_address = input ? virt_to_phys (input ) : 0 ;
3130 output_address = output ? virt_to_phys (output ) : 0 ;
3231
33- arm_smccc_1_1_hvc (HV_FUNC_ID , control ,
34- input_address , output_address , & res );
35- return res .a0 ;
32+ return hv_do_hvc (control , input_address , output_address );
3633}
3734EXPORT_SYMBOL_GPL (hv_do_hypercall );
3835
@@ -41,43 +38,48 @@ EXPORT_SYMBOL_GPL(hv_do_hypercall);
4138 * with arguments in registers instead of physical memory.
4239 * Avoids the overhead of virt_to_phys for simple hypercalls.
4340 */
44-
4541u64 hv_do_fast_hypercall8 (u16 code , u64 input )
4642{
47- struct arm_smccc_res res ;
4843 u64 control ;
4944
5045 control = (u64 )code | HV_HYPERCALL_FAST_BIT ;
51-
52- arm_smccc_1_1_hvc (HV_FUNC_ID , control , input , & res );
53- return res .a0 ;
46+ return hv_do_hvc (control , input );
5447}
5548EXPORT_SYMBOL_GPL (hv_do_fast_hypercall8 );
5649
50+ union hv_hypercall_status {
51+ u64 as_uint64 ;
52+ struct {
53+ u16 status ;
54+ u16 reserved ;
55+ u16 reps_completed ; /* Low 12 bits */
56+ u16 reserved2 ;
57+ };
58+ };
59+
5760/*
5861 * Set a single VP register to a 64-bit value.
5962 */
6063void hv_set_vpreg (u32 msr , u64 value )
6164{
62- struct arm_smccc_res res ;
65+ union hv_hypercall_status status ;
6366
64- arm_smccc_1_1_hvc ( HV_FUNC_ID ,
67+ status . as_uint64 = hv_do_hvc (
6568 HVCALL_SET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT |
6669 HV_HYPERCALL_REP_COMP_1 ,
6770 HV_PARTITION_ID_SELF ,
6871 HV_VP_INDEX_SELF ,
6972 msr ,
7073 0 ,
7174 value ,
72- 0 ,
73- & res );
75+ 0 );
7476
7577 /*
7678 * Something is fundamentally broken in the hypervisor if
7779 * setting a VP register fails. There's really no way to
7880 * continue as a guest VM, so panic.
7981 */
80- BUG_ON (! hv_result_success ( res . a0 ) );
82+ BUG_ON (status . status != HV_STATUS_SUCCESS );
8183}
8284EXPORT_SYMBOL_GPL (hv_set_vpreg );
8385
@@ -90,31 +92,22 @@ EXPORT_SYMBOL_GPL(hv_set_vpreg);
9092
9193void hv_get_vpreg_128 (u32 msr , struct hv_get_vp_registers_output * result )
9294{
93- struct arm_smccc_1_2_regs args ;
94- struct arm_smccc_1_2_regs res ;
95-
96- args .a0 = HV_FUNC_ID ;
97- args .a1 = HVCALL_GET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT |
98- HV_HYPERCALL_REP_COMP_1 ;
99- args .a2 = HV_PARTITION_ID_SELF ;
100- args .a3 = HV_VP_INDEX_SELF ;
101- args .a4 = msr ;
95+ u64 status ;
10296
103- /*
104- * Use the SMCCC 1.2 interface because the results are in registers
105- * beyond X0-X3.
106- */
107- arm_smccc_1_2_hvc (& args , & res );
97+ status = hv_do_hvc_fast_get (
98+ HVCALL_GET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT |
99+ HV_HYPERCALL_REP_COMP_1 ,
100+ HV_PARTITION_ID_SELF ,
101+ HV_VP_INDEX_SELF ,
102+ msr ,
103+ result );
108104
109105 /*
110106 * Something is fundamentally broken in the hypervisor if
111107 * getting a VP register fails. There's really no way to
112108 * continue as a guest VM, so panic.
113109 */
114- BUG_ON (!hv_result_success (res .a0 ));
115-
116- result -> as64 .low = res .a6 ;
117- result -> as64 .high = res .a7 ;
110+ BUG_ON ((status & HV_HYPERCALL_RESULT_MASK ) != HV_STATUS_SUCCESS );
118111}
119112EXPORT_SYMBOL_GPL (hv_get_vpreg_128 );
120113
0 commit comments