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=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 61143C55189 for ; Wed, 22 Apr 2020 13:46:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 326A82084D for ; Wed, 22 Apr 2020 13:46:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lfagTDX8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 326A82084D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=URDOfcS4Uc0Jty7QoD1Z/RHObPVbQnDYkb29MAXTRBQ=; b=lfagTDX8YvhCOCbvd3tStiljP APBiezFOHSooUC4SmrWX51Z3HCBpQq1xVCSoYJmQ2rITDNS/z4Y2Orl3Kzb2oCPh8smL//pdPThxH 2szb5nWz22AccjIS8Qolah07EoxWP6tfTycD21MG9XAHq62uclphfCdoHrgVlvzyfN+a+fX+I2Aej FlSVcj8GXukLILrcg+RE2nzH7v2oeU36QcJzfkH1Su2yOy5squMpkP/PnqY00y/aqWy561I2AOJmp XZpgddmvfMqsxMlMoQPBVXcrzeNW5I2+IoZphHGrw+H4qs/gYLo7AoOgaasl+sNhY7heiLA3SIol1 7g+vOiRBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRFhp-0005ZX-Id; Wed, 22 Apr 2020 13:46:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRFhj-0005TL-KL for linux-arm-kernel@lists.infradead.org; Wed, 22 Apr 2020 13:46:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CE6E531B; Wed, 22 Apr 2020 06:46:18 -0700 (PDT) Received: from [10.37.12.172] (unknown [10.37.12.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6BEC03F68F; Wed, 22 Apr 2020 06:46:15 -0700 (PDT) Subject: Re: [PATCH 02/26] KVM: arm64: Move __load_guest_stage2 to kvm_mmu.h To: maz@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org References: <20200422120050.3693593-1-maz@kernel.org> <20200422120050.3693593-3-maz@kernel.org> From: Suzuki K Poulose Message-ID: <7bfefbb0-a467-3e43-6e22-466ae7184a1f@arm.com> Date: Wed, 22 Apr 2020 14:51:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20200422120050.3693593-3-maz@kernel.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200422_064619_820945_8CA97B63 X-CRM114-Status: GOOD ( 20.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, will@kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, dave.martin@arm.com, gcherian@marvell.com, james.morse@arm.com, prime.zeng@hisilicon.com, catalin.marinas@arm.com, alexandru.elisei@arm.com, jintack@cs.columbia.edu, julien.thierry.kdev@gmail.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 ? Otherwise : Reviewed-by: Suzuki K Poulose _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel