mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: put hostdev pci address in a struct
There will soon be other items related to pci hostdevs that need to be in the same part of the hostdevsubsys union as the pci address (which is currently a single member called "pci". This patch replaces the single member named pci with a struct named pci that contains a single member named "addr".
This commit is contained in:
parent
5b90ef0847
commit
9f80fc1bd5
@ -382,10 +382,10 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
|
|||||||
switch (hostdev->source.subsys.type) {
|
switch (hostdev->source.subsys.type) {
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||||
if (virAsprintf(&address, "%.4x:%.2x:%.2x.%.1x",
|
if (virAsprintf(&address, "%.4x:%.2x:%.2x.%.1x",
|
||||||
hostdev->source.subsys.u.pci.domain,
|
hostdev->source.subsys.u.pci.addr.domain,
|
||||||
hostdev->source.subsys.u.pci.bus,
|
hostdev->source.subsys.u.pci.addr.bus,
|
||||||
hostdev->source.subsys.u.pci.slot,
|
hostdev->source.subsys.u.pci.addr.slot,
|
||||||
hostdev->source.subsys.u.pci.function) < 0) {
|
hostdev->source.subsys.u.pci.addr.function) < 0) {
|
||||||
VIR_WARN("OOM while encoding audit message");
|
VIR_WARN("OOM while encoding audit message");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -3636,7 +3636,7 @@ virDomainHostdevSubsysPciDefParseXML(const xmlNodePtr node,
|
|||||||
if (cur->type == XML_ELEMENT_NODE) {
|
if (cur->type == XML_ELEMENT_NODE) {
|
||||||
if (xmlStrEqual(cur->name, BAD_CAST "address")) {
|
if (xmlStrEqual(cur->name, BAD_CAST "address")) {
|
||||||
virDevicePCIAddressPtr addr =
|
virDevicePCIAddressPtr addr =
|
||||||
&def->source.subsys.u.pci;
|
&def->source.subsys.u.pci.addr;
|
||||||
|
|
||||||
if (virDevicePCIAddressParseXML(cur, addr) < 0)
|
if (virDevicePCIAddressParseXML(cur, addr) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
@ -9115,10 +9115,10 @@ static int
|
|||||||
virDomainHostdevMatchSubsysPCI(virDomainHostdevDefPtr a,
|
virDomainHostdevMatchSubsysPCI(virDomainHostdevDefPtr a,
|
||||||
virDomainHostdevDefPtr b)
|
virDomainHostdevDefPtr b)
|
||||||
{
|
{
|
||||||
if (a->source.subsys.u.pci.domain == b->source.subsys.u.pci.domain &&
|
if (a->source.subsys.u.pci.addr.domain == b->source.subsys.u.pci.addr.domain &&
|
||||||
a->source.subsys.u.pci.bus == b->source.subsys.u.pci.bus &&
|
a->source.subsys.u.pci.addr.bus == b->source.subsys.u.pci.addr.bus &&
|
||||||
a->source.subsys.u.pci.slot == b->source.subsys.u.pci.slot &&
|
a->source.subsys.u.pci.addr.slot == b->source.subsys.u.pci.addr.slot &&
|
||||||
a->source.subsys.u.pci.function == b->source.subsys.u.pci.function)
|
a->source.subsys.u.pci.addr.function == b->source.subsys.u.pci.addr.function)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -13858,7 +13858,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
|
|||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||||
if (virDevicePCIAddressFormat(buf,
|
if (virDevicePCIAddressFormat(buf,
|
||||||
def->source.subsys.u.pci,
|
def->source.subsys.u.pci.addr,
|
||||||
includeTypeInAddr) != 0)
|
includeTypeInAddr) != 0)
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("PCI address Formatting failed"));
|
_("PCI address Formatting failed"));
|
||||||
|
@ -404,7 +404,9 @@ struct _virDomainHostdevSubsys {
|
|||||||
unsigned vendor;
|
unsigned vendor;
|
||||||
unsigned product;
|
unsigned product;
|
||||||
} usb;
|
} usb;
|
||||||
virDevicePCIAddress pci; /* host address */
|
struct {
|
||||||
|
virDevicePCIAddress addr; /* host address */
|
||||||
|
} pci;
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3891,7 +3891,7 @@ networkAllocateActualDevice(virDomainNetDefPtr iface)
|
|||||||
iface->data.network.actual->data.hostdev.def.mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
iface->data.network.actual->data.hostdev.def.mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
||||||
iface->data.network.actual->data.hostdev.def.managed = netdef->forward.managed ? 1 : 0;
|
iface->data.network.actual->data.hostdev.def.managed = netdef->forward.managed ? 1 : 0;
|
||||||
iface->data.network.actual->data.hostdev.def.source.subsys.type = dev->type;
|
iface->data.network.actual->data.hostdev.def.source.subsys.type = dev->type;
|
||||||
iface->data.network.actual->data.hostdev.def.source.subsys.u.pci = dev->device.pci;
|
iface->data.network.actual->data.hostdev.def.source.subsys.u.pci.addr = dev->device.pci;
|
||||||
|
|
||||||
/* merge virtualports from interface, network, and portgroup to
|
/* merge virtualports from interface, network, and portgroup to
|
||||||
* arrive at actual virtualport to use
|
* arrive at actual virtualport to use
|
||||||
@ -4222,7 +4222,7 @@ networkNotifyActualDevice(virDomainNetDefPtr iface)
|
|||||||
for (ii = 0; ii < netdef->forward.nifs; ii++) {
|
for (ii = 0; ii < netdef->forward.nifs; ii++) {
|
||||||
if (netdef->forward.ifs[ii].type
|
if (netdef->forward.ifs[ii].type
|
||||||
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
|
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
|
||||||
virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci,
|
virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci.addr,
|
||||||
&netdef->forward.ifs[ii].device.pci)) {
|
&netdef->forward.ifs[ii].device.pci)) {
|
||||||
dev = &netdef->forward.ifs[ii];
|
dev = &netdef->forward.ifs[ii];
|
||||||
break;
|
break;
|
||||||
@ -4234,10 +4234,10 @@ networkNotifyActualDevice(virDomainNetDefPtr iface)
|
|||||||
_("network '%s' doesn't have "
|
_("network '%s' doesn't have "
|
||||||
"PCI device %04x:%02x:%02x.%x in use by domain"),
|
"PCI device %04x:%02x:%02x.%x in use by domain"),
|
||||||
netdef->name,
|
netdef->name,
|
||||||
hostdev->source.subsys.u.pci.domain,
|
hostdev->source.subsys.u.pci.addr.domain,
|
||||||
hostdev->source.subsys.u.pci.bus,
|
hostdev->source.subsys.u.pci.addr.bus,
|
||||||
hostdev->source.subsys.u.pci.slot,
|
hostdev->source.subsys.u.pci.addr.slot,
|
||||||
hostdev->source.subsys.u.pci.function);
|
hostdev->source.subsys.u.pci.addr.function);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4380,8 +4380,8 @@ networkReleaseActualDevice(virDomainNetDefPtr iface)
|
|||||||
for (ii = 0; ii < netdef->forward.nifs; ii++) {
|
for (ii = 0; ii < netdef->forward.nifs; ii++) {
|
||||||
if (netdef->forward.ifs[ii].type
|
if (netdef->forward.ifs[ii].type
|
||||||
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
|
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
|
||||||
virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci,
|
virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci.addr,
|
||||||
&netdef->forward.ifs[ii].device.pci)) {
|
&netdef->forward.ifs[ii].device.pci)) {
|
||||||
dev = &netdef->forward.ifs[ii];
|
dev = &netdef->forward.ifs[ii];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4392,10 +4392,10 @@ networkReleaseActualDevice(virDomainNetDefPtr iface)
|
|||||||
_("network '%s' doesn't have "
|
_("network '%s' doesn't have "
|
||||||
"PCI device %04x:%02x:%02x.%x in use by domain"),
|
"PCI device %04x:%02x:%02x.%x in use by domain"),
|
||||||
netdef->name,
|
netdef->name,
|
||||||
hostdev->source.subsys.u.pci.domain,
|
hostdev->source.subsys.u.pci.addr.domain,
|
||||||
hostdev->source.subsys.u.pci.bus,
|
hostdev->source.subsys.u.pci.addr.bus,
|
||||||
hostdev->source.subsys.u.pci.slot,
|
hostdev->source.subsys.u.pci.addr.slot,
|
||||||
hostdev->source.subsys.u.pci.function);
|
hostdev->source.subsys.u.pci.addr.function);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4321,10 +4321,10 @@ qemuOpenPCIConfig(virDomainHostdevDefPtr dev)
|
|||||||
int configfd = -1;
|
int configfd = -1;
|
||||||
|
|
||||||
if (virAsprintf(&path, "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/config",
|
if (virAsprintf(&path, "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/config",
|
||||||
dev->source.subsys.u.pci.domain,
|
dev->source.subsys.u.pci.addr.domain,
|
||||||
dev->source.subsys.u.pci.bus,
|
dev->source.subsys.u.pci.addr.bus,
|
||||||
dev->source.subsys.u.pci.slot,
|
dev->source.subsys.u.pci.addr.slot,
|
||||||
dev->source.subsys.u.pci.function) < 0) {
|
dev->source.subsys.u.pci.addr.function) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -4347,9 +4347,9 @@ qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd,
|
|||||||
|
|
||||||
virBufferAddLit(&buf, "pci-assign");
|
virBufferAddLit(&buf, "pci-assign");
|
||||||
virBufferAsprintf(&buf, ",host=%.2x:%.2x.%.1x",
|
virBufferAsprintf(&buf, ",host=%.2x:%.2x.%.1x",
|
||||||
dev->source.subsys.u.pci.bus,
|
dev->source.subsys.u.pci.addr.bus,
|
||||||
dev->source.subsys.u.pci.slot,
|
dev->source.subsys.u.pci.addr.slot,
|
||||||
dev->source.subsys.u.pci.function);
|
dev->source.subsys.u.pci.addr.function);
|
||||||
virBufferAsprintf(&buf, ",id=%s", dev->info->alias);
|
virBufferAsprintf(&buf, ",id=%s", dev->info->alias);
|
||||||
if (configfd && *configfd)
|
if (configfd && *configfd)
|
||||||
virBufferAsprintf(&buf, ",configfd=%s", configfd);
|
virBufferAsprintf(&buf, ",configfd=%s", configfd);
|
||||||
@ -4379,9 +4379,9 @@ qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev)
|
|||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
||||||
if (virAsprintf(&ret, "host=%.2x:%.2x.%.1x",
|
if (virAsprintf(&ret, "host=%.2x:%.2x.%.1x",
|
||||||
dev->source.subsys.u.pci.bus,
|
dev->source.subsys.u.pci.addr.bus,
|
||||||
dev->source.subsys.u.pci.slot,
|
dev->source.subsys.u.pci.addr.slot,
|
||||||
dev->source.subsys.u.pci.function) < 0)
|
dev->source.subsys.u.pci.addr.function) < 0)
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -7062,10 +7062,10 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
_("PCI device %04x:%02x:%02x.%x "
|
_("PCI device %04x:%02x:%02x.%x "
|
||||||
"allocated from network %s is already "
|
"allocated from network %s is already "
|
||||||
"in use by domain %s"),
|
"in use by domain %s"),
|
||||||
hostdev->source.subsys.u.pci.domain,
|
hostdev->source.subsys.u.pci.addr.domain,
|
||||||
hostdev->source.subsys.u.pci.bus,
|
hostdev->source.subsys.u.pci.addr.bus,
|
||||||
hostdev->source.subsys.u.pci.slot,
|
hostdev->source.subsys.u.pci.addr.slot,
|
||||||
hostdev->source.subsys.u.pci.function,
|
hostdev->source.subsys.u.pci.addr.function,
|
||||||
net->data.network.name,
|
net->data.network.name,
|
||||||
def->name);
|
def->name);
|
||||||
goto error;
|
goto error;
|
||||||
@ -8953,9 +8953,9 @@ qemuParseCommandLinePCI(const char *val)
|
|||||||
def->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
def->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
||||||
def->managed = true;
|
def->managed = true;
|
||||||
def->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
|
def->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
|
||||||
def->source.subsys.u.pci.bus = bus;
|
def->source.subsys.u.pci.addr.bus = bus;
|
||||||
def->source.subsys.u.pci.slot = slot;
|
def->source.subsys.u.pci.addr.slot = slot;
|
||||||
def->source.subsys.u.pci.function = func;
|
def->source.subsys.u.pci.addr.function = func;
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* qemu_hostdev.c: QEMU hostdev management
|
* qemu_hostdev.c: QEMU hostdev management
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2007, 2009-2012 Red Hat, Inc.
|
* Copyright (C) 2006-2007, 2009-2013 Red Hat, Inc.
|
||||||
* Copyright (C) 2006 Daniel P. Berrange
|
* Copyright (C) 2006 Daniel P. Berrange
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -51,10 +51,10 @@ qemuGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
|
|||||||
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dev = virPCIDeviceNew(hostdev->source.subsys.u.pci.domain,
|
dev = virPCIDeviceNew(hostdev->source.subsys.u.pci.addr.domain,
|
||||||
hostdev->source.subsys.u.pci.bus,
|
hostdev->source.subsys.u.pci.addr.bus,
|
||||||
hostdev->source.subsys.u.pci.slot,
|
hostdev->source.subsys.u.pci.addr.slot,
|
||||||
hostdev->source.subsys.u.pci.function);
|
hostdev->source.subsys.u.pci.addr.function);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
virObjectUnref(list);
|
virObjectUnref(list);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -96,10 +96,10 @@ qemuGetActivePciHostDeviceList(virQEMUDriverPtr driver,
|
|||||||
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dev = virPCIDeviceNew(hostdev->source.subsys.u.pci.domain,
|
dev = virPCIDeviceNew(hostdev->source.subsys.u.pci.addr.domain,
|
||||||
hostdev->source.subsys.u.pci.bus,
|
hostdev->source.subsys.u.pci.addr.bus,
|
||||||
hostdev->source.subsys.u.pci.slot,
|
hostdev->source.subsys.u.pci.addr.slot,
|
||||||
hostdev->source.subsys.u.pci.function);
|
hostdev->source.subsys.u.pci.addr.function);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
virObjectUnref(list);
|
virObjectUnref(list);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -141,10 +141,10 @@ int qemuUpdateActivePciHostdevs(virQEMUDriverPtr driver,
|
|||||||
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dev = virPCIDeviceNew(hostdev->source.subsys.u.pci.domain,
|
dev = virPCIDeviceNew(hostdev->source.subsys.u.pci.addr.domain,
|
||||||
hostdev->source.subsys.u.pci.bus,
|
hostdev->source.subsys.u.pci.addr.bus,
|
||||||
hostdev->source.subsys.u.pci.slot,
|
hostdev->source.subsys.u.pci.addr.slot,
|
||||||
hostdev->source.subsys.u.pci.function);
|
hostdev->source.subsys.u.pci.addr.function);
|
||||||
|
|
||||||
if (!dev)
|
if (!dev)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -219,10 +219,10 @@ qemuDomainHostdevPciSysfsPath(virDomainHostdevDefPtr hostdev, char **sysfs_path)
|
|||||||
{
|
{
|
||||||
virPCIDeviceAddress config_address;
|
virPCIDeviceAddress config_address;
|
||||||
|
|
||||||
config_address.domain = hostdev->source.subsys.u.pci.domain;
|
config_address.domain = hostdev->source.subsys.u.pci.addr.domain;
|
||||||
config_address.bus = hostdev->source.subsys.u.pci.bus;
|
config_address.bus = hostdev->source.subsys.u.pci.addr.bus;
|
||||||
config_address.slot = hostdev->source.subsys.u.pci.slot;
|
config_address.slot = hostdev->source.subsys.u.pci.addr.slot;
|
||||||
config_address.function = hostdev->source.subsys.u.pci.function;
|
config_address.function = hostdev->source.subsys.u.pci.addr.function;
|
||||||
|
|
||||||
return virPCIDeviceAddressGetSysfsFile(&config_address, sysfs_path);
|
return virPCIDeviceAddressGetSysfsFile(&config_address, sysfs_path);
|
||||||
}
|
}
|
||||||
@ -544,10 +544,10 @@ int qemuPrepareHostdevPCIDevices(virQEMUDriverPtr driver,
|
|||||||
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dev = virPCIDeviceNew(hostdev->source.subsys.u.pci.domain,
|
dev = virPCIDeviceNew(hostdev->source.subsys.u.pci.addr.domain,
|
||||||
hostdev->source.subsys.u.pci.bus,
|
hostdev->source.subsys.u.pci.addr.bus,
|
||||||
hostdev->source.subsys.u.pci.slot,
|
hostdev->source.subsys.u.pci.addr.slot,
|
||||||
hostdev->source.subsys.u.pci.function);
|
hostdev->source.subsys.u.pci.addr.function);
|
||||||
|
|
||||||
/* original states "unbind_from_stub", "remove_slot",
|
/* original states "unbind_from_stub", "remove_slot",
|
||||||
* "reprobe" were already set by pciDettachDevice in
|
* "reprobe" were already set by pciDettachDevice in
|
||||||
|
@ -1035,7 +1035,7 @@ int qemuDomainAttachHostPciDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
ret = qemuMonitorAddPCIHostDevice(priv->mon,
|
ret = qemuMonitorAddPCIHostDevice(priv->mon,
|
||||||
&hostdev->source.subsys.u.pci,
|
&hostdev->source.subsys.u.pci.addr,
|
||||||
&guestAddr);
|
&guestAddr);
|
||||||
qemuDomainObjExitMonitor(driver, vm);
|
qemuDomainObjExitMonitor(driver, vm);
|
||||||
|
|
||||||
@ -2343,8 +2343,8 @@ qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver,
|
|||||||
if (qemuIsMultiFunctionDevice(vm->def, detach->info)) {
|
if (qemuIsMultiFunctionDevice(vm->def, detach->info)) {
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("cannot hot unplug multifunction PCI device: %.4x:%.2x:%.2x.%.1x"),
|
_("cannot hot unplug multifunction PCI device: %.4x:%.2x:%.2x.%.1x"),
|
||||||
subsys->u.pci.domain, subsys->u.pci.bus,
|
subsys->u.pci.addr.domain, subsys->u.pci.addr.bus,
|
||||||
subsys->u.pci.slot, subsys->u.pci.function);
|
subsys->u.pci.addr.slot, subsys->u.pci.addr.function);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2375,8 +2375,8 @@ qemuDomainDetachHostPciDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
virObjectLock(driver->activePciHostdevs);
|
virObjectLock(driver->activePciHostdevs);
|
||||||
virObjectLock(driver->inactivePciHostdevs);
|
virObjectLock(driver->inactivePciHostdevs);
|
||||||
pci = virPCIDeviceNew(subsys->u.pci.domain, subsys->u.pci.bus,
|
pci = virPCIDeviceNew(subsys->u.pci.addr.domain, subsys->u.pci.addr.bus,
|
||||||
subsys->u.pci.slot, subsys->u.pci.function);
|
subsys->u.pci.addr.slot, subsys->u.pci.addr.function);
|
||||||
if (pci) {
|
if (pci) {
|
||||||
activePci = virPCIDeviceListSteal(driver->activePciHostdevs, pci);
|
activePci = virPCIDeviceListSteal(driver->activePciHostdevs, pci);
|
||||||
if (activePci &&
|
if (activePci &&
|
||||||
@ -2518,8 +2518,8 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
|
|||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("host pci device %.4x:%.2x:%.2x.%.1x not found"),
|
_("host pci device %.4x:%.2x:%.2x.%.1x not found"),
|
||||||
subsys->u.pci.domain, subsys->u.pci.bus,
|
subsys->u.pci.addr.domain, subsys->u.pci.addr.bus,
|
||||||
subsys->u.pci.slot, subsys->u.pci.function);
|
subsys->u.pci.addr.slot, subsys->u.pci.addr.function);
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
|
||||||
if (subsys->u.usb.bus && subsys->u.usb.device) {
|
if (subsys->u.usb.bus && subsys->u.usb.device) {
|
||||||
|
@ -823,10 +823,10 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
|
|||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
||||||
virPCIDevicePtr pci =
|
virPCIDevicePtr pci =
|
||||||
virPCIDeviceNew(dev->source.subsys.u.pci.domain,
|
virPCIDeviceNew(dev->source.subsys.u.pci.addr.domain,
|
||||||
dev->source.subsys.u.pci.bus,
|
dev->source.subsys.u.pci.addr.bus,
|
||||||
dev->source.subsys.u.pci.slot,
|
dev->source.subsys.u.pci.addr.slot,
|
||||||
dev->source.subsys.u.pci.function);
|
dev->source.subsys.u.pci.addr.function);
|
||||||
|
|
||||||
if (!pci)
|
if (!pci)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -508,10 +508,10 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
|
|||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
||||||
virPCIDevicePtr pci =
|
virPCIDevicePtr pci =
|
||||||
virPCIDeviceNew(dev->source.subsys.u.pci.domain,
|
virPCIDeviceNew(dev->source.subsys.u.pci.addr.domain,
|
||||||
dev->source.subsys.u.pci.bus,
|
dev->source.subsys.u.pci.addr.bus,
|
||||||
dev->source.subsys.u.pci.slot,
|
dev->source.subsys.u.pci.addr.slot,
|
||||||
dev->source.subsys.u.pci.function);
|
dev->source.subsys.u.pci.addr.function);
|
||||||
|
|
||||||
if (!pci)
|
if (!pci)
|
||||||
goto done;
|
goto done;
|
||||||
@ -588,10 +588,10 @@ virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr,
|
|||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
||||||
virPCIDevicePtr pci =
|
virPCIDevicePtr pci =
|
||||||
virPCIDeviceNew(dev->source.subsys.u.pci.domain,
|
virPCIDeviceNew(dev->source.subsys.u.pci.addr.domain,
|
||||||
dev->source.subsys.u.pci.bus,
|
dev->source.subsys.u.pci.addr.bus,
|
||||||
dev->source.subsys.u.pci.slot,
|
dev->source.subsys.u.pci.addr.slot,
|
||||||
dev->source.subsys.u.pci.function);
|
dev->source.subsys.u.pci.addr.function);
|
||||||
|
|
||||||
if (!pci)
|
if (!pci)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -1334,10 +1334,10 @@ virSecuritySELinuxSetSecurityHostdevSubsysLabel(virDomainDefPtr def,
|
|||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
||||||
virPCIDevicePtr pci =
|
virPCIDevicePtr pci =
|
||||||
virPCIDeviceNew(dev->source.subsys.u.pci.domain,
|
virPCIDeviceNew(dev->source.subsys.u.pci.addr.domain,
|
||||||
dev->source.subsys.u.pci.bus,
|
dev->source.subsys.u.pci.addr.bus,
|
||||||
dev->source.subsys.u.pci.slot,
|
dev->source.subsys.u.pci.addr.slot,
|
||||||
dev->source.subsys.u.pci.function);
|
dev->source.subsys.u.pci.addr.function);
|
||||||
|
|
||||||
if (!pci)
|
if (!pci)
|
||||||
goto done;
|
goto done;
|
||||||
@ -1496,10 +1496,10 @@ virSecuritySELinuxRestoreSecurityHostdevSubsysLabel(virSecurityManagerPtr mgr,
|
|||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
||||||
virPCIDevicePtr pci =
|
virPCIDevicePtr pci =
|
||||||
virPCIDeviceNew(dev->source.subsys.u.pci.domain,
|
virPCIDeviceNew(dev->source.subsys.u.pci.addr.domain,
|
||||||
dev->source.subsys.u.pci.bus,
|
dev->source.subsys.u.pci.addr.bus,
|
||||||
dev->source.subsys.u.pci.slot,
|
dev->source.subsys.u.pci.addr.slot,
|
||||||
dev->source.subsys.u.pci.function);
|
dev->source.subsys.u.pci.addr.function);
|
||||||
|
|
||||||
if (!pci)
|
if (!pci)
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* virt-aa-helper: wrapper program used by AppArmor security driver.
|
* virt-aa-helper: wrapper program used by AppArmor security driver.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2012 Red Hat, Inc.
|
* Copyright (C) 2010-2013 Red Hat, Inc.
|
||||||
* Copyright (C) 2009-2011 Canonical Ltd.
|
* Copyright (C) 2009-2011 Canonical Ltd.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -1029,10 +1029,10 @@ get_files(vahControl * ctl)
|
|||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
||||||
virPCIDevicePtr pci = virPCIDeviceNew(
|
virPCIDevicePtr pci = virPCIDeviceNew(
|
||||||
dev->source.subsys.u.pci.domain,
|
dev->source.subsys.u.pci.addr.domain,
|
||||||
dev->source.subsys.u.pci.bus,
|
dev->source.subsys.u.pci.addr.bus,
|
||||||
dev->source.subsys.u.pci.slot,
|
dev->source.subsys.u.pci.addr.slot,
|
||||||
dev->source.subsys.u.pci.function);
|
dev->source.subsys.u.pci.addr.function);
|
||||||
|
|
||||||
if (pci == NULL)
|
if (pci == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2565,7 +2565,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain,
|
|||||||
|
|
||||||
virDevicePCIAddress PCIAddr;
|
virDevicePCIAddress PCIAddr;
|
||||||
|
|
||||||
PCIAddr = dev->data.hostdev->source.subsys.u.pci;
|
PCIAddr = dev->data.hostdev->source.subsys.u.pci.addr;
|
||||||
if (virAsprintf(&target, "PCI device: %.4x:%.2x:%.2x",
|
if (virAsprintf(&target, "PCI device: %.4x:%.2x:%.2x",
|
||||||
PCIAddr.domain, PCIAddr.bus, PCIAddr.slot) < 0) {
|
PCIAddr.domain, PCIAddr.bus, PCIAddr.slot) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
@ -3753,10 +3753,10 @@ virDomainXMLDevID(virDomainPtr domain,
|
|||||||
virDomainHostdevDefPtr def = dev->data.hostdev;
|
virDomainHostdevDefPtr def = dev->data.hostdev;
|
||||||
|
|
||||||
if (virAsprintf(&bdf, "%04x:%02x:%02x.%0x",
|
if (virAsprintf(&bdf, "%04x:%02x:%02x.%0x",
|
||||||
def->source.subsys.u.pci.domain,
|
def->source.subsys.u.pci.addr.domain,
|
||||||
def->source.subsys.u.pci.bus,
|
def->source.subsys.u.pci.addr.bus,
|
||||||
def->source.subsys.u.pci.slot,
|
def->source.subsys.u.pci.addr.slot,
|
||||||
def->source.subsys.u.pci.function) < 0) {
|
def->source.subsys.u.pci.addr.function) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1089,10 +1089,10 @@ xenParseSxprPCI(virDomainDefPtr def,
|
|||||||
dev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
dev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
|
||||||
dev->managed = false;
|
dev->managed = false;
|
||||||
dev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
|
dev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
|
||||||
dev->source.subsys.u.pci.domain = domainID;
|
dev->source.subsys.u.pci.addr.domain = domainID;
|
||||||
dev->source.subsys.u.pci.bus = busID;
|
dev->source.subsys.u.pci.addr.bus = busID;
|
||||||
dev->source.subsys.u.pci.slot = slotID;
|
dev->source.subsys.u.pci.addr.slot = slotID;
|
||||||
dev->source.subsys.u.pci.function = funcID;
|
dev->source.subsys.u.pci.addr.function = funcID;
|
||||||
|
|
||||||
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
|
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
|
||||||
virDomainHostdevDefFree(dev);
|
virDomainHostdevDefFree(dev);
|
||||||
@ -2044,10 +2044,10 @@ xenFormatSxprPCI(virDomainHostdevDefPtr def,
|
|||||||
virBufferPtr buf)
|
virBufferPtr buf)
|
||||||
{
|
{
|
||||||
virBufferAsprintf(buf, "(dev (domain 0x%04x)(bus 0x%02x)(slot 0x%02x)(func 0x%x))",
|
virBufferAsprintf(buf, "(dev (domain 0x%04x)(bus 0x%02x)(slot 0x%02x)(func 0x%x))",
|
||||||
def->source.subsys.u.pci.domain,
|
def->source.subsys.u.pci.addr.domain,
|
||||||
def->source.subsys.u.pci.bus,
|
def->source.subsys.u.pci.addr.bus,
|
||||||
def->source.subsys.u.pci.slot,
|
def->source.subsys.u.pci.addr.slot,
|
||||||
def->source.subsys.u.pci.function);
|
def->source.subsys.u.pci.addr.function);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -877,10 +877,10 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
|
|||||||
|
|
||||||
hostdev->managed = false;
|
hostdev->managed = false;
|
||||||
hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
|
hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
|
||||||
hostdev->source.subsys.u.pci.domain = domainID;
|
hostdev->source.subsys.u.pci.addr.domain = domainID;
|
||||||
hostdev->source.subsys.u.pci.bus = busID;
|
hostdev->source.subsys.u.pci.addr.bus = busID;
|
||||||
hostdev->source.subsys.u.pci.slot = slotID;
|
hostdev->source.subsys.u.pci.addr.slot = slotID;
|
||||||
hostdev->source.subsys.u.pci.function = funcID;
|
hostdev->source.subsys.u.pci.addr.function = funcID;
|
||||||
|
|
||||||
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
|
if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
|
||||||
virDomainHostdevDefFree(hostdev);
|
virDomainHostdevDefFree(hostdev);
|
||||||
@ -1470,10 +1470,10 @@ xenFormatXMPCI(virConfPtr conf,
|
|||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (virAsprintf(&buf, "%04x:%02x:%02x.%x",
|
if (virAsprintf(&buf, "%04x:%02x:%02x.%x",
|
||||||
def->hostdevs[i]->source.subsys.u.pci.domain,
|
def->hostdevs[i]->source.subsys.u.pci.addr.domain,
|
||||||
def->hostdevs[i]->source.subsys.u.pci.bus,
|
def->hostdevs[i]->source.subsys.u.pci.addr.bus,
|
||||||
def->hostdevs[i]->source.subsys.u.pci.slot,
|
def->hostdevs[i]->source.subsys.u.pci.addr.slot,
|
||||||
def->hostdevs[i]->source.subsys.u.pci.function) < 0) {
|
def->hostdevs[i]->source.subsys.u.pci.addr.function) < 0) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user