Skip to content
  • Will Deacon's avatar
    virtio_pci: Limit DMA mask to 44 bits for legacy virtio devices · a0be1db4
    Will Deacon authored and Michael S. Tsirkin's avatar Michael S. Tsirkin committed
    
    
    Legacy virtio defines the virtqueue base using a 32-bit PFN field, with
    a read-only register indicating a fixed page size of 4k.
    
    This can cause problems for DMA allocators that allocate top down from
    the DMA mask, which is set to 64 bits. In this case, the addresses are
    silently truncated to 44-bit, leading to IOMMU faults, failure to read
    from the queue or data corruption.
    
    This patch restricts the coherent DMA mask for legacy PCI virtio devices
    to 44 bits, which matches the specification.
    
    Cc: stable@vger.kernel.org
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Benjamin Serebrin <serebrin@google.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    a0be1db4