1. 03 5月, 2017 2 次提交
  2. 28 2月, 2017 2 次提交
  3. 02 8月, 2016 1 次提交
    • M
      virtio: new feature to detect IOMMU device quirk · 1a937693
      Michael S. Tsirkin 提交于
      The interaction between virtio and IOMMUs is messy.
      
      On most systems with virtio, physical addresses match bus addresses,
      and it doesn't particularly matter which one we use to program
      the device.
      
      On some systems, including Xen and any system with a physical device
      that speaks virtio behind a physical IOMMU, we must program the IOMMU
      for virtio DMA to work at all.
      
      On other systems, including SPARC and PPC64, virtio-pci devices are
      enumerated as though they are behind an IOMMU, but the virtio host
      ignores the IOMMU, so we must either pretend that the IOMMU isn't
      there or somehow map everything as the identity.
      
      Add a feature bit to detect that quirk: VIRTIO_F_IOMMU_PLATFORM.
      
      Any device with this feature bit set to 0 needs a quirk and has to be
      passed physical addresses (as opposed to bus addresses) even though
      the device is behind an IOMMU.
      
      Note: it has to be a per-device quirk because for example, there could
      be a mix of passed-through and virtual virtio devices. As another
      example, some devices could be implemented by an out of process
      hypervisor backend (in case of qemu vhost, or vhost-user) and so support
      for an IOMMU needs to be coded up separately.
      
      It would be cleanest to handle this in IOMMU core code, but that needs
      per-device DMA ops. While we are waiting for that to be implemented, use
      a work-around in virtio core.
      
      Note: a "noiommu" feature is a quirk - add a wrapper to make
      that clear.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      1a937693
  4. 13 1月, 2016 1 次提交
  5. 01 6月, 2015 2 次提交
  6. 01 4月, 2015 2 次提交
  7. 15 12月, 2014 1 次提交
    • M
      virtio: core support for config generation · d71de9ec
      Michael S. Tsirkin 提交于
      virtio 1.0 spec says:
      
      Drivers MUST NOT assume reads from fields greater than 32 bits wide are
      atomic, nor are reads from multiple fields: drivers SHOULD read device
      configuration space fields like so:
      	u32 before, after;
      	do {
      		before = get_config_generation(device);
      		// read config entry/entries.
      		after = get_config_generation(device);
      	} while (after != before);
      
      Do exactly this, for transports that support it.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      d71de9ec
  8. 12 12月, 2014 1 次提交
    • M
      virtio_config: fix virtio_cread_bytes · 3d266782
      Michael S. Tsirkin 提交于
      virtio_cread_bytes is implemented incorrectly in case length happens to
      be 2,4 or 8 bytes: transports and devices will assume it's an integer
      value that has to be converted to LE format.
      
      Let's just do multiple 1-byte reads: this also makes life easier
      for transports who only need to implement 1,2,4 and 8 byte reads.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      3d266782
  9. 09 12月, 2014 6 次提交
  10. 15 10月, 2014 1 次提交
  11. 17 10月, 2013 2 次提交
  12. 13 10月, 2012 1 次提交
  13. 28 9月, 2012 2 次提交
    • M
      virtio: support reserved vqs · 6457f126
      Michael S. Tsirkin 提交于
      virtio network device multiqueue support reserves
      vq 3 for future use (useful both for future extensions and to make it
      pretty - this way receive vqs have even and transmit - odd numbers).
      Make it possible to skip initialization for
      specific vq numbers by specifying NULL for name.
      Document this usage as well as (existing) NULL callback.
      
      Drivers using this not coded up yet, so I simply tested
      with virtio-pci and verified that this patch does
      not break existing drivers.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      6457f126
    • J
      virtio: introduce an API to set affinity for a virtqueue · 75a0a52b
      Jason Wang 提交于
      Sometimes, virtio device need to configure irq affinity hint to maximize the
      performance. Instead of just exposing the irq of a virtqueue, this patch
      introduce an API to set the affinity for a virtqueue.
      
      The api is best-effort, the affinity hint may not be set as expected due to
      platform support, irq sharing or irq type. Currently, only pci method were
      implemented and we set the affinity according to:
      
      - if device uses INTX, we just ignore the request
      - if device has per vq vector, we force the affinity hint
      - if the virtqueues share MSI, make the affinity OR over all affinities
        requested
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      75a0a52b
  14. 22 5月, 2012 1 次提交
  15. 05 3月, 2012 1 次提交
    • P
      BUG: headers with BUG/BUG_ON etc. need linux/bug.h · 187f1882
      Paul Gortmaker 提交于
      If a header file is making use of BUG, BUG_ON, BUILD_BUG_ON, or any
      other BUG variant in a static inline (i.e. not in a #define) then
      that header really should be including <linux/bug.h> and not just
      expecting it to be implicitly present.
      
      We can make this change risk-free, since if the files using these
      headers didn't have exposure to linux/bug.h already, they would have
      been causing compile failures/warnings.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      187f1882
  16. 24 11月, 2011 1 次提交
    • M
      virtio-pci: make reset operation safer · e6af578c
      Michael S. Tsirkin 提交于
      virtio pci device reset actually just does an I/O
      write, which in PCI is really posted, that is it
      can complete on CPU before the device has received it.
      
      Further, interrupts might have been pending on
      another CPU, so device callback might get invoked after reset.
      
      This conflicts with how drivers use reset, which is typically:
      	reset
      	unregister
      a callback running after reset completed can race with
      unregister, potentially leading to use after free bugs.
      
      Fix by flushing out the write, and flushing pending interrupts.
      
      This assumes that device is never reset from
      its vq/config callbacks, or in parallel with being
      added/removed, document this assumption.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      e6af578c
  17. 17 11月, 2011 1 次提交
  18. 02 11月, 2011 1 次提交
  19. 30 5月, 2011 1 次提交
  20. 24 1月, 2011 1 次提交
  21. 23 9月, 2009 1 次提交
    • J
      BUILD_BUG_ON(): fix it and a couple of bogus uses of it · 8c87df45
      Jan Beulich 提交于
      gcc permitting variable length arrays makes the current construct used for
      BUILD_BUG_ON() useless, as that doesn't produce any diagnostic if the
      controlling expression isn't really constant.  Instead, this patch makes
      it so that a bit field gets used here.  Consequently, those uses where the
      condition isn't really constant now also need fixing.
      
      Note that in the gfp.h, kmemcheck.h, and virtio_config.h cases
      MAYBE_BUILD_BUG_ON() really just serves documentation purposes - even if
      the expression is compile time constant (__builtin_constant_p() yields
      true), the array is still deemed of variable length by gcc, and hence the
      whole expression doesn't have the intended effect.
      
      [akpm@linux-foundation.org: make arch/sparc/include/asm/vio.h compile]
      [akpm@linux-foundation.org: more nonsensical assertions in tpm.c..]
      Signed-off-by: NJan Beulich <jbeulich@novell.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
      Cc: Mimi Zohar <zohar@us.ibm.com>
      Cc: James Morris <jmorris@namei.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8c87df45
  22. 30 7月, 2009 1 次提交
  23. 12 6月, 2009 3 次提交
  24. 25 7月, 2008 3 次提交
  25. 30 5月, 2008 1 次提交
    • R
      virtio: force callback on empty. · b4f68be6
      Rusty Russell 提交于
      virtio allows drivers to suppress callbacks (ie. interrupts) for
      efficiency (no locking, it's just an optimization).
      
      There's a similar mechanism for the host to suppress notifications
      coming from the guest: in that case, we ignore the suppression if the
      ring is completely full.
      
      It turns out that life is simpler if the host similarly ignores
      callback suppression when the ring is completely empty: the network
      driver wants to free up old packets in a timely manner, and otherwise
      has to use a timer to poll.
      
      We have to remove the code which ignores interrupts when the driver
      has disabled them (again, it had no locking and hence was unreliable
      anyway).
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      b4f68be6