|
|
ae23c9 |
From 89c813343ab05381d7def3b67120a4480490add7 Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
ae23c9 |
Date: Mon, 15 Oct 2018 10:19:28 +0100
|
|
|
ae23c9 |
Subject: [PATCH 3/6] s390x/kvm: enable AP instruction interpretation for guest
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
ae23c9 |
Message-id: <1539598771-16223-4-git-send-email-thuth@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 82697
|
|
|
ae23c9 |
O-Subject: [RHEL-8 qemu-kvm PATCH 3/6] s390x/kvm: enable AP instruction interpretation for guest
|
|
|
ae23c9 |
Bugzilla: 1508142
|
|
|
ae23c9 |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
From: Tony Krowiak <akrowiak@linux.ibm.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Let's use the KVM_SET_DEVICE_ATTR ioctl to enable hardware
|
|
|
ae23c9 |
interpretation of AP instructions executed on the guest.
|
|
|
ae23c9 |
If the S390_FEAT_AP feature is switched on for the guest,
|
|
|
ae23c9 |
AP instructions must be interpreted by default; otherwise,
|
|
|
ae23c9 |
they will be intercepted.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
This attribute setting may be overridden by a device. For example,
|
|
|
ae23c9 |
a device may want to provide AP instructions to the guest (i.e.,
|
|
|
ae23c9 |
S390_FEAT_AP turned on), but it may want to emulate them. In this
|
|
|
ae23c9 |
case, the AP instructions executed on the guest must be
|
|
|
ae23c9 |
intercepted; so when the device is realized, it must disable
|
|
|
ae23c9 |
interpretation.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
|
|
|
ae23c9 |
Tested-by: Pierre Morel <pmorel@linux.ibm.com>
|
|
|
ae23c9 |
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Thomas Huth <thuth@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
|
|
|
ae23c9 |
Acked-by: Halil Pasic <pasic@linux.ibm.com>
|
|
|
ae23c9 |
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
|
|
|
ae23c9 |
Message-Id: <20181010170309.12045-4-akrowiak@linux.ibm.com>
|
|
|
ae23c9 |
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit 1d7db85b61cb9888b8ed8c8923343b468405b7a0)
|
|
|
ae23c9 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
target/s390x/kvm.c | 19 +++++++++++++++++++
|
|
|
ae23c9 |
1 file changed, 19 insertions(+)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
|
|
|
ae23c9 |
index 2a63499..4cb3499 100644
|
|
|
ae23c9 |
--- a/target/s390x/kvm.c
|
|
|
ae23c9 |
+++ b/target/s390x/kvm.c
|
|
|
ae23c9 |
@@ -2298,11 +2298,26 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
|
|
|
ae23c9 |
error_setg(errp, "KVM: host CPU model could not be identified");
|
|
|
ae23c9 |
return;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
+ /* for now, we can only provide the AP feature with HW support */
|
|
|
ae23c9 |
+ if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO,
|
|
|
ae23c9 |
+ KVM_S390_VM_CRYPTO_ENABLE_APIE)) {
|
|
|
ae23c9 |
+ set_bit(S390_FEAT_AP, model->features);
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
/* strip of features that are not part of the maximum model */
|
|
|
ae23c9 |
bitmap_and(model->features, model->features, model->def->full_feat,
|
|
|
ae23c9 |
S390_FEAT_MAX);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
+static void kvm_s390_configure_apie(bool interpret)
|
|
|
ae23c9 |
+{
|
|
|
ae23c9 |
+ uint64_t attr = interpret ? KVM_S390_VM_CRYPTO_ENABLE_APIE :
|
|
|
ae23c9 |
+ KVM_S390_VM_CRYPTO_DISABLE_APIE;
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO, attr)) {
|
|
|
ae23c9 |
+ kvm_s390_set_attr(attr);
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
+}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
struct kvm_s390_vm_cpu_processor prop = {
|
|
|
ae23c9 |
@@ -2360,6 +2375,10 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
|
|
|
ae23c9 |
if (test_bit(S390_FEAT_CMM, model->features)) {
|
|
|
ae23c9 |
kvm_s390_enable_cmma();
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ if (test_bit(S390_FEAT_AP, model->features)) {
|
|
|
ae23c9 |
+ kvm_s390_configure_apie(true);
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
void kvm_s390_restart_interrupt(S390CPU *cpu)
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|