From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, agraf@suse.de, jfrei@linux.vnet.ibm.com,
Michael Mueller <mimu@linux.vnet.ibm.com>,
David Hildenbrand <dahi@linux.vnet.ibm.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: [Qemu-devel] [PATCH for-2.8 14/38] s390x/cpumodel: generate CPU feature lists for CPU models
Date: Mon, 29 Aug 2016 13:45:06 +0200 [thread overview]
Message-ID: <20160829114530.10842-15-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <20160829114530.10842-1-cornelia.huck@de.ibm.com>
From: Michael Mueller <mimu@linux.vnet.ibm.com>
This patch introduces the helper "gen-features" which allows to generate
feature list definitions at compile time. Its flexibility is better and the
error-proneness is lower when compared to static programming time added
statements.
The helper includes "target-s390x/cpu_features.h" to be able to use named
facility bits instead of numbers. The generated defines will be used for
the definition of CPU models.
We generate feature lists for each HW generation and GA for EC models. BC
models are always based on a EC version and have no separate definitions.
Base features: Features we expect to be always available in sane setups.
Migration safe - will never change. Can be seen as "minimum features
required for a CPU model".
Default features: Features we expect to be stable and around in latest
setups (e.g. having KVM support) - not migration safe.
Max features: All supported features that are theoretically allowed for a
CPU model. Exceeding these features could otherwise produce problems with
IBC (instruction blocking controls) in KVM.
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
[generate base, default and models. renaming and cleanup]
Message-Id: <1472062266-53206-6-git-send-email-dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
Makefile.target | 2 +-
rules.mak | 1 +
target-s390x/Makefile.objs | 20 ++
target-s390x/gen-features.c | 507 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 529 insertions(+), 1 deletion(-)
create mode 100644 target-s390x/gen-features.c
diff --git a/Makefile.target b/Makefile.target
index a440bcb..8c7a072 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -212,7 +212,7 @@ hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx $(SRC_PATH)/scripts/hxtool
$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
-clean:
+clean: clean-target
rm -f *.a *~ $(PROGS)
rm -f $(shell find . -name '*.[od]')
rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
diff --git a/rules.mak b/rules.mak
index 99cd0b3..55b0121 100644
--- a/rules.mak
+++ b/rules.mak
@@ -14,6 +14,7 @@ MAKEFLAGS += -rR
%.cpp:
%.m:
%.mak:
+clean-target:
# Flags for C++ compilation
QEMU_CXXFLAGS = -D__STDC_LIMIT_MACROS $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls, $(QEMU_CFLAGS))
diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs
index 4266c87..745d501 100644
--- a/target-s390x/Makefile.objs
+++ b/target-s390x/Makefile.objs
@@ -3,3 +3,23 @@ obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o
obj-y += gdbstub.o cpu_models.o cpu_features.o
obj-$(CONFIG_SOFTMMU) += machine.o ioinst.o arch_dump.o mmu_helper.o
obj-$(CONFIG_KVM) += kvm.o
+
+# build and run feature list generator
+feat-src = $(SRC_PATH)/target-$(TARGET_BASE_ARCH)/
+feat-dst = $(BUILD_DIR)/$(TARGET_DIR)
+ifneq ($(MAKECMDGOALS),clean)
+GENERATED_HEADERS += $(feat-dst)gen-features.h
+endif
+
+$(feat-dst)gen-features.h: $(feat-dst)gen-features.h-timestamp
+ @cmp $< $@ >/dev/null 2>&1 || cp $< $@
+$(feat-dst)gen-features.h-timestamp: $(feat-dst)gen-features
+ $(call quiet-command,$< >$@," GEN $(TARGET_DIR)gen-features.h")
+
+$(feat-dst)gen-features: $(feat-src)gen-features.c config-target.h
+ $(call quiet-command,$(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(CFLAGS) -o $@ $<," CC $(TARGET_DIR)gen-features")
+
+clean-target:
+ rm -f gen-features.h-timestamp
+ rm -f gen-features.h
+ rm -f gen-features
diff --git a/target-s390x/gen-features.c b/target-s390x/gen-features.c
new file mode 100644
index 0000000..db63389
--- /dev/null
+++ b/target-s390x/gen-features.c
@@ -0,0 +1,507 @@
+/*
+ * S390 feature list generator
+ *
+ * Copyright 2016 IBM Corp.
+ *
+ * Author(s): Michael Mueller <mimu@linux.vnet.ibm.com>
+ * David Hildenbrand <dahi@linux.vnet.ibm.com>
+ *
+ * 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 "qemu/osdep.h"
+#include "cpu_features.h"
+
+/***** BEGIN FEATURE DEFS *****/
+
+#define S390_FEAT_GROUP_PLO \
+ S390_FEAT_PLO_CL, \
+ S390_FEAT_PLO_CLG, \
+ S390_FEAT_PLO_CLGR, \
+ S390_FEAT_PLO_CLX, \
+ S390_FEAT_PLO_CS, \
+ S390_FEAT_PLO_CSG, \
+ S390_FEAT_PLO_CSGR, \
+ S390_FEAT_PLO_CSX, \
+ S390_FEAT_PLO_DCS, \
+ S390_FEAT_PLO_DCSG, \
+ S390_FEAT_PLO_DCSGR, \
+ S390_FEAT_PLO_DCSX, \
+ S390_FEAT_PLO_CSST, \
+ S390_FEAT_PLO_CSSTG, \
+ S390_FEAT_PLO_CSSTGR, \
+ S390_FEAT_PLO_CSSTX, \
+ S390_FEAT_PLO_CSDST, \
+ S390_FEAT_PLO_CSDSTG, \
+ S390_FEAT_PLO_CSDSTGR, \
+ S390_FEAT_PLO_CSDSTX, \
+ S390_FEAT_PLO_CSTST, \
+ S390_FEAT_PLO_CSTSTG, \
+ S390_FEAT_PLO_CSTSTGR, \
+ S390_FEAT_PLO_CSTSTX
+
+#define S390_FEAT_GROUP_TOD_CLOCK_STEERING \
+ S390_FEAT_TOD_CLOCK_STEERING, \
+ S390_FEAT_PTFF_QTO, \
+ S390_FEAT_PTFF_QSI, \
+ S390_FEAT_PTFF_QPT, \
+ S390_FEAT_PTFF_STO
+
+#define S390_FEAT_GROUP_GEN13_PTFF \
+ S390_FEAT_PTFF_QUI, \
+ S390_FEAT_PTFF_QTOU, \
+ S390_FEAT_PTFF_STOU
+
+#define S390_FEAT_GROUP_MSA \
+ S390_FEAT_MSA, \
+ S390_FEAT_KMAC_DEA, \
+ S390_FEAT_KMAC_TDEA_128, \
+ S390_FEAT_KMAC_TDEA_192, \
+ S390_FEAT_KMC_DEA, \
+ S390_FEAT_KMC_TDEA_128, \
+ S390_FEAT_KMC_TDEA_192, \
+ S390_FEAT_KM_DEA, \
+ S390_FEAT_KM_TDEA_128, \
+ S390_FEAT_KM_TDEA_192, \
+ S390_FEAT_KIMD_SHA_1, \
+ S390_FEAT_KLMD_SHA_1
+
+#define S390_FEAT_GROUP_MSA_EXT_1 \
+ S390_FEAT_KMC_AES_128, \
+ S390_FEAT_KM_AES_128, \
+ S390_FEAT_KIMD_SHA_256, \
+ S390_FEAT_KLMD_SHA_256
+
+#define S390_FEAT_GROUP_MSA_EXT_2 \
+ S390_FEAT_KMC_AES_192, \
+ S390_FEAT_KMC_AES_256, \
+ S390_FEAT_KMC_PRNG, \
+ S390_FEAT_KM_AES_192, \
+ S390_FEAT_KM_AES_256, \
+ S390_FEAT_KIMD_SHA_512, \
+ S390_FEAT_KLMD_SHA_512
+
+#define S390_FEAT_GROUP_MSA_EXT_3 \
+ S390_FEAT_MSA_EXT_3, \
+ S390_FEAT_KMAC_EDEA, \
+ S390_FEAT_KMAC_ETDEA_128, \
+ S390_FEAT_KMAC_ETDEA_192, \
+ S390_FEAT_KMC_EAES_128, \
+ S390_FEAT_KMC_EAES_192, \
+ S390_FEAT_KMC_EAES_256, \
+ S390_FEAT_KMC_EDEA, \
+ S390_FEAT_KMC_ETDEA_128, \
+ S390_FEAT_KMC_ETDEA_192, \
+ S390_FEAT_KM_EDEA, \
+ S390_FEAT_KM_ETDEA_128, \
+ S390_FEAT_KM_ETDEA_192, \
+ S390_FEAT_KM_EAES_128, \
+ S390_FEAT_KM_EAES_192, \
+ S390_FEAT_KM_EAES_256, \
+ S390_FEAT_PCKMO_EDEA, \
+ S390_FEAT_PCKMO_ETDEA_128, \
+ S390_FEAT_PCKMO_ETDEA_256, \
+ S390_FEAT_PCKMO_AES_128, \
+ S390_FEAT_PCKMO_AES_192, \
+ S390_FEAT_PCKMO_AES_256
+
+#define S390_FEAT_GROUP_MSA_EXT_4 \
+ S390_FEAT_MSA_EXT_4, \
+ S390_FEAT_KMAC_AES_128, \
+ S390_FEAT_KMAC_AES_192, \
+ S390_FEAT_KMAC_AES_256, \
+ S390_FEAT_KMAC_EAES_128, \
+ S390_FEAT_KMAC_EAES_192, \
+ S390_FEAT_KMAC_EAES_256, \
+ S390_FEAT_KM_XTS_AES_128, \
+ S390_FEAT_KM_XTS_AES_256, \
+ S390_FEAT_KM_XTS_EAES_128, \
+ S390_FEAT_KM_XTS_EAES_256, \
+ S390_FEAT_KIMD_GHASH, \
+ S390_FEAT_KMCTR_DEA, \
+ S390_FEAT_KMCTR_TDEA_128, \
+ S390_FEAT_KMCTR_TDEA_192, \
+ S390_FEAT_KMCTR_EDEA, \
+ S390_FEAT_KMCTR_ETDEA_128, \
+ S390_FEAT_KMCTR_ETDEA_192, \
+ S390_FEAT_KMCTR_AES_128, \
+ S390_FEAT_KMCTR_AES_192, \
+ S390_FEAT_KMCTR_AES_256, \
+ S390_FEAT_KMCTR_EAES_128, \
+ S390_FEAT_KMCTR_EAES_192, \
+ S390_FEAT_KMCTR_EAES_256, \
+ S390_FEAT_KMF_DEA, \
+ S390_FEAT_KMF_TDEA_128, \
+ S390_FEAT_KMF_TDEA_192, \
+ S390_FEAT_KMF_EDEA, \
+ S390_FEAT_KMF_ETDEA_128, \
+ S390_FEAT_KMF_ETDEA_192, \
+ S390_FEAT_KMF_AES_128, \
+ S390_FEAT_KMF_AES_192, \
+ S390_FEAT_KMF_AES_256, \
+ S390_FEAT_KMF_EAES_128, \
+ S390_FEAT_KMF_EAES_192, \
+ S390_FEAT_KMF_EAES_256, \
+ S390_FEAT_KMO_DEA, \
+ S390_FEAT_KMO_TDEA_128, \
+ S390_FEAT_KMO_TDEA_192, \
+ S390_FEAT_KMO_EDEA, \
+ S390_FEAT_KMO_ETDEA_128, \
+ S390_FEAT_KMO_ETDEA_192, \
+ S390_FEAT_KMO_AES_128, \
+ S390_FEAT_KMO_AES_192, \
+ S390_FEAT_KMO_AES_256, \
+ S390_FEAT_KMO_EAES_128, \
+ S390_FEAT_KMO_EAES_192, \
+ S390_FEAT_KMO_EAES_256, \
+ S390_FEAT_PCC_CMAC_DEA, \
+ S390_FEAT_PCC_CMAC_TDEA_128, \
+ S390_FEAT_PCC_CMAC_TDEA_192, \
+ S390_FEAT_PCC_CMAC_ETDEA_128, \
+ S390_FEAT_PCC_CMAC_ETDEA_192, \
+ S390_FEAT_PCC_CMAC_TDEA, \
+ S390_FEAT_PCC_CMAC_AES_128, \
+ S390_FEAT_PCC_CMAC_AES_192, \
+ S390_FEAT_PCC_CMAC_AES_256, \
+ S390_FEAT_PCC_CMAC_EAES_128, \
+ S390_FEAT_PCC_CMAC_EAES_192, \
+ S390_FEAT_PCC_CMAC_EAES_256, \
+ S390_FEAT_PCC_XTS_AES_128, \
+ S390_FEAT_PCC_XTS_AES_256, \
+ S390_FEAT_PCC_XTS_EAES_128, \
+ S390_FEAT_PCC_XTS_EAES_256
+
+#define S390_FEAT_GROUP_MSA_EXT_5 \
+ S390_FEAT_MSA_EXT_5, \
+ S390_FEAT_PPNO_SHA_512_DRNG
+
+/* base features in order of release */
+static uint16_t base_GEN7_GA1[] = {
+ S390_FEAT_GROUP_PLO,
+ S390_FEAT_ESAN3,
+ S390_FEAT_ZARCH,
+};
+#define base_GEN7_GA2 EmptyFeat
+#define base_GEN7_GA3 EmptyFeat
+static uint16_t base_GEN8_GA1[] = {
+ S390_FEAT_DAT_ENH,
+ S390_FEAT_EXTENDED_TRANSLATION_2,
+ S390_FEAT_GROUP_MSA,
+ S390_FEAT_LONG_DISPLACEMENT,
+ S390_FEAT_LONG_DISPLACEMENT_FAST,
+ S390_FEAT_HFP_MADDSUB,
+};
+#define base_GEN8_GA2 EmptyFeat
+#define base_GEN8_GA3 EmptyFeat
+#define base_GEN8_GA4 EmptyFeat
+#define base_GEN8_GA5 EmptyFeat
+static uint16_t base_GEN9_GA1[] = {
+ S390_FEAT_IDTE_SEGMENT,
+ S390_FEAT_ASN_LX_REUSE,
+ S390_FEAT_STFLE,
+ S390_FEAT_SENSE_RUNNING_STATUS,
+ S390_FEAT_EXTENDED_IMMEDIATE,
+ S390_FEAT_EXTENDED_TRANSLATION_3,
+ S390_FEAT_HFP_UNNORMALIZED_EXT,
+ S390_FEAT_ETF2_ENH,
+ S390_FEAT_STORE_CLOCK_FAST,
+ S390_FEAT_GROUP_TOD_CLOCK_STEERING,
+ S390_FEAT_ETF3_ENH,
+ S390_FEAT_DAT_ENH_2,
+};
+#define base_GEN9_GA2 EmptyFeat
+#define base_GEN9_GA3 EmptyFeat
+static uint16_t base_GEN10_GA1[] = {
+ S390_FEAT_CONDITIONAL_SSKE,
+ S390_FEAT_PARSING_ENH,
+ S390_FEAT_MOVE_WITH_OPTIONAL_SPEC,
+ S390_FEAT_EXTRACT_CPU_TIME,
+ S390_FEAT_COMPARE_AND_SWAP_AND_STORE,
+ S390_FEAT_COMPARE_AND_SWAP_AND_STORE_2,
+ S390_FEAT_GENERAL_INSTRUCTIONS_EXT,
+ S390_FEAT_EXECUTE_EXT,
+ S390_FEAT_FLOATING_POINT_SUPPPORT_ENH,
+ S390_FEAT_DFP,
+ S390_FEAT_DFP_FAST,
+ S390_FEAT_PFPO,
+};
+#define base_GEN10_GA2 EmptyFeat
+#define base_GEN10_GA3 EmptyFeat
+static uint16_t base_GEN11_GA1[] = {
+ S390_FEAT_NONQ_KEY_SETTING,
+ S390_FEAT_ENHANCED_MONITOR,
+ S390_FEAT_FLOATING_POINT_EXT,
+ S390_FEAT_SET_PROGRAM_PARAMETERS,
+ S390_FEAT_STFLE_45,
+ S390_FEAT_CMPSC_ENH,
+ S390_FEAT_INTERLOCKED_ACCESS_2,
+};
+#define base_GEN11_GA2 EmptyFeat
+static uint16_t base_GEN12_GA1[] = {
+ S390_FEAT_DFP_ZONED_CONVERSION,
+ S390_FEAT_STFLE_49,
+ S390_FEAT_LOCAL_TLB_CLEARING,
+};
+#define base_GEN12_GA2 EmptyFeat
+static uint16_t base_GEN13_GA1[] = {
+ S390_FEAT_STFLE_53,
+ S390_FEAT_DFP_PACKED_CONVERSION,
+ S390_FEAT_GROUP_GEN13_PTFF,
+};
+#define base_GEN13_GA2 EmptyFeat
+
+/* full features differing to the base in order of release */
+static uint16_t full_GEN7_GA1[] = {
+ S390_FEAT_SIE_F2,
+ S390_FEAT_SIE_SKEY,
+ S390_FEAT_SIE_GPERE,
+ S390_FEAT_SIE_IB,
+ S390_FEAT_SIE_CEI,
+};
+static uint16_t full_GEN7_GA2[] = {
+ S390_FEAT_EXTENDED_TRANSLATION_2,
+};
+static uint16_t full_GEN7_GA3[] = {
+ S390_FEAT_LONG_DISPLACEMENT,
+ S390_FEAT_SIE_SIIF,
+};
+static uint16_t full_GEN8_GA1[] = {
+ S390_FEAT_SIE_GSLS,
+ S390_FEAT_SIE_64BSCAO,
+};
+#define full_GEN8_GA2 EmptyFeat
+static uint16_t full_GEN8_GA3[] = {
+ S390_FEAT_ASN_LX_REUSE,
+ S390_FEAT_EXTENDED_TRANSLATION_3,
+};
+#define full_GEN8_GA4 EmptyFeat
+#define full_GEN8_GA5 EmptyFeat
+static uint16_t full_GEN9_GA1[] = {
+ S390_FEAT_STORE_HYPERVISOR_INFO,
+ S390_FEAT_GROUP_MSA_EXT_1,
+ S390_FEAT_CMM,
+ S390_FEAT_SIE_CMMA,
+};
+static uint16_t full_GEN9_GA2[] = {
+ S390_FEAT_MOVE_WITH_OPTIONAL_SPEC,
+ S390_FEAT_EXTRACT_CPU_TIME,
+ S390_FEAT_COMPARE_AND_SWAP_AND_STORE,
+ S390_FEAT_FLOATING_POINT_SUPPPORT_ENH,
+ S390_FEAT_DFP,
+};
+static uint16_t full_GEN9_GA3[] = {
+ S390_FEAT_CONDITIONAL_SSKE,
+ S390_FEAT_PFPO,
+};
+static uint16_t full_GEN10_GA1[] = {
+ S390_FEAT_EDAT,
+ S390_FEAT_CONFIGURATION_TOPOLOGY,
+ S390_FEAT_GROUP_MSA_EXT_2,
+ S390_FEAT_ESOP,
+ S390_FEAT_SIE_PFMFI,
+ S390_FEAT_SIE_SIGPIF,
+};
+static uint16_t full_GEN10_GA2[] = {
+ S390_FEAT_SET_PROGRAM_PARAMETERS,
+ S390_FEAT_SIE_IBS,
+};
+static uint16_t full_GEN10_GA3[] = {
+ S390_FEAT_GROUP_MSA_EXT_3,
+};
+static uint16_t full_GEN11_GA1[] = {
+ S390_FEAT_IPTE_RANGE,
+ S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION,
+ S390_FEAT_GROUP_MSA_EXT_4,
+};
+#define full_GEN11_GA2 EmptyFeat
+static uint16_t full_GEN12_GA1[] = {
+ S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE,
+ S390_FEAT_TRANSACTIONAL_EXE,
+ S390_FEAT_RUNTIME_INSTRUMENTATION,
+ S390_FEAT_EDAT_2,
+};
+static uint16_t full_GEN12_GA2[] = {
+ S390_FEAT_GROUP_MSA_EXT_5,
+};
+static uint16_t full_GEN13_GA1[] = {
+ S390_FEAT_VECTOR,
+};
+#define full_GEN13_GA2 EmptyFeat
+
+/* default features differing to the base in order of release */
+#define default_GEN7_GA1 EmptyFeat
+#define default_GEN7_GA2 EmptyFeat
+#define default_GEN7_GA3 EmptyFeat
+#define default_GEN8_GA1 EmptyFeat
+#define default_GEN8_GA2 EmptyFeat
+#define default_GEN8_GA3 EmptyFeat
+#define default_GEN8_GA4 EmptyFeat
+#define default_GEN8_GA5 EmptyFeat
+static uint16_t default_GEN9_GA1[] = {
+ S390_FEAT_STORE_HYPERVISOR_INFO,
+ S390_FEAT_GROUP_MSA_EXT_1,
+};
+#define default_GEN9_GA2 EmptyFeat
+#define default_GEN9_GA3 EmptyFeat
+static uint16_t default_GEN10_GA1[] = {
+ S390_FEAT_EDAT,
+ S390_FEAT_GROUP_MSA_EXT_2,
+};
+#define default_GEN10_GA2 EmptyFeat
+#define default_GEN10_GA3 EmptyFeat
+static uint16_t default_GEN11_GA1[] = {
+ S390_FEAT_GROUP_MSA_EXT_3,
+ S390_FEAT_IPTE_RANGE,
+ S390_FEAT_ACCESS_EXCEPTION_FS_INDICATION,
+ S390_FEAT_GROUP_MSA_EXT_4,
+};
+#define default_GEN11_GA2 EmptyFeat
+static uint16_t default_GEN12_GA1[] = {
+ S390_FEAT_CONSTRAINT_TRANSACTIONAL_EXE,
+ S390_FEAT_TRANSACTIONAL_EXE,
+ S390_FEAT_RUNTIME_INSTRUMENTATION,
+ S390_FEAT_EDAT_2,
+};
+#define default_GEN12_GA2 EmptyFeat
+static uint16_t default_GEN13_GA1[] = {
+ S390_FEAT_GROUP_MSA_EXT_5,
+ S390_FEAT_VECTOR,
+};
+#define default_GEN13_GA2 EmptyFeat
+
+/****** END FEATURE DEFS ******/
+
+#define _YEARS "2016"
+#define _NAME_H "TARGET_S390X_GEN_FEATURES_H"
+
+#define CPU_FEAT_INITIALIZER(_name) \
+ { \
+ .name = "S390_FEAT_LIST_" #_name, \
+ .base_bits = \
+ { .data = base_##_name, \
+ .len = ARRAY_SIZE(base_##_name) }, \
+ .default_bits = \
+ { .data = default_##_name, \
+ .len = ARRAY_SIZE(default_##_name) }, \
+ .full_bits = \
+ { .data = full_##_name, \
+ .len = ARRAY_SIZE(full_##_name) }, \
+ }
+
+typedef struct BitSpec {
+ uint16_t *data;
+ uint32_t len;
+} BitSpec;
+
+typedef struct {
+ const char *name;
+ BitSpec base_bits;
+ BitSpec default_bits;
+ BitSpec full_bits;
+} CpuFeatDefSpec;
+
+static uint16_t EmptyFeat[] = {};
+
+/*******************************
+ * processor GA series
+ *******************************/
+static CpuFeatDefSpec CpuFeatDef[] = {
+ CPU_FEAT_INITIALIZER(GEN7_GA1),
+ CPU_FEAT_INITIALIZER(GEN7_GA2),
+ CPU_FEAT_INITIALIZER(GEN7_GA3),
+ CPU_FEAT_INITIALIZER(GEN8_GA1),
+ CPU_FEAT_INITIALIZER(GEN8_GA2),
+ CPU_FEAT_INITIALIZER(GEN8_GA3),
+ CPU_FEAT_INITIALIZER(GEN8_GA4),
+ CPU_FEAT_INITIALIZER(GEN8_GA5),
+ CPU_FEAT_INITIALIZER(GEN9_GA1),
+ CPU_FEAT_INITIALIZER(GEN9_GA2),
+ CPU_FEAT_INITIALIZER(GEN9_GA3),
+ CPU_FEAT_INITIALIZER(GEN10_GA1),
+ CPU_FEAT_INITIALIZER(GEN10_GA2),
+ CPU_FEAT_INITIALIZER(GEN10_GA3),
+ CPU_FEAT_INITIALIZER(GEN11_GA1),
+ CPU_FEAT_INITIALIZER(GEN11_GA2),
+ CPU_FEAT_INITIALIZER(GEN12_GA1),
+ CPU_FEAT_INITIALIZER(GEN12_GA2),
+ CPU_FEAT_INITIALIZER(GEN13_GA1),
+ CPU_FEAT_INITIALIZER(GEN13_GA2),
+};
+
+static void set_bits(uint64_t list[], BitSpec bits)
+{
+ uint32_t i;
+
+ for (i = 0; i < bits.len; i++) {
+ list[bits.data[i] / 64] |= 1ULL << (bits.data[i] % 64);
+ }
+}
+
+static void print_feature_defs(void)
+{
+ uint64_t base_feat[S390_FEAT_MAX / 64 + 1] = {};
+ uint64_t default_feat[S390_FEAT_MAX / 64 + 1] = {};
+ uint64_t full_feat[S390_FEAT_MAX / 64 + 1] = {};
+ int i, j;
+
+ printf("\n/* CPU model feature list data */\n");
+
+ for (i = 0; i < ARRAY_SIZE(CpuFeatDef); i++) {
+ set_bits(base_feat, CpuFeatDef[i].base_bits);
+ /* add the base to the default features */
+ set_bits(default_feat, CpuFeatDef[i].base_bits);
+ set_bits(default_feat, CpuFeatDef[i].default_bits);
+ /* add the base to the full features */
+ set_bits(full_feat, CpuFeatDef[i].base_bits);
+ set_bits(full_feat, CpuFeatDef[i].full_bits);
+
+ printf("#define %s_BASE\t", CpuFeatDef[i].name);
+ for (j = 0; j < ARRAY_SIZE(base_feat); j++) {
+ printf("0x%016"PRIx64"UL", base_feat[j]);
+ if (j < ARRAY_SIZE(base_feat) - 1) {
+ printf(",");
+ } else {
+ printf("\n");
+ }
+ }
+ printf("#define %s_DEFAULT\t", CpuFeatDef[i].name);
+ for (j = 0; j < ARRAY_SIZE(default_feat); j++) {
+ printf("0x%016"PRIx64"UL", default_feat[j]);
+ if (j < ARRAY_SIZE(default_feat) - 1) {
+ printf(",");
+ } else {
+ printf("\n");
+ }
+ }
+ printf("#define %s_FULL\t\t", CpuFeatDef[i].name);
+ for (j = 0; j < ARRAY_SIZE(full_feat); j++) {
+ printf("0x%016"PRIx64"UL", full_feat[j]);
+ if (j < ARRAY_SIZE(full_feat) - 1) {
+ printf(",");
+ } else {
+ printf("\n");
+ }
+ }
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ printf("/*\n"
+ " * AUTOMATICALLY GENERATED, DO NOT MODIFY HERE, EDIT\n"
+ " * SOURCE FILE \"%s\" INSTEAD.\n"
+ " *\n"
+ " * Copyright %s IBM Corp.\n"
+ " *\n"
+ " * This work is licensed under the terms of the GNU GPL, "
+ "version 2 or (at\n * your option) any later version. See "
+ "the COPYING file in the top-level\n * directory.\n"
+ " */\n\n"
+ "#ifndef %s\n#define %s\n", __FILE__, _YEARS, _NAME_H, _NAME_H);
+ print_feature_defs();
+ printf("\n#endif\n");
+ return 0;
+}
--
2.9.3
next prev parent reply other threads:[~2016-08-29 11:45 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-29 11:44 [Qemu-devel] [PATCH for-2.8 00/38] s390x patches for 2.8 Cornelia Huck
2016-08-29 11:44 ` [Qemu-devel] [PATCH for-2.8 01/38] s390x: add compat machine " Cornelia Huck
2016-08-29 11:44 ` [Qemu-devel] [PATCH for-2.8 02/38] s390x/pci: return directly if create zpci failed Cornelia Huck
2016-08-29 11:44 ` [Qemu-devel] [PATCH for-2.8 03/38] s390x/pci: assert zpci always existing Cornelia Huck
2016-08-29 11:44 ` [Qemu-devel] [PATCH for-2.8 04/38] s390/sclp: cache the sclp device Cornelia Huck
2016-08-29 11:44 ` [Qemu-devel] [PATCH for-2.8 05/38] s390x: wrap flic savevm calls into vmstate Cornelia Huck
2016-08-29 11:44 ` [Qemu-devel] [PATCH for-2.8 06/38] s390x/ioinst: advertise fcs facility Cornelia Huck
2016-08-29 11:44 ` [Qemu-devel] [PATCH for-2.8 07/38] s390x/css: handle cssid 255 correctly Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 08/38] linux-headers: update Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 09/38] s390x/kvm: 2 byte software breakpoint support Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 10/38] qmp: details about CPU definitions in query-cpu-definitions Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 11/38] s390x/cpumodel: "host" and "qemu" as CPU subclasses Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 12/38] s390x/cpumodel: expose CPU class properties Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 13/38] s390x/cpumodel: introduce CPU features Cornelia Huck
2016-08-29 11:45 ` Cornelia Huck [this message]
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 15/38] s390x/cpumodel: generate CPU feature group lists Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 16/38] s390x/cpumodel: introduce CPU feature group definitions Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 17/38] s390x/cpumodel: register defined CPU models as subclasses Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 18/38] s390x/cpumodel: store the CPU model in the CPU instance Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 19/38] s390x/cpumodel: expose features and feature groups as properties Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 20/38] s390x/cpumodel: let the CPU model handle feature checks Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 21/38] s390x/cpumodel: check and apply the CPU model Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 22/38] s390x/sclp: factor out preparation of cpu entries Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 23/38] s390x/sclp: introduce sclp feature blocks Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 24/38] s390x/sclp: indicate sclp features Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 25/38] s390x/sclp: propagate the ibc val (lowest and unblocked ibc) Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 26/38] s390x/sclp: propagate the mha via sclp Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 27/38] s390x/sclp: propagate hmfai Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 28/38] s390x/kvm: allow runtime-instrumentation for "none" machine Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 29/38] s390x/kvm: implement CPU model support Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 30/38] s390x/kvm: disable host model for problematic compat machines Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 31/38] s390x/kvm: let the CPU model control CMM(A) Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 32/38] s390x/kvm: don't enable key wrapping if msa3 is disabled Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 33/38] qmp: add QMP interface "query-cpu-model-expansion" Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 34/38] qmp: add QMP interface "query-cpu-model-comparison" Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 35/38] qmp: add QMP interface "query-cpu-model-baseline" Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 36/38] s390x/cpumodel: implement QMP interface "query-cpu-model-expansion" Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 37/38] s390x/cpumodel: implement QMP interface "query-cpu-model-comparison" Cornelia Huck
2016-08-29 11:45 ` [Qemu-devel] [PATCH for-2.8 38/38] s390x/cpumodel: implement QMP interface "query-cpu-model-baseline" Cornelia Huck
2016-08-29 15:39 ` [Qemu-devel] [PATCH for-2.8 00/38] s390x patches for 2.8 no-reply
2016-09-05 7:28 ` David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160829114530.10842-15-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=mimu@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).