Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
e640e98f
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看板
提交
e640e98f
编写于
3月 05, 2014
作者:
C
Chunyan Liu
提交者:
Daniel P. Berrange
3月 12, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu: use general virhostdev lists instead of its own
上级
b5d5eb9b
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
108 addition
and
111 deletion
+108
-111
src/qemu/qemu_conf.h
src/qemu/qemu_conf.h
+2
-7
src/qemu/qemu_driver.c
src/qemu/qemu_driver.c
+25
-34
src/qemu/qemu_hostdev.c
src/qemu/qemu_hostdev.c
+81
-70
未找到文件。
src/qemu/qemu_conf.h
浏览文件 @
e640e98f
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
# include "locking/lock_manager.h"
# include "locking/lock_manager.h"
# include "qemu_capabilities.h"
# include "qemu_capabilities.h"
# include "virclosecallbacks.h"
# include "virclosecallbacks.h"
# include "virhostdev.h"
# ifdef CPU_SETSIZE
/* Linux */
# ifdef CPU_SETSIZE
/* Linux */
# define QEMUD_CPUMASK_LEN CPU_SETSIZE
# define QEMUD_CPUMASK_LEN CPU_SETSIZE
...
@@ -215,13 +216,7 @@ struct _virQEMUDriver {
...
@@ -215,13 +216,7 @@ struct _virQEMUDriver {
/* Immutable pointer. self-locking APIs */
/* Immutable pointer. self-locking APIs */
virSecurityManagerPtr
securityManager
;
virSecurityManagerPtr
securityManager
;
/* Immutable pointers. Requires locks to be held before
virHostdevManagerPtr
hostdevMgr
;
* calling APIs. activePciHostdevs must be locked before
* inactivePciHostdevs */
virPCIDeviceListPtr
activePciHostdevs
;
virPCIDeviceListPtr
inactivePciHostdevs
;
virUSBDeviceListPtr
activeUsbHostdevs
;
virSCSIDeviceListPtr
activeScsiHostdevs
;
/* Immutable pointer. Unsafe APIs. XXX */
/* Immutable pointer. Unsafe APIs. XXX */
virHashTablePtr
sharedDevices
;
virHashTablePtr
sharedDevices
;
...
...
src/qemu/qemu_driver.c
浏览文件 @
e640e98f
...
@@ -94,6 +94,7 @@
...
@@ -94,6 +94,7 @@
#include "viraccessapicheck.h"
#include "viraccessapicheck.h"
#include "viraccessapicheckqemu.h"
#include "viraccessapicheckqemu.h"
#include "storage/storage_driver.h"
#include "storage/storage_driver.h"
#include "virhostdev.h"
#define VIR_FROM_THIS VIR_FROM_QEMU
#define VIR_FROM_THIS VIR_FROM_QEMU
...
@@ -690,16 +691,7 @@ qemuStateInitialize(bool privileged,
...
@@ -690,16 +691,7 @@ qemuStateInitialize(bool privileged,
if (qemuSecurityInit(qemu_driver) < 0)
if (qemuSecurityInit(qemu_driver) < 0)
goto error;
goto error;
if ((qemu_driver->activePciHostdevs = virPCIDeviceListNew()) == NULL)
if (!(qemu_driver->hostdevMgr = virHostdevManagerGetDefault()))
goto error;
if ((qemu_driver->activeUsbHostdevs = virUSBDeviceListNew()) == NULL)
goto error;
if ((qemu_driver->inactivePciHostdevs = virPCIDeviceListNew()) == NULL)
goto error;
if ((qemu_driver->activeScsiHostdevs = virSCSIDeviceListNew()) == NULL)
goto error;
goto error;
if (!(qemu_driver->sharedDevices = virHashCreate(30, qemuSharedDeviceEntryFree)))
if (!(qemu_driver->sharedDevices = virHashCreate(30, qemuSharedDeviceEntryFree)))
...
@@ -979,10 +971,7 @@ qemuStateCleanup(void) {
...
@@ -979,10 +971,7 @@ qemuStateCleanup(void) {
virNWFilterUnRegisterCallbackDriver(&qemuCallbackDriver);
virNWFilterUnRegisterCallbackDriver(&qemuCallbackDriver);
virObjectUnref(qemu_driver->config);
virObjectUnref(qemu_driver->config);
virObjectUnref(qemu_driver->activePciHostdevs);
virObjectUnref(qemu_driver->hostdevMgr);
virObjectUnref(qemu_driver->inactivePciHostdevs);
virObjectUnref(qemu_driver->activeUsbHostdevs);
virObjectUnref(qemu_driver->activeScsiHostdevs);
virHashFree(qemu_driver->sharedDevices);
virHashFree(qemu_driver->sharedDevices);
virObjectUnref(qemu_driver->caps);
virObjectUnref(qemu_driver->caps);
virQEMUCapsCacheFree(qemu_driver->qemuCapsCache);
virQEMUCapsCacheFree(qemu_driver->qemuCapsCache);
...
@@ -11288,6 +11277,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
...
@@ -11288,6 +11277,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
char *xml = NULL;
char *xml = NULL;
bool legacy = qemuHostdevHostSupportsPassthroughLegacy();
bool legacy = qemuHostdevHostSupportsPassthroughLegacy();
bool vfio = qemuHostdevHostSupportsPassthroughVFIO();
bool vfio = qemuHostdevHostSupportsPassthroughVFIO();
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
virCheckFlags(0, -1);
virCheckFlags(0, -1);
...
@@ -11346,18 +11336,18 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
...
@@ -11346,18 +11336,18 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
goto cleanup;
goto cleanup;
}
}
virObjectLock(
drive
r->activePciHostdevs);
virObjectLock(
hostdev_mg
r->activePciHostdevs);
virObjectLock(
drive
r->inactivePciHostdevs);
virObjectLock(
hostdev_mg
r->inactivePciHostdevs);
if (virPCIDeviceDetach(pci,
drive
r->activePciHostdevs,
if (virPCIDeviceDetach(pci,
hostdev_mg
r->activePciHostdevs,
drive
r->inactivePciHostdevs) < 0) {
hostdev_mg
r->inactivePciHostdevs) < 0) {
goto out;
goto out;
}
}
ret = 0;
ret = 0;
out:
out:
virObjectUnlock(
drive
r->inactivePciHostdevs);
virObjectUnlock(
hostdev_mg
r->inactivePciHostdevs);
virObjectUnlock(
drive
r->activePciHostdevs);
virObjectUnlock(
hostdev_mg
r->activePciHostdevs);
cleanup:
cleanup:
virPCIDeviceFree(pci);
virPCIDeviceFree(pci);
virNodeDeviceDefFree(def);
virNodeDeviceDefFree(def);
...
@@ -11381,6 +11371,7 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
...
@@ -11381,6 +11371,7 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
int ret = -1;
int ret = -1;
virNodeDeviceDefPtr def = NULL;
virNodeDeviceDefPtr def = NULL;
char *xml = NULL;
char *xml = NULL;
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
xml = virNodeDeviceGetXMLDesc(dev, 0);
xml = virNodeDeviceGetXMLDesc(dev, 0);
if (!xml)
if (!xml)
...
@@ -11400,9 +11391,9 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
...
@@ -11400,9 +11391,9 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
if (!pci)
if (!pci)
goto cleanup;
goto cleanup;
virObjectLock(
drive
r->activePciHostdevs);
virObjectLock(
hostdev_mg
r->activePciHostdevs);
virObjectLock(
drive
r->inactivePciHostdevs);
virObjectLock(
hostdev_mg
r->inactivePciHostdevs);
other = virPCIDeviceListFind(
drive
r->activePciHostdevs, pci);
other = virPCIDeviceListFind(
hostdev_mg
r->activePciHostdevs, pci);
if (other) {
if (other) {
const char *other_drvname = NULL;
const char *other_drvname = NULL;
const char *other_domname = NULL;
const char *other_domname = NULL;
...
@@ -11423,14 +11414,14 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
...
@@ -11423,14 +11414,14 @@ qemuNodeDeviceReAttach(virNodeDevicePtr dev)
virPCIDeviceReattachInit(pci);
virPCIDeviceReattachInit(pci);
if (virPCIDeviceReattach(pci,
drive
r->activePciHostdevs,
if (virPCIDeviceReattach(pci,
hostdev_mg
r->activePciHostdevs,
drive
r->inactivePciHostdevs) < 0)
hostdev_mg
r->inactivePciHostdevs) < 0)
goto out;
goto out;
ret = 0;
ret = 0;
out:
out:
virObjectUnlock(
drive
r->inactivePciHostdevs);
virObjectUnlock(
hostdev_mg
r->inactivePciHostdevs);
virObjectUnlock(
drive
r->activePciHostdevs);
virObjectUnlock(
hostdev_mg
r->activePciHostdevs);
virPCIDeviceFree(pci);
virPCIDeviceFree(pci);
cleanup:
cleanup:
virNodeDeviceDefFree(def);
virNodeDeviceDefFree(def);
...
@@ -11447,6 +11438,7 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
...
@@ -11447,6 +11438,7 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
int ret = -1;
int ret = -1;
virNodeDeviceDefPtr def = NULL;
virNodeDeviceDefPtr def = NULL;
char *xml = NULL;
char *xml = NULL;
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
xml = virNodeDeviceGetXMLDesc(dev, 0);
xml = virNodeDeviceGetXMLDesc(dev, 0);
if (!xml)
if (!xml)
...
@@ -11466,17 +11458,16 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
...
@@ -11466,17 +11458,16 @@ qemuNodeDeviceReset(virNodeDevicePtr dev)
if (!pci)
if (!pci)
goto cleanup;
goto cleanup;
virObjectLock(driver->activePciHostdevs);
virObjectLock(hostdev_mgr->activePciHostdevs);
virObjectLock(driver->inactivePciHostdevs);
virObjectLock(hostdev_mgr->inactivePciHostdevs);
if (virPCIDeviceReset(pci, hostdev_mgr->activePciHostdevs,
if (virPCIDeviceReset(pci, driver->activePciHostdevs,
hostdev_mgr->inactivePciHostdevs) < 0)
driver->inactivePciHostdevs) < 0)
goto out;
goto out;
ret = 0;
ret = 0;
out:
out:
virObjectUnlock(
drive
r->inactivePciHostdevs);
virObjectUnlock(
hostdev_mg
r->inactivePciHostdevs);
virObjectUnlock(
drive
r->activePciHostdevs);
virObjectUnlock(
hostdev_mg
r->activePciHostdevs);
virPCIDeviceFree(pci);
virPCIDeviceFree(pci);
cleanup:
cleanup:
virNodeDeviceDefFree(def);
virNodeDeviceDefFree(def);
...
...
src/qemu/qemu_hostdev.c
浏览文件 @
e640e98f
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录