Commit 22be5a13 authored by David Hildenbrand's avatar David Hildenbrand Committed by Christian Borntraeger

KVM: s390: forward ESOP if available

ESOP guarantees that during a protection exception, bit 61 of real location
168-175 will only be set to 1 if it was because of ALCP or DATP. If the
exception is due to LAP or KCP, the bit will always be set to 0.

The old SOP definition allowed bit 61 to be unpredictable in case of LAP
or KCP in some conditions. So ESOP replaces this unpredictability by
a guarantee.

Therefore, we can directly forward ESOP if it is available on our machine.
We don't have to do anything when ESOP is disabled - the guest will simply
expect unpredictable values. Our guest access functions are already
handling ESOP properly.

Please note that future functionality in KVM will require knowledge about
ESOP being enabled for a guest or not.
Reviewed-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent 15c9705f
...@@ -97,6 +97,7 @@ struct kvm_s390_vm_cpu_machine { ...@@ -97,6 +97,7 @@ struct kvm_s390_vm_cpu_machine {
#define KVM_S390_VM_CPU_MACHINE_FEAT 3 #define KVM_S390_VM_CPU_MACHINE_FEAT 3
#define KVM_S390_VM_CPU_FEAT_NR_BITS 1024 #define KVM_S390_VM_CPU_FEAT_NR_BITS 1024
#define KVM_S390_VM_CPU_FEAT_ESOP 0
struct kvm_s390_vm_cpu_feat { struct kvm_s390_vm_cpu_feat {
__u64 feat[16]; __u64 feat[16];
}; };
......
...@@ -193,6 +193,17 @@ void kvm_arch_hardware_unsetup(void) ...@@ -193,6 +193,17 @@ void kvm_arch_hardware_unsetup(void)
&kvm_clock_notifier); &kvm_clock_notifier);
} }
static void allow_cpu_feat(unsigned long nr)
{
set_bit_inv(nr, kvm_s390_available_cpu_feat);
}
static void kvm_s390_cpu_feat_init(void)
{
if (MACHINE_HAS_ESOP)
allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP);
}
int kvm_arch_init(void *opaque) int kvm_arch_init(void *opaque)
{ {
kvm_s390_dbf = debug_register("kvm-trace", 32, 1, 7 * sizeof(long)); kvm_s390_dbf = debug_register("kvm-trace", 32, 1, 7 * sizeof(long));
...@@ -204,6 +215,8 @@ int kvm_arch_init(void *opaque) ...@@ -204,6 +215,8 @@ int kvm_arch_init(void *opaque)
return -ENOMEM; return -ENOMEM;
} }
kvm_s390_cpu_feat_init();
/* Register floating interrupt controller interface. */ /* Register floating interrupt controller interface. */
return kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC); return kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment