AMDESE / AMDSEV

AMD Secure Encrypted Virtualization
298 stars 87 forks source link

SEV-SNP:Can not run ubuntu22.04 with SEV-SNP #232

Closed lcmfq closed 1 month ago

lcmfq commented 2 months ago

When I run the commad“/usr/local/bin/qemu-system-x86_64 -enable-kvm -cpu EPYC-v4 -machine q35 -smp 4,maxcpus=255 -m 2048M,slots=5,maxmem=10240M -no-reboot -bios /usr/local/share/qemu/OVMF_CODE.fd -drive if=pflash,format=raw,unit=0,file=/home/ubuntu/kernel/AMDSEV/ubuntu-2204.fd -drive file=/home/ubuntu/os/ubuntu-2204.qcow2,if=none,id=disk0,format=qcow2 -device virtio-scsi-pci,id=scsi0,disable-legacy=on,iommu_platform=true -device scsi-hd,drive=disk0 -machine memory-encryption=sev0,vmport=off -object memory-backend-memfd,id=ram1,size=2048M,share=true,prealloc=false -machine memory-backend=ram1 -object sev-snp-guest,id=sev0,policy=0xb0000,cbitpos=51,reduced-phys-bits=1 -nographic -monitor pty -monitor unix:monitor,server,nowait” I get "PciSioSerial: Create SIO child serial device - Device Error error: kvm run failed Invalid argument" error

MpInitChangeApLoopCallback() done! SetUefiImageMemoryAttributes - 0x000000007E4E4000 - 0x0000000000009000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x000000007E4DD000 - 0x0000000000007000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x000000007E4D7000 - 0x0000000000006000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x000000007E4D0000 - 0x0000000000007000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x000000007E4C0000 - 0x0000000000010000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x000000007E4BB000 - 0x0000000000005000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x000000007E4B4000 - 0x0000000000007000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x000000007E4B0000 - 0x0000000000004000 (0x0000000000000008) SetUefiImageMemoryAttributes - 0x000000007E4AB000 - 0x0000000000005000 (0x0000000000000008) error: kvm run failed Invalid argument EAX=00000000 EBX=00000000 ECX=00000000 EDX=00800f12 ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000 EIP=0000fff0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0 ES =0000 00000000 0000ffff 00009300 CS =f000 ffff0000 0000ffff 00009b00 SS =0000 00000000 0000ffff 00009300 DS =0000 00000000 0000ffff 00009300 FS =0000 00000000 0000ffff 00009300 GS =0000 00000000 0000ffff 00009300 LDT=0000 00000000 0000ffff 00008200 TR =0000 00000000 0000ffff 00008b00 GDT= 00000000 0000ffff IDT= 00000000 0000ffff CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000 DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 DR6=00000000ffff0ff0 DR7=0000000000000400 EFER=0000000000000000 Code=c5 5a 08 2d 00 00 00 00 00 00 00 00 00 00 00 00 56 54 46 00 <0f> 20 c0 a8 01 74 05 e9 2c ff ff ff e9 11 ff 90 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

When I run the commad“/usr/local/bin/qemu-system-x86_64 -enable-kvm -cpu EPYC-v4 -machine q35 -smp 4,maxcpus=255 -m 2048M,slots=5,maxmem=10240M -no-reboot -bios /usr/local/share/qemu/OVMF_CODE.fd -drive if=pflash,format=raw,unit=0,file=/home/ubuntu/kernel/AMDSEV/ubuntu-2204.fd -drive file=/home/ubuntu/os/ubuntu-2204.qcow2,if=none,id=disk0,format=qcow2 -device virtio-scsi-pci,id=scsi0,disable-legacy=on,iommu_platform=true -device scsi-hd,drive=disk0 -machine memory-encryption=sev0,vmport=off -object memory-backend-memfd,id=ram1,size=2048M,share=true,prealloc=false -machine memory-backend=ram1 -object sev-snp-guest,id=sev0,policy=0xb0000,cbitpos=51,reduced-phys-bits=1 -monitor pty -monitor unix:monitor,server,nowait” In VNCViewer ,I get "guest has not initialized the display yet" error In shell, I get "Viewport: No symbol for key code 77 (in the current state)" error

image

mdroth commented 2 months ago

Change this: -bios /usr/local/share/qemu/OVMF_CODE.fd -drive if=pflash,format=raw,unit=0,file=/home/ubuntu/kernel/AMDSEV/ubuntu-2204.fd

to this: -bios /usr/local/share/qemu/OVMF.fd

Note that that's a single-image OVMF instead of the OVMF_CODE one where there's a separate image for persistent storage. Also ensure that the OVMF you use is fairly recent, I don't know if your Ubuntu ships an OVMF that has SNP support or not.

lcmfq commented 1 month ago

Thankyou. This issue has been resolved

ghe0 commented 2 weeks ago

How has this issue been resolved?