[libvirt] [PATCHv2 0/5] Basic Enablement of s390

Resending as a thread, same content. Please ignore previous submission. The first series of patches aimed to enable libvirt to manage qemu/kvm domains hosted on the System z platform. The patches in this series address s390 specifics of node and hypervisor. Patches 2,3 and 5 are written by Thang Pham <thang.pham@us.ibm.com> the others are my doing. Since they all should go together, I am sending in Thang's as well, hoping to facilitate the review a bit this way. Thang Pham (3): S390: CPU support for s390(x) S390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture S390: Added sysinfo for host on s390x. Viktor Mihajlovski (2): S390: Override QEMU_CAPS_NO_ACPI for s390x S390: Fixed core identification for s390 src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 ++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++ src/nodeinfo.c | 11 +++ src/qemu/qemu_capabilities.c | 5 ++ src/util/sysinfo.c | 154 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 284 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h

Starting a KVM guest on s390 fails immediately. This is because "qemu --help" reports -no-acpi even for the s390(x) architecture but -no-acpi isn't supported there. Workaround is to remove QEMU_CAPS_NO_ACPI from the capability set after the version/capability extraction. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/qemu/qemu_capabilities.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4308833..0c01cb0 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1511,6 +1511,11 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char *arch, qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIBUS); } + /* S390 and probably other archs do not support no-acpi - + maybe the qemu option parsing should be re-thought. */ + if (STREQLEN(arch, "s390x", 5)) + qemuCapsClear(flags, QEMU_CAPS_NO_ACPI); + /* qemuCapsExtractDeviceStr will only set additional flags if qemu * understands the 0.13.0+ notion of "-device driver,". */ if (qemuCapsGet(flags, QEMU_CAPS_DEVICE) && -- 1.7.0.4

