@@ -417,28 +417,30 @@ bool initialize_trusty(struct vcpu *vcpu, uint64_t param)
417
417
return false;
418
418
}
419
419
420
- if (boot_param .version > TRUSTY_VERSION_2 ) {
421
- dev_dbg (ACRN_DBG_TRUSTY , "%s: Version(%u) not supported!\n" ,
422
- __func__ , boot_param .version );
423
- return false;
424
- }
425
-
426
- trusty_entry_gpa = (uint64_t )boot_param .entry_point ;
427
- trusty_base_gpa = (uint64_t )boot_param .base_addr ;
428
- trusty_mem_size = boot_param .mem_size ;
429
-
430
- if (boot_param .version >= TRUSTY_VERSION_2 ) {
431
- trusty_entry_gpa |=
420
+ switch (boot_param .version ) {
421
+ case TRUSTY_VERSION_2 :
422
+ trusty_entry_gpa = ((uint64_t )boot_param .entry_point ) |
432
423
(((uint64_t )boot_param .entry_point_high ) << 32 );
433
- trusty_base_gpa |=
424
+ trusty_base_gpa = (( uint64_t ) boot_param . base_addr ) |
434
425
(((uint64_t )boot_param .base_addr_high ) << 32 );
435
426
436
427
/* copy rpmb_key from OSloader */
437
428
(void )memcpy_s (& g_key_info .rpmb_key [0 ][0 ], 64U ,
438
429
& boot_param .rpmb_key [0 ], 64U );
439
430
(void )memset (& boot_param .rpmb_key [0 ], 0U , 64U );
431
+ break ;
432
+ case TRUSTY_VERSION :
433
+ trusty_entry_gpa = (uint64_t )boot_param .entry_point ;
434
+ trusty_base_gpa = (uint64_t )boot_param .base_addr ;
435
+ break ;
436
+ default :
437
+ dev_dbg (ACRN_DBG_TRUSTY , "%s: Version(%u) not supported!\n" ,
438
+ __func__ , boot_param .version );
439
+ return false;
440
440
}
441
441
442
+ trusty_mem_size = boot_param .mem_size ;
443
+
442
444
create_secure_world_ept (vm , trusty_base_gpa , trusty_mem_size ,
443
445
TRUSTY_EPT_REBASE_GPA );
444
446
trusty_base_hpa = vm -> sworld_control .sworld_memory .base_hpa ;
0 commit comments