31 Oct, 2016

1 commit

  • 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
    Cc: Michael S. Tsirkin
    Cc: Benjamin Serebrin
    Signed-off-by: Will Deacon
    Signed-off-by: Michael S. Tsirkin

    Will Deacon
     

02 Mar, 2016

1 commit

  • This switches to vring_create_virtqueue, simplifying the driver and
    adding DMA API support.

    This fixes virtio-pci on platforms and busses that have IOMMUs. This
    will break the experimental QEMU Q35 IOMMU support until QEMU is
    fixed. In exchange, it fixes physical virtio hardware as well as
    virtio-pci running under Xen.

    Signed-off-by: Andy Lutomirski
    Signed-off-by: Michael S. Tsirkin

    Andy Lutomirski
     

24 Jun, 2015

1 commit


21 Jan, 2015

2 commits


06 Jan, 2015

3 commits

  • The reason we defer kfree until release function is because it's a
    general rule for kobjects: kfree of the reference counter itself is only
    legal in the release function.

    Previous patch didn't make this clear, document this in code.

    Cc: stable@vger.kernel.org
    Signed-off-by: Michael S. Tsirkin

    Michael S. Tsirkin
     
  • A struct device which has just been unregistered can live on past the
    point at which a driver decides to drop it's initial reference to the
    kobject gained on allocation.

    This implies that when releasing a virtio device, we can't free a struct
    virtio_device until the underlying struct device has been released,
    which might not happen immediately on device_unregister().

    Unfortunately, this is exactly what virtio pci does:
    it has an empty release callback, and frees memory immediately
    after unregistering the device.

    This causes an easy to reproduce crash if CONFIG_DEBUG_KOBJECT_RELEASE
    it enabled.

    To fix, free the memory only once we know the device is gone in the release
    callback.

    Cc: stable@vger.kernel.org
    Signed-off-by: Sasha Levin
    Signed-off-by: Michael S. Tsirkin

    Sasha Levin
     
  • It turns out we need to add device-specific code
    in release callback. Move it to virtio_pci_legacy.c.

    Signed-off-by: Michael S. Tsirkin

    Michael S. Tsirkin
     

14 Dec, 2014

1 commit


10 Dec, 2014

3 commits