Commit Graph

14 Commits

Author SHA1 Message Date
Alexey Kardashevskiy 73dea09dae virtio: Make virtio_set_qaddr static
It is never called outside of virtio, make it static.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2019-11-11 15:22:32 +11:00
Nikunj A Dadhania 685af54d8a virtio-net: rework the driver to support multiple open
Found that virtio-net is using a around 200K receive buffer per device, if we
connect more than 40 virtio-net devices the heap(8MB) gets over. Because of
which allocation starts failing and the VM does not boot.

Moreover, the driver did not support opening multiple device, which is possible
using the OF client interface. As it was using globals to store the state
information of the driver.

Now the driver allocates a virtio_net structure during device open stage and
fills in the state information. This details are used during various device
functions and finally for cleaning up on close operation.

Now as the buffer memory is allocated during open and freed during the close
operations the heap usage is contained.

Reported-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-08-07 18:24:58 +10:00
Thomas Huth 264553932b virtio: Implement block write support
Refactor the virtio-block code a little bit to provide block write access,
too. Write access to the first 34 sectors is not allowed, though, to avoid
that the user / client program accidentially destroys the partition table.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-11-24 23:24:23 +11:00
Thomas Huth b294381e48 virtio: Fix stack comment of virtio-blk-read
The real parameters differ from the current stack comment.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-11-10 14:52:12 +11:00
Nikunj A Dadhania 8e92d6b3e8 Add virtio-serial device support
Add support for virtio serial device to be used as a console device.
Currently, SLOF only supports spapr-vty device. With this addition
virtio console can be used during boot.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-10-13 10:47:05 +11:00
Nikunj A Dadhania f83299621c virtio: add and enable 1.0 device setup
Introduce parsing routines for virtio capabilities. This would also
determine whether we need to function in legacy mode or virtio 1.0.
Update routine to start using the base address from the updated legacy
structure.

With the removal for base address setting in the Forth code and most of
the device setup happening in C code, code in virtio.fs is redundant.
Remove virtio.fs and move the allocation of the virtio_device structure
to the C code instead of the Forth code in individual files. Also, drop
the packed attribute for the virtio_{device,cap} structure. The
structure is not shared anymore.

Drivers need to negotiate the 1.0 feature capability before starting to
use 1.0. Disable it in all the drivers until 1.0 is enabled.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-08 16:40:39 +11:00
Nikunj A Dadhania aa9566d2ed virtio-net: move setup-mac to the open routine
MAC reading should be done after the initialization of the device after
the features negotiation.

Adjust the open routine accordingly. There is no point in sending the
mac address to the virtionet_open. Change the signature. Also read the
mac address directly from the config space to remove the dependency of
getting the mac address from the open routine.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-08 16:40:39 +11:00
Nikunj A Dadhania 805cc24afa virtio: fix code style/design issues.
The patch does not make any functional changes.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-02-08 16:40:38 +11:00
Nikunj A Dadhania c365fe0393 virtio-blk: support variable block size
Current code only works with 512 bytes read.

Moreover, Qemu ignores the guest set features request. In the set
features request SLOF indicates to qemu that it is not support
VIRTIO_BLK_F_BLK_SIZE feature. Code in qemu suggests that virtio-blk
is not implementing set_guest_feature.

Tested-by: Bharata B Rao <bharata@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-04-25 15:40:13 +05:30
Avik Sil 46a32aa9c7 Add virtio-net driver in libvirtio
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:00:13 +05:30
Nikunj A. Dadhania b5595b4565 SLOF: virtio-scsi helper routines
* initialize/shutdown virtio-scsi device
* routine for sending scsi commands to virtio-scsi device

[ Modified to pass the whole virtio req/resp from forth
  to allow better handling of status and sense buffer
  -- BenH
]

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2013-06-05 16:12:31 +10:00
Nikunj A. Dadhania a35e44f0e6 virtio: Add a virtio-set-qaddr helper
A simple function that can be used from forth code for setting
virtqueue address. virito-scsi has multiple virtqueues(atleast 3) and
need to use set queue address for all the 3 queues.

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2013-05-21 15:13:45 +10:00
Benjamin Herrenschmidt 44e8d9a57d Add virtfs support
Code originally written by Timothy Rule and reworked &
bug fixed by myself

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-01-19 17:17:50 +11:00
Benjamin Herrenschmidt ca610c931e Move virtio to a separate library
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-01-19 17:17:50 +11:00