On Fri, Jun 22, 2012 at 01:50:10PM +0200, Viktor Mihajlovski wrote:
Starting a KVM guest on s390 fails immediately. This is because "qemu --help" reports -no-acpi even for the s390(x) architecture but -no-acpi isn't supported there. Workaround is to remove QEMU_CAPS_NO_ACPI from the capability set after the version/capability extraction.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/qemu/qemu_capabilities.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4308833..0c01cb0 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1511,6 +1511,11 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char *arch, qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIBUS); }
+ /* S390 and probably other archs do not support no-acpi - + maybe the qemu option parsing should be re-thought. */ + if (STREQLEN(arch, "s390x", 5)) + qemuCapsClear(flags, QEMU_CAPS_NO_ACPI); + /* qemuCapsExtractDeviceStr will only set additional flags if qemu * understands the 0.13.0+ notion of "-device driver,". */ if (qemuCapsGet(flags, QEMU_CAPS_DEVICE) &&
Shouldn't the "s390" prefix be used instead to catch both s390 and s390x ? Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 22.06.2012 13:50, Viktor Mihajlovski wrote:
Starting a KVM guest on s390 fails immediately. This is because "qemu --help" reports -no-acpi even for the s390(x) architecture but -no-acpi isn't supported there. Workaround is to remove QEMU_CAPS_NO_ACPI from the capability set after the version/capability extraction.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/qemu/qemu_capabilities.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4308833..0c01cb0 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1511,6 +1511,11 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char *arch, qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIBUS); }
+ /* S390 and probably other archs do not support no-acpi - + maybe the qemu option parsing should be re-thought. */ + if (STREQLEN(arch, "s390x", 5)) + qemuCapsClear(flags, QEMU_CAPS_NO_ACPI); + /* qemuCapsExtractDeviceStr will only set additional flags if qemu * understands the 0.13.0+ notion of "-device driver,". */ if (qemuCapsGet(flags, QEMU_CAPS_DEVICE) &&
Pushed with this change: diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index dda9422..1e12a39 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1516,7 +1516,7 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char *arch, /* S390 and probably other archs do not support no-acpi - maybe the qemu option parsing should be re-thought. */ - if (STREQLEN(arch, "s390x", 5)) + if (STRPREFIX(arch, "s390")) qemuCapsClear(flags, QEMU_CAPS_NO_ACPI); /* qemuCapsExtractDeviceStr will only set additional flags if qemu Michal

From: Thang Pham <thang.pham@us.ibm.com> Adding CPU encoder/decoder for s390 to avoid runtime error messages. Signed-off-by: Thang Pham <thang.pham@us.ibm.com> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++++++++++++ 4 files changed, 114 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h diff --git a/src/Makefile.am b/src/Makefile.am index e40909b..b0bd3e8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -566,6 +566,7 @@ CPU_SOURCES = \ cpu/cpu.h cpu/cpu.c \ cpu/cpu_generic.h cpu/cpu_generic.c \ cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \ + cpu/cpu_s390x.h cpu/cpu_s390x.c \ cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \ cpu/cpu_powerpc.c diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index b8ccd24..08cb144 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -29,6 +29,7 @@ #include "cpu.h" #include "cpu_x86.h" #include "cpu_powerpc.h" +#include "cpu_s390x.h" #include "cpu_generic.h" @@ -38,6 +39,7 @@ static struct cpuArchDriver *drivers[] = { &cpuDriverX86, &cpuDriverPowerPC, + &cpuDriverS390X, /* generic driver must always be the last one */ &cpuDriverGeneric }; diff --git a/src/cpu/cpu_s390x.c b/src/cpu/cpu_s390x.c new file mode 100644 index 0000000..da45433 --- /dev/null +++ b/src/cpu/cpu_s390x.c @@ -0,0 +1,80 @@ +/* + * cpu_s390x.c: CPU driver for s390x CPUs + * + * Copyright IBM Corp. 2012 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: + * Thang Pham <thang.pham@us.ibm.com> + */ + +#include <config.h> + +#include "memory.h" +#include "cpu.h" + + +#define VIR_FROM_THIS VIR_FROM_CPU + +static const char *archs[] = { "s390", "s390x" }; + +static union cpuData * +s390xNodeData(void) +{ + union cpuData *data; + + if (VIR_ALLOC(data) < 0) { + virReportOOMError(); + return NULL; + } + + return data; +} + + +static int +s390xDecode(virCPUDefPtr cpu ATTRIBUTE_UNUSED, + const union cpuData *data ATTRIBUTE_UNUSED, + const char **models ATTRIBUTE_UNUSED, + unsigned int nmodels ATTRIBUTE_UNUSED, + const char *preferred ATTRIBUTE_UNUSED) +{ + return 0; +} + +static void +s390xDataFree(union cpuData *data) +{ + if (data == NULL) + return; + + VIR_FREE(data); +} + +struct cpuArchDriver cpuDriverS390X = { + .name = "s390x", + .arch = archs, + .narch = ARRAY_CARDINALITY(archs), + .compare = NULL, + .decode = s390xDecode, + .encode = NULL, + .free = s390xDataFree, + .nodeData = s390xNodeData, + .guestData = NULL, + .baseline = NULL, + .update = NULL, + .hasFeature = NULL, +}; diff --git a/src/cpu/cpu_s390x.h b/src/cpu/cpu_s390x.h new file mode 100644 index 0000000..f91377f --- /dev/null +++ b/src/cpu/cpu_s390x.h @@ -0,0 +1,31 @@ +/* + * cpu_s390x.c: CPU driver for s390x CPUs + * + * Copyright IBM Corp. 2012 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: + * Thang Pham <thang.pham@us.ibm.com> + */ + +#ifndef __VIR_CPU_S390X_H__ +# define __VIR_CPU_S390X_H__ + +# include "cpu.h" + +extern struct cpuArchDriver cpuDriverS390X; + +#endif /* __VIR_CPU_S390X_H__ */ -- 1.7.0.4

On Fri, Jun 22, 2012 at 01:50:11PM +0200, Viktor Mihajlovski wrote:
From: Thang Pham <thang.pham@us.ibm.com>
Adding CPU encoder/decoder for s390 to avoid runtime error messages.
Signed-off-by: Thang Pham <thang.pham@us.ibm.com> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++++++++++++ 4 files changed, 114 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h
diff --git a/src/Makefile.am b/src/Makefile.am index e40909b..b0bd3e8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -566,6 +566,7 @@ CPU_SOURCES = \ cpu/cpu.h cpu/cpu.c \ cpu/cpu_generic.h cpu/cpu_generic.c \ cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \ + cpu/cpu_s390x.h cpu/cpu_s390x.c \ cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \ cpu/cpu_powerpc.c
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index b8ccd24..08cb144 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -29,6 +29,7 @@ #include "cpu.h" #include "cpu_x86.h" #include "cpu_powerpc.h" +#include "cpu_s390x.h" #include "cpu_generic.h"
@@ -38,6 +39,7 @@ static struct cpuArchDriver *drivers[] = { &cpuDriverX86, &cpuDriverPowerPC, + &cpuDriverS390X, /* generic driver must always be the last one */ &cpuDriverGeneric }; diff --git a/src/cpu/cpu_s390x.c b/src/cpu/cpu_s390x.c new file mode 100644 index 0000000..da45433 --- /dev/null +++ b/src/cpu/cpu_s390x.c @@ -0,0 +1,80 @@ +/* + * cpu_s390x.c: CPU driver for s390x CPUs + * + * Copyright IBM Corp. 2012 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: + * Thang Pham <thang.pham@us.ibm.com> + */ + +#include <config.h> + +#include "memory.h" +#include "cpu.h" + + +#define VIR_FROM_THIS VIR_FROM_CPU + +static const char *archs[] = { "s390", "s390x" }; + +static union cpuData * +s390xNodeData(void) +{ + union cpuData *data; + + if (VIR_ALLOC(data) < 0) { + virReportOOMError(); + return NULL; + } + + return data; +} + + +static int +s390xDecode(virCPUDefPtr cpu ATTRIBUTE_UNUSED, + const union cpuData *data ATTRIBUTE_UNUSED, + const char **models ATTRIBUTE_UNUSED, + unsigned int nmodels ATTRIBUTE_UNUSED, + const char *preferred ATTRIBUTE_UNUSED) +{ + return 0; +} + +static void +s390xDataFree(union cpuData *data) +{ + if (data == NULL) + return; + + VIR_FREE(data); +} + +struct cpuArchDriver cpuDriverS390X = { + .name = "s390x", + .arch = archs, + .narch = ARRAY_CARDINALITY(archs), + .compare = NULL, + .decode = s390xDecode, + .encode = NULL, + .free = s390xDataFree, + .nodeData = s390xNodeData, + .guestData = NULL, + .baseline = NULL, + .update = NULL, + .hasFeature = NULL, +}; diff --git a/src/cpu/cpu_s390x.h b/src/cpu/cpu_s390x.h new file mode 100644 index 0000000..f91377f --- /dev/null +++ b/src/cpu/cpu_s390x.h @@ -0,0 +1,31 @@ +/* + * cpu_s390x.c: CPU driver for s390x CPUs + * + * Copyright IBM Corp. 2012 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: + * Thang Pham <thang.pham@us.ibm.com> + */ + +#ifndef __VIR_CPU_S390X_H__ +# define __VIR_CPU_S390X_H__ + +# include "cpu.h" + +extern struct cpuArchDriver cpuDriverS390X; + +#endif /* __VIR_CPU_S390X_H__ */
Again a small naming issue, why s390x when we ought to cope with s390 too (and the arch array lists both). I would name them cpu_s390.[ch] instead as this is the most generic. I would also update the top comment to explain both are supported. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Fri, Jun 22, 2012 at 01:50:11PM +0200, Viktor Mihajlovski wrote:
From: Thang Pham <thang.pham@us.ibm.com>
Adding CPU encoder/decoder for s390 to avoid runtime error messages.
Signed-off-by: Thang Pham <thang.pham@us.ibm.com> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++++++++++++ 4 files changed, 114 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h
diff --git a/src/Makefile.am b/src/Makefile.am index e40909b..b0bd3e8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -566,6 +566,7 @@ CPU_SOURCES = \ cpu/cpu.h cpu/cpu.c \ cpu/cpu_generic.h cpu/cpu_generic.c \ cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \ + cpu/cpu_s390x.h cpu/cpu_s390x.c \ cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \ cpu/cpu_powerpc.c
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index b8ccd24..08cb144 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -29,6 +29,7 @@ #include "cpu.h" #include "cpu_x86.h" #include "cpu_powerpc.h" +#include "cpu_s390x.h" #include "cpu_generic.h"
@@ -38,6 +39,7 @@ static struct cpuArchDriver *drivers[] = { &cpuDriverX86, &cpuDriverPowerPC, + &cpuDriverS390X, /* generic driver must always be the last one */ &cpuDriverGeneric }; diff --git a/src/cpu/cpu_s390x.c b/src/cpu/cpu_s390x.c new file mode 100644 index 0000000..da45433 --- /dev/null +++ b/src/cpu/cpu_s390x.c @@ -0,0 +1,80 @@ +/* + * cpu_s390x.c: CPU driver for s390x CPUs + * + * Copyright IBM Corp. 2012 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: + * Thang Pham <thang.pham@us.ibm.com> + */ + +#include <config.h> + +#include "memory.h" +#include "cpu.h" + + +#define VIR_FROM_THIS VIR_FROM_CPU + +static const char *archs[] = { "s390", "s390x" }; + +static union cpuData * +s390xNodeData(void) +{ + union cpuData *data; + + if (VIR_ALLOC(data) < 0) { + virReportOOMError(); + return NULL; + } + + return data; +} + + +static int +s390xDecode(virCPUDefPtr cpu ATTRIBUTE_UNUSED, + const union cpuData *data ATTRIBUTE_UNUSED, + const char **models ATTRIBUTE_UNUSED, + unsigned int nmodels ATTRIBUTE_UNUSED, + const char *preferred ATTRIBUTE_UNUSED)
Following lines are indented 2 spaces too many
+{ + return 0; +} + +static void +s390xDataFree(union cpuData *data) +{ + if (data == NULL) + return; + + VIR_FREE(data); +} + +struct cpuArchDriver cpuDriverS390X = { + .name = "s390x", + .arch = archs, + .narch = ARRAY_CARDINALITY(archs), + .compare = NULL, + .decode = s390xDecode, + .encode = NULL, + .free = s390xDataFree, + .nodeData = s390xNodeData, + .guestData = NULL, + .baseline = NULL, + .update = NULL, + .hasFeature = NULL, +}; diff --git a/src/cpu/cpu_s390x.h b/src/cpu/cpu_s390x.h new file mode 100644 index 0000000..f91377f --- /dev/null +++ b/src/cpu/cpu_s390x.h @@ -0,0 +1,31 @@ +/* + * cpu_s390x.c: CPU driver for s390x CPUs + * + * Copyright IBM Corp. 2012 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: + * Thang Pham <thang.pham@us.ibm.com> + */ + +#ifndef __VIR_CPU_S390X_H__ +# define __VIR_CPU_S390X_H__ + +# include "cpu.h" + +extern struct cpuArchDriver cpuDriverS390X; + +#endif /* __VIR_CPU_S390X_H__ */
ACK, though I agree with DV that we should do s/s390x/s390/ in the filename & all the variable/function names, since this code is applicable to s390 + s390x Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 22.06.2012 13:50, Viktor Mihajlovski wrote:
From: Thang Pham <thang.pham@us.ibm.com>
Adding CPU encoder/decoder for s390 to avoid runtime error messages.
Signed-off-by: Thang Pham <thang.pham@us.ibm.com> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++++++++++++ 4 files changed, 114 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h
diff --git a/src/Makefile.am b/src/Makefile.am index e40909b..b0bd3e8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -566,6 +566,7 @@ CPU_SOURCES = \ cpu/cpu.h cpu/cpu.c \ cpu/cpu_generic.h cpu/cpu_generic.c \ cpu/cpu_x86.h cpu/cpu_x86.c cpu/cpu_x86_data.h \ + cpu/cpu_s390x.h cpu/cpu_s390x.c \ cpu/cpu_map.h cpu/cpu_map.c cpu/cpu_powerpc.h \ cpu/cpu_powerpc.c
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index b8ccd24..08cb144 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -29,6 +29,7 @@ #include "cpu.h" #include "cpu_x86.h" #include "cpu_powerpc.h" +#include "cpu_s390x.h" #include "cpu_generic.h"
@@ -38,6 +39,7 @@ static struct cpuArchDriver *drivers[] = { &cpuDriverX86, &cpuDriverPowerPC, + &cpuDriverS390X, /* generic driver must always be the last one */ &cpuDriverGeneric }; diff --git a/src/cpu/cpu_s390x.c b/src/cpu/cpu_s390x.c new file mode 100644 index 0000000..da45433 --- /dev/null +++ b/src/cpu/cpu_s390x.c @@ -0,0 +1,80 @@ +/* + * cpu_s390x.c: CPU driver for s390x CPUs + * + * Copyright IBM Corp. 2012 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: + * Thang Pham <thang.pham@us.ibm.com> + */ + +#include <config.h> + +#include "memory.h" +#include "cpu.h" + + +#define VIR_FROM_THIS VIR_FROM_CPU + +static const char *archs[] = { "s390", "s390x" }; + +static union cpuData * +s390xNodeData(void) +{ + union cpuData *data; + + if (VIR_ALLOC(data) < 0) { + virReportOOMError(); + return NULL; + } + + return data; +} + + +static int +s390xDecode(virCPUDefPtr cpu ATTRIBUTE_UNUSED, + const union cpuData *data ATTRIBUTE_UNUSED, + const char **models ATTRIBUTE_UNUSED, + unsigned int nmodels ATTRIBUTE_UNUSED, + const char *preferred ATTRIBUTE_UNUSED) +{ + return 0; +}
Again indent.
+ +static void +s390xDataFree(union cpuData *data) +{ + if (data == NULL) + return;
Useless. VIR_FREE handles this.
+ + VIR_FREE(data); +} + +struct cpuArchDriver cpuDriverS390X = { + .name = "s390x", + .arch = archs, + .narch = ARRAY_CARDINALITY(archs), + .compare = NULL, + .decode = s390xDecode, + .encode = NULL, + .free = s390xDataFree, + .nodeData = s390xNodeData, + .guestData = NULL, + .baseline = NULL, + .update = NULL, + .hasFeature = NULL, +}; diff --git a/src/cpu/cpu_s390x.h b/src/cpu/cpu_s390x.h new file mode 100644 index 0000000..f91377f --- /dev/null +++ b/src/cpu/cpu_s390x.h @@ -0,0 +1,31 @@ +/* + * cpu_s390x.c: CPU driver for s390x CPUs + * + * Copyright IBM Corp. 2012 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: + * Thang Pham <thang.pham@us.ibm.com> + */ + +#ifndef __VIR_CPU_S390X_H__ +# define __VIR_CPU_S390X_H__ + +# include "cpu.h" + +extern struct cpuArchDriver cpuDriverS390X; + +#endif /* __VIR_CPU_S390X_H__ */
Fixed, renamed to cpu_s390.[ch] and pushed. Michal

From: Thang Pham <thang.pham@us.ibm.com> Minimal CPU "parser" for s390 to avoid compile time warning. Signed-off-by: Thang Pham <thang.pham@us.ibm.com> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/nodeinfo.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index f7d0cc6..7eb5ae5 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -315,6 +315,11 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, * and parsed in next iteration, because it is not in expected * format and thus lead to error. */ } +# elif defined(__s390__) || \ + defined(__s390x__) + /* s390x has no realistic value for CPU speed, + * assign a value of zero to signify this */ + nodeinfo->mhz = 0; # else # warning Parser for /proc/cpuinfo needs to be adapted for your architecture # endif -- 1.7.0.4

