[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 39/70] target/s390x/cpu_models: Allow some additio
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL v2 39/70] target/s390x/cpu_models: Allow some additional feature bits for the "qemu" CPU |
Date: |
Tue, 6 Jun 2017 17:30:48 -0700 |
From: Thomas Huth <address@hidden>
Currently we only present the plain z900 feature bits to the guest,
but QEMU already emulates some additional features (but not all of
the next CPU generation, so we can not use the next CPU level as
default yet). Since newer Linux kernels are checking the feature bits
and refuse to work if a required feature is missing, it would be nice
to have a way to present more of the supported features when we are
running with the "qemu" CPU.
This patch now adds the supported features to the "full_feat" bitmap,
so that additional features can be enabled on the command line now,
for example with:
qemu-system-s390x -cpu qemu,stfle=true,ldisp=true,eimm=true,stckf=true
Acked-by: David Hildenbrand <address@hidden>
Reviewed-by: Aurelien Jarno <address@hidden>
Signed-off-by: Thomas Huth <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
target/s390x/cpu_models.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 8d27363..e5e005a 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -658,6 +658,30 @@ static void check_compatibility(const S390CPUModel
*max_model,
"available in the configuration: ");
}
+/**
+ * The base TCG CPU model "qemu" is based on the z900. However, we already
+ * can also emulate some additional features of later CPU generations, so
+ * we add these additional feature bits here.
+ */
+static void add_qemu_cpu_model_features(S390FeatBitmap fbm)
+{
+ static const int feats[] = {
+ S390_FEAT_STFLE,
+ S390_FEAT_EXTENDED_IMMEDIATE,
+ S390_FEAT_LONG_DISPLACEMENT,
+ S390_FEAT_LONG_DISPLACEMENT_FAST,
+ S390_FEAT_STORE_CLOCK_FAST,
+ S390_FEAT_GENERAL_INSTRUCTIONS_EXT,
+ S390_FEAT_EXECUTE_EXT,
+ S390_FEAT_STFLE_45,
+ };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(feats); i++) {
+ set_bit(feats[i], fbm);
+ }
+}
+
static S390CPUModel *get_max_cpu_model(Error **errp)
{
static S390CPUModel max_model;
@@ -670,10 +694,11 @@ static S390CPUModel *get_max_cpu_model(Error **errp)
if (kvm_enabled()) {
kvm_s390_get_host_cpu_model(&max_model, errp);
} else {
- /* TCG emulates a z900 */
+ /* TCG emulates a z900 (with some optional additional features) */
max_model.def = &s390_cpu_defs[0];
bitmap_copy(max_model.features, max_model.def->default_feat,
S390_FEAT_MAX);
+ add_qemu_cpu_model_features(max_model.features);
}
if (!*errp) {
cached = true;
@@ -925,11 +950,14 @@ static void s390_host_cpu_model_initfn(Object *obj)
static void s390_qemu_cpu_model_initfn(Object *obj)
{
+ static S390CPUDef s390_qemu_cpu_defs;
S390CPU *cpu = S390_CPU(obj);
cpu->model = g_malloc0(sizeof(*cpu->model));
- /* TCG emulates a z900 */
- cpu->model->def = &s390_cpu_defs[0];
+ /* TCG emulates a z900 (with some optional additional features) */
+ memcpy(&s390_qemu_cpu_defs, &s390_cpu_defs[0], sizeof(s390_qemu_cpu_defs));
+ add_qemu_cpu_model_features(s390_qemu_cpu_defs.full_feat);
+ cpu->model->def = &s390_qemu_cpu_defs;
bitmap_copy(cpu->model->features, cpu->model->def->default_feat,
S390_FEAT_MAX);
}
--
2.9.4
- [Qemu-devel] [PULL v2 29/70] target/s390x: Use unwind data for helper_lra, (continued)
- [Qemu-devel] [PULL v2 29/70] target/s390x: Use unwind data for helper_lra, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 31/70] target/s390x: Fix some helper_ex problems, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 34/70] target/s390x: Implement CSPG, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 33/70] target/s390x: Use atomic operations for COMPARE SWAP PURGE, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 36/70] target/s390x: End the TB after EXECUTE, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 37/70] target/s390x: Implement EXECUTE via new TranslationBlock, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 35/70] target/s390x: Save current ilen during translation, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 38/70] target/s390x: Re-implement a few EXECUTE target insns directly, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 40/70] target/s390x: remove dead code in translate.c, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 41/70] target/s390x: remove some Linux assumptions from IPTE, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 39/70] target/s390x/cpu_models: Allow some additional feature bits for the "qemu" CPU,
Richard Henderson <=
- [Qemu-devel] [PULL v2 43/70] target/s390x: implement TEST AND SET, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 42/70] target/s390x: implement local-TLB-clearing in IPTE, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 44/70] target/s390x: implement TEST ADDRESSING MODE, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 45/70] target/s390x: implement PACK, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 46/70] target/s390x: implement COMPARE AND SIGNAL, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 48/70] target/s390x: implement MOVE NUMERICS, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 47/70] target/s390x: implement MOVE INVERSE, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 49/70] target/s390x: implement MOVE WITH OFFSET, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 50/70] target/s390x: implement MOVE ZONES, Richard Henderson, 2017/06/06
- [Qemu-devel] [PULL v2 51/70] target/s390x: improve 24-bit and 31-bit addresses read, Richard Henderson, 2017/06/06