From patchwork Wed Feb 1 10:37:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 51293 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp200714wrn; Wed, 1 Feb 2023 02:43:09 -0800 (PST) X-Google-Smtp-Source: AK7set8Zq2WpOogKHQRbGk7Nt2IPAPpo4Li5VUK7hkPmdIqASUIE2M7Tt8TkZICijccuP+OPsGpw X-Received: by 2002:a17:90a:2e03:b0:22c:64ac:a98c with SMTP id q3-20020a17090a2e0300b0022c64aca98cmr1795324pjd.23.1675248189116; Wed, 01 Feb 2023 02:43:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675248189; cv=none; d=google.com; s=arc-20160816; b=jKSzs8Pi/duK+aN6EFhINry/x0ihbfhEoBA2zxJRnnlYfYMBdIgDxh8mmM1vNHSXqK MwD9rLKp2vhUAZ/YA75iPz2J+FraxreG0ZZBilJx8onDAxwopT02aZn9bIUy66ghkD4q Xg+4TZu4ohzJ9reQoPkmVv5H69A7LrZyIOqHYzsC8vTSBxWcI0lcv+Gs/UAf0l3AthkZ br/nvujx4omCAIF6ORqbXSu/iZY+h7rOzT2ARUJbPUITa5dNi9fpEwokQIhKjoKYvwrX o6jpdsLmUWIuTh/YVYOcN5Lc3XexWLG+r31vTHL2Ek1+WBECEw+qhy29w8Zjmm/fk+Us UU+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=5K0pl1+Hpl1utWVuYLmia50ybxVZ915Svs1mkYim4pM=; b=crICbuYJMDeZnAI7HhmUK7tqsAN1Nh1s0EkuOsLtRlPqFhZjHFvFHPBPfzVFVW8jDs cL0riRWJXDKgoqTz/Lhx8x7163ANIegCDTm17oh+Um/ZHZAH5Gs4ILlSzplkWZ8JJ7fO oiwJqEUJuYYBxd9aYkYzcqa7qQNV9mtdbZM1brz979gse8eHHeqrpOuZJ8Xb33xCt0st +JPqbwcSFHpKBKt0xL9qLvv5MfqMF5PL1yawd1s5r8mLTxVkQNklEApK+ECSaD1K9PCV l5gSaOIWvkuzDajkr7rOUyfoEM/P/66kTwRcT6KEJppMpb1vCNbEwj2dkQ1CIGjFlYik OCnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=AZ9csdjM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mn22-20020a17090b189600b00215dedefc32si1445222pjb.163.2023.02.01.02.42.56; Wed, 01 Feb 2023 02:43:09 -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=@google.com header.s=20210112 header.b=AZ9csdjM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231292AbjBAKjS (ORCPT + 99 others); Wed, 1 Feb 2023 05:39:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232043AbjBAKim (ORCPT ); Wed, 1 Feb 2023 05:38:42 -0500 Received: from mail-ed1-x549.google.com (mail-ed1-x549.google.com [IPv6:2a00:1450:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5BEF22A30 for ; Wed, 1 Feb 2023 02:38:13 -0800 (PST) Received: by mail-ed1-x549.google.com with SMTP id w3-20020a056402268300b00487e0d9b53fso12627867edd.10 for ; Wed, 01 Feb 2023 02:38:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=5K0pl1+Hpl1utWVuYLmia50ybxVZ915Svs1mkYim4pM=; b=AZ9csdjMBU+FO+3CE5q5XDNRyaZ+1mlI2Lj3G1o2WNntXFQVTVDho9LCPGR3ZrjnXW JzNnaFIPmXpm1MpNtgYY9TfcRGV/I80g3/DhYrNneq1VaDoh+xCyAM3n4ZUB4PFiJqFv GGn8eklaQ1dnG02WA+6uKaN01WVr/3jbL7WzodfEkxccXhoCtmRiM0EBfAG3LxVXbQZV i44+kQsGiH2Ml3pjlbpo89OSHLLMHSBeFOAjyXQ0oG8pg4GtPyrrCZHUYYir8456Jh6h 5dDC6ExL1FQ8xWFj8hVPrPcEDZ8PoUEG/UNWhCmCOrvuvhxntp5jsxy0+egWKDo9xi3C UstQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5K0pl1+Hpl1utWVuYLmia50ybxVZ915Svs1mkYim4pM=; b=kMJ3trocu9HwZfv4gzNVvXZKzBWHkOCU2J40p0aFTm8JqRAQFNSt9XMuwetjc8grre X6qLDVYTDaV3/IuVq96K8H5UuqroWU4HfGG1szhXp2haynqaNlaJThal84E1ntuok5rA FFbx0F0x82a1KY/KZZb/24MEyujTDXphex2miEzarpFJ1Cy9qBngozap7Lnf6kSw8qCC iysTkRFpgwlpg7M+0U6djdCuurFa0K7Nz5bxbPd2iQ8CEe9734ltDzy0XN7SYiYyTwGH /I20FTfV6o6f241bEeQHaHrISTg8IqbX0FlChGkRsdEk8gHIbvnpXD/qaOrYZ+Iaahv3 zsXg== X-Gm-Message-State: AO0yUKWeasW6jnWdhXoOl/tGP2I4aP+MryLAU+ymGYts6AxRBbiYd7B/ 8n4KCgSnS5k1LKN+PIG+FoxqzW93w+zh X-Received: from big-boi.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:129]) (user=qperret job=sendgmr) by 2002:aa7:cb43:0:b0:4a2:46c7:888b with SMTP id w3-20020aa7cb43000000b004a246c7888bmr446208edt.36.1675247892003; Wed, 01 Feb 2023 02:38:12 -0800 (PST) Date: Wed, 1 Feb 2023 10:37:54 +0000 In-Reply-To: <20230201103755.1398086-1-qperret@google.com> Mime-Version: 1.0 References: <20230201103755.1398086-1-qperret@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Message-ID: <20230201103755.1398086-5-qperret@google.com> Subject: [PATCH 4/4] KVM: arm64: Finalise EL2 state from pKVM PSCI relay From: Quentin Perret To: Catalin Marinas , Will Deacon , Marc Zyngier , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Mark Brown Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, kernel-team@android.com, Quentin Perret X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756625045450041748?= X-GMAIL-MSGID: =?utf-8?q?1756625045450041748?= The EL2 state is not initialised correctly when a CPU comes out of CPU_{SUSPEND,OFF} as the finalise_el2 function is not being called. Let's directly call finalise_el2_state from this path to solve the issue. Fixes: 504ee23611c4 ("arm64: Add the arm64.nosve command line option") Signed-off-by: Quentin Perret --- arch/arm64/kvm/hyp/nvhe/hyp-init.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-init.S b/arch/arm64/kvm/hyp/nvhe/hyp-init.S index c953fb4b9a13..a6d67c2bb5ae 100644 --- a/arch/arm64/kvm/hyp/nvhe/hyp-init.S +++ b/arch/arm64/kvm/hyp/nvhe/hyp-init.S @@ -183,6 +183,7 @@ SYM_CODE_START_LOCAL(__kvm_hyp_init_cpu) /* Initialize EL2 CPU state to sane values. */ init_el2_state // Clobbers x0..x2 + finalise_el2_state /* Enable MMU, set vectors and stack. */ mov x0, x28