Skip to content
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

Add support for ARMv8 to use AAVMF EFI firmware #880

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

dustins
Copy link

@dustins dustins commented May 17, 2024

I discovered I wasn't able to run VMs on my RK3588 (ARM64). Although ARM64 supports UEFI it wasn't able to find appropriate *.fd files because it is assumed every architecture was using OVMF. On ARM64 it should be using AAVMF as far as I can tell.

This PR adds support for using AAVMF on ARMv8 architectures and updates the documentation to reflect the code changes.

I've tested creating VMs with these changes on my ARM64 and x86_64 machines but don't have many devices to test against.

Signed-off-by: Dustin Sweigart <dustins@swigg.net>
Signed-off-by: Dustin Sweigart <dustins@swigg.net>
Signed-off-by: Dustin Sweigart <dustins@swigg.net>
@github-actions github-actions bot added the Documentation Documentation needs updating label May 17, 2024
@dustins dustins marked this pull request as ready for review May 17, 2024 21:03
@dustins dustins requested a review from stgraber as a code owner May 17, 2024 21:03
@dustins dustins changed the title cmd/incusd: Add support for ARMv8 to use AAVMF EFI firmware Add support for ARMv8 to use AAVMF EFI firmware May 17, 2024
@@ -36,7 +36,7 @@ Name | Description
`INCUS_EXEC_PATH` | Full path to the Incus binary (used when forking subcommands)
`INCUS_IDMAPPED_MOUNTS_DISABLE` | Disable idmapped mounts support (useful when testing traditional UID shifting)
`INCUS_LXC_TEMPLATE_CONFIG` | Path to the LXC template configuration directory
`INCUS_OVMF_PATH` | Path to an OVMF build including `OVMF_CODE.fd` and `OVMF_VARS.ms.fd`
`INCUS_EFI_PATH` | Path to EFI firmware build including `*_CODE.fd` and `*_VARS.fd`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably use INCUS_EDK2_PATH instead to be a bit more specific about what we're using.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on your other comment about the ed2k driver would prefer edk2 be used throughout the code instead of the more generic efi?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think so, especially as EFI is misleading anyway given that what we're using today is UEFI, not the old EFI (which I had to deal with a long time ago ;)).

Comment on lines +325 to +328
```{note}
On ARM64 CPUs you need to install AAVMF instead of OVMF for UEFI to work with virtual machines.
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should need that.

Instead we should just remove all that symlink stuff and make sure that the logic in the code knows to look into /usr/share/qemu too in this case.

@@ -114,40 +114,60 @@ const qemuBlockDevIDPrefix = "incus_"
// qemuMigrationNBDExportName is the name of the disk device export by the migration NBD server.
const qemuMigrationNBDExportName = "incus_root"

// OVMF firmwares.
type ovmfFirmware struct {
// EFI firmwares.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rework here looks good, but I think we should make a new internal/server/instance/drivers/edk2 package which would contain those definitions and possibly some functions to access it.

That would then make it easy to consume from the apparmor package too so we don't need to keep duplicating logic between the two.

Copy link
Author

@dustins dustins May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that. Thanks for the feedback. I'll give it a go and push some new commits.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@stgraber
Copy link
Member

@dustins have you had any luck with this one?

@dustins
Copy link
Author

dustins commented May 30, 2024

Yes, I actually am almost done just wanted to test on x86 and ARM64 before pushing. Sorry for the long delay! I think I can test tonight and then push up the changes for you to review.

@stgraber
Copy link
Member

Sounds good.

We're releasing 6.2 today so that will most likely miss that release by a hair but it will be in 6.3 for sure.

@dustins
Copy link
Author

dustins commented Jun 1, 2024

I still have to test this on arm64/x86_64 to check that this all still works.

Signed-off-by: Dustin Sweigart <dustins@swigg.net>
Signed-off-by: Dustin Sweigart <dustins@swigg.net>
@dustins
Copy link
Author

dustins commented Jun 2, 2024

Ok I tested this on my x86_64/arm64 boxes and I was able to launch VMs with and without secure boot.

@@ -1,4 +1,5 @@
AAAA
AAVMF
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file also needs to have EDK2 added to it.

@@ -0,0 +1,141 @@
package edk2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is missing the Signed-off-by line

@@ -40,7 +40,7 @@ import (
"google.golang.org/protobuf/proto"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is missing the Signed-off-by line

@@ -7,6 +7,7 @@ import (
"strings"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is missing the Signed-off-by line

@@ -36,7 +36,7 @@ Name | Description
`INCUS_EXEC_PATH` | Full path to the Incus binary (used when forking subcommands)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is missing the Signed-off-by line

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the correct way for me to resolve the commits without the Signed-off-by line?

"github.com/lxc/incus/v6/client"
incus "github.com/lxc/incus/v6/client"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needless change caused by goimports.

@stgraber
Copy link
Member

stgraber commented Jun 2, 2024

Looking good, just a few changes needed to get the tests to be happy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation needs updating
Development

Successfully merging this pull request may close these issues.

None yet

2 participants