From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mackerras Date: Tue, 30 Apr 2019 10:07:48 +0000 Subject: Re: [PATCH] KVM: PPC: Book3S HV: Handle virtual mode in XIVE VCPU push code Message-Id: <20190430100748.GG32205@blackberry> List-Id: References: <20190429085745.GA17146@blackberry> In-Reply-To: <20190429085745.GA17146@blackberry> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Cc: kvm-ppc@vger.kernel.org, Suraj Jitindar Singh On Mon, Apr 29, 2019 at 06:57:45PM +1000, Paul Mackerras wrote: > From: Suraj Jitindar Singh > > The code in book3s_hv_rmhandlers.S that pushes the XIVE virtual CPU > context to the hardware currently assumes it is being called in real > mode, which is usually true. There is however a path by which it can > be executed in virtual mode, in the case where indep_threads_mode = N. > A virtual CPU executing on an offline secondary thread can take a > hypervisor interrupt in virtual mode and return from the > kvmppc_hv_entry() call after the kvm_secondary_got_guest label. > It is possible for it to be given another vcpu to execute before it > gets to execute the stop instruction. In that case it will call > kvmppc_hv_entry() for the second VCPU in virtual mode, and the XIVE > vCPU push code will be executed in virtual mode. The result in that > case will be a host crash due to an unexpected data storage interrupt > caused by executing the stdcix instruction in virtual mode. > > This fixes it by adding a code path for virtual mode, which uses the > virtual TIMA pointer and normal load/store instructions. > > [paulus@ozlabs.org - wrote patch description] > > Signed-off-by: Paul Mackerras Patch applied to my kvm-ppc-next tree. Paul.