Fix launching ARM guests on x86 (patches posted upstream, F20 feature)
This commit is contained in:
parent
db2858c661
commit
2daa92daf9
@ -1,5 +1,4 @@
|
||||
From 0e671a1646df543eab683b38f6644f70d12fbee1 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <0e671a1646df543eab683b38f6644f70d12fbee1.1376524611.git.crobinso@redhat.com>
|
||||
From 815828b54398429bddb290d954e6b0291e8831a4 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
Date: Mon, 5 Aug 2013 10:27:23 -0600
|
||||
Subject: [PATCH] xen: fix memory corruption in legacy driver
|
||||
@ -25,15 +24,17 @@ of havoc in libvirtd such as aborts like the following
|
||||
/lib64/libc.so.6(clone+0x6d)[0x7ffff400e7dd]
|
||||
|
||||
Fix by initializing ret to 0 and only setting to error on failure path.
|
||||
|
||||
(cherry picked from commit 0e671a1646df543eab683b38f6644f70d12fbee1)
|
||||
---
|
||||
src/xen/xend_internal.c | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
|
||||
index 1ce36e6..f698c8d 100644
|
||||
index 9d61fca..01e74bd 100644
|
||||
--- a/src/xen/xend_internal.c
|
||||
+++ b/src/xen/xend_internal.c
|
||||
@@ -2896,7 +2896,7 @@ xenDaemonListDefinedDomains(virConnectPtr conn,
|
||||
@@ -2897,7 +2897,7 @@ xenDaemonListDefinedDomains(virConnectPtr conn,
|
||||
{
|
||||
struct sexpr *root = NULL;
|
||||
size_t i;
|
||||
@ -42,7 +43,7 @@ index 1ce36e6..f698c8d 100644
|
||||
struct sexpr *_for_i, *node;
|
||||
|
||||
if (maxnames == 0)
|
||||
@@ -2919,16 +2919,15 @@ xenDaemonListDefinedDomains(virConnectPtr conn,
|
||||
@@ -2920,16 +2920,15 @@ xenDaemonListDefinedDomains(virConnectPtr conn,
|
||||
break;
|
||||
}
|
||||
|
||||
@ -61,6 +62,3 @@ index 1ce36e6..f698c8d 100644
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
|
@ -0,0 +1,89 @@
|
||||
From ba3daaef85007c5ef48c0057284654cd22c168f7 Mon Sep 17 00:00:00 2001
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Fri, 2 Aug 2013 04:13:33 -0400
|
||||
Subject: [PATCH] conf: add default USB controller in qemu post-parse callback
|
||||
|
||||
The parser shouldn't be doing arch-specific things like adding in
|
||||
implicit controllers to the config. This should instead be done in the
|
||||
hypervisor's post-parse callback.
|
||||
|
||||
This patch removes the auto-add of a usb controller from the domain
|
||||
parser, and puts it into the qemu driver's post-parse callback (just
|
||||
as is already done with the auto-add of the pci-root controller). In
|
||||
the future, any machine/arch that shouldn't have a default usb
|
||||
controller added should just set addDefaultUSB = false in this
|
||||
function.
|
||||
|
||||
We've recently seen that q35 and ARMV7L domains shouldn't get a default USB
|
||||
controller, so I've set addDefaultUSB to false for both of those.
|
||||
|
||||
(cherry picked from commit c66da9d224ffba1d972beaf049c00dbebda4e8ea)
|
||||
---
|
||||
src/conf/domain_conf.c | 6 ------
|
||||
src/qemu/qemu_domain.c | 14 +++++++++++++-
|
||||
2 files changed, 13 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 783df96..18c6acf 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -11718,12 +11718,6 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
goto error;
|
||||
}
|
||||
|
||||
- if (def->virtType == VIR_DOMAIN_VIRT_QEMU ||
|
||||
- def->virtType == VIR_DOMAIN_VIRT_KQEMU ||
|
||||
- def->virtType == VIR_DOMAIN_VIRT_KVM)
|
||||
- if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, 0, -1) < 0)
|
||||
- goto error;
|
||||
-
|
||||
/* analysis of the resource leases */
|
||||
if ((n = virXPathNodeSet("./devices/lease", ctxt, &nodes)) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index da3b768..648121a 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -699,6 +699,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
+ bool addDefaultUSB = true;
|
||||
bool addPCIRoot = false;
|
||||
|
||||
/* check for emulator and create a default one if needed */
|
||||
@@ -714,8 +715,10 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
break;
|
||||
if (STRPREFIX(def->os.machine, "pc-q35") ||
|
||||
STREQ(def->os.machine, "q35") ||
|
||||
- STREQ(def->os.machine, "isapc"))
|
||||
+ STREQ(def->os.machine, "isapc")) {
|
||||
+ addDefaultUSB = false;
|
||||
break;
|
||||
+ }
|
||||
if (!STRPREFIX(def->os.machine, "pc-0.") &&
|
||||
!STRPREFIX(def->os.machine, "pc-1.") &&
|
||||
!STRPREFIX(def->os.machine, "pc-i440") &&
|
||||
@@ -725,6 +728,10 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
addPCIRoot = true;
|
||||
break;
|
||||
|
||||
+ case VIR_ARCH_ARMV7L:
|
||||
+ addDefaultUSB = false;
|
||||
+ break;
|
||||
+
|
||||
case VIR_ARCH_ALPHA:
|
||||
case VIR_ARCH_PPC:
|
||||
case VIR_ARCH_PPC64:
|
||||
@@ -737,6 +744,11 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
break;
|
||||
}
|
||||
|
||||
+ if (addDefaultUSB &&
|
||||
+ virDomainDefMaybeAddController(
|
||||
+ def, VIR_DOMAIN_CONTROLLER_TYPE_USB, 0, -1) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
if (addPCIRoot &&
|
||||
virDomainDefMaybeAddController(
|
||||
def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0,
|
300
0003-qemu-rename-some-functions-in-qemu_command.c.patch
Normal file
300
0003-qemu-rename-some-functions-in-qemu_command.c.patch
Normal file
@ -0,0 +1,300 @@
|
||||
From b90db10aa95fe048b039e2605884c300a1e00726 Mon Sep 17 00:00:00 2001
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Fri, 26 Jul 2013 21:04:18 -0400
|
||||
Subject: [PATCH] qemu: rename some functions in qemu_command.c
|
||||
|
||||
* qemuDomainPCIAddressSetNextAddr
|
||||
|
||||
The name of this function was confusing because 1) other functions in
|
||||
the file that end in "Addr" are only operating on a single function of
|
||||
one PCI slot, not the entire slot, while functions that do something
|
||||
with the entire slot end in "Slot", and 2) it didn't contain a verb
|
||||
describing what it is doing (the "Set" refers to the set that contains
|
||||
all PCI buses in the system, used to keep track of which slots in
|
||||
which buses are already reserved for use).
|
||||
|
||||
It is now renamed to qemuDomainPCIAddressReserveNextSlot, which more
|
||||
clearly describes what it is doing. Arguably, it could have been
|
||||
changed to qemuDomainPCIAddressSetReserveNextSlot, but 1) the word
|
||||
"set" is confusing in this context because it could be intended as a
|
||||
verb or as a noun, and 2) most other functions that operate on a
|
||||
single slot or address within this set are also named
|
||||
qemuDomainPCIAddress... rather than qemuDomainPCIAddressSet... Only
|
||||
the Create, Free, and Grow functions for an address set (which modify the
|
||||
entire set, not just one element) use "Set" in their name.
|
||||
|
||||
* qemuPCIAddressAsString, qemuPCIAddressValidate
|
||||
|
||||
All the other functions in this set are named
|
||||
qemuDomainPCIAddressxxxxx, so I renamed these to be consistent.
|
||||
|
||||
(cherry picked from commit 29e3a1df474aeb35b5eeca4930e7748cd2664472)
|
||||
---
|
||||
src/qemu/qemu_command.c | 78 ++++++++++++++++++++++++++++++-------------------
|
||||
src/qemu/qemu_command.h | 6 ++--
|
||||
2 files changed, 51 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index aa3a2fd..4345456 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -1439,9 +1439,9 @@ struct _qemuDomainPCIAddressSet {
|
||||
* with the specified PCI address set.
|
||||
*/
|
||||
static bool
|
||||
-qemuPCIAddressValidate(qemuDomainPCIAddressSetPtr addrs ATTRIBUTE_UNUSED,
|
||||
- virDevicePCIAddressPtr addr,
|
||||
- qemuDomainPCIConnectFlags flags)
|
||||
+qemuDomainPCIAddressValidate(qemuDomainPCIAddressSetPtr addrs,
|
||||
+ virDevicePCIAddressPtr addr,
|
||||
+ qemuDomainPCIConnectFlags flags)
|
||||
{
|
||||
qemuDomainPCIAddressBusPtr bus;
|
||||
|
||||
@@ -1578,7 +1578,7 @@ qemuDomainPCIAddressSetGrow(qemuDomainPCIAddressSetPtr addrs,
|
||||
|
||||
|
||||
static char *
|
||||
-qemuPCIAddressAsString(virDevicePCIAddressPtr addr)
|
||||
+qemuDomainPCIAddressAsString(virDevicePCIAddressPtr addr)
|
||||
{
|
||||
char *str;
|
||||
|
||||
@@ -1648,10 +1648,10 @@ qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
* that the bus is of the correct type for the device (via
|
||||
* comparing the flags).
|
||||
*/
|
||||
- if (!qemuPCIAddressValidate(addrs, addr, flags))
|
||||
+ if (!qemuDomainPCIAddressValidate(addrs, addr, flags))
|
||||
return -1;
|
||||
|
||||
- if (!(str = qemuPCIAddressAsString(addr)))
|
||||
+ if (!(str = qemuDomainPCIAddressAsString(addr)))
|
||||
goto cleanup;
|
||||
|
||||
/* check if already in use */
|
||||
@@ -1729,7 +1729,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
|
||||
goto cleanup;
|
||||
/* Reserve 1 extra slot for a (potential) bridge */
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs, &info, flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for (i = 1; i < addrs->nbuses; i++) {
|
||||
@@ -1740,7 +1740,8 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
i, bus->model)) < 0)
|
||||
goto cleanup;
|
||||
/* If we added a new bridge, we will need one more address */
|
||||
- if (rv > 0 && qemuDomainPCIAddressSetNextAddr(addrs, &info, flags) < 0)
|
||||
+ if (rv > 0 && qemuDomainPCIAddressReserveNextSlot(addrs, &info,
|
||||
+ flags) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
nbuses = addrs->nbuses;
|
||||
@@ -1881,7 +1882,7 @@ qemuDomainPCIAddressReserveAddr(qemuDomainPCIAddressSetPtr addrs,
|
||||
if (addrs->dryRun && qemuDomainPCIAddressSetGrow(addrs, addr, flags) < 0)
|
||||
return -1;
|
||||
|
||||
- if (!(str = qemuPCIAddressAsString(addr)))
|
||||
+ if (!(str = qemuDomainPCIAddressAsString(addr)))
|
||||
return -1;
|
||||
|
||||
VIR_DEBUG("Reserving PCI addr %s", str);
|
||||
@@ -1923,7 +1924,7 @@ qemuDomainPCIAddressReserveSlot(qemuDomainPCIAddressSetPtr addrs,
|
||||
if (addrs->dryRun && qemuDomainPCIAddressSetGrow(addrs, addr, flags) < 0)
|
||||
return -1;
|
||||
|
||||
- if (!(str = qemuPCIAddressAsString(addr)))
|
||||
+ if (!(str = qemuDomainPCIAddressAsString(addr)))
|
||||
return -1;
|
||||
|
||||
VIR_DEBUG("Reserving PCI slot %s", str);
|
||||
@@ -1959,12 +1960,12 @@ int qemuDomainPCIAddressEnsureAddr(qemuDomainPCIAddressSetPtr addrs,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if (!qemuPCIAddressValidate(addrs, &dev->addr.pci, flags))
|
||||
+ if (!qemuDomainPCIAddressValidate(addrs, &dev->addr.pci, flags))
|
||||
return -1;
|
||||
|
||||
ret = qemuDomainPCIAddressReserveSlot(addrs, &dev->addr.pci, flags);
|
||||
} else {
|
||||
- ret = qemuDomainPCIAddressSetNextAddr(addrs, dev, flags);
|
||||
+ ret = qemuDomainPCIAddressReserveNextSlot(addrs, dev, flags);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1986,7 +1987,7 @@ qemuDomainPCIAddressReleaseSlot(qemuDomainPCIAddressSetPtr addrs,
|
||||
*/
|
||||
qemuDomainPCIConnectFlags flags = QEMU_PCI_CONNECT_TYPES_MASK;
|
||||
|
||||
- if (!qemuPCIAddressValidate(addrs, addr, flags))
|
||||
+ if (!qemuDomainPCIAddressValidate(addrs, addr, flags))
|
||||
return -1;
|
||||
|
||||
addrs->buses[addr->bus].slots[addr->slot] = 0;
|
||||
@@ -2059,9 +2060,9 @@ success:
|
||||
}
|
||||
|
||||
int
|
||||
-qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs,
|
||||
- virDomainDeviceInfoPtr dev,
|
||||
- qemuDomainPCIConnectFlags flags)
|
||||
+qemuDomainPCIAddressReserveNextSlot(qemuDomainPCIAddressSetPtr addrs,
|
||||
+ virDomainDeviceInfoPtr dev,
|
||||
+ qemuDomainPCIConnectFlags flags)
|
||||
{
|
||||
virDevicePCIAddress addr;
|
||||
if (qemuDomainPCIAddressGetNextSlot(addrs, &addr, flags) < 0)
|
||||
@@ -2188,14 +2189,16 @@ qemuValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
|
||||
primaryVideo->info.addr.pci.function = 0;
|
||||
addrptr = &primaryVideo->info.addr.pci;
|
||||
|
||||
- if (!qemuPCIAddressValidate(addrs, addrptr, flags))
|
||||
+ if (!qemuDomainPCIAddressValidate(addrs, addrptr, flags))
|
||||
goto error;
|
||||
|
||||
if (qemuDomainPCIAddressSlotInUse(addrs, addrptr)) {
|
||||
if (qemuDeviceVideoUsable) {
|
||||
virResetLastError();
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &primaryVideo->info, flags) < 0)
|
||||
- goto error;;
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs,
|
||||
+ &primaryVideo->info,
|
||||
+ flags) < 0)
|
||||
+ goto error;
|
||||
} else {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("PCI address 0:0:2.0 is in use, "
|
||||
@@ -2296,7 +2299,9 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
continue;
|
||||
if (def->controllers[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
|
||||
continue;
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->controllers[i]->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs,
|
||||
+ &def->controllers[i]->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -2307,7 +2312,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
|
||||
/* Only support VirtIO-9p-pci so far. If that changes,
|
||||
* we might need to skip devices here */
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->fss[i]->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs, &def->fss[i]->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2321,7 +2327,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
(def->nets[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)) {
|
||||
continue;
|
||||
}
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->nets[i]->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs, &def->nets[i]->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2334,7 +2341,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
def->sounds[i]->model == VIR_DOMAIN_SOUND_MODEL_PCSPK)
|
||||
continue;
|
||||
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->sounds[i]->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs, &def->sounds[i]->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2409,7 +2417,9 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||
def->controllers[i]->info.addr.pci = addr;
|
||||
} else {
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->controllers[i]->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs,
|
||||
+ &def->controllers[i]->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -2434,7 +2444,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
goto error;
|
||||
}
|
||||
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->disks[i]->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs, &def->disks[i]->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2446,7 +2457,9 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
def->hostdevs[i]->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||
continue;
|
||||
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, def->hostdevs[i]->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs,
|
||||
+ def->hostdevs[i]->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2454,7 +2467,9 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
if (def->memballoon &&
|
||||
def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
|
||||
def->memballoon->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->memballoon->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs,
|
||||
+ &def->memballoon->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2462,7 +2477,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
if (def->rng &&
|
||||
def->rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO &&
|
||||
def->rng->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->rng->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs,
|
||||
+ &def->rng->info, flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2470,7 +2486,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
if (def->watchdog &&
|
||||
def->watchdog->model != VIR_DOMAIN_WATCHDOG_MODEL_IB700 &&
|
||||
def->watchdog->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->watchdog->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs, &def->watchdog->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2483,7 +2500,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
||||
}
|
||||
if (def->videos[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
|
||||
continue;
|
||||
- if (qemuDomainPCIAddressSetNextAddr(addrs, &def->videos[i]->info, flags) < 0)
|
||||
+ if (qemuDomainPCIAddressReserveNextSlot(addrs, &def->videos[i]->info,
|
||||
+ flags) < 0)
|
||||
goto error;
|
||||
}
|
||||
for (i = 0; i < def->ninputs; i++) {
|
||||
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
|
||||
index 2b02d6e..c9f1600 100644
|
||||
--- a/src/qemu/qemu_command.h
|
||||
+++ b/src/qemu/qemu_command.h
|
||||
@@ -254,9 +254,9 @@ int qemuDomainPCIAddressReserveSlot(qemuDomainPCIAddressSetPtr addrs,
|
||||
int qemuDomainPCIAddressReserveAddr(qemuDomainPCIAddressSetPtr addrs,
|
||||
virDevicePCIAddressPtr addr,
|
||||
qemuDomainPCIConnectFlags flags);
|
||||
-int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs,
|
||||
- virDomainDeviceInfoPtr dev,
|
||||
- qemuDomainPCIConnectFlags flags);
|
||||
+int qemuDomainPCIAddressReserveNextSlot(qemuDomainPCIAddressSetPtr addrs,
|
||||
+ virDomainDeviceInfoPtr dev,
|
||||
+ qemuDomainPCIConnectFlags flags);
|
||||
int qemuDomainPCIAddressEnsureAddr(qemuDomainPCIAddressSetPtr addrs,
|
||||
virDomainDeviceInfoPtr dev);
|
||||
int qemuDomainPCIAddressReleaseAddr(qemuDomainPCIAddressSetPtr addrs,
|
3369
0004-qemu-Set-QEMU_AUDIO_DRV-none-with-nographic.patch
Normal file
3369
0004-qemu-Set-QEMU_AUDIO_DRV-none-with-nographic.patch
Normal file
File diff suppressed because it is too large
Load Diff
31
0005-qemu-Only-setup-vhost-if-virtType-kvm.patch
Normal file
31
0005-qemu-Only-setup-vhost-if-virtType-kvm.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From 9475a3ba1e808aa3fe1a975e98bcd1ac7a660d01 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Wed, 31 Jul 2013 21:37:40 -0400
|
||||
Subject: [PATCH] qemu: Only setup vhost if virtType == "kvm"
|
||||
|
||||
vhost only works in KVM mode at the moment, and is infact compiled
|
||||
out if the emulator is built for non-native architecture. While it
|
||||
may work at some point in the future for plain qemu, for now it's
|
||||
just noise on the command line (and which contributes to arm cli
|
||||
breakage).
|
||||
---
|
||||
src/qemu/qemu_command.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index d968333..6710bf0 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -441,8 +441,10 @@ qemuOpenVhostNet(virDomainDefPtr def,
|
||||
{
|
||||
size_t i;
|
||||
|
||||
- /* If the config says explicitly to not use vhost, return now */
|
||||
- if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_QEMU) {
|
||||
+ /* If running a plain QEMU guest, or
|
||||
+ * if the config says explicitly to not use vhost, return now*/
|
||||
+ if (def->virtType != VIR_DOMAIN_VIRT_KVM ||
|
||||
+ net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_QEMU) {
|
||||
*vhostfdSize = 0;
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
From a9d7a8a2f604f30f4769cdfe62a36aba28ce7368 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Fri, 16 Aug 2013 20:33:23 -0400
|
||||
Subject: [PATCH] domain_conf: Add default memballon in PostParse callbacks
|
||||
|
||||
This should be a no-op change for now.
|
||||
---
|
||||
src/qemu/qemu_domain.c | 9 +++++++++
|
||||
src/xen/xen_driver.c | 9 +++++++++
|
||||
2 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 648121a..dc7ab3e 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -755,6 +755,15 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) < 0)
|
||||
return -1;
|
||||
|
||||
+ if (!def->memballoon) {
|
||||
+ virDomainMemballoonDefPtr memballoon;
|
||||
+ if (VIR_ALLOC(memballoon) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
|
||||
+ def->memballoon = memballoon;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
|
||||
index 4ae38d3..780230f 100644
|
||||
--- a/src/xen/xen_driver.c
|
||||
+++ b/src/xen/xen_driver.c
|
||||
@@ -330,6 +330,15 @@ xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
STRNEQ(def->os.type, "hvm"))
|
||||
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
||||
|
||||
+ if (!def->memballoon) {
|
||||
+ virDomainMemballoonDefPtr memballoon;
|
||||
+ if (VIR_ALLOC(memballoon) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_XEN;
|
||||
+ def->memballoon = memballoon;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
224
0007-qemu-Don-t-add-default-memballoon-device-on-ARM.patch
Normal file
224
0007-qemu-Don-t-add-default-memballoon-device-on-ARM.patch
Normal file
@ -0,0 +1,224 @@
|
||||
From 56aa5100965134dcc9773dcb47c2cf88b26717f9 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue, 30 Jul 2013 15:41:14 -0400
|
||||
Subject: [PATCH] qemu: Don't add default memballoon device on ARM
|
||||
|
||||
And add test cases for a basic working ARM guest.
|
||||
---
|
||||
docs/schemas/domaincommon.rng | 19 +++++++++++++
|
||||
src/conf/domain_conf.c | 14 ---------
|
||||
src/qemu/qemu_domain.c | 4 ++-
|
||||
.../qemuxml2argv-arm-vexpressa9-nodevs.args | 5 ++++
|
||||
.../qemuxml2argv-arm-vexpressa9-nodevs.xml | 26 +++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 3 ++
|
||||
tests/testutilsqemu.c | 33 ++++++++++++++++++++++
|
||||
7 files changed, 89 insertions(+), 15 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.args
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.xml
|
||||
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 745b959..781ecfd 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -303,6 +303,7 @@
|
||||
<ref name="hvmppc"/>
|
||||
<ref name="hvmppc64"/>
|
||||
<ref name="hvms390"/>
|
||||
+ <ref name="hvmarm"/>
|
||||
</choice>
|
||||
</optional>
|
||||
<value>hvm</value>
|
||||
@@ -412,6 +413,24 @@
|
||||
</optional>
|
||||
</group>
|
||||
</define>
|
||||
+ <define name="hvmarm">
|
||||
+ <group>
|
||||
+ <optional>
|
||||
+ <attribute name="arch">
|
||||
+ <choice>
|
||||
+ <value>armv7l</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="machine">
|
||||
+ <data type="string">
|
||||
+ <param name="pattern">[a-zA-Z0-9_\.\-]+</param>
|
||||
+ </data>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ </group>
|
||||
+ </define>
|
||||
<define name="osexe">
|
||||
<element name="os">
|
||||
<element name="type">
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 18c6acf..8ede44d 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -8801,7 +8801,6 @@ virDomainVideoDefaultRAM(virDomainDefPtr def,
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
int
|
||||
virDomainVideoDefaultType(virDomainDefPtr def)
|
||||
{
|
||||
@@ -12136,19 +12135,6 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
|
||||
def->memballoon = memballoon;
|
||||
VIR_FREE(nodes);
|
||||
- } else {
|
||||
- if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
|
||||
- def->virtType == VIR_DOMAIN_VIRT_QEMU ||
|
||||
- def->virtType == VIR_DOMAIN_VIRT_KQEMU ||
|
||||
- def->virtType == VIR_DOMAIN_VIRT_KVM) {
|
||||
- virDomainMemballoonDefPtr memballoon;
|
||||
- if (VIR_ALLOC(memballoon) < 0)
|
||||
- goto error;
|
||||
- memballoon->model = def->virtType == VIR_DOMAIN_VIRT_XEN ?
|
||||
- VIR_DOMAIN_MEMBALLOON_MODEL_XEN :
|
||||
- VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
|
||||
- def->memballoon = memballoon;
|
||||
- }
|
||||
}
|
||||
|
||||
/* Parse the RNG device */
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index dc7ab3e..36df403 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -701,6 +701,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
{
|
||||
bool addDefaultUSB = true;
|
||||
bool addPCIRoot = false;
|
||||
+ bool addDefaultMemballoon = true;
|
||||
|
||||
/* check for emulator and create a default one if needed */
|
||||
if (!def->emulator &&
|
||||
@@ -730,6 +731,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
|
||||
case VIR_ARCH_ARMV7L:
|
||||
addDefaultUSB = false;
|
||||
+ addDefaultMemballoon = false;
|
||||
break;
|
||||
|
||||
case VIR_ARCH_ALPHA:
|
||||
@@ -755,7 +757,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) < 0)
|
||||
return -1;
|
||||
|
||||
- if (!def->memballoon) {
|
||||
+ if (addDefaultMemballoon && !def->memballoon) {
|
||||
virDomainMemballoonDefPtr memballoon;
|
||||
if (VIR_ALLOC(memballoon) < 0)
|
||||
return -1;
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.args b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.args
|
||||
new file mode 100644
|
||||
index 0000000..794dba2
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.args
|
||||
@@ -0,0 +1,5 @@
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-arm -S -M vexpress-a9 -m 1024 -smp 1 -nographic \
|
||||
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
+-boot c -kernel /arm.kernel -initrd /arm.initrd \
|
||||
+-append console=ttyAMA0,115200n8 -dtb /arm.dtb -usb
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.xml b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.xml
|
||||
new file mode 100644
|
||||
index 0000000..3f318c8
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.xml
|
||||
@@ -0,0 +1,26 @@
|
||||
+<domain type="qemu">
|
||||
+ <name>armtest</name>
|
||||
+ <uuid>496d7ea8-9739-544b-4ebd-ef08be936e6a</uuid>
|
||||
+ <memory>1048576</memory>
|
||||
+ <currentMemory>1048576</currentMemory>
|
||||
+ <vcpu>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch="armv7l" machine="vexpress-a9">hvm</type>
|
||||
+ <kernel>/arm.kernel</kernel>
|
||||
+ <initrd>/arm.initrd</initrd>
|
||||
+ <dtb>/arm.dtb</dtb>
|
||||
+ <cmdline>console=ttyAMA0,115200n8</cmdline>
|
||||
+ </os>
|
||||
+ <features>
|
||||
+ <acpi/>
|
||||
+ <apic/>
|
||||
+ <pae/>
|
||||
+ </features>
|
||||
+ <clock offset="utc"/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>restart</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-arm</emulator>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index b7485fc..361ddb8 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1027,6 +1027,9 @@ mymain(void)
|
||||
DO_TEST_PARSE_ERROR("pci-root-address",
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE);
|
||||
|
||||
+ DO_TEST("arm-vexpressa9-nodevs",
|
||||
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
|
||||
+
|
||||
virObjectUnref(driver.config);
|
||||
virObjectUnref(driver.caps);
|
||||
virObjectUnref(driver.xmlopt);
|
||||
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
|
||||
index fac83b2..92433ef 100644
|
||||
--- a/tests/testutilsqemu.c
|
||||
+++ b/tests/testutilsqemu.c
|
||||
@@ -145,6 +145,36 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static int testQemuAddArmGuest(virCapsPtr caps)
|
||||
+{
|
||||
+ static const char *machines[] = { "vexpress-a9",
|
||||
+ "vexpress-a15",
|
||||
+ "versatilepb" };
|
||||
+ virCapsGuestMachinePtr *capsmachines = NULL;
|
||||
+ virCapsGuestPtr guest;
|
||||
+
|
||||
+ capsmachines = virCapabilitiesAllocMachines(machines,
|
||||
+ ARRAY_CARDINALITY(machines));
|
||||
+ if (!capsmachines)
|
||||
+ goto error;
|
||||
+
|
||||
+ guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_ARMV7L,
|
||||
+ "/usr/bin/qemu-system-arm", NULL,
|
||||
+ ARRAY_CARDINALITY(machines),
|
||||
+ capsmachines);
|
||||
+ if (!guest)
|
||||
+ goto error;
|
||||
+
|
||||
+ if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
|
||||
+ goto error;
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+error:
|
||||
+ virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines));
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
|
||||
virCapsPtr testQemuCapsInit(void) {
|
||||
virCapsPtr caps;
|
||||
@@ -270,6 +300,9 @@ virCapsPtr testQemuCapsInit(void) {
|
||||
if (testQemuAddS390Guest(caps))
|
||||
goto cleanup;
|
||||
|
||||
+ if (testQemuAddArmGuest(caps))
|
||||
+ goto cleanup;
|
||||
+
|
||||
if (virTestGetDebug()) {
|
||||
char *caps_str;
|
||||
|
156
0008-qemu-Fix-adding-specifying-char-devs-for-ARM.patch
Normal file
156
0008-qemu-Fix-adding-specifying-char-devs-for-ARM.patch
Normal file
@ -0,0 +1,156 @@
|
||||
From 2797780706ba62cff67540be18e59d0fd6438389 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue, 30 Jul 2013 17:49:11 -0400
|
||||
Subject: [PATCH] qemu: Fix adding specifying char devs for ARM
|
||||
|
||||
QEMU ARM boards don't give us any way to explicitly wire in
|
||||
a -chardev, so use the old style -serial options.
|
||||
|
||||
Unfortunately this isn't as simple as just turning off the CHARDEV flag
|
||||
for qemu-system-arm, as upcoming virtio support _will_ use device/chardev.
|
||||
---
|
||||
src/qemu/qemu_capabilities.c | 18 ++++++++++++++++++
|
||||
src/qemu/qemu_capabilities.h | 4 ++++
|
||||
src/qemu/qemu_command.c | 3 +--
|
||||
src/qemu/qemu_process.c | 37 ++++++++++++++++++++++---------------
|
||||
4 files changed, 45 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index 08406b8..5c8316f 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -2810,3 +2810,21 @@ virQEMUCapsUsedQMP(virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
return qemuCaps->usedQMP;
|
||||
}
|
||||
+
|
||||
+bool
|
||||
+virQEMUCapsSupportsChardev(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainChrDefPtr chr ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) ||
|
||||
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
+ return false;
|
||||
+
|
||||
+ /* This may not be true for all ARM machine types, but at least
|
||||
+ * the only supported serial devices of vexpress and versatile
|
||||
+ * don't have the -chardev property wired up. */
|
||||
+ if (def->os.arch != VIR_ARCH_ARMV7L)
|
||||
+ return false;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index f5f685d..56f8405 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -272,4 +272,8 @@ int virQEMUCapsParseDeviceStr(virQEMUCapsPtr qemuCaps, const char *str);
|
||||
VIR_ENUM_DECL(virQEMUCaps);
|
||||
|
||||
bool virQEMUCapsUsedQMP(virQEMUCapsPtr qemuCaps);
|
||||
+bool virQEMUCapsSupportsChardev(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainChrDefPtr chr);
|
||||
+
|
||||
#endif /* __QEMU_CAPABILITIES_H__*/
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 6710bf0..e6000d9 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -7996,8 +7996,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
char *devstr;
|
||||
|
||||
/* Use -chardev with -device if they are available */
|
||||
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
+ if (virQEMUCapsSupportsChardev(def, qemuCaps, serial)) {
|
||||
virCommandAddArg(cmd, "-chardev");
|
||||
if (!(devstr = qemuBuildChrChardevStr(&serial->source,
|
||||
serial->info.alias,
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index d631a6f..57036e8 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -1583,22 +1583,25 @@ qemuProcessExtractTTYPath(const char *haystack,
|
||||
}
|
||||
|
||||
static int
|
||||
-qemuProcessLookupPTYs(virDomainChrDefPtr *devices,
|
||||
+qemuProcessLookupPTYs(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainChrDefPtr *devices,
|
||||
int count,
|
||||
- virHashTablePtr paths,
|
||||
- bool chardevfmt)
|
||||
+ virHashTablePtr paths)
|
||||
{
|
||||
size_t i;
|
||||
- const char *prefix = chardevfmt ? "char" : "";
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
virDomainChrDefPtr chr = devices[i];
|
||||
+ bool chardevfmt = virQEMUCapsSupportsChardev(def, qemuCaps, chr);
|
||||
+
|
||||
if (chr->source.type == VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
char id[32];
|
||||
const char *path;
|
||||
|
||||
if (snprintf(id, sizeof(id), "%s%s",
|
||||
- prefix, chr->info.alias) >= sizeof(id))
|
||||
+ chardevfmt ? "char" : "",
|
||||
+ chr->info.alias) >= sizeof(id))
|
||||
return -1;
|
||||
|
||||
path = (const char *) virHashLookup(paths, id);
|
||||
@@ -1632,19 +1635,21 @@ qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
virHashTablePtr paths)
|
||||
{
|
||||
- bool chardevfmt = virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV);
|
||||
size_t i = 0;
|
||||
|
||||
- if (qemuProcessLookupPTYs(vm->def->serials, vm->def->nserials,
|
||||
- paths, chardevfmt) < 0)
|
||||
+ if (qemuProcessLookupPTYs(vm->def, qemuCaps,
|
||||
+ vm->def->serials, vm->def->nserials,
|
||||
+ paths) < 0)
|
||||
return -1;
|
||||
|
||||
- if (qemuProcessLookupPTYs(vm->def->parallels, vm->def->nparallels,
|
||||
- paths, chardevfmt) < 0)
|
||||
+ if (qemuProcessLookupPTYs(vm->def, qemuCaps,
|
||||
+ vm->def->parallels, vm->def->nparallels,
|
||||
+ paths) < 0)
|
||||
return -1;
|
||||
|
||||
- if (qemuProcessLookupPTYs(vm->def->channels, vm->def->nchannels,
|
||||
- paths, chardevfmt) < 0)
|
||||
+ if (qemuProcessLookupPTYs(vm->def, qemuCaps,
|
||||
+ vm->def->channels, vm->def->nchannels,
|
||||
+ paths) < 0)
|
||||
return -1;
|
||||
/* For historical reasons, console[0] can be just an alias
|
||||
* for serial[0]. That's why we need to update it as well. */
|
||||
@@ -1662,8 +1667,9 @@ qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm,
|
||||
}
|
||||
}
|
||||
|
||||
- if (qemuProcessLookupPTYs(vm->def->consoles + i, vm->def->nconsoles - i,
|
||||
- paths, chardevfmt) < 0)
|
||||
+ if (qemuProcessLookupPTYs(vm->def, qemuCaps,
|
||||
+ vm->def->consoles + i, vm->def->nconsoles - i,
|
||||
+ paths) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@@ -1753,7 +1759,8 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
|
||||
virHashTablePtr paths = NULL;
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
|
||||
- if (!virQEMUCapsUsedQMP(qemuCaps) && pos != -1) {
|
||||
+ if (!virQEMUCapsUsedQMP(qemuCaps)
|
||||
+ && pos != -1) {
|
||||
if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0)
|
||||
return -1;
|
||||
|
43
0009-qemu-Don-t-try-to-allocate-PCI-addresses-for-ARM.patch
Normal file
43
0009-qemu-Don-t-try-to-allocate-PCI-addresses-for-ARM.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From d859b21108e4d45a7851c2be0a61895da66159a2 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue, 30 Jul 2013 18:56:15 -0400
|
||||
Subject: [PATCH] qemu: Don't try to allocate PCI addresses for ARM
|
||||
|
||||
---
|
||||
src/qemu/qemu_command.c | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index e6000d9..66b02fc 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -1694,6 +1694,16 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static bool
|
||||
+qemuDomainSupportsPCI(virDomainDefPtr def) {
|
||||
+ if (def->os.arch != VIR_ARCH_ARMV7L)
|
||||
+ return true;
|
||||
+
|
||||
+ if (STREQ(def->os.machine, "versatilepb"))
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
|
||||
int
|
||||
qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
@@ -1760,8 +1770,10 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
|
||||
goto cleanup;
|
||||
|
||||
- if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
|
||||
- goto cleanup;
|
||||
+ if (qemuDomainSupportsPCI(def)) {
|
||||
+ if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (obj && obj->privateData) {
|
146
0010-domain_conf-Add-disk-bus-sd-wire-it-up-for-qemu.patch
Normal file
146
0010-domain_conf-Add-disk-bus-sd-wire-it-up-for-qemu.patch
Normal file
@ -0,0 +1,146 @@
|
||||
From a0d15c46d153d5574f68e18ea2f027cdb98e9390 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Wed, 31 Jul 2013 09:00:26 -0400
|
||||
Subject: [PATCH] domain_conf: Add disk bus=sd, wire it up for qemu
|
||||
|
||||
This corresponds to '-sd' and '-drive if=sd' on the qemu command line.
|
||||
Needed for many ARM boards which don't provide any other way to
|
||||
pass in storage.
|
||||
---
|
||||
docs/formatdomain.html.in | 3 ++-
|
||||
docs/schemas/domaincommon.rng | 1 +
|
||||
src/conf/domain_conf.c | 4 +++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_command.c | 20 +++++++++++++++-----
|
||||
5 files changed, 22 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 78e132e..1314806 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -1660,7 +1660,8 @@
|
||||
as a device ordering hint. The optional <code>bus</code>
|
||||
attribute specifies the type of disk device to emulate;
|
||||
possible values are driver specific, with typical values being
|
||||
- "ide", "scsi", "virtio", "xen", "usb" or "sata". If omitted, the bus
|
||||
+ "ide", "scsi", "virtio", "xen", "usb", "sata", or
|
||||
+ "sd" <span class="since">"sd" since 1.1.2</span>. If omitted, the bus
|
||||
type is inferred from the style of the device name (e.g. a device named
|
||||
'sda' will typically be exported using a SCSI bus). The optional
|
||||
attribute <code>tray</code> indicates the tray status of the
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 781ecfd..4f4564b 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -1286,6 +1286,7 @@
|
||||
<value>usb</value>
|
||||
<value>uml</value>
|
||||
<value>sata</value>
|
||||
+ <value>sd</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 8ede44d..5485d86 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -239,7 +239,8 @@ VIR_ENUM_IMPL(virDomainDiskBus, VIR_DOMAIN_DISK_BUS_LAST,
|
||||
"xen",
|
||||
"usb",
|
||||
"uml",
|
||||
- "sata")
|
||||
+ "sata",
|
||||
+ "sd")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainDiskCache, VIR_DOMAIN_DISK_CACHE_LAST,
|
||||
"default",
|
||||
@@ -17227,6 +17228,7 @@ virDiskNameToBusDeviceIndex(const virDomainDiskDefPtr disk,
|
||||
case VIR_DOMAIN_DISK_BUS_USB:
|
||||
case VIR_DOMAIN_DISK_BUS_VIRTIO:
|
||||
case VIR_DOMAIN_DISK_BUS_XEN:
|
||||
+ case VIR_DOMAIN_DISK_BUS_SD:
|
||||
default:
|
||||
*busIdx = 0;
|
||||
*devIdx = idx;
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index abf024c..cf075e1 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -508,6 +508,7 @@ enum virDomainDiskBus {
|
||||
VIR_DOMAIN_DISK_BUS_USB,
|
||||
VIR_DOMAIN_DISK_BUS_UML,
|
||||
VIR_DOMAIN_DISK_BUS_SATA,
|
||||
+ VIR_DOMAIN_DISK_BUS_SD,
|
||||
|
||||
VIR_DOMAIN_DISK_BUS_LAST
|
||||
};
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 66b02fc..d4ab1a6 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -73,7 +73,8 @@ VIR_ENUM_IMPL(virDomainDiskQEMUBus, VIR_DOMAIN_DISK_BUS_LAST,
|
||||
"xen",
|
||||
"usb",
|
||||
"uml",
|
||||
- "sata")
|
||||
+ "sata",
|
||||
+ "sd")
|
||||
|
||||
|
||||
VIR_ENUM_DECL(qemuDiskCacheV1)
|
||||
@@ -646,6 +647,9 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
|
||||
case VIR_DOMAIN_DISK_BUS_XEN:
|
||||
ret = virAsprintf(&dev_name, "xenblk%d", devid);
|
||||
break;
|
||||
+ case VIR_DOMAIN_DISK_BUS_SD:
|
||||
+ ret = virAsprintf(&dev_name, "sd%d", devid);
|
||||
+ break;
|
||||
default:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Unsupported disk name mapping for bus '%s'"),
|
||||
@@ -3406,7 +3410,9 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_BUS_XEN:
|
||||
- /* Xen has no address type currently, so assign based on index */
|
||||
+ case VIR_DOMAIN_DISK_BUS_SD:
|
||||
+ /* Xen and SD have no address type currently, so assign
|
||||
+ * based on index */
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7693,12 +7699,13 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
virCommandAddArg(cmd, "-drive");
|
||||
|
||||
/* Unfortunately it is not possible to use
|
||||
- -device for floppies, or Xen paravirt
|
||||
+ -device for floppies, xen PV, or SD
|
||||
devices. Fortunately, those don't need
|
||||
static PCI addresses, so we don't really
|
||||
care that we can't use -device */
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
- if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN) {
|
||||
+ if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN &&
|
||||
+ disk->bus != VIR_DOMAIN_DISK_BUS_SD) {
|
||||
withDeviceArg = true;
|
||||
} else {
|
||||
virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
|
||||
@@ -9383,6 +9390,8 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
||||
def->bus = VIR_DOMAIN_DISK_BUS_VIRTIO;
|
||||
else if (STREQ(values[i], "xen"))
|
||||
def->bus = VIR_DOMAIN_DISK_BUS_XEN;
|
||||
+ else if (STREQ(values[i], "sd"))
|
||||
+ def->bus = VIR_DOMAIN_DISK_BUS_SD;
|
||||
} else if (STREQ(keywords[i], "media")) {
|
||||
if (STREQ(values[i], "cdrom")) {
|
||||
def->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
||||
@@ -9532,7 +9541,8 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
||||
|
||||
if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) {
|
||||
ignore_value(VIR_STRDUP(def->dst, "hda"));
|
||||
- } else if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
|
||||
+ } else if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI ||
|
||||
+ def->bus == VIR_DOMAIN_DISK_BUS_SD) {
|
||||
ignore_value(VIR_STRDUP(def->dst, "sda"));
|
||||
} else if (def->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
||||
ignore_value(VIR_STRDUP(def->dst, "vda"));
|
206
0011-qemu-Fix-networking-for-ARM-guests.patch
Normal file
206
0011-qemu-Fix-networking-for-ARM-guests.patch
Normal file
@ -0,0 +1,206 @@
|
||||
From 2661a048446d64fa0e4f6516ca7295e6087b5ec7 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue, 30 Jul 2013 18:51:30 -0400
|
||||
Subject: [PATCH] qemu: Fix networking for ARM guests
|
||||
|
||||
Similar to the chardev bit, ARM boards depend on the old style '-net nic'
|
||||
for actually instantiating net devices. But we can't block out
|
||||
-netdev altogether since it's needed for upcoming virtio support.
|
||||
|
||||
And add tests for working ARM XML with console, disk, and networking.
|
||||
---
|
||||
src/qemu/qemu_command.c | 34 ++++++++++++++++------
|
||||
src/qemu/qemu_domain.c | 20 +++++++++++--
|
||||
.../qemuxml2argv-arm-vexpressa9-basic.args | 8 +++++
|
||||
.../qemuxml2argv-arm-vexpressa9-basic.xml | 34 ++++++++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 3 ++
|
||||
5 files changed, 88 insertions(+), 11 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.args
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.xml
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index d4ab1a6..1d57ccc 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -417,6 +417,26 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static bool
|
||||
+qemuDomainSupportsNicdev(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
+ return false;
|
||||
+
|
||||
+ /* arm boards require legacy -net nic */
|
||||
+ if (def->os.arch == VIR_ARCH_ARMV7L)
|
||||
+ return false;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+qemuDomainSupportsNetdev(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ if (!qemuDomainSupportsNicdev(def, qemuCaps))
|
||||
+ return false;
|
||||
+ return virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV);
|
||||
+}
|
||||
|
||||
/**
|
||||
* qemuOpenVhostNet:
|
||||
@@ -454,8 +474,7 @@ qemuOpenVhostNet(virDomainDefPtr def,
|
||||
* option), don't try to open the device.
|
||||
*/
|
||||
if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) {
|
||||
+ qemuDomainSupportsNetdev(def, qemuCaps))) {
|
||||
if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("vhost-net is not supported with "
|
||||
@@ -6872,8 +6891,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
*
|
||||
* NB, no support for -netdev without use of -device
|
||||
*/
|
||||
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
+ if (qemuDomainSupportsNetdev(def, qemuCaps)) {
|
||||
if (!(host = qemuBuildHostNetStr(net, driver,
|
||||
',', vlan,
|
||||
tapfdName, tapfdSize,
|
||||
@@ -6881,7 +6899,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-netdev", host, NULL);
|
||||
}
|
||||
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
+ if (qemuDomainSupportsNicdev(def, qemuCaps)) {
|
||||
if (!(nic = qemuBuildNicDevStr(net, vlan, bootindex, qemuCaps)))
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-device", nic, NULL);
|
||||
@@ -6890,8 +6908,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-net", nic, NULL);
|
||||
}
|
||||
- if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) {
|
||||
+ if (!qemuDomainSupportsNetdev(def, qemuCaps)) {
|
||||
if (!(host = qemuBuildHostNetStr(net, driver,
|
||||
',', vlan,
|
||||
tapfdName, tapfdSize,
|
||||
@@ -7888,8 +7905,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
int vlan;
|
||||
|
||||
/* VLANs are not used with -netdev, so don't record them */
|
||||
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
+ if (qemuDomainSupportsNetdev(def, qemuCaps))
|
||||
vlan = -1;
|
||||
else
|
||||
vlan = i;
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 36df403..0b3503a 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -769,6 +769,23 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static const char *
|
||||
+qemuDomainDefaultNetModel(virDomainDefPtr def) {
|
||||
+ if (def->os.arch == VIR_ARCH_S390 ||
|
||||
+ def->os.arch == VIR_ARCH_S390X)
|
||||
+ return "virtio";
|
||||
+
|
||||
+ if (def->os.arch == VIR_ARCH_ARMV7L) {
|
||||
+ if (STREQ(def->os.machine, "versatilepb"))
|
||||
+ return "smc91c111";
|
||||
+
|
||||
+ /* Incomplete. vexpress (and a few others) use this, but not all
|
||||
+ * arm boards */
|
||||
+ return "lan9118";
|
||||
+ }
|
||||
+
|
||||
+ return "rtl8139";
|
||||
+}
|
||||
|
||||
static int
|
||||
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
@@ -784,8 +801,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
dev->data.net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
|
||||
!dev->data.net->model) {
|
||||
if (VIR_STRDUP(dev->data.net->model,
|
||||
- def->os.arch == VIR_ARCH_S390 ||
|
||||
- def->os.arch == VIR_ARCH_S390X ? "virtio" : "rtl8139") < 0)
|
||||
+ qemuDomainDefaultNetModel(def)) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.args b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.args
|
||||
new file mode 100644
|
||||
index 0000000..a23fde4
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.args
|
||||
@@ -0,0 +1,8 @@
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-arm -S -M vexpress-a9 -m 1024 -smp 1 -nographic \
|
||||
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
+-boot c -kernel /arm.kernel -initrd /arm.initrd -append \
|
||||
+'console=ttyAMA0,115200n8 rw root=/dev/mmcblk0p3 rootwait physmap.enabled=0' \
|
||||
+-dtb /arm.dtb -usb -drive file=/arm.raw,if=sd,index=0 \
|
||||
+-net nic,macaddr=52:54:00:09:a4:37,vlan=0,model=lan9118,name=net0 \
|
||||
+-net user,vlan=0,name=hostnet0 -serial pty
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.xml b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.xml
|
||||
new file mode 100644
|
||||
index 0000000..ec9374f
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.xml
|
||||
@@ -0,0 +1,34 @@
|
||||
+<domain type="qemu">
|
||||
+ <name>armtest</name>
|
||||
+ <uuid>496d7ea8-9739-544b-4ebd-ef08be936e6a</uuid>
|
||||
+ <memory>1048576</memory>
|
||||
+ <currentMemory>1048576</currentMemory>
|
||||
+ <vcpu>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch="armv7l" machine="vexpress-a9">hvm</type>
|
||||
+ <kernel>/arm.kernel</kernel>
|
||||
+ <initrd>/arm.initrd</initrd>
|
||||
+ <dtb>/arm.dtb</dtb>
|
||||
+ <cmdline>console=ttyAMA0,115200n8 rw root=/dev/mmcblk0p3 rootwait physmap.enabled=0</cmdline>
|
||||
+ </os>
|
||||
+ <features>
|
||||
+ <acpi/>
|
||||
+ <apic/>
|
||||
+ <pae/>
|
||||
+ </features>
|
||||
+ <clock offset="utc"/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>restart</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-arm</emulator>
|
||||
+ <disk type='file' device='disk'>
|
||||
+ <source file='/arm.raw'/>
|
||||
+ <target dev='sda' bus='sd'/>
|
||||
+ </disk>
|
||||
+ <interface type='user'>
|
||||
+ <mac address='52:54:00:09:a4:37'/>
|
||||
+ </interface>
|
||||
+ <console type='pty'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index 361ddb8..0bf2724 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1029,6 +1029,9 @@ mymain(void)
|
||||
|
||||
DO_TEST("arm-vexpressa9-nodevs",
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
|
||||
+ DO_TEST("arm-vexpressa9-basic",
|
||||
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
|
||||
+ QEMU_CAPS_DRIVE);
|
||||
|
||||
virObjectUnref(driver.config);
|
||||
virObjectUnref(driver.caps);
|
446
0012-qemu-Support-virtio-mmio-transport-for-virtio-on-ARM.patch
Normal file
446
0012-qemu-Support-virtio-mmio-transport-for-virtio-on-ARM.patch
Normal file
@ -0,0 +1,446 @@
|
||||
From cd745209fc0b4a433ae7127bab616373e91a8a22 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Wed, 31 Jul 2013 21:40:35 -0400
|
||||
Subject: [PATCH] qemu: Support virtio-mmio transport for virtio on ARM
|
||||
|
||||
Starting with qemu 1.6, the qemu-system-arm vexpress-a9 model has a
|
||||
hardcoded virtio-mmio transport which enables attaching all virtio
|
||||
devices.
|
||||
|
||||
On the command line, we have to use virtio-XXX-device rather than
|
||||
virtio-XXX-pci, thankfully s390 already set the precedent here so
|
||||
it's fairly straight forward.
|
||||
|
||||
At the XML level, this adds a new device address type virtio-mmio.
|
||||
The controller and addressing don't have any subelements at the
|
||||
moment because we they aren't needed for this usecase, but could
|
||||
be added later if needed.
|
||||
|
||||
Add a test case for an ARM guest with one of every virtio device
|
||||
enabled.
|
||||
---
|
||||
src/conf/domain_conf.c | 12 +++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_capabilities.c | 16 ++++--
|
||||
src/qemu/qemu_capabilities.h | 1 +
|
||||
src/qemu/qemu_command.c | 65 +++++++++++++++++-----
|
||||
.../qemuxml2argv-arm-vexpressa9-virtio.args | 14 +++++
|
||||
.../qemuxml2argv-arm-vexpressa9-virtio.xml | 45 +++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 4 ++
|
||||
8 files changed, 137 insertions(+), 21 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.args
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.xml
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 5485d86..73e5af4 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -210,7 +210,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
|
||||
"usb",
|
||||
"spapr-vio",
|
||||
"virtio-s390",
|
||||
- "ccw")
|
||||
+ "ccw",
|
||||
+ "virtio-mmio")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
|
||||
"block",
|
||||
@@ -2386,6 +2387,7 @@ int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
|
||||
return 1;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
|
||||
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
|
||||
return 1;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
|
||||
@@ -3027,6 +3029,9 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
info->addr.ccw.devno);
|
||||
break;
|
||||
|
||||
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown address type '%d'"), info->type);
|
||||
@@ -3491,6 +3496,9 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
|
||||
goto cleanup;
|
||||
break;
|
||||
|
||||
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
/* Should not happen */
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -5738,6 +5746,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 &&
|
||||
+ def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Controllers must use the 'pci' address type"));
|
||||
@@ -6349,6 +6358,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 &&
|
||||
+ def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Network interfaces must use 'pci' address type"));
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index cf075e1..f0344ac 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -207,6 +207,7 @@ enum virDomainDeviceAddressType {
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO,
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW,
|
||||
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO,
|
||||
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
|
||||
};
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index 5c8316f..c4c6fbd 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -234,6 +234,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
|
||||
|
||||
"vnc-share-policy", /* 150 */
|
||||
"device-del-event",
|
||||
+ "virtio-mmio",
|
||||
);
|
||||
|
||||
struct _virQEMUCaps {
|
||||
@@ -1381,6 +1382,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
|
||||
{ "pci-bridge", QEMU_CAPS_DEVICE_PCI_BRIDGE },
|
||||
{ "vfio-pci", QEMU_CAPS_DEVICE_VFIO_PCI },
|
||||
{ "scsi-generic", QEMU_CAPS_DEVICE_SCSI_GENERIC },
|
||||
+ { "virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO },
|
||||
};
|
||||
|
||||
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
|
||||
@@ -2814,17 +2816,19 @@ virQEMUCapsUsedQMP(virQEMUCapsPtr qemuCaps)
|
||||
bool
|
||||
virQEMUCapsSupportsChardev(virDomainDefPtr def,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
- virDomainChrDefPtr chr ATTRIBUTE_UNUSED)
|
||||
+ virDomainChrDefPtr chr)
|
||||
{
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) ||
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
return false;
|
||||
|
||||
- /* This may not be true for all ARM machine types, but at least
|
||||
- * the only supported serial devices of vexpress and versatile
|
||||
- * don't have the -chardev property wired up. */
|
||||
if (def->os.arch != VIR_ARCH_ARMV7L)
|
||||
- return false;
|
||||
+ return true;
|
||||
|
||||
- return true;
|
||||
+ /* This may not be true for all ARM machine types, but at least
|
||||
+ * the only supported non-virtio serial devices of vexpress and versatile
|
||||
+ * don't have the -chardev property wired up. */
|
||||
+ return (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO ||
|
||||
+ (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
||||
+ chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO));
|
||||
}
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index 56f8405..fdb61b0 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -190,6 +190,7 @@ enum virQEMUCapsFlags {
|
||||
QEMU_CAPS_MLOCK = 149, /* -realtime mlock=on|off */
|
||||
QEMU_CAPS_VNC_SHARE_POLICY = 150, /* set display sharing policy */
|
||||
QEMU_CAPS_DEVICE_DEL_EVENT = 151, /* DEVICE_DELETED event */
|
||||
+ QEMU_CAPS_DEVICE_VIRTIO_MMIO = 152, /* -device virtio-mmio */
|
||||
|
||||
QEMU_CAPS_LAST, /* this must always be the last item */
|
||||
};
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 1d57ccc..360be4e 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -418,22 +418,27 @@ cleanup:
|
||||
}
|
||||
|
||||
static bool
|
||||
-qemuDomainSupportsNicdev(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
||||
+qemuDomainSupportsNicdev(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainNetDefPtr net)
|
||||
{
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
return false;
|
||||
|
||||
- /* arm boards require legacy -net nic */
|
||||
- if (def->os.arch == VIR_ARCH_ARMV7L)
|
||||
+ /* non-virtio ARM nics require legacy -net nic */
|
||||
+ if (def->os.arch == VIR_ARCH_ARMV7L &&
|
||||
+ net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
-qemuDomainSupportsNetdev(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
||||
+qemuDomainSupportsNetdev(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainNetDefPtr net)
|
||||
{
|
||||
- if (!qemuDomainSupportsNicdev(def, qemuCaps))
|
||||
+ if (!qemuDomainSupportsNicdev(def, qemuCaps, net))
|
||||
return false;
|
||||
return virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV);
|
||||
}
|
||||
@@ -474,7 +479,7 @@ qemuOpenVhostNet(virDomainDefPtr def,
|
||||
* option), don't try to open the device.
|
||||
*/
|
||||
if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) &&
|
||||
- qemuDomainSupportsNetdev(def, qemuCaps))) {
|
||||
+ qemuDomainSupportsNetdev(def, qemuCaps, net))) {
|
||||
if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("vhost-net is not supported with "
|
||||
@@ -1146,8 +1151,8 @@ cleanup:
|
||||
}
|
||||
|
||||
static void
|
||||
-qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def,
|
||||
- enum virDomainDeviceAddressType type)
|
||||
+qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
|
||||
+ enum virDomainDeviceAddressType type)
|
||||
{
|
||||
/*
|
||||
declare address-less virtio devices to be of address type 'type'
|
||||
@@ -1281,7 +1286,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
|
||||
|
||||
if (STREQLEN(def->os.machine, "s390-ccw", 8) &&
|
||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
||||
- qemuDomainPrimeS390VirtioDevices(
|
||||
+ qemuDomainPrimeVirtioDeviceAddresses(
|
||||
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
|
||||
|
||||
if (!(addrs = qemuDomainCCWAddressSetCreate()))
|
||||
@@ -1296,7 +1301,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
|
||||
goto cleanup;
|
||||
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
|
||||
/* deal with legacy virtio-s390 */
|
||||
- qemuDomainPrimeS390VirtioDevices(
|
||||
+ qemuDomainPrimeVirtioDeviceAddresses(
|
||||
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390);
|
||||
}
|
||||
|
||||
@@ -1319,6 +1324,18 @@ cleanup:
|
||||
|
||||
return ret;
|
||||
}
|
||||
+static int
|
||||
+qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ if (def->os.arch == VIR_ARCH_ARMV7L &&
|
||||
+ STRPREFIX(def->os.machine, "vexpress-") &&
|
||||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) {
|
||||
+ qemuDomainPrimeVirtioDeviceAddresses(
|
||||
+ def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
static int
|
||||
qemuSpaprVIOFindByReg(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
@@ -1834,6 +1851,10 @@ int qemuDomainAssignAddresses(virDomainDefPtr def,
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
+ rc = qemuDomainAssignARMVirtioMMIOAddresses(def, qemuCaps);
|
||||
+ if (rc)
|
||||
+ return rc;
|
||||
+
|
||||
return qemuDomainAssignPCIAddresses(def, qemuCaps, obj);
|
||||
}
|
||||
|
||||
@@ -3957,6 +3978,9 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
|
||||
} else if (disk->info.type ==
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
|
||||
virBufferAddLit(&opt, "virtio-blk-s390");
|
||||
+ } else if (disk->info.type ==
|
||||
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) {
|
||||
+ virBufferAddLit(&opt, "virtio-blk-device");
|
||||
} else {
|
||||
virBufferAddLit(&opt, "virtio-blk-pci");
|
||||
}
|
||||
@@ -4234,6 +4258,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
|
||||
else if (def->info.type ==
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
|
||||
virBufferAddLit(&buf, "virtio-scsi-s390");
|
||||
+ else if (def->info.type ==
|
||||
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
|
||||
+ virBufferAddLit(&buf, "virtio-scsi-device");
|
||||
else
|
||||
virBufferAddLit(&buf, "virtio-scsi-pci");
|
||||
break;
|
||||
@@ -4263,6 +4290,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
|
||||
} else if (def->info.type ==
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
|
||||
virBufferAddLit(&buf, "virtio-serial-s390");
|
||||
+ } else if (def->info.type ==
|
||||
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) {
|
||||
+ virBufferAddLit(&buf, "virtio-serial-device");
|
||||
} else {
|
||||
virBufferAddLit(&buf, "virtio-serial");
|
||||
}
|
||||
@@ -4378,6 +4408,8 @@ qemuBuildNicDevStr(virDomainNetDefPtr net,
|
||||
nic = "virtio-net-ccw";
|
||||
else if (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
|
||||
nic = "virtio-net-s390";
|
||||
+ else if (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
|
||||
+ nic = "virtio-net-device";
|
||||
else
|
||||
nic = "virtio-net-pci";
|
||||
|
||||
@@ -4622,6 +4654,9 @@ qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev,
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
|
||||
virBufferAddLit(&buf, "virtio-balloon-ccw");
|
||||
break;
|
||||
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
|
||||
+ virBufferAddLit(&buf, "virtio-balloon-device");
|
||||
+ break;
|
||||
default:
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("memballoon unsupported with address type '%s'"),
|
||||
@@ -5615,6 +5650,8 @@ qemuBuildRNGDeviceArgs(virCommandPtr cmd,
|
||||
virBufferAsprintf(&buf, "virtio-rng-ccw,rng=%s", dev->info.alias);
|
||||
else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
|
||||
virBufferAsprintf(&buf, "virtio-rng-s390,rng=%s", dev->info.alias);
|
||||
+ else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
|
||||
+ virBufferAsprintf(&buf, "virtio-rng-device,rng=%s", dev->info.alias);
|
||||
else
|
||||
virBufferAsprintf(&buf, "virtio-rng-pci,rng=%s", dev->info.alias);
|
||||
|
||||
@@ -6891,7 +6928,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
*
|
||||
* NB, no support for -netdev without use of -device
|
||||
*/
|
||||
- if (qemuDomainSupportsNetdev(def, qemuCaps)) {
|
||||
+ if (qemuDomainSupportsNetdev(def, qemuCaps, net)) {
|
||||
if (!(host = qemuBuildHostNetStr(net, driver,
|
||||
',', vlan,
|
||||
tapfdName, tapfdSize,
|
||||
@@ -6899,7 +6936,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-netdev", host, NULL);
|
||||
}
|
||||
- if (qemuDomainSupportsNicdev(def, qemuCaps)) {
|
||||
+ if (qemuDomainSupportsNicdev(def, qemuCaps, net)) {
|
||||
if (!(nic = qemuBuildNicDevStr(net, vlan, bootindex, qemuCaps)))
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-device", nic, NULL);
|
||||
@@ -6908,7 +6945,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-net", nic, NULL);
|
||||
}
|
||||
- if (!qemuDomainSupportsNetdev(def, qemuCaps)) {
|
||||
+ if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) {
|
||||
if (!(host = qemuBuildHostNetStr(net, driver,
|
||||
',', vlan,
|
||||
tapfdName, tapfdSize,
|
||||
@@ -7905,7 +7942,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
int vlan;
|
||||
|
||||
/* VLANs are not used with -netdev, so don't record them */
|
||||
- if (qemuDomainSupportsNetdev(def, qemuCaps))
|
||||
+ if (qemuDomainSupportsNetdev(def, qemuCaps, net))
|
||||
vlan = -1;
|
||||
else
|
||||
vlan = i;
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.args
|
||||
new file mode 100644
|
||||
index 0000000..62de9d3
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.args
|
||||
@@ -0,0 +1,14 @@
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-arm -S -M vexpress-a9 -m 1024 -smp 1 -nographic \
|
||||
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
+-boot c -kernel /arm.kernel -initrd /arm.initrd -append \
|
||||
+'console=ttyAMA0,115200n8 rw root=/dev/vda3 rootwait physmap.enabled=0' \
|
||||
+-dtb /arm.dtb -device virtio-serial-device,id=virtio-serial0 -usb \
|
||||
+-drive file=/arm.raw,if=none,id=drive-virtio-disk0 \
|
||||
+-device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
+-device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
|
||||
+-net user,vlan=0,name=hostnet0 -serial pty -chardev pty,id=charconsole1 \
|
||||
+-device virtconsole,chardev=charconsole1,id=console1 \
|
||||
+-device virtio-balloon-device,id=balloon0 \
|
||||
+-object rng-random,id=rng0,filename=/dev/random \
|
||||
+-device virtio-rng-device,rng=rng0
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.xml
|
||||
new file mode 100644
|
||||
index 0000000..2acf3c9
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.xml
|
||||
@@ -0,0 +1,45 @@
|
||||
+<domain type="qemu">
|
||||
+ <name>armtest</name>
|
||||
+ <uuid>496d7ea8-9739-544b-4ebd-ef08be936e6a</uuid>
|
||||
+ <memory>1048576</memory>
|
||||
+ <currentMemory>1048576</currentMemory>
|
||||
+ <vcpu>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch="armv7l" machine="vexpress-a9">hvm</type>
|
||||
+ <kernel>/arm.kernel</kernel>
|
||||
+ <initrd>/arm.initrd</initrd>
|
||||
+ <dtb>/arm.dtb</dtb>
|
||||
+ <cmdline>console=ttyAMA0,115200n8 rw root=/dev/vda3 rootwait physmap.enabled=0</cmdline>
|
||||
+ </os>
|
||||
+ <features>
|
||||
+ <acpi/>
|
||||
+ <apic/>
|
||||
+ <pae/>
|
||||
+ </features>
|
||||
+ <clock offset="utc"/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>restart</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-arm</emulator>
|
||||
+ <disk type='file' device='disk'>
|
||||
+ <source file='/arm.raw'/>
|
||||
+ <target dev='vda' bus='virtio'/>
|
||||
+ </disk>
|
||||
+ <interface type='user'>
|
||||
+ <mac address='52:54:00:09:a4:37'/>
|
||||
+ <model type='virtio'/>
|
||||
+ </interface>
|
||||
+ <console type='pty'/>
|
||||
+ <console type='pty'>
|
||||
+ <target type='virtio' port='0'/>
|
||||
+ </console>
|
||||
+ <memballoon model='virtio'/>
|
||||
+ <!--
|
||||
+ This actually doesn't work in practice because vexpress only has
|
||||
+ 4 virtio slots available, rng makes 5 -->
|
||||
+ <rng model='virtio'>
|
||||
+ <backend model='random'>/dev/random</backend>
|
||||
+ </rng>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index 0bf2724..2bdd18e 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1032,6 +1032,10 @@ mymain(void)
|
||||
DO_TEST("arm-vexpressa9-basic",
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
|
||||
QEMU_CAPS_DRIVE);
|
||||
+ DO_TEST("arm-vexpressa9-virtio",
|
||||
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
|
||||
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
|
||||
+ QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
|
||||
|
||||
virObjectUnref(driver.config);
|
||||
virObjectUnref(driver.caps);
|
29
libvirt.spec
29
libvirt.spec
@ -350,7 +350,7 @@
|
||||
Summary: Library providing a simple virtualization API
|
||||
Name: libvirt
|
||||
Version: 1.1.1
|
||||
Release: 2%{?dist}%{?extra_release}
|
||||
Release: 3%{?dist}%{?extra_release}
|
||||
License: LGPLv2+
|
||||
Group: Development/Libraries
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
@ -364,6 +364,18 @@ Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz
|
||||
# CVE-2013-4239: xen: memory corruption in legacy driver (bz #996241, bz
|
||||
# #996244)
|
||||
Patch0001: 0001-xen-fix-memory-corruption-in-legacy-driver.patch
|
||||
# Fix launching ARM guests on x86 (patches posted upstream, F20 feature)
|
||||
Patch0002: 0002-conf-add-default-USB-controller-in-qemu-post-parse-c.patch
|
||||
Patch0003: 0003-qemu-rename-some-functions-in-qemu_command.c.patch
|
||||
Patch0004: 0004-qemu-Set-QEMU_AUDIO_DRV-none-with-nographic.patch
|
||||
Patch0005: 0005-qemu-Only-setup-vhost-if-virtType-kvm.patch
|
||||
Patch0006: 0006-domain_conf-Add-default-memballon-in-PostParse-callb.patch
|
||||
Patch0007: 0007-qemu-Don-t-add-default-memballoon-device-on-ARM.patch
|
||||
Patch0008: 0008-qemu-Fix-adding-specifying-char-devs-for-ARM.patch
|
||||
Patch0009: 0009-qemu-Don-t-try-to-allocate-PCI-addresses-for-ARM.patch
|
||||
Patch0010: 0010-domain_conf-Add-disk-bus-sd-wire-it-up-for-qemu.patch
|
||||
Patch0011: 0011-qemu-Fix-networking-for-ARM-guests.patch
|
||||
Patch0012: 0012-qemu-Support-virtio-mmio-transport-for-virtio-on-ARM.patch
|
||||
|
||||
%if %{with_libvirtd}
|
||||
Requires: libvirt-daemon = %{version}-%{release}
|
||||
@ -1138,6 +1150,18 @@ of recent versions of Linux (and other OSes).
|
||||
# CVE-2013-4239: xen: memory corruption in legacy driver (bz #996241, bz
|
||||
# #996244)
|
||||
%patch0001 -p1
|
||||
# Fix launching ARM guests on x86 (patches posted upstream, F20 feature)
|
||||
%patch0002 -p1
|
||||
%patch0003 -p1
|
||||
%patch0004 -p1
|
||||
%patch0005 -p1
|
||||
%patch0006 -p1
|
||||
%patch0007 -p1
|
||||
%patch0008 -p1
|
||||
%patch0009 -p1
|
||||
%patch0010 -p1
|
||||
%patch0011 -p1
|
||||
%patch0012 -p1
|
||||
|
||||
%build
|
||||
%if ! %{with_xen}
|
||||
@ -2077,6 +2101,9 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Aug 20 2013 Cole Robinson <crobinso@redhat.com> - 1.1.1-3
|
||||
- Fix launching ARM guests on x86 (patches posted upstream, F20 feature)
|
||||
|
||||
* Wed Aug 14 2013 Cole Robinson <crobinso@redhat.com> - 1.1.1-2
|
||||
- CVE-2013-4239: xen: memory corruption in legacy driver (bz #996241, bz
|
||||
#996244)
|
||||
|
Loading…
Reference in New Issue
Block a user