Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
124affae
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
124affae
编写于
1月 16, 2014
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pci: Publish some internal code for virpcitest
Signed-off-by:
N
Jiri Denemark
<
jdenemar@redhat.com
>
上级
44bfe357
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
49 addition
and
29 deletion
+49
-29
src/libvirt_private.syms
src/libvirt_private.syms
+2
-0
src/util/virpci.c
src/util/virpci.c
+42
-29
src/util/virpci.h
src/util/virpci.h
+5
-0
未找到文件。
src/libvirt_private.syms
浏览文件 @
124affae
...
@@ -1585,6 +1585,7 @@ virPCIDeviceCopy;
...
@@ -1585,6 +1585,7 @@ virPCIDeviceCopy;
virPCIDeviceDetach;
virPCIDeviceDetach;
virPCIDeviceFileIterate;
virPCIDeviceFileIterate;
virPCIDeviceFree;
virPCIDeviceFree;
virPCIDeviceGetDriverPathAndName;
virPCIDeviceGetIOMMUGroupDev;
virPCIDeviceGetIOMMUGroupDev;
virPCIDeviceGetIOMMUGroupList;
virPCIDeviceGetIOMMUGroupList;
virPCIDeviceGetManaged;
virPCIDeviceGetManaged;
...
@@ -1616,6 +1617,7 @@ virPCIDeviceSetReprobe;
...
@@ -1616,6 +1617,7 @@ virPCIDeviceSetReprobe;
virPCIDeviceSetStubDriver;
virPCIDeviceSetStubDriver;
virPCIDeviceSetUnbindFromStub;
virPCIDeviceSetUnbindFromStub;
virPCIDeviceSetUsedBy;
virPCIDeviceSetUsedBy;
virPCIDeviceUnbind;
virPCIDeviceWaitForCleanup;
virPCIDeviceWaitForCleanup;
virPCIGetNetName;
virPCIGetNetName;
virPCIGetPhysicalFunction;
virPCIGetPhysicalFunction;
...
...
src/util/virpci.c
浏览文件 @
124affae
...
@@ -225,7 +225,7 @@ virPCIFile(char **buffer, const char *device, const char *file)
...
@@ -225,7 +225,7 @@ virPCIFile(char **buffer, const char *device, const char *file)
*
*
* Return 0 for success, -1 for error.
* Return 0 for success, -1 for error.
*/
*/
static
int
int
virPCIDeviceGetDriverPathAndName
(
virPCIDevicePtr
dev
,
char
**
path
,
char
**
name
)
virPCIDeviceGetDriverPathAndName
(
virPCIDevicePtr
dev
,
char
**
path
,
char
**
name
)
{
{
int
ret
=
-
1
;
int
ret
=
-
1
;
...
@@ -1005,6 +1005,44 @@ recheck:
...
@@ -1005,6 +1005,44 @@ recheck:
return
-
1
;
return
-
1
;
}
}
int
virPCIDeviceUnbind
(
virPCIDevicePtr
dev
,
bool
reprobe
)
{
char
*
path
=
NULL
;
char
*
drvpath
=
NULL
;
char
*
driver
=
NULL
;
int
ret
=
-
1
;
if
(
virPCIDeviceGetDriverPathAndName
(
dev
,
&
drvpath
,
&
driver
)
<
0
)
goto
cleanup
;
if
(
!
driver
)
{
/* The device is not bound to any driver */
ret
=
0
;
goto
cleanup
;
}
if
(
virPCIFile
(
&
path
,
dev
->
name
,
"driver/unbind"
)
<
0
)
goto
cleanup
;
if
(
virFileExists
(
path
))
{
if
(
virFileWriteStr
(
path
,
dev
->
name
,
0
)
<
0
)
{
virReportSystemError
(
errno
,
_
(
"Failed to unbind PCI device '%s' from %s"
),
dev
->
name
,
driver
);
goto
cleanup
;
}
dev
->
reprobe
=
reprobe
;
}
ret
=
0
;
cleanup:
VIR_FREE
(
path
);
VIR_FREE
(
drvpath
);
VIR_FREE
(
driver
);
return
ret
;
}
static
const
char
*
virPCIKnownStubs
[]
=
{
static
const
char
*
virPCIKnownStubs
[]
=
{
"pciback"
,
/* used by xen */
"pciback"
,
/* used by xen */
"pci-stub"
,
/* used by kvm legacy passthrough */
"pci-stub"
,
/* used by kvm legacy passthrough */
...
@@ -1047,18 +1085,8 @@ virPCIDeviceUnbindFromStub(virPCIDevicePtr dev)
...
@@ -1047,18 +1085,8 @@ virPCIDeviceUnbindFromStub(virPCIDevicePtr dev)
if
(
!
isStub
)
if
(
!
isStub
)
goto
remove_slot
;
goto
remove_slot
;
if
(
virFileExists
(
drvdir
))
{
if
(
virPCIDeviceUnbind
(
dev
,
dev
->
reprobe
)
<
0
)
if
(
virPCIDriverFile
(
&
path
,
driver
,
"unbind"
)
<
0
)
{
goto
cleanup
;
}
if
(
virFileWriteStr
(
path
,
dev
->
name
,
0
)
<
0
)
{
virReportSystemError
(
errno
,
_
(
"Failed to unbind PCI device '%s' from %s"
),
dev
->
name
,
driver
);
goto
cleanup
;
goto
cleanup
;
}
}
dev
->
unbind_from_stub
=
false
;
dev
->
unbind_from_stub
=
false
;
remove_slot:
remove_slot:
...
@@ -1174,23 +1202,8 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev,
...
@@ -1174,23 +1202,8 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev,
goto
remove_id
;
goto
remove_id
;
}
}
/* If the device is already bound to a driver, unbind it.
if
(
virPCIDeviceUnbind
(
dev
,
reprobe
)
<
0
)
* Note, this will have rather unpleasant side effects if this
* PCI device happens to be IDE controller for the disk hosting
* your root filesystem.
*/
if
(
virPCIFile
(
&
path
,
dev
->
name
,
"driver/unbind"
)
<
0
)
goto
remove_id
;
if
(
virFileExists
(
path
))
{
if
(
virFileWriteStr
(
path
,
dev
->
name
,
0
)
<
0
)
{
virReportSystemError
(
errno
,
_
(
"Failed to unbind PCI device '%s'"
),
dev
->
name
);
goto
remove_id
;
goto
remove_id
;
}
dev
->
reprobe
=
reprobe
;
}
/* If the device isn't already bound to pci-stub, try binding it now.
/* If the device isn't already bound to pci-stub, try binding it now.
*/
*/
...
...
src/util/virpci.h
浏览文件 @
124affae
...
@@ -167,4 +167,9 @@ int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf);
...
@@ -167,4 +167,9 @@ int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf);
int
virPCIGetVirtualFunctionInfo
(
const
char
*
vf_sysfs_device_path
,
int
virPCIGetVirtualFunctionInfo
(
const
char
*
vf_sysfs_device_path
,
char
**
pfname
,
int
*
vf_index
);
char
**
pfname
,
int
*
vf_index
);
int
virPCIDeviceUnbind
(
virPCIDevicePtr
dev
,
bool
reprobe
);
int
virPCIDeviceGetDriverPathAndName
(
virPCIDevicePtr
dev
,
char
**
path
,
char
**
name
);
#endif
/* __VIR_PCI_H__ */
#endif
/* __VIR_PCI_H__ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录