thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-s390x-cpumodel-add-Deflate-conversion-facility.patch

ae23c9
From f1b43cf50155508bf93ff4bbd4e9930ab06e8359 Mon Sep 17 00:00:00 2001
ae23c9
From: David Hildenbrand <david@redhat.com>
ae23c9
Date: Wed, 22 May 2019 08:04:00 +0100
ae23c9
Subject: [PATCH 08/12] s390x/cpumodel: add Deflate-conversion facility
ae23c9
ae23c9
RH-Author: David Hildenbrand <david@redhat.com>
ae23c9
Message-id: <20190522080402.20173-9-david@redhat.com>
ae23c9
Patchwork-id: 88155
ae23c9
O-Subject: [RHEL8.1 qemu-kvm PATCH v2 08/10] s390x/cpumodel: add Deflate-conversion facility
ae23c9
Bugzilla: 1660912
ae23c9
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
ae23c9
add the deflate conversion facility.
ae23c9
ae23c9
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
ae23c9
Message-Id: <20190429090250.7648-8-borntraeger@de.ibm.com>
ae23c9
Reviewed-by: David Hildenbrand <david@redhat.com>
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
(cherry picked from commit afc7b8666b62fe72fdbad7ab0c3f206d4c57c1d1)
ae23c9
Signed-off-by: David Hildenbrand <david@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 target/s390x/cpu_features.c     |  9 +++++++++
ae23c9
 target/s390x/cpu_features.h     |  1 +
ae23c9
 target/s390x/cpu_features_def.h |  7 +++++++
ae23c9
 target/s390x/gen-features.c     | 12 ++++++++++++
ae23c9
 target/s390x/kvm.c              |  6 ++++++
ae23c9
 5 files changed, 35 insertions(+)
