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

Prepare for update to COCONUT linux host and QEMU 9.0 #415

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

Conversation

roy-hopkins
Copy link
Collaborator

This PR consists of commits that are required to launch and run tests when hosted on a system with the following kernel and QEMU versions:

Linux-6.10-rc2:
coconut-svsm/linux#6

QEMU 9.0:
coconut-svsm/qemu#15

The intercept behaviour of some MSRs has changed since the previous COCONUT linux version, hence tests needed to be updated. Also, the QEMU command line has changed requiring a change in the launch script. The script is still compatible with early versions of QEMU/kernel.

I've also added an extra commit that fixes failing test-in-svsm cases when run on a Genoa system.

QEMU 9.0 with IGVM support uses a different command line to previous
QEMU versions. The IGVM file is now specified as a separate object.
Also, init-flags has been removed and there have been some other changes
to the arguments required to launch an SEV-SNP guest.

This commit updates scripts/launch.sh to provide the correct arguments
when QEMU 9 or greater is detected.

Signed-off-by: Roy Hopkins <[email protected]>
The commit b7e4be0a224fe5 in the kernel introduces a change that means
that sev-es and sev-snp guests do not now intercept the debug ctl MSR.
This means for kernels that include this commit this test will always
fail.

This commit removes the test. The read_msr functionality is tested by
the remaining test_rdmsr_apic() test case.

Signed-off-by: Roy Hopkins <[email protected]>
MSR_TSC_AUX is only intercepted on systems that do not support Virtual
TSC_AUX, such as Milan based systems. Genoa systems do support Virtual
TSC_AUX. Therefore the read_msr/write_msr tests fail on these systems.

This commit replaces the read_msr/write_msr tests with MSR_APIC_BASE to
test the write functionality and fixes the test for rdtscp by ignoring
whether the MSR read was intercepted.

Signed-off-by: Roy Hopkins <[email protected]>
if (( (QEMU_MAJOR > 8) || ((QEMU_MAJOR == 8) && (QEMU_MINOR >= 2)) )); then
if (( QEMU_MAJOR >= 9 )); then
MACHINE=q35,confidential-guest-support=sev0,memory-backend=mem0,igvm-cfg=igvm0
IGVM_OBJECT=
Copy link
Contributor

@stefano-garzarella stefano-garzarella Jul 24, 2024

Choose a reason for hiding this comment

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

I guess it's a left over. Can we remove this line (67)?

@@ -103,7 +115,8 @@ $SUDO_CMD \
-cpu EPYC-v4 \
-machine $MACHINE \
-object $MEMORY \
-object sev-snp-guest,id=sev0,cbitpos=$C_BIT_POS,reduced-phys-bits=1,init-flags=5,igvm-file=$IGVM \
-object sev-snp-guest,id=sev0,cbitpos=$C_BIT_POS,reduced-phys-bits=1$INIT_FLAGS$IGVM_FILE \
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a strong opinion, but what about defining an SEV_SNP_OBJECT and assign it for each QEMU version, so it's a bit clear also for the reader the differences between the versions?

I mean something like this:

if (( QEMU_MAJOR >= 9 )); then
    ...
    SEV_SNP_OBJECT="-object sev-snp-guest,id=sev0,cbitpos=$C_BIT_POS,reduced-phys-bits=1"
elif (( (QEMU_MAJOR > 8) || ((QEMU_MAJOR == 8) && (QEMU_MINOR >= 2)) )); then
    ...
    SEV_SNP_OBJECT="-object sev-snp-guest,id=sev0,cbitpos=$C_BIT_POS,reduced-phys-bits=1,init-flags=5,igvm-file=$IGVM"
   ...

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