@@ -33,11 +33,11 @@ use devices::virtio::{port_io, MmioTransport, PortDescription, Vsock};
33
33
#[ cfg( target_os = "macos" ) ]
34
34
use hvf:: MemoryMapping ;
35
35
36
- #[ cfg( feature = "tee" ) ]
36
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
37
37
use kbs_types:: Tee ;
38
38
39
39
use crate :: device_manager;
40
- #[ cfg( feature = "tee" ) ]
40
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
41
41
use crate :: resources:: TeeConfig ;
42
42
#[ cfg( target_os = "linux" ) ]
43
43
use crate :: signal_handler:: register_sigint_handler;
@@ -55,12 +55,12 @@ use crate::vstate::KvmContext;
55
55
use crate :: vstate:: MeasuredRegion ;
56
56
use crate :: vstate:: { Error as VstateError , Vcpu , VcpuConfig , Vm } ;
57
57
use arch:: ArchMemoryInfo ;
58
- #[ cfg( feature = "tee" ) ]
58
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
59
59
use arch:: InitrdConfig ;
60
60
use device_manager:: shm:: ShmManager ;
61
61
#[ cfg( not( feature = "tee" ) ) ]
62
62
use devices:: virtio:: { fs:: ExportTable , VirtioShmRegion } ;
63
- #[ cfg( feature = "tee" ) ]
63
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
64
64
use kvm_bindings:: KVM_MAX_CPUID_ENTRIES ;
65
65
use libc:: { STDERR_FILENO , STDIN_FILENO , STDOUT_FILENO } ;
66
66
use nix:: unistd:: isatty;
@@ -342,7 +342,7 @@ enum Payload {
342
342
Empty ,
343
343
#[ cfg( feature = "efi" ) ]
344
344
Efi ,
345
- #[ cfg( feature = "tee" ) ]
345
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
346
346
Tee ( MmapRegion , u64 , usize , u64 , usize , u64 , usize ) ,
347
347
}
348
348
@@ -370,17 +370,17 @@ pub fn build_microvm(
370
370
. map_err ( StartMicrovmError :: KernelBundle ) ?
371
371
} ;
372
372
373
- #[ cfg( feature = "tee" ) ]
373
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
374
374
let qboot_bundle = vm_resources
375
375
. qboot_bundle ( )
376
376
. ok_or ( StartMicrovmError :: MissingKernelConfig ) ?;
377
377
378
- #[ cfg( feature = "tee" ) ]
378
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
379
379
let initrd_bundle = vm_resources
380
380
. initrd_bundle ( )
381
381
. ok_or ( StartMicrovmError :: MissingKernelConfig ) ?;
382
382
383
- #[ cfg( feature = "tee" ) ]
383
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
384
384
let payload = Payload :: Tee (
385
385
kernel_region,
386
386
kernel_bundle. guest_addr ,
@@ -402,7 +402,7 @@ pub fn build_microvm(
402
402
. vm_config ( )
403
403
. mem_size_mib
404
404
. ok_or ( StartMicrovmError :: MissingMemSizeConfig ) ?,
405
- #[ cfg( feature = "tee" ) ]
405
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
406
406
None ,
407
407
#[ cfg( not( feature = "tee" ) ) ]
408
408
Some ( vm_resources) ,
@@ -422,7 +422,7 @@ pub fn build_microvm(
422
422
#[ allow( unused_mut) ]
423
423
let mut vm = setup_vm ( & guest_memory) ?;
424
424
425
- #[ cfg( feature = "tee" ) ]
425
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
426
426
let ( kvm, mut vm) = {
427
427
let kvm = KvmContext :: new ( )
428
428
. map_err ( Error :: KvmContext )
@@ -431,10 +431,10 @@ pub fn build_microvm(
431
431
( kvm, vm)
432
432
} ;
433
433
434
- #[ cfg( feature = "tee" ) ]
434
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
435
435
let tee = vm_resources. tee_config ( ) . tee ;
436
436
437
- #[ cfg( feature = "tee" ) ]
437
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
438
438
let sev_launcher = match tee {
439
439
Tee :: Sev => Some (
440
440
vm. sev_secure_virt_prepare ( & guest_memory)
@@ -443,7 +443,7 @@ pub fn build_microvm(
443
443
_ => None ,
444
444
} ;
445
445
446
- #[ cfg( feature = "tee" ) ]
446
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
447
447
let snp_launcher = match tee {
448
448
Tee :: Snp => Some (
449
449
vm. snp_secure_virt_prepare ( & guest_memory)
@@ -452,7 +452,7 @@ pub fn build_microvm(
452
452
_ => None ,
453
453
} ;
454
454
455
- #[ cfg( feature = "tee" ) ]
455
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
456
456
let measured_regions = {
457
457
println ! ( "Injecting and measuring memory regions. This may take a while." ) ;
458
458
@@ -543,7 +543,7 @@ pub fn build_microvm(
543
543
544
544
#[ cfg( all( target_os = "linux" , target_arch = "x86_64" , not( feature = "tee" ) ) ) ]
545
545
let boot_ip: GuestAddress = GuestAddress ( kernel_bundle. entry_addr ) ;
546
- #[ cfg( feature = "tee" ) ]
546
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
547
547
let boot_ip: GuestAddress = GuestAddress ( arch:: RESET_VECTOR ) ;
548
548
549
549
let vcpus;
@@ -712,7 +712,7 @@ pub fn build_microvm(
712
712
#[ cfg( all( target_arch = "x86_64" , not( feature = "tee" ) ) ) ]
713
713
load_cmdline ( & vmm) ?;
714
714
715
- #[ cfg( feature = "tee" ) ]
715
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
716
716
let initrd_config = Some ( InitrdConfig {
717
717
address : GuestAddress ( arch:: x86_64:: layout:: INITRD_SEV_START ) ,
718
718
size : initrd_bundle. size ,
@@ -728,7 +728,7 @@ pub fn build_microvm(
728
728
)
729
729
. map_err ( StartMicrovmError :: Internal ) ?;
730
730
731
- #[ cfg( feature = "tee" ) ]
731
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
732
732
{
733
733
match tee {
734
734
Tee :: Sev => vmm
@@ -794,7 +794,7 @@ fn load_payload(
794
794
. map_err ( StartMicrovmError :: GuestMemoryMmap ) ,
795
795
#[ cfg( test) ]
796
796
Payload :: Empty => Ok ( guest_mem) ,
797
- #[ cfg( feature = "tee" ) ]
797
+ #[ cfg( all ( feature = "tee" , target_arch = "x86_64" ) ) ]
798
798
Payload :: Tee (
799
799
kernel_region,
800
800
kernel_load_addr,
@@ -919,7 +919,7 @@ pub(crate) fn setup_vm(
919
919
. map_err ( StartMicrovmError :: Internal ) ?;
920
920
Ok ( vm)
921
921
}
922
- #[ cfg( all( target_os = "linux" , feature = "tee" ) ) ]
922
+ #[ cfg( all( target_os = "linux" , feature = "tee" , target_arch = "x86_64" ) ) ]
923
923
pub ( crate ) fn setup_vm (
924
924
kvm : & KvmContext ,
925
925
guest_memory : & GuestMemoryMmap ,
0 commit comments