|
|
8fced6 |
From 722078f9fdb766c2f0990145de6732f0c36a63b7 Mon Sep 17 00:00:00 2001
|
|
|
8fced6 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
8fced6 |
Date: Wed, 11 Nov 2020 12:03:16 -0500
|
|
|
8fced6 |
Subject: [PATCH 16/18] s390x: pv: Fix diag318 PV fencing
|
|
|
8fced6 |
|
|
|
8fced6 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
8fced6 |
Message-id: <20201111120316.707489-13-thuth@redhat.com>
|
|
|
8fced6 |
Patchwork-id: 99509
|
|
|
8fced6 |
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH v2 12/12] s390x: pv: Fix diag318 PV fencing
|
|
|
8fced6 |
Bugzilla: 1798506
|
|
|
8fced6 |
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
|
|
|
8fced6 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
8fced6 |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
8fced6 |
|
|
|
8fced6 |
From: Janosch Frank <frankja@linux.ibm.com>
|
|
|
8fced6 |
|
|
|
8fced6 |
Diag318 fencing needs to be determined on the current VM PV state and
|
|
|
8fced6 |
not on the state that the VM has when we create the CPU model.
|
|
|
8fced6 |
|
|
|
8fced6 |
Fixes: fabdada935 ("s390: guest support for diagnose 0x318")
|
|
|
8fced6 |
Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
|
|
|
8fced6 |
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
|
|
8fced6 |
Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
|
|
|
8fced6 |
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
|
|
|
8fced6 |
Reviewed-by: Collin Walling <walling@linux.ibm.com>
|
|
|
8fced6 |
Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
8fced6 |
Message-Id: <20201022103135.126033-3-frankja@linux.ibm.com>
|
|
|
8fced6 |
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
8fced6 |
(cherry picked from commit 3ded270a2697852a71961b45291519ae044f25e3)
|
|
|
8fced6 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
8fced6 |
---
|
|
|
8fced6 |
target/s390x/cpu_features.c | 5 +++++
|
|
|
8fced6 |
target/s390x/cpu_features.h | 4 ++++
|
|
|
8fced6 |
target/s390x/cpu_models.c | 4 ++++
|
|
|
8fced6 |
target/s390x/kvm.c | 3 +--
|
|
|
8fced6 |
4 files changed, 14 insertions(+), 2 deletions(-)
|
|
|
8fced6 |
|
|
|
8fced6 |
diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
|
|
|
8fced6 |
index 9f817e3cfa7..e5cdf232607 100644
|
|
|
8fced6 |
--- a/target/s390x/cpu_features.c
|
|
|
8fced6 |
+++ b/target/s390x/cpu_features.c
|
|
|
8fced6 |
@@ -14,6 +14,7 @@
|
|
|
8fced6 |
#include "qemu/osdep.h"
|
|
|
8fced6 |
#include "qemu/module.h"
|
|
|
8fced6 |
#include "cpu_features.h"
|
|
|
8fced6 |
+#include "hw/s390x/pv.h"
|
|
|
8fced6 |
|
|
|
8fced6 |
#define DEF_FEAT(_FEAT, _NAME, _TYPE, _BIT, _DESC) \
|
|
|
8fced6 |
[S390_FEAT_##_FEAT] = { \
|
|
|
8fced6 |
@@ -105,6 +106,10 @@ void s390_fill_feat_block(const S390FeatBitmap features, S390FeatType type,
|
|
|
8fced6 |
}
|
|
|
8fced6 |
feat = find_next_bit(features, S390_FEAT_MAX, feat + 1);
|
|
|
8fced6 |
}
|
|
|
8fced6 |
+
|
|
|
8fced6 |
+ if (type == S390_FEAT_TYPE_SCLP_FAC134 && s390_is_pv()) {
|
|
|
8fced6 |
+ clear_be_bit(s390_feat_def(S390_FEAT_DIAG_318)->bit, data);
|
|
|
8fced6 |
+ }
|
|
|
8fced6 |
}
|
|
|
8fced6 |
|
|
|
8fced6 |
void s390_add_from_feat_block(S390FeatBitmap features, S390FeatType type,
|
|
|
8fced6 |
diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
|
|
|
8fced6 |
index f74f7fc3a11..d3c685a04c8 100644
|
|
|
8fced6 |
--- a/target/s390x/cpu_features.h
|
|
|
8fced6 |
+++ b/target/s390x/cpu_features.h
|
|
|
8fced6 |
@@ -81,6 +81,10 @@ const S390FeatGroupDef *s390_feat_group_def(S390FeatGroup group);
|
|
|
8fced6 |
|
|
|
8fced6 |
#define BE_BIT_NR(BIT) (BIT ^ (BITS_PER_LONG - 1))
|
|
|
8fced6 |
|
|
|
8fced6 |
+static inline void clear_be_bit(unsigned int bit_nr, uint8_t *array)
|
|
|
8fced6 |
+{
|
|
|
8fced6 |
+ array[bit_nr / 8] &= ~(0x80 >> (bit_nr % 8));
|
|
|
8fced6 |
+}
|
|
|
8fced6 |
static inline void set_be_bit(unsigned int bit_nr, uint8_t *array)
|
|
|
8fced6 |
{
|
|
|
8fced6 |
array[bit_nr / 8] |= 0x80 >> (bit_nr % 8);
|
|
|
8fced6 |
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
|
|
|
8fced6 |
index bf6a3faba9e..d489923cb8a 100644
|
|
|
8fced6 |
--- a/target/s390x/cpu_models.c
|
|
|
8fced6 |
+++ b/target/s390x/cpu_models.c
|
|
|
8fced6 |
@@ -29,6 +29,7 @@
|
|
|
8fced6 |
#include "hw/pci/pci.h"
|
|
|
8fced6 |
#endif
|
|
|
8fced6 |
#include "qapi/qapi-commands-machine-target.h"
|
|
|
8fced6 |
+#include "hw/s390x/pv.h"
|
|
|
8fced6 |
|
|
|
8fced6 |
#define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \
|
|
|
8fced6 |
{ \
|
|
|
8fced6 |
@@ -238,6 +239,9 @@ bool s390_has_feat(S390Feat feat)
|
|
|
8fced6 |
}
|
|
|
8fced6 |
return 0;
|
|
|
8fced6 |
}
|
|
|
8fced6 |
+ if (feat == S390_FEAT_DIAG_318 && s390_is_pv()) {
|
|
|
8fced6 |
+ return false;
|
|
|
8fced6 |
+ }
|
|
|
8fced6 |
return test_bit(feat, cpu->model->features);
|
|
|
8fced6 |
}
|
|
|
8fced6 |
|
|
|
8fced6 |
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
|
|
|
8fced6 |
index e5e190d21c9..6edb52f6d25 100644
|
|
|
8fced6 |
--- a/target/s390x/kvm.c
|
|
|
8fced6 |
+++ b/target/s390x/kvm.c
|
|
|
8fced6 |
@@ -2483,8 +2483,7 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
|
|
|
8fced6 |
*/
|
|
|
8fced6 |
set_bit(S390_FEAT_EXTENDED_LENGTH_SCCB, model->features);
|
|
|
8fced6 |
|
|
|
8fced6 |
- /* DIAGNOSE 0x318 is not supported under protected virtualization */
|
|
|
8fced6 |
- if (!s390_is_pv() && kvm_check_extension(kvm_state, KVM_CAP_S390_DIAG318)) {
|
|
|
8fced6 |
+ if (kvm_check_extension(kvm_state, KVM_CAP_S390_DIAG318)) {
|
|
|
8fced6 |
set_bit(S390_FEAT_DIAG_318, model->features);
|
|
|
8fced6 |
}
|
|
|
8fced6 |
|
|
|
8fced6 |
--
|
|
|
8fced6 |
2.27.0
|
|
|
8fced6 |
|