Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
cf21e106
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cf21e106
编写于
5月 14, 2009
作者:
P
Paul Brook
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Virtio-net qdev conversion
Signed-off-by:
N
Paul Brook
<
paul@codesourcery.com
>
上级
9d07d757
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
40 addition
and
32 deletion
+40
-32
hw/pci.c
hw/pci.c
+0
-1
hw/virtio-balloon.c
hw/virtio-balloon.c
+8
-4
hw/virtio-blk.c
hw/virtio-blk.c
+8
-4
hw/virtio-console.c
hw/virtio-console.c
+8
-2
hw/virtio-net.c
hw/virtio-net.c
+12
-9
hw/virtio-net.h
hw/virtio-net.h
+0
-2
hw/virtio.c
hw/virtio.c
+2
-8
hw/virtio.h
hw/virtio.h
+2
-2
未找到文件。
hw/pci.c
浏览文件 @
cf21e106
...
...
@@ -25,7 +25,6 @@
#include "pci.h"
#include "monitor.h"
#include "net.h"
#include "virtio-net.h"
#include "sysemu.h"
//#define DEBUG_PCI
...
...
hw/virtio-balloon.c
浏览文件 @
cf21e106
...
...
@@ -172,16 +172,20 @@ static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
void
*
virtio_balloon_init
(
PCIBus
*
bus
)
{
VirtIOBalloon
*
s
;
PCIDevice
*
d
;
s
=
(
VirtIOBalloon
*
)
virtio_init_pci
(
bus
,
"virtio-balloon"
,
d
=
pci_register_device
(
bus
,
"virtio-balloon"
,
sizeof
(
VirtIOBalloon
),
-
1
,
NULL
,
NULL
);
if
(
!
d
)
return
NULL
;
s
=
(
VirtIOBalloon
*
)
virtio_init_pci
(
d
,
"virtio-balloon"
,
PCI_VENDOR_ID_REDHAT_QUMRANET
,
PCI_DEVICE_ID_VIRTIO_BALLOON
,
PCI_VENDOR_ID_REDHAT_QUMRANET
,
VIRTIO_ID_BALLOON
,
PCI_CLASS_MEMORY_RAM
,
0x00
,
8
,
sizeof
(
VirtIOBalloon
));
if
(
s
==
NULL
)
return
NULL
;
8
);
s
->
vdev
.
get_config
=
virtio_balloon_get_config
;
s
->
vdev
.
set_config
=
virtio_balloon_set_config
;
...
...
hw/virtio-blk.c
浏览文件 @
cf21e106
...
...
@@ -353,16 +353,20 @@ void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs)
VirtIOBlock
*
s
;
int
cylinders
,
heads
,
secs
;
static
int
virtio_blk_id
;
PCIDevice
*
d
;
s
=
(
VirtIOBlock
*
)
virtio_init_pci
(
bus
,
"virtio-blk"
,
d
=
pci_register_device
(
bus
,
"virtio-blk"
,
sizeof
(
VirtIOBlock
),
-
1
,
NULL
,
NULL
);
if
(
!
d
)
return
NULL
;
s
=
(
VirtIOBlock
*
)
virtio_init_pci
(
d
,
"virtio-blk"
,
PCI_VENDOR_ID_REDHAT_QUMRANET
,
PCI_DEVICE_ID_VIRTIO_BLOCK
,
PCI_VENDOR_ID_REDHAT_QUMRANET
,
VIRTIO_ID_BLOCK
,
PCI_CLASS_STORAGE_OTHER
,
0x00
,
sizeof
(
struct
virtio_blk_config
),
sizeof
(
VirtIOBlock
));
if
(
!
s
)
return
NULL
;
sizeof
(
struct
virtio_blk_config
));
s
->
vdev
.
get_config
=
virtio_blk_update_config
;
s
->
vdev
.
get_features
=
virtio_blk_get_features
;
...
...
hw/virtio-console.c
浏览文件 @
cf21e106
...
...
@@ -126,14 +126,20 @@ static int virtio_console_load(QEMUFile *f, void *opaque, int version_id)
void
*
virtio_console_init
(
PCIBus
*
bus
,
CharDriverState
*
chr
)
{
VirtIOConsole
*
s
;
PCIDevice
*
d
;
s
=
(
VirtIOConsole
*
)
virtio_init_pci
(
bus
,
"virtio-console"
,
d
=
pci_register_device
(
bus
,
"virtio-console"
,
sizeof
(
VirtIOConsole
),
-
1
,
NULL
,
NULL
);
if
(
!
d
)
return
NULL
;
s
=
(
VirtIOConsole
*
)
virtio_init_pci
(
d
,
"virtio-console"
,
PCI_VENDOR_ID_REDHAT_QUMRANET
,
PCI_DEVICE_ID_VIRTIO_CONSOLE
,
PCI_VENDOR_ID_REDHAT_QUMRANET
,
VIRTIO_ID_CONSOLE
,
PCI_CLASS_DISPLAY_OTHER
,
0x00
,
0
,
sizeof
(
VirtIOConsole
)
);
0
);
if
(
s
==
NULL
)
return
NULL
;
...
...
hw/virtio-net.c
浏览文件 @
cf21e106
...
...
@@ -585,21 +585,18 @@ static void virtio_net_cleanup(VLANClientState *vc)
virtio_cleanup
(
&
n
->
vdev
);
}
PCIDevice
*
virtio_net_init
(
PCIBus
*
bus
,
NICInfo
*
nd
,
int
devfn
)
static
void
virtio_net_init
(
PCIDevice
*
pci_dev
)
{
VirtIONet
*
n
;
static
int
virtio_net_id
;
n
=
(
VirtIONet
*
)
virtio_init_pci
(
bus
,
"virtio-net"
,
n
=
(
VirtIONet
*
)
virtio_init_pci
(
pci_dev
,
"virtio-net"
,
PCI_VENDOR_ID_REDHAT_QUMRANET
,
PCI_DEVICE_ID_VIRTIO_NET
,
PCI_VENDOR_ID_REDHAT_QUMRANET
,
VIRTIO_ID_NET
,
PCI_CLASS_NETWORK_ETHERNET
,
0x00
,
sizeof
(
struct
virtio_net_config
),
sizeof
(
VirtIONet
));
if
(
!
n
)
return
NULL
;
sizeof
(
struct
virtio_net_config
));
n
->
vdev
.
get_config
=
virtio_net_get_config
;
n
->
vdev
.
set_config
=
virtio_net_set_config
;
...
...
@@ -610,9 +607,9 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
n
->
rx_vq
=
virtio_add_queue
(
&
n
->
vdev
,
256
,
virtio_net_handle_rx
);
n
->
tx_vq
=
virtio_add_queue
(
&
n
->
vdev
,
256
,
virtio_net_handle_tx
);
n
->
ctrl_vq
=
virtio_add_queue
(
&
n
->
vdev
,
16
,
virtio_net_handle_ctrl
);
memcpy
(
n
->
mac
,
nd
->
macaddr
,
ETH_ALEN
);
qdev_get_macaddr
(
&
pci_dev
->
qdev
,
n
->
mac
);
n
->
status
=
VIRTIO_NET_S_LINK_UP
;
n
->
vc
=
q
emu_new_vlan_client
(
nd
->
vlan
,
nd
->
model
,
nd
->
name
,
n
->
vc
=
q
dev_get_vlan_client
(
&
pci_dev
->
qdev
,
virtio_net_receive
,
virtio_net_can_receive
,
virtio_net_cleanup
,
n
);
...
...
@@ -631,5 +628,11 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
register_savevm
(
"virtio-net"
,
virtio_net_id
++
,
VIRTIO_NET_VM_VERSION
,
virtio_net_save
,
virtio_net_load
,
n
);
return
(
PCIDevice
*
)
n
;
}
static
void
virtio_net_register_devices
(
void
)
{
pci_qdev_register
(
"virtio_net"
,
sizeof
(
VirtIONet
),
virtio_net_init
);
}
device_init
(
virtio_net_register_devices
)
hw/virtio-net.h
浏览文件 @
cf21e106
...
...
@@ -85,8 +85,6 @@ struct virtio_net_hdr_mrg_rxbuf
uint16_t
num_buffers
;
/* Number of merged rx buffers */
};
PCIDevice
*
virtio_net_init
(
PCIBus
*
bus
,
NICInfo
*
nd
,
int
devfn
);
/*
* Control virtqueue data structures
*
...
...
hw/virtio.c
浏览文件 @
cf21e106
...
...
@@ -757,22 +757,16 @@ void virtio_cleanup(VirtIODevice *vdev)
qemu_free
(
vdev
->
vq
);
}
VirtIODevice
*
virtio_init_pci
(
PCI
Bus
*
bus
,
const
char
*
name
,
VirtIODevice
*
virtio_init_pci
(
PCI
Device
*
pci_dev
,
const
char
*
name
,
uint16_t
vendor
,
uint16_t
device
,
uint16_t
subvendor
,
uint16_t
subdevice
,
uint16_t
class_code
,
uint8_t
pif
,
size_t
config_size
,
size_t
struct_size
)
size_t
config_size
)
{
VirtIODevice
*
vdev
;
PCIDevice
*
pci_dev
;
uint8_t
*
config
;
uint32_t
size
;
pci_dev
=
pci_register_device
(
bus
,
name
,
struct_size
,
-
1
,
NULL
,
NULL
);
if
(
!
pci_dev
)
return
NULL
;
vdev
=
to_virtio_device
(
pci_dev
);
vdev
->
status
=
0
;
...
...
hw/virtio.h
浏览文件 @
cf21e106
...
...
@@ -92,11 +92,11 @@ struct VirtIODevice
VirtQueue
*
vq
;
};
VirtIODevice
*
virtio_init_pci
(
PCI
Bus
*
bus
,
const
char
*
name
,
VirtIODevice
*
virtio_init_pci
(
PCI
Device
*
pci_dev
,
const
char
*
name
,
uint16_t
vendor
,
uint16_t
device
,
uint16_t
subvendor
,
uint16_t
subdevice
,
uint16_t
class_code
,
uint8_t
pif
,
size_t
config_size
,
size_t
struct_size
);
size_t
config_size
);
VirtQueue
*
virtio_add_queue
(
VirtIODevice
*
vdev
,
int
queue_size
,
void
(
*
handle_output
)(
VirtIODevice
*
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录