@@ -66,32 +66,26 @@ int32_t hcall_world_switch(struct acrn_vcpu *vcpu)
66
66
*/
67
67
int32_t hcall_initialize_trusty (struct acrn_vcpu * vcpu , uint64_t param )
68
68
{
69
- if (vcpu -> vm -> sworld_control .flag .supported == 0UL ) {
70
- dev_dbg (ACRN_DBG_TRUSTY_HYCALL ,
71
- "Secure World is not supported!\n" );
72
- return - EPERM ;
73
- }
74
-
75
- if (vcpu -> vm -> sworld_control .flag .active != 0UL ) {
76
- dev_dbg (ACRN_DBG_TRUSTY_HYCALL ,
77
- "Trusty already initialized!\n" );
78
- return - EPERM ;
79
- }
69
+ int32_t ret = 0 ;
80
70
81
- if (vcpu -> arch .cur_context != NORMAL_WORLD ) {
82
- dev_dbg (ACRN_DBG_TRUSTY_HYCALL ,
83
- "%s, must initialize Trusty from Normal World!\n" ,
84
- __func__ );
85
- return - EPERM ;
86
- }
87
-
88
- if (!initialize_trusty (vcpu , param )) {
89
- return - ENODEV ;
71
+ if (vcpu -> vm -> sworld_control .flag .supported == 0UL ) {
72
+ pr_err ("Secure World is not supported!\n" );
73
+ ret = - EPERM ;
74
+ } else if (vcpu -> vm -> sworld_control .flag .active != 0UL ) {
75
+ pr_err ("Trusty already initialized!\n" );
76
+ ret = - EPERM ;
77
+ } else if (vcpu -> arch .cur_context != NORMAL_WORLD ) {
78
+ pr_err ("%s, must initialize Trusty from Normal World!\n" , __func__ );
79
+ ret = - EPERM ;
80
+ } else {
81
+ if (!initialize_trusty (vcpu , param )) {
82
+ ret = - ENODEV ;
83
+ } else {
84
+ vcpu -> vm -> sworld_control .flag .active = 1UL ;
85
+ }
90
86
}
91
87
92
- vcpu -> vm -> sworld_control .flag .active = 1UL ;
93
-
94
- return 0 ;
88
+ return ret ;
95
89
}
96
90
97
91
/**
0 commit comments