Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
a229c053
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,发现更多精彩内容 >>
提交
a229c053
编写于
6月 08, 2012
作者:
G
Gerd Hoffmann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
usb-host: live migration support
Signed-off-by:
N
Gerd Hoffmann
<
kraxel@redhat.com
>
上级
a844ed84
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
46 addition
and
1 deletion
+46
-1
hw/usb/host-linux.c
hw/usb/host-linux.c
+46
-1
未找到文件。
hw/usb/host-linux.c
浏览文件 @
a229c053
...
...
@@ -111,6 +111,7 @@ typedef struct USBHostDevice {
uint32_t
iso_urb_count
;
uint32_t
options
;
Notifier
exit
;
QEMUBH
*
bh
;
struct
endp_data
ep_in
[
USB_MAX_ENDPOINTS
];
struct
endp_data
ep_out
[
USB_MAX_ENDPOINTS
];
...
...
@@ -1421,6 +1422,43 @@ static void usb_host_exit_notifier(struct Notifier *n, void *data)
}
}
/*
* This is *NOT* about restoring state. We have absolutely no idea
* what state the host device is in at the moment and whenever it is
* still present in the first place. Attemping to contine where we
* left off is impossible.
*
* What we are going to to to here is emulate a surprise removal of
* the usb device passed through, then kick host scan so the device
* will get re-attached (and re-initialized by the guest) in case it
* is still present.
*
* As the device removal will change the state of other devices (usb
* host controller, most likely interrupt controller too) we have to
* wait with it until *all* vmstate is loaded. Thus post_load just
* kicks a bottom half which then does the actual work.
*/
static
void
usb_host_post_load_bh
(
void
*
opaque
)
{
USBHostDevice
*
dev
=
opaque
;
if
(
dev
->
fd
!=
-
1
)
{
usb_host_close
(
dev
);
}
if
(
dev
->
dev
.
attached
)
{
usb_device_detach
(
&
dev
->
dev
);
}
usb_host_auto_check
(
NULL
);
}
static
int
usb_host_post_load
(
void
*
opaque
,
int
version_id
)
{
USBHostDevice
*
dev
=
opaque
;
qemu_bh_schedule
(
dev
->
bh
);
return
0
;
}
static
int
usb_host_initfn
(
USBDevice
*
dev
)
{
USBHostDevice
*
s
=
DO_UPCAST
(
USBHostDevice
,
dev
,
dev
);
...
...
@@ -1432,6 +1470,7 @@ static int usb_host_initfn(USBDevice *dev)
QTAILQ_INSERT_TAIL
(
&
hostdevs
,
s
,
next
);
s
->
exit
.
notify
=
usb_host_exit_notifier
;
qemu_add_exit_notifier
(
&
s
->
exit
);
s
->
bh
=
qemu_bh_new
(
usb_host_post_load_bh
,
s
);
usb_host_auto_check
(
NULL
);
if
(
s
->
match
.
bus_num
!=
0
&&
s
->
match
.
port
!=
NULL
)
{
...
...
@@ -1443,7 +1482,13 @@ static int usb_host_initfn(USBDevice *dev)
static
const
VMStateDescription
vmstate_usb_host
=
{
.
name
=
"usb-host"
,
.
unmigratable
=
1
,
.
version_id
=
1
,
.
minimum_version_id
=
1
,
.
post_load
=
usb_host_post_load
,
.
fields
=
(
VMStateField
[])
{
VMSTATE_USB_DEVICE
(
dev
,
USBHostDevice
),
VMSTATE_END_OF_LIST
()
}
};
static
Property
usb_host_dev_properties
[]
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录