Skip to content

Why SEV-SNP breaks cross-device P2P? #287

@aakarshcool15-crypto

Description

@aakarshcool15-crypto

Host Configuration:

dmesg | grep -i sev

[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-6.16.0-snp-host-68799c0277b2+ root=/dev/mapper/vg00-rootvol ro printk.time=1 nomodeset gfxpayload=text fb=false mem_encrypt=on kvm_amd.sev=1 kvm_amd.sev_es=1 kvm_amd.sev_snp=1 amd_iommu=on
[ 0.000000] SEV-SNP: RMP table physical range [0x0000018279300000 - 0x00000183fd3fffff]
[ 0.027006] SEV-SNP: Reserving start/end of RMP table on a 2MB boundary [0x0000018279200000]
[ 1.147647] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-6.16.0-snp-host-68799c0277b2+ root=/dev/mapper/vg00-rootvol ro printk.time=1 nomodeset gfxpayload=text fb=false mem_encrypt=on kvm_amd.sev=1 kvm_amd.sev_es=1 kvm_amd.sev_snp=1 amd_iommu=on
[ 38.256904] ccp 0000:03:00.5: sev enabled
[ 61.424502] ccp 0000:03:00.5: SEV-SNP API:1.55 build:42
[ 61.497361] ccp 0000:03:00.5: SEV API:1.55 build:42
[ 61.499835] kvm_amd: SEV enabled (ASIDs 2 - 1006)
[ 61.499844] kvm_amd: SEV-ES enabled (ASIDs 1 - 1)
[ 61.499848] kvm_amd: SEV-SNP enabled (ASIDs 1 - 1)

I have two PCIe devices located under different PCIe switches, and I need to perform peer-to-peer (P2P) data transfers between them. ACS (Access Control Services) is disabled, so P2P traffic should route through the root complex and will involve IOMMU translations. So now every device’s DMA must go through the IOMMU with translation enabled.
When I run this setup inside a confidential VM (SEV-SNP enabled), P2P operations fail with the error:

Failed to access P2P device

However, when I run the same configuration inside a normal VM (without SEV-SNP), P2P works correctly across both devices.(host kernel also wihout SEV features)
The PCIe topology and configuration are identical in both cases. I am trying to understand why P2P succeeds in a normal VM but fails in an SEV-SNP confidential VM.

So is this expected or I am doing something wrong or there is some limitation?

Thanks in advance!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions