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

AArch64: ubuntu 20.04+ can't boot from rust hypervisor firmware #261

Closed
jongwu opened this issue Jul 6, 2023 · 0 comments · Fixed by #262
Closed

AArch64: ubuntu 20.04+ can't boot from rust hypervisor firmware #261

jongwu opened this issue Jul 6, 2023 · 0 comments · Fixed by #262

Comments

@jongwu
Copy link
Contributor

jongwu commented Jul 6, 2023

Guest stuck at UEFI shim or grub loading when boot ubuntu 20.04+ on AArch64.

How to reproduce:
Download ubuntu cloud image and convert to raw image, start VM from rust hypervisor firmware.

jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
For now, 0x40400000 ~ 0x40480000 is used for loading grub. But it may not
be enough sometime. Enlarge this area by movnge the ram_min to 0x40600000.
Thus there is 2M range for loading grub that is enough.

As PE loader will get image offset and size in the header to put it in the
right place, image header should also be updated.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
When boot ubuntu 22.04, grub may run out of efi allocations. Bump it to
512.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
There is a check that if fdt is stub when ACPI table initialized in
linux kernel [1]. So, if full fdt is given, fdt will be used insdead of
ACPI. It is aginst our primary goal to use UEFI. So, full fdt can't
be given here. For simplicity, just neglict it here.

It can be improved by making a stub fdt and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
There is a check that if fdt is stub when ACPI table initialized in
linux kernel [1]. So, if full fdt is given, fdt will be used insdead of
ACPI. It is aginst our primary goal to use UEFI. So, full fdt can't
be given here. For simplicity, just neglict it here.

It can be improved by making a stub fdt and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
There is a check that if fdt is stub when ACPI table initialized in
linux kernel [1]. So, if full fdt is given, fdt will be used insdead of
ACPI. It is aginst our primary goal to use UEFI. So, full fdt can't
be given here. For simplicity, just neglict it here.

It can be improved by making a stub fdt and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
There is a check that if fdt is stub when ACPI table initialized in
linux kernel [1]. So, if full fdt is given, fdt will be used insdead of
ACPI. It is aginst our primary goal to use UEFI. So, full fdt can't
be given here. For simplicity, just neglict it here.

It can be improved by making a stub fdt and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
There is a check that if fdt is stub when ACPI table initialized in
linux kernel [1]. So, if full fdt is given, fdt will be used insdead of
ACPI. It is aginst our primary goal to use UEFI. So, full fdt can't
be given here. For simplicity, just neglict it here.

It can be improved by making a stub fdt and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 6, 2023
There is a check that if fdt is stub when ACPI table initialized in
linux kernel [1]. So, if full fdt is given, fdt will be used insdead of
ACPI. It is aginst our primary goal to use UEFI. So, full fdt can't
be given here. For simplicity, just neglict it here.

It can be improved by making a stub fdt and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 17, 2023
For now, 0x40400000 ~ 0x40480000 is used for loading grub. But it may not
be enough sometime. Enlarge this area by movnge the ram_min to 0x40600000.
Thus there is 2M range for loading grub that is enough.

As PE loader will get image offset and size in the header to put it in the
right place, image header should also be updated.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 17, 2023
When boot ubuntu 22.04, grub may run out of efi allocations. Bump it to
512.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 17, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 17, 2023
There is a check that if fdt is stub when ACPI table initialized in
linux kernel [1]. So, if full fdt is given, fdt will be used instead of
ACPI. It is aginst our primary goal to use UEFI. So, full fdt can't
be given here. For simplicity, just neglict it here. Remember that this
is just a workaround as we are required to pass a FDT to kernel/grub to
meet Arm Base Boot Requirement 7.4.3 [2].

It can be improved by making a stub fdt and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
[2] https://developer.arm.com/documentation/den0044/latest
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
For now, 0x40400000 ~ 0x40480000 is used for loading grub. But it may not
be enough sometime. Enlarge this area by moving the ram_min to 0x40600000.
Thus there is 2M range for loading grub that is enough.

As PE loader will get image offset and size in the header to put it in the
right place, image header should also be updated.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
When boot ubuntu 22.04, grub may run out of efi allocations. Bump it to
512.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
There is a check that if FDT is stub when ACPI table initialized in
linux kernel [1]. So, if full FDT is given, FDT will be used instead of
ACPI. It is aginst our primary goal to use UEFI. So, full FDT can't
be given here. For simplicity, just neglict it here. Remember that this
is just a workaround as we are required to pass a FDT to kernel/grub to
meet Arm Base Boot Requirement 7.4.3 [2].

It can be improved by making a stub FDT and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
[2] https://developer.arm.com/documentation/den0044/latest
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
There is a check that if FDT is stub when ACPI table initialized in
linux kernel [1]. So, if full FDT is given, FDT will be used instead of
ACPI. It is aginst our primary goal to use UEFI. So, full FDT can't
be given here. For simplicity, just neglict it here. Remember that this
is just a workaround as we are required to pass a FDT to kernel/grub to
meet Arm Base Boot Requirement 7.4.3 [2].

