From patchwork Thu Nov 7 15:23:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hendrik Brueckner X-Patchwork-Id: 13866640 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 266C22139D3; Thu, 7 Nov 2024 15:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730993023; cv=none; b=Q5aduwriBjZ/qqy42FdBAWFWw2ZHRvomQTnEcnZYHq6/YYapZ1RgrYiDZekNKu+ngKeO0AiTjn1bhtOF7wPwDKzKKEVxXvHF7Dicn5fekntP/MJoY5uqKuUsrj4zVnlRrSe8YlONa8iAvMf7F3Xccnlr56nglpetNnnb+UYylOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730993023; c=relaxed/simple; bh=kpFZRJEAe8iAGoQAb7BnMMqtjyylyhgY5ibqYfw3JwE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=acnljIjWKkdkRq4WgNBNQKHYHdbe06XtiS17NTW9ylMwc2EDoVb6kqq2kahSE5DJvvi4UnxB6/ZLj2HKE9PLxbQDgZe/qnjGNVVOa2s+JzbybfQEJ+QysK7qd3+cDOkopMANrcPcVJNFryPnhGc4qKC8OcR7t9hW8YDQ0XyY9y4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=UK/xibtM; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="UK/xibtM" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7EeIR1027775; Thu, 7 Nov 2024 15:23:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=mCGvaOKuIYvTaUIfJ 3g+A8nj3e4nN0QlTM2wtE0B17s=; b=UK/xibtMRXSgbzLkyYAnuRisVqED2po7P qFUrlYHg7Co15A3zOLZR2mgsnEJ8XtmC/66xXgd33X9FFPT3WSY6V6nVMAsfX2Uy qTUmY2za4+Es9dt8F7JObZYGpUJiAQFxmMTtrEbw7MbEiItsIfAXUM4uMbTZooSM VflYQFHC4aqfZwWbxhUweu4faKpOn9aKEjb8EnnlDiSTJhJ3lSTC7a5HcBbatcHd eN3bUh2abtrMnBPnzV+H/zkcpkr0KE0Ophfi7ErDD45cRoYhLEyNzyREI14VKryT 3AKXyMkWo2lW/BO62xNptSDsKz/cWHU+lylVVG2K2H2RA6D4mhRow== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42rygs883h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 15:23:38 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7BxNlV031966; Thu, 7 Nov 2024 15:23:37 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 42nydmree7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 15:23:37 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4A7FNXpX45089252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Nov 2024 15:23:33 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35F4C20040; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 06BAA2004B; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) Received: from vela.boeblingen.de.ibm.com (unknown [9.155.210.79]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 7 Nov 2024 15:23:32 +0000 (GMT) From: Hendrik Brueckner To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com, borntraeger@linux.ibm.com, frankja@linux.ibm.com Subject: [PATCH 1/4] KVM: s390: add concurrent-function facility to cpu model Date: Thu, 7 Nov 2024 16:23:16 +0100 Message-ID: <20241107152319.77816-2-brueckner@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107152319.77816-1-brueckner@linux.ibm.com> References: <20241107152319.77816-1-brueckner@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: PVSScK_8VEVTA8cDCrvdzoq02bFtGPAC X-Proofpoint-GUID: PVSScK_8VEVTA8cDCrvdzoq02bFtGPAC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=555 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411070114 Adding support for concurrent-functions facility which provides additional subfunctions. Signed-off-by: Hendrik Brueckner Reviewed-by: Christian Borntraeger --- arch/s390/include/uapi/asm/kvm.h | 3 ++- arch/s390/kvm/kvm-s390.c | 22 ++++++++++++++++++++++ arch/s390/tools/gen_facilities.c | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h index 05eaf6db3ad4..60345dd2cba2 100644 --- a/arch/s390/include/uapi/asm/kvm.h +++ b/arch/s390/include/uapi/asm/kvm.h @@ -469,7 +469,8 @@ struct kvm_s390_vm_cpu_subfunc { __u8 kdsa[16]; /* with MSA9 */ __u8 sortl[32]; /* with STFLE.150 */ __u8 dfltcc[32]; /* with STFLE.151 */ - __u8 reserved[1728]; + __u8 pfcr[16]; /* with STFLE.201 */ + __u8 reserved[1712]; }; #define KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST 6 diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 06e55f681a39..f9cc1c92a79d 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -348,6 +348,16 @@ static inline int plo_test_bit(unsigned char nr) return cc == 0; } +static __always_inline void pfcr_query(u8 (*query)[16]) +{ + asm volatile( + " lghi 0,0\n" + " .insn rsy,0xeb0000000016,0,0,%[query]\n" + : [query] "=QS" (*query) + : + : "cc", "0"); +} + static __always_inline void __sortl_query(u8 (*query)[32]) { asm volatile( @@ -429,6 +439,9 @@ static void __init kvm_s390_cpu_feat_init(void) if (test_facility(151)) /* DFLTCC */ __dfltcc_query(&kvm_s390_available_subfunc.dfltcc); + if (test_facility(201)) /* PFCR */ + pfcr_query(&kvm_s390_available_subfunc.pfcr); + if (MACHINE_HAS_ESOP) allow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP); /* @@ -1543,6 +1556,9 @@ static int kvm_s390_set_processor_subfunc(struct kvm *kvm, ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1], ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2], ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]); + VM_EVENT(kvm, 3, "GET: guest PFCR subfunc 0x%16.16lx.%16.16lx", + ((unsigned long *) &kvm_s390_available_subfunc.pfcr)[0], + ((unsigned long *) &kvm_s390_available_subfunc.pfcr)[1]); return 0; } @@ -1757,6 +1773,9 @@ static int kvm_s390_get_processor_subfunc(struct kvm *kvm, ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1], ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2], ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]); + VM_EVENT(kvm, 3, "GET: guest PFCR subfunc 0x%16.16lx.%16.16lx", + ((unsigned long *) &kvm_s390_available_subfunc.pfcr)[0], + ((unsigned long *) &kvm_s390_available_subfunc.pfcr)[1]); return 0; } @@ -1825,6 +1844,9 @@ static int kvm_s390_get_machine_subfunc(struct kvm *kvm, ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[1], ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[2], ((unsigned long *) &kvm_s390_available_subfunc.dfltcc)[3]); + VM_EVENT(kvm, 3, "GET: host PFCR subfunc 0x%16.16lx.%16.16lx", + ((unsigned long *) &kvm_s390_available_subfunc.pfcr)[0], + ((unsigned long *) &kvm_s390_available_subfunc.pfcr)[1]); return 0; } diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c index c3d5214c8442..e97b4faaf222 100644 --- a/arch/s390/tools/gen_facilities.c +++ b/arch/s390/tools/gen_facilities.c @@ -116,6 +116,7 @@ static struct facility_def facility_defs[] = { 194, /* rdp enhancement facility */ 196, /* processor activity instrumentation facility */ 197, /* processor activity instrumentation extension 1 */ + 201, /* concurrent-functions facility */ -1 /* END */ } }, From patchwork Thu Nov 7 15:23:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hendrik Brueckner X-Patchwork-Id: 13866637 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C05BD2101A4; Thu, 7 Nov 2024 15:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730993022; cv=none; b=ZmtnqaiH9NJtPLNrBRYhKWVEz/mQOz1T3ZBjybT41OsmST0QG7I4OgayX2GsoFF+05F5GSww/uQpvs8yBAwNrSC2V2G7/rung32x5fSXo4wsb5cu3bNNxGAU6YEzCgq5CAYbzV+yaCrlzmliBuOrq2IxECW/Z/Z5kWjeXndYG7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730993022; c=relaxed/simple; bh=XRWV1WfINcc2nhLFjtdfAtRY9pdCvoEvSxGcZpOL7cM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iYyVXjl9DhG0GXTHdLLQO1BrFyx0EUh9cttdj9etJufAfJTeKgDKDTl5JYKTe4mkCS0lEAxl3MU3HgLwSW5sqgIZ0XrYqM2Sj1MJxU1FnhmwOoax1fZtbX8Euejg5PUTrzUnSGT9koQum84gsUePzTfWEvXRUa+ArP+CmbYIra8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=BYlN/YlM; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="BYlN/YlM" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7FA1bg017938; Thu, 7 Nov 2024 15:23:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=q609OraqBOvlDyxd/ 0H+yFREJ4wh3UnuVVyvsl486DA=; b=BYlN/YlM3+0WPyhK0tsU1am47qLyJ5X1G 3vCpxtJKw2jKKQU/filLEHZp3KI4DcL7U3y5cwf0GQo8ZGYtnnTzB1HfpJxFxcS4 QbRXYvDW45XXy1Tppu30tzCLL5C1W6MuToL13qKCWnIe4E5DTSVoKrFPL6W+akJ7 yxQkQUfd0Fed6F6W3vz0+KfYLFTNy1tbx0eiqjh3WipCTvVAc96h6FjW9t+RvmeW OTbaRz103J2O3s1x0NlfB0tdYx/nCMFj+D515RE8kArCeipofwAur8Tw66N0tVRJ 9/a7ZrV6Yc4EiJLGT24Uhu1jAL+VIzs/0S6+B7HvNcTWVEyVYy0FA== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42ryxx02dm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 15:23:37 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7Dm5rm012288; Thu, 7 Nov 2024 15:23:36 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 42p1410bnk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 15:23:36 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4A7FNXmJ45089254 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Nov 2024 15:23:33 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CA1220040; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3ED4B20049; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) Received: from vela.boeblingen.de.ibm.com (unknown [9.155.210.79]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) From: Hendrik Brueckner To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com, borntraeger@linux.ibm.com, frankja@linux.ibm.com Subject: [PATCH 2/4] KVM: s390: add msa11 to cpu model Date: Thu, 7 Nov 2024 16:23:17 +0100 Message-ID: <20241107152319.77816-3-brueckner@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107152319.77816-1-brueckner@linux.ibm.com> References: <20241107152319.77816-1-brueckner@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ixe8DRdiB9XbtysGGv61-bxYJhBOAQRk X-Proofpoint-GUID: ixe8DRdiB9XbtysGGv61-bxYJhBOAQRk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 suspectscore=0 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 mlxlogscore=848 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411070117 Message-security-assist 11 introduces pckmo subfunctions to encrypt hmac keys. Signed-off-by: Hendrik Brueckner Reviewed-by: Janosch Frank Reviewed-by: Christian Borntraeger --- arch/s390/include/asm/kvm_host.h | 1 + arch/s390/kvm/kvm-s390.c | 13 +++++++++++-- arch/s390/kvm/vsie.c | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h index 51201b4ac93a..1cd8eaebd3c0 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h @@ -356,6 +356,7 @@ struct kvm_s390_sie_block { #define ECD_MEF 0x08000000 #define ECD_ETOKENF 0x02000000 #define ECD_ECC 0x00200000 +#define ECD_HMAC 0x00004000 __u32 ecd; /* 0x01c8 */ __u8 reserved1cc[18]; /* 0x01cc */ __u64 pp; /* 0x01de */ diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index f9cc1c92a79d..6efa812ca592 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -3791,6 +3791,13 @@ static bool kvm_has_pckmo_ecc(struct kvm *kvm) } +static bool kvm_has_pckmo_hmac(struct kvm *kvm) +{ + /* At least one HMAC subfunction must be present */ + return kvm_has_pckmo_subfunc(kvm, 118) || + kvm_has_pckmo_subfunc(kvm, 122); +} + static void kvm_s390_vcpu_crypto_setup(struct kvm_vcpu *vcpu) { /* @@ -3803,7 +3810,7 @@ static void kvm_s390_vcpu_crypto_setup(struct kvm_vcpu *vcpu) vcpu->arch.sie_block->crycbd = vcpu->kvm->arch.crypto.crycbd; vcpu->arch.sie_block->ecb3 &= ~(ECB3_AES | ECB3_DEA); vcpu->arch.sie_block->eca &= ~ECA_APIE; - vcpu->arch.sie_block->ecd &= ~ECD_ECC; + vcpu->arch.sie_block->ecd &= ~(ECD_ECC | ECD_HMAC); if (vcpu->kvm->arch.crypto.apie) vcpu->arch.sie_block->eca |= ECA_APIE; @@ -3811,9 +3818,11 @@ static void kvm_s390_vcpu_crypto_setup(struct kvm_vcpu *vcpu) /* Set up protected key support */ if (vcpu->kvm->arch.crypto.aes_kw) { vcpu->arch.sie_block->ecb3 |= ECB3_AES; - /* ecc is also wrapped with AES key */ + /* ecc/hmac is also wrapped with AES key */ if (kvm_has_pckmo_ecc(vcpu->kvm)) vcpu->arch.sie_block->ecd |= ECD_ECC; + if (kvm_has_pckmo_hmac(vcpu->kvm)) + vcpu->arch.sie_block->ecd |= ECD_HMAC; } if (vcpu->kvm->arch.crypto.dea_kw) diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c index d3cdde1b18e5..b30f58f0bf95 100644 --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c @@ -335,7 +335,8 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) /* we may only allow it if enabled for guest 2 */ ecb3_flags = scb_o->ecb3 & vcpu->arch.sie_block->ecb3 & (ECB3_AES | ECB3_DEA); - ecd_flags = scb_o->ecd & vcpu->arch.sie_block->ecd & ECD_ECC; + ecd_flags = scb_o->ecd & vcpu->arch.sie_block->ecd & + (ECD_ECC | ECD_HMAC); if (!ecb3_flags && !ecd_flags) goto end; From patchwork Thu Nov 7 15:23:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hendrik Brueckner X-Patchwork-Id: 13866636 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AAFC212D31; Thu, 7 Nov 2024 15:23:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730993021; cv=none; b=NyDE2IutniicB5Xk5nHb7t1T6LkROv9ATkEpbCA7/NVSeRLM9SqKfiIrGq4CSlVfK8jH4flR/u0BU8WmsdaTzAJNmpFFgcrEOWGqDVNkthPIrVSc+H6ND//7PRUAz+Hr4rmey2hfWSdhF3QLkYHUWc8uNpwu9pBiWDxmW6EaspY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730993021; c=relaxed/simple; bh=y4X9nMngUkz0tiS2keBTzLxiUP5KGzcYzzpdZyl9xf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QT7MyM4uB1OvE/d7bPhvNpnpTkhRmwUIeXiy6+g1xLdR6kB8jvMERGJ262TT98pvpa168L/CcUWMDTJnyfK1aDEuERBTjdKIfB03C9CALUTuG5QbvY0PIJP5oWOqxhjjDLA2jyGzExOCI5y9axCpc0OjZS+xeCpDyj3CKlQfM4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=DvJzWNsp; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="DvJzWNsp" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7FALGn015298; Thu, 7 Nov 2024 15:23:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=nx9zxen3i95cfQyC5 dV6JNorzBWqLiQQ71P9JtAMBaA=; b=DvJzWNspS/LKrgXPtEC7xlW94t8a0X6WW nc518qJBr/oSJGNTE5I1DNyLdCdv74mJwb6Yb2MY9MNPgLC9IRhtMNe/bOsTccnW 8CpI0xPuQRmQw85mxEbQ/xodhNGTSeSLUUhb13gQXeV6NO6PqNaM4Vlhqul9G7Ib 4AS+wZtM47aIJ9Q45KZSOxmW3ASkDJZLAihCD0UJwUJ7B/XRYTxiaa0qDS3/nR5D K/sXD+K59K3EFXUqjSv63dSrSW3WzIiyrxSvouhsUpfrxU+2Pw8YlZeRjhnVq5VF yKPizRsXVDmZJt01yc84UKTSRk5zHT0rGaskg0Z5wKxVExN+5VY/A== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42ryy002dm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 15:23:37 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7CgCE6024200; Thu, 7 Nov 2024 15:23:37 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 42nxds8fp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 15:23:36 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4A7FNXsQ45089256 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Nov 2024 15:23:33 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A21C120040; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74C6B2004D; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) Received: from vela.boeblingen.de.ibm.com (unknown [9.155.210.79]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) From: Hendrik Brueckner To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com, borntraeger@linux.ibm.com, frankja@linux.ibm.com Subject: [PATCH 3/4] KVM: s390: add gen17 facilities to CPU model Date: Thu, 7 Nov 2024 16:23:18 +0100 Message-ID: <20241107152319.77816-4-brueckner@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107152319.77816-1-brueckner@linux.ibm.com> References: <20241107152319.77816-1-brueckner@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: euomUaWUxEsJp6oxIS_pWszC4qTCzxVr X-Proofpoint-ORIG-GUID: euomUaWUxEsJp6oxIS_pWszC4qTCzxVr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 phishscore=0 clxscore=1011 impostorscore=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=808 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411070117 Add gen17 facilities and let KVM_CAP_S390_VECTOR_REGISTERS handle the enablement of the vector extension facilities. Signed-off-by: Hendrik Brueckner Reviewed-by: Christian Borntraeger --- arch/s390/kvm/kvm-s390.c | 8 ++++++++ arch/s390/tools/gen_facilities.c | 1 + 2 files changed, 9 insertions(+) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 6efa812ca592..14d72749b000 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -812,6 +812,14 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) set_kvm_facility(kvm->arch.model.fac_mask, 192); set_kvm_facility(kvm->arch.model.fac_list, 192); } + if (test_facility(198)) { + set_kvm_facility(kvm->arch.model.fac_mask, 198); + set_kvm_facility(kvm->arch.model.fac_list, 198); + } + if (test_facility(199)) { + set_kvm_facility(kvm->arch.model.fac_mask, 199); + set_kvm_facility(kvm->arch.model.fac_list, 199); + } r = 0; } else r = -EINVAL; diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c index e97b4faaf222..d5c68ade71ab 100644 --- a/arch/s390/tools/gen_facilities.c +++ b/arch/s390/tools/gen_facilities.c @@ -112,6 +112,7 @@ static struct facility_def facility_defs[] = { 15, /* AP Facilities Test */ 156, /* etoken facility */ 165, /* nnpa facility */ + 170, /* ineffective-nonconstrained-transaction facility */ 193, /* bear enhancement facility */ 194, /* rdp enhancement facility */ 196, /* processor activity instrumentation facility */ From patchwork Thu Nov 7 15:23:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hendrik Brueckner X-Patchwork-Id: 13866639 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15729212F08; Thu, 7 Nov 2024 15:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730993022; cv=none; b=nKwTbcVyHSfIiDUqgA9Qe2oC5vebn41gED7/2Uf1csZG9mAxZ79qaDDkYJJ5xpBUk0ESr1IZpEuuIytueafWYnb3IMSmi1sAjPllASjI4Op/+JG2zG2RALQkEwm9mZZKbuz2p1EiMsBjh/QKCkxSiBua+3chiIZtCc6RHG5jTe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730993022; c=relaxed/simple; bh=q7r113h8V27m9wIjZYJBUSQrGnWgrXFlDKCfyRLutmY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JzqKxRATCw9AC85RBhsWoYZLy+A58w9dRRhK2IBo2dpKGGfSuSiQq9lItojiKqq49GsunhKoKviSfHEq3NcJM0c3RUaoSzoiLCU1rsG7aJT8u6cN0N398tF9qTzCfDRbmh8HJlROf8MwTfPezOWB13BgOGrCw+3p6WloRNLFqXY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=XcndR4Wh; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="XcndR4Wh" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A7EeB54027536; Thu, 7 Nov 2024 15:23:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=xJomWUTv1MPMrre1/ tUDz0SI3tdQkeweYB39erzEUSg=; b=XcndR4Whh0z4ikgTRlOH/DefBrVtEfKHg Hq3OiV7/Ex2aRO232otCXzOntGUBCn8um/SYxGFk5nlf3QMYmVj49EKJuv5vYY1n 91Zy4GZmk3QiytjoCY/Z902e89fhdCHbzbXZ7eljrthyKAi0tFH4MjL9vOWrQePS yGUMI4/YDWygOAOd0PvE6IVzojdnx+rqtTVHJozQK+A5tVkzQTwEmbt6iT+0JLkn 00KOXboXrlvTjBhHzB/HlO6pVDXg9fVbEaZI4eQ09PinX6YVqmEM0mDkAjHX+UpW 74PGOOHs+PcGKh9qLKmyG2cBBWVvrcVDLASOdV8o9rMq/FtsG7ilQ== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42rygs883j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 15:23:38 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4A76q8IM024314; Thu, 7 Nov 2024 15:23:37 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 42p0mj8b48-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 15:23:37 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4A7FNX8E45089258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Nov 2024 15:23:34 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D80C020040; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA7A120049; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) Received: from vela.boeblingen.de.ibm.com (unknown [9.155.210.79]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 7 Nov 2024 15:23:33 +0000 (GMT) From: Hendrik Brueckner To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com, david@redhat.com, borntraeger@linux.ibm.com, frankja@linux.ibm.com Subject: [PATCH 4/4] KVM: s390: selftests: Add regression tests for PFCR subfunctions Date: Thu, 7 Nov 2024 16:23:19 +0100 Message-ID: <20241107152319.77816-5-brueckner@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107152319.77816-1-brueckner@linux.ibm.com> References: <20241107152319.77816-1-brueckner@linux.ibm.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 7iskTDdG9lmVnW-WWL2xJynXihGDjpnP X-Proofpoint-GUID: 7iskTDdG9lmVnW-WWL2xJynXihGDjpnP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=892 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411070114 Signed-off-by: Hendrik Brueckner Reviewed-by: Hariharan Mari --- tools/arch/s390/include/uapi/asm/kvm.h | 3 ++- .../selftests/kvm/s390x/cpumodel_subfuncs_test.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/arch/s390/include/uapi/asm/kvm.h b/tools/arch/s390/include/uapi/asm/kvm.h index 05eaf6db3ad4..60345dd2cba2 100644 --- a/tools/arch/s390/include/uapi/asm/kvm.h +++ b/tools/arch/s390/include/uapi/asm/kvm.h @@ -469,7 +469,8 @@ struct kvm_s390_vm_cpu_subfunc { __u8 kdsa[16]; /* with MSA9 */ __u8 sortl[32]; /* with STFLE.150 */ __u8 dfltcc[32]; /* with STFLE.151 */ - __u8 reserved[1728]; + __u8 pfcr[16]; /* with STFLE.201 */ + __u8 reserved[1712]; }; #define KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST 6 diff --git a/tools/testing/selftests/kvm/s390x/cpumodel_subfuncs_test.c b/tools/testing/selftests/kvm/s390x/cpumodel_subfuncs_test.c index 222ba1cc3cac..27255880dabd 100644 --- a/tools/testing/selftests/kvm/s390x/cpumodel_subfuncs_test.c +++ b/tools/testing/selftests/kvm/s390x/cpumodel_subfuncs_test.c @@ -214,6 +214,19 @@ static void test_dfltcc_asm_block(u8 (*query)[32]) : "cc", "0", "1"); } +/* + * Testing Perform Function with Concurrent Results (PFCR) + * CPU subfunctions's ASM block + */ +static void test_pfcr_asm_block(u8 (*query)[16]) +{ + asm volatile(" lghi 0,0\n" + " .insn rsy,0xeb0000000016,0,0,%[query]\n" + : [query] "=QS" (*query) + : + : "cc", "0"); +} + typedef void (*testfunc_t)(u8 (*array)[]); struct testdef { @@ -249,6 +262,8 @@ struct testdef { { "SORTL", cpu_subfunc.sortl, sizeof(cpu_subfunc.sortl), test_sortl_asm_block, 150 }, /* DFLTCC - Facility bit 151 */ { "DFLTCC", cpu_subfunc.dfltcc, sizeof(cpu_subfunc.dfltcc), test_dfltcc_asm_block, 151 }, + /* Concurrent-function facility - Facility bit 201 */ + { "PFCR", cpu_subfunc.pfcr, sizeof(cpu_subfunc.pfcr), test_pfcr_asm_block, 201 }, }; int main(int argc, char *argv[])