Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3716657pxb; Fri, 4 Feb 2022 14:58:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJz10e2hN7bajNhpNSCxbRQwrfaBESxpd3/16cljaCc9eUA0ad5OXZcSRwAy9nc83ifqyEbf X-Received: by 2002:a62:1715:: with SMTP id 21mr5226340pfx.59.1644015493823; Fri, 04 Feb 2022 14:58:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644015493; cv=none; d=google.com; s=arc-20160816; b=qcITQXPymOd/qUYxkEpyY7RlRbETb3M6Wb+hbpOdPqfALGmwbrpG7D6fYP0dGGf60R FUaXf1M0FmX63jsoaOSnVOCMbLDgR6sLq3kAchl786jbk4AwHqxMIQUKBEgoozePiFmE u01scrPUBhAkDtDlpfIYZ5qj2XLPgDGnNr3cBYUuMXjMXOJbdAzvhcWbVUoWya0gYYZN /gyWA+a0VEdAyjJPbDYCmeG7fTeXciu67QSI3eWy/trq6FU2gzF86lRsZ6ETZX+zPrRx uoARG6o4+Rh+fMJlFqFhuYNhv8TvEUxtilVpc2ah58ABgm1xzViaHPlwH7r4vZ5BcVSQ B1Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Wrc3RicklgqfMG1yc2XIxriG1FIRrPXpcWphaFKLTbE=; b=DUWn+e00LiJjij+bFXjZO6H5sWJgEYcrYJoP7N6tBL78KeVgnikcS14YlVzi+c2d9V tlu0Or5kfR8Jbt8Im/e1eX7j6YB6Sv7c4c9lHMlE+mlaZ4uxdSUA/S7I0jZF505vWfWl zT1NxYcUQG0pW0T4iukjAJMS91h7RpjjMILI9jrnLewQq+9c2sW+MtZcIEVfad6n0rrZ Mwz4CDzdvtFX39iFRbloluf904Kn5RrKdq5/Bu5Swc9ivQz3DFcraPDx30SEgjpH+zoU tydr5bTITPaEoNQLSuUtv9naPxKxBSr61gnj/dUIQBVm3nNpeR+bfSwHpmh3GlpCpKq7 ZEkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nSLI+xsd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a191si3071603pge.666.2022.02.04.14.57.59; Fri, 04 Feb 2022 14:58:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nSLI+xsd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376497AbiBDPyp (ORCPT + 99 others); Fri, 4 Feb 2022 10:54:45 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45432 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1376319AbiBDPyB (ORCPT ); Fri, 4 Feb 2022 10:54:01 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 214Ecnt5016053; Fri, 4 Feb 2022 15:54:01 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=Wrc3RicklgqfMG1yc2XIxriG1FIRrPXpcWphaFKLTbE=; b=nSLI+xsd1DuEoJ886k8JdxiDxFRCR+pr8NkValLvfAdGq9Bihn01RCcGusADMItf5QwI /vAQBSqsRM6GDP7bO69ROvRwt67IEFyTQ6YYWvLdyZxKvwZhFQ/SMwC+FxxX+LrAehaH Ck1FuTOeb+q/apeMdL+o+hzWynN3MyUNKsRnfvZxBipeGeCOv0EWXRFTNIdUAMqS6iOX LFzttbMmqFzEDYU2NAHevKYxRC23zsxaTo2kZfA6z4cfxP/zGkc9vAxQwscTKNDehUtH jB0+q0NVN0iS6ZoG/6m9tGgR/ioBXeC3nelN5OrjeYYzoLD5hNP0C1sHFZX4oAR21oXx DQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e0rt5fgq4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 15:54:00 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 214FKX3i008040; Fri, 4 Feb 2022 15:54:00 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 3e0rt5fgpp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 15:54:00 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 214FlSP5022582; Fri, 4 Feb 2022 15:53:58 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 3e0r0u6ajp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 15:53:58 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 214FrtlU36307296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Feb 2022 15:53:55 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8525CAE056; Fri, 4 Feb 2022 15:53:55 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C5AAAE045; Fri, 4 Feb 2022 15:53:55 +0000 (GMT) Received: from p-imbrenda.bredband2.com (unknown [9.145.8.50]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 Feb 2022 15:53:54 +0000 (GMT) From: Claudio Imbrenda To: kvm@vger.kernel.org Cc: borntraeger@de.ibm.com, frankja@linux.ibm.com, thuth@redhat.com, pasic@linux.ibm.com, david@redhat.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, scgl@linux.ibm.com Subject: [PATCH v7 08/17] KVM: s390: pv: make kvm_s390_cpus_from_pv global Date: Fri, 4 Feb 2022 16:53:40 +0100 Message-Id: <20220204155349.63238-9-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204155349.63238-1-imbrenda@linux.ibm.com> References: <20220204155349.63238-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: MKIy815wK960sfDmgc744VEzLBoZFMoG X-Proofpoint-ORIG-GUID: a48gbsZWTawSoaEgO9bSxgNkfP0oTa7M X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-04_06,2022-02-03_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 spamscore=0 bulkscore=0 mlxlogscore=892 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202040086 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The functions kvm_s390_cpus_from_pv needs to be called from pv.c, so make it global. Take the opportunity to add documentation. Signed-off-by: Claudio Imbrenda --- arch/s390/kvm/kvm-s390.c | 26 +++++++++++++++++++++++++- arch/s390/kvm/kvm-s390.h | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 1a788f45d691..0fc8d1aec396 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -2175,7 +2175,20 @@ static int kvm_s390_set_cmma_bits(struct kvm *kvm, return r; } -static int kvm_s390_cpus_from_pv(struct kvm *kvm, u16 *rcp, u16 *rrcp) +/** + * kvm_s390_cpus_from_pv - Convert all protected vCPUs in a protected VM to + * non protected. + * @kvm the VM whose protected vCPUs are to be converted + * @rcp return value for the RC field of the UVC (in case of error) + * @rrcp return value for the RRC field of the UVC (in case of error) + * + * Does not stop in case of error, tries to convert as many + * CPUs as possible. In case of error, the RC and RRC of the last error are + * returned. + * + * Return: 0 in case of success, otherwise -EIO + */ +int kvm_s390_cpus_from_pv(struct kvm *kvm, u16 *rcp, u16 *rrcp) { struct kvm_vcpu *vcpu; u16 rc, rrc; @@ -2202,6 +2215,17 @@ static int kvm_s390_cpus_from_pv(struct kvm *kvm, u16 *rcp, u16 *rrcp) return ret; } +/** + * kvm_s390_cpus_to_pv - Convert all non-protected vCPUs in a protected VM + * to protected. + * @kvm the VM whose protected vCPUs are to be converted + * @rcp return value for the RC field of the UVC (in case of error) + * @rrcp return value for the RRC field of the UVC (in case of error) + * + * Tries to undo the conversion in case of error. + * + * Return: 0 in case of success, otherwise -EIO + */ static int kvm_s390_cpus_to_pv(struct kvm *kvm, u16 *rc, u16 *rrc) { unsigned long i; diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h index 098831e815e6..9276d910631b 100644 --- a/arch/s390/kvm/kvm-s390.h +++ b/arch/s390/kvm/kvm-s390.h @@ -365,6 +365,7 @@ int kvm_s390_vcpu_setup_cmma(struct kvm_vcpu *vcpu); void kvm_s390_vcpu_unsetup_cmma(struct kvm_vcpu *vcpu); void kvm_s390_set_cpu_timer(struct kvm_vcpu *vcpu, __u64 cputm); __u64 kvm_s390_get_cpu_timer(struct kvm_vcpu *vcpu); +int kvm_s390_cpus_from_pv(struct kvm *kvm, u16 *rcp, u16 *rrcp); /* implemented in diag.c */ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu); -- 2.34.1