1. 24 Jul, 2008 3 commits
  2. 29 May, 2008 2 commits
    • Rusty Russell's avatar
      virtio: force callback on empty. · b4f68be6
      Rusty Russell authored
      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: default avatarRusty Russell <rusty@rustcorp.com.au>
      b4f68be6
    • Christian Borntraeger's avatar
      virtio_config: fix len calculation of config elements · 7f31fe05
      Christian Borntraeger authored
      Rusty,
      
      This patch is a prereq for the virtio_blk blocksize patch, please apply it
      first.
      
      Adding an u32 value to the virtio_blk_config unconvered a small bug the config
      space defintions:
      v is a pointer, to we have to use sizeof(*v) instead of sizeof(v).
      Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      7f31fe05
  3. 02 May, 2008 2 commits
    • Rusty Russell's avatar
      virtio: explicit advertisement of driver features · c45a6816
      Rusty Russell authored
      A recent proposed feature addition to the virtio block driver revealed
      some flaws in the API: in particular, we assume that feature
      negotiation is complete once a driver's probe function returns.
      
      There is nothing in the API to require this, however, and even I
      didn't notice when it was violated.
      
      So instead, we require the driver to specify what features it supports
      in a table, we can then move the feature negotiation into the virtio
      core.  The intersection of device and driver features are presented in
      a new 'features' bitmap in the struct virtio_device.
      
      Note that this highlights the difference between Linux unsigned-long
      bitmaps where each unsigned long is in native endian, and a
      straight-forward little-endian array of bytes.
      
      Drivers can still remove feature bits in their probe routine if they
      really have to.
      
      API changes:
      - dev->config->feature() no longer gets and acks a feature.
      - drivers should advertise their features in the 'feature_table' field
      - use virtio_has_feature() for extra sanity when checking feature bits
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      c45a6816
    • Rusty Russell's avatar
      virtio: change config to guest endian. · 72e61eb4
      Rusty Russell authored
      A recent proposed feature addition to the virtio block driver revealed
      some flaws in the API, in particular how easy it is to break big
      endian machines.
      
      The virtio config space was originally chosen to be little-endian,
      because we thought the config might be part of the PCI config space
      for virtio_pci.  It's actually a separate mmio region, so that
      argument holds little water; as only x86 is currently using the virtio
      mechanism, we can change this (but must do so now, before the
      impending s390 merge).
      
      API changes:
      - __virtio_config_val() just becomes a striaght vdev->config_get() call.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      72e61eb4
  4. 04 Feb, 2008 3 commits
    • Rusty Russell's avatar
      virtio: reset function · 6e5aa7ef
      Rusty Russell authored
      A reset function solves three problems:
      
      1) It allows us to renegotiate features, eg. if we want to upgrade a
         guest driver without rebooting the guest.
      
      2) It gives us a clean way of shutting down virtqueues: after a reset,
         we know that the buffers won't be used by the host, and
      
      3) It helps the guest recover from messed-up drivers.
      
      So we remove the ->shutdown hook, and the only way we now remove
      feature bits is via reset.
      
      We leave it to the driver to do the reset before it deletes queues:
      the balloon driver, for example, needs to chat to the host in its
      remove function.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      6e5aa7ef
    • Rusty Russell's avatar
      virtio: explicit enable_cb/disable_cb rather than callback return. · 18445c4d
      Rusty Russell authored
      It seems that virtio_net wants to disable callbacks (interrupts) before
      calling netif_rx_schedule(), so we can't use the return value to do so.
      
      Rename "restart" to "cb_enable" and introduce "cb_disable" hook: callback
      now returns void, rather than a boolean.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      18445c4d
    • Rusty Russell's avatar
      virtio: simplify config mechanism. · a586d4f6
      Rusty Russell authored
      Previously we used a type/len pair within the config space, but this
      seems overkill.  We now simply define a structure which represents the
      layout in the config space: the config space can now only be extended
      at the end.
      
      The main driver-visible changes:
      1) We indicate what fields are present with an explicit feature bit.
      2) Virtqueues are explicitly numbered, and not in the config space.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      a586d4f6
  5. 22 Oct, 2007 1 commit
    • Rusty Russell's avatar
      Virtio interface · ec3d41c4
      Rusty Russell authored
      This attempts to implement a "virtual I/O" layer which should allow
      common drivers to be efficiently used across most virtual I/O
      mechanisms.  It will no-doubt need further enhancement.
      
      The virtio drivers add buffers to virtio queues; as the buffers are consumed
      the driver "interrupt" callbacks are invoked.
      
      There is also a generic implementation of config space which drivers can query
      to get setup information from the host.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Cc: Dor Laor <dor.laor@qumranet.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      ec3d41c4