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
This commit is contained in:
parent
3dd8d840ed
commit
abd6790ce8
@ -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 .
|
||||
|
@ -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 .
|
||||
|
@ -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 .
|
||||
|
@ -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 .
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user