From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78BC8C55185 for ; Wed, 22 Apr 2020 13:59:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F63D20787 for ; Wed, 22 Apr 2020 13:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587563990; bh=OKor0O1lAwDsiHEhIHm+ZWkyVKAQBwA4AAHrzX1Q+v4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=h7bKDsLindCg5SZmM3Q02D0yB/AY9rM4NXR8mkWemJOC9a48HbTtIxD7Ey2YUPoor ZJq4C2q8yv01y1nk+pbBwgUL65I4QW24s/SMtozF2zW1owHIBg23haasvIRkR0kLyT GYpF4YIJ8c4EP6JjD6ssshxTCWdF9ZTwU7Plna5o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726983AbgDVN7t (ORCPT ); Wed, 22 Apr 2020 09:59:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:36254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbgDVN7s (ORCPT ); Wed, 22 Apr 2020 09:59:48 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 280B22077D; Wed, 22 Apr 2020 13:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587563988; bh=OKor0O1lAwDsiHEhIHm+ZWkyVKAQBwA4AAHrzX1Q+v4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Mft597zjrjfiYPCTD7S4lA3sg14fCZ2v2U47Z6Du5U5NKrMl5NA1BpiDTbr2xAimj 47DVnc9Fv7lo3ZnBI6UJOPGcZpV//wtWy4jdl3wOzpAv81yu35tKsTyUMnnhnGbfhl h4An5H97MXOwUnn3qKU24hiU2sZED7EywJKFlAAc= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jRFuk-005WlJ-HE; Wed, 22 Apr 2020 14:59:46 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 22 Apr 2020 14:59:46 +0100 From: Marc Zyngier To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, dave.martin@arm.com, jintack@cs.columbia.edu, alexandru.elisei@arm.com, gcherian@marvell.com, prime.zeng@hisilicon.com, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com Subject: Re: [PATCH 02/26] KVM: arm64: Move __load_guest_stage2 to kvm_mmu.h In-Reply-To: <7bfefbb0-a467-3e43-6e22-466ae7184a1f@arm.com> References: <20200422120050.3693593-1-maz@kernel.org> <20200422120050.3693593-3-maz@kernel.org> <7bfefbb0-a467-3e43-6e22-466ae7184a1f@arm.com> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, dave.martin@arm.com, jintack@cs.columbia.edu, alexandru.elisei@arm.com, gcherian@marvell.com, prime.zeng@hisilicon.com, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, james.morse@arm.com, julien.thierry.kdev@gmail.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Suzuki, On 2020-04-22 14:51, Suzuki K Poulose wrote: > Hi Marc, > > > On 04/22/2020 01:00 PM, Marc Zyngier wrote: >> Having __load_guest_stage2 in kvm_hyp.h is quickly going to trigger >> a circular include problem. In order to avoid this, let's move >> it to kvm_mmu.h, where it will be a better fit anyway. >> >> In the process, drop the __hyp_text annotation, which doesn't help >> as the function is marked as __always_inline. >> >> Signed-off-by: Marc Zyngier > >> --- >> arch/arm64/include/asm/kvm_hyp.h | 18 ------------------ >> arch/arm64/include/asm/kvm_mmu.h | 17 +++++++++++++++++ >> 2 files changed, 17 insertions(+), 18 deletions(-) >> >> diff --git a/arch/arm64/include/asm/kvm_hyp.h >> b/arch/arm64/include/asm/kvm_hyp.h >> index fe57f60f06a89..dcb63bf941057 100644 >> --- a/arch/arm64/include/asm/kvm_hyp.h >> +++ b/arch/arm64/include/asm/kvm_hyp.h >> @@ -10,7 +10,6 @@ >> #include >> #include >> #include >> -#include >> #include >> #define __hyp_text __section(.hyp.text) notrace >> @@ -88,22 +87,5 @@ void deactivate_traps_vhe_put(void); >> u64 __guest_enter(struct kvm_vcpu *vcpu, struct kvm_cpu_context >> *host_ctxt); >> void __noreturn __hyp_do_panic(unsigned long, ...); >> -/* >> - * Must be called from hyp code running at EL2 with an updated VTTBR >> - * and interrupts disabled. >> - */ >> -static __always_inline void __hyp_text __load_guest_stage2(struct kvm >> *kvm) >> -{ >> - write_sysreg(kvm->arch.vtcr, vtcr_el2); >> - write_sysreg(kvm_get_vttbr(kvm), vttbr_el2); >> - >> - /* >> - * ARM errata 1165522 and 1530923 require the actual execution of >> the >> - * above before we can switch to the EL1/EL0 translation regime used >> by >> - * the guest. >> - */ >> - asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_SPECULATIVE_AT_VHE)); >> -} >> - >> #endif /* __ARM64_KVM_HYP_H__ */ >> diff --git a/arch/arm64/include/asm/kvm_mmu.h >> b/arch/arm64/include/asm/kvm_mmu.h >> index 30b0e8d6b8953..5ba1310639ec6 100644 >> --- a/arch/arm64/include/asm/kvm_mmu.h >> +++ b/arch/arm64/include/asm/kvm_mmu.h >> @@ -604,5 +604,22 @@ static __always_inline u64 kvm_get_vttbr(struct >> kvm *kvm) >> return kvm_phys_to_vttbr(baddr) | vmid_field | cnp; >> } >> +/* >> + * Must be called from hyp code running at EL2 with an updated VTTBR >> + * and interrupts disabled. >> + */ >> +static __always_inline void __load_guest_stage2(struct kvm *kvm) >> +{ >> + write_sysreg(kvm->arch.vtcr, vtcr_el2); >> + write_sysreg(kvm_get_vttbr(kvm), vttbr_el2); >> + >> + /* >> + * ARM erratum 1165522 requires the actual execution of the above > > Is it intentional to drop the reference to errata 1530923 ? No, that's obviously the effect of a bad conflict resolution during a rebase. I'll fix it now, thanks for spotting it. > Otherwise : > > Reviewed-by: Suzuki K Poulose Cheers, M. -- Jazz is not dead. It just smells funny...