Commit 13209ad0 authored by Christian Borntraeger's avatar Christian Borntraeger

KVM: s390: add MSA9 to cpumodel

This enables stfle.155 and adds the subfunctions for KDSA. Bit 155 is
added to the list of facilities that will be enabled when there is no
cpu model involved as MSA9 requires no additional handling from
userspace, e.g. for migration.

Please note that a cpu model enabled user space can and will have the
final decision on the facility bits for a guests.
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Acked-by: default avatarJanosch Frank <frankja@linux.ibm.com>
Reviewed-by: default avatarCollin Walling <walling@linux.ibm.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
parent d5cb6ab1
...@@ -141,7 +141,8 @@ struct kvm_s390_vm_cpu_subfunc { ...@@ -141,7 +141,8 @@ struct kvm_s390_vm_cpu_subfunc {
u8 pcc[16]; # valid with Message-Security-Assist-Extension 4 u8 pcc[16]; # valid with Message-Security-Assist-Extension 4
u8 ppno[16]; # valid with Message-Security-Assist-Extension 5 u8 ppno[16]; # valid with Message-Security-Assist-Extension 5
u8 kma[16]; # valid with Message-Security-Assist-Extension 8 u8 kma[16]; # valid with Message-Security-Assist-Extension 8
u8 reserved[1808]; # reserved for future instructions u8 kdsa[16]; # valid with Message-Security-Assist-Extension 9
u8 reserved[1792]; # reserved for future instructions
}; };
Parameters: address of a buffer to load the subfunction blocks from. Parameters: address of a buffer to load the subfunction blocks from.
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#define CPACF_KMCTR 0xb92d /* MSA4 */ #define CPACF_KMCTR 0xb92d /* MSA4 */
#define CPACF_PRNO 0xb93c /* MSA5 */ #define CPACF_PRNO 0xb93c /* MSA5 */
#define CPACF_KMA 0xb929 /* MSA8 */ #define CPACF_KMA 0xb929 /* MSA8 */
#define CPACF_KDSA 0xb93a /* MSA9 */
/* /*
* En/decryption modifier bits * En/decryption modifier bits
......
...@@ -152,7 +152,8 @@ struct kvm_s390_vm_cpu_subfunc { ...@@ -152,7 +152,8 @@ struct kvm_s390_vm_cpu_subfunc {
__u8 pcc[16]; /* with MSA4 */ __u8 pcc[16]; /* with MSA4 */
__u8 ppno[16]; /* with MSA5 */ __u8 ppno[16]; /* with MSA5 */
__u8 kma[16]; /* with MSA8 */ __u8 kma[16]; /* with MSA8 */
__u8 reserved[1808]; __u8 kdsa[16]; /* with MSA9 */
__u8 reserved[1792];
}; };
/* kvm attributes for crypto */ /* kvm attributes for crypto */
......
...@@ -368,6 +368,10 @@ static void kvm_s390_cpu_feat_init(void) ...@@ -368,6 +368,10 @@ static void kvm_s390_cpu_feat_init(void)
__cpacf_query(CPACF_KMA, (cpacf_mask_t *) __cpacf_query(CPACF_KMA, (cpacf_mask_t *)
kvm_s390_available_subfunc.kma); kvm_s390_available_subfunc.kma);
if (test_facility(155)) /* MSA9 */
__cpacf_query(CPACF_KDSA, (cpacf_mask_t *)
kvm_s390_available_subfunc.kdsa);
if (MACHINE_HAS_ESOP) if (MACHINE_HAS_ESOP)
allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP); allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP);
/* /*
...@@ -1331,6 +1335,9 @@ static int kvm_s390_set_processor_subfunc(struct kvm *kvm, ...@@ -1331,6 +1335,9 @@ static int kvm_s390_set_processor_subfunc(struct kvm *kvm,
VM_EVENT(kvm, 3, "SET: guest KMA subfunc 0x%16.16lx.%16.16lx", VM_EVENT(kvm, 3, "SET: guest KMA subfunc 0x%16.16lx.%16.16lx",
((unsigned long *) &kvm->arch.model.subfuncs.kma)[0], ((unsigned long *) &kvm->arch.model.subfuncs.kma)[0],
((unsigned long *) &kvm->arch.model.subfuncs.kma)[1]); ((unsigned long *) &kvm->arch.model.subfuncs.kma)[1]);
VM_EVENT(kvm, 3, "SET: guest KDSA subfunc 0x%16.16lx.%16.16lx",
((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[0],
((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[1]);
return 0; return 0;
} }
...@@ -1499,6 +1506,9 @@ static int kvm_s390_get_processor_subfunc(struct kvm *kvm, ...@@ -1499,6 +1506,9 @@ static int kvm_s390_get_processor_subfunc(struct kvm *kvm,
VM_EVENT(kvm, 3, "GET: guest KMA subfunc 0x%16.16lx.%16.16lx", VM_EVENT(kvm, 3, "GET: guest KMA subfunc 0x%16.16lx.%16.16lx",
((unsigned long *) &kvm->arch.model.subfuncs.kma)[0], ((unsigned long *) &kvm->arch.model.subfuncs.kma)[0],
((unsigned long *) &kvm->arch.model.subfuncs.kma)[1]); ((unsigned long *) &kvm->arch.model.subfuncs.kma)[1]);
VM_EVENT(kvm, 3, "GET: guest KDSA subfunc 0x%16.16lx.%16.16lx",
((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[0],
((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[1]);
return 0; return 0;
} }
...@@ -1554,6 +1564,9 @@ static int kvm_s390_get_machine_subfunc(struct kvm *kvm, ...@@ -1554,6 +1564,9 @@ static int kvm_s390_get_machine_subfunc(struct kvm *kvm,
VM_EVENT(kvm, 3, "GET: host KMA subfunc 0x%16.16lx.%16.16lx", VM_EVENT(kvm, 3, "GET: host KMA subfunc 0x%16.16lx.%16.16lx",
((unsigned long *) &kvm_s390_available_subfunc.kma)[0], ((unsigned long *) &kvm_s390_available_subfunc.kma)[0],
((unsigned long *) &kvm_s390_available_subfunc.kma)[1]); ((unsigned long *) &kvm_s390_available_subfunc.kma)[1]);
VM_EVENT(kvm, 3, "GET: host KDSA subfunc 0x%16.16lx.%16.16lx",
((unsigned long *) &kvm_s390_available_subfunc.kdsa)[0],
((unsigned long *) &kvm_s390_available_subfunc.kdsa)[1]);
return 0; return 0;
} }
......
...@@ -93,6 +93,7 @@ static struct facility_def facility_defs[] = { ...@@ -93,6 +93,7 @@ static struct facility_def facility_defs[] = {
131, /* enhanced-SOP 2 and side-effect */ 131, /* enhanced-SOP 2 and side-effect */
139, /* multiple epoch facility */ 139, /* multiple epoch facility */
146, /* msa extension 8 */ 146, /* msa extension 8 */
155, /* msa extension 9 */
-1 /* END */ -1 /* END */
} }
}, },
......
...@@ -152,7 +152,8 @@ struct kvm_s390_vm_cpu_subfunc { ...@@ -152,7 +152,8 @@ struct kvm_s390_vm_cpu_subfunc {
__u8 pcc[16]; /* with MSA4 */ __u8 pcc[16]; /* with MSA4 */
__u8 ppno[16]; /* with MSA5 */ __u8 ppno[16]; /* with MSA5 */
__u8 kma[16]; /* with MSA8 */ __u8 kma[16]; /* with MSA8 */
__u8 reserved[1808]; __u8 kdsa[16]; /* with MSA9 */
__u8 reserved[1792];
}; };
/* kvm attributes for crypto */ /* kvm attributes for crypto */
......
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