On Fri, Jun 22, 2012 at 01:50:12PM +0200, Viktor Mihajlovski wrote:
From: Thang Pham <thang.pham@us.ibm.com>
Minimal CPU "parser" for s390 to avoid compile time warning.
Signed-off-by: Thang Pham <thang.pham@us.ibm.com> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/nodeinfo.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c index f7d0cc6..7eb5ae5 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -315,6 +315,11 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, * and parsed in next iteration, because it is not in expected * format and thus lead to error. */ } +# elif defined(__s390__) || \ + defined(__s390x__) + /* s390x has no realistic value for CPU speed, + * assign a value of zero to signify this */ + nodeinfo->mhz = 0; # else # warning Parser for /proc/cpuinfo needs to be adapted for your architecture # endif
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 25.06.2012 13:26, Daniel P. Berrange wrote:
On Fri, Jun 22, 2012 at 01:50:12PM +0200, Viktor Mihajlovski wrote:
From: Thang Pham <thang.pham@us.ibm.com>
Minimal CPU "parser" for s390 to avoid compile time warning.
Signed-off-by: Thang Pham <thang.pham@us.ibm.com> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/nodeinfo.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c index f7d0cc6..7eb5ae5 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -315,6 +315,11 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, * and parsed in next iteration, because it is not in expected * format and thus lead to error. */ } +# elif defined(__s390__) || \ + defined(__s390x__) + /* s390x has no realistic value for CPU speed, + * assign a value of zero to signify this */ + nodeinfo->mhz = 0; # else # warning Parser for /proc/cpuinfo needs to be adapted for your architecture # endif
ACK
Daniel
Pushed now. Michal

For the s390x architecture the sysfs core_id alone is not unique. As a result it can happen that libvirt thinks there are less host CPUs available than really present. Currently, a logical CPU is equivalent to a core for s390x. We therefore produce a fake core id from the CPU number. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/nodeinfo.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 7eb5ae5..819f954 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -355,7 +355,13 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, nodeinfo->cpus++; /* Parse core */ +# if defined(__s390__) || \ + defined(__s390x__) + /* logical cpu is equivalent to a core on s390 */ + core = cpu; +# else core = virNodeGetCpuValue(sysfs_cpudir, cpu, "topology/core_id", false); +# endif if (!CPU_ISSET(core, &core_mask)) { CPU_SET(core, &core_mask); nodeinfo->cores++; -- 1.7.0.4

On Fri, Jun 22, 2012 at 01:50:13PM +0200, Viktor Mihajlovski wrote:
For the s390x architecture the sysfs core_id alone is not unique. As a result it can happen that libvirt thinks there are less host CPUs available than really present. Currently, a logical CPU is equivalent to a core for s390x. We therefore produce a fake core id from the CPU number.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/nodeinfo.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 7eb5ae5..819f954 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -355,7 +355,13 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, nodeinfo->cpus++;
/* Parse core */ +# if defined(__s390__) || \ + defined(__s390x__) + /* logical cpu is equivalent to a core on s390 */ + core = cpu; +# else core = virNodeGetCpuValue(sysfs_cpudir, cpu, "topology/core_id", false); +# endif if (!CPU_ISSET(core, &core_mask)) { CPU_SET(core, &core_mask); nodeinfo->cores++;
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 25.06.2012 13:25, Daniel P. Berrange wrote:
On Fri, Jun 22, 2012 at 01:50:13PM +0200, Viktor Mihajlovski wrote:
For the s390x architecture the sysfs core_id alone is not unique. As a result it can happen that libvirt thinks there are less host CPUs available than really present. Currently, a logical CPU is equivalent to a core for s390x. We therefore produce a fake core id from the CPU number.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/nodeinfo.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 7eb5ae5..819f954 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -355,7 +355,13 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, nodeinfo->cpus++;
/* Parse core */ +# if defined(__s390__) || \ + defined(__s390x__) + /* logical cpu is equivalent to a core on s390 */ + core = cpu; +# else core = virNodeGetCpuValue(sysfs_cpudir, cpu, "topology/core_id", false); +# endif if (!CPU_ISSET(core, &core_mask)) { CPU_SET(core, &core_mask); nodeinfo->cores++;
ACK
Daniel
Pushed now. Michal

From: Thang Pham <thang.pham@us.ibm.com> In order to retrieve some sysinfo data we need to parse /proc/sysinfo and /proc/cpuinfo. Signed-off-by: Thang Pham <thang.pham@us.ibm.com> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> --- src/util/sysinfo.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 154 insertions(+), 0 deletions(-) diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c index 78efc32..01cce98 100644 --- a/src/util/sysinfo.c +++ b/src/util/sysinfo.c @@ -44,6 +44,7 @@ __FUNCTION__, __LINE__, __VA_ARGS__) #define SYSINFO_SMBIOS_DECODER "dmidecode" +#define SYSINFO "/proc/sysinfo" #define CPUINFO "/proc/cpuinfo" VIR_ENUM_IMPL(virSysinfo, VIR_SYSINFO_LAST, @@ -241,6 +242,159 @@ no_memory: return NULL; } +#elif defined(__s390__) || defined(__s390x__) + +static int +virSysinfoParseSystem(const char *base, virSysinfoDefPtr ret) +{ + char *cur, *eol = NULL; + const char *property; + + /* Return if Manufacturer field is not found */ + if ((cur = strstr(base, "Manufacturer")) == NULL) + return 0; + + base = cur; + if ((cur = strstr(base, "Manufacturer")) != NULL) { + cur = strchr(cur, ':') + 1; + eol = strchr(cur, '\n'); + virSkipSpacesBackwards(cur, &eol); + if ((eol) && ((property = strndup(cur, eol - cur)) == NULL)) + goto no_memory; + virSkipSpaces(&property); + ret->system_manufacturer = (char *) property; + } + if ((cur = strstr(base, "Type")) != NULL) { + cur = strchr(cur, ':') + 1; + eol = strchr(cur, '\n'); + virSkipSpacesBackwards(cur, &eol); + if ((eol) && ((property = strndup(cur, eol - cur)) == NULL)) + goto no_memory; + virSkipSpaces(&property); + ret->system_family = (char *) property; + } + if ((cur = strstr(base, "Sequence Code")) != NULL) { + cur = strchr(cur, ':') + 1; + eol = strchr(cur, '\n'); + virSkipSpacesBackwards(cur, &eol); + if ((eol) && ((property = strndup(cur, eol - cur)) == NULL)) + goto no_memory; + virSkipSpaces(&property); + ret->system_serial = (char *) property; + } + + return 0; + +no_memory: + return -1; +} + +static int +virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret) +{ + char *cur, *eol, *tmp_base; + char *manufacturer; + const char *tmp; + virSysinfoProcessorDefPtr processor; + + if ((cur = strstr(base, "vendor_id")) != NULL) { + cur = strchr(cur, ':') + 1; + eol = strchr(cur, '\n'); + virSkipSpacesBackwards(cur, &eol); + if ((eol) && ((tmp = strndup(cur, eol - cur)) == NULL)) + goto no_memory; + virSkipSpaces(&tmp); + manufacturer = (char *) tmp; + } + + /* Find processor N: line and gather the processor manufacturer, version, serial number, and family */ + while((tmp_base = strstr(base, "processor ")) != NULL) { + base = tmp_base; + eol = strchr(base, '\n'); + cur = strchr(base, ':') + 1; + + if (VIR_EXPAND_N(ret->processor, ret->nprocessor, 1) < 0) { + goto no_memory; + } + + processor = &ret->processor[ret->nprocessor - 1]; + + /* Set the processor manufacturer */ + processor->processor_manufacturer = manufacturer; + + if ((cur = strstr(base, "version =")) != NULL) { + cur += sizeof("version ="); + eol = strchr(cur, ','); + if ((eol) && + ((processor->processor_version = strndup(cur, eol - cur)) == NULL)) + goto no_memory; + } + if ((cur = strstr(base, "identification =")) != NULL) { + cur += sizeof("identification ="); + eol = strchr(cur, ','); + if ((eol) && + ((processor->processor_serial_number = strndup(cur, eol - cur)) == NULL)) + goto no_memory; + } + if ((cur = strstr(base, "machine =")) != NULL) { + cur += sizeof("machine ="); + eol = strchr(cur, '\n'); + if ((eol) && + ((processor->processor_family = strndup(cur, eol - cur)) == NULL)) + goto no_memory; + } + + base = cur; + } + + return 0; + +no_memory: + return -1; +} + +/* virSysinfoRead for s390x + * Gathers sysinfo data from /proc/sysinfo and /proc/cpuinfo */ +virSysinfoDefPtr +virSysinfoRead(void) { + virSysinfoDefPtr ret = NULL; + char *outbuf = NULL; + + if (VIR_ALLOC(ret) < 0) + goto no_memory; + + /* Gather info from /proc/cpuinfo */ + if(virFileReadAll(CPUINFO, 2048, &outbuf) < 0) { + virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to open %s"), CPUINFO); + return NULL; + } + + ret->nprocessor = 0; + ret->processor = NULL; + if (virSysinfoParseProcessor(outbuf, ret) < 0) + goto no_memory; + + /* Free buffer before reading next file */ + VIR_FREE(outbuf); + + /* Gather info from /proc/sysinfo */ + if(virFileReadAll(SYSINFO, 4096, &outbuf) < 0) { + virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to open %s"), SYSINFO); + return NULL; + } + + if (virSysinfoParseSystem(outbuf, ret) < 0) + goto no_memory; + + return ret; + +no_memory: + VIR_FREE(outbuf); + return NULL; +} + #elif defined(WIN32) || \ !(defined(__x86_64__) || \ defined(__i386__) || \ -- 1.7.0.4

