Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp572043ybb; Fri, 20 Mar 2020 04:25:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vstzEbm9++UVl7TwY1SIQ19DrbRXKaCRh+CdLxvmolj2NA/+MF+P00vKPBBxel+Fsig/+Pq X-Received: by 2002:aca:d68a:: with SMTP id n132mr6231030oig.40.1584703523408; Fri, 20 Mar 2020 04:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584703523; cv=none; d=google.com; s=arc-20160816; b=wqMhhrrBY67MVItB9GcVXDAWGD2QeqI8Xs+xnvTsJlpHvB7Fx4vyaBUDpwy8I8FdQg WXEsGsSf6btYkgDMU/+Gv6x+smUEYyea60akAWv9IbvrJSymf2yqXGAfkZX2N7snjzBX GjOizZVoRvBN62reUHKrT74aPc+2sM5v6ZK9xWd6e186sUTwALf9gEnTvH22kap2kWwV GorC81iwRwoEqPFSxiGwT3D5rOboFXTJdQiDc9uIcfj0WycWaOeftXiVBkiPJ7VRCe/8 u914HqJE9H5acG5YMTOHgRIBNQqhwYcJoutm8yoaAt0hQ6alp9fyNSCkdSbFXjgU59B4 pAYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=+PghOeyPm/cPH+iRCz8NM9qVSM2WHxMcEfU3XHzYLL0=; b=v1B4/kUMOsI8+TqmGqvDgSSWwmBl3pFa4KPXE3AIcah2bJbkhtOvqUIwy7rP53X4tB Owoa3yS9qc659xptztWYw04XVIx9c/lFB0WGiEbrDEziX1q9Ex5N8TJk6P/yu9VQAOpN 464cWGEFdtgauc8Xje1v2J0hcjuDfdFh3vdR6BLsxr2u0m00fQ16hHSXui5PZ8mgLS4F s7yhw6uizI54s6mtznrO1joC/X7drQeOBr/Fjhr2rjoFrZU+lDxq4xrFW9rUeh7bhwd2 KS5P0JxY1vvP+G/A1Ttp3oIhEzcSrql+VfTuFVaob8HXLCgmLwI24juooTz9ry8We2dN u80g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si2681771otm.71.2020.03.20.04.25.10; Fri, 20 Mar 2020 04:25:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727224AbgCTLYP (ORCPT + 99 others); Fri, 20 Mar 2020 07:24:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:13418 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727209AbgCTLYO (ORCPT ); Fri, 20 Mar 2020 07:24:14 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02KB3p9m070934 for ; Fri, 20 Mar 2020 07:24:13 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yu7dbwa5s-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 20 Mar 2020 07:24:12 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 20 Mar 2020 11:24:11 -0000 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 20 Mar 2020 11:24:08 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02KBN6Vw49217996 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Mar 2020 11:23:06 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5BA3542045; Fri, 20 Mar 2020 11:24:07 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0490042041; Fri, 20 Mar 2020 11:24:06 +0000 (GMT) Received: from in.ibm.com (unknown [9.85.95.122]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 20 Mar 2020 11:24:05 +0000 (GMT) Date: Fri, 20 Mar 2020 16:54:03 +0530 From: Bharata B Rao To: Laurent Dufour Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , Benjamin Herrenschmidt , Michael Ellerman Subject: Re: [PATCH 2/2] KVM: PPC: Book3S HV: H_SVM_INIT_START must call UV_RETURN Reply-To: bharata@linux.ibm.com References: <20200320102643.15516-1-ldufour@linux.ibm.com> <20200320102643.15516-3-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200320102643.15516-3-ldufour@linux.ibm.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-TM-AS-GCONF: 00 x-cbid: 20032011-0008-0000-0000-0000036097F3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20032011-0009-0000-0000-00004A81F8F6 Message-Id: <20200320112403.GG26049@in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.645 definitions=2020-03-20_02:2020-03-20,2020-03-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxscore=0 suspectscore=2 clxscore=1011 priorityscore=1501 impostorscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003200046 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 20, 2020 at 11:26:43AM +0100, Laurent Dufour wrote: > When the call to UV_REGISTER_MEM_SLOT is failing, for instance because > there is not enough free secured memory, the Hypervisor (HV) has to call > UV_RETURN to report the error to the Ultravisor (UV). Then the UV will call > H_SVM_INIT_ABORT to abort the securing phase and go back to the calling VM. > > If the kvm->arch.secure_guest is not set, in the return path rfid is called > but there is no valid context to get back to the SVM since the Hcall has > been routed by the Ultravisor. > > Move the setting of kvm->arch.secure_guest earlier in > kvmppc_h_svm_init_start() so in the return path, UV_RETURN will be called > instead of rfid. > > Cc: Bharata B Rao > Cc: Paul Mackerras > Cc: Benjamin Herrenschmidt > Cc: Michael Ellerman > Signed-off-by: Laurent Dufour > --- > arch/powerpc/kvm/book3s_hv_uvmem.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c > index 79b1202b1c62..68dff151315c 100644 > --- a/arch/powerpc/kvm/book3s_hv_uvmem.c > +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c > @@ -209,6 +209,8 @@ unsigned long kvmppc_h_svm_init_start(struct kvm *kvm) > int ret = H_SUCCESS; > int srcu_idx; > > + kvm->arch.secure_guest = KVMPPC_SECURE_INIT_START; > + > if (!kvmppc_uvmem_bitmap) > return H_UNSUPPORTED; > > @@ -233,7 +235,6 @@ unsigned long kvmppc_h_svm_init_start(struct kvm *kvm) > goto out; > } > } > - kvm->arch.secure_guest |= KVMPPC_SECURE_INIT_START; There is an assumption that memory slots would have been registered with UV if KVMPPC_SECURE_INIT_START has been done. KVM_PPC_SVM_OFF ioctl will skip unregistration and other steps during reboot if KVMPPC_SECURE_INIT_START hasn't been done. Have you checked if that path isn't affected by this change? Regards, Bharata.