From: Ram Pai Date: Fri, 03 Jan 2020 02:20:17 +0000 Subject: Re: [PATCH V3 2/2] KVM: PPC: Implement H_SVM_INIT_ABORT hcall Message-Id: <20200103022017.GF5556@oc0525413822.ibm.com> List-Id: References: <20191215021104.GA27378@us.ibm.com> <20191215021208.GB27378@us.ibm.com> <20200103001814.GD5556@oc0525413822.ibm.com> <20200103003233.GA16216@us.ibm.com> In-Reply-To: <20200103003233.GA16216@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Sukadev Bhattiprolu Cc: Michael Ellerman , Paul Mackerras , Bharata B Rao , kvm-ppc@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org On Thu, Jan 02, 2020 at 04:32:33PM -0800, Sukadev Bhattiprolu wrote: > Ram Pai [linuxram@us.ibm.com] wrote: > > > +unsigned long kvmppc_h_svm_init_abort(struct kvm *kvm) > > > +{ > > > + int i; > > > + > > > + if (!(kvm->arch.secure_guest & KVMPPC_SECURE_INIT_START)) > > > + return H_UNSUPPORTED; > > > > It should also return H_UNSUPPORTED when > > (kvm->arch.secure_guest & KVMPPC_SECURE_INIT_DONE) is true. > > If KVMPPC_SECURE_INIT_DONE is set, KVMPPC_SECURE_INIT_START is also > set - we never clear KVMPPC_SECURE_INIT_START right? I am concerned about the case, where the VM has successfully transitioned into a SVM, where both KVMPPC_SECURE_INIT_DONE and KVMPPC_SECURE_INIT_START are set. In this scenario, if the UV makes a H_SVM_INIT_ABORT hcall, the Hypervisor will not return H_UNSUPPORTED, because KVMPPC_SECURE_INIT_START is set. That is the reason, I think, we need to add another check as below. if (kvm->arch.secure_guest & KVMPPC_SECURE_INIT_DONE) return H_UNSUPPORTED; > > Sukadev -- Ram Pai