Skip to content

Commit

Permalink
virtio: Support MMIO bus for all devices
Browse files Browse the repository at this point in the history
The bus is independent of the device, so all devices can be attached to
either a PCI bus or an MMIO bus. For example, QEMU's virtio-rng-device
gives the MMIO variant of virtio-rng-pci, and is now detected.

Reviewed by:	andrew, br, brooks (mentor)
Approved by:	andrew, br, brooks (mentor)
Differential Revision:	https://reviews.freebsd.org/D24730
  • Loading branch information
jrtc27 committed May 6, 2020
1 parent 046096d commit a1da7a4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sys/dev/virtio/balloon/virtio_balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,16 @@ static driver_t vtballoon_driver = {
};
static devclass_t vtballoon_devclass;

DRIVER_MODULE(virtio_balloon, virtio_mmio, vtballoon_driver,
vtballoon_devclass, 0, 0);
DRIVER_MODULE(virtio_balloon, virtio_pci, vtballoon_driver,
vtballoon_devclass, 0, 0);
MODULE_VERSION(virtio_balloon, 1);
MODULE_DEPEND(virtio_balloon, virtio, 1, 1, 1);

VIRTIO_SIMPLE_PNPTABLE(virtio_balloon, VIRTIO_ID_BALLOON,
"VirtIO Balloon Adapter");
VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_balloon);
VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_balloon);

static int
Expand Down
3 changes: 3 additions & 0 deletions sys/dev/virtio/console/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,16 @@ static driver_t vtcon_driver = {
};
static devclass_t vtcon_devclass;

DRIVER_MODULE(virtio_console, virtio_mmio, vtcon_driver, vtcon_devclass,
vtcon_modevent, 0);
DRIVER_MODULE(virtio_console, virtio_pci, vtcon_driver, vtcon_devclass,
vtcon_modevent, 0);
MODULE_VERSION(virtio_console, 1);
MODULE_DEPEND(virtio_console, virtio, 1, 1, 1);

VIRTIO_SIMPLE_PNPTABLE(virtio_console, VIRTIO_ID_CONSOLE,
"VirtIO Console Adapter");
VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_console);
VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_console);

static int
Expand Down
3 changes: 3 additions & 0 deletions sys/dev/virtio/random/virtio_random.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ static driver_t vtrnd_driver = {
};
static devclass_t vtrnd_devclass;

DRIVER_MODULE(virtio_random, virtio_mmio, vtrnd_driver, vtrnd_devclass,
vtrnd_modevent, 0);
DRIVER_MODULE(virtio_random, virtio_pci, vtrnd_driver, vtrnd_devclass,
vtrnd_modevent, 0);
MODULE_VERSION(virtio_random, 1);
Expand All @@ -104,6 +106,7 @@ MODULE_DEPEND(virtio_random, random_device, 1, 1, 1);

VIRTIO_SIMPLE_PNPTABLE(virtio_random, VIRTIO_ID_ENTROPY,
"VirtIO Entropy Adapter");
VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_random);
VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_random);

static int
Expand Down
3 changes: 3 additions & 0 deletions sys/dev/virtio/scsi/virtio_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,16 @@ static driver_t vtscsi_driver = {
};
static devclass_t vtscsi_devclass;

DRIVER_MODULE(virtio_scsi, virtio_mmio, vtscsi_driver, vtscsi_devclass,
vtscsi_modevent, 0);
DRIVER_MODULE(virtio_scsi, virtio_pci, vtscsi_driver, vtscsi_devclass,
vtscsi_modevent, 0);
MODULE_VERSION(virtio_scsi, 1);
MODULE_DEPEND(virtio_scsi, virtio, 1, 1, 1);
MODULE_DEPEND(virtio_scsi, cam, 1, 1, 1);

VIRTIO_SIMPLE_PNPTABLE(virtio_scsi, VIRTIO_ID_SCSI, "VirtIO SCSI Adapter");
VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_scsi);
VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_scsi);

static int
Expand Down

0 comments on commit a1da7a4

Please sign in to comment.