Description of problem: Boot guest with sev and device assignment, qemu print failed info. Version-Release number of selected component (if applicable): kernel-4.18.0-114.el8.x86_64 qemu-kvm-4.0.0-5.module+el8.1.0+3622+5812d9bf.x86_64 How reproducible: 100% Steps to Reproduce: 1. Boot guest with sev and device assignment /usr/libexec/qemu-kvm \ -enable-kvm \ -cpu EPYC \ -smp 4 \ -m 4G \ -object sev-guest,id=sev0,cbitpos=47,reduced-phys-bits=1 \ -machine q35,memory-encryption=sev0 \ -drive if=pflash,format=raw,unit=0,file=/usr/share/edk2/ovmf/sev/OVMF_CODE.secboot.fd,readonly \ -drive if=pflash,format=raw,unit=1,file=/usr/share/edk2/ovmf/sev/OVMF_VARS.fd \ -device pcie-root-port,id=root.1,chassis=1 \ -device pcie-root-port,id=root.2,chassis=2 \ -device pcie-root-port,id=root.3,chassis=3 \ -device pcie-root-port,id=root.4,chassis=4 \ -device pcie-root-port,id=root.5,chassis=5 \ -device virtio-scsi-pci,iommu_platform=on,id=scsi0,bus=root.1,addr=0x0 \ -drive file=/home/sev_guest.qcow2,format=qcow2,if=none,id=drive-scsi0-0-0-0 \ -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scssi0-0-0-0,bootindex=1 \ -netdev tap,id=hostnet0,vhost=off \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=18:66:da:57:dd:03,bus=root.2,iommu_platform=true \ -vnc :0 \ -monitor stdio \ -serial unix:/tmp/console,server,nowait \ -device vfio-pci,host=0000:e3:00.0,bus=root.3,id=pf1 \ -device vfio-pci,host=0000:e3:00.1,bus=root.4,id=pf2 \ 2. Hot unplug vfio-pci devices, qemu prints error info: (qemu) device_del pf1 (qemu) qemu-kvm: sev_ram_block_removed: failed to unregister region (0x7f5537000000+0x1000000) qemu-kvm: sev_ram_block_removed: failed to unregister region (0x7f555ee1a000+0x8000) (qemu) (qemu) device_del pf2 (qemu) qemu-kvm: sev_ram_block_removed: failed to unregister region (0x7f555ec44000+0x8000) qemu-kvm: sev_ram_block_removed: failed to unregister region (0x7f5536000000+0x1000000) Actual results: qemu prints failed info. Expected results: qemu should not print any failed info. Additional info: 1. Both host and guest work well, only qemu terminal shows failed info.
See bug 1728958, this is the same issue. The fix is already in QEMU 4.1-rc1. As this is against RHAV, I expect this should move to ON_QA, fixed in v4.1-rc1.
As noted in comment #3, fixed by: commit 56e2ec9488b3b281130e064929f8ae5595d6ac39 Author: Alex Williamson <alex.williamson> Date: Mon Jul 15 08:28:39 2019 -0600 target/i386: sev: Do not unpin ram device memory region The commit referenced below skipped pinning ram device memory when ram blocks are added, we need to do the same when they're removed. Cc: Brijesh Singh <brijesh.singh> Cc: Paolo Bonzini <pbonzini> Fixes: cedc0ad539af ("target/i386: sev: Do not pin the ram device memory region") Signed-off-by: Alex Williamson <alex.williamson> Message-Id: <156320087103.2556.10983987500488190423.stgit> Reviewed-by: Singh, Brijesh <brijesh.singh> Signed-off-by: Paolo Bonzini <pbonzini>
Verified with qemu-kvm-4.1.0-4.module+el8.1.0+4020+16089f93.x86_64: Following steps of Description. After hot plug PFs, qemu works well without any error. So this bug has been fixed very well. Move to 'VERIFIED'.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2019:3723