Revision 9fe1ebeb
b/Makefile.objs | ||
---|---|---|
45 | 45 |
net-nested-$(CONFIG_VDE) += vde.o |
46 | 46 |
net-obj-y += $(addprefix net/, $(net-nested-y)) |
47 | 47 |
|
48 |
ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS),yy)
|
|
48 |
ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
|
|
49 | 49 |
# Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add. |
50 | 50 |
# only pull in the actual virtio-9p device if we also enabled virtio. |
51 | 51 |
CONFIG_REALLY_VIRTFS=y |
b/hw/9pfs/virtio-9p.c | ||
---|---|---|
14 | 14 |
#include "virtio.h" |
15 | 15 |
#include "pc.h" |
16 | 16 |
#include "qemu_socket.h" |
17 |
#include "virtio-pci.h" |
|
17 | 18 |
#include "virtio-9p.h" |
18 | 19 |
#include "fsdev/qemu-fsdev.h" |
19 | 20 |
#include "virtio-9p-debug.h" |
... | ... | |
3761 | 3762 |
|
3762 | 3763 |
return &s->vdev; |
3763 | 3764 |
} |
3765 |
|
|
3766 |
static int virtio_9p_init_pci(PCIDevice *pci_dev) |
|
3767 |
{ |
|
3768 |
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); |
|
3769 |
VirtIODevice *vdev; |
|
3770 |
|
|
3771 |
vdev = virtio_9p_init(&pci_dev->qdev, &proxy->fsconf); |
|
3772 |
vdev->nvectors = proxy->nvectors; |
|
3773 |
virtio_init_pci(proxy, vdev, |
|
3774 |
PCI_VENDOR_ID_REDHAT_QUMRANET, |
|
3775 |
0x1009, |
|
3776 |
0x2, |
|
3777 |
0x00); |
|
3778 |
/* make the actual value visible */ |
|
3779 |
proxy->nvectors = vdev->nvectors; |
|
3780 |
return 0; |
|
3781 |
} |
|
3782 |
|
|
3783 |
static PCIDeviceInfo virtio_9p_info = { |
|
3784 |
.qdev.name = "virtio-9p-pci", |
|
3785 |
.qdev.size = sizeof(VirtIOPCIProxy), |
|
3786 |
.init = virtio_9p_init_pci, |
|
3787 |
.qdev.props = (Property[]) { |
|
3788 |
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), |
|
3789 |
DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features), |
|
3790 |
DEFINE_PROP_STRING("mount_tag", VirtIOPCIProxy, fsconf.tag), |
|
3791 |
DEFINE_PROP_STRING("fsdev", VirtIOPCIProxy, fsconf.fsdev_id), |
|
3792 |
DEFINE_PROP_END_OF_LIST(), |
|
3793 |
} |
|
3794 |
}; |
|
3795 |
|
|
3796 |
static void virtio_9p_register_devices(void) |
|
3797 |
{ |
|
3798 |
pci_qdev_register(&virtio_9p_info); |
|
3799 |
} |
|
3800 |
|
|
3801 |
device_init(virtio_9p_register_devices) |
b/hw/virtio-pci.c | ||
---|---|---|
26 | 26 |
#include "loader.h" |
27 | 27 |
#include "kvm.h" |
28 | 28 |
#include "blockdev.h" |
29 |
#include "virtio-pci.h" |
|
29 | 30 |
|
30 | 31 |
/* from Linux's linux/virtio_pci.h */ |
31 | 32 |
|
... | ... | |
95 | 96 |
*/ |
96 | 97 |
#define wmb() do { } while (0) |
97 | 98 |
|
98 |
/* PCI bindings. */ |
|
99 |
|
|
100 |
typedef struct { |
|
101 |
PCIDevice pci_dev; |
|
102 |
VirtIODevice *vdev; |
|
103 |
uint32_t flags; |
|
104 |
uint32_t addr; |
|
105 |
uint32_t class_code; |
|
106 |
uint32_t nvectors; |
|
107 |
BlockConf block; |
|
108 |
NICConf nic; |
|
109 |
uint32_t host_features; |
|
110 |
#ifdef CONFIG_LINUX |
|
111 |
V9fsConf fsconf; |
|
112 |
#endif |
|
113 |
virtio_serial_conf serial; |
|
114 |
virtio_net_conf net; |
|
115 |
bool ioeventfd_disabled; |
|
116 |
bool ioeventfd_started; |
|
117 |
} VirtIOPCIProxy; |
|
118 |
|
|
119 | 99 |
/* virtio device */ |
120 | 100 |
|
121 | 101 |
static void virtio_pci_notify(void *opaque, uint16_t vector) |
... | ... | |
669 | 649 |
.vmstate_change = virtio_pci_vmstate_change, |
670 | 650 |
}; |
671 | 651 |
|
672 |
static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
|
|
652 |
void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev, |
|
673 | 653 |
uint16_t vendor, uint16_t device, |
674 | 654 |
uint16_t class_code, uint8_t pif) |
675 | 655 |
{ |
... | ... | |
835 | 815 |
return 0; |
836 | 816 |
} |
837 | 817 |
|
838 |
#ifdef CONFIG_VIRTFS |
|
839 |
static int virtio_9p_init_pci(PCIDevice *pci_dev) |
|
840 |
{ |
|
841 |
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); |
|
842 |
VirtIODevice *vdev; |
|
843 |
|
|
844 |
vdev = virtio_9p_init(&pci_dev->qdev, &proxy->fsconf); |
|
845 |
vdev->nvectors = proxy->nvectors; |
|
846 |
virtio_init_pci(proxy, vdev, |
|
847 |
PCI_VENDOR_ID_REDHAT_QUMRANET, |
|
848 |
0x1009, |
|
849 |
0x2, |
|
850 |
0x00); |
|
851 |
/* make the actual value visible */ |
|
852 |
proxy->nvectors = vdev->nvectors; |
|
853 |
return 0; |
|
854 |
} |
|
855 |
#endif |
|
856 |
|
|
857 | 818 |
static PCIDeviceInfo virtio_info[] = { |
858 | 819 |
{ |
859 | 820 |
.qdev.name = "virtio-blk-pci", |
... | ... | |
922 | 883 |
}, |
923 | 884 |
.qdev.reset = virtio_pci_reset, |
924 | 885 |
},{ |
925 |
#ifdef CONFIG_VIRTFS |
|
926 |
.qdev.name = "virtio-9p-pci", |
|
927 |
.qdev.alias = "virtio-9p", |
|
928 |
.qdev.size = sizeof(VirtIOPCIProxy), |
|
929 |
.init = virtio_9p_init_pci, |
|
930 |
.qdev.props = (Property[]) { |
|
931 |
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), |
|
932 |
DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features), |
|
933 |
DEFINE_PROP_STRING("mount_tag", VirtIOPCIProxy, fsconf.tag), |
|
934 |
DEFINE_PROP_STRING("fsdev", VirtIOPCIProxy, fsconf.fsdev_id), |
|
935 |
DEFINE_PROP_END_OF_LIST(), |
|
936 |
}, |
|
937 |
}, { |
|
938 |
#endif |
|
939 | 886 |
/* end of list */ |
940 | 887 |
} |
941 | 888 |
}; |
b/hw/virtio-pci.h | ||
---|---|---|
1 |
/* |
|
2 |
* Virtio PCI Bindings |
|
3 |
* |
|
4 |
* Copyright IBM, Corp. 2007 |
|
5 |
* Copyright (c) 2009 CodeSourcery |
|
6 |
* |
|
7 |
* Authors: |
|
8 |
* Anthony Liguori <aliguori@us.ibm.com> |
|
9 |
* Paul Brook <paul@codesourcery.com> |
|
10 |
* |
|
11 |
* This work is licensed under the terms of the GNU GPL, version 2. See |
|
12 |
* the COPYING file in the top-level directory. |
|
13 |
*/ |
|
14 |
|
|
15 |
#ifndef QEMU_VIRTIO_PCI_H |
|
16 |
#define QEMU_VIRTIO_PCI_H |
|
17 |
|
|
18 |
#include "virtio-net.h" |
|
19 |
#include "virtio-serial.h" |
|
20 |
|
|
21 |
typedef struct { |
|
22 |
PCIDevice pci_dev; |
|
23 |
VirtIODevice *vdev; |
|
24 |
uint32_t flags; |
|
25 |
uint32_t addr; |
|
26 |
uint32_t class_code; |
|
27 |
uint32_t nvectors; |
|
28 |
BlockConf block; |
|
29 |
NICConf nic; |
|
30 |
uint32_t host_features; |
|
31 |
#ifdef CONFIG_LINUX |
|
32 |
V9fsConf fsconf; |
|
33 |
#endif |
|
34 |
virtio_serial_conf serial; |
|
35 |
virtio_net_conf net; |
|
36 |
bool ioeventfd_disabled; |
|
37 |
bool ioeventfd_started; |
|
38 |
} VirtIOPCIProxy; |
|
39 |
|
|
40 |
extern void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev, |
|
41 |
uint16_t vendor, uint16_t device, |
|
42 |
uint16_t class_code, uint8_t pif); |
|
43 |
#endif |
Also available in: Unified diff