|
|
c401cc |
From 8a0f676b42526ea92fa8e1e62ddea2aeb7768df1 Mon Sep 17 00:00:00 2001
|
|
|
c401cc |
Message-Id: <8a0f676b42526ea92fa8e1e62ddea2aeb7768df1.1387385061.git.jdenemar@redhat.com>
|
|
|
c401cc |
From: Hu Tao <hutao@cn.fujitsu.com>
|
|
|
c401cc |
Date: Mon, 16 Dec 2013 11:58:20 -0700
|
|
|
c401cc |
Subject: [PATCH] conf: introduce generic ISA address
|
|
|
c401cc |
|
|
|
c401cc |
RHEL 7.0: https://bugzilla.redhat.com/show_bug.cgi?id=996520
|
|
|
c401cc |
|
|
|
c401cc |
For example:
|
|
|
c401cc |
<address type='isa' iobase='0x505' irq='0x1'/>
|
|
|
c401cc |
|
|
|
c401cc |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
c401cc |
(cherry picked from commit f1a039ef57f48fbc28c629163d2fedf9f273179f)
|
|
|
c401cc |
|
|
|
c401cc |
Conflicts:
|
|
|
c401cc |
src/conf/domain_conf.c - no virtio-mmio (commit 4fa1722)
|
|
|
c401cc |
src/conf/domain_conf.h - no virtio-mmio
|
|
|
c401cc |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c401cc |
---
|
|
|
c401cc |
docs/formatdomain.html.in | 5 ++++
|
|
|
c401cc |
docs/schemas/basictypes.rng | 17 ++++++++++++
|
|
|
c401cc |
docs/schemas/domaincommon.rng | 6 +++++
|
|
|
c401cc |
src/conf/domain_conf.c | 63 ++++++++++++++++++++++++++++++++++++++++++-
|
|
|
c401cc |
src/conf/domain_conf.h | 9 +++++++
|
|
|
c401cc |
5 files changed, 99 insertions(+), 1 deletion(-)
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
|
|
c401cc |
index c783478..fb557f6 100644
|
|
|
c401cc |
--- a/docs/formatdomain.html.in
|
|
|
c401cc |
+++ b/docs/formatdomain.html.in
|
|
|
c401cc |
@@ -2382,6 +2382,11 @@
|
|
|
c401cc |
operating system.
|
|
|
c401cc |
Since 1.0.4
|
|
|
c401cc |
|
|
|
c401cc |
+ type='isa'
|
|
|
c401cc |
+ ISA addresses have the following additional
|
|
|
c401cc |
+ attributes: iobase and irq .
|
|
|
c401cc |
+ Since 1.2.1
|
|
|
c401cc |
+
|
|
|
c401cc |
|
|
|
c401cc |
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
|
|
|
c401cc |
index 34c2254..dcd846e 100644
|
|
|
c401cc |
--- a/docs/schemas/basictypes.rng
|
|
|
c401cc |
+++ b/docs/schemas/basictypes.rng
|
|
|
c401cc |
@@ -372,4 +372,21 @@
|
|
|
c401cc |
</element>
|
|
|
c401cc |
</define>
|
|
|
c401cc |
|
|
|
c401cc |
+ <define name="isaaddress">
|
|
|
c401cc |
+ <optional>
|
|
|
c401cc |
+ <attribute name="iobase">
|
|
|
c401cc |
+ <data type="string">
|
|
|
c401cc |
+ <param name="pattern">0x[a-fA-F0-9]{1,4}</param>
|
|
|
c401cc |
+ </data>
|
|
|
c401cc |
+ </attribute>
|
|
|
c401cc |
+ </optional>
|
|
|
c401cc |
+ <optional>
|
|
|
c401cc |
+ <attribute name="irq">
|
|
|
c401cc |
+ <data type="string">
|
|
|
c401cc |
+ <param name="pattern">0x[a-fA-F0-9]</param>
|
|
|
c401cc |
+ </data>
|
|
|
c401cc |
+ </attribute>
|
|
|
c401cc |
+ </optional>
|
|
|
c401cc |
+ </define>
|
|
|
c401cc |
+
|
|
|
c401cc |
</grammar>
|
|
|
c401cc |
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
|
|
c401cc |
index 36a4b94..871ae30 100644
|
|
|
c401cc |
--- a/docs/schemas/domaincommon.rng
|
|
|
c401cc |
+++ b/docs/schemas/domaincommon.rng
|
|
|
c401cc |
@@ -3870,6 +3870,12 @@
|
|
|
c401cc |
</attribute>
|
|
|
c401cc |
<ref name="ccwaddress"/>
|
|
|
c401cc |
</group>
|
|
|
c401cc |
+ <group>
|
|
|
c401cc |
+ <attribute name="type">
|
|
|
c401cc |
+ <value>isa</value>
|
|
|
c401cc |
+ </attribute>
|
|
|
c401cc |
+ <ref name="isaaddress"/>
|
|
|
c401cc |
+ </group>
|
|
|
c401cc |
</choice>
|
|
|
c401cc |
</element>
|
|
|
c401cc |
</define>
|
|
|
c401cc |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
c401cc |
index f7c0274..f35ec44 100644
|
|
|
c401cc |
--- a/src/conf/domain_conf.c
|
|
|
c401cc |
+++ b/src/conf/domain_conf.c
|
|
|
c401cc |
@@ -211,7 +211,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
|
|
|
c401cc |
"usb",
|
|
|
c401cc |
"spapr-vio",
|
|
|
c401cc |
"virtio-s390",
|
|
|
c401cc |
- "ccw")
|
|
|
c401cc |
+ "ccw",
|
|
|
c401cc |
+ "isa")
|
|
|
c401cc |
|
|
|
c401cc |
VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
|
|
|
c401cc |
"block",
|
|
|
c401cc |
@@ -3036,6 +3037,13 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
|
|
c401cc |
info->addr.ccw.devno);
|
|
|
c401cc |
break;
|
|
|
c401cc |
|
|
|
c401cc |
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA:
|
|
|
c401cc |
+ if (info->addr.isa.iobase > 0)
|
|
|
c401cc |
+ virBufferAsprintf(buf, " iobase='0x%x'", info->addr.isa.iobase);
|
|
|
c401cc |
+ if (info->addr.isa.irq > 0)
|
|
|
c401cc |
+ virBufferAsprintf(buf, " irq='0x%x'", info->addr.isa.irq);
|
|
|
c401cc |
+ break;
|
|
|
c401cc |
+
|
|
|
c401cc |
default:
|
|
|
c401cc |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
c401cc |
_("unknown address type '%d'"), info->type);
|
|
|
c401cc |
@@ -3372,6 +3380,40 @@ cleanup:
|
|
|
c401cc |
return ret;
|
|
|
c401cc |
}
|
|
|
c401cc |
|
|
|
c401cc |
+static int
|
|
|
c401cc |
+virDomainDeviceISAAddressParseXML(xmlNodePtr node,
|
|
|
c401cc |
+ virDomainDeviceISAAddressPtr addr)
|
|
|
c401cc |
+{
|
|
|
c401cc |
+ int ret = -1;
|
|
|
c401cc |
+ char *iobase;
|
|
|
c401cc |
+ char *irq;
|
|
|
c401cc |
+
|
|
|
c401cc |
+ memset(addr, 0, sizeof(*addr));
|
|
|
c401cc |
+
|
|
|
c401cc |
+ iobase = virXMLPropString(node, "iobase");
|
|
|
c401cc |
+ irq = virXMLPropString(node, "irq");
|
|
|
c401cc |
+
|
|
|
c401cc |
+ if (iobase &&
|
|
|
c401cc |
+ virStrToLong_ui(iobase, NULL, 16, &addr->iobase) < 0) {
|
|
|
c401cc |
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
|
c401cc |
+ _("Cannot parse <address> 'iobase' attribute"));
|
|
|
c401cc |
+ goto cleanup;
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+
|
|
|
c401cc |
+ if (irq &&
|
|
|
c401cc |
+ virStrToLong_ui(irq, NULL, 16, &addr->irq) < 0) {
|
|
|
c401cc |
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
|
c401cc |
+ _("Cannot parse <address> 'irq' attribute"));
|
|
|
c401cc |
+ goto cleanup;
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+
|
|
|
c401cc |
+ ret = 0;
|
|
|
c401cc |
+cleanup:
|
|
|
c401cc |
+ VIR_FREE(iobase);
|
|
|
c401cc |
+ VIR_FREE(irq);
|
|
|
c401cc |
+ return ret;
|
|
|
c401cc |
+}
|
|
|
c401cc |
+
|
|
|
c401cc |
/* Parse the XML definition for a device address
|
|
|
c401cc |
* @param node XML nodeset to parse for device address definition
|
|
|
c401cc |
*/
|
|
|
c401cc |
@@ -3500,6 +3542,11 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
break;
|
|
|
c401cc |
|
|
|
c401cc |
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA:
|
|
|
c401cc |
+ if (virDomainDeviceISAAddressParseXML(address, &info->addr.isa) < 0)
|
|
|
c401cc |
+ goto cleanup;
|
|
|
c401cc |
+ break;
|
|
|
c401cc |
+
|
|
|
c401cc |
default:
|
|
|
c401cc |
/* Should not happen */
|
|
|
c401cc |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
c401cc |
@@ -12806,6 +12853,20 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
|
|
|
c401cc |
return false;
|
|
|
c401cc |
}
|
|
|
c401cc |
break;
|
|
|
c401cc |
+
|
|
|
c401cc |
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA:
|
|
|
c401cc |
+ if (src->addr.isa.iobase != dst->addr.isa.iobase ||
|
|
|
c401cc |
+ src->addr.isa.irq != dst->addr.isa.irq) {
|
|
|
c401cc |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
c401cc |
+ _("Target device isa address %d:%d "
|
|
|
c401cc |
+ "does not match source %d:%d"),
|
|
|
c401cc |
+ dst->addr.isa.iobase,
|
|
|
c401cc |
+ dst->addr.isa.irq,
|
|
|
c401cc |
+ src->addr.isa.iobase,
|
|
|
c401cc |
+ src->addr.isa.irq);
|
|
|
c401cc |
+ return false;
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+ break;
|
|
|
c401cc |
}
|
|
|
c401cc |
|
|
|
c401cc |
return true;
|
|
|
c401cc |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
c401cc |
index 1d27ccd..7f6096f 100644
|
|
|
c401cc |
--- a/src/conf/domain_conf.h
|
|
|
c401cc |
+++ b/src/conf/domain_conf.h
|
|
|
c401cc |
@@ -207,6 +207,7 @@ enum virDomainDeviceAddressType {
|
|
|
c401cc |
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO,
|
|
|
c401cc |
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
|
|
|
c401cc |
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW,
|
|
|
c401cc |
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA,
|
|
|
c401cc |
|
|
|
c401cc |
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
|
|
|
c401cc |
};
|
|
|
c401cc |
@@ -283,6 +284,13 @@ struct _virDomainDeviceUSBMaster {
|
|
|
c401cc |
unsigned int startport;
|
|
|
c401cc |
};
|
|
|
c401cc |
|
|
|
c401cc |
+typedef struct _virDomainDeviceISAAddress virDomainDeviceISAAddress;
|
|
|
c401cc |
+typedef virDomainDeviceISAAddress *virDomainDeviceISAAddressPtr;
|
|
|
c401cc |
+struct _virDomainDeviceISAAddress {
|
|
|
c401cc |
+ unsigned int iobase;
|
|
|
c401cc |
+ unsigned int irq;
|
|
|
c401cc |
+};
|
|
|
c401cc |
+
|
|
|
c401cc |
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
|
|
|
c401cc |
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
|
|
|
c401cc |
struct _virDomainDeviceInfo {
|
|
|
c401cc |
@@ -300,6 +308,7 @@ struct _virDomainDeviceInfo {
|
|
|
c401cc |
virDomainDeviceUSBAddress usb;
|
|
|
c401cc |
virDomainDeviceSpaprVioAddress spaprvio;
|
|
|
c401cc |
virDomainDeviceCCWAddress ccw;
|
|
|
c401cc |
+ virDomainDeviceISAAddress isa;
|
|
|
c401cc |
} addr;
|
|
|
c401cc |
int mastertype;
|
|
|
c401cc |
union {
|
|
|
c401cc |
--
|
|
|
c401cc |
1.8.5.1
|
|
|
c401cc |
|