@@ -10,6 +10,7 @@ import (
1010 "net"
1111 "os"
1212 "path/filepath"
13+ "runtime"
1314 "strings"
1415
1516 "github.com/Microsoft/go-winio"
@@ -181,6 +182,12 @@ func NewDefaultOptionsLCOW(id, owner string) *OptionsLCOW {
181182
182183 opts .UpdateBootFilesPath (context .TODO (), defaultLCOWOSBootFilesPath ())
183184
185+ if runtime .GOARCH == "arm64" {
186+ // ARM64 doesn't support KernelDirect, so disable it even if the flag is set.
187+ opts .KernelDirect = false
188+ // ARM64 doesn't support VPMem yet, so disable it even if the flag is set.
189+ opts .VPMemDeviceCount = 0
190+ }
184191 return opts
185192}
186193
@@ -218,11 +225,12 @@ func (opts *OptionsLCOW) UpdateBootFilesPath(ctx context.Context, path string) {
218225 }).Debug ("updated LCOW root filesystem to " + VhdFile )
219226 }
220227
221- if opts .KernelDirect {
228+ if opts .KernelDirect && runtime . GOARCH != "arm64" {
222229 // KernelDirect supports uncompressed kernel if the kernel is present.
223230 // Default to uncompressed if on box. NOTE: If `kernel` is already
224231 // uncompressed and simply named 'kernel' it will still be used
225232 // uncompressed automatically.
233+ // ARM64 doesn't support KernelDirect, so skip this logic in that case.
226234 if _ , err := os .Stat (filepath .Join (opts .BootFilesPath , UncompressedKernelFile )); err == nil {
227235 opts .KernelFile = UncompressedKernelFile
228236
@@ -807,14 +815,20 @@ func makeLCOWDoc(ctx context.Context, opts *OptionsLCOW, uvm *UtilityVM) (_ *hcs
807815 vmDebugging := false
808816 if opts .ConsolePipe != "" {
809817 vmDebugging = true
810- kernelArgs += " 8250_core.nr_uarts=1 8250_core.skip_txen_test=1 console=ttyS0,115200"
818+ if runtime .GOARCH == "arm64" {
819+ kernelArgs += " console=ttyAMA0,115200"
820+ } else {
821+ kernelArgs += " 8250_core.nr_uarts=1 8250_core.skip_txen_test=1 console=ttyS0,115200"
822+ }
811823 doc .VirtualMachine .Devices .ComPorts = map [string ]hcsschema.ComPort {
812824 "0" : { // Which is actually COM1
813825 NamedPipe : opts .ConsolePipe ,
814826 },
815827 }
816828 } else {
817- kernelArgs += " 8250_core.nr_uarts=0"
829+ if runtime .GOARCH != "arm64" {
830+ kernelArgs += " 8250_core.nr_uarts=0"
831+ }
818832 }
819833
820834 if opts .EnableGraphicsConsole {
@@ -835,7 +849,7 @@ func makeLCOWDoc(ctx context.Context, opts *OptionsLCOW, uvm *UtilityVM) (_ *hcs
835849 kernelArgs += " " + opts .KernelBootOptions
836850 }
837851
838- if ! opts .VPCIEnabled {
852+ if runtime . GOARCH != "arm64" && ! opts .VPCIEnabled {
839853 kernelArgs += ` pci=off`
840854 }
841855
@@ -967,6 +981,12 @@ func CreateLCOW(ctx context.Context, opts *OptionsLCOW) (_ *UtilityVM, err error
967981 return nil , errors .Wrap (err , errBadUVMOpts .Error ())
968982 }
969983
984+ // KernelDirect and VPMem devices are not supported by Hyper-V on ARM64.
985+ if runtime .GOARCH == "arm64" {
986+ opts .KernelDirect = false
987+ opts .VPMemDeviceCount = 0
988+ }
989+
970990 // HCS config for SNP isolated vm is quite different to the usual case
971991 var doc * hcsschema.ComputeSystem
972992 if opts .SecurityPolicyEnabled {
0 commit comments