From patchwork Wed Oct 2 11:33:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Mueller X-Patchwork-Id: 279697 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 86A682C00BA for ; Wed, 2 Oct 2013 21:36:45 +1000 (EST) Received: from localhost ([::1]:35416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRKjT-0003os-BO for incoming@patchwork.ozlabs.org; Wed, 02 Oct 2013 07:36:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRKgt-0000Yi-25 for qemu-devel@nongnu.org; Wed, 02 Oct 2013 07:34:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRKgj-00026J-Ts for qemu-devel@nongnu.org; Wed, 02 Oct 2013 07:34:03 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:45589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRKgj-00025Y-Ie for qemu-devel@nongnu.org; Wed, 02 Oct 2013 07:33:53 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 2 Oct 2013 12:33:51 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 2 Oct 2013 12:33:49 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5DE7F2190056 for ; Wed, 2 Oct 2013 12:33:49 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r92BXb2k60948670 for ; Wed, 2 Oct 2013 11:33:37 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 r92BXmt6022873 for ; Wed, 2 Oct 2013 05:33:48 -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 r92BXkeS022802; Wed, 2 Oct 2013 05:33:48 -0600 From: Michael Mueller To: qemu-devel@nongnu.org Date: Wed, 2 Oct 2013 13:33:34 +0200 Message-Id: <1380713622-22325-4-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-0542-0000-0000-0000069FF7B9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.113 Cc: Michael Mueller Subject: [Qemu-devel] [PATCH RFC 03/11] s390/qemu: cpu model cpu class definition 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 implements the static part of the s390 cpu class definitions. It defines single cpu models by means of virtual cpu ids which contain information on the cpu generation, the machine class, the GA number and the machine type. The cpu id is used to instantiate a cpu classes per cpu id. Signed-off-by: Michael Mueller --- target-s390x/Makefile.objs | 1 + target-s390x/cpu-models.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++ target-s390x/cpu-models.h | 66 +++++++++++++++++++++++++++++++++++++++ target-s390x/cpu-qom.h | 9 ++++++ 4 files changed, 154 insertions(+) create mode 100644 target-s390x/cpu-models.c create mode 100644 target-s390x/cpu-models.h diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs index f873146..6a38ce9 100644 --- a/target-s390x/Makefile.objs +++ b/target-s390x/Makefile.objs @@ -1,5 +1,6 @@ obj-y += translate.o helper.o cpu.o interrupt.o obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o obj-y += gdbstub.o +obj-y += cpu-models.o obj-$(CONFIG_SOFTMMU) += ioinst.o arch_dump.o obj-$(CONFIG_KVM) += kvm.o diff --git a/target-s390x/cpu-models.c b/target-s390x/cpu-models.c new file mode 100644 index 0000000..e2e8019 --- /dev/null +++ b/target-s390x/cpu-models.c @@ -0,0 +1,78 @@ +/* + * CPU models for s390 + * + * Copyright 2013 IBM Corp. + * + * Author(s): Michael Mueller + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at + * your option) any later version. See the COPYING file in the top-level + * directory. + */ + +#include "cpu.h" +#include "cpu-models.h" +#include "hw/s390x/config.h" + +#define S390_PROC_DEF(_name, _cpu_id, _desc) \ + static void \ + glue(_cpu_id, _cpu_class_init) \ + (ObjectClass *oc, void *data) \ + { \ + DeviceClass *dc = DEVICE_CLASS(oc); \ + S390CPUClass *cc = S390_CPU_CLASS(oc); \ + \ + cc->order = cpu_order(_cpu_id); \ + cc->type = cpu_type(_cpu_id); \ + cc->class = cpu_class(_cpu_id); \ + cc->ga = cpu_ga(_cpu_id); \ + cc->generation = cpu_generation(_cpu_id); \ + cc->facilities = NULL; \ + cc->kvm_facilities = NULL; \ + cc->is_active = true; \ + cc->is_host = false; \ + dc->desc = _desc; \ + } \ + static const TypeInfo \ + glue(_cpu_id, _cpu_type_info) = { \ + .name = _name "-" TYPE_S390_CPU, \ + .parent = TYPE_S390_CPU, \ + .class_init = glue(_cpu_id, _cpu_class_init), \ + }; \ + static void \ + glue(_cpu_id, _cpu_register_types)(void) \ + { \ + type_register_static( \ + &glue(_cpu_id, _cpu_type_info)); \ + } \ + type_init(glue(_cpu_id, _cpu_register_types)) + +/* 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") +S390_PROC_DEF("2064-ga3", CPU_S390_2064_GA3, "IBM zSeries 900 GA3") +S390_PROC_DEF("2066-ga1", CPU_S390_2066_GA1, "IBM zSeries 800 GA1") +S390_PROC_DEF("2084-ga1", CPU_S390_2084_GA1, "IBM zSeries 990 GA1") +S390_PROC_DEF("2084-ga2", CPU_S390_2084_GA2, "IBM zSeries 990 GA2") +S390_PROC_DEF("2084-ga3", CPU_S390_2084_GA3, "IBM zSeries 990 GA3") +S390_PROC_DEF("2084-ga4", CPU_S390_2084_GA4, "IBM zSeries 990 GA4") +S390_PROC_DEF("2084-ga5", CPU_S390_2084_GA5, "IBM zSeries 990 GA5") +S390_PROC_DEF("2086-ga1", CPU_S390_2086_GA1, "IBM zSeries 890 GA1") +S390_PROC_DEF("2086-ga2", CPU_S390_2086_GA2, "IBM zSeries 890 GA2") +S390_PROC_DEF("2086-ga3", CPU_S390_2086_GA3, "IBM zSeries 890 GA3") +S390_PROC_DEF("2094-ga1", CPU_S390_2094_GA1, "IBM Sytems z9 EC GA1") +S390_PROC_DEF("2094-ga2", CPU_S390_2094_GA2, "IBM Sytems z9 EC GA2") +S390_PROC_DEF("2094-ga3", CPU_S390_2094_GA3, "IBM Sytems z9 EC GA3") +S390_PROC_DEF("2096-ga1", CPU_S390_2096_GA1, "IBM Sytems z9 BC GA1") +S390_PROC_DEF("2096-ga2", CPU_S390_2096_GA2, "IBM Sytems z9 BC GA2") +S390_PROC_DEF("2097-ga1", CPU_S390_2097_GA1, "IBM Sytems z10 EC GA1") +S390_PROC_DEF("2097-ga2", CPU_S390_2097_GA2, "IBM Sytems z10 EC GA2") +S390_PROC_DEF("2097-ga3", CPU_S390_2097_GA3, "IBM Sytems z10 EC GA3") +S390_PROC_DEF("2098-ga1", CPU_S390_2098_GA1, "IBM Sytems z10 BC GA1") +S390_PROC_DEF("2098-ga2", CPU_S390_2098_GA2, "IBM Sytems z10 BC GA2") +S390_PROC_DEF("2817-ga1", CPU_S390_2817_GA1, "IBM zEnterprise 196 GA1") +S390_PROC_DEF("2817-ga2", CPU_S390_2817_GA2, "IBM zEnterprise 196 GA2") +S390_PROC_DEF("2818-ga1", CPU_S390_2818_GA1, "IBM zEnterprise 114 GA1") +S390_PROC_DEF("2827-ga1", CPU_S390_2827_GA1, "IBM zEnterprise EC12 GA1") +S390_PROC_DEF("2827-ga2", CPU_S390_2827_GA2, "IBM zEnterprise EC12 GA2") +S390_PROC_DEF("2828-ga1", CPU_S390_2828_GA1, "IBM zEnterprise BC12 GA1") diff --git a/target-s390x/cpu-models.h b/target-s390x/cpu-models.h new file mode 100644 index 0000000..8a3b947 --- /dev/null +++ b/target-s390x/cpu-models.h @@ -0,0 +1,66 @@ +/* + * CPU models for s390 + * + * Copyright 2013 IBM Corp. + * + * Author(s): Michael Mueller + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at + * your option) any later version. See the COPYING file in the top-level + * directory. + */ + +#ifndef TARGET_S390X_CPU_MODELS_H +#define TARGET_S390X_CPU_MODELS_H + +#define MAX_S390_FACILITY_ULONG 2 +#define MAX_S390_FACILITY_BYTE \ + (MAX_S390_FACILITY_ULONG * sizeof(unsigned long)) +#define MAX_S390_FACILITY_BIT \ + (MAX_S390_FACILITY_BYTE << 3) + +#define cpu_type(x) (((x) >> 0) & 0xffff) +#define cpu_order(x) (((x) >> 16) & 0xffff) +#define cpu_ga(x) (((x) >> 16) & 0xf) +#define cpu_class(x) (((x) >> 20) & 0x1) +#define cpu_generation(x) (((x) >> 24) & 0xff) + +/* + * bits 0-7 : CMOS generation + * bits 8-9 : reserved + * bits 10-11 : machine class 0/unknown 1/EC 2/BC + * bits 12-15 : GA + * bits 16-31 : machine type + */ +enum { + CPU_S390_2064_GA1 = 0x07112064, + CPU_S390_2064_GA2 = 0x07122064, + CPU_S390_2064_GA3 = 0x07132064, + CPU_S390_2066_GA1 = 0x07212066, + CPU_S390_2084_GA1 = 0x08112084, + CPU_S390_2084_GA2 = 0x08122084, + CPU_S390_2084_GA3 = 0x08132084, + CPU_S390_2084_GA4 = 0x08142084, + CPU_S390_2084_GA5 = 0x08152084, + CPU_S390_2086_GA1 = 0x08212086, + CPU_S390_2086_GA2 = 0x08222086, + CPU_S390_2086_GA3 = 0x08232086, + CPU_S390_2094_GA1 = 0x09112094, + CPU_S390_2094_GA2 = 0x09122094, + CPU_S390_2094_GA3 = 0x09132094, + CPU_S390_2096_GA1 = 0x09212096, + CPU_S390_2096_GA2 = 0x09222096, + CPU_S390_2097_GA1 = 0x0a112097, + CPU_S390_2097_GA2 = 0x0a122097, + CPU_S390_2097_GA3 = 0x0a132097, + CPU_S390_2098_GA1 = 0x0a212098, + CPU_S390_2098_GA2 = 0x0a222098, + CPU_S390_2817_GA1 = 0x0b112817, + CPU_S390_2817_GA2 = 0x0b122817, + CPU_S390_2818_GA1 = 0x0b212818, + CPU_S390_2827_GA1 = 0x0c112827, + CPU_S390_2827_GA2 = 0x0c122827, + CPU_S390_2828_GA1 = 0x0c212828, +}; + +#endif diff --git a/target-s390x/cpu-qom.h b/target-s390x/cpu-qom.h index ac0460e..7026a8c 100644 --- a/target-s390x/cpu-qom.h +++ b/target-s390x/cpu-qom.h @@ -52,6 +52,15 @@ typedef struct S390CPUClass { void (*load_normal)(CPUState *cpu); void (*cpu_reset)(CPUState *cpu); void (*initial_cpu_reset)(CPUState *cpu); + unsigned short class; /* machine class */ + unsigned short ga; /* ga number of machine */ + unsigned short type; /* machine type */ + unsigned short order; /* order of availability */ + unsigned short generation; /* S390 CMOS generation */ + unsigned long *facilities; /* required facilities by machine type */ + unsigned long *kvm_facilities; /* required facilities by virtual machine */ + bool is_active; /* host supports all required facilities */ + bool is_host; /* cpu class represents the "host" cpu model */ } S390CPUClass; /**