diff options
author | bryanv <bryanv@FreeBSD.org> | 2013-07-04 17:57:26 +0000 |
---|---|---|
committer | bryanv <bryanv@FreeBSD.org> | 2013-07-04 17:57:26 +0000 |
commit | 5cda36b5ac3c30cfb2a0c172471aacfa08583438 (patch) | |
tree | ee2ee2f1b022368ac3e2a7f0618fc28ba9d4135c | |
parent | e56d87e5498bf6002856c59cb2e6bc32d5f9a555 (diff) | |
download | FreeBSD-src-5cda36b5ac3c30cfb2a0c172471aacfa08583438.zip FreeBSD-src-5cda36b5ac3c30cfb2a0c172471aacfa08583438.tar.gz |
Merge virtio changes from projects/virtio
Contains projects/virtio commits:
r245738:
virtio: Minor man page tweaks
r246060:
virtio: Cleanup feature description printing
r246306:
virtio: Remove old debugging flag
r247238:
virtio: Remove PRIx64 macros from format strings
r247239:
virtio: Constify some fields
r247240:
virtio: Minor code simplifications
r249962:
virtio: Update to my freebsd.org email address
MFC after: 1 month
-rw-r--r-- | share/man/man4/virtio.4 | 6 | ||||
-rw-r--r-- | share/man/man4/virtio_balloon.4 | 2 | ||||
-rw-r--r-- | share/man/man4/virtio_blk.4 | 2 | ||||
-rw-r--r-- | share/man/man4/virtio_scsi.4 | 2 | ||||
-rw-r--r-- | share/man/man4/vtnet.4 | 2 | ||||
-rw-r--r-- | sys/dev/virtio/balloon/virtio_balloon.c | 2 | ||||
-rw-r--r-- | sys/dev/virtio/block/virtio_blk.c | 2 | ||||
-rw-r--r-- | sys/dev/virtio/network/if_vtnet.c | 2 | ||||
-rw-r--r-- | sys/dev/virtio/network/if_vtnetvar.h | 2 | ||||
-rw-r--r-- | sys/dev/virtio/pci/virtio_pci.c | 5 | ||||
-rw-r--r-- | sys/dev/virtio/scsi/virtio_scsi.c | 2 | ||||
-rw-r--r-- | sys/dev/virtio/scsi/virtio_scsivar.h | 2 | ||||
-rw-r--r-- | sys/dev/virtio/virtio.c | 59 | ||||
-rw-r--r-- | sys/dev/virtio/virtio.h | 2 | ||||
-rw-r--r-- | sys/dev/virtio/virtio_bus_if.m | 5 | ||||
-rw-r--r-- | sys/dev/virtio/virtio_if.m | 2 | ||||
-rw-r--r-- | sys/dev/virtio/virtqueue.c | 2 | ||||
-rw-r--r-- | sys/dev/virtio/virtqueue.h | 2 |
18 files changed, 48 insertions, 55 deletions
diff --git a/share/man/man4/virtio.4 b/share/man/man4/virtio.4 index 6856f69..10ebf20 100644 --- a/share/man/man4/virtio.4 +++ b/share/man/man4/virtio.4 @@ -53,10 +53,10 @@ This emulation is often inefficient. .Pp VirtIO defines an interface for efficient I/O between the hypervisor and VM. The -.Xr virtio 4 +.Nm module provides a shared memory transport called a virtqueue. The -.Xr virtio_pci 4 +.Xr virtio_pci device driver represents an emulated PCI device that the hypervisor makes available to the VM. This device provides the probing, configuration, and @@ -94,4 +94,4 @@ Support for VirtIO first appeared in .An -nosplit .Fx support for VirtIO was first added by -.An Bryan Venteicher Aq bryanv@daemoninthecloset.org . +.An Bryan Venteicher Aq bryanv@FreeBSD.org . diff --git a/share/man/man4/virtio_balloon.4 b/share/man/man4/virtio_balloon.4 index 96e8c73..450b5cd 100644 --- a/share/man/man4/virtio_balloon.4 +++ b/share/man/man4/virtio_balloon.4 @@ -59,6 +59,6 @@ The hypervisor can later signal the balloon to return the memory. The .Nm driver was written by -.An Bryan Venteicher Aq bryanv@daemoninthecloset.org . +.An Bryan Venteicher Aq bryanv@FreeBSD.org . It first appeared in .Fx 9.0 . diff --git a/share/man/man4/virtio_blk.4 b/share/man/man4/virtio_blk.4 index d71ca7e..eb5fded 100644 --- a/share/man/man4/virtio_blk.4 +++ b/share/man/man4/virtio_blk.4 @@ -87,6 +87,6 @@ be toggled between writethrough and writeback. The .Nm driver was written by -.An Bryan Venteicher Aq bryanv@daemoninthecloset.org . +.An Bryan Venteicher Aq bryanv@FreeBSD.org . It first appeared in .Fx 9.0 . diff --git a/share/man/man4/virtio_scsi.4 b/share/man/man4/virtio_scsi.4 index a2d30d4..b136de6 100644 --- a/share/man/man4/virtio_scsi.4 +++ b/share/man/man4/virtio_scsi.4 @@ -87,6 +87,6 @@ Enable tracing prints. The .Nm driver was written by -.An Bryan Venteicher Aq bryanv@daemoninthecloset.org . +.An Bryan Venteicher Aq bryanv@FreeBSD.org . It first appeared in .Fx 10.0 . diff --git a/share/man/man4/vtnet.4 b/share/man/man4/vtnet.4 index febb0ac..8d4d202 100644 --- a/share/man/man4/vtnet.4 +++ b/share/man/man4/vtnet.4 @@ -89,7 +89,7 @@ The default value is 0. The .Nm driver was written by -.An Bryan Venteicher Aq bryanv@daemoninthecloset.org . +.An Bryan Venteicher Aq bryanv@FreeBSD.org . It first appeared in .Fx 9.0 . .Sh CAVEATS diff --git a/sys/dev/virtio/balloon/virtio_balloon.c b/sys/dev/virtio/balloon/virtio_balloon.c index c222032..9a87cf2 100644 --- a/sys/dev/virtio/balloon/virtio_balloon.c +++ b/sys/dev/virtio/balloon/virtio_balloon.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c index 2d76398..5219a38 100644 --- a/sys/dev/virtio/block/virtio_blk.c +++ b/sys/dev/virtio/block/virtio_blk.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 329614a..89604d1 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index da7e61d..d870436 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/virtio/pci/virtio_pci.c b/sys/dev/virtio/pci/virtio_pci.c index 02a9d23..0e7d412 100644 --- a/sys/dev/virtio/pci/virtio_pci.c +++ b/sys/dev/virtio/pci/virtio_pci.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -487,9 +487,6 @@ vtpci_alloc_virtqueues(device_t dev, int flags, int nvqs, if (nvqs <= 0 || nvqs > VIRTIO_MAX_VIRTQUEUES) return (EINVAL); - if (flags & VIRTIO_ALLOC_VQS_DISABLE_MSIX) - sc->vtpci_flags |= VTPCI_FLAG_NO_MSIX; - for (idx = 0; idx < nvqs; idx++) { vqx = &sc->vtpci_vqx[idx]; info = &vq_info[idx]; diff --git a/sys/dev/virtio/scsi/virtio_scsi.c b/sys/dev/virtio/scsi/virtio_scsi.c index d471937..64aa62d 100644 --- a/sys/dev/virtio/scsi/virtio_scsi.c +++ b/sys/dev/virtio/scsi/virtio_scsi.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2012, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/virtio/scsi/virtio_scsivar.h b/sys/dev/virtio/scsi/virtio_scsivar.h index ca53f21..f30f667 100644 --- a/sys/dev/virtio/scsi/virtio_scsivar.h +++ b/sys/dev/virtio/scsi/virtio_scsivar.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2012, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/virtio/virtio.c b/sys/dev/virtio/virtio.c index 6c6b0bc..ea2b91a 100644 --- a/sys/dev/virtio/virtio.c +++ b/sys/dev/virtio/virtio.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/resource.h> -#include <machine/_inttypes.h> #include <sys/bus.h> #include <sys/rman.h> @@ -49,8 +48,8 @@ static int virtio_modevent(module_t, int, void *); static const char *virtio_feature_name(uint64_t, struct virtio_feature_desc *); static struct virtio_ident { - uint16_t devid; - char *name; + uint16_t devid; + const char *name; } virtio_ident_table[] = { { VIRTIO_ID_NETWORK, "Network" }, { VIRTIO_ID_BLOCK, "Block" }, @@ -87,9 +86,29 @@ virtio_device_name(uint16_t devid) return (NULL); } +static const char * +virtio_feature_name(uint64_t val, struct virtio_feature_desc *desc) +{ + int i, j; + struct virtio_feature_desc *descs[2] = { desc, + virtio_common_feature_desc }; + + for (i = 0; i < 2; i++) { + if (descs[i] == NULL) + continue; + + for (j = 0; descs[i][j].vfd_val != 0; j++) { + if (val == descs[i][j].vfd_val) + return (descs[i][j].vfd_str); + } + } + + return (NULL); +} + void virtio_describe(device_t dev, const char *msg, - uint64_t features, struct virtio_feature_desc *feature_desc) + uint64_t features, struct virtio_feature_desc *desc) { struct sbuf sb; uint64_t val; @@ -98,13 +117,12 @@ virtio_describe(device_t dev, const char *msg, int n; if ((buf = malloc(512, M_TEMP, M_NOWAIT)) == NULL) { - device_printf(dev, "%s features: 0x%"PRIx64"\n", msg, - features); + device_printf(dev, "%s features: %#jx\n", msg, (uintmax_t) features); return; } sbuf_new(&sb, buf, 512, SBUF_FIXEDLEN); - sbuf_printf(&sb, "%s features: 0x%"PRIx64, msg, features); + sbuf_printf(&sb, "%s features: %#jx", msg, (uintmax_t) features); for (n = 0, val = 1ULL << 63; val != 0; val >>= 1) { /* @@ -119,15 +137,9 @@ virtio_describe(device_t dev, const char *msg, else sbuf_cat(&sb, ","); - name = NULL; - if (feature_desc != NULL) - name = virtio_feature_name(val, feature_desc); + name = virtio_feature_name(val, desc); if (name == NULL) - name = virtio_feature_name(val, - virtio_common_feature_desc); - - if (name == NULL) - sbuf_printf(&sb, "0x%"PRIx64, val); + sbuf_printf(&sb, "%#jx", (uintmax_t) val); else sbuf_cat(&sb, name); } @@ -147,18 +159,6 @@ virtio_describe(device_t dev, const char *msg, free(buf, M_TEMP); } -static const char * -virtio_feature_name(uint64_t val, struct virtio_feature_desc *feature_desc) -{ - int i; - - for (i = 0; feature_desc[i].vfd_val != 0; i++) - if (val == feature_desc[i].vfd_val) - return (feature_desc[i].vfd_str); - - return (NULL); -} - /* * VirtIO bus method wrappers. */ @@ -251,13 +251,12 @@ virtio_modevent(module_t mod, int type, void *unused) { int error; - error = 0; - switch (type) { case MOD_LOAD: case MOD_QUIESCE: case MOD_UNLOAD: case MOD_SHUTDOWN: + error = 0; break; default: error = EOPNOTSUPP; diff --git a/sys/dev/virtio/virtio.h b/sys/dev/virtio/virtio.h index 4d069dd..e201640 100644 --- a/sys/dev/virtio/virtio.h +++ b/sys/dev/virtio/virtio.h @@ -99,7 +99,7 @@ struct vq_alloc_info; struct virtio_feature_desc { uint64_t vfd_val; - char *vfd_str; + const char *vfd_str; }; const char *virtio_device_name(uint16_t devid); diff --git a/sys/dev/virtio/virtio_bus_if.m b/sys/dev/virtio/virtio_bus_if.m index ec2029d..74341ff 100644 --- a/sys/dev/virtio/virtio_bus_if.m +++ b/sys/dev/virtio/virtio_bus_if.m @@ -1,5 +1,5 @@ #- -# Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> +# Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -50,9 +50,6 @@ METHOD int alloc_virtqueues { int nvqs; struct vq_alloc_info *info; }; -HEADER { -#define VIRTIO_ALLOC_VQS_DISABLE_MSIX 0x1 -}; METHOD int setup_intr { device_t dev; diff --git a/sys/dev/virtio/virtio_if.m b/sys/dev/virtio/virtio_if.m index 13b0660..9a99d37 100644 --- a/sys/dev/virtio/virtio_if.m +++ b/sys/dev/virtio/virtio_if.m @@ -1,5 +1,5 @@ #- -# Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> +# Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/virtio/virtqueue.c b/sys/dev/virtio/virtqueue.c index 275a92d..88ce577 100644 --- a/sys/dev/virtio/virtqueue.c +++ b/sys/dev/virtio/virtqueue.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/virtio/virtqueue.h b/sys/dev/virtio/virtqueue.h index 80e52ff..128a10a 100644 --- a/sys/dev/virtio/virtqueue.h +++ b/sys/dev/virtio/virtqueue.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, Bryan Venteicher <bryanv@daemoninthecloset.org> + * Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without |