virtio: Add virtio::probe() helper

Add a new virtio::probe() helper function to simplify virtio driver
probing.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
virtio-net: Use virtio::probe() helper

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
virtio-blk: Use virtio::probe() helper

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
devfs: device_destroy() API

Enable device_destroy() API for the virtio-rng driver.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
virtio: Fix device init with no MSI support

Not all virtio devices support MSI.  Fix device initialization by not
writing to VIRTIO_MSI_QUEUE_VECTOR register if a PCI device does not
advertise MSI-X support.  This is needed to initialize virtio-rng
devices when running on KVM/QEMU.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
virtio: Add virtio-rng driver

This adds the virtio-rng driver to OSv.  The implementation is simple:

  - Start a thread that keeps 64 byte of entropy cached in internal
    buffer.  Entropy is gathered from the host with virtio-rng.

  - Create device nodes for "/dev/random" and "/dev/urandom" that both
    use the same virtio_rng_read() hook.

  - Use the entropy buffer for virtio_rng_read().  If we exhaust the
    buffer, wake up the thread and wait for more entropy to appear.

We eventually should move device node creation to separate
drivers/random.c that multiplexes between different hardware RNG
implementations.  However, as we only support virtio-rng, I'm leaving
that to whomever implements support for the next RNG.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
tests: tst-random.so

Add a simple test case for "/dev/random" which just reads from the file
and prints out the random bytes.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add java.security properties to the image

Without it secure random generator doesn't use /dev/random
source, which leads to slow startup of tomcat.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>