mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
Change virDevicePCIAddress to virPCIDeviceAddress
We had both and the only difference was that the latter also included information about multifunction setting. The problem with that was that we couldn't use functions made for only one of the structs (e.g. parsing). To consolidate those two structs, use the one in virpci.h, include that in domain_conf.h and add the multifunction member in it. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
573cfd188c
commit
c36b1f7b6a
@ -40,7 +40,7 @@ bhyveCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virDomainPCIAddressSetPtr addrs = opaque;
|
virDomainPCIAddressSetPtr addrs = opaque;
|
||||||
virDevicePCIAddressPtr addr = &info->addr.pci;
|
virPCIDeviceAddressPtr addr = &info->addr.pci;
|
||||||
|
|
||||||
if (addr->domain == 0 && addr->bus == 0) {
|
if (addr->domain == 0 && addr->bus == 0) {
|
||||||
if (addr->slot == 0) {
|
if (addr->slot == 0) {
|
||||||
@ -88,7 +88,7 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def,
|
|||||||
virDomainPCIAddressSetPtr addrs)
|
virDomainPCIAddressSetPtr addrs)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
virDevicePCIAddress lpc_addr;
|
virPCIDeviceAddress lpc_addr;
|
||||||
|
|
||||||
/* explicitly reserve slot 1 for LPC-ISA bridge */
|
/* explicitly reserve slot 1 for LPC-ISA bridge */
|
||||||
memset(&lpc_addr, 0, sizeof(lpc_addr));
|
memset(&lpc_addr, 0, sizeof(lpc_addr));
|
||||||
|
@ -55,7 +55,7 @@ VIR_ENUM_IMPL(virNetDevFeature,
|
|||||||
"rdma",
|
"rdma",
|
||||||
"txudptnl")
|
"txudptnl")
|
||||||
|
|
||||||
int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr,
|
int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr,
|
||||||
bool report)
|
bool report)
|
||||||
{
|
{
|
||||||
if (addr->domain > 0xFFFF) {
|
if (addr->domain > 0xFFFF) {
|
||||||
@ -102,8 +102,8 @@ int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virDevicePCIAddressParseXML(xmlNodePtr node,
|
virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||||
virDevicePCIAddressPtr addr)
|
virPCIDeviceAddressPtr addr)
|
||||||
{
|
{
|
||||||
char *domain, *slot, *bus, *function, *multi;
|
char *domain, *slot, *bus, *function, *multi;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -152,7 +152,7 @@ virDevicePCIAddressParseXML(xmlNodePtr node,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!virDevicePCIAddressIsValid(addr, true))
|
if (!virPCIDeviceAddressIsValid(addr, true))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -167,8 +167,8 @@ virDevicePCIAddressParseXML(xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
virDevicePCIAddressFormat(virBufferPtr buf,
|
virPCIDeviceAddressFormat(virBufferPtr buf,
|
||||||
virDevicePCIAddress addr,
|
virPCIDeviceAddress addr,
|
||||||
bool includeTypeInAddr)
|
bool includeTypeInAddr)
|
||||||
{
|
{
|
||||||
virBufferAsprintf(buf, "<address %sdomain='0x%.4x' bus='0x%.2x' "
|
virBufferAsprintf(buf, "<address %sdomain='0x%.4x' bus='0x%.2x' "
|
||||||
@ -182,8 +182,8 @@ virDevicePCIAddressFormat(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
virDevicePCIAddressEqual(virDevicePCIAddress *addr1,
|
virPCIDeviceAddressEqual(virPCIDeviceAddress *addr1,
|
||||||
virDevicePCIAddress *addr2)
|
virPCIDeviceAddress *addr2)
|
||||||
{
|
{
|
||||||
if (addr1->domain == addr2->domain &&
|
if (addr1->domain == addr2->domain &&
|
||||||
addr1->bus == addr2->bus &&
|
addr1->bus == addr2->bus &&
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
# include "virutil.h"
|
# include "virutil.h"
|
||||||
# include "virthread.h"
|
# include "virthread.h"
|
||||||
# include "virbuffer.h"
|
# include "virbuffer.h"
|
||||||
|
# include "virpci.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_INTERFACE_STATE_UNKNOWN = 1,
|
VIR_INTERFACE_STATE_UNKNOWN = 1,
|
||||||
@ -45,16 +46,6 @@ typedef enum {
|
|||||||
|
|
||||||
VIR_ENUM_DECL(virInterfaceState)
|
VIR_ENUM_DECL(virInterfaceState)
|
||||||
|
|
||||||
typedef struct _virDevicePCIAddress virDevicePCIAddress;
|
|
||||||
typedef virDevicePCIAddress *virDevicePCIAddressPtr;
|
|
||||||
struct _virDevicePCIAddress {
|
|
||||||
unsigned int domain;
|
|
||||||
unsigned int bus;
|
|
||||||
unsigned int slot;
|
|
||||||
unsigned int function;
|
|
||||||
int multi; /* virTristateSwitch */
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _virInterfaceLink virInterfaceLink;
|
typedef struct _virInterfaceLink virInterfaceLink;
|
||||||
typedef virInterfaceLink *virInterfaceLinkPtr;
|
typedef virInterfaceLink *virInterfaceLinkPtr;
|
||||||
struct _virInterfaceLink {
|
struct _virInterfaceLink {
|
||||||
@ -81,18 +72,18 @@ typedef enum {
|
|||||||
|
|
||||||
VIR_ENUM_DECL(virNetDevFeature)
|
VIR_ENUM_DECL(virNetDevFeature)
|
||||||
|
|
||||||
int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr,
|
int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr,
|
||||||
bool report);
|
bool report);
|
||||||
|
|
||||||
int virDevicePCIAddressParseXML(xmlNodePtr node,
|
int virPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||||
virDevicePCIAddressPtr addr);
|
virPCIDeviceAddressPtr addr);
|
||||||
|
|
||||||
int virDevicePCIAddressFormat(virBufferPtr buf,
|
int virPCIDeviceAddressFormat(virBufferPtr buf,
|
||||||
virDevicePCIAddress addr,
|
virPCIDeviceAddress addr,
|
||||||
bool includeTypeInAddr);
|
bool includeTypeInAddr);
|
||||||
|
|
||||||
bool virDevicePCIAddressEqual(virDevicePCIAddress *addr1,
|
bool virPCIDeviceAddressEqual(virPCIDeviceAddress *addr1,
|
||||||
virDevicePCIAddress *addr2);
|
virPCIDeviceAddress *addr2);
|
||||||
|
|
||||||
int virInterfaceLinkParseXML(xmlNodePtr node,
|
int virInterfaceLinkParseXML(xmlNodePtr node,
|
||||||
virInterfaceLinkPtr lnk);
|
virInterfaceLinkPtr lnk);
|
||||||
|
@ -88,7 +88,7 @@ virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
virDomainPCIAddressFlagsCompatible(virDevicePCIAddressPtr addr,
|
virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
|
||||||
const char *addrStr,
|
const char *addrStr,
|
||||||
virDomainPCIConnectFlags busFlags,
|
virDomainPCIConnectFlags busFlags,
|
||||||
virDomainPCIConnectFlags devFlags,
|
virDomainPCIConnectFlags devFlags,
|
||||||
@ -163,7 +163,7 @@ virDomainPCIAddressFlagsCompatible(virDevicePCIAddressPtr addr,
|
|||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs,
|
virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr,
|
virPCIDeviceAddressPtr addr,
|
||||||
const char *addrStr,
|
const char *addrStr,
|
||||||
virDomainPCIConnectFlags flags,
|
virDomainPCIConnectFlags flags,
|
||||||
bool fromConfig)
|
bool fromConfig)
|
||||||
@ -315,7 +315,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
|
virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr,
|
virPCIDeviceAddressPtr addr,
|
||||||
virDomainPCIConnectFlags flags)
|
virDomainPCIConnectFlags flags)
|
||||||
{
|
{
|
||||||
int add;
|
int add;
|
||||||
@ -351,7 +351,7 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
|
|||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
virDomainPCIAddressAsString(virDevicePCIAddressPtr addr)
|
virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
@ -369,7 +369,7 @@ virDomainPCIAddressAsString(virDevicePCIAddressPtr addr)
|
|||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
|
virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr)
|
virPCIDeviceAddressPtr addr)
|
||||||
{
|
{
|
||||||
return !!addrs->buses[addr->bus].slots[addr->slot];
|
return !!addrs->buses[addr->bus].slots[addr->slot];
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
|
virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr,
|
virPCIDeviceAddressPtr addr,
|
||||||
virDomainPCIConnectFlags flags,
|
virDomainPCIConnectFlags flags,
|
||||||
bool reserveEntireSlot,
|
bool reserveEntireSlot,
|
||||||
bool fromConfig)
|
bool fromConfig)
|
||||||
@ -448,7 +448,7 @@ virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
|
|||||||
|
|
||||||
int
|
int
|
||||||
virDomainPCIAddressReserveSlot(virDomainPCIAddressSetPtr addrs,
|
virDomainPCIAddressReserveSlot(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr,
|
virPCIDeviceAddressPtr addr,
|
||||||
virDomainPCIConnectFlags flags)
|
virDomainPCIConnectFlags flags)
|
||||||
{
|
{
|
||||||
return virDomainPCIAddressReserveAddr(addrs, addr, flags, true, false);
|
return virDomainPCIAddressReserveAddr(addrs, addr, flags, true, false);
|
||||||
@ -499,7 +499,7 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
|
|||||||
|
|
||||||
int
|
int
|
||||||
virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr)
|
virPCIDeviceAddressPtr addr)
|
||||||
{
|
{
|
||||||
addrs->buses[addr->bus].slots[addr->slot] &= ~(1 << addr->function);
|
addrs->buses[addr->bus].slots[addr->slot] &= ~(1 << addr->function);
|
||||||
return 0;
|
return 0;
|
||||||
@ -507,7 +507,7 @@ virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
|||||||
|
|
||||||
int
|
int
|
||||||
virDomainPCIAddressReleaseSlot(virDomainPCIAddressSetPtr addrs,
|
virDomainPCIAddressReleaseSlot(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr)
|
virPCIDeviceAddressPtr addr)
|
||||||
{
|
{
|
||||||
/* permit any kind of connection type in validation, since we
|
/* permit any kind of connection type in validation, since we
|
||||||
* already had it, and are giving it back.
|
* already had it, and are giving it back.
|
||||||
@ -563,13 +563,13 @@ virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs)
|
|||||||
|
|
||||||
int
|
int
|
||||||
virDomainPCIAddressGetNextSlot(virDomainPCIAddressSetPtr addrs,
|
virDomainPCIAddressGetNextSlot(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr next_addr,
|
virPCIDeviceAddressPtr next_addr,
|
||||||
virDomainPCIConnectFlags flags)
|
virDomainPCIConnectFlags flags)
|
||||||
{
|
{
|
||||||
/* default to starting the search for a free slot from
|
/* default to starting the search for a free slot from
|
||||||
* the first slot of domain 0 bus 0...
|
* the first slot of domain 0 bus 0...
|
||||||
*/
|
*/
|
||||||
virDevicePCIAddress a = { 0, 0, 0, 0, false };
|
virPCIDeviceAddress a = { 0, 0, 0, 0, false };
|
||||||
char *addrStr = NULL;
|
char *addrStr = NULL;
|
||||||
|
|
||||||
if (addrs->nbuses == 0) {
|
if (addrs->nbuses == 0) {
|
||||||
@ -666,7 +666,7 @@ virDomainPCIAddressReserveNextSlot(virDomainPCIAddressSetPtr addrs,
|
|||||||
virDomainDeviceInfoPtr dev,
|
virDomainDeviceInfoPtr dev,
|
||||||
virDomainPCIConnectFlags flags)
|
virDomainPCIConnectFlags flags)
|
||||||
{
|
{
|
||||||
virDevicePCIAddress addr;
|
virPCIDeviceAddress addr;
|
||||||
if (virDomainPCIAddressGetNextSlot(addrs, &addr, flags) < 0)
|
if (virDomainPCIAddressGetNextSlot(addrs, &addr, flags) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ typedef virDomainPCIAddressBus *virDomainPCIAddressBusPtr;
|
|||||||
struct _virDomainPCIAddressSet {
|
struct _virDomainPCIAddressSet {
|
||||||
virDomainPCIAddressBus *buses;
|
virDomainPCIAddressBus *buses;
|
||||||
size_t nbuses;
|
size_t nbuses;
|
||||||
virDevicePCIAddress lastaddr;
|
virPCIDeviceAddress lastaddr;
|
||||||
virDomainPCIConnectFlags lastFlags;
|
virDomainPCIConnectFlags lastFlags;
|
||||||
bool dryRun; /* on a dry run, new buses are auto-added
|
bool dryRun; /* on a dry run, new buses are auto-added
|
||||||
and addresses aren't saved in device infos */
|
and addresses aren't saved in device infos */
|
||||||
@ -87,14 +87,14 @@ struct _virDomainPCIAddressSet {
|
|||||||
typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet;
|
typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet;
|
||||||
typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
|
typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
|
||||||
|
|
||||||
char *virDomainPCIAddressAsString(virDevicePCIAddressPtr addr)
|
char *virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses);
|
virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses);
|
||||||
|
|
||||||
void virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs);
|
void virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs);
|
||||||
|
|
||||||
bool virDomainPCIAddressFlagsCompatible(virDevicePCIAddressPtr addr,
|
bool virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
|
||||||
const char *addrStr,
|
const char *addrStr,
|
||||||
virDomainPCIConnectFlags busFlags,
|
virDomainPCIConnectFlags busFlags,
|
||||||
virDomainPCIConnectFlags devFlags,
|
virDomainPCIConnectFlags devFlags,
|
||||||
@ -103,7 +103,7 @@ bool virDomainPCIAddressFlagsCompatible(virDevicePCIAddressPtr addr,
|
|||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
bool virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs,
|
bool virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr,
|
virPCIDeviceAddressPtr addr,
|
||||||
const char *addrStr,
|
const char *addrStr,
|
||||||
virDomainPCIConnectFlags flags,
|
virDomainPCIConnectFlags flags,
|
||||||
bool fromConfig)
|
bool fromConfig)
|
||||||
@ -115,23 +115,23 @@ int virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus,
|
|||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
|
bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr)
|
virPCIDeviceAddressPtr addr)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
|
int virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr,
|
virPCIDeviceAddressPtr addr,
|
||||||
virDomainPCIConnectFlags flags)
|
virDomainPCIConnectFlags flags)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
|
int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr,
|
virPCIDeviceAddressPtr addr,
|
||||||
virDomainPCIConnectFlags flags,
|
virDomainPCIConnectFlags flags,
|
||||||
bool reserveEntireSlot,
|
bool reserveEntireSlot,
|
||||||
bool fromConfig)
|
bool fromConfig)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int virDomainPCIAddressReserveSlot(virDomainPCIAddressSetPtr addrs,
|
int virDomainPCIAddressReserveSlot(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr,
|
virPCIDeviceAddressPtr addr,
|
||||||
virDomainPCIConnectFlags flags)
|
virDomainPCIConnectFlags flags)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
@ -140,15 +140,15 @@ int virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
|
|||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
int virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr)
|
virPCIDeviceAddressPtr addr)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int virDomainPCIAddressReleaseSlot(virDomainPCIAddressSetPtr addrs,
|
int virDomainPCIAddressReleaseSlot(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr addr)
|
virPCIDeviceAddressPtr addr)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int virDomainPCIAddressGetNextSlot(virDomainPCIAddressSetPtr addrs,
|
int virDomainPCIAddressGetNextSlot(virDomainPCIAddressSetPtr addrs,
|
||||||
virDevicePCIAddressPtr next_addr,
|
virPCIDeviceAddressPtr next_addr,
|
||||||
virDomainPCIConnectFlags flags)
|
virDomainPCIConnectFlags flags)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
|
@ -3113,7 +3113,7 @@ int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
|
|||||||
|
|
||||||
switch (info->type) {
|
switch (info->type) {
|
||||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
|
||||||
return virDevicePCIAddressIsValid(&info->addr.pci, false);
|
return virPCIDeviceAddressIsValid(&info->addr.pci, false);
|
||||||
|
|
||||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
|
||||||
return 1;
|
return 1;
|
||||||
@ -5043,7 +5043,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
|
|||||||
|
|
||||||
switch ((virDomainDeviceAddressType) info->type) {
|
switch ((virDomainDeviceAddressType) info->type) {
|
||||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
|
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
|
||||||
if (virDevicePCIAddressParseXML(address, &info->addr.pci) < 0)
|
if (virPCIDeviceAddressParseXML(address, &info->addr.pci) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5113,7 +5113,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainParseLegacyDeviceAddress(char *devaddr,
|
virDomainParseLegacyDeviceAddress(char *devaddr,
|
||||||
virDevicePCIAddressPtr pci)
|
virPCIDeviceAddressPtr pci)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
@ -5317,10 +5317,10 @@ virDomainHostdevSubsysPCIDefParseXML(xmlNodePtr node,
|
|||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
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 =
|
virPCIDeviceAddressPtr addr =
|
||||||
&def->source.subsys.u.pci.addr;
|
&def->source.subsys.u.pci.addr;
|
||||||
|
|
||||||
if (virDevicePCIAddressParseXML(cur, addr) < 0)
|
if (virPCIDeviceAddressParseXML(cur, addr) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
} else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
|
} else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
|
||||||
xmlStrEqual(cur->name, BAD_CAST "state")) {
|
xmlStrEqual(cur->name, BAD_CAST "state")) {
|
||||||
@ -13263,7 +13263,7 @@ virDomainDiskControllerMatch(int controller_type, int disk_bus)
|
|||||||
|
|
||||||
int
|
int
|
||||||
virDomainDiskIndexByAddress(virDomainDefPtr def,
|
virDomainDiskIndexByAddress(virDomainDefPtr def,
|
||||||
virDevicePCIAddressPtr pci_address,
|
virPCIDeviceAddressPtr pci_address,
|
||||||
unsigned int bus, unsigned int target,
|
unsigned int bus, unsigned int target,
|
||||||
unsigned int unit)
|
unsigned int unit)
|
||||||
{
|
{
|
||||||
@ -13278,7 +13278,7 @@ virDomainDiskIndexByAddress(virDomainDefPtr def,
|
|||||||
for (i = 0; i < def->ndisks; i++) {
|
for (i = 0; i < def->ndisks; i++) {
|
||||||
vdisk = def->disks[i];
|
vdisk = def->disks[i];
|
||||||
if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
||||||
virDevicePCIAddressEqual(&vdisk->info.addr.pci, pci_address))
|
virPCIDeviceAddressEqual(&vdisk->info.addr.pci, pci_address))
|
||||||
return i;
|
return i;
|
||||||
if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
|
if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
|
||||||
virDomainDeviceDriveAddressPtr drive = &vdisk->info.addr.drive;
|
virDomainDeviceDriveAddressPtr drive = &vdisk->info.addr.drive;
|
||||||
@ -13295,7 +13295,7 @@ virDomainDiskIndexByAddress(virDomainDefPtr def,
|
|||||||
|
|
||||||
virDomainDiskDefPtr
|
virDomainDiskDefPtr
|
||||||
virDomainDiskByAddress(virDomainDefPtr def,
|
virDomainDiskByAddress(virDomainDefPtr def,
|
||||||
virDevicePCIAddressPtr pci_address,
|
virPCIDeviceAddressPtr pci_address,
|
||||||
unsigned int bus,
|
unsigned int bus,
|
||||||
unsigned int target,
|
unsigned int target,
|
||||||
unsigned int unit)
|
unsigned int unit)
|
||||||
@ -13465,7 +13465,7 @@ virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (PCIAddrSpecified) {
|
if (PCIAddrSpecified) {
|
||||||
if (virDevicePCIAddressEqual(&def->nets[i]->info.addr.pci,
|
if (virPCIDeviceAddressEqual(&def->nets[i]->info.addr.pci,
|
||||||
&net->info.addr.pci)) {
|
&net->info.addr.pci)) {
|
||||||
/* exit early if the pci address was specified and
|
/* exit early if the pci address was specified and
|
||||||
* it matches, as this guarantees no duplicates.
|
* it matches, as this guarantees no duplicates.
|
||||||
@ -13509,7 +13509,7 @@ virDomainHasNet(virDomainDefPtr def, virDomainNetDefPtr net)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (PCIAddrSpecified) {
|
if (PCIAddrSpecified) {
|
||||||
if (virDevicePCIAddressEqual(&def->nets[i]->info.addr.pci,
|
if (virPCIDeviceAddressEqual(&def->nets[i]->info.addr.pci,
|
||||||
&net->info.addr.pci))
|
&net->info.addr.pci))
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -13686,7 +13686,7 @@ virDomainControllerFindByType(virDomainDefPtr def,
|
|||||||
|
|
||||||
int
|
int
|
||||||
virDomainControllerFindByPCIAddress(virDomainDefPtr def,
|
virDomainControllerFindByPCIAddress(virDomainDefPtr def,
|
||||||
virDevicePCIAddressPtr addr)
|
virPCIDeviceAddressPtr addr)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -13694,7 +13694,7 @@ virDomainControllerFindByPCIAddress(virDomainDefPtr def,
|
|||||||
virDomainDeviceInfoPtr info = &def->controllers[i]->info;
|
virDomainDeviceInfoPtr info = &def->controllers[i]->info;
|
||||||
|
|
||||||
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
||||||
virDevicePCIAddressEqual(&info->addr.pci, addr))
|
virPCIDeviceAddressEqual(&info->addr.pci, addr))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19747,7 +19747,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||||
if (virDevicePCIAddressFormat(buf, pcisrc->addr,
|
if (virPCIDeviceAddressFormat(buf, pcisrc->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"));
|
||||||
|
@ -348,7 +348,7 @@ struct _virDomainDeviceInfo {
|
|||||||
char *alias;
|
char *alias;
|
||||||
int type; /* virDomainDeviceAddressType */
|
int type; /* virDomainDeviceAddressType */
|
||||||
union {
|
union {
|
||||||
virDevicePCIAddress pci;
|
virPCIDeviceAddress pci;
|
||||||
virDomainDeviceDriveAddress drive;
|
virDomainDeviceDriveAddress drive;
|
||||||
virDomainDeviceVirtioSerialAddress vioserial;
|
virDomainDeviceVirtioSerialAddress vioserial;
|
||||||
virDomainDeviceCcidAddress ccid;
|
virDomainDeviceCcidAddress ccid;
|
||||||
@ -456,7 +456,7 @@ struct _virDomainHostdevSubsysUSB {
|
|||||||
typedef struct _virDomainHostdevSubsysPCI virDomainHostdevSubsysPCI;
|
typedef struct _virDomainHostdevSubsysPCI virDomainHostdevSubsysPCI;
|
||||||
typedef virDomainHostdevSubsysPCI *virDomainHostdevSubsysPCIPtr;
|
typedef virDomainHostdevSubsysPCI *virDomainHostdevSubsysPCIPtr;
|
||||||
struct _virDomainHostdevSubsysPCI {
|
struct _virDomainHostdevSubsysPCI {
|
||||||
virDevicePCIAddress addr; /* host address */
|
virPCIDeviceAddress addr; /* host address */
|
||||||
int backend; /* enum virDomainHostdevSubsysPCIBackendType */
|
int backend; /* enum virDomainHostdevSubsysPCIBackendType */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2780,11 +2780,11 @@ int virDomainDefCompatibleDevice(virDomainDefPtr def,
|
|||||||
void virDomainRNGDefFree(virDomainRNGDefPtr def);
|
void virDomainRNGDefFree(virDomainRNGDefPtr def);
|
||||||
|
|
||||||
int virDomainDiskIndexByAddress(virDomainDefPtr def,
|
int virDomainDiskIndexByAddress(virDomainDefPtr def,
|
||||||
virDevicePCIAddressPtr pci_controller,
|
virPCIDeviceAddressPtr pci_controller,
|
||||||
unsigned int bus, unsigned int target,
|
unsigned int bus, unsigned int target,
|
||||||
unsigned int unit);
|
unsigned int unit);
|
||||||
virDomainDiskDefPtr virDomainDiskByAddress(virDomainDefPtr def,
|
virDomainDiskDefPtr virDomainDiskByAddress(virDomainDefPtr def,
|
||||||
virDevicePCIAddressPtr pci_controller,
|
virPCIDeviceAddressPtr pci_controller,
|
||||||
unsigned int bus,
|
unsigned int bus,
|
||||||
unsigned int target,
|
unsigned int target,
|
||||||
unsigned int unit);
|
unsigned int unit);
|
||||||
@ -2855,7 +2855,7 @@ void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
|
|||||||
int virDomainControllerFind(const virDomainDef *def, int type, int idx);
|
int virDomainControllerFind(const virDomainDef *def, int type, int idx);
|
||||||
int virDomainControllerFindByType(virDomainDefPtr def, int type);
|
int virDomainControllerFindByType(virDomainDefPtr def, int type);
|
||||||
int virDomainControllerFindByPCIAddress(virDomainDefPtr def,
|
int virDomainControllerFindByPCIAddress(virDomainDefPtr def,
|
||||||
virDevicePCIAddressPtr addr);
|
virPCIDeviceAddressPtr addr);
|
||||||
virDomainControllerDefPtr virDomainControllerRemove(virDomainDefPtr def, size_t i);
|
virDomainControllerDefPtr virDomainControllerRemove(virDomainDefPtr def, size_t i);
|
||||||
const char *virDomainControllerAliasFind(const virDomainDef *def,
|
const char *virDomainControllerAliasFind(const virDomainDef *def,
|
||||||
int type, int idx)
|
int type, int idx)
|
||||||
|
@ -1974,13 +1974,13 @@ virNetworkForwardDefParseXML(const char *networkName,
|
|||||||
switch (def->ifs[i].type) {
|
switch (def->ifs[i].type) {
|
||||||
case VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI:
|
case VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI:
|
||||||
{
|
{
|
||||||
virDevicePCIAddressPtr addr = &def->ifs[i].device.pci;
|
virPCIDeviceAddressPtr addr = &def->ifs[i].device.pci;
|
||||||
|
|
||||||
if (virDevicePCIAddressParseXML(forwardAddrNodes[i], addr) < 0)
|
if (virPCIDeviceAddressParseXML(forwardAddrNodes[i], addr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (j = 0; j < i; j++) {
|
for (j = 0; j < i; j++) {
|
||||||
if (virDevicePCIAddressEqual(addr, &def->ifs[j].device.pci)) {
|
if (virPCIDeviceAddressEqual(addr, &def->ifs[j].device.pci)) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("PCI device '%04x:%02x:%02x.%x' can "
|
_("PCI device '%04x:%02x:%02x.%x' can "
|
||||||
"only be listed once in network %s"),
|
"only be listed once in network %s"),
|
||||||
@ -2797,7 +2797,7 @@ virNetworkDefFormatBuf(virBufferPtr buf,
|
|||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
} else {
|
} else {
|
||||||
if (def->forward.ifs[i].type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI) {
|
if (def->forward.ifs[i].type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI) {
|
||||||
if (virDevicePCIAddressFormat(buf,
|
if (virPCIDeviceAddressFormat(buf,
|
||||||
def->forward.ifs[i].device.pci,
|
def->forward.ifs[i].device.pci,
|
||||||
true) < 0)
|
true) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -169,7 +169,7 @@ typedef virNetworkForwardIfDef *virNetworkForwardIfDefPtr;
|
|||||||
struct _virNetworkForwardIfDef {
|
struct _virNetworkForwardIfDef {
|
||||||
int type;
|
int type;
|
||||||
union {
|
union {
|
||||||
virDevicePCIAddress pci; /*PCI Address of device */
|
virPCIDeviceAddress pci; /*PCI Address of device */
|
||||||
/* when USB devices are supported a new variable to be added here */
|
/* when USB devices are supported a new variable to be added here */
|
||||||
char *dev; /* name of device */
|
char *dev; /* name of device */
|
||||||
}device;
|
}device;
|
||||||
|
@ -1164,8 +1164,8 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < nAddrNodes; i++) {
|
for (i = 0; i < nAddrNodes; i++) {
|
||||||
virDevicePCIAddress addr = { 0, 0, 0, 0, 0 };
|
virPCIDeviceAddress addr = { 0, 0, 0, 0, 0 };
|
||||||
if (virDevicePCIAddressParseXML(addrNodes[i], &addr) < 0)
|
if (virPCIDeviceAddressParseXML(addrNodes[i], &addr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (VIR_ALLOC(pciAddr) < 0)
|
if (VIR_ALLOC(pciAddr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -603,7 +603,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
if (virXPathNode("./adapter/parentaddr", ctxt)) {
|
if (virXPathNode("./adapter/parentaddr", ctxt)) {
|
||||||
xmlNodePtr addrnode = virXPathNode("./adapter/parentaddr/address",
|
xmlNodePtr addrnode = virXPathNode("./adapter/parentaddr/address",
|
||||||
ctxt);
|
ctxt);
|
||||||
virDevicePCIAddressPtr addr =
|
virPCIDeviceAddressPtr addr =
|
||||||
&source->adapter.data.scsi_host.parentaddr;
|
&source->adapter.data.scsi_host.parentaddr;
|
||||||
|
|
||||||
if (!addrnode) {
|
if (!addrnode) {
|
||||||
@ -612,7 +612,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
source->adapter.data.scsi_host.has_parent = true;
|
source->adapter.data.scsi_host.has_parent = true;
|
||||||
if (virDevicePCIAddressParseXML(addrnode, addr) < 0)
|
if (virPCIDeviceAddressParseXML(addrnode, addr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if ((virXPathInt("string(./adapter/parentaddr/@unique_id)",
|
if ((virXPathInt("string(./adapter/parentaddr/@unique_id)",
|
||||||
ctxt,
|
ctxt,
|
||||||
@ -1103,14 +1103,14 @@ virStoragePoolSourceFormat(virBufferPtr buf,
|
|||||||
virBufferAsprintf(buf, " name='%s'/>\n",
|
virBufferAsprintf(buf, " name='%s'/>\n",
|
||||||
src->adapter.data.scsi_host.name);
|
src->adapter.data.scsi_host.name);
|
||||||
} else {
|
} else {
|
||||||
virDevicePCIAddress addr;
|
virPCIDeviceAddress addr;
|
||||||
virBufferAddLit(buf, ">\n");
|
virBufferAddLit(buf, ">\n");
|
||||||
virBufferAdjustIndent(buf, 2);
|
virBufferAdjustIndent(buf, 2);
|
||||||
virBufferAsprintf(buf, "<parentaddr unique_id='%d'>\n",
|
virBufferAsprintf(buf, "<parentaddr unique_id='%d'>\n",
|
||||||
src->adapter.data.scsi_host.unique_id);
|
src->adapter.data.scsi_host.unique_id);
|
||||||
virBufferAdjustIndent(buf, 2);
|
virBufferAdjustIndent(buf, 2);
|
||||||
addr = src->adapter.data.scsi_host.parentaddr;
|
addr = src->adapter.data.scsi_host.parentaddr;
|
||||||
ignore_value(virDevicePCIAddressFormat(buf, addr, false));
|
ignore_value(virPCIDeviceAddressFormat(buf, addr, false));
|
||||||
virBufferAdjustIndent(buf, -2);
|
virBufferAdjustIndent(buf, -2);
|
||||||
virBufferAddLit(buf, "</parentaddr>\n");
|
virBufferAddLit(buf, "</parentaddr>\n");
|
||||||
virBufferAdjustIndent(buf, -2);
|
virBufferAdjustIndent(buf, -2);
|
||||||
@ -2315,7 +2315,7 @@ getSCSIHostNumber(virStoragePoolSourceAdapter adapter,
|
|||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
|
|
||||||
if (adapter.data.scsi_host.has_parent) {
|
if (adapter.data.scsi_host.has_parent) {
|
||||||
virDevicePCIAddress addr = adapter.data.scsi_host.parentaddr;
|
virPCIDeviceAddress addr = adapter.data.scsi_host.parentaddr;
|
||||||
unsigned int unique_id = adapter.data.scsi_host.unique_id;
|
unsigned int unique_id = adapter.data.scsi_host.unique_id;
|
||||||
|
|
||||||
if (!(name = virGetSCSIHostNameByParentaddr(addr.domain,
|
if (!(name = virGetSCSIHostNameByParentaddr(addr.domain,
|
||||||
@ -2419,9 +2419,9 @@ static bool
|
|||||||
matchSCSIAdapterParent(virStoragePoolObjPtr pool,
|
matchSCSIAdapterParent(virStoragePoolObjPtr pool,
|
||||||
virStoragePoolDefPtr def)
|
virStoragePoolDefPtr def)
|
||||||
{
|
{
|
||||||
virDevicePCIAddressPtr pooladdr =
|
virPCIDeviceAddressPtr pooladdr =
|
||||||
&pool->def->source.adapter.data.scsi_host.parentaddr;
|
&pool->def->source.adapter.data.scsi_host.parentaddr;
|
||||||
virDevicePCIAddressPtr defaddr =
|
virPCIDeviceAddressPtr defaddr =
|
||||||
&def->source.adapter.data.scsi_host.parentaddr;
|
&def->source.adapter.data.scsi_host.parentaddr;
|
||||||
int pool_unique_id =
|
int pool_unique_id =
|
||||||
pool->def->source.adapter.data.scsi_host.unique_id;
|
pool->def->source.adapter.data.scsi_host.unique_id;
|
||||||
|
@ -186,7 +186,7 @@ struct _virStoragePoolSourceAdapter {
|
|||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
char *name;
|
char *name;
|
||||||
virDevicePCIAddress parentaddr; /* host address */
|
virPCIDeviceAddress parentaddr; /* host address */
|
||||||
int unique_id;
|
int unique_id;
|
||||||
bool has_parent;
|
bool has_parent;
|
||||||
} scsi_host;
|
} scsi_host;
|
||||||
|
@ -76,14 +76,14 @@ virCPUModeTypeToString;
|
|||||||
|
|
||||||
|
|
||||||
# conf/device_conf.h
|
# conf/device_conf.h
|
||||||
virDevicePCIAddressEqual;
|
|
||||||
virDevicePCIAddressFormat;
|
|
||||||
virDevicePCIAddressIsValid;
|
|
||||||
virDevicePCIAddressParseXML;
|
|
||||||
virInterfaceLinkFormat;
|
virInterfaceLinkFormat;
|
||||||
virInterfaceLinkParseXML;
|
virInterfaceLinkParseXML;
|
||||||
virInterfaceStateTypeFromString;
|
virInterfaceStateTypeFromString;
|
||||||
virInterfaceStateTypeToString;
|
virInterfaceStateTypeToString;
|
||||||
|
virPCIDeviceAddressEqual;
|
||||||
|
virPCIDeviceAddressFormat;
|
||||||
|
virPCIDeviceAddressIsValid;
|
||||||
|
virPCIDeviceAddressParseXML;
|
||||||
|
|
||||||
|
|
||||||
# conf/domain_addr.h
|
# conf/domain_addr.h
|
||||||
|
@ -4457,7 +4457,7 @@ networkNotifyActualDevice(virDomainDefPtr dom,
|
|||||||
for (i = 0; i < netdef->forward.nifs; i++) {
|
for (i = 0; i < netdef->forward.nifs; i++) {
|
||||||
if (netdef->forward.ifs[i].type
|
if (netdef->forward.ifs[i].type
|
||||||
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
|
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
|
||||||
virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci.addr,
|
virPCIDeviceAddressEqual(&hostdev->source.subsys.u.pci.addr,
|
||||||
&netdef->forward.ifs[i].device.pci)) {
|
&netdef->forward.ifs[i].device.pci)) {
|
||||||
dev = &netdef->forward.ifs[i];
|
dev = &netdef->forward.ifs[i];
|
||||||
break;
|
break;
|
||||||
@ -4616,7 +4616,7 @@ networkReleaseActualDevice(virDomainDefPtr dom,
|
|||||||
for (i = 0; i < netdef->forward.nifs; i++) {
|
for (i = 0; i < netdef->forward.nifs; i++) {
|
||||||
if (netdef->forward.ifs[i].type
|
if (netdef->forward.ifs[i].type
|
||||||
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
|
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI &&
|
||||||
virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci.addr,
|
virPCIDeviceAddressEqual(&hostdev->source.subsys.u.pci.addr,
|
||||||
&netdef->forward.ifs[i].device.pci)) {
|
&netdef->forward.ifs[i].device.pci)) {
|
||||||
dev = &netdef->forward.ifs[i];
|
dev = &netdef->forward.ifs[i];
|
||||||
break;
|
break;
|
||||||
|
@ -1770,7 +1770,7 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr **info,
|
|||||||
virJSONValuePtr reply = NULL;
|
virJSONValuePtr reply = NULL;
|
||||||
virJSONValuePtr data;
|
virJSONValuePtr data;
|
||||||
virDomainFSInfoPtr *info_ret = NULL;
|
virDomainFSInfoPtr *info_ret = NULL;
|
||||||
virDevicePCIAddress pci_address;
|
virPCIDeviceAddress pci_address;
|
||||||
|
|
||||||
cmd = qemuAgentMakeCommand("guest-get-fsinfo", NULL);
|
cmd = qemuAgentMakeCommand("guest-get-fsinfo", NULL);
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
|
@ -423,7 +423,7 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
|||||||
{
|
{
|
||||||
virDomainPCIAddressSetPtr addrs = opaque;
|
virDomainPCIAddressSetPtr addrs = opaque;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virDevicePCIAddressPtr addr = &info->addr.pci;
|
virPCIDeviceAddressPtr addr = &info->addr.pci;
|
||||||
bool entireSlot;
|
bool entireSlot;
|
||||||
/* flags may be changed from default below */
|
/* flags may be changed from default below */
|
||||||
virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
|
virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
|
||||||
@ -620,7 +620,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
virDevicePCIAddress tmp_addr;
|
virPCIDeviceAddress tmp_addr;
|
||||||
bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||||
char *addrStr = NULL;
|
char *addrStr = NULL;
|
||||||
virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE
|
virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE
|
||||||
@ -754,7 +754,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
virDevicePCIAddress tmp_addr;
|
virPCIDeviceAddress tmp_addr;
|
||||||
bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||||
char *addrStr = NULL;
|
char *addrStr = NULL;
|
||||||
virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCIE_DEVICE;
|
virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCIE_DEVICE;
|
||||||
@ -1021,7 +1021,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
|||||||
{
|
{
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
virDomainPCIConnectFlags flags = 0; /* initialize to quiet gcc warning */
|
virDomainPCIConnectFlags flags = 0; /* initialize to quiet gcc warning */
|
||||||
virDevicePCIAddress tmp_addr;
|
virPCIDeviceAddress tmp_addr;
|
||||||
|
|
||||||
/* PCI controllers */
|
/* PCI controllers */
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
@ -1120,7 +1120,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
|||||||
|
|
||||||
/* USB2 needs special handling to put all companions in the same slot */
|
/* USB2 needs special handling to put all companions in the same slot */
|
||||||
if (IS_USB2_CONTROLLER(def->controllers[i])) {
|
if (IS_USB2_CONTROLLER(def->controllers[i])) {
|
||||||
virDevicePCIAddress addr = { 0, 0, 0, 0, false };
|
virPCIDeviceAddress addr = { 0, 0, 0, 0, false };
|
||||||
bool foundAddr = false;
|
bool foundAddr = false;
|
||||||
|
|
||||||
memset(&tmp_addr, 0, sizeof(tmp_addr));
|
memset(&tmp_addr, 0, sizeof(tmp_addr));
|
||||||
@ -1545,7 +1545,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
|||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
virDomainControllerDefPtr cont = def->controllers[i];
|
virDomainControllerDefPtr cont = def->controllers[i];
|
||||||
int idx = cont->idx;
|
int idx = cont->idx;
|
||||||
virDevicePCIAddressPtr addr;
|
virPCIDeviceAddressPtr addr;
|
||||||
virDomainPCIControllerOptsPtr options;
|
virDomainPCIControllerOptsPtr options;
|
||||||
|
|
||||||
if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI)
|
if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI)
|
||||||
|
@ -2309,7 +2309,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
|
|||||||
virDomainDeviceInfoCopy(&newdev->info, &olddev->info) < 0) {
|
virDomainDeviceInfoCopy(&newdev->info, &olddev->info) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (!virDevicePCIAddressEqual(&olddev->info.addr.pci,
|
if (!virPCIDeviceAddressEqual(&olddev->info.addr.pci,
|
||||||
&newdev->info.addr.pci)) {
|
&newdev->info.addr.pci)) {
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||||
_("cannot modify network device guest PCI address"));
|
_("cannot modify network device guest PCI address"));
|
||||||
|
@ -675,13 +675,13 @@ int qemuMonitorGetChardevInfo(qemuMonitorPtr mon,
|
|||||||
|
|
||||||
int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
|
int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
|
||||||
const char *bus,
|
const char *bus,
|
||||||
virDevicePCIAddress *guestAddr);
|
virPCIDeviceAddress *guestAddr);
|
||||||
|
|
||||||
typedef struct _qemuMonitorPCIAddress qemuMonitorPCIAddress;
|
typedef struct _qemuMonitorPCIAddress qemuMonitorPCIAddress;
|
||||||
struct _qemuMonitorPCIAddress {
|
struct _qemuMonitorPCIAddress {
|
||||||
unsigned int vendor;
|
unsigned int vendor;
|
||||||
unsigned int product;
|
unsigned int product;
|
||||||
virDevicePCIAddress addr;
|
virPCIDeviceAddress addr;
|
||||||
};
|
};
|
||||||
|
|
||||||
int qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon,
|
int qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon,
|
||||||
|
@ -170,20 +170,20 @@ int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon,
|
|||||||
const char *tlsSubject);
|
const char *tlsSubject);
|
||||||
|
|
||||||
int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon,
|
int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon,
|
||||||
virDevicePCIAddress *hostAddr,
|
virPCIDeviceAddress *hostAddr,
|
||||||
virDevicePCIAddress *guestAddr);
|
virPCIDeviceAddress *guestAddr);
|
||||||
|
|
||||||
int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon,
|
int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon,
|
||||||
const char *path,
|
const char *path,
|
||||||
const char *bus,
|
const char *bus,
|
||||||
virDevicePCIAddress *guestAddr);
|
virPCIDeviceAddress *guestAddr);
|
||||||
|
|
||||||
int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon,
|
int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon,
|
||||||
const char *nicstr,
|
const char *nicstr,
|
||||||
virDevicePCIAddress *guestAddr);
|
virPCIDeviceAddress *guestAddr);
|
||||||
|
|
||||||
int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon,
|
int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon,
|
||||||
virDevicePCIAddress *guestAddr);
|
virPCIDeviceAddress *guestAddr);
|
||||||
|
|
||||||
int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon,
|
int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon,
|
||||||
const char *fdname,
|
const char *fdname,
|
||||||
@ -209,7 +209,7 @@ int qemuMonitorJSONGetChardevInfo(qemuMonitorPtr mon,
|
|||||||
|
|
||||||
int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon,
|
int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon,
|
||||||
const char *bus,
|
const char *bus,
|
||||||
virDevicePCIAddress *guestAddr);
|
virPCIDeviceAddress *guestAddr);
|
||||||
|
|
||||||
int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon,
|
int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon,
|
||||||
qemuMonitorPCIAddress **addrs);
|
qemuMonitorPCIAddress **addrs);
|
||||||
|
@ -640,7 +640,7 @@ getAdapterName(virStoragePoolSourceAdapter adapter)
|
|||||||
|
|
||||||
if (adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
|
if (adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
|
||||||
if (adapter.data.scsi_host.has_parent) {
|
if (adapter.data.scsi_host.has_parent) {
|
||||||
virDevicePCIAddress addr = adapter.data.scsi_host.parentaddr;
|
virPCIDeviceAddress addr = adapter.data.scsi_host.parentaddr;
|
||||||
unsigned int unique_id = adapter.data.scsi_host.unique_id;
|
unsigned int unique_id = adapter.data.scsi_host.unique_id;
|
||||||
|
|
||||||
if (!(name = virGetSCSIHostNameByParentaddr(addr.domain,
|
if (!(name = virGetSCSIHostNameByParentaddr(addr.domain,
|
||||||
|
@ -2517,7 +2517,7 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
char *device_link = NULL;
|
char *device_link = NULL;
|
||||||
virPCIDeviceAddress *config_addr = NULL;
|
virPCIDeviceAddressPtr config_addr = NULL;
|
||||||
char *totalvfs_file = NULL, *totalvfs_str = NULL;
|
char *totalvfs_file = NULL, *totalvfs_str = NULL;
|
||||||
|
|
||||||
*virtual_functions = NULL;
|
*virtual_functions = NULL;
|
||||||
|
@ -40,6 +40,7 @@ struct _virPCIDeviceAddress {
|
|||||||
unsigned int bus;
|
unsigned int bus;
|
||||||
unsigned int slot;
|
unsigned int slot;
|
||||||
unsigned int function;
|
unsigned int function;
|
||||||
|
int multi; /* virTristateSwitch */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -168,7 +169,7 @@ int virPCIDeviceFileIterate(virPCIDevicePtr dev,
|
|||||||
virPCIDeviceFileActor actor,
|
virPCIDeviceFileActor actor,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
|
||||||
typedef int (*virPCIDeviceAddressActor)(virPCIDeviceAddress *addr,
|
typedef int (*virPCIDeviceAddressActor)(virPCIDeviceAddressPtr addr,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
int virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig,
|
int virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig,
|
||||||
virPCIDeviceAddressActor actor,
|
virPCIDeviceAddressActor actor,
|
||||||
|
@ -2167,7 +2167,7 @@ xenDaemonAttachDeviceFlags(virConnectPtr conn,
|
|||||||
if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 0) < 0)
|
if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 0) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virDevicePCIAddress PCIAddr;
|
virPCIDeviceAddress PCIAddr;
|
||||||
|
|
||||||
PCIAddr = dev->data.hostdev->source.subsys.u.pci.addr;
|
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",
|
||||||
|
Loading…
Reference in New Issue
Block a user