-
Notifications
You must be signed in to change notification settings - Fork 277
Adding support for ARM64 LCOW #2606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
marma-dev
wants to merge
1
commit into
microsoft:main
Choose a base branch
from
marma-dev:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+32
−4
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import ( | |
| "net" | ||
| "os" | ||
| "path/filepath" | ||
| "runtime" | ||
| "strings" | ||
|
|
||
| "github.com/Microsoft/go-winio" | ||
|
|
@@ -181,6 +182,12 @@ func NewDefaultOptionsLCOW(id, owner string) *OptionsLCOW { | |
|
|
||
| opts.UpdateBootFilesPath(context.TODO(), defaultLCOWOSBootFilesPath()) | ||
|
|
||
| if runtime.GOARCH == "arm64" { | ||
| // ARM64 doesn't support KernelDirect, so disable it even if the flag is set. | ||
| opts.KernelDirect = false | ||
| // ARM64 doesn't support VPMem yet, so disable it even if the flag is set. | ||
| opts.VPMemDeviceCount = 0 | ||
| } | ||
| return opts | ||
| } | ||
|
|
||
|
|
@@ -218,11 +225,12 @@ func (opts *OptionsLCOW) UpdateBootFilesPath(ctx context.Context, path string) { | |
| }).Debug("updated LCOW root filesystem to " + VhdFile) | ||
| } | ||
|
|
||
| if opts.KernelDirect { | ||
| if opts.KernelDirect && runtime.GOARCH != "arm64" { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even though the fixes here are temporary in nature, I think we should avoid Silent override of user-requested KernelDirect/VPMem from annotations. |
||
| // KernelDirect supports uncompressed kernel if the kernel is present. | ||
| // Default to uncompressed if on box. NOTE: If `kernel` is already | ||
| // uncompressed and simply named 'kernel' it will still be used | ||
| // uncompressed automatically. | ||
| // ARM64 doesn't support KernelDirect, so skip this logic in that case. | ||
| if _, err := os.Stat(filepath.Join(opts.BootFilesPath, UncompressedKernelFile)); err == nil { | ||
| opts.KernelFile = UncompressedKernelFile | ||
|
|
||
|
|
@@ -807,14 +815,20 @@ func makeLCOWDoc(ctx context.Context, opts *OptionsLCOW, uvm *UtilityVM) (_ *hcs | |
| vmDebugging := false | ||
| if opts.ConsolePipe != "" { | ||
| vmDebugging = true | ||
| kernelArgs += " 8250_core.nr_uarts=1 8250_core.skip_txen_test=1 console=ttyS0,115200" | ||
| if runtime.GOARCH == "arm64" { | ||
| kernelArgs += " console=ttyAMA0,115200" | ||
| } else { | ||
| kernelArgs += " 8250_core.nr_uarts=1 8250_core.skip_txen_test=1 console=ttyS0,115200" | ||
| } | ||
| doc.VirtualMachine.Devices.ComPorts = map[string]hcsschema.ComPort{ | ||
| "0": { // Which is actually COM1 | ||
| NamedPipe: opts.ConsolePipe, | ||
| }, | ||
| } | ||
| } else { | ||
| kernelArgs += " 8250_core.nr_uarts=0" | ||
| if runtime.GOARCH != "arm64" { | ||
| kernelArgs += " 8250_core.nr_uarts=0" | ||
| } | ||
| } | ||
|
|
||
| if opts.EnableGraphicsConsole { | ||
|
|
@@ -835,7 +849,7 @@ func makeLCOWDoc(ctx context.Context, opts *OptionsLCOW, uvm *UtilityVM) (_ *hcs | |
| kernelArgs += " " + opts.KernelBootOptions | ||
| } | ||
|
|
||
| if !opts.VPCIEnabled { | ||
| if runtime.GOARCH != "arm64" && !opts.VPCIEnabled { | ||
| kernelArgs += ` pci=off` | ||
| } | ||
|
|
||
|
|
@@ -967,6 +981,12 @@ func CreateLCOW(ctx context.Context, opts *OptionsLCOW) (_ *UtilityVM, err error | |
| return nil, errors.Wrap(err, errBadUVMOpts.Error()) | ||
| } | ||
|
|
||
| // KernelDirect and VPMem devices are not supported by Hyper-V on ARM64. | ||
| if runtime.GOARCH == "arm64" { | ||
| opts.KernelDirect = false | ||
| opts.VPMemDeviceCount = 0 | ||
| } | ||
|
|
||
| // HCS config for SNP isolated vm is quite different to the usual case | ||
| var doc *hcsschema.ComputeSystem | ||
| if opts.SecurityPolicyEnabled { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of triplicating this change, can we consolidate directboot and VPMEM setting at one place, say in CreateLCOW?