From nobody Tue Feb 10 18:36:24 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66DE2C04FE0 for ; Thu, 27 Jul 2023 12:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233873AbjG0MVF (ORCPT ); Thu, 27 Jul 2023 08:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233848AbjG0MVC (ORCPT ); Thu, 27 Jul 2023 08:21:02 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C327B2D49; Thu, 27 Jul 2023 05:20:59 -0700 (PDT) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36RCF3ro004216; Thu, 27 Jul 2023 12:20:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ma0mH2UWlwQKD7Zhgtplg7ZH4W5F9TapcisIc1Y6dWg=; b=J58LsqaKbmp6N7KiYlfPAUbxLzQHZLNg7hVXydVukWFALxRN7spe8MvEbkcndwXfIXFB h4fGqZ3GF/RnNXCYmD4/Vf8VvSitowD2VCpsxcqo6qE4yM3DCbng3EGSHSfxfPhMDFiX lecGMcc9geXEE2vEnYu0Wxr5it79vamAUQxvLRdGEe0y8+IffU3FRxblVaIG2JTXLqa+ URPFGXvGvVYrytG8bXC8EcbjHRJUnnN4qCzLXimltmeFmSeYdusU9XM5DN40YaABqdmx z2Q32G4th1j2+VlsPAmp+D2hP+9DFfLLXXcX5rc0mF7qGzI2xpMgoOjeKSTu+Cg5ZQ+o WQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s3rdpg5ub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 12:20:58 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36RCGsIb010425; Thu, 27 Jul 2023 12:20:58 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s3rdpg5u4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 12:20:58 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36RBVSTZ002381; Thu, 27 Jul 2023 12:20:57 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3s0txkd8ny-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 12:20:57 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36RCKsYb25297524 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jul 2023 12:20:54 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6BDE020040; Thu, 27 Jul 2023 12:20:54 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 334882004B; Thu, 27 Jul 2023 12:20:54 +0000 (GMT) Received: from a46lp73.lnxne.boe (unknown [9.152.108.100]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 27 Jul 2023 12:20:54 +0000 (GMT) From: Steffen Eiden To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org Cc: Janosch Frank , Claudio Imbrenda , David Hildenbrand , Michael Mueller , Marc Hartmayer Subject: [PATCH 1/3] s390: uv: UV feature check utility Date: Thu, 27 Jul 2023 14:20:51 +0200 Message-Id: <20230727122053.774473-2-seiden@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230727122053.774473-1-seiden@linux.ibm.com> References: <20230727122053.774473-1-seiden@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 6BrG-v4BX6EHdlWXVAZDNETIE5dXmHOU X-Proofpoint-ORIG-GUID: 6yx1wVt8kv_0cfcJ8SqD7CDyXcrmJRNk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_06,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 adultscore=0 phishscore=0 clxscore=1011 priorityscore=1501 spamscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307270108 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Introduces a function to check the existence of an UV feature. Refactor feature bit checks to use the new function. Signed-off-by: Steffen Eiden Reviewed-by: Claudio Imbrenda --- arch/s390/include/asm/uv.h | 5 +++++ arch/s390/kernel/uv.c | 2 +- arch/s390/kvm/kvm-s390.c | 2 +- arch/s390/mm/fault.c | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/s390/include/asm/uv.h b/arch/s390/include/asm/uv.h index d6bb2f4f78d1..338845402324 100644 --- a/arch/s390/include/asm/uv.h +++ b/arch/s390/include/asm/uv.h @@ -397,6 +397,11 @@ struct uv_info { =20 extern struct uv_info uv_info; =20 +static inline bool uv_has_feature(u8 feature_bit) +{ + return test_bit_inv(feature_bit, &uv_info.uv_feature_indications); +} + #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST extern int prot_virt_guest; =20 diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c index d8b25cda5471..c82a667d2113 100644 --- a/arch/s390/kernel/uv.c +++ b/arch/s390/kernel/uv.c @@ -249,7 +249,7 @@ static bool should_export_before_import(struct uv_cb_he= ader *uvcb, struct mm_str * shared page from a different protected VM will automatically also * transfer its ownership. */ - if (test_bit_inv(BIT_UV_FEAT_MISC, &uv_info.uv_feature_indications)) + if (uv_has_feature(BIT_UV_FEAT_MISC)) return false; if (uvcb->cmd =3D=3D UVC_CMD_UNPIN_PAGE_SHARED) return false; diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 17b81659cdb2..339e3190f6dc 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -2402,7 +2402,7 @@ static int kvm_s390_cpus_to_pv(struct kvm *kvm, u16 *= rc, u16 *rrc) struct kvm_vcpu *vcpu; =20 /* Disable the GISA if the ultravisor does not support AIV. */ - if (!test_bit_inv(BIT_UV_FEAT_AIV, &uv_info.uv_feature_indications)) + if (!uv_has_feature(BIT_UV_FEAT_AIV)) kvm_s390_gisa_disable(kvm); =20 kvm_for_each_vcpu(i, vcpu, kvm) { diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index b65144c392b0..b8ef42fac2c4 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -824,7 +824,7 @@ void do_secure_storage_access(struct pt_regs *regs) * reliable without the misc UV feature so we need to check * for that as well. */ - if (test_bit_inv(BIT_UV_FEAT_MISC, &uv_info.uv_feature_indications) && + if (uv_has_feature(BIT_UV_FEAT_MISC) && !test_bit_inv(61, ®s->int_parm_long)) { /* * When this happens, userspace did something that it --=20 2.40.1 From nobody Tue Feb 10 18:36:24 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83A17C0015E for ; Thu, 27 Jul 2023 12:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233945AbjG0MVN (ORCPT ); Thu, 27 Jul 2023 08:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232856AbjG0MVC (ORCPT ); Thu, 27 Jul 2023 08:21:02 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A2842D51; Thu, 27 Jul 2023 05:21:00 -0700 (PDT) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36RC9a89031355; Thu, 27 Jul 2023 12:21:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Kb45gmG62YcJdhYbQumntF3jwUQ/CdCBL8RR1Aj1AQg=; b=BpwOfpZ6tEUYcm9w3MjNpGJIyC7I5fpAR3LrwA8YWj+o2LxqGK5cPUq16sfAyd9O4M6P XmW03mUB2TpXTsI4ymBffwOGwKLITqyeagVolEo6TwDeGFfzJNCoIQjU0HPBMzZ/d+iS F3WqP4avYPDZV1/Y3dxljRiqc24u8XMj0nfeMSaMtTRM7m+FtYF4AccWpgZOAUNN1p/4 Yhcn11BncrmHj0KWHOhpuiKk8Miescto1CCc8FZh43UVn0JTha9WkIqzMidbeKocR3tq +MH+Fuu6q8936DRzazslFjCobNwYExb3K3GVVZA404MxferkboEeq9mi/J4aO41cVq85 ow== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s3qmn1jpn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 12:20:59 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36RCGKG8005156; Thu, 27 Jul 2023 12:20:59 GMT 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 3s3qmn1jpd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 12:20:59 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36RAaZbG001973; Thu, 27 Jul 2023 12:20:58 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3s0tenddgb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 12:20:57 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36RCKsll25297528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jul 2023 12:20:54 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AB18F20040; Thu, 27 Jul 2023 12:20:54 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73FF520043; Thu, 27 Jul 2023 12:20:54 +0000 (GMT) Received: from a46lp73.lnxne.boe (unknown [9.152.108.100]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 27 Jul 2023 12:20:54 +0000 (GMT) From: Steffen Eiden To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org Cc: Janosch Frank , Claudio Imbrenda , David Hildenbrand , Michael Mueller , Marc Hartmayer Subject: [PATCH 2/3] KVM: s390: Add UV feature negotiation Date: Thu, 27 Jul 2023 14:20:52 +0200 Message-Id: <20230727122053.774473-3-seiden@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230727122053.774473-1-seiden@linux.ibm.com> References: <20230727122053.774473-1-seiden@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Pq7M_QJsaM7rWr4fepkm5SCoco_09SBv X-Proofpoint-ORIG-GUID: R1EnF9oHqEq8mRhdp0ks3TeTX-EBNCe_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_06,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 phishscore=0 clxscore=1015 impostorscore=0 bulkscore=0 mlxscore=0 malwarescore=0 spamscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307270108 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a uv_feature list for pv-guests to the kvm cpu-model. The feature bits 'AP-interpretation for secure guests' and 'AP-interrupt for secure guests' are available. Signed-off-by: Steffen Eiden --- arch/s390/include/asm/kvm_host.h | 2 + arch/s390/include/uapi/asm/kvm.h | 24 +++++++++++ arch/s390/kvm/kvm-s390.c | 70 ++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_h= ost.h index 2bbc3d54959d..7ae57ac352b2 100644 --- a/arch/s390/include/asm/kvm_host.h +++ b/arch/s390/include/asm/kvm_host.h @@ -817,6 +817,8 @@ struct kvm_s390_cpu_model { __u64 *fac_list; u64 cpuid; unsigned short ibc; + /* subset of available uv features for pv-guests enabled by user space */ + struct kvm_s390_vm_cpu_uv_feat uv_feat_guest; }; =20 typedef int (*crypto_hook)(struct kvm_vcpu *vcpu); diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/= kvm.h index a73cf01a1606..7ea7e4fbd37e 100644 --- a/arch/s390/include/uapi/asm/kvm.h +++ b/arch/s390/include/uapi/asm/kvm.h @@ -159,6 +159,30 @@ struct kvm_s390_vm_cpu_subfunc { __u8 reserved[1728]; }; =20 +#define KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST 6 +#define KVM_S390_VM_CPU_MACHINE_UV_FEAT_GUEST 7 + +#define KVM_S390_VM_CPU_UV_FEAT_NR_BITS 64 +struct kvm_s390_vm_cpu_uv_feat { + union { + struct { + __u64 res0 : 4; + __u64 ap : 1; /* bit 4 */ + __u64 ap_intr : 1; /* bit 5 */ + }; + __u64 feat; + }; +}; + +#define KVM_S390_VM_CPU_UV_FEAT_GUEST_MASK \ +(((struct kvm_s390_vm_cpu_uv_feat) { \ + .ap =3D 1, \ + .ap_intr =3D 1, \ +}).feat) + +#define KVM_S390_VM_CPU_UV_FEAT_GUEST_DEFAULT \ +((struct kvm_s390_vm_cpu_uv_feat) { }) + /* kvm attributes for crypto */ #define KVM_S390_VM_CRYPTO_ENABLE_AES_KW 0 #define KVM_S390_VM_CRYPTO_ENABLE_DEA_KW 1 diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 339e3190f6dc..50c8b85b89ac 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -1531,6 +1531,32 @@ static int kvm_s390_set_processor_subfunc(struct kvm= *kvm, return 0; } =20 +static int kvm_s390_set_uv_feat(struct kvm *kvm, struct kvm_device_attr *a= ttr) +{ + struct kvm_s390_vm_cpu_uv_feat data =3D {}; + unsigned long filter =3D + uv_info.uv_feature_indications & + (unsigned long)KVM_S390_VM_CPU_UV_FEAT_GUEST_MASK; + + if (copy_from_user(&data, (void __user *)attr->addr, sizeof(data))) + return -EFAULT; + if (!bitmap_subset((unsigned long *)&data, &filter, + KVM_S390_VM_CPU_UV_FEAT_NR_BITS)) + return -EINVAL; + + mutex_lock(&kvm->lock); + if (kvm->created_vcpus) { + mutex_unlock(&kvm->lock); + return -EBUSY; + } + kvm->arch.model.uv_feat_guest =3D data; + mutex_unlock(&kvm->lock); + + VM_EVENT(kvm, 3, "SET: guest uv feat: 0x%16.16llx", data.feat); + + return 0; +} + static int kvm_s390_set_cpu_model(struct kvm *kvm, struct kvm_device_attr = *attr) { int ret =3D -ENXIO; @@ -1545,6 +1571,9 @@ static int kvm_s390_set_cpu_model(struct kvm *kvm, st= ruct kvm_device_attr *attr) case KVM_S390_VM_CPU_PROCESSOR_SUBFUNC: ret =3D kvm_s390_set_processor_subfunc(kvm, attr); break; + case KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST: + ret =3D kvm_s390_set_uv_feat(kvm, attr); + break; } return ret; } @@ -1777,6 +1806,37 @@ static int kvm_s390_get_machine_subfunc(struct kvm *= kvm, return 0; } =20 +static int kvm_s390_get_processor_uv_feat(struct kvm *kvm, + struct kvm_device_attr *attr) +{ + struct kvm_s390_vm_cpu_uv_feat *src =3D &kvm->arch.model.uv_feat_guest; + + if (copy_to_user((void __user *)attr->addr, src, sizeof(*src))) + return -EFAULT; + VM_EVENT(kvm, 3, "GET: guest uv feat: 0x%16.16llx", + kvm->arch.model.uv_feat_guest.feat); + + return 0; +} + +static int kvm_s390_get_machine_uv_feat(struct kvm *kvm, + struct kvm_device_attr *attr) +{ + struct kvm_s390_vm_cpu_uv_feat data =3D { + .feat =3D uv_info.uv_feature_indications & + KVM_S390_VM_CPU_UV_FEAT_GUEST_MASK + }; + + BUILD_BUG_ON(sizeof(struct kvm_s390_vm_cpu_uv_feat) !=3D + sizeof(uv_info.uv_feature_indications)); + if (copy_to_user((void __user *)attr->addr, &data, + sizeof(struct kvm_s390_vm_cpu_uv_feat))) + return -EFAULT; + VM_EVENT(kvm, 3, "GET: guest uv feat: 0x%16.16llx", data.feat); + + return 0; +} + static int kvm_s390_get_cpu_model(struct kvm *kvm, struct kvm_device_attr = *attr) { int ret =3D -ENXIO; @@ -1800,6 +1860,12 @@ static int kvm_s390_get_cpu_model(struct kvm *kvm, s= truct kvm_device_attr *attr) case KVM_S390_VM_CPU_MACHINE_SUBFUNC: ret =3D kvm_s390_get_machine_subfunc(kvm, attr); break; + case KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST: + ret =3D kvm_s390_get_processor_uv_feat(kvm, attr); + break; + case KVM_S390_VM_CPU_MACHINE_UV_FEAT_GUEST: + ret =3D kvm_s390_get_machine_uv_feat(kvm, attr); + break; } return ret; } @@ -1952,6 +2018,8 @@ static int kvm_s390_vm_has_attr(struct kvm *kvm, stru= ct kvm_device_attr *attr) case KVM_S390_VM_CPU_MACHINE_FEAT: case KVM_S390_VM_CPU_MACHINE_SUBFUNC: case KVM_S390_VM_CPU_PROCESSOR_SUBFUNC: + case KVM_S390_VM_CPU_MACHINE_UV_FEAT_GUEST: + case KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST: ret =3D 0; break; default: @@ -3292,6 +3360,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long t= ype) kvm->arch.model.cpuid =3D kvm_s390_get_initial_cpuid(); kvm->arch.model.ibc =3D sclp.ibc & 0x0fff; =20 + kvm->arch.model.uv_feat_guest =3D KVM_S390_VM_CPU_UV_FEAT_GUEST_DEFAULT; + kvm_s390_crypto_init(kvm); =20 if (IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM)) { --=20 2.40.1 From nobody Tue Feb 10 18:36:24 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 671B8C0015E for ; Thu, 27 Jul 2023 12:21:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233911AbjG0MVL (ORCPT ); Thu, 27 Jul 2023 08:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233852AbjG0MVD (ORCPT ); Thu, 27 Jul 2023 08:21:03 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD56D2D57; Thu, 27 Jul 2023 05:21:00 -0700 (PDT) Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36RBC5W5015215; Thu, 27 Jul 2023 12:21:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=cHznHBeE+R8xjomVQ6O9ndPfcAnMTKcymdFjhf9yEfI=; b=S1fwyoajDTA+pvMJ30JAOWqEuPNBLCOonRBOumABJvayv8p7+L97NH0oQOAnBU08YJu0 EGNLlQcPMgE59da0RfQlkk6+LXapEknLx0kFnhYfSd9K1DPBsuIMB9DlMJ7zpvzFe1kx +WL93WeJn51rWcc6fpqM66SIaiF96tyNM7paSl8PrqRe3L19GTLnf1icdEL+knPd8wbz bbKDCdRuo0jjTY/bqENtUcAFStq22bjeWyk3xz6EMEggikMcQlrzPsWOuDUOICmr9jGy Ts4myIuiP8Z49jSCdHMJKdzDHnr4e9NL8scWt4zvJSi9pMUxnH54CUnD/MB8q1ZnPg2r Bg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s3qg81u8d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 12:20:59 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36RC5uMq008730; Thu, 27 Jul 2023 12:20:59 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3s3qg81u7s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 12:20:59 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36RBFdRr003624; Thu, 27 Jul 2023 12:20:58 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3s0txkd8p1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jul 2023 12:20:58 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36RCKtMQ61866242 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jul 2023 12:20:55 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EBD2A20040; Thu, 27 Jul 2023 12:20:54 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3B612004B; Thu, 27 Jul 2023 12:20:54 +0000 (GMT) Received: from a46lp73.lnxne.boe (unknown [9.152.108.100]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 27 Jul 2023 12:20:54 +0000 (GMT) From: Steffen Eiden To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org Cc: Janosch Frank , Claudio Imbrenda , David Hildenbrand , Michael Mueller , Marc Hartmayer Subject: [PATCH 3/3] KVM: s390: pv: Allow AP-instructions for pv guests Date: Thu, 27 Jul 2023 14:20:53 +0200 Message-Id: <20230727122053.774473-4-seiden@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230727122053.774473-1-seiden@linux.ibm.com> References: <20230727122053.774473-1-seiden@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: f2Yxwkr6ANsnTVZd19B702BuRpnj4Vfk X-Proofpoint-GUID: --diftdoVCpbiT8hMDgrhoRpTvGSeNsY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_06,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 mlxscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307270108 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Introduces new feature bits and enablement flags for AP and AP IRQ support. Signed-off-by: Steffen Eiden --- arch/s390/include/asm/uv.h | 12 +++++++++++- arch/s390/kvm/pv.c | 8 ++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/arch/s390/include/asm/uv.h b/arch/s390/include/asm/uv.h index 338845402324..913ccfaa9d76 100644 --- a/arch/s390/include/asm/uv.h +++ b/arch/s390/include/asm/uv.h @@ -99,6 +99,8 @@ enum uv_cmds_inst { enum uv_feat_ind { BIT_UV_FEAT_MISC =3D 0, BIT_UV_FEAT_AIV =3D 1, + BIT_UV_FEAT_AP =3D 4, + BIT_UV_FEAT_AP_INTR =3D 5, }; =20 struct uv_cb_header { @@ -159,7 +161,15 @@ struct uv_cb_cgc { u64 guest_handle; u64 conf_base_stor_origin; u64 conf_virt_stor_origin; - u64 reserved30; + u8 reserved30[6]; + union { + struct { + u16 reserved : 14; + u16 ap_instr_intr : 1; + u16 ap_allow_instr : 1; + }; + u16 raw; + } flags; u64 guest_stor_origin; u64 guest_stor_len; u64 guest_sca; diff --git a/arch/s390/kvm/pv.c b/arch/s390/kvm/pv.c index 899f3b8ac011..103add1894c9 100644 --- a/arch/s390/kvm/pv.c +++ b/arch/s390/kvm/pv.c @@ -561,12 +561,16 @@ int kvm_s390_pv_init_vm(struct kvm *kvm, u16 *rc, u16= *rrc) uvcb.conf_base_stor_origin =3D virt_to_phys((void *)kvm->arch.pv.stor_base); uvcb.conf_virt_stor_origin =3D (u64)kvm->arch.pv.stor_var; + uvcb.flags.ap_allow_instr =3D uv_has_feature(BIT_UV_FEAT_AP) && + kvm->arch.model.uv_feat_guest.ap; + uvcb.flags.ap_instr_intr =3D uv_has_feature(BIT_UV_FEAT_AP_INTR) && + kvm->arch.model.uv_feat_guest.ap_intr; =20 cc =3D uv_call_sched(0, (u64)&uvcb); *rc =3D uvcb.header.rc; *rrc =3D uvcb.header.rrc; - KVM_UV_EVENT(kvm, 3, "PROTVIRT CREATE VM: handle %llx len %llx rc %x rrc = %x", - uvcb.guest_handle, uvcb.guest_stor_len, *rc, *rrc); + KVM_UV_EVENT(kvm, 3, "PROTVIRT CREATE VM: handle %llx len %llx rc %x rrc = %x flags %04x", + uvcb.guest_handle, uvcb.guest_stor_len, *rc, *rrc, uvcb.flags.raw); =20 /* Outputs */ kvm->arch.pv.handle =3D uvcb.guest_handle; --=20 2.40.1