On Fri, Jun 22, 2012 at 01:50:14PM +0200, Viktor Mihajlovski wrote:
+static int +virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret) +{
+ /* Find processor N: line and gather the processor manufacturer, version, serial number, and family */ + while((tmp_base = strstr(base, "processor ")) != NULL) {
Missing space after 'while'
+/* virSysinfoRead for s390x + * Gathers sysinfo data from /proc/sysinfo and /proc/cpuinfo */ +virSysinfoDefPtr +virSysinfoRead(void) { + virSysinfoDefPtr ret = NULL; + char *outbuf = NULL; + + if (VIR_ALLOC(ret) < 0) + goto no_memory; + + /* Gather info from /proc/cpuinfo */ + if(virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
Missing space after 'if'
+ virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to open %s"), CPUINFO); + return NULL; + } + + ret->nprocessor = 0; + ret->processor = NULL; + if (virSysinfoParseProcessor(outbuf, ret) < 0) + goto no_memory; + + /* Free buffer before reading next file */ + VIR_FREE(outbuf); + + /* Gather info from /proc/sysinfo */ + if(virFileReadAll(SYSINFO, 4096, &outbuf) < 0) {
Missing space
+ virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to open %s"), SYSINFO); + return NULL; + }
Messed up indentation.
+ + if (virSysinfoParseSystem(outbuf, ret) < 0) + goto no_memory; + + return ret; + +no_memory: + VIR_FREE(outbuf); + return NULL; +} + #elif defined(WIN32) || \ !(defined(__x86_64__) || \ defined(__i386__) || \
ACK with the whitespace fixes Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 25.06.2012 13:29, Daniel P. Berrange wrote:
On Fri, Jun 22, 2012 at 01:50:14PM +0200, Viktor Mihajlovski wrote:
+static int +virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret) +{
+ /* Find processor N: line and gather the processor manufacturer, version, serial number, and family */
Line too long.
+ while((tmp_base = strstr(base, "processor ")) != NULL) {
Missing space after 'while'
+/* virSysinfoRead for s390x + * Gathers sysinfo data from /proc/sysinfo and /proc/cpuinfo */ +virSysinfoDefPtr +virSysinfoRead(void) { + virSysinfoDefPtr ret = NULL; + char *outbuf = NULL; + + if (VIR_ALLOC(ret) < 0) + goto no_memory; + + /* Gather info from /proc/cpuinfo */ + if(virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
Missing space after 'if'
+ virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to open %s"), CPUINFO); + return NULL; + } + + ret->nprocessor = 0; + ret->processor = NULL; + if (virSysinfoParseProcessor(outbuf, ret) < 0) + goto no_memory; + + /* Free buffer before reading next file */ + VIR_FREE(outbuf); + + /* Gather info from /proc/sysinfo */ + if(virFileReadAll(SYSINFO, 4096, &outbuf) < 0) {
Missing space
+ virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to open %s"), SYSINFO); + return NULL; + }
Messed up indentation.
+ + if (virSysinfoParseSystem(outbuf, ret) < 0) + goto no_memory; + + return ret; + +no_memory: + VIR_FREE(outbuf); + return NULL; +} + #elif defined(WIN32) || \ !(defined(__x86_64__) || \ defined(__i386__) || \
ACK with the whitespace fixes
Daniel
Fixed and pushed now. Changes I've made: diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c index 01cce98..20482db 100644 --- a/src/util/sysinfo.c +++ b/src/util/sysinfo.c @@ -307,8 +307,9 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret) manufacturer = (char *) tmp; } - /* Find processor N: line and gather the processor manufacturer, version, serial number, and family */ - while((tmp_base = strstr(base, "processor ")) != NULL) { + /* Find processor N: line and gather the processor manufacturer, version, + * serial number, and family */ + while ((tmp_base = strstr(base, "processor ")) != NULL) { base = tmp_base; eol = strchr(base, '\n'); cur = strchr(base, ':') + 1; @@ -364,7 +365,7 @@ virSysinfoRead(void) { goto no_memory; /* Gather info from /proc/cpuinfo */ - if(virFileReadAll(CPUINFO, 2048, &outbuf) < 0) { + if (virFileReadAll(CPUINFO, 2048, &outbuf) < 0) { virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to open %s"), CPUINFO); return NULL; @@ -379,11 +380,11 @@ virSysinfoRead(void) { VIR_FREE(outbuf); /* Gather info from /proc/sysinfo */ - if(virFileReadAll(SYSINFO, 4096, &outbuf) < 0) { - virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to open %s"), SYSINFO); - return NULL; - } + if (virFileReadAll(SYSINFO, 4096, &outbuf) < 0) { + virSmbiosReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to open %s"), SYSINFO); + return NULL; + } if (virSysinfoParseSystem(outbuf, ret) < 0) goto no_memory; Michal

On Fri, Jun 22, 2012 at 01:50:09PM +0200, Viktor Mihajlovski wrote:
Resending as a thread, same content. Please ignore previous submission.
The first series of patches aimed to enable libvirt to manage qemu/kvm domains hosted on the System z platform. The patches in this series address s390 specifics of node and hypervisor.
Patches 2,3 and 5 are written by Thang Pham <thang.pham@us.ibm.com> the others are my doing. Since they all should go together, I am sending in Thang's as well, hoping to facilitate the review a bit this way.
Thang Pham (3): S390: CPU support for s390(x) S390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture S390: Added sysinfo for host on s390x.
Viktor Mihajlovski (2): S390: Override QEMU_CAPS_NO_ACPI for s390x S390: Fixed core identification for s390
src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 ++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++ src/nodeinfo.c | 11 +++ src/qemu/qemu_capabilities.c | 5 ++ src/util/sysinfo.c | 154 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 284 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h
In general I like seeing additional platform support. If done well this is an opportunity to improve the code and bust out bug not raised on the main architecture. I was tempted to get such patch in before the freeze for 0.9.13, but it's a bit too late. So let's try to clean an improve the patch set(s) and push starting next week after the freeze. Ideally we should make sure we do thing uniformly for s390 s390x ppc64 and try to be ready if/when arm64 shows up ! thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 06/25/2012 10:41 AM, Daniel Veillard wrote:
On Fri, Jun 22, 2012 at 01:50:09PM +0200, Viktor Mihajlovski wrote:
Resending as a thread, same content. Please ignore previous submission.
The first series of patches aimed to enable libvirt to manage qemu/kvm domains hosted on the System z platform. The patches in this series address s390 specifics of node and hypervisor.
Patches 2,3 and 5 are written by Thang Pham<thang.pham@us.ibm.com> the others are my doing. Since they all should go together, I am sending in Thang's as well, hoping to facilitate the review a bit this way.
Thang Pham (3): S390: CPU support for s390(x) S390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture S390: Added sysinfo for host on s390x.
Viktor Mihajlovski (2): S390: Override QEMU_CAPS_NO_ACPI for s390x S390: Fixed core identification for s390
src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 ++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++ src/nodeinfo.c | 11 +++ src/qemu/qemu_capabilities.c | 5 ++ src/util/sysinfo.c | 154 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 284 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h
In general I like seeing additional platform support. If done well this is an opportunity to improve the code and bust out bug not raised on the main architecture. I was tempted to get such patch in before the freeze for 0.9.13, but it's a bit too late. So let's try to clean an improve the patch set(s) and push starting next week after the freeze. Ideally we should make sure we do thing uniformly for s390 s390x ppc64 and try to be ready if/when arm64 shows up !
thanks !
Daniel
thanks for reviewing the patches, we will send out a cleaned up version shortly. -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Mon, Jun 25, 2012 at 03:08:09PM +0200, Viktor Mihajlovski wrote:
On 06/25/2012 10:41 AM, Daniel Veillard wrote:
On Fri, Jun 22, 2012 at 01:50:09PM +0200, Viktor Mihajlovski wrote:
Resending as a thread, same content. Please ignore previous submission.
The first series of patches aimed to enable libvirt to manage qemu/kvm domains hosted on the System z platform. The patches in this series address s390 specifics of node and hypervisor.
Patches 2,3 and 5 are written by Thang Pham<thang.pham@us.ibm.com> the others are my doing. Since they all should go together, I am sending in Thang's as well, hoping to facilitate the review a bit this way.
Thang Pham (3): S390: CPU support for s390(x) S390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture S390: Added sysinfo for host on s390x.
Viktor Mihajlovski (2): S390: Override QEMU_CAPS_NO_ACPI for s390x S390: Fixed core identification for s390
src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 ++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++ src/nodeinfo.c | 11 +++ src/qemu/qemu_capabilities.c | 5 ++ src/util/sysinfo.c | 154 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 284 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h
In general I like seeing additional platform support. If done well this is an opportunity to improve the code and bust out bug not raised on the main architecture. I was tempted to get such patch in before the freeze for 0.9.13, but it's a bit too late. So let's try to clean an improve the patch set(s) and push starting next week after the freeze. Ideally we should make sure we do thing uniformly for s390 s390x ppc64 and try to be ready if/when arm64 shows up !
thanks !
Daniel
thanks for reviewing the patches, we will send out a cleaned up version shortly.
Well I reviewed only 2 of the set, lemme try to get a bit further :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Mon, Jun 25, 2012 at 09:43:41PM +0800, Daniel Veillard wrote:
On Mon, Jun 25, 2012 at 03:08:09PM +0200, Viktor Mihajlovski wrote:
On 06/25/2012 10:41 AM, Daniel Veillard wrote:
On Fri, Jun 22, 2012 at 01:50:09PM +0200, Viktor Mihajlovski wrote:
Resending as a thread, same content. Please ignore previous submission.
The first series of patches aimed to enable libvirt to manage qemu/kvm domains hosted on the System z platform. The patches in this series address s390 specifics of node and hypervisor.
Patches 2,3 and 5 are written by Thang Pham<thang.pham@us.ibm.com> the others are my doing. Since they all should go together, I am sending in Thang's as well, hoping to facilitate the review a bit this way.
Thang Pham (3): S390: CPU support for s390(x) S390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture S390: Added sysinfo for host on s390x.
Viktor Mihajlovski (2): S390: Override QEMU_CAPS_NO_ACPI for s390x S390: Fixed core identification for s390
src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 ++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++ src/nodeinfo.c | 11 +++ src/qemu/qemu_capabilities.c | 5 ++ src/util/sysinfo.c | 154 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 284 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h
In general I like seeing additional platform support. If done well this is an opportunity to improve the code and bust out bug not raised on the main architecture. I was tempted to get such patch in before the freeze for 0.9.13, but it's a bit too late. So let's try to clean an improve the patch set(s) and push starting next week after the freeze. Ideally we should make sure we do thing uniformly for s390 s390x ppc64 and try to be ready if/when arm64 shows up !
thanks !
Daniel
thanks for reviewing the patches, we will send out a cleaned up version shortly.
Well I reviewed only 2 of the set, lemme try to get a bit further :-)
Actually now that I went though all 5 and since Dan Berrange reviewed them too, it seems to me this code should not generate portability troubles for other platforms (which was my main concern at this point). So I would agree with trying to push that patch set in rc2 if you fix the few issues which were raised, and send the new set within a couple of days. Thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 25.06.2012 15:54, Daniel Veillard wrote:
On Mon, Jun 25, 2012 at 09:43:41PM +0800, Daniel Veillard wrote:
On Mon, Jun 25, 2012 at 03:08:09PM +0200, Viktor Mihajlovski wrote:
On 06/25/2012 10:41 AM, Daniel Veillard wrote:
On Fri, Jun 22, 2012 at 01:50:09PM +0200, Viktor Mihajlovski wrote:
Resending as a thread, same content. Please ignore previous submission.
The first series of patches aimed to enable libvirt to manage qemu/kvm domains hosted on the System z platform. The patches in this series address s390 specifics of node and hypervisor.
Patches 2,3 and 5 are written by Thang Pham<thang.pham@us.ibm.com> the others are my doing. Since they all should go together, I am sending in Thang's as well, hoping to facilitate the review a bit this way.
Thang Pham (3): S390: CPU support for s390(x) S390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture S390: Added sysinfo for host on s390x.
Viktor Mihajlovski (2): S390: Override QEMU_CAPS_NO_ACPI for s390x S390: Fixed core identification for s390
src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 ++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++ src/nodeinfo.c | 11 +++ src/qemu/qemu_capabilities.c | 5 ++ src/util/sysinfo.c | 154 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 284 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h
In general I like seeing additional platform support. If done well this is an opportunity to improve the code and bust out bug not raised on the main architecture. I was tempted to get such patch in before the freeze for 0.9.13, but it's a bit too late. So let's try to clean an improve the patch set(s) and push starting next week after the freeze. Ideally we should make sure we do thing uniformly for s390 s390x ppc64 and try to be ready if/when arm64 shows up !
thanks !
Daniel
thanks for reviewing the patches, we will send out a cleaned up version shortly.
Well I reviewed only 2 of the set, lemme try to get a bit further :-)
Actually now that I went though all 5 and since Dan Berrange reviewed them too, it seems to me this code should not generate portability troubles for other platforms (which was my main concern at this point). So I would agree with trying to push that patch set in rc2 if you fix the few issues which were raised, and send the new set within a couple of days.
Thanks !
Daniel
Well, I went ahead and cleaned up some nits you guys pointed our or I've spotted myself. Viktor, can you please give it a try and send any follow up patch if you find anything not working? Michal

On 06/25/2012 04:43 PM, Michal Privoznik wrote:
On 25.06.2012 15:54, Daniel Veillard wrote:
On Mon, Jun 25, 2012 at 09:43:41PM +0800, Daniel Veillard wrote:
On Mon, Jun 25, 2012 at 03:08:09PM +0200, Viktor Mihajlovski wrote:
On 06/25/2012 10:41 AM, Daniel Veillard wrote:
On Fri, Jun 22, 2012 at 01:50:09PM +0200, Viktor Mihajlovski wrote:
Resending as a thread, same content. Please ignore previous submission.
The first series of patches aimed to enable libvirt to manage qemu/kvm domains hosted on the System z platform. The patches in this series address s390 specifics of node and hypervisor.
Patches 2,3 and 5 are written by Thang Pham<thang.pham@us.ibm.com> the others are my doing. Since they all should go together, I am sending in Thang's as well, hoping to facilitate the review a bit this way.
Thang Pham (3): S390: CPU support for s390(x) S390: Fixed Parser for /proc/cpuinfo needs to be adapted for your architecture S390: Added sysinfo for host on s390x.
Viktor Mihajlovski (2): S390: Override QEMU_CAPS_NO_ACPI for s390x S390: Fixed core identification for s390
src/Makefile.am | 1 + src/cpu/cpu.c | 2 + src/cpu/cpu_s390x.c | 80 ++++++++++++++++++++++ src/cpu/cpu_s390x.h | 31 +++++++++ src/nodeinfo.c | 11 +++ src/qemu/qemu_capabilities.c | 5 ++ src/util/sysinfo.c | 154 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 284 insertions(+), 0 deletions(-) create mode 100644 src/cpu/cpu_s390x.c create mode 100644 src/cpu/cpu_s390x.h
In general I like seeing additional platform support. If done well this is an opportunity to improve the code and bust out bug not raised on the main architecture. I was tempted to get such patch in before the freeze for 0.9.13, but it's a bit too late. So let's try to clean an improve the patch set(s) and push starting next week after the freeze. Ideally we should make sure we do thing uniformly for s390 s390x ppc64 and try to be ready if/when arm64 shows up !
thanks !
Daniel
thanks for reviewing the patches, we will send out a cleaned up version shortly.
Well I reviewed only 2 of the set, lemme try to get a bit further :-)
Actually now that I went though all 5 and since Dan Berrange reviewed them too, it seems to me this code should not generate portability troubles for other platforms (which was my main concern at this point). So I would agree with trying to push that patch set in rc2 if you fix the few issues which were raised, and send the new set within a couple of days.
Thanks !
Daniel
Well, I went ahead and cleaned up some nits you guys pointed our or I've spotted myself. Viktor, can you please give it a try and send any follow up patch if you find anything not working?
Michal
Hi Michal, thanks for fixing the issues :-). I rebased my local branch to upstream and everything is working as expected. Please note that my other patch set (virtio support for s390) is needed to start s390 guests with I/O devices. As this touches common areas in the qemu driver, I'll hold off until 0.9.13 is out of the door. -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On Mon, Jun 25, 2012 at 06:54:12PM +0200, Viktor Mihajlovski wrote:
On 06/25/2012 04:43 PM, Michal Privoznik wrote:
On 25.06.2012 15:54, Daniel Veillard wrote:
On Mon, Jun 25, 2012 at 09:43:41PM +0800, Daniel Veillard wrote: [...]
thanks for reviewing the patches, we will send out a cleaned up version shortly.
Well I reviewed only 2 of the set, lemme try to get a bit further :-)
Actually now that I went though all 5 and since Dan Berrange reviewed them too, it seems to me this code should not generate portability troubles for other platforms (which was my main concern at this point). So I would agree with trying to push that patch set in rc2 if you fix the few issues which were raised, and send the new set within a couple of days.
Thanks !
Daniel
Well, I went ahead and cleaned up some nits you guys pointed our or I've spotted myself. Viktor, can you please give it a try and send any follow up patch if you find anything not working?
Thanks Michal !
Hi Michal,
thanks for fixing the issues :-). I rebased my local branch to upstream and everything is working as expected. Please note that my other patch set (virtio support for s390) is needed to start s390 guests with I/O devices. As this touches common areas in the qemu driver, I'll hold off until 0.9.13 is out of the door.
Right, that set will have to wait for next week :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Latest patchset enabling libvirt on s390(x) was developed by Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> Thang Pham <thang.pham@us.ibm.com> Add them to the AUTHORS file. --- Let me know if you prefer any other spelling. AUTHORS | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/AUTHORS b/AUTHORS index 195a007..b876ee6 100644 --- a/AUTHORS +++ b/AUTHORS @@ -244,6 +244,8 @@ Patches have also been contributed by: Gao feng <gaofeng@cn.fujitsu.com> Dipankar Sarma <dipankar@in.ibm.com> Gerd Hoffmann <kraxel@redhat.com> + Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> + Thang Pham <thang.pham@us.ibm.com> [....send patches to get your name here....] -- 1.7.8.5
participants (4)
-
Daniel P. Berrange
-
Daniel Veillard
-
Michal Privoznik
-
Viktor Mihajlovski