1. 02 5月, 2008 3 次提交
    • R
      virtio: change config to guest endian. · 72e61eb4
      Rusty Russell 提交于
      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: NRusty Russell <rusty@rustcorp.com.au>
      72e61eb4
    • M
      virtio-blk: fix remove oops · 2e895e4c
      Marcelo Tosatti 提交于
      Do not unregister the major at device remove, since there might be
      another device instances around.
      
      (qemu) pci_del 0 11
      (qemu) ACPI: PCI interrupt for device 0000:00:0b.0 disabled
      (qemu) pci_del 0 10
      (qemu) ------------[ cut here ]------------
      WARNING: at block/genhd.c:126 unregister_blkdev+0x74/0x9e()
      ACPI: PCI interrupt for device 0000:00:0a.0 disabled
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      2e895e4c
    • R
      virtio: de-structify virtio_block status byte · cb38fa23
      Rusty Russell 提交于
      Ron Minnich points out that a struct containing a char is not always
      sizeof(char); simplest to remove the structure to avoid confusion.
      
      Cc: "ron minnich" <rminnich@gmail.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      cb38fa23
  2. 17 3月, 2008 1 次提交
  3. 04 2月, 2008 6 次提交
    • C
      virtio_blk: implement naming for vda-vdz,vdaa-vdzz,vdaaa-vdzzz · d50ed907
      Christian Borntraeger 提交于
      Am Freitag, 1. Februar 2008 schrieb Christian Borntraeger:
      > Right. I will fix that with an additional patch.
      
      This patch goes on top of the minor number patch. Please let me know if
      you want a merged patch:
      
      Currently virtio_blk creates the disk name combinging "vd"  with 'a'++.
      This will give strange names after vdz. I have implemented names up to
      vdzzz - inspired by the sd.c code. That should be sufficient for now.
      
      There is one driver in the kernel (driver/s390/block/dasd_genhd.c) that
      implements names from dasda-dasdzzzz allowing even more disks. Maybe
      a janitor can come up with a common implementation usable for all kind
      of block device drivers.
      
      I have tested this patch with 100 disks - seems to work.
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      d50ed907
    • C
      virtio_blk: Dont waste major numbers · 4f3bf19c
      Christian Borntraeger 提交于
      Rusty,
      
      currently virtio_blk uses one major number per device. While this works
      quite well on most systems it is wasteful and will exhaust major numbers
      on larger installations.
      
      This patch allocates a major number on init and will use 16 minor numbers
      for each disk. That will allow ~64k virtio_blk disks.
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      4f3bf19c
    • C
      virtio_blk: provide getgeo · 135da0b0
      Christian Borntraeger 提交于
      Rusty,
      
      I currently try to make my guest boot from an virtio root device
      without having an external kernel. Some of the tools that I tried
      expect HDIO_GETGEO to work. The most interesting value is likely
      the geo.start value to get the offset of a partition. This value
      is filled by block/ioctl.c if fops->getgeo is set. This patch also
      fills in some standard values for heads, sectors and cylinders.
      
      Makes sense?
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      135da0b0
    • R
      virtio: reset function · 6e5aa7ef
      Rusty Russell 提交于
      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: NRusty Russell <rusty@rustcorp.com.au>
      6e5aa7ef
    • R
      virtio: explicit enable_cb/disable_cb rather than callback return. · 18445c4d
      Rusty Russell 提交于
      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: NRusty Russell <rusty@rustcorp.com.au>
      18445c4d
    • R
      virtio: simplify config mechanism. · a586d4f6
      Rusty Russell 提交于
      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: NRusty Russell <rusty@rustcorp.com.au>
      a586d4f6
  4. 19 11月, 2007 1 次提交
  5. 24 10月, 2007 1 次提交
  6. 23 10月, 2007 1 次提交
    • R
      Block driver using virtio. · e467cde2
      Rusty Russell 提交于
      The block driver uses scatter-gather lists with sg[0] being the
      request information (struct virtio_blk_outhdr) with the type, sector
      and inbuf id.  The next N sg entries are the bio itself, then the last
      sg is the status byte.  Whether the N entries are in or out depends on
      whether it's a read or a write.
      
      We accept the normal (SCSI) ioctls: they get handed through to the other
      side which can then handle it or reply that it's unsupported.  It's
      not clear that this actually works in general, since I don't know
      if blk_pc_request() requests have an accurate rq_data_dir().
      
      Although we try to reply -ENOTTY on unsupported commands, ioctl(fd,
      CDROMEJECT) returns success to userspace.  This needs a separate
      patch.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      e467cde2