From patchwork Wed Oct 2 11:33:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Mueller X-Patchwork-Id: 279699 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8CE1B2C00B9 for ; Wed, 2 Oct 2013 21:37:06 +1000 (EST) Received: from localhost ([::1]:35420 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRKjo-0004Qq-Ez for incoming@patchwork.ozlabs.org; Wed, 02 Oct 2013 07:37:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRKgu-0000Yp-02 for qemu-devel@nongnu.org; Wed, 02 Oct 2013 07:34:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRKgk-00027D-QM for qemu-devel@nongnu.org; Wed, 02 Oct 2013 07:34:03 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:59722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRKgk-000266-Ev for qemu-devel@nongnu.org; Wed, 02 Oct 2013 07:33:54 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 2 Oct 2013 12:33:53 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 2 Oct 2013 12:33:51 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 0693417D8058 for ; Wed, 2 Oct 2013 12:34:09 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r92BXcQd66191600 for ; Wed, 2 Oct 2013 11:33:38 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r92BXoBl022966 for ; Wed, 2 Oct 2013 05:33:50 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r92BXkeX022802; Wed, 2 Oct 2013 05:33:50 -0600 From: Michael Mueller To: qemu-devel@nongnu.org Date: Wed, 2 Oct 2013 13:33:39 +0200 Message-Id: <1380713622-22325-9-git-send-email-mimu@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1380713622-22325-1-git-send-email-mimu@linux.vnet.ibm.com> References: <1380713622-22325-1-git-send-email-mimu@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13100211-8372-0000-0000-000007592F59 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.108 Cc: Michael Mueller Subject: [Qemu-devel] [PATCH RFC 08/11] s390/qemu: cpu model command line option help X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch provides a list of supported cpu models and aliases in the current host context. See command line option -cpu {help|?} The returned list is determined from the current host and and contains also well know alias names. It is sorted by appearance of the respective system: s390 2064-ga1 IBM zSeries 900 GA1 s390 2064-ga2 IBM zSeries 900 GA2 s390 2064-ga3 IBM zSeries 900 GA3 s390 2064 (alias for 2064-ga3) s390 z900 (alias for 2064-ga3) s390 2066-ga1 IBM zSeries 800 GA1 s390 2066 (alias for 2066-ga1) s390 z800 (alias for 2066-ga1) s390 2084-ga1 IBM zSeries 990 GA1 s390 2084-ga2 IBM zSeries 990 GA2 s390 2084-ga3 IBM zSeries 990 GA3 s390 2084-ga4 IBM zSeries 990 GA4 s390 2084-ga5 IBM zSeries 990 GA5 s390 2084 (alias for 2084-ga5) s390 z990 (alias for 2084-ga5) s390 2086-ga1 IBM zSeries 890 GA1 s390 2086-ga2 IBM zSeries 890 GA2 s390 2086-ga3 IBM zSeries 890 GA3 s390 2086 (alias for 2086-ga3) s390 z890 (alias for 2086-ga3) s390 2094-ga1 IBM Sytems z9 EC GA1 s390 2094-ga2 IBM Sytems z9 EC GA2 s390 2094-ga3 IBM Sytems z9 EC GA3 s390 2094 (alias for 2094-ga3) s390 z9 (alias for 2094-ga3) s390 2096-ga1 IBM Sytems z9 BC GA1 s390 2096-ga2 IBM Sytems z9 BC GA2 s390 2096 (alias for 2096-ga2) s390 z9-bc (alias for 2096-ga2) s390 2097-ga1 IBM Sytems z10 EC GA1 s390 2097-ga2 IBM Sytems z10 EC GA2 s390 2097-ga3 IBM Sytems z10 EC GA3 s390 2097 (alias for 2097-ga3) s390 z10 (alias for 2097-ga3) s390 2098-ga1 IBM Sytems z10 BC GA1 s390 2098-ga2 IBM Sytems z10 BC GA2 s390 2098 (alias for 2098-ga2) s390 z10-bc (alias for 2098-ga2) s390 2817-ga1 IBM zEnterprise 196 GA1 s390 2817-ga2 IBM zEnterprise 196 GA2 s390 2817 (alias for 2817-ga2) s390 z196 (alias for 2817-ga2) s390 2818-ga1 IBM zEnterprise 114 GA1 s390 2818 (alias for 2818-ga1) s390 z114 (alias for 2818-ga1) s390 2827-ga1 IBM zEnterprise EC12 GA1 s390 2827 (alias for 2827-ga1) s390 zEC12 (alias for 2827-ga1) s390 host (alias for 2827-ga1) Signed-off-by: Michael Mueller --- target-s390x/cpu-models.c | 30 ++++++++++++++++++++++++++++++ target-s390x/cpu-models.h | 1 + target-s390x/cpu.c | 16 +++++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/target-s390x/cpu-models.c b/target-s390x/cpu-models.c index ecf94a4..68b978a 100644 --- a/target-s390x/cpu-models.c +++ b/target-s390x/cpu-models.c @@ -558,6 +558,36 @@ out: return ret; } +void s390_cpu_list_entry(gpointer data, gpointer user_data) +{ + ObjectClass *alias_oc, *oc = data; + CPUListState *s = user_data; + DeviceClass *dc = DEVICE_CLASS(oc); + S390CPUClass *cc = S390_CPU_CLASS(oc); + const char *typename = object_class_get_name(oc); + S390CPUAlias *alias; + GSList *item; + char *name; + + if (!cc->is_active) { + return; + } + name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_S390_CPU)); + (*s->cpu_fprintf)(s->file, "s390 %-10s %s\n", name, dc->desc); + + for (item = s390_cpu_aliases; item != NULL; item = item->next) { + alias = (S390CPUAlias *) item->data; + alias_oc = s390_cpu_class_by_name(alias->model); + if (alias_oc != oc) { + continue; + } + (*s->cpu_fprintf)(s->file, "s390 %-10s (alias for %s)\n", + alias->name, name); + } + + g_free(name); +} + /* define S390 CPU model classes */ S390_PROC_DEF("2064-ga1", CPU_S390_2064_GA1, "IBM zSeries 900 GA1") S390_PROC_DEF("2064-ga2", CPU_S390_2064_GA2, "IBM zSeries 900 GA2") diff --git a/target-s390x/cpu-models.h b/target-s390x/cpu-models.h index 6164114..fd01876 100644 --- a/target-s390x/cpu-models.h +++ b/target-s390x/cpu-models.h @@ -53,6 +53,7 @@ int s390_request_kvm_cpu_config(S390CPUClass *cc); gint s390_cpu_class_asc_order_compare(gconstpointer a, gconstpointer b); int s390_setup_cpu_classes(struct S390HostProps *prop); ObjectClass *s390_cpu_class_by_name(const char *name); +void s390_cpu_list_entry(gpointer data, gpointer user_data); /* * bits 0-7 : CMOS generation diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index 3c89f8a..0fccc72 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -24,6 +24,7 @@ */ #include "cpu.h" +#include "cpu-models.h" #include "qemu-common.h" #include "qemu/timer.h" #include "hw/hw.h" @@ -38,7 +39,20 @@ void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf) { #ifdef CONFIG_KVM - (*cpu_fprintf)(f, "s390 %16s\n", "host"); + CPUListState s = { + .file = f, + .cpu_fprintf = cpu_fprintf, + }; + GSList *list; + + if (kvm_enabled()) { + list = object_class_get_list(TYPE_S390_CPU, false); + list = g_slist_sort(list, s390_cpu_class_asc_order_compare); + g_slist_foreach(list, s390_cpu_list_entry, &s); + g_slist_free(list); + } else { + (*cpu_fprintf)(f, "s390 host\n"); + } #endif }