KVM: s390: MSA8 feature for guests

- Detect all function codes for KMA and export the features
   for use in the cpu model
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJZAJMcAAoJEBF7vIC1phx8KhYP/3mLY9I/SIJDNDge2Jyu59Mf
 8VH6UhwViVV2xq0IJvQFuMzlJZ7CoIrdPGTg+mCkzl14fseJOXsS70H4S+stq/nQ
 CtMPe5SHz5TkKa4OMcFuR4dLk4bWNt+eNwsfe8fy5FAihTSuQXslOAmE7f7kWIWn
 kRzzAoK595AtCnpdO2tqnJHLCby9OxLVAfg58vCnILKrb7PfU8pK5QVQ9LJPNxLX
 L0Sf0jWkv+cAGlxD4Z5C/So1YRYjVsHDfQUaExQNiL4jlYJTuOOQ9jD2dZ1SPfWF
 oImEeIc9ykDaLEG6fsBvqOWPMSVmA4ErppXn9Zq11NfUCxVBHI1zerJzfI5RrU7w
 +IkoCHkOmlzUY/OgixejcVyh48iMrmgTbpyI/idhgGNgCHjZ5E2AcFNfxJW4n7Sj
 XvuUvpi9RLddvySdAnYVE+y+KJgPxc33Rkw1+g02YrkQxvT2JVmGA9sgFA/wN5zM
 rNtwXpi9lY8uza4/AGUCNN3+lmZW/cMCWA33oApIjVogFwJikafrpqNlNv3clkiw
 EZKgaKnPlSCGJey+5SNxNGcPnip9OT/zIbRtpyFvLmeaYaABiVIJ2unSfdPaAyMn
 zW6grB+ZzSoKnN514k5rw9smEYUOYYtnVkYEdTtq6LBnRRptR1S/bVkQt2v1aTRn
 ZP3nJm4CZ+SUjioTWHon
 =elz2
 -----END PGP SIGNATURE-----

Merge tag 'kvm-s390-next-4.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD

KVM: s390: MSA8 feature for guests

- Detect all function codes for KMA and export the features
  for use in the cpu model
This commit is contained in:
Paolo Bonzini 2017-04-27 14:11:07 +02:00
commit cf9bdd3577
6 changed files with 14 additions and 5 deletions

View File

@ -140,7 +140,8 @@ struct kvm_s390_vm_cpu_subfunc {
u8 kmo[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 reserved[1824]; # reserved for future instructions
u8 kma[16]; # valid with Message-Security-Assist-Extension 8
u8 reserved[1808]; # reserved for future instructions
};
Parameters: address of a buffer to load the subfunction blocks from.

View File

@ -26,6 +26,7 @@
#define CPACF_PCC 0xb92c /* MSA4 */
#define CPACF_KMCTR 0xb92d /* MSA4 */
#define CPACF_PPNO 0xb93c /* MSA5 */
#define CPACF_KMA 0xb929 /* MSA8 */
/*
* En/decryption modifier bits
@ -149,8 +150,8 @@ static inline void __cpacf_query(unsigned int opcode, cpacf_mask_t *mask)
asm volatile(
" spm 0\n" /* pckmo doesn't change the cc */
/* Parameter registers are ignored, but may not be 0 */
"0: .insn rrf,%[opc] << 16,2,2,2,0\n"
/* Parameter regs are ignored, but must be nonzero and unique */
"0: .insn rrf,%[opc] << 16,2,4,6,0\n"
" brc 1,0b\n" /* handle partial completion */
: "=m" (*mask)
: [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (opcode)

View File

@ -141,7 +141,8 @@ struct kvm_s390_vm_cpu_subfunc {
__u8 kmo[16]; /* with MSA4 */
__u8 pcc[16]; /* with MSA4 */
__u8 ppno[16]; /* with MSA5 */
__u8 reserved[1824];
__u8 kma[16]; /* with MSA8 */
__u8 reserved[1808];
};
/* kvm attributes for crypto */

View File

@ -276,6 +276,10 @@ static void kvm_s390_cpu_feat_init(void)
__cpacf_query(CPACF_PPNO, (cpacf_mask_t *)
kvm_s390_available_subfunc.ppno);
if (test_facility(146)) /* MSA8 */
__cpacf_query(CPACF_KMA, (cpacf_mask_t *)
kvm_s390_available_subfunc.kma);
if (MACHINE_HAS_ESOP)
allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP);
/*

View File

@ -82,6 +82,7 @@ static struct facility_def facility_defs[] = {
78, /* enhanced-DAT 2 */
130, /* instruction-execution-protection */
131, /* enhanced-SOP 2 and side-effect */
146, /* msa extension 8 */
-1 /* END */
}
},

View File

@ -131,7 +131,8 @@ struct kvm_s390_vm_cpu_subfunc {
__u8 kmo[16]; /* with MSA4 */
__u8 pcc[16]; /* with MSA4 */
__u8 ppno[16]; /* with MSA5 */
__u8 reserved[1824];
__u8 kma[16]; /* with MSA8 */
__u8 reserved[1808];
};
/* kvm attributes for crypto */