Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3876401rwj; Tue, 20 Dec 2022 03:13:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXuEq88MdbVXR+sSVF4JbevVLN3D0Hgj8bGOzNZPm70bxhjzwV2qltRIEwGUPq4Lq2kiMmR3 X-Received: by 2002:a17:902:9f87:b0:186:95c9:ddc9 with SMTP id g7-20020a1709029f8700b0018695c9ddc9mr15076384plq.55.1671534807298; Tue, 20 Dec 2022 03:13:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671534807; cv=none; d=google.com; s=arc-20160816; b=GQ1OzK1kxr41vmawHtZTOCAu0CocuV77UA2iXa2wMiziwo5e1Wkh/fLYKQT0aUhVuU PaSS2ModZzmnsm0WmS4UjKMNXwMXt8aK7DXIyZxTyntVBQq06mL21N+VMGcm8NldlYzg /N4kQyEgYn4vkEYEOhWd1VikYPXE4dYbDSK+UcxIgjZXkgVI/OS6VOMzRtxeAbTmI93X BOQT26/QUkOhsJFqECW0vA9R2nI4f5Q0M+rEjVjZrJgeTm9/6VCbyVNjK31pCgVAkAF8 B9rQv2tszMiLxIm2lWJQR1Pn2PYtNe8NffSXsQBfmg28wS8fi4PRMvNJSHPxJ1rsN1TL 7y3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=HvSYrE9vboOAI+wzjCFX8TNZXIp7b/0BMg/Qj/k/J78=; b=zfJDX+IF67lRQ2Liw4oM1vlx78l4FOngBP3gk0WY26XYWRbzwL1sRA0V//KJ1cHmjM C+5iNK4zHBU+fpefPMJQ4dxgE591h8D8AduNYXibwJsNRISJCiljc0zPkwWKTobaviKG WUauayCIJuk+WwSjB7IARVTonhNUmBnZMSALDBPsnHZR+sLeBgqfHSYEe03pdUkoFGeW 4J/8ezlHKg6T3ixLd1+F+AGqqs0vSztsDchcEOtDYq0gsInNvTMNEop7YmoWZ8nWFIaa JxBljTXfnWhL54oJFi5YSVN0moapxdd8zEdtSJz1reDKwVhcnerfmNYZdGTbF1UxBj4A SPwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hTHocmie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a170902c94900b001892d820a1fsi13998060pla.571.2022.12.20.03.13.17; Tue, 20 Dec 2022 03:13:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hTHocmie; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229540AbiLTKPo (ORCPT + 70 others); Tue, 20 Dec 2022 05:15:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233540AbiLTKPh (ORCPT ); Tue, 20 Dec 2022 05:15:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E21012AF1 for ; Tue, 20 Dec 2022 02:15:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2D16BB811A1 for ; Tue, 20 Dec 2022 10:15:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6DCAC433EF; Tue, 20 Dec 2022 10:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671531325; bh=28o3C2KADlOFeNzK3Jd2QioJksowl6HsKCCJsoj0JNc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hTHocmiee6gvKVzLZV5/t6IWCbeDwMvUf3a0u8WqPfC+l5PFsyKkoiSCjLAi9qN0G eagZrygJHAMqKsrmDlnhWGcdCClwZYodO4umxU4tnQeTNlGPTx3o9PEPvdVM8RWWL6 Z1Tgs6G7hACSwJvTfnji5T75CmH2OoaWVbp2M7myeGl2GBj6aqVRGCekDTCdR9ZYNo V2pbsbjfe14fsHkcQc/DjU9k/6c77BfsH4pnYDqZlgLfDzq/RLhG+WjFaTDeBrCygx 99U89QIo3t0zqUfekkGdveis/HHqh1VerBZWyHpwCutmjj90BfevPsNkAps8YwyiiL lBSSkK1KtqMog== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p7Zed-00DsnV-FZ; Tue, 20 Dec 2022 10:15:23 +0000 Date: Tue, 20 Dec 2022 10:15:18 +0000 Message-ID: <86v8m6bcuh.wl-maz@kernel.org> From: Marc Zyngier To: Dong Bo Cc: , , , , Nianyao Tang , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Catalin Marinas , Will Deacon , Mark Brown Subject: Re: [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out In-Reply-To: <20221220105024.13484-1-dongbo4@huawei.com> References: <20221220105024.13484-1-dongbo4@huawei.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: dongbo4@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, tangnianyao@huawei.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + Mark On Tue, 20 Dec 2022 10:50:24 +0000, Dong Bo wrote: > > From: Nianyao Tang > > If we have VHE and need to reenable SME for host in > kvm_arch_vcpu_put_fp, CPACR.SMEN is modified from 0 to 1. Trap > control for reading SVCR is modified from enable to disable. > Synchronization is needed before reading SVCR later in > fpsimd_save, or it may cause sync exception which can not be > handled by host. > > Cc: Marc Zyngier > Cc: James Morse > Cc: Alexandru Elisei > Cc: Suzuki K Poulose > Cc: Oliver Upton > Cc: Catalin Marinas > Cc: Will Deacon > Signed-off-by: Nianyao Tang > --- > arch/arm64/kvm/fpsimd.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c > index 02dd7e9ebd39..f5799f571317 100644 > --- a/arch/arm64/kvm/fpsimd.c > +++ b/arch/arm64/kvm/fpsimd.c > @@ -184,6 +184,7 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu) > sysreg_clear_set(CPACR_EL1, > CPACR_EL1_SMEN_EL0EN, > CPACR_EL1_SMEN_EL1EN); > + isb(); > } > > if (vcpu->arch.fp_state == FP_STATE_GUEST_OWNED) { > -- > 1.8.3.1 > > -- Without deviation from the norm, progress is not possible.