@@ -24,11 +24,18 @@ const (
2424 MetalQEMUSNPGPU
2525 // MetalQEMUTDXGPU is the generic platform for bare-metal TDX deployments with GPU passthrough.
2626 MetalQEMUTDXGPU
27+ // MetalQEMUInsecure is the platform for bare-metal deployments with a non-CC runtime class.
28+ MetalQEMUInsecure
29+ // MetalQEMUInsecureGPU is the platform for bare-metal deployments with GPU passthrough and a non-CC runtime class.
30+ MetalQEMUInsecureGPU
2731)
2832
2933// All returns a list of all available platforms.
3034func All () []Platform {
31- return []Platform {MetalQEMUSNP , MetalQEMUTDX , MetalQEMUSNPGPU , MetalQEMUTDXGPU }
35+ return []Platform {
36+ MetalQEMUSNP , MetalQEMUTDX , MetalQEMUSNPGPU , MetalQEMUTDXGPU ,
37+ MetalQEMUInsecure , MetalQEMUInsecureGPU ,
38+ }
3239}
3340
3441// AllStrings returns a list of all available platforms as strings.
@@ -51,11 +58,28 @@ func (p Platform) String() string {
5158 return "Metal-QEMU-TDX"
5259 case MetalQEMUTDXGPU :
5360 return "Metal-QEMU-TDX-GPU"
61+ case MetalQEMUInsecure :
62+ return "Metal-QEMU-Insecure"
63+ case MetalQEMUInsecureGPU :
64+ return "Metal-QEMU-Insecure-GPU"
5465 default :
5566 return "Unknown"
5667 }
5768}
5869
70+ // InsecureVariant returns the insecure (non-CC) variant of the
71+ // platform, or Unknown if there is no such variant.
72+ func (p Platform ) InsecureVariant () Platform {
73+ switch p {
74+ case MetalQEMUSNP , MetalQEMUTDX :
75+ return MetalQEMUInsecure
76+ case MetalQEMUSNPGPU , MetalQEMUTDXGPU :
77+ return MetalQEMUInsecureGPU
78+ default :
79+ return Unknown
80+ }
81+ }
82+
5983// MarshalJSON marshals a Platform type to a JSON string.
6084func (p Platform ) MarshalJSON () ([]byte , error ) {
6185 return fmt .Appendf (nil , `"%s"` , p .String ()), nil
@@ -99,6 +123,10 @@ func FromString(s string) (Platform, error) {
99123 return MetalQEMUTDX , nil
100124 case "metal-qemu-tdx-gpu" :
101125 return MetalQEMUTDXGPU , nil
126+ case "metal-qemu-insecure" :
127+ return MetalQEMUInsecure , nil
128+ case "metal-qemu-insecure-gpu" :
129+ return MetalQEMUInsecureGPU , nil
102130 default :
103131 return Unknown , fmt .Errorf ("unknown platform: %s" , s )
104132 }
@@ -125,6 +153,10 @@ func FromRuntimeClassString(s string) (Platform, error) {
125153 return MetalQEMUTDXGPU , nil
126154 case strings .HasPrefix (s , "contrast-cc-metal-qemu-tdx" ):
127155 return MetalQEMUTDX , nil
156+ case strings .HasPrefix (s , "contrast-insecure-metal-qemu-gpu" ):
157+ return MetalQEMUInsecureGPU , nil
158+ case strings .HasPrefix (s , "contrast-insecure-metal-qemu" ):
159+ return MetalQEMUInsecure , nil
128160 default :
129161 return Unknown , fmt .Errorf ("unknown platform: %s" , s )
130162 }
@@ -133,7 +165,7 @@ func FromRuntimeClassString(s string) (Platform, error) {
133165// DefaultMemoryInMebiBytes returns the desired VM overhead for the given platform.
134166func DefaultMemoryInMebiBytes (p Platform ) int {
135167 switch p {
136- case MetalQEMUSNPGPU , MetalQEMUTDXGPU :
168+ case MetalQEMUSNPGPU , MetalQEMUTDXGPU , MetalQEMUInsecureGPU :
137169 // Guest components contribute around 600MiB with GPU enabled.
138170 return 1024
139171 default :
@@ -144,6 +176,16 @@ func DefaultMemoryInMebiBytes(p Platform) int {
144176 }
145177}
146178
179+ // IsInsecure returns true if the platform is an insecure (non-CC) platform.
180+ func IsInsecure (p Platform ) bool {
181+ switch p {
182+ case MetalQEMUInsecure , MetalQEMUInsecureGPU :
183+ return true
184+ default :
185+ return false
186+ }
187+ }
188+
147189// IsSNP returns true if the platform is a SEV-SNP platform.
148190func IsSNP (p Platform ) bool {
149191 switch p {
@@ -167,7 +209,7 @@ func IsTDX(p Platform) bool {
167209// IsGPU returns true if the platform supports GPUs.
168210func IsGPU (p Platform ) bool {
169211 switch p {
170- case MetalQEMUSNPGPU , MetalQEMUTDXGPU :
212+ case MetalQEMUSNPGPU , MetalQEMUTDXGPU , MetalQEMUInsecureGPU :
171213 return true
172214 default :
173215 return false
@@ -177,7 +219,8 @@ func IsGPU(p Platform) bool {
177219// IsQEMU returns true if the platform uses QEMU as the hypervisor.
178220func IsQEMU (p Platform ) bool {
179221 switch p {
180- case MetalQEMUSNP , MetalQEMUSNPGPU , MetalQEMUTDX , MetalQEMUTDXGPU :
222+ case MetalQEMUSNP , MetalQEMUSNPGPU , MetalQEMUTDX , MetalQEMUTDXGPU ,
223+ MetalQEMUInsecure , MetalQEMUInsecureGPU :
181224 return true
182225 default :
183226 return false
@@ -191,6 +234,8 @@ func (p Platform) WithGPU() Platform {
191234 return MetalQEMUSNPGPU
192235 case MetalQEMUTDX , MetalQEMUTDXGPU :
193236 return MetalQEMUTDXGPU
237+ case MetalQEMUInsecure , MetalQEMUInsecureGPU :
238+ return MetalQEMUInsecureGPU
194239 default :
195240 return Unknown
196241 }
0 commit comments