ae23c9
ae23c9
diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
ae23c9
index 1d19b30..f64f581 100644
ae23c9
--- a/target/s390x/cpu_features.c
ae23c9
+++ b/target/s390x/cpu_features.c
ae23c9
@@ -110,6 +110,7 @@ static const S390FeatDef s390_features[] = {
ae23c9
     FEAT_INIT("cmmnt", S390_FEAT_TYPE_STFL, 147, "CMM: ESSA-enhancement (no translate) facility"),
ae23c9
     FEAT_INIT("vxeh2", S390_FEAT_TYPE_STFL, 148, "Vector Enhancements facility 2"),
ae23c9
     FEAT_INIT("esort-base", S390_FEAT_TYPE_STFL, 150, "Enhanced-sort facility (excluding subfunctions)"),
ae23c9
+    FEAT_INIT("deflate-base", S390_FEAT_TYPE_STFL, 151, "Deflate-conversion facility (excluding subfunctions)"),
ae23c9
     FEAT_INIT("vxbeh", S390_FEAT_TYPE_STFL, 152, "Vector BCD enhancements facility 1"),
ae23c9
     FEAT_INIT("msa9-base", S390_FEAT_TYPE_STFL, 155, "Message-security-assist-extension-9 facility (excluding subfunctions)"),
ae23c9
     FEAT_INIT("etoken", S390_FEAT_TYPE_STFL, 156, "Etoken facility"),
ae23c9
@@ -347,6 +348,11 @@ static const S390FeatDef s390_features[] = {
ae23c9
     FEAT_INIT("sortl-32", S390_FEAT_TYPE_SORTL, 130, "SORTL 32 input lists"),
ae23c9
     FEAT_INIT("sortl-128", S390_FEAT_TYPE_SORTL, 132, "SORTL 128 input lists"),
ae23c9
     FEAT_INIT("sortl-f0", S390_FEAT_TYPE_SORTL, 192, "SORTL format 0 parameter-block"),
ae23c9
+
ae23c9
+    FEAT_INIT("dfltcc-gdht", S390_FEAT_TYPE_DFLTCC, 1, "DFLTCC GDHT"),
ae23c9
+    FEAT_INIT("dfltcc-cmpr", S390_FEAT_TYPE_DFLTCC, 2, "DFLTCC CMPR"),
ae23c9
+    FEAT_INIT("dfltcc-xpnd", S390_FEAT_TYPE_DFLTCC, 4, "DFLTCC XPND"),
ae23c9
+    FEAT_INIT("dfltcc-f0", S390_FEAT_TYPE_DFLTCC, 192, "DFLTCC format 0 parameter-block"),
ae23c9
 };
ae23c9
 
ae23c9
 const S390FeatDef *s390_feat_def(S390Feat feat)
ae23c9
@@ -411,6 +417,7 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
ae23c9
     case S390_FEAT_TYPE_KMA:
ae23c9
     case S390_FEAT_TYPE_KDSA:
ae23c9
     case S390_FEAT_TYPE_SORTL:
ae23c9
+    case S390_FEAT_TYPE_DFLTCC:
ae23c9
         set_be_bit(0, data); /* query is always available */
ae23c9
         break;
ae23c9
     default:
ae23c9
@@ -439,6 +446,7 @@ void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
ae23c9
        break;
ae23c9
     case S390_FEAT_TYPE_PLO:
ae23c9
     case S390_FEAT_TYPE_SORTL:
ae23c9
+    case S390_FEAT_TYPE_DFLTCC:
ae23c9
        nr_bits = 256;
ae23c9
        break;
ae23c9
     default:
ae23c9
@@ -511,6 +519,7 @@ static S390FeatGroupDef s390_feature_groups[] = {
ae23c9
     FEAT_GROUP_INIT("msa9_pckmo", MSA_EXT_9_PCKMO, "Message-security-assist-extension 9 PCKMO subfunctions"),
ae23c9
     FEAT_GROUP_INIT("mepochptff", MULTIPLE_EPOCH_PTFF, "PTFF enhancements introduced with Multiple-epoch facility"),
ae23c9
     FEAT_GROUP_INIT("esort", ENH_SORT, "Enhanced-sort facility"),
ae23c9
+    FEAT_GROUP_INIT("deflate", DEFLATE_CONVERSION, "Deflate-conversion facility"),
ae23c9
 };
ae23c9
 
ae23c9
 const S390FeatGroupDef *s390_feat_group_def(S390FeatGroup group)
ae23c9
diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
ae23c9
index 3b8c5b2..da695a8 100644
ae23c9
--- a/target/s390x/cpu_features.h
ae23c9
+++ b/target/s390x/cpu_features.h
ae23c9
@@ -41,6 +41,7 @@ typedef enum {
ae23c9
     S390_FEAT_TYPE_KMA,
ae23c9
     S390_FEAT_TYPE_KDSA,
ae23c9
     S390_FEAT_TYPE_SORTL,
ae23c9
+    S390_FEAT_TYPE_DFLTCC,
ae23c9
 } S390FeatType;
ae23c9
 
ae23c9
 /* Definition of a CPU feature */
ae23c9
diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_def.h
ae23c9
index bb85858..292b17b 100644
ae23c9
--- a/target/s390x/cpu_features_def.h
ae23c9
+++ b/target/s390x/cpu_features_def.h
ae23c9
@@ -98,6 +98,7 @@ typedef enum {
ae23c9
     S390_FEAT_CMM_NT,
ae23c9
     S390_FEAT_VECTOR_ENH2,
ae23c9
     S390_FEAT_ESORT_BASE,
ae23c9
+    S390_FEAT_DEFLATE_BASE,
ae23c9
     S390_FEAT_VECTOR_BCD_ENH,
ae23c9
     S390_FEAT_MSA_EXT_9,
ae23c9
     S390_FEAT_ETOKEN,
ae23c9
@@ -354,6 +355,12 @@ typedef enum {
ae23c9
     S390_FEAT_SORTL_128,
ae23c9
     S390_FEAT_SORTL_F0,
ae23c9
 
ae23c9
+    /* DEFLATE */
ae23c9
+    S390_FEAT_DEFLATE_GHDT,
ae23c9
+    S390_FEAT_DEFLATE_CMPR,
ae23c9
+    S390_FEAT_DEFLATE_XPND,
ae23c9
+    S390_FEAT_DEFLATE_F0,
ae23c9
+
ae23c9
     S390_FEAT_MAX,
ae23c9
 } S390Feat;
ae23c9
 
ae23c9
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
ae23c9
index 1a94cae..c61bce2 100644
ae23c9
--- a/target/s390x/gen-features.c
ae23c9
+++ b/target/s390x/gen-features.c
ae23c9
@@ -254,6 +254,13 @@
ae23c9
     S390_FEAT_SORTL_F0
ae23c9
 
ae23c9
 
ae23c9
+#define S390_FEAT_GROUP_DEFLATE_CONVERSION \
ae23c9
+    S390_FEAT_DEFLATE_BASE, \
ae23c9
+    S390_FEAT_DEFLATE_GHDT, \
ae23c9
+    S390_FEAT_DEFLATE_CMPR, \
ae23c9
+    S390_FEAT_DEFLATE_XPND, \
ae23c9
+    S390_FEAT_DEFLATE_F0
ae23c9
+
ae23c9
 /* cpu feature groups */
ae23c9
 static uint16_t group_PLO[] = {
ae23c9
     S390_FEAT_GROUP_PLO,
ae23c9
@@ -307,6 +314,10 @@ static uint16_t group_ENH_SORT[] = {
ae23c9
     S390_FEAT_GROUP_ENH_SORT,
ae23c9
 };
ae23c9
 
ae23c9
+static uint16_t group_DEFLATE_CONVERSION[] = {
ae23c9
+    S390_FEAT_GROUP_DEFLATE_CONVERSION,
ae23c9
+};
ae23c9
+
ae23c9
 /* Base features (in order of release)
ae23c9
  * Only non-hypervisor managed features belong here.
ae23c9
  * Base feature sets are static meaning they do not change in future QEMU
ae23c9
@@ -765,6 +776,7 @@ static FeatGroupDefSpec FeatGroupDef[] = {
ae23c9
     FEAT_GROUP_INITIALIZER(MSA_EXT_9_PCKMO),
ae23c9
     FEAT_GROUP_INITIALIZER(MULTIPLE_EPOCH_PTFF),
ae23c9
     FEAT_GROUP_INITIALIZER(ENH_SORT),
ae23c9
+    FEAT_GROUP_INITIALIZER(DEFLATE_CONVERSION),
ae23c9
 };
ae23c9
 
ae23c9
 #define QEMU_FEAT_INITIALIZER(_name)                   \
ae23c9
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
ae23c9
index b7e3f33..1d6cc33 100644
ae23c9
--- a/target/s390x/kvm.c
ae23c9
+++ b/target/s390x/kvm.c
ae23c9
@@ -2085,6 +2085,9 @@ static int query_cpu_subfunc(S390FeatBitmap features)
ae23c9
     if (test_bit(S390_FEAT_ESORT_BASE, features)) {
ae23c9
         s390_add_from_feat_block(features, S390_FEAT_TYPE_SORTL, prop.sortl);
ae23c9
     }
ae23c9
+    if (test_bit(S390_FEAT_DEFLATE_BASE, features)) {
ae23c9
+        s390_add_from_feat_block(features, S390_FEAT_TYPE_DFLTCC, prop.dfltcc);
ae23c9
+    }
ae23c9
     return 0;
ae23c9
 }
ae23c9
 
ae23c9
@@ -2135,6 +2138,9 @@ static int configure_cpu_subfunc(const S390FeatBitmap features)
ae23c9
     if (test_bit(S390_FEAT_ESORT_BASE, features)) {
ae23c9
         s390_fill_feat_block(features, S390_FEAT_TYPE_SORTL, prop.sortl);
ae23c9
     }
ae23c9
+    if (test_bit(S390_FEAT_DEFLATE_BASE, features)) {
ae23c9
+        s390_fill_feat_block(features, S390_FEAT_TYPE_DFLTCC, prop.dfltcc);
ae23c9
+    }
ae23c9
     return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
ae23c9
 }
ae23c9
 
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9