From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v3 18/41] KVM: arm64: Move userspace system registers into separate function Date: Fri, 9 Feb 2018 18:50:14 +0000 Message-ID: References: <20180112120747.27999-1-christoffer.dall@linaro.org> <20180112120747.27999-19-christoffer.dall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Marc Zyngier , Shih-Wei Li , kvm@vger.kernel.org To: Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Return-path: Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:51754 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751004AbeBISuU (ORCPT ); Fri, 9 Feb 2018 13:50:20 -0500 In-Reply-To: <20180112120747.27999-19-christoffer.dall@linaro.org> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: Hi Christoffer, On 01/12/2018 12:07 PM, Christoffer Dall wrote: > There's a semantic difference between the EL1 registers that control > operation of a kernel running in EL1 and EL1 registers that only control > userspace execution in EL0. Since we can defer saving/restoring the > latter, move them into their own function. > > We also take this chance to rename the function saving/restoring the > remaining system register to make it clear this function deals with > the EL1 system registers. > > No functional change. > > Reviewed-by: Andrew Jones > Signed-off-by: Christoffer Dall > --- > arch/arm64/kvm/hyp/sysreg-sr.c | 46 +++++++++++++++++++++++++++++++----------- > 1 file changed, 34 insertions(+), 12 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/sysreg-sr.c b/arch/arm64/kvm/hyp/sysreg-sr.c > index 848a46eb33bf..99dd50ce483b 100644 > --- a/arch/arm64/kvm/hyp/sysreg-sr.c > +++ b/arch/arm64/kvm/hyp/sysreg-sr.c > @@ -34,18 +34,27 @@ static void __hyp_text __sysreg_do_nothing(struct kvm_cpu_context *ctxt) { } > > static void __hyp_text __sysreg_save_common_state(struct kvm_cpu_context *ctxt) > { > - ctxt->sys_regs[ACTLR_EL1] = read_sysreg(actlr_el1); I am a bit confused, the comment on top of the function says the host must save ACTLR_EL1 in the VHE case. But AFAICT, after this patch the register will not get saved in the host context. Did I miss anything? Cheers, -- Julien Grall From mboxrd@z Thu Jan 1 00:00:00 1970 From: julien.grall@arm.com (Julien Grall) Date: Fri, 9 Feb 2018 18:50:14 +0000 Subject: [PATCH v3 18/41] KVM: arm64: Move userspace system registers into separate function In-Reply-To: <20180112120747.27999-19-christoffer.dall@linaro.org> References: <20180112120747.27999-1-christoffer.dall@linaro.org> <20180112120747.27999-19-christoffer.dall@linaro.org> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Christoffer, On 01/12/2018 12:07 PM, Christoffer Dall wrote: > There's a semantic difference between the EL1 registers that control > operation of a kernel running in EL1 and EL1 registers that only control > userspace execution in EL0. Since we can defer saving/restoring the > latter, move them into their own function. > > We also take this chance to rename the function saving/restoring the > remaining system register to make it clear this function deals with > the EL1 system registers. > > No functional change. > > Reviewed-by: Andrew Jones > Signed-off-by: Christoffer Dall > --- > arch/arm64/kvm/hyp/sysreg-sr.c | 46 +++++++++++++++++++++++++++++++----------- > 1 file changed, 34 insertions(+), 12 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/sysreg-sr.c b/arch/arm64/kvm/hyp/sysreg-sr.c > index 848a46eb33bf..99dd50ce483b 100644 > --- a/arch/arm64/kvm/hyp/sysreg-sr.c > +++ b/arch/arm64/kvm/hyp/sysreg-sr.c > @@ -34,18 +34,27 @@ static void __hyp_text __sysreg_do_nothing(struct kvm_cpu_context *ctxt) { } > > static void __hyp_text __sysreg_save_common_state(struct kvm_cpu_context *ctxt) > { > - ctxt->sys_regs[ACTLR_EL1] = read_sysreg(actlr_el1); I am a bit confused, the comment on top of the function says the host must save ACTLR_EL1 in the VHE case. But AFAICT, after this patch the register will not get saved in the host context. Did I miss anything? Cheers, -- Julien Grall