@@ -14,6 +14,7 @@ use crate::vp_context_builder::VpContextBuilder;
1414use crate :: vp_context_builder:: VpContextPageState ;
1515use crate :: vp_context_builder:: VpContextState ;
1616use crate :: vp_context_builder:: snp:: InjectionType ;
17+ use crate :: vp_context_builder:: snp:: SecureAvic ;
1718use crate :: vp_context_builder:: snp:: SnpHardwareContext ;
1819use crate :: vp_context_builder:: tdx:: TdxHardwareContext ;
1920use crate :: vp_context_builder:: vbs:: VbsRegister ;
@@ -149,6 +150,7 @@ pub enum LoaderIsolationType {
149150 shared_gpa_boundary_bits : Option < u8 > ,
150151 policy : SnpPolicy ,
151152 injection_type : InjectionType ,
153+ secure_avic : SecureAvic ,
152154 // TODO SNP: SNP Keys? Other data?
153155 } ,
154156 Tdx {
@@ -201,6 +203,7 @@ impl IgvmLoaderRegister for X86Register {
201203 shared_gpa_boundary_bits,
202204 policy,
203205 injection_type,
206+ secure_avic,
204207 } => {
205208 // TODO SNP: assumed that shared_gpa_boundary is always available.
206209 let shared_gpa_boundary =
@@ -227,6 +230,7 @@ impl IgvmLoaderRegister for X86Register {
227230 !with_paravisor,
228231 shared_gpa_boundary,
229232 injection_type,
233+ secure_avic,
230234 ) ) ;
231235
232236 ( platform_header, vec ! [ init_header] , vp_context_builder)
@@ -890,25 +894,30 @@ impl<R: IgvmLoaderRegister + GuestArch + 'static> ImageLoad<R> for IgvmVtlLoader
890894 paravisor_present : self . loader . paravisor_present ,
891895 isolation_type : IsolationType :: None ,
892896 shared_gpa_boundary_bits : None ,
897+ auto_enable_secure_apic : false ,
893898 } ,
894899 LoaderIsolationType :: Vbs { .. } => IsolationConfig {
895900 paravisor_present : self . loader . paravisor_present ,
896901 isolation_type : IsolationType :: Vbs ,
897902 shared_gpa_boundary_bits : None ,
903+ auto_enable_secure_apic : false ,
898904 } ,
899905 LoaderIsolationType :: Snp {
900906 shared_gpa_boundary_bits,
901907 policy : _,
902908 injection_type : _,
909+ secure_avic,
903910 } => IsolationConfig {
904911 paravisor_present : self . loader . paravisor_present ,
905912 isolation_type : IsolationType :: Snp ,
906913 shared_gpa_boundary_bits,
914+ auto_enable_secure_apic : matches ! ( secure_avic, SecureAvic :: Auto ) ,
907915 } ,
908916 LoaderIsolationType :: Tdx { .. } => IsolationConfig {
909917 paravisor_present : self . loader . paravisor_present ,
910918 isolation_type : IsolationType :: Tdx ,
911919 shared_gpa_boundary_bits : Some ( TDX_SHARED_GPA_BOUNDARY_BITS ) ,
920+ auto_enable_secure_apic : false ,
912921 } ,
913922 }
914923 }
@@ -1260,6 +1269,7 @@ mod tests {
12601269 shared_gpa_boundary_bits : Some ( 39 ) ,
12611270 policy : SnpPolicy :: from ( ( 0x1 << 17 ) | ( 0x1 << 16 ) | ( 0x1f ) ) ,
12621271 injection_type : InjectionType :: Restricted ,
1272+ secure_avic : SecureAvic :: Enabled ,
12631273 } ,
12641274 ) ;
12651275 let data = vec ! [ 0 , 5 ] ;
0 commit comments