yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Pablo Greco e6a3ae
From 51cdec5fac585a2bd7c2ed4fc3501cb6622ad493 Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: David Hildenbrand <david@redhat.com>
Pablo Greco e6a3ae
Date: Wed, 22 May 2019 08:03:59 +0100
Pablo Greco e6a3ae
Subject: [PATCH 07/12] s390x/cpumodel: enhanced sort facility
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: David Hildenbrand <david@redhat.com>
Pablo Greco e6a3ae
Message-id: <20190522080402.20173-8-david@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 88154
Pablo Greco e6a3ae
O-Subject: [RHEL8.1 qemu-kvm PATCH v2 07/10] s390x/cpumodel: enhanced sort facility
Pablo Greco e6a3ae
Bugzilla: 1660912
Pablo Greco e6a3ae
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Thomas Huth <thuth@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
add the enhanced sort facility.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Pablo Greco e6a3ae
Reviewed-by: David Hildenbrand <david@redhat.com>
Pablo Greco e6a3ae
Message-Id: <20190429090250.7648-7-borntraeger@de.ibm.com>
Pablo Greco e6a3ae
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit d220fabf16091ca5c26f3313541bdfb7435d6a08)
Pablo Greco e6a3ae
Signed-off-by: David Hildenbrand <david@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 target/s390x/cpu_features.c     | 10 ++++++++++
Pablo Greco e6a3ae
 target/s390x/cpu_features.h     |  1 +
Pablo Greco e6a3ae
 target/s390x/cpu_features_def.h |  8 ++++++++
Pablo Greco e6a3ae
 target/s390x/gen-features.c     | 14 ++++++++++++++
Pablo Greco e6a3ae
 target/s390x/kvm.c              |  6 ++++++
Pablo Greco e6a3ae
 5 files changed, 39 insertions(+)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
