Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3458755rwj; Mon, 19 Dec 2022 19:22:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXt7MItThKjN87/ghkdvfxRUxxK03OFnMu698JxBr0Vp+RPzVcNmHRwHw6kcXCnoixiq4wAK X-Received: by 2002:a17:907:6f19:b0:7aa:491c:6cdf with SMTP id sy25-20020a1709076f1900b007aa491c6cdfmr672382ejc.18.1671506553874; Mon, 19 Dec 2022 19:22:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671506553; cv=none; d=google.com; s=arc-20160816; b=pVIsxxVFptWgoXxqxhx2+QaWjrqWX9R9VyQW/O8TmgsdfSSnrv+TQ3LNM2Sm1tkoRQ +E1Uheih/uIfLNPuNTBc+stRjPNlU0LSDUg8WK7jmEyTmc7NxCHRPWQZ5yM8GxbqmHR1 5qUZ8IoxVXjnN1nUAhGqdxislSp3KZKOo+9JAmB2NkhlIrnEUPENPr3RdyL7fjIZxFME JQ5tcvICUmCybO//UJgiPhiEzAaQ8bBSLpVEjFPhYRK8VRx6ObqhZvBqaEZFLxOx9uyS g77UyEFiYYiCvgkwynqxkVeKE58CnpA6aLrqzGwyxO8dG5vxafT3HzFXJxfMt5Dlo/pl JB3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=g4V2Mj1yRAZksYYAx22/ifZ+PWIDFAZCNO0Hb/5MBao=; b=y7+5qtHQT3r88gOX/ccxbYatnVLs9PHXM7oshff6jI/i+UIthhvXwK5/QCGdNknn/J ArHWp6VD8F/KVOy/r8RRzR/iEMP68eRXSWW8pERveJ/r57LFRMkMQVscAgHYrQ2pe5LG +CILAgdyqUXXQPlRyQytbKeU+SSdgMkj8RxT88rpZ/tuz10QhRXEs1unPWorFb+C5AwT 6r0gFlaGINowtzYwGwP+Qo5qxk8CTyWxNlfrT5UM2uWAV+FfyrogQhVghHXd5Kw+X3/7 2ScOJkQiAqlEPeq3iwtXB/HRT3bCAMAzBKXvNOuqf4RKYGLNDbftIBs6BwxdtVCv+vxz EP5Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk7-20020a1709077f8700b007c10f6a46c5si198458ejc.219.2022.12.19.19.22.16; Mon, 19 Dec 2022 19:22:33 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232976AbiLTCuS (ORCPT + 70 others); Mon, 19 Dec 2022 21:50:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbiLTCuQ (ORCPT ); Mon, 19 Dec 2022 21:50:16 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7773913CC6 for ; Mon, 19 Dec 2022 18:50:15 -0800 (PST) Received: from dggpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NbgyC1tz5zmWZg; Tue, 20 Dec 2022 10:49:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.246) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 20 Dec 2022 10:50:13 +0800 From: Dong Bo To: , , , CC: Nianyao Tang , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Catalin Marinas , Will Deacon Subject: [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out Date: Tue, 20 Dec 2022 18:50:24 +0800 Message-ID: <20221220105024.13484-1-dongbo4@huawei.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.246] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_MED,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 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