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: 13124134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 108D4C05027 for ; Wed, 1 Feb 2023 10:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+mBpbI5j4htOiJ0Pa+3eJnqH2xXeoMOH809a6RLlpVo=; b=4cgRyRMie5C/Pr1qys2in9Tkbv at5YCKomVLHx/8+I0FURx79hmL9ZP8WcpruIsWPoX90pULzsjmaW/RvgMbHO9ztYIsEBVkOvEDqBH 8yn6zORl+/fbML/W6BEbFMTQUhwdz2iBeaAfgp7tG4RaHv7drsCOiAR5ES0mS1Bskz0+xSdFz4N5O KxUDn+HHGfKBfUmR/Qk7sd4GIpRs3ZSMFdSb8siUW64rJhNdLY+7aVO7dH3pOYLwf3pRwer7IYuZ5 fubg1kXhAczT98gDBRUP1Uparpw1Skquc7W0ysbjFoHEfhyVxGj4kUdmJQDaGlLyyyAO2GJgTtUkU J1V4kQmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNAVr-00BHQa-96; Wed, 01 Feb 2023 10:38:47 +0000 Received: from mail-ej1-x64a.google.com ([2a00:1450:4864:20::64a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNAVK-00BHGS-Ac for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2023 10:38:15 +0000 Received: by mail-ej1-x64a.google.com with SMTP id hp2-20020a1709073e0200b0084d47e3fe82so11611161ejc.8 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=AIzDoycKgVLRdsJbIdvI+WEog/fFfwS7IN6zSNQBV26qzGR8QVjjhkfxaHNW5c0JhR qh9o0cBwM9yqm7tdnDGgeez2oyugDtjqDchRhul6CHnBLDAQb9LIf9T+GlQogd4dkq6S nrMDCeMqObkrgyQGMcNOA/cWz3GXffUHPpmln1oDpy1A0XzW/N+h1BrxHxomKrUenS5T LjSi4auLP20vyqrZP8LucL5xFb3Xdbn6orgDSD49PoTwW7q8felpZMebLEAdACyWfL3u PyzU0VFeIMkteWAeGOAvaZSDikJ6QDuwPlCAUNfZYs2p7XFovfUif7Vbl6V2E8rioBMP 8I+A== X-Gm-Message-State: AO0yUKUJMLWu81UD/2MonD+Zb8mRWB1ExYPXp5u7p6cUcBUQQVesqlFf 7xkz4MqhGHa44/E5JI5B4UGadq1Z4Dfh X-Google-Smtp-Source: AK7set+MIwBZlCh4FsMdr7pXxaPBRLjcasYsOx+njItP8dkSsNSFXlEsZ3xNBcQ6mJPWDYNmVw5G7qWj5uvy 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230201_023814_384278_DF7F15BA X-CRM114-Status: GOOD ( 10.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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