Pablo Greco e6a3ae
index 3587325..1d19b30 100644
Pablo Greco e6a3ae
--- a/target/s390x/cpu_features.c
Pablo Greco e6a3ae
+++ b/target/s390x/cpu_features.c
Pablo Greco e6a3ae
@@ -109,6 +109,7 @@ static const S390FeatDef s390_features[] = {
Pablo Greco e6a3ae
     FEAT_INIT("msa8-base", S390_FEAT_TYPE_STFL, 146, "Message-security-assist-extension-8 facility (excluding subfunctions)"),
Pablo Greco e6a3ae
     FEAT_INIT("cmmnt", S390_FEAT_TYPE_STFL, 147, "CMM: ESSA-enhancement (no translate) facility"),
Pablo Greco e6a3ae
     FEAT_INIT("vxeh2", S390_FEAT_TYPE_STFL, 148, "Vector Enhancements facility 2"),
Pablo Greco e6a3ae
+    FEAT_INIT("esort-base", S390_FEAT_TYPE_STFL, 150, "Enhanced-sort facility (excluding subfunctions)"),
Pablo Greco e6a3ae
     FEAT_INIT("vxbeh", S390_FEAT_TYPE_STFL, 152, "Vector BCD enhancements facility 1"),
Pablo Greco e6a3ae
     FEAT_INIT("msa9-base", S390_FEAT_TYPE_STFL, 155, "Message-security-assist-extension-9 facility (excluding subfunctions)"),
Pablo Greco e6a3ae
     FEAT_INIT("etoken", S390_FEAT_TYPE_STFL, 156, "Etoken facility"),
Pablo Greco e6a3ae
@@ -340,6 +341,12 @@ static const S390FeatDef s390_features[] = {
Pablo Greco e6a3ae
     FEAT_INIT("kdsa-eddsa-sign-ed448", S390_FEAT_TYPE_KDSA, 44, "KDSA EdDSA-Sign-Ed448"),
Pablo Greco e6a3ae
     FEAT_INIT("kdsa-eeddsa-sign-ed25519", S390_FEAT_TYPE_KDSA, 48, "KDSA Encrypted-EdDSA-Sign-Ed25519"),
Pablo Greco e6a3ae
     FEAT_INIT("kdsa-eeddsa-sign-ed448", S390_FEAT_TYPE_KDSA, 52, "KDSA Encrypted-EdDSA-Sign-Ed448"),
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+    FEAT_INIT("sortl-sflr", S390_FEAT_TYPE_SORTL, 1, "SORTL SFLR"),
Pablo Greco e6a3ae
+    FEAT_INIT("sortl-svlr", S390_FEAT_TYPE_SORTL, 2, "SORTL SVLR"),
Pablo Greco e6a3ae
+    FEAT_INIT("sortl-32", S390_FEAT_TYPE_SORTL, 130, "SORTL 32 input lists"),
Pablo Greco e6a3ae
+    FEAT_INIT("sortl-128", S390_FEAT_TYPE_SORTL, 132, "SORTL 128 input lists"),
Pablo Greco e6a3ae
+    FEAT_INIT("sortl-f0", S390_FEAT_TYPE_SORTL, 192, "SORTL format 0 parameter-block"),
Pablo Greco e6a3ae
 };
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 const S390FeatDef *s390_feat_def(S390Feat feat)
Pablo Greco e6a3ae
@@ -403,6 +410,7 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
Pablo Greco e6a3ae
     case S390_FEAT_TYPE_PPNO:
Pablo Greco e6a3ae
     case S390_FEAT_TYPE_KMA:
Pablo Greco e6a3ae
     case S390_FEAT_TYPE_KDSA:
Pablo Greco e6a3ae
+    case S390_FEAT_TYPE_SORTL:
Pablo Greco e6a3ae
         set_be_bit(0, data); /* query is always available */
Pablo Greco e6a3ae
         break;
Pablo Greco e6a3ae
     default:
Pablo Greco e6a3ae
@@ -430,6 +438,7 @@ void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
Pablo Greco e6a3ae
        nr_bits = 16384;
Pablo Greco e6a3ae
        break;
Pablo Greco e6a3ae
     case S390_FEAT_TYPE_PLO:
Pablo Greco e6a3ae
+    case S390_FEAT_TYPE_SORTL:
Pablo Greco e6a3ae
        nr_bits = 256;
Pablo Greco e6a3ae
        break;
Pablo Greco e6a3ae
     default:
Pablo Greco e6a3ae
@@ -501,6 +510,7 @@ static S390FeatGroupDef s390_feature_groups[] = {
Pablo Greco e6a3ae
     FEAT_GROUP_INIT("msa9", MSA_EXT_9, "Message-security-assist-extension 9 facility"),
Pablo Greco e6a3ae
     FEAT_GROUP_INIT("msa9_pckmo", MSA_EXT_9_PCKMO, "Message-security-assist-extension 9 PCKMO subfunctions"),
Pablo Greco e6a3ae
     FEAT_GROUP_INIT("mepochptff", MULTIPLE_EPOCH_PTFF, "PTFF enhancements introduced with Multiple-epoch facility"),
Pablo Greco e6a3ae
+    FEAT_GROUP_INIT("esort", ENH_SORT, "Enhanced-sort facility"),
Pablo Greco e6a3ae
 };
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 const S390FeatGroupDef *s390_feat_group_def(S390FeatGroup group)
Pablo Greco e6a3ae
diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
Pablo Greco e6a3ae
index 5ffd3db..3b8c5b2 100644
Pablo Greco e6a3ae
--- a/target/s390x/cpu_features.h
Pablo Greco e6a3ae
+++ b/target/s390x/cpu_features.h
Pablo Greco e6a3ae
@@ -40,6 +40,7 @@ typedef enum {
Pablo Greco e6a3ae
     S390_FEAT_TYPE_PPNO,
Pablo Greco e6a3ae
     S390_FEAT_TYPE_KMA,
Pablo Greco e6a3ae
     S390_FEAT_TYPE_KDSA,
Pablo Greco e6a3ae
+    S390_FEAT_TYPE_SORTL,
Pablo Greco e6a3ae
 } S390FeatType;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 /* Definition of a CPU feature */
Pablo Greco e6a3ae
diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_def.h
Pablo Greco e6a3ae
index ce2223c..bb85858 100644
Pablo Greco e6a3ae
--- a/target/s390x/cpu_features_def.h
Pablo Greco e6a3ae
+++ b/target/s390x/cpu_features_def.h
Pablo Greco e6a3ae
@@ -97,6 +97,7 @@ typedef enum {
Pablo Greco e6a3ae
     S390_FEAT_MSA_EXT_8,
Pablo Greco e6a3ae
     S390_FEAT_CMM_NT,
Pablo Greco e6a3ae
     S390_FEAT_VECTOR_ENH2,
Pablo Greco e6a3ae
+    S390_FEAT_ESORT_BASE,
Pablo Greco e6a3ae
     S390_FEAT_VECTOR_BCD_ENH,
Pablo Greco e6a3ae
     S390_FEAT_MSA_EXT_9,
Pablo Greco e6a3ae
     S390_FEAT_ETOKEN,
Pablo Greco e6a3ae
@@ -346,6 +347,13 @@ typedef enum {
Pablo Greco e6a3ae
     S390_FEAT_EEDDSA_SIGN_ED25519,
Pablo Greco e6a3ae
     S390_FEAT_EEDDSA_SIGN_ED448,
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+    /* SORTL */
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_SFLR,
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_SVLR,
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_32,
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_128,
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_F0,
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
     S390_FEAT_MAX,
Pablo Greco e6a3ae
 } S390Feat;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
Pablo Greco e6a3ae
index 39cc375..1a94cae 100644
Pablo Greco e6a3ae
--- a/target/s390x/gen-features.c
Pablo Greco e6a3ae
+++ b/target/s390x/gen-features.c
Pablo Greco e6a3ae
@@ -245,6 +245,15 @@
Pablo Greco e6a3ae
     S390_FEAT_PCKMO_ECC_ED25519, \
Pablo Greco e6a3ae
     S390_FEAT_PCKMO_ECC_ED448
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+#define S390_FEAT_GROUP_ENH_SORT \
Pablo Greco e6a3ae
+    S390_FEAT_ESORT_BASE, \
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_SFLR, \
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_SVLR, \
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_32, \
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_128, \
Pablo Greco e6a3ae
+    S390_FEAT_SORTL_F0
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
 /* cpu feature groups */
Pablo Greco e6a3ae
 static uint16_t group_PLO[] = {
Pablo Greco e6a3ae
     S390_FEAT_GROUP_PLO,
Pablo Greco e6a3ae
@@ -294,6 +303,10 @@ static uint16_t group_MSA_EXT_9_PCKMO[] = {
Pablo Greco e6a3ae
     S390_FEAT_GROUP_MSA_EXT_9_PCKMO,
Pablo Greco e6a3ae
 };
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+static uint16_t group_ENH_SORT[] = {
Pablo Greco e6a3ae
+    S390_FEAT_GROUP_ENH_SORT,
Pablo Greco e6a3ae
+};
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
 /* Base features (in order of release)
Pablo Greco e6a3ae
  * Only non-hypervisor managed features belong here.
Pablo Greco e6a3ae
  * Base feature sets are static meaning they do not change in future QEMU
Pablo Greco e6a3ae
@@ -751,6 +764,7 @@ static FeatGroupDefSpec FeatGroupDef[] = {
Pablo Greco e6a3ae
     FEAT_GROUP_INITIALIZER(MSA_EXT_9),
Pablo Greco e6a3ae
     FEAT_GROUP_INITIALIZER(MSA_EXT_9_PCKMO),
Pablo Greco e6a3ae
     FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
Pablo Greco e6a3ae
+    FEAT_GROUP_INITIALIZER(ENH_SORT),
Pablo Greco e6a3ae
 };
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 #define QEMU_FEAT_INITIALIZER(_name)                   \
Pablo Greco e6a3ae
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
Pablo Greco e6a3ae
index 898fe5e..b7e3f33 100644
Pablo Greco e6a3ae
--- a/target/s390x/kvm.c
Pablo Greco e6a3ae
+++ b/target/s390x/kvm.c
Pablo Greco e6a3ae
@@ -2082,6 +2082,9 @@ static int query_cpu_subfunc(S390FeatBitmap features)
Pablo Greco e6a3ae
     if (test_bit(S390_FEAT_MSA_EXT_9, features)) {
Pablo Greco e6a3ae
         s390_add_from_feat_block(features, S390_FEAT_TYPE_KDSA, prop.kdsa);
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
+    if (test_bit(S390_FEAT_ESORT_BASE, features)) {
Pablo Greco e6a3ae
+        s390_add_from_feat_block(features, S390_FEAT_TYPE_SORTL, prop.sortl);
Pablo Greco e6a3ae
+    }
Pablo Greco e6a3ae
     return 0;
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -2129,6 +2132,9 @@ static int configure_cpu_subfunc(const S390FeatBitmap features)
Pablo Greco e6a3ae
     if (test_bit(S390_FEAT_MSA_EXT_9, features)) {
Pablo Greco e6a3ae
         s390_fill_feat_block(features, S390_FEAT_TYPE_KDSA, prop.kdsa);
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
+    if (test_bit(S390_FEAT_ESORT_BASE, features)) {
Pablo Greco e6a3ae
+        s390_fill_feat_block(features, S390_FEAT_TYPE_SORTL, prop.sortl);
Pablo Greco e6a3ae
+    }
Pablo Greco e6a3ae
     return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae