ACPI Dimm devices are described by the slot and base address. Add a new
address type to be able to describe such address.
---
docs/schemas/domaincommon.rng | 18 +++++++++++
src/conf/domain_conf.c | 69 ++++++++++++++++++++++++++++++++++++++++++-
src/conf/domain_conf.h | 9 ++++++
3 files changed, 95 insertions(+), 1 deletion(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 2dbfbec..d7e27c2 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3944,6 +3944,18 @@
</attribute>
</optional>
</define>
+ <define name="acpidimmaddress">
+ <optional>
+ <attribute name="slot">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="base">
+ <ref name="hexuint"/>
+ </attribute>
+ </optional>
+ </define>
<define name="devices">
<element name="devices">
<interleave>
@@ -4358,6 +4370,12 @@
</attribute>
<ref name="isaaddress"/>
</group>
+ <group>
+ <attribute name="type">
+ <value>acpi-dimm</value>
+ </attribute>
+ <ref name="acpidimmaddress"/>
+ </group>
</choice>
</element>
</define>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0cfc638..0b9fb06 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -249,7 +249,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"virtio-s390",
"ccw",
"virtio-mmio",
- "isa")
+ "isa",
+ "acpi-dimm")
VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST,
"disk",
@@ -3484,6 +3485,12 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
virBufferAsprintf(buf, " irq='0x%x'",
info->addr.isa.irq);
break;
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ACPI_DIMM:
+ virBufferAsprintf(buf, " slot='%u'",
info->addr.acpiDimm.slot);
+ virBufferAsprintf(buf, " base='0x%llx'",
info->addr.acpiDimm.base);
+
+ break;
+
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST:
@@ -3853,6 +3860,41 @@ virDomainDeviceISAAddressParseXML(xmlNodePtr node,
return ret;
}
+
+static int
+virDomainDeviceACPIDimmAddressParseXML(xmlNodePtr node,
+ virDomainDeviceACPIDimmAddressPtr addr)
+{
+ int ret = -1;
+ char *tmp = NULL;
+
+ if (!(tmp = virXMLPropString(node, "slot")) ||
+ virStrToLong_uip(tmp, NULL, 10, &addr->slot) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid or missing acpi-dimm slot id '%s'"),
+ NULLSTR(tmp));
+ goto cleanup;
+ }
+ VIR_FREE(tmp);
+
+ if (!(tmp = virXMLPropString(node, "base")) ||
+ virStrToLong_ullp(tmp, NULL, 16, &addr->base) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("invalid or missing acpi-dimm base address
'%s'"),
+ NULLSTR(tmp));
+ goto cleanup;
+ }
+ VIR_FREE(tmp);
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(tmp);
+
+ return ret;
+}
+
+
/* Parse the XML definition for a device address
* @param node XML nodeset to parse for device address definition
*/
@@ -3994,6 +4036,11 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
_("virtio-s390 bus doesn't have an address"));
goto cleanup;
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ACPI_DIMM:
+ if (virDomainDeviceACPIDimmAddressParseXML(address, &info->addr.acpiDimm)
< 0)
+ goto cleanup;
+ break;
+
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST:
break;
@@ -14842,6 +14889,26 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
}
break;
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ACPI_DIMM:
+ if (src->addr.acpiDimm.slot != dst->addr.acpiDimm.slot) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target device acpi dimm slot %d does not match "
+ "source %d"),
+ dst->addr.acpiDimm.slot,
+ src->addr.acpiDimm.slot);
+ return false;
+ }
+
+ if (src->addr.acpiDimm.base != dst->addr.acpiDimm.base) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target device acpi dimm base addres '%llx'
does "
+ "not match source '%llx'"),
+ dst->addr.acpiDimm.base,
+ src->addr.acpiDimm.base);
+ return false;
+ }
+ break;
+
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 97be518..f01c2ab 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -234,6 +234,7 @@ typedef enum {
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA,
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ACPI_DIMM,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
} virDomainDeviceAddressType;
@@ -309,6 +310,13 @@ struct _virDomainDeviceISAAddress {
unsigned int irq;
};
+typedef struct _virDomainDeviceACPIDimmAddress virDomainDeviceACPIDimmAddress;
+typedef virDomainDeviceACPIDimmAddress *virDomainDeviceACPIDimmAddressPtr;
+struct _virDomainDeviceACPIDimmAddress {
+ unsigned int slot;
+ unsigned long long base;
+};
+
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
struct _virDomainDeviceInfo {
@@ -327,6 +335,7 @@ struct _virDomainDeviceInfo {
virDomainDeviceSpaprVioAddress spaprvio;
virDomainDeviceCCWAddress ccw;
virDomainDeviceISAAddress isa;
+ virDomainDeviceACPIDimmAddress acpiDimm;
} addr;
int mastertype;
union {
--
2.2.2