Skip to content

Commit 66da492

Browse files
committed
Disable video console in SNP mode
Video console is not supported when a UVM is being started in SNP isolation mode. It is anyway always disabled when starting a pod, but uvmboot tool always enabled it until now. This change only enables it if the isolation mode isn't SNP. Also, adds a new log statement to log the generated UVM HCS doc. Signed-off-by: Amit Barve <ambarve@microsoft.com>
1 parent 0fc5d6e commit 66da492

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

internal/tools/uvmboot/conf_wcow.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ var cwcowCommand = cli.Command{
114114
options.DisableSecureBoot = cwcowDisableSecureBoot
115115
options.GuestStateFilePath = cwcowVMGSPath
116116
options.IsolationType = cwcowIsolationMode
117-
// always enable graphics console with uvmboot - helps with testing/debugging
118-
options.EnableGraphicsConsole = true
117+
118+
// graphics console helps with testing/debugging however, it
119+
// doesn't work in SNP isolation mode.
120+
options.EnableGraphicsConsole = cwcowIsolationMode != "SecureNestedPaging"
119121
options.WritableEFI = cwcowWritableEFI
120122

121123
var err error

internal/uvm/create.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ func verifyOptions(_ context.Context, options interface{}) error {
193193
if opts.SecurityPolicyEnabled && opts.GuestStateFilePath == "" {
194194
return fmt.Errorf("GuestStateFilePath must be provided when enabling security policy")
195195
}
196+
if opts.IsolationType == "SecureNestedPaging" && opts.EnableGraphicsConsole {
197+
return fmt.Errorf("graphics console cannot be enabled with SecureNestedPaging isolation mode")
198+
}
196199
if opts.ResourcePartitionID != nil {
197200
if opts.CPUGroupID != "" {
198201
return errors.New("resource partition ID and CPU group ID cannot be set at the same time")

internal/uvm/create_wcow.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ func prepareSecurityConfigDoc(ctx context.Context, uvm *UtilityVM, opts *Options
354354

355355
enableHCL := true
356356
doc.VirtualMachine.SecuritySettings = &hcsschema.SecuritySettings{
357-
EnableTpm: false,
357+
EnableTpm: false, // TPM MUST always remain false in confidential mode as per the design
358358
Isolation: &hcsschema.IsolationSettings{
359359
IsolationType: "SecureNestedPaging",
360360
HclEnabled: &enableHCL,
@@ -522,10 +522,20 @@ func CreateWCOW(ctx context.Context, opts *OptionsWCOW) (_ *UtilityVM, err error
522522
var doc *hcsschema.ComputeSystem
523523
if opts.SecurityPolicyEnabled {
524524
doc, err = prepareSecurityConfigDoc(ctx, uvm, opts)
525-
log.G(ctx).Tracef("CreateWCOW prepareSecurityConfigDoc result doc: %v err %v", doc, err)
525+
if logrus.IsLevelEnabled(logrus.TraceLevel) {
526+
log.G(ctx).WithFields(logrus.Fields{
527+
"doc": log.Format(ctx, doc),
528+
logrus.ErrorKey: err,
529+
}).Trace("CreateWCOW prepareSecurityConfigDoc")
530+
}
526531
} else {
527532
doc, err = prepareConfigDoc(ctx, uvm, opts)
528-
log.G(ctx).Tracef("CreateWCOW prepareConfigDoc result doc: %v err %v", doc, err)
533+
if logrus.IsLevelEnabled(logrus.TraceLevel) {
534+
log.G(ctx).WithFields(logrus.Fields{
535+
"doc": log.Format(ctx, doc),
536+
logrus.ErrorKey: err,
537+
}).Trace("CreateWCOW prepareConfigDoc")
538+
}
529539
}
530540
if err != nil {
531541
return nil, fmt.Errorf("error in preparing config doc: %w", err)

0 commit comments

Comments
 (0)