Skip to content

boot-qemu.sh: arm64: Pass 'lpa2=off' when necessary#58

Merged
nathanchance merged 5 commits into
ClangBuiltLinux:mainfrom
nathanchance:arm64-lpa2
Mar 17, 2022
Merged

boot-qemu.sh: arm64: Pass 'lpa2=off' when necessary#58
nathanchance merged 5 commits into
ClangBuiltLinux:mainfrom
nathanchance:arm64-lpa2

Conversation

@nathanchance

Copy link
Copy Markdown
Member

Starting with QEMU commit 69b2265d5fe8e, aarch64 kernels older than
5.12.0 do not boot without "lpa2=off". Add this parameter when booting a
kernel older than this version using a version of QEMU that has this
commit.

We cannot universally pass this for all QEMU versions because the
property is not recognized on older version:

qemu-system-aarch64: can't apply global max-arm-cpu.lpa2=off: Property 'max-arm-cpu.lpa2' not found

We could pass this for all kernel versions but we miss out on testing a
default QEMU change.

The first three commits add the individual functions that are needed by the
last commit for ease of reviewing.

Link: https://gitlab.com/qemu-project/qemu/-/commit/69b2265d5fe8e0f401d75e175e0a243a7d505e53

Comment thread boot-qemu.sh Outdated
Comment on lines +132 to +133
IFS=. read -ra QEMU_VER <<<"${QEMU_VER}"
printf "%d%02d%02d" "${QEMU_VER[@]}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yuck

@nathanchance nathanchance Mar 14, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I could spell this out as:

printf "%d%02d%03d" "${VER_CODE[0]}" "${VER_CODE[1]}" "${VER_CODE[2]}"

?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We'd still need the read though?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct, I don't think I can use printf without splitting the version somehow. This was the cleanest way I could think of.

Comment thread boot-qemu.sh Outdated
Comment thread boot-qemu.sh Outdated
We will need to make some QEMU argument choices based on the kernel
version, which we can only get reliably from the kernel image itself,
which means we need to call this block in the case statement above.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Similar to the Linux kernel's representation of compiler versions, add
the ability to get the version of a QEMU as a five or six digit number
to make decisions based on what version of QEMU is being used.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Similar to the Linux kernel's representation of compiler versions, add
the ability to get the version of the kernel being booted as a six or
seven digit number to make decisions based on that number.

To do this, we need a decompressed kernel image, so that we can use
"strings" + "grep". The arguments to the function are the command to
dump the decompressed kernel image to stdout. For example, if the kernel
image is Image.gz, the command would be "gzip -c -d ...".

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Refactor get_{lnx,qemu}_ver_code to share splitting the version into an
array and printing it as a six or seven digit number. The QEMU sublevel
is never more than 100 but that does not matter much.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Starting with QEMU commit 69b2265d5fe8e, aarch64 kernels older than
5.12.0 do not boot without "lpa2=off". Add this parameter when booting a
kernel older than this version using a version of QEMU that has this
commit.

We cannot universally pass this for all QEMU versions because the
property is not recognized on older version:

qemu-system-aarch64: can't apply global max-arm-cpu.lpa2=off: Property 'max-arm-cpu.lpa2' not found

We could pass this for all kernel versions but we miss out on testing a
default QEMU change.

Link: https://gitlab.com/qemu-project/qemu/-/commit/69b2265d5fe8e0f401d75e175e0a243a7d505e53
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
@nathanchance nathanchance merged commit a707c91 into ClangBuiltLinux:main Mar 17, 2022
@nathanchance nathanchance deleted the arm64-lpa2 branch March 17, 2022 18:17
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 this pull request may close these issues.

2 participants