On 2/25/26 13:04, [email protected] wrote:
From: Marc-André Lureau <[email protected]>
Hi,
This is an attempt to fix the incompatibility of virtio-mem with confidential
VMs. The solution implements what was discussed earlier with D. Hildenbrand:
https://patchwork.ozlabs.org/project/qemu-devel/patch/[email protected]/#3502238
The first patches are misc cleanups. Then some code refactoring to have split a
manager/source. And finally, the manager learns to deal with multiple sources.
I haven't done thorough testing. I only launched a SEV guest with a virtio-mem
device. It would be nice to have more tests for those scenarios with
VFIO/virtio-mem/confvm.. In any case, review & testing needed!
In a SEV-SNP guest (BIOS) with a VFIO device and virtio-mem device :
-m 4G,maxmem=24G
-object '{"size": 4294967296, "id": "mem-vmem0", "qom-type":
"memory-backend-ram"}'
-device '{"id": "pcie-root-port-1", "port": 1, "driver": "pcie-root-port", "bus":
"pcie.0", "chassis": 2}'
-device '{"memdev": "mem-vmem0", "driver": "virtio-mem-pci", "id": "virtio_mem-vmem0", "bus":
"pcie-root-port-1", "addr": "0x0"}'
-object '{"size": 4294967296, "id": "mem-machine_mem", "qom-type":
"memory-backend-ram"}'
...
[ 0.663227] Memory Encryption Features active: AMD SEV SEV-ES SEV-SNP
...
[ 3.199716] virtio_mem virtio2: start address: 0x180000000
[ 3.200988] virtio_mem virtio2: region size: 0x100000000
[ 3.202217] virtio_mem virtio2: device block size: 0x200000
[ 3.203475] virtio_mem virtio2: nid: 0
[ 3.204384] virtio_mem virtio2: memory block size: 0x8000000
[ 3.205696] virtio_mem virtio2: subblock size: 0x200000
[ 3.207193] virtio_mem virtio2: plugged size: 0x0
[ 3.208282] virtio_mem virtio2: requested size: 0x0
boot is fine.
Powerdown reveals an issue :
[ 25.054116] ACPI: PM: Preparing to enter system sleep state S5
[ 25.055671] reboot: Power down
**
ERROR:../system/ram-discard-manager.c:459:ram_discard_manager_finalize: assertion
failed: (QLIST_EMPTY(&rdm->source_list))
Aborted
Thanks,
C.