It can be improved by making a stub FDT and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
[2] https://developer.arm.com/documentation/den0044/latest
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
There is a check that if FDT is stub when ACPI table initialized in
linux kernel [1]. So, if full FDT is given, FDT will be used instead of
ACPI. It is aginst our primary goal to use UEFI. So, full FDT can't
be given here. For simplicity, just neglict it here. Remember that this
is just a workaround as we are required to pass a FDT to kernel/grub to
meet Arm Base Boot Requirement 7.4.3 [2].

It can be improved by making a stub FDT and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
[2] https://developer.arm.com/documentation/den0044/latest
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 19, 2023
There is a check that if FDT is stub when ACPI table initialized in
linux kernel [1]. So, if full FDT is given, FDT will be used instead of
ACPI. It is aginst our primary goal to use UEFI. So, full FDT can't
be given here. For simplicity, just neglict it here. Remember that this
is just a workaround as we are required to pass a FDT to kernel/grub to
meet Arm Base Boot Requirement 7.4.3 [2].

It can be improved by making a stub FDT and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
[2] https://developer.arm.com/documentation/den0044/latest
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 20, 2023
In order to support the requirements of a larger GRUB binary extend the
size of the memory used for loading the payload. Since the payload
address is hardcoded to a location in RAM below that of where the RHF
binary is loaded increase adjust the ram_min constant to handle that.
This does not require any VMM changes as the load address in the PE
binary will reflect this change.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 20, 2023
When boot ubuntu 22.04, grub may run out of efi allocations. Bump it to
512.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 20, 2023
Fat filename can be 12, that is filename with length of 8 and extension
name with length of 3 and a separator like '.'. But directory name
length limits to 11. That's say some name can't be shown correctly. For
that case, we can do a fixup to give a correct name to userspace.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
jongwu added a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 20, 2023
There is a check that if FDT is stub when ACPI table initialized in
linux kernel [1]. So, if full FDT is given, FDT will be used instead of
ACPI. It is aginst our primary goal to use UEFI. So, full FDT can't
be given here. For simplicity, just neglict it here. Remember that this
is just a workaround as we are required to pass a FDT to kernel/grub to
meet Arm Base Boot Requirement 7.4.3 [2].

It can be improved by making a stub FDT and pass it through configuration
table. Maybe later.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
[2] https://developer.arm.com/documentation/den0044/latest
rbradford pushed a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 20, 2023
In order to support the requirements of a larger GRUB binary extend the
size of the memory used for loading the payload. Since the payload
address is hardcoded to a location in RAM below that of where the RHF
binary is loaded increase adjust the ram_min constant to handle that.
This does not require any VMM changes as the load address in the PE
binary will reflect this change.

Fixes: cloud-hypervisor#261

Signed-off-by: Jianyong Wu <[email protected]>
rbradford pushed a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 20, 2023
Increasing the maximum number of memory allocations is required to
support booting the version of GRUB used in Ubuntu 20.04 for AArch64.

Fixes: cloud-hypervisor#261

Signed-off-by: Jianyong Wu <[email protected]>
rbradford pushed a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 20, 2023
This patch increases the size of the byte array to 12 bytes (so that the
'.' can be included for files that are named the full 8 + 3 bytes. If
the string presented is exactly 11 bytes then adjust it to correctly
included the '.' separator.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>
rbradford pushed a commit to jongwu/rust-hypervisor-firmware that referenced this issue Jul 20, 2023
The Linux kernel only enabled ACPI if the provided FDT table is a stub
[1]. Although this is a violation of the boot Arm Base Boot Requirement
7.4.3 [2] which requires an FDT table (a stub would be sufficient) for
simplicity the FDT table is simply skipped which does not cause issues.

Fixes: cloud-hypervisor#261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
[2] https://developer.arm.com/documentation/den0044/latest
retrage pushed a commit that referenced this issue Jul 21, 2023
In order to support the requirements of a larger GRUB binary extend the
size of the memory used for loading the payload. Since the payload
address is hardcoded to a location in RAM below that of where the RHF
binary is loaded increase adjust the ram_min constant to handle that.
This does not require any VMM changes as the load address in the PE
binary will reflect this change.

Fixes: #261

Signed-off-by: Jianyong Wu <[email protected]>
retrage pushed a commit that referenced this issue Jul 21, 2023
Increasing the maximum number of memory allocations is required to
support booting the version of GRUB used in Ubuntu 20.04 for AArch64.

Fixes: #261

Signed-off-by: Jianyong Wu <[email protected]>
retrage pushed a commit that referenced this issue Jul 21, 2023
This patch increases the size of the byte array to 12 bytes (so that the
'.' can be included for files that are named the full 8 + 3 bytes. If
the string presented is exactly 11 bytes then adjust it to correctly
included the '.' separator.

Fixes: #261
Signed-off-by: Jianyong Wu <[email protected]>
retrage pushed a commit that referenced this issue Jul 21, 2023
The Linux kernel only enabled ACPI if the provided FDT table is a stub
[1]. Although this is a violation of the boot Arm Base Boot Requirement
7.4.3 [2] which requires an FDT table (a stub would be sufficient) for
simplicity the FDT table is simply skipped which does not cause issues.

Fixes: #261
Signed-off-by: Jianyong Wu <[email protected]>

[1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203
[2] https://developer.arm.com/documentation/den0044/latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant