[libvirt] [PATCH v2] cpu: add Freescale ppc64 CPU models

2015-01-29 Thread Olivia Yin
From: Olivia Yin hong-hua@freescale.com

With this patch, Freescale ppc64 CPU modesl could be recognized.

virsh # cpu-models ppc64
POWERPC_e6500
POWERPC_e5500
power8
power8e
power7+
power7
power6
POWER8_v1.0
POWER7+_v2.1
POWER7_v2.3
POWER7_v2.1
POWER7

virsh # capabilities
capabilities
  host
uuid5a54efa6-20dc-4da7-b271-0b7fb7062cb8/uuid
cpu
  archppc64/arch
  modelPOWERPC_e6500/model
  vendorFreescale/vendor


---
 src/cpu/cpu_map.xml | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index bd9b056..413148f 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -600,6 +600,7 @@
   arch name='ppc64'
 !-- vendor definitions --
 vendor name='IBM'/
+vendor name='Freescale'/
 
 !-- IBM-based CPU models --
 model name='POWER7'
@@ -657,5 +658,16 @@
   pvr value='0x004d'/
 /model
 
+!-- Freescale-based CPU models --
+model name='POWERPC_e5500'
+  vendor name='Freescale'/
+  pvr value='0x8024'/
+/model
+
+model name='POWERPC_e6500'
+  vendor name='Freescale'/
+  pvr value='0x8040'/
+/model
+
   /arch
 /cpus
-- 
2.1.0.27.g96db324

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] cpu: add Freescale ppc64 CPU models

2015-01-22 Thread Olivia Yin
When running Openstack on Freescale ppc64 board, got libvirtError as before:
nova.openstack.common.threadgroup libvirtError: XML error: Missing CPU model 
name.

This patch is to add Freescale ppc64 CPU models.


Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/cpu/cpu_map.xml | 36 
 1 file changed, 36 insertions(+)

diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index bd9b056..707cf88 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -600,6 +600,7 @@
   arch name='ppc64'
 !-- vendor definitions --
 vendor name='IBM'/
+vendor name='Freescale'/
 
 !-- IBM-based CPU models --
 model name='POWER7'
@@ -657,5 +658,40 @@
   pvr value='0x004d'/
 /model
 
+!-- Freescale-based CPU models --
+model name='POWERPC_e5500_v10'
+  vendor name='Freescale'/
+  pvr value='0x80240010'/
+/model
+
+model name='POWERPC_e5500_v11'
+  vendor name='Freescale'/
+  pvr value='0x80240011'/
+/model
+
+model name='POWERPC_e5500_v12'
+  vendor name='Freescale'/
+  pvr value='0x80240012'/
+/model
+
+ model name='POWERPC_e5500_v1020'
+  vendor name='Freescale'/
+  pvr value='0x80241020'/
+/model
+
+model name='POWERPC_e6500_v10'
+  vendor name='Freescale'/
+  pvr value='0x80400010'/
+/model
+
+model name='POWERPC_e6500_v20'
+  vendor name='Freescale'/
+  pvr value='0x80400020'/
+/model
+
+model name='POWERPC_e6500_v120'
+  vendor name='Freescale'/
+  pvr value='0x80400120'/
+/model
   /arch
 /cpus
-- 
2.1.0.27.g96db324

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] cpu: add Freescale ppc64 CPU models

2015-01-22 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/cpu/cpu_map.xml | 38 +-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index bd9b056..c34874e 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -1,4 +1,4 @@
-cpus
+ncpus
   arch name='x86'
 !-- vendor definitions --
 vendor name='Intel' string='GenuineIntel'/
@@ -600,6 +600,7 @@
   arch name='ppc64'
 !-- vendor definitions --
 vendor name='IBM'/
+vendor name='Freescale'/
 
 !-- IBM-based CPU models --
 model name='POWER7'
@@ -657,5 +658,40 @@
   pvr value='0x004d'/
 /model
 
+!-- Freescale-based CPU models --
+model name='POWERPC_e5500_v10'
+  vendor name='Freescale'/
+  pvr value='0x80240010'/
+/model
+
+model name='POWERPC_e5500_v11'
+  vendor name='Freescale'/
+  pvr value='0x80240011'/
+/model
+
+model name='POWERPC_e5500_v12'
+  vendor name='Freescale'/
+  pvr value='0x80240012'/
+/model
+
+ model name='POWERPC_e5500_v1020'
+  vendor name='Freescale'/
+  pvr value='0x80241020'/
+/model
+
+model name='POWERPC_e6500_v10'
+  vendor name='Freescale'/
+  pvr value='0x80400010'/
+/model
+
+model name='POWERPC_e6500_v20'
+  vendor name='Freescale'/
+  pvr value='0x80400020'/
+/model
+
+model name='POWERPC_e6500_v120'
+  vendor name='Freescale'/
+  pvr value='0x80400120'/
+/model
   /arch
 /cpus
-- 
2.1.0.27.g96db324

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] QEMU: Fix virtio-serial device support on PPC.

2014-06-25 Thread Olivia Yin
Patch fd0f22ed414e114664f4140306834bedd19f52c9 discard virtio-serial
device support on PPC machine.

Most PPC boards don't use -chardev with non-virtio serial device
except pseries which uses -device spapr-vty with -chardev.

Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/qemu/qemu_capabilities.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 8e0a550..4541f52 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3493,19 +3493,18 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
 !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
 return false;
 
-if ((def-os.arch == VIR_ARCH_PPC) || (def-os.arch == VIR_ARCH_PPC64)) {
-/* only pseries need -device spapr-vty with -chardev */
-return (chr-deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL 
-chr-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO);
-}
-
-if ((def-os.arch != VIR_ARCH_ARMV7L)  (def-os.arch != 
VIR_ARCH_AARCH64))
+if ((def-os.arch != VIR_ARCH_ARMV7L)  (def-os.arch != 
VIR_ARCH_AARCH64) 
+(def-os.arch != VIR_ARCH_PPC)  (def-os.arch != VIR_ARCH_PPC64))
 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. */
+/* Currently PPC boards don't use -chardev for non-virtio serial device
+ * except pseries which uses -device spapr-vty with -chardev. */
 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));
+ chr-targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) ||
+(chr-deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL 
+ chr-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO));
 }
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCHv2] QEMU: Modify qemuParseCommandLinePCI() to parsee '-device vfio-pci'

2014-06-09 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com

Modify qemuParseCommandLinePCI() to support parsing '-device 
vfio-pci,host=bus:slot.func'.
Add test case 'hostdev-vfio' into qemuargv2xmltest to validate this function.

The case related to QEMU_CAPS_HOST_PCI_MULTIDOMAIN which uses
'-device vfio-pci,host=domain:bus:slot.func' is not supported yet.
---
 src/qemu/qemu_command.c  | 36 ++--
 tests/qemuargv2xmltest.c |  2 +-
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3cf279e..ae7f94e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10193,7 +10193,7 @@ qemuParseCommandLineNet(virDomainXMLOptionPtr xmlopt,
  * Tries to parse a QEMU PCI device
  */
 static virDomainHostdevDefPtr
-qemuParseCommandLinePCI(const char *val)
+qemuParseCommandLinePCI(const char *val, bool vfio)
 {
 int bus = 0, slot = 0, func = 0;
 const char *start;
@@ -10222,10 +10222,20 @@ qemuParseCommandLinePCI(const char *val)
 goto error;
 }
 start = end + 1;
-if (virStrToLong_i(start, NULL, 16, func)  0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(cannot extract PCI device function '%s'), val);
-goto error;
+
+if (!vfio) {
+if (virStrToLong_i(start, NULL, 16, func)  0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(cannot extract PCI device function '%s'), val);
+goto error;
+}
+} else {
+if (virStrToLong_i(start, end, 16, func)  0 || *end != ',') {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(cannot extract PCI device function '%s'), val);
+goto error;
+} else
+def-source.subsys.u.pci.backend = 
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
 }
 
 def-mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
@@ -11347,12 +11357,26 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
 } else if (STREQ(arg, -pcidevice)) {
 virDomainHostdevDefPtr hostdev;
 WANT_VALUE();
-if (!(hostdev = qemuParseCommandLinePCI(val)))
+if (!(hostdev = qemuParseCommandLinePCI(val,0)))
 goto error;
 if (VIR_APPEND_ELEMENT(def-hostdevs, def-nhostdevs, hostdev)  
0) {
 virDomainHostdevDefFree(hostdev);
 goto error;
 }
+} else if (STREQ(arg, -device)) {
+WANT_VALUE();
+if (STRPREFIX(val, vfio-pci,)) {
+const char *start;
+start = val;
+virDomainHostdevDefPtr hostdev;
+start += strlen(vfio-pci,);
+if (!(hostdev = qemuParseCommandLinePCI(start,1)))
+goto error;
+if (VIR_APPEND_ELEMENT(def-hostdevs, def-nhostdevs, hostdev) 
 0) {
+virDomainHostdevDefFree(hostdev);
+goto error;
+}
+}
 } else if (STREQ(arg, -soundhw)) {
 const char *start;
 WANT_VALUE();
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index 0fc9fcb..b4ba97a 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -251,8 +251,8 @@ mymain(void)
 DO_TEST(watchdog);
 
 DO_TEST(hostdev-usb-address);
-
 DO_TEST(hostdev-pci-address);
+DO_TEST(hostdev-vfio);
 
 DO_TEST(smp);
 
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v3] QEMU: parse '-device vfio-pci' and '-device pci-assign'

2014-06-09 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
Signed-off-by: Laine Stump la...@laine.org

Modify the existing function qemuParseCommandLinePCI(), which works with
 -pcidevice, to support for -device pci-assign and -device pci-assign.

Change test cases 'hostdev-vfio' and 'hostdev-pci-address-device' to
validate the new function.

The case related to QEMU_CAPS_HOST_PCI_MULTIDOMAIN which uses
'host=domain:bus:slot.func' is not supported yet.
---
 src/qemu/qemu_command.c| 50 +++---
 tests/qemuargv2xmltest.c   |  3 +-
 .../qemuxml2argv-hostdev-pci-address-device.xml|  6 +++
 .../qemuxml2argvdata/qemuxml2argv-hostdev-vfio.xml |  1 +
 4 files changed, 53 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e1d7e1b..3a4bc61 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10193,7 +10193,8 @@ qemuParseCommandLineNet(virDomainXMLOptionPtr xmlopt,
  * Tries to parse a QEMU PCI device
  */
 static virDomainHostdevDefPtr
-qemuParseCommandLinePCI(const char *val)
+qemuParseCommandLinePCI(const char *val,
+virDomainHostdevSubsysPCIBackendType backend)
 {
 int bus = 0, slot = 0, func = 0;
 const char *start;
@@ -10222,10 +10223,20 @@ qemuParseCommandLinePCI(const char *val)
 goto error;
 }
 start = end + 1;
-if (virStrToLong_i(start, NULL, 16, func)  0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(cannot extract PCI device function '%s'), val);
-goto error;
+
+if (backend) {
+if (virStrToLong_i(start, end, 16, func)  0 || *end != ',') {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(cannot extract PCI device function '%s'), val);
+goto error;
+} else
+def-source.subsys.u.pci.backend = backend;
+} else {
+if (virStrToLong_i(start, NULL, 16, func)  0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(cannot extract PCI device function '%s'), val);
+goto error;
+}
 }
 
 def-mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
@@ -11347,7 +11358,34 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
 } else if (STREQ(arg, -pcidevice)) {
 virDomainHostdevDefPtr hostdev;
 WANT_VALUE();
-if (!(hostdev = qemuParseCommandLinePCI(val)))
+if (!(hostdev = qemuParseCommandLinePCI(val,
+VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT)))
+goto error;
+if (VIR_APPEND_ELEMENT(def-hostdevs, def-nhostdevs, hostdev)  
0) {
+virDomainHostdevDefFree(hostdev);
+goto error;
+}
+} else if (STREQ(arg, -device)  progargv[i+1] 
+   STRPREFIX(progargv[i+1], vfio-pci)) {
+const char *start;
+virDomainHostdevDefPtr hostdev;
+WANT_VALUE();
+start = val + strlen(vfio-pci,);
+if (!(hostdev = qemuParseCommandLinePCI(start,
+VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO)))
+goto error;
+if (VIR_APPEND_ELEMENT(def-hostdevs, def-nhostdevs, hostdev)  
0) {
+virDomainHostdevDefFree(hostdev);
+goto error;
+}
+} else if (STREQ(arg, -device)  progargv[i+1] 
+   STRPREFIX(progargv[i+1], pci-assign)) {
+const char *start;
+virDomainHostdevDefPtr hostdev;
+WANT_VALUE();
+start = val + strlen(pci-assign,);
+if (!(hostdev = qemuParseCommandLinePCI(start,
+VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM)))
 goto error;
 if (VIR_APPEND_ELEMENT(def-hostdevs, def-nhostdevs, hostdev)  
0) {
 virDomainHostdevDefFree(hostdev);
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index 2cbbe3d..80188be 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -274,8 +274,9 @@ mymain(void)
 DO_TEST(watchdog);
 
 DO_TEST(hostdev-usb-address);
-
 DO_TEST(hostdev-pci-address);
+DO_TEST(hostdev-pci-address-device);
+DO_TEST(hostdev-vfio);
 
 DO_TEST(smp);
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.xml
index b29ef58..b9a221a 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.xml
@@ -15,10 +15,16 @@
   devices
 emulator/usr/bin/qemu/emulator
 disk type='block' device='disk'
+  driver name='qemu' type='raw'/
   source dev='/dev/HostVG/QEMUGuest2'/
   target dev='hda' bus='ide'/
+  address type='drive' controller='0' bus='0' target='0' unit='0'/
 /disk
+controller type='usb' index='0

[libvirt] [RFC][PATCH]QEMU: Parse -device vfio-pci commandline

2014-06-05 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/qemu/qemu_command.c  | 67 
 tests/qemuargv2xmltest.c |  2 +-
 2 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e6acced..4db4a1d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10239,6 +10239,59 @@ qemuParseCommandLinePCI(const char *val)
 return NULL;
 }
 
+/*
+ * Tries to parse a QEMU vfio-pci device
+ */
+static virDomainHostdevDefPtr
+qemuParseCommandLineVFIOPCI(const char *val)
+{
+int bus = 0, slot = 0, func = 0;
+const char *start;
+char *end;
+virDomainHostdevDefPtr def = virDomainHostdevDefAlloc();
+
+if (!def)
+   goto error;
+
+if (!STRPREFIX(val, host=)) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unknown PCI device syntax '%s'), val);
+goto error;
+}
+
+start = val + strlen(host=);
+if (virStrToLong_i(start, end, 16, bus)  0 || *end != ':') {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(cannot extract PCI device bus '%s'), val);
+goto error;
+}
+start = end + 1;
+if (virStrToLong_i(start, end, 16, slot)  0 || *end != '.') {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(cannot extract PCI device slot '%s'), val);
+goto error;
+}
+start = end + 1;
+if (virStrToLong_i(start, end, 16, func)  0 || *end != ',') {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(cannot extract PCI device function '%s'), val);
+goto error;
+}
+
+def-mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
+def-managed = true;
+def-source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
+def-source.subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
+def-source.subsys.u.pci.addr.bus = bus;
+def-source.subsys.u.pci.addr.slot = slot;
+def-source.subsys.u.pci.addr.function = func;
+return def;
+
+ error:
+virDomainHostdevDefFree(def);
+return NULL;
+}
+
 
 /*
  * Tries to parse a QEMU USB device
@@ -11351,6 +11404,20 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
 virDomainHostdevDefFree(hostdev);
 goto error;
 }
+} else if (STREQ(arg, -device)) {
+WANT_VALUE();
+if (STRPREFIX(val, vfio-pci,)) {
+const char *start;
+start = val;
+virDomainHostdevDefPtr hostdev;
+start += strlen(vfio-pci,);
+if (!(hostdev = qemuParseCommandLineVFIOPCI(start)))
+goto error;
+if (VIR_APPEND_ELEMENT(def-hostdevs, def-nhostdevs, hostdev) 
 0) {
+virDomainHostdevDefFree(hostdev);
+goto error;
+}
+}
 } else if (STREQ(arg, -soundhw)) {
 const char *start;
 WANT_VALUE();
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index 0fc9fcb..b4ba97a 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -251,8 +251,8 @@ mymain(void)
 DO_TEST(watchdog);
 
 DO_TEST(hostdev-usb-address);
-
 DO_TEST(hostdev-pci-address);
+DO_TEST(hostdev-vfio);
 
 DO_TEST(smp);
 
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [Patch v2 2/3] qemu: Fix specifying char devs for PPC

2014-05-26 Thread Olivia Yin
QEMU ppce500 board uses the legacy -serial option.

Other PPC boards don't give any way to explicitly wire in a -chardev
except pseries which uses -device spapr-vty with -chardev.

Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/qemu/qemu_capabilities.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 03d8842..1b09a17 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3467,7 +3467,14 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
 return false;
 
 if ((def-os.arch != VIR_ARCH_ARMV7L)  (def-os.arch != 
VIR_ARCH_AARCH64))
-return true;
+{
+if ((def-os.arch != VIR_ARCH_PPC)  (def-os.arch != VIR_ARCH_PPC64))
+return true;
+else
+/* only pseries need -device spapr-vty with -chardev */
+return (chr-deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL 
+chr-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO);
+}
 
 /* This may not be true for all ARM machine types, but at least
  * the only supported non-virtio serial devices of vexpress and versatile
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [Patch v2 1/3] change machine name ppce500v2 as ppce500

2014-05-26 Thread Olivia Yin
ppce500v2 is not machine supported by official release of QEMU.
It should be replaced by ppce500.
---
 docs/schemas/domaincommon.rng| 2 +-
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args | 2 +-
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  | 2 +-
 tests/testutilsqemu.c| 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4249ed5..af67123 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -371,7 +371,7 @@
 valueg3beige/value
 valuemac99/value
 valueprep/value
-valueppce500v2/value
+valueppce500/value
   /choice
 /attribute
   /optional
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
index fd7e994..5d6dc45 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-ppc -S -M ppce500v2 -m 256 -smp 1 -nographic \
+/usr/bin/qemu-system-ppc -S -M ppce500 -m 256 -smp 1 -nographic \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
 -kernel /media/ram/uImage -initrd /media/ram/ramdisk \
 -append 'root=/dev/ram rw console=ttyS0,115200' -dtb /media/ram/test.dtb \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
index 3674621..04f0eb6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
@@ -5,7 +5,7 @@
   currentMemory unit='KiB'262144/currentMemory
   vcpu placement='static'1/vcpu
   os
-type arch='ppc' machine='ppce500v2'hvm/type
+type arch='ppc' machine='ppce500'hvm/type
 kernel/media/ram/uImage/kernel
 initrd/media/ram/ramdisk/initrd
 cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index a8884ba..7e24909 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -91,7 +91,7 @@ static int testQemuAddPPCGuest(virCapsPtr caps)
 static const char *machine[] = { g3beige,
  mac99,
  prep,
- ppce500v2 };
+ ppce500 };
 virCapsGuestMachinePtr *machines = NULL;
 virCapsGuestPtr guest;
 
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [Patch v2 0/3] use -serial for ppce500 board and add test case

2014-05-26 Thread Olivia Yin
Machine name ppce500 is used to replace ppce500v2 supported by QEMU.
QEMU ppce500 board uses the legacy -serial option.
Test case ppce500-serial is used to verify this change.

Olivia Yin (3):
  change machine name ppce500v2 as ppce500
  qemu: Fix specifying char devs for PPC
  tests: add test case for -serial option for ppce500

 docs/schemas/domaincommon.rng  |  2 +-
 src/qemu/qemu_capabilities.c   |  9 +++-
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args   |  2 +-
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml|  2 +-
 .../qemuxml2argv-ppce500-serial.args   |  7 ++
 .../qemuxml2argv-ppce500-serial.xml| 26 ++
 tests/qemuxml2argvtest.c   |  1 +
 tests/testutilsqemu.c  |  2 +-
 8 files changed, 46 insertions(+), 5 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml

-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [Patch v2 3/3] tests: add test case for -serial option for ppce500

2014-05-26 Thread Olivia Yin
---
 .../qemuxml2argv-ppce500-serial.args   |  7 ++
 .../qemuxml2argv-ppce500-serial.xml| 26 ++
 tests/qemuxml2argvtest.c   |  1 +
 3 files changed, 34 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args 
b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args
new file mode 100644
index 000..a23ae41
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-ppc -S -M ppce500 -m 256 -smp 1 -nographic -nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
+-kernel /media/ram/uImage -initrd /media/ram/ramdisk \
+-append 'root=/dev/ram rw console=ttyS0,115200' \
+-usb -serial pty -device virtio-balloon-pci,id=balloon0,bus=pci,addr=0x2
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml
new file mode 100644
index 000..397aadc
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml
@@ -0,0 +1,26 @@
+domain type='kvm'
+  nameQEMUGuest1/name
+  memory unit='KiB'262144/memory
+  currentMemory unit='KiB'262144/currentMemory
+  vcpu placement='static'1/vcpu
+  os
+type arch='ppc' machine='ppce500'hvm/type
+kernel/media/ram/uImage/kernel
+initrd/media/ram/ramdisk/initrd
+cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
+  /os
+  clock offset='utc'/
+  on_poweroffdestroy/on_poweroff
+  on_rebootrestart/on_reboot
+  on_crashdestroy/on_crash
+  devices
+emulator/usr/bin/qemu-system-ppc/emulator
+serial type='pty'
+  target port='0'/
+/serial
+console type='pty'
+  target type='serial' port='0'/
+/console
+memballoon model='virtio'/
+  /devices
+/domain
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1ea7bf8..24d104e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1279,6 +1279,7 @@ mymain(void)
 QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
 
 DO_TEST(ppc-dtb, QEMU_CAPS_KVM, QEMU_CAPS_DTB);
+DO_TEST(ppce500-serial, QEMU_CAPS_KVM, QEMU_CAPS_DEVICE, 
QEMU_CAPS_CHARDEV);
 
 DO_TEST(tpm-passthrough, QEMU_CAPS_DEVICE,
 QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/3] qemu: Fix specifying char devs for PPC

2014-05-22 Thread Olivia Yin
QEMU ppce500 board uses the old style -serial options.

Other PPC boards don't give any way to explicitly wire in a -chardev
except pseries which uses -device spapr-vty with -chardev.
---
 src/qemu/qemu_capabilities.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 03d8842..1cc37ad 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3466,13 +3466,17 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
 !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
 return false;
 
-if ((def-os.arch != VIR_ARCH_ARMV7L)  (def-os.arch != 
VIR_ARCH_AARCH64))
+if ((def-os.arch != VIR_ARCH_ARMV7L)  (def-os.arch != VIR_ARCH_AARCH64)
+  (def-os.arch != VIR_ARCH_PPC)  (def-os.arch != VIR_ARCH_PPC64))
 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. */
+ * don't have the -chardev property wired up.
+ * For PPC machines, only pseries need -device spapr-vty with -chardev */
 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));
+ chr-targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) ||
+(chr-deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL 
+ chr-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO));
 }
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/3] change machine name ppce500v2 as ppce500

2014-05-22 Thread Olivia Yin
---
 docs/schemas/domaincommon.rng| 2 +-
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args | 2 +-
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  | 2 +-
 tests/testutilsqemu.c| 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4249ed5..af67123 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -371,7 +371,7 @@
 valueg3beige/value
 valuemac99/value
 valueprep/value
-valueppce500v2/value
+valueppce500/value
   /choice
 /attribute
   /optional
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
index fd7e994..5d6dc45 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu-system-ppc -S -M ppce500v2 -m 256 -smp 1 -nographic \
+/usr/bin/qemu-system-ppc -S -M ppce500 -m 256 -smp 1 -nographic \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
 -kernel /media/ram/uImage -initrd /media/ram/ramdisk \
 -append 'root=/dev/ram rw console=ttyS0,115200' -dtb /media/ram/test.dtb \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
index 3674621..04f0eb6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
@@ -5,7 +5,7 @@
   currentMemory unit='KiB'262144/currentMemory
   vcpu placement='static'1/vcpu
   os
-type arch='ppc' machine='ppce500v2'hvm/type
+type arch='ppc' machine='ppce500'hvm/type
 kernel/media/ram/uImage/kernel
 initrd/media/ram/ramdisk/initrd
 cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index a8884ba..7e24909 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -91,7 +91,7 @@ static int testQemuAddPPCGuest(virCapsPtr caps)
 static const char *machine[] = { g3beige,
  mac99,
  prep,
- ppce500v2 };
+ ppce500 };
 virCapsGuestMachinePtr *machines = NULL;
 virCapsGuestPtr guest;
 
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 3/3] tests: add test case for -serial option for ppce500

2014-05-22 Thread Olivia Yin
---
 .../qemuxml2argv-ppce500-serial.args   |  7 ++
 .../qemuxml2argv-ppce500-serial.xml| 26 ++
 tests/qemuxml2argvtest.c   |  1 +
 3 files changed, 34 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args 
b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args
new file mode 100644
index 000..c7b4819
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-ppc -S -M ppce500 -m 256 -smp 1 -nographic \
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
+-kernel /media/ram/uImage -initrd /media/ram/ramdisk \
+-append 'root=/dev/ram rw console=ttyS0,115200' \
+-usb -net none -serial pty -parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml
new file mode 100644
index 000..397aadc
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml
@@ -0,0 +1,26 @@
+domain type='kvm'
+  nameQEMUGuest1/name
+  memory unit='KiB'262144/memory
+  currentMemory unit='KiB'262144/currentMemory
+  vcpu placement='static'1/vcpu
+  os
+type arch='ppc' machine='ppce500'hvm/type
+kernel/media/ram/uImage/kernel
+initrd/media/ram/ramdisk/initrd
+cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
+  /os
+  clock offset='utc'/
+  on_poweroffdestroy/on_poweroff
+  on_rebootrestart/on_reboot
+  on_crashdestroy/on_crash
+  devices
+emulator/usr/bin/qemu-system-ppc/emulator
+serial type='pty'
+  target port='0'/
+/serial
+console type='pty'
+  target type='serial' port='0'/
+/console
+memballoon model='virtio'/
+  /devices
+/domain
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1ea7bf8..b2aa22a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1279,6 +1279,7 @@ mymain(void)
 QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
 
 DO_TEST(ppc-dtb, QEMU_CAPS_KVM, QEMU_CAPS_DTB);
+DO_TEST(ppce500-serial, QEMU_CAPS_KVM, QEMU_CAPS_DRIVE, 
QEMU_CAPS_CHARDEV);
 
 DO_TEST(tpm-passthrough, QEMU_CAPS_DEVICE,
 QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/3] use -serial for ppce500 board and add test case

2014-05-22 Thread Olivia Yin
Machine name ppce500 is used to replace ppce500v2 supported by QEMU.
QEMU ppce500 board uses the old style -serial options.
Test case ppce500-serial is used to verify this change.

Olivia Yin (3):
  change machine name ppce500v2 as ppce500
  qemu: Fix specifying char devs for PPC
  tests: add test case for -serial option for ppce500

 docs/schemas/domaincommon.rng  |  2 +-
 src/qemu/qemu_capabilities.c   | 10 ++---
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args   |  2 +-
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml|  2 +-
 .../qemuxml2argv-ppce500-serial.args   |  7 ++
 .../qemuxml2argv-ppce500-serial.xml| 26 ++
 tests/qemuxml2argvtest.c   |  1 +
 tests/testutilsqemu.c  |  2 +-
 8 files changed, 45 insertions(+), 7 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppce500-serial.xml

-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] qemu: Fix specifying char devs for PPC

2014-05-14 Thread Olivia Yin
QEMU ppce500 board uses the old style -serial options.

Other PPC boards don't give any way to explicitly wire in a -chardev
except pseries which uses -device spapr-vty with -chardev.

---
 src/qemu/qemu_capabilities.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b491f58..fe5dd19 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3460,13 +3460,17 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
 !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
 return false;
 
-if ((def-os.arch != VIR_ARCH_ARMV7L)  (def-os.arch != 
VIR_ARCH_AARCH64))
+if ((def-os.arch != VIR_ARCH_ARMV7L)  (def-os.arch != VIR_ARCH_AARCH64)
+ (def-os.arch != VIR_ARCH_PPC)  (def-os.arch != VIR_ARCH_PPC64))
 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. */
+ * don't have the -chardev property wired up.
+ * For PPC machines, only pserial need -device spapr-vty with -chardev */
 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));
+ chr-targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) ||
+(chr-deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL 
+ chr-info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO));
 }
-- 
1.8.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] Define CPUINFO_FILE_LEN and fix maxlen of cpuinfo file for powerpc

2014-04-03 Thread Olivia Yin
This patch define CPUINFO_FILE_LEN as 2KB which is enough for most 
architectures.

For the 24 cores PowerPC machines, the file of /proc/cpuinfo will be larger 
than 2KB.
It will fail to start libvirtd with the error message as below:
virFileReadAll: Failed to read file '/proc/cpuinfo': Value too large for 
defined data type
virSysinfoRead: internal error Failed to open /proc/cpuinfo

So this patch increases the maxlen of cpuinfo for PowerPC architecture.

Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/util/virsysinfo.c | 6 +++---
 src/util/virsysinfo.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 7b16157..33c4bc6 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -223,7 +223,7 @@ virSysinfoRead(void)
 if (VIR_ALLOC(ret)  0)
 goto no_memory;
 
-if (virFileReadAll(CPUINFO, 2048, outbuf)  0) {
+if (virFileReadAll(CPUINFO, 2 * CPUINFO_FILE_LEN, outbuf)  0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(Failed to open %s), CPUINFO);
 return NULL;
@@ -341,7 +341,7 @@ virSysinfoRead(void)
 if (VIR_ALLOC(ret)  0)
 goto no_memory;
 
-if (virFileReadAll(CPUINFO, 2048, outbuf)  0) {
+if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, outbuf)  0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(Failed to open %s), CPUINFO);
 return NULL;
@@ -470,7 +470,7 @@ virSysinfoRead(void)
 goto no_memory;
 
 /* Gather info from /proc/cpuinfo */
-if (virFileReadAll(CPUINFO, 8192, outbuf)  0) {
+if (virFileReadAll(CPUINFO, 4 * CPUINFO_FILE_LEN, outbuf)  0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(Failed to open %s), CPUINFO);
 return NULL;
diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h
index fbb505b..630b9ce 100644
--- a/src/util/virsysinfo.h
+++ b/src/util/virsysinfo.h
@@ -102,4 +102,6 @@ bool virSysinfoIsEqual(virSysinfoDefPtr src,
 
 VIR_ENUM_DECL(virSysinfo)
 
+#define CPUINFO_FILE_LEN   2048/*2KB limit for normal cpuinfo file*/
+
 #endif /* __VIR_SYSINFOS_H__ */
-- 
1.8.5


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] Define STATE_XMLFILE_LEN as 8192

2014-04-03 Thread Olivia Yin
Save/restore the state of domain and migrate need read state XML file.
8192B is not the exactly maximum file length of state file.

restore command could work successfully in virsh shell.
virsh # list --all
 IdName   State

 9 sdkrunning

virsh # save sdk pp

Domain sdk saved to pp

virsh # list --all
 IdName   State

 - sdkshut off

virsh # restore pp
Domain restored from pp

virsh # list --all
 IdName   State

 10sdkrunning

But it will fail with 'virsh restore' command because the state file is 
oversized.
~# virsh restore pp
error: Failed to read file 'pp': Value too large for defined data type

Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 tools/virsh-domain.c | 6 +++---
 tools/virsh.h| 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 73414f8..8ade296 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -3547,7 +3547,7 @@ doSave(void *opaque)
 goto out;
 
 if (xmlfile 
-virFileReadAll(xmlfile, 8192, xml)  0) {
+virFileReadAll(xmlfile, STATE_XMLFILE_LEN, xml)  0) {
 vshReportError(ctl);
 goto out;
 }
@@ -3840,7 +3840,7 @@ cmdSaveImageDefine(vshControl *ctl, const vshCmd *cmd)
 if (vshCommandOptStringReq(ctl, cmd, xml, xmlfile)  0)
 return false;
 
-if (virFileReadAll(xmlfile, 8192, xml)  0)
+if (virFileReadAll(xmlfile, STATE_XMLFILE_LEN, xml)  0)
 goto cleanup;
 
 if (virDomainSaveImageDefineXML(ctl-conn, file, xml, flags)  0) {
@@ -4424,7 +4424,7 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd)
 return false;
 
 if (xmlfile 
-virFileReadAll(xmlfile, 8192, xml)  0)
+virFileReadAll(xmlfile, STATE_XMLFILE_LEN, xml)  0)
 goto cleanup;
 
 if (((flags || xml)
diff --git a/tools/virsh.h b/tools/virsh.h
index 3e0251b..3f95216 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -41,6 +41,7 @@
 # include virstring.h
 
 # define VSH_MAX_XML_FILE (10*1024*1024)
+# define STATE_XMLFILE_LEN (8*1024)
 
 # define VSH_PROMPT_RWvirsh # 
 # define VSH_PROMPT_ROvirsh  
-- 
1.8.5


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2] Define CPUINFO_FILE_LEN and fix maxlen of cpuinfo file for all uses

2014-04-03 Thread Olivia Yin
For example, the file /proc/cpuinfo for 24 cores PowerPC platform is larger than
the previous maximum size 2KB.
It will fail to start libvirtd with the error message as below:
virFileReadAll: Failed to read file '/proc/cpuinfo': Value too large for defined
data type
virSysinfoRead: internal error Failed to open /proc/cpuinfo

This patch defines CPUINFO_FILE_LEN as 10KB which is enough for most 
architectures.

Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/util/virsysinfo.c | 6 +++---
 src/util/virsysinfo.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 7b16157..873872c 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -223,7 +223,7 @@ virSysinfoRead(void)
 if (VIR_ALLOC(ret)  0)
 goto no_memory;
 
-if (virFileReadAll(CPUINFO, 2048, outbuf)  0) {
+if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, outbuf)  0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(Failed to open %s), CPUINFO);
 return NULL;
@@ -341,7 +341,7 @@ virSysinfoRead(void)
 if (VIR_ALLOC(ret)  0)
 goto no_memory;
 
-if (virFileReadAll(CPUINFO, 2048, outbuf)  0) {
+if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, outbuf)  0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(Failed to open %s), CPUINFO);
 return NULL;
@@ -470,7 +470,7 @@ virSysinfoRead(void)
 goto no_memory;
 
 /* Gather info from /proc/cpuinfo */
-if (virFileReadAll(CPUINFO, 8192, outbuf)  0) {
+if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, outbuf)  0) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(Failed to open %s), CPUINFO);
 return NULL;
diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h
index fbb505b..b5336e2 100644
--- a/src/util/virsysinfo.h
+++ b/src/util/virsysinfo.h
@@ -102,4 +102,6 @@ bool virSysinfoIsEqual(virSysinfoDefPtr src,
 
 VIR_ENUM_DECL(virSysinfo)
 
+#define CPUINFO_FILE_LEN (10*1024) /*10KB limit for /proc/cpuinfo file*/
+
 #endif /* __VIR_SYSINFOS_H__ */
-- 
1.8.5


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] replace ppce500v2 with ppce500

2013-03-19 Thread Olivia Yin
---
 docs/schemas/domaincommon.rng| 2 +-
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args | 2 +-
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  | 2 +-
 tests/testutilsqemu.c| 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 90647df..5a871d6 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -367,7 +367,7 @@
 valueg3beige/value
 valuemac99/value
 valueprep/value
-valueppce500v2/value
+valueppce500/value
   /choice
 /attribute
   /optional
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
index 93e8f9c..1ffd8be 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
@@ -1,5 +1,5 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
-/usr/bin/qemu-system-ppc -S -M ppce500v2 -m 256 -smp 1 -nographic \
+/usr/bin/qemu-system-ppc -S -M ppce500 -m 256 -smp 1 -nographic \
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
 -kernel /media/ram/uImage -initrd /media/ram/ramdisk \
 -append 'root=/dev/ram rw console=ttyS0,115200' -dtb /media/ram/test.dtb \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
index 3674621..04f0eb6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
@@ -5,7 +5,7 @@
   currentMemory unit='KiB'262144/currentMemory
   vcpu placement='static'1/vcpu
   os
-type arch='ppc' machine='ppce500v2'hvm/type
+type arch='ppc' machine='ppce500'hvm/type
 kernel/media/ram/uImage/kernel
 initrd/media/ram/ramdisk/initrd
 cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index db15ee6..35d6158 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -97,7 +97,7 @@ static int testQemuAddPPCGuest(virCapsPtr caps)
 static const char *machine[] = { g3beige,
  mac99,
  prep,
- ppce500v2 };
+ ppce500 };
 virCapsGuestMachinePtr *machines = NULL;
 virCapsGuestPtr guest;
 
-- 
1.8.0


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] fix TLS error with virNetServerClientCreateIdentity

2013-03-19 Thread Olivia Yin
---
 src/rpc/virnetserverclient.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index d407f5e..58fb0b4 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -687,6 +687,7 @@ virNetServerClientCreateIdentity(virNetServerClientPtr 
client)
 }
 #endif
 
+#if WITH_GNUTLS
 if (client-tls) {
 const char *identity = virNetTLSSessionGetX509DName(client-tls);
 if (identity 
@@ -695,6 +696,7 @@ virNetServerClientCreateIdentity(virNetServerClientPtr 
client)
 goto cleanup;
 }
 }
+#endif
 
 if (client-sock 
 virNetSocketGetSecurityContext(client-sock, seccontext)  0)
-- 
1.8.0


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 0/3] qemu: -dtb option support

2013-03-13 Thread Olivia Yin
Since v1.1 QEMU provides -dtb option to support loading device tree binary 
images.
These patches update qemu commands/capabilities for dtb and provide docs/tests.

Olivia Yin (3):
  conf: support dtb tag in XML domain file
  qemu: add dtb option supprt
  selinux: deal with dtb file

 docs/formatdomain.html.in|5 +++
 docs/schemas/domaincommon.rng|6 
 src/conf/domain_conf.c   |4 ++
 src/conf/domain_conf.h   |1 +
 src/qemu/qemu_capabilities.c |8 -
 src/qemu/qemu_capabilities.h |1 +
 src/qemu/qemu_command.c  |6 
 src/security/security_dac.c  |8 +
 src/security/security_selinux.c  |8 +
 src/security/virt-aa-helper.c|4 ++
 tests/qemuhelptest.c |   30 +--
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
 tests/qemuxml2argvtest.c |2 +
 tests/testutilsqemu.c|   33 ++
 15 files changed, 133 insertions(+), 12 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v5 2/3] qemu: add dtb option supprt

2013-03-13 Thread Olivia Yin
The dtb option sets the filename for the device tree.
If without this option support, -dtb file will be converted into
qemu:commandline in domain XML file.
For example, '-dtb /media/ram/test.dtb' will be converted into
  qemu:commandline
qemu:arg value='-dtb'/
qemu:arg value='/media/ram/test.dtb'/
  /qemu:commandline

This is not very friendly.
This patchset add special dtb tag like kernel and initrd
which is easier for user to write domain XML file.
  os
type arch='ppc' machine='ppce500v2'hvm/type
kernel/media/ram/uImage/kernel
initrd/media/ram/ramdisk/initrd
dtb/media/ram/test.dtb/dtb
cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
  /os
---
 src/qemu/qemu_capabilities.c |8 -
 src/qemu/qemu_capabilities.h |1 +
 src/qemu/qemu_command.c  |6 
 tests/qemuhelptest.c |   30 +--
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
 tests/qemuxml2argvtest.c |2 +
 tests/testutilsqemu.c|   33 ++
 8 files changed, 97 insertions(+), 12 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 79cfdb3..636608a 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -210,7 +210,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
 
   rng-random, /* 130 */
   rng-egd,
-  virtio-ccw
+  virtio-ccw,
+  dtb,
 );
 
 struct _virQEMUCaps {
@@ -1173,8 +1174,10 @@ virQEMUCapsComputeCmdFlags(const char *help,
 if (version = 12000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_ROMBAR);
 
-if (version = 11000)
+if (version = 11000) {
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
+}
 
 if (version = 1002000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
@@ -2299,6 +2302,7 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
 }
 
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 5c5dc5a..9f88593 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -172,6 +172,7 @@ enum virQEMUCapsFlags {
virtio rng */
 QEMU_CAPS_OBJECT_RNG_EGD = 131, /* EGD protocol daemon for rng */
 QEMU_CAPS_VIRTIO_CCW = 132, /* -device virtio-*-ccw */
+QEMU_CAPS_DTB= 133, /* -dtb file */
 
 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 e7f2325..a95d41c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5984,6 +5984,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 virCommandAddArgList(cmd, -initrd, def-os.initrd, NULL);
 if (def-os.cmdline)
 virCommandAddArgList(cmd, -append, def-os.cmdline, NULL);
+if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB)  def-os.dtb)
+virCommandAddArgList(cmd, -dtb, def-os.dtb, NULL);
 } else {
 virCommandAddArgList(cmd, -bootloader, def-os.bootloader, NULL);
 }
@@ -9161,6 +9163,10 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 WANT_VALUE();
 if (!(def-os.cmdline = strdup(val)))
 goto no_memory;
+} else if (STREQ(arg, -dtb)) {
+WANT_VALUE();
+if (!(def-os.dtb = strdup(val)))
+goto no_memory;
 } else if (STREQ(arg, -boot)) {
 const char *token = NULL;
 WANT_VALUE();
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 720a188..460c5fd 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -339,7 +339,8 @@ mymain(void)
 QEMU_CAPS_NO_ACPI,
 QEMU_CAPS_VIRTIO_BLK_SG_IO,
 QEMU_CAPS_CPU_HOST,
-QEMU_CAPS_VNC);
+QEMU_CAPS_VNC,
+QEMU_CAPS_DTB);
 DO_TEST(qemu-kvm-0.12.1.2-rhel60, 12001, 1, 0,
 QEMU_CAPS_VNC_COLON,
 QEMU_CAPS_NO_REBOOT,
@@ -397,7 +398,8 @@ mymain(void)
 QEMU_CAPS_DEVICE_CIRRUS_VGA,
 QEMU_CAPS_DEVICE_VMWARE_SVGA,
 QEMU_CAPS_DEVICE_USB_SERIAL,
-QEMU_CAPS_DEVICE_USB_NET);
+QEMU_CAPS_DEVICE_USB_NET,
+QEMU_CAPS_DTB);
 DO_TEST(qemu-kvm-0.12.3, 12003, 1, 0,
 QEMU_CAPS_VNC_COLON,
 

[libvirt] [PATCH v4 0/2] qemu: -dtb option support

2013-03-12 Thread Olivia Yin
Sometime QEMU need load specific device tree binary images.
These patches provide -dtb option support and update docs/tests.

Olivia Yin (2):
  qemu: add support for dtb option
  conf: Add support for dtb option in QEMU

 src/qemu/qemu_capabilities.c |6 
 src/qemu/qemu_capabilities.h |1 +
 src/qemu/qemu_command.c  |6 
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
 tests/qemuxml2argvtest.c |2 +
 docs/formatdomain.html.in|5 +
 docs/schemas/domaincommon.rng|5 +
 src/conf/domain_conf.c   |4 
 src/conf/domain_conf.h   |1 +

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v4 1/2] qemu: add support for dtb option

2013-03-12 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com

The dtb option sets the filename for the device tree.
If without this option support, -dtb file will be converted into
qemu:commandline in domain XML file.
For example, '-dtb /media/ram/test.dtb' will be converted into
  qemu:commandline
qemu:arg value='-dtb'/
qemu:arg value='/media/ram/test.dtb'/
  /qemu:commandline

This is not very friendly.
This patchset add special dtb tag like kernel and initrd
which is easier for user to write domain XML file.
  os
type arch='ppc' machine='ppce500v2'hvm/type
kernel/media/ram/uImage/kernel
initrd/media/ram/ramdisk/initrd
dtb/media/ram/test.dtb/dtb
cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
  /os
---
 src/qemu/qemu_capabilities.c |6 
 src/qemu/qemu_capabilities.h |1 +
 src/qemu/qemu_command.c  |6 
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
 tests/qemuxml2argvtest.c |2 +
 6 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 40022c1..7bc1ebc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -210,6 +210,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
 
   rng-random, /* 130 */
   rng-egd,
+  dtb,
 );
 
 struct _virQEMUCaps {
@@ -1177,6 +1178,10 @@ virQEMUCapsComputeCmdFlags(const char *help,
 
 if (version = 1002000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+
+if (version = 11000)
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
+
 return 0;
 }
 
@@ -2294,6 +2299,7 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
 }
 
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a895867..f373285 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -171,6 +171,7 @@ enum virQEMUCapsFlags {
 QEMU_CAPS_OBJECT_RNG_RANDOM  = 130, /* the rng-random backend for
virtio rng */
 QEMU_CAPS_OBJECT_RNG_EGD = 131, /* EGD protocol daemon for rng */
+QEMU_CAPS_DTB= 132, /* -dtb available */
 
 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 201fac1..1614f3e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5747,6 +5747,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 virCommandAddArgList(cmd, -initrd, def-os.initrd, NULL);
 if (def-os.cmdline)
 virCommandAddArgList(cmd, -append, def-os.cmdline, NULL);
+if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB)  def-os.dtb)
+virCommandAddArgList(cmd, -dtb, def-os.dtb, NULL);
 } else {
 virCommandAddArgList(cmd, -bootloader, def-os.bootloader, NULL);
 }
@@ -8922,6 +8924,10 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 WANT_VALUE();
 if (!(def-os.cmdline = strdup(val)))
 goto no_memory;
+} else if (STREQ(arg, -dtb)) {
+WANT_VALUE();
+if (!(def-os.dtb = strdup(val)))
+goto no_memory;
 } else if (STREQ(arg, -boot)) {
 const char *token = NULL;
 WANT_VALUE();
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
new file mode 100644
index 000..99ee22c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
/usr/bin/qemu-system-ppc -M ppce500v2 -enable-kvm -m 256 -nographic -kernel 
/media/ram/uImage -initrd /media/ram/ramdisk -append root=/dev/ram rw 
console=ttyS0,115200 -dtb /media/ram/test.dtb -serial pty
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
new file mode 100644
index 000..3674621
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
@@ -0,0 +1,28 @@
+domain type='kvm'
+  nameQEMUGuest1/name
+  uuid49545eb3-75e1-2d0a-acdd-f0294406c99e/uuid
+  memory unit='KiB'262144/memory
+  currentMemory unit='KiB'262144/currentMemory
+  vcpu placement='static'1/vcpu
+  os
+type arch='ppc' machine='ppce500v2'hvm/type
+kernel/media/ram/uImage/kernel
+initrd/media/ram/ramdisk/initrd
+cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
+dtb/media/ram

[libvirt] [PATCH v4 2/2] conf: Add support for dtb option in QEMU

2013-03-12 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com

This patch adds support to set the device trees file.
---
 docs/formatdomain.html.in |5 +
 docs/schemas/domaincommon.rng |5 +
 src/conf/domain_conf.c|4 
 src/conf/domain_conf.h|1 +
 4 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 4cafc92..e589df5 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -232,6 +232,7 @@
 lt;kernelgt;/root/f8-i386-vmlinuzlt;/kernelgt;
 lt;initrdgt;/root/f8-i386-initrdlt;/initrdgt;
 lt;cmdlinegt;console=ttyS0 
ks=http://example.com/f8-i386/os/lt;/cmdlinegt;
+lt;dtbgt;/root/ppc.dtblt;/dtbgt;
   lt;/osgt;
   .../pre
 
@@ -253,6 +254,10 @@
 the kernel (or installer) at boottime. This is often used to
 specify an alternate primary console (eg serial port), or the
 installation media source / kickstart file/dd
+  dtcodedtb/code/dt
+  ddThe contents of this element specify the fully-qualified path
+to the (optional) device tree binary (dtb) image in the host OS.
+Since 1.0.4/dd
 /dl
 
 h4a name=eleemntsOSContainerContainer boot/a/h4
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 372aab7..88e89dd 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -832,6 +832,11 @@
   text/
 /element
   /optional
+  optional
+element name=dtb
+  ref name=absFilePath/
+/element
+  /optional
 /interleave
   /define
   define name=osbootdev
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 717fc20..18e4906 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1785,6 +1785,7 @@ void virDomainDefFree(virDomainDefPtr def)
 VIR_FREE(def-os.kernel);
 VIR_FREE(def-os.initrd);
 VIR_FREE(def-os.cmdline);
+VIR_FREE(def-os.dtb);
 VIR_FREE(def-os.root);
 VIR_FREE(def-os.loader);
 VIR_FREE(def-os.bootloader);
@@ -10063,6 +10064,7 @@ virDomainDefParseXML(virCapsPtr caps,
 def-os.kernel = virXPathString(string(./os/kernel[1]), ctxt);
 def-os.initrd = virXPathString(string(./os/initrd[1]), ctxt);
 def-os.cmdline = virXPathString(string(./os/cmdline[1]), ctxt);
+def-os.dtb = virXPathString(string(./os/dtb[1]), ctxt);
 def-os.root = virXPathString(string(./os/root[1]), ctxt);
 def-os.loader = virXPathString(string(./os/loader[1]), ctxt);
 }
@@ -14675,6 +14677,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
   def-os.initrd);
 virBufferEscapeString(buf, cmdline%s/cmdline\n,
   def-os.cmdline);
+virBufferEscapeString(buf, dtb%s/dtb\n,
+  def-os.dtb);
 virBufferEscapeString(buf, root%s/root\n,
   def-os.root);
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 2509193..03a5c33 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1535,6 +1535,7 @@ struct _virDomainOSDef {
 char *kernel;
 char *initrd;
 char *cmdline;
+char *dtb;
 char *root;
 char *loader;
 char *bootloader;
-- 
1.6.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] qemu: add PCI-multibus support for ppc

2013-03-12 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/qemu/qemu_capabilities.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7bc1ebc..7d7791d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2209,6 +2209,11 @@ virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t 
runUid, gid_t runGid)
 virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_ACPI);
 }
 
+/* ppc support PCI-multibus */
+if (qemuCaps-arch == VIR_ARCH_PPC) {
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
+}
+
 /* virQEMUCapsExtractDeviceStr will only set additional caps if qemu
  * understands the 0.13.0+ notion of -device driver,.  */
 if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) 
@@ -2450,6 +2455,11 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI);
 }
 
+/* ppc support PCI-multibus */
+if (qemuCaps-arch == VIR_ARCH_PPC) {
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
+}
+
 if (virQEMUCapsProbeQMPCommands(qemuCaps, mon)  0)
 goto cleanup;
 if (virQEMUCapsProbeQMPEvents(qemuCaps, mon)  0)
-- 
1.6.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 1/2] QEMU: add -dtb option support

2013-02-27 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/conf/domain_conf.c   |4 
 src/conf/domain_conf.h   |1 +
 src/qemu/qemu_capabilities.c |3 +++
 src/qemu/qemu_capabilities.h |1 +
 src/qemu/qemu_command.c  |6 ++
 5 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0c75838..07ad6b9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1771,6 +1771,7 @@ void virDomainDefFree(virDomainDefPtr def)
 VIR_FREE(def-os.kernel);
 VIR_FREE(def-os.initrd);
 VIR_FREE(def-os.cmdline);
+VIR_FREE(def-os.dtb);
 VIR_FREE(def-os.root);
 VIR_FREE(def-os.loader);
 VIR_FREE(def-os.bootloader);
@@ -9993,6 +9994,7 @@ virDomainDefParseXML(virCapsPtr caps,
 def-os.kernel = virXPathString(string(./os/kernel[1]), ctxt);
 def-os.initrd = virXPathString(string(./os/initrd[1]), ctxt);
 def-os.cmdline = virXPathString(string(./os/cmdline[1]), ctxt);
+def-os.dtb = virXPathString(string(./os/dtb[1]), ctxt);
 def-os.root = virXPathString(string(./os/root[1]), ctxt);
 def-os.loader = virXPathString(string(./os/loader[1]), ctxt);
 }
@@ -14506,6 +14508,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
   def-os.initrd);
 virBufferEscapeString(buf, cmdline%s/cmdline\n,
   def-os.cmdline);
+virBufferEscapeString(buf, dtb%s/dtb\n,
+  def-os.dtb);
 virBufferEscapeString(buf, root%s/root\n,
   def-os.root);
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4ffa4aa..892640f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1545,6 +1545,7 @@ struct _virDomainOSDef {
 char *kernel;
 char *initrd;
 char *cmdline;
+char *dtb;
 char *root;
 char *loader;
 char *bootloader;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 35a714d..7f226b6 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -206,6 +206,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
   usb-net,
   add-fd,
   nbd-server,
+  dtb,
 );
 
 struct _virQEMUCaps {
@@ -940,6 +941,8 @@ virQEMUCapsComputeCmdFlags(const char *help,
 }
 if (strstr(help, -uuid))
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_UUID);
+if (strstr(help, -dtb))
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
 if (strstr(help, -xen-domid))
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_XEN_DOMID);
 else if (strstr(help, -domid))
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 7c55dc8..1f1bfa3 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -167,6 +167,7 @@ enum virQEMUCapsFlags {
 QEMU_CAPS_DEVICE_USB_NET = 126, /* -device usb-net */
 QEMU_CAPS_ADD_FD = 127, /* -add-fd */
 QEMU_CAPS_NBD_SERVER = 128, /* nbd-server-start QMP command */
+QEMU_CAPS_DTB= 129, /* -dtb available */
 
 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 dee493f..e979e09 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5628,6 +5628,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 virCommandAddArgList(cmd, -initrd, def-os.initrd, NULL);
 if (def-os.cmdline)
 virCommandAddArgList(cmd, -append, def-os.cmdline, NULL);
+if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB)  (def-os.dtb))
+virCommandAddArgList(cmd, -dtb, def-os.dtb, NULL);
 } else {
 virCommandAddArgList(cmd, -bootloader, def-os.bootloader, NULL);
 }
@@ -8794,6 +8796,10 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 WANT_VALUE();
 if (!(def-os.cmdline = strdup(val)))
 goto no_memory;
+} else if (STREQ(arg, -dtb)) {
+WANT_VALUE();
+if (!(def-os.dtb = strdup(val)))
+goto no_memory;
 } else if (STREQ(arg, -boot)) {
 const char *token = NULL;
 WANT_VALUE();
-- 
1.6.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 0/2] QEMU: add -dtb option support

2013-02-27 Thread Olivia Yin
Sometime qemu need load specific device tree binary image.
These patches provides -dtb option support and update docs/tests.


Olivia Yin (2):
  QEMU: add -dtb option support
  update documents and test cases for -dtb support

 src/conf/domain_conf.c   |4 
 src/conf/domain_conf.h   |1 +
 src/qemu/qemu_capabilities.c |3 +++
 src/qemu/qemu_capabilities.h |1 +
 src/qemu/qemu_command.c  |6 ++
 docs/formatdomain.html.in|5 
 docs/schemas/domaincommon.rng|5 
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 2/2] update documents and test cases for -dtb support

2013-02-27 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 docs/formatdomain.html.in|5 
 docs/schemas/domaincommon.rng|5 
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
 4 files changed, 39 insertions(+), 0 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a9003d7..ae00a25 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -232,6 +232,7 @@
 lt;kernelgt;/root/f8-i386-vmlinuzlt;/kernelgt;
 lt;initrdgt;/root/f8-i386-initrdlt;/initrdgt;
 lt;cmdlinegt;console=ttyS0 
ks=http://example.com/f8-i386/os/lt;/cmdlinegt;
+lt;dtbgt;/root/ppc.dtblt;/dtbgt;
   lt;/osgt;
   .../pre
 
@@ -253,6 +254,10 @@
 the kernel (or installer) at boottime. This is often used to
 specify an alternate primary console (eg serial port), or the
 installation media source / kickstart file/dd
+  dtcodedtb/code/dt
+  ddThe contents of this element specify the fully-qualified path
+to the (optional) device tree binary (dtb) image in the host OS.
+Since 1.0.4/dd
 /dl
 
 h4a name=eleemntsOSContainerContainer boot/a/h4
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 63be4aa..80e9d93 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -835,6 +835,11 @@
   text/
 /element
   /optional
+  optional
+element name=dtb
+  ref name=absFilePath/
+/element
+  /optional
 /interleave
   /define
   define name=osbootdev
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
new file mode 100644
index 000..99ee22c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
/usr/bin/qemu-system-ppc -M ppce500v2 -enable-kvm -m 256 -nographic -kernel 
/media/ram/uImage -initrd /media/ram/ramdisk -append root=/dev/ram rw 
console=ttyS0,115200 -dtb /media/ram/test.dtb -serial pty
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
new file mode 100644
index 000..3674621
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
@@ -0,0 +1,28 @@
+domain type='kvm'
+  nameQEMUGuest1/name
+  uuid49545eb3-75e1-2d0a-acdd-f0294406c99e/uuid
+  memory unit='KiB'262144/memory
+  currentMemory unit='KiB'262144/currentMemory
+  vcpu placement='static'1/vcpu
+  os
+type arch='ppc' machine='ppce500v2'hvm/type
+kernel/media/ram/uImage/kernel
+initrd/media/ram/ramdisk/initrd
+cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
+dtb/media/ram/test.dtb/dtb
+  /os
+  clock offset='utc'/
+  on_poweroffdestroy/on_poweroff
+  on_rebootrestart/on_reboot
+  on_crashdestroy/on_crash
+  devices
+emulator/usr/bin/qemu-system-ppc/emulator
+serial type='pty'
+  target port='0'/
+/serial
+console type='pty'
+  target type='serial' port='0'/
+/console
+memballoon model='virtio'/
+  /devices
+/domain
-- 
1.6.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v3 0/4] qemu: -dtb option support

2013-02-27 Thread Olivia Yin
Sometime QEMU need load specific device tree binary images.
These patches provide -dtb option support and update docs/tests.

Olivia Yin (4):
  QEMU: add -dtb option support
  qemu: add dtb capability
  docs: add -dtb option support to QEMU
  tests: add dtb test case

 src/conf/domain_conf.c   |4 
 src/conf/domain_conf.h   |1 +
 src/qemu/qemu_command.c  |6 ++
 src/qemu/qemu_capabilities.c |3 +++
 src/qemu/qemu_capabilities.h |1 +
 docs/formatdomain.html.in|5 +
 docs/schemas/domaincommon.rng|5 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
 tests/qemuxml2argvtest.c |2 +

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v3 4/4] tests: add dtb test case

2013-02-27 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
 tests/qemuxml2argvtest.c |2 +
 3 files changed, 31 insertions(+), 0 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
new file mode 100644
index 000..99ee22c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
/usr/bin/qemu-system-ppc -M ppce500v2 -enable-kvm -m 256 -nographic -kernel 
/media/ram/uImage -initrd /media/ram/ramdisk -append root=/dev/ram rw 
console=ttyS0,115200 -dtb /media/ram/test.dtb -serial pty
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
new file mode 100644
index 000..3674621
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
@@ -0,0 +1,28 @@
+domain type='kvm'
+  nameQEMUGuest1/name
+  uuid49545eb3-75e1-2d0a-acdd-f0294406c99e/uuid
+  memory unit='KiB'262144/memory
+  currentMemory unit='KiB'262144/currentMemory
+  vcpu placement='static'1/vcpu
+  os
+type arch='ppc' machine='ppce500v2'hvm/type
+kernel/media/ram/uImage/kernel
+initrd/media/ram/ramdisk/initrd
+cmdlineroot=/dev/ram rw console=ttyS0,115200/cmdline
+dtb/media/ram/test.dtb/dtb
+  /os
+  clock offset='utc'/
+  on_poweroffdestroy/on_poweroff
+  on_rebootrestart/on_reboot
+  on_crashdestroy/on_crash
+  devices
+emulator/usr/bin/qemu-system-ppc/emulator
+serial type='pty'
+  target port='0'/
+/serial
+console type='pty'
+  target type='serial' port='0'/
+/console
+memballoon model='virtio'/
+  /devices
+/domain
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b6b5489..78da9cf 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -887,6 +887,8 @@ mymain(void)
 DO_TEST(virtio-rng-egd, QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,
 QEMU_CAPS_OBJECT_RNG_EGD);
 
+DO_TEST(ppc-dtb, QEMU_CAPS_DTB);
+
 virObjectUnref(driver.config);
 virObjectUnref(driver.caps);
 VIR_FREE(map);
-- 
1.6.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v3 1/4] QEMU: add -dtb option support

2013-02-27 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/conf/domain_conf.c  |4 
 src/conf/domain_conf.h  |1 +
 src/qemu/qemu_command.c |6 ++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 995cf0c..9b71066 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1785,6 +1785,7 @@ void virDomainDefFree(virDomainDefPtr def)
 VIR_FREE(def-os.kernel);
 VIR_FREE(def-os.initrd);
 VIR_FREE(def-os.cmdline);
+VIR_FREE(def-os.dtb);
 VIR_FREE(def-os.root);
 VIR_FREE(def-os.loader);
 VIR_FREE(def-os.bootloader);
@@ -10047,6 +10048,7 @@ virDomainDefParseXML(virCapsPtr caps,
 def-os.kernel = virXPathString(string(./os/kernel[1]), ctxt);
 def-os.initrd = virXPathString(string(./os/initrd[1]), ctxt);
 def-os.cmdline = virXPathString(string(./os/cmdline[1]), ctxt);
+def-os.dtb = virXPathString(string(./os/dtb[1]), ctxt);
 def-os.root = virXPathString(string(./os/root[1]), ctxt);
 def-os.loader = virXPathString(string(./os/loader[1]), ctxt);
 }
@@ -14666,6 +14668,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
   def-os.initrd);
 virBufferEscapeString(buf, cmdline%s/cmdline\n,
   def-os.cmdline);
+virBufferEscapeString(buf, dtb%s/dtb\n,
+  def-os.dtb);
 virBufferEscapeString(buf, root%s/root\n,
   def-os.root);
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 5828ae2..a35f90a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1535,6 +1535,7 @@ struct _virDomainOSDef {
 char *kernel;
 char *initrd;
 char *cmdline;
+char *dtb;
 char *root;
 char *loader;
 char *bootloader;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1c9bfc9..fb74ec5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5732,6 +5732,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 virCommandAddArgList(cmd, -initrd, def-os.initrd, NULL);
 if (def-os.cmdline)
 virCommandAddArgList(cmd, -append, def-os.cmdline, NULL);
+if (def-os.dtb)
+virCommandAddArgList(cmd, -dtb, def-os.dtb, NULL);
 } else {
 virCommandAddArgList(cmd, -bootloader, def-os.bootloader, NULL);
 }
@@ -8908,6 +8910,10 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 WANT_VALUE();
 if (!(def-os.cmdline = strdup(val)))
 goto no_memory;
+} else if (STREQ(arg, -dtb)) {
+WANT_VALUE();
+if (!(def-os.dtb = strdup(val)))
+goto no_memory;
 } else if (STREQ(arg, -boot)) {
 const char *token = NULL;
 WANT_VALUE();
-- 
1.6.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v3 2/4] qemu: add dtb capability

2013-02-27 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/qemu/qemu_capabilities.c |3 +++
 src/qemu/qemu_capabilities.h |1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 40022c1..f6a6ab7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -210,6 +210,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
 
   rng-random, /* 130 */
   rng-egd,
+ dtb,
 );
 
 struct _virQEMUCaps {
@@ -944,6 +945,8 @@ virQEMUCapsComputeCmdFlags(const char *help,
 }
 if (strstr(help, -uuid))
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_UUID);
+if (strstr(help, -dtb))
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
 if (strstr(help, -xen-domid))
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_XEN_DOMID);
 else if (strstr(help, -domid))
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a895867..f373285 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -171,6 +171,7 @@ enum virQEMUCapsFlags {
 QEMU_CAPS_OBJECT_RNG_RANDOM  = 130, /* the rng-random backend for
virtio rng */
 QEMU_CAPS_OBJECT_RNG_EGD = 131, /* EGD protocol daemon for rng */
+QEMU_CAPS_DTB= 132, /* -dtb available */
 
 QEMU_CAPS_LAST,   /* this must always be the last item */
 };
-- 
1.6.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v3 3/4] docs: add -dtb option support to QEMU

2013-02-27 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 docs/formatdomain.html.in |5 +
 docs/schemas/domaincommon.rng |5 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 595f151..93b10ac 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -232,6 +232,7 @@
 lt;kernelgt;/root/f8-i386-vmlinuzlt;/kernelgt;
 lt;initrdgt;/root/f8-i386-initrdlt;/initrdgt;
 lt;cmdlinegt;console=ttyS0 
ks=http://example.com/f8-i386/os/lt;/cmdlinegt;
+lt;dtbgt;/root/ppc.dtblt;/dtbgt;
   lt;/osgt;
   .../pre
 
@@ -253,6 +254,10 @@
 the kernel (or installer) at boottime. This is often used to
 specify an alternate primary console (eg serial port), or the
 installation media source / kickstart file/dd
+  dtcodedtb/code/dt
+  ddThe contents of this element specify the fully-qualified path
+to the (optional) device tree binary (dtb) image in the host OS.
+Since 1.0.4/dd
 /dl
 
 h4a name=eleemntsOSContainerContainer boot/a/h4
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e7231cc..970976a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -832,6 +832,11 @@
   text/
 /element
   /optional
+  optional
+element name=dtb
+  ref name=absFilePath/
+/element
+  /optional
 /interleave
   /define
   define name=osbootdev
-- 
1.6.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] add dtb support

2013-02-26 Thread Olivia Yin
Signed-off-by: Olivia Yin hong-hua@freescale.com
---
 src/conf/domain_conf.c  |4 
 src/conf/domain_conf.h  |1 +
 src/qemu/qemu_command.c |6 ++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0c75838..07ad6b9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1771,6 +1771,7 @@ void virDomainDefFree(virDomainDefPtr def)
 VIR_FREE(def-os.kernel);
 VIR_FREE(def-os.initrd);
 VIR_FREE(def-os.cmdline);
+VIR_FREE(def-os.dtb);
 VIR_FREE(def-os.root);
 VIR_FREE(def-os.loader);
 VIR_FREE(def-os.bootloader);
@@ -9993,6 +9994,7 @@ virDomainDefParseXML(virCapsPtr caps,
 def-os.kernel = virXPathString(string(./os/kernel[1]), ctxt);
 def-os.initrd = virXPathString(string(./os/initrd[1]), ctxt);
 def-os.cmdline = virXPathString(string(./os/cmdline[1]), ctxt);
+def-os.dtb = virXPathString(string(./os/dtb[1]), ctxt);
 def-os.root = virXPathString(string(./os/root[1]), ctxt);
 def-os.loader = virXPathString(string(./os/loader[1]), ctxt);
 }
@@ -14506,6 +14508,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
   def-os.initrd);
 virBufferEscapeString(buf, cmdline%s/cmdline\n,
   def-os.cmdline);
+virBufferEscapeString(buf, dtb%s/dtb\n,
+  def-os.dtb);
 virBufferEscapeString(buf, root%s/root\n,
   def-os.root);
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4ffa4aa..892640f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1545,6 +1545,7 @@ struct _virDomainOSDef {
 char *kernel;
 char *initrd;
 char *cmdline;
+char *dtb;
 char *root;
 char *loader;
 char *bootloader;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index dee493f..0c68778 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5628,6 +5628,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 virCommandAddArgList(cmd, -initrd, def-os.initrd, NULL);
 if (def-os.cmdline)
 virCommandAddArgList(cmd, -append, def-os.cmdline, NULL);
+if (def-os.dtb)
+virCommandAddArgList(cmd, -dtb, def-os.dtb, NULL);
 } else {
 virCommandAddArgList(cmd, -bootloader, def-os.bootloader, NULL);
 }
@@ -8794,6 +8796,10 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 WANT_VALUE();
 if (!(def-os.cmdline = strdup(val)))
 goto no_memory;
+} else if (STREQ(arg, -dtb)) {
+WANT_VALUE();
+if (!(def-os.dtb = strdup(val)))
+goto no_memory;
 } else if (STREQ(arg, -boot)) {
 const char *token = NULL;
 WANT_VALUE();
-- 
1.6.4


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list