From patchwork Thu May 19 13:41:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 12855132 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 79CF9C433EF for ; Thu, 19 May 2022 14:10:41 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J+ubhHWgFhiUXbnz3Mr35ZCSQ5huYyLZtigSOBjYYhY=; b=bQxYcc2uLmXvl6 TUwtgVY7NImZ4KTznOrDZpX+xwzyYsV5bj8tfUSD2+HjcLa0yv4Bec1DebGuWhcmP7Fp2n5aWgGLN qH+ulCZRlipqUUQdROU7TzEI1vtPJ8mJfnN0LS8EUWyWYg4KYE7OyLOEzyNNPdxWPezWkcFllz8fc YqcsCSuMgbwx5LDQbZx/ZL2POFYYPrVaBV4kSANvT6qhfMa41NeeyJm3bQgbUwqnw+vYCHv6wPSPy Zhmz4JL+Js1I9nnd27pSKSsbnUQHvbgtWlm6DrDnsa04InWPQsiQYgifbrk2ALm4+CrpfzCXmIdcF y9idlrlecwatl/wD41SQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrgqB-007HA2-Ti; Thu, 19 May 2022 14:09:24 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrgSU-00762y-LP for linux-arm-kernel@lists.infradead.org; Thu, 19 May 2022 13:44:56 +0000 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 4D9B8B824B0; Thu, 19 May 2022 13:44:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FA86C34117; Thu, 19 May 2022 13:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652967892; bh=uJnqJPwMR6L3zu0hKzCa6M5X1lVNf2v8m3jLNKMqNM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R0497BzDPARsmIUjvgx2EZejin+P6ZOTLPa81aUHW0q8FvPtUJP3LpWcU5PBUgbsP 1rTwT+sJjD87VWB+U3bJ2FlpMn5iMvHaasaeqjlHOG6BTz6R2Dkx1BTXTjflDPt5vD EbLuhQG5UZCHhie+rj+6NSAqo+vGrYiysbTw1lpwerRIFeIU4Rue5txCLlp7ygUKo3 1sXAkTbYjJqhpkF+K7h4MsO51v8LylExPcfY1OC59B4TbCaYuIWZUQcbHfD2DpPhNm KbuRo2ggObmCIdukL1p+Yw7hNwXkF0voQUCYz8ZNWanYj6WZYUNCZAJqovOrQdiVGe 2BmAIjL0MlR/w== From: Will Deacon To: kvmarm@lists.cs.columbia.edu Cc: Will Deacon , Ard Biesheuvel , Sean Christopherson , Alexandru Elisei , Andy Lutomirski , Catalin Marinas , James Morse , Chao Peng , Quentin Perret , Suzuki K Poulose , Michael Roth , Mark Rutland , Fuad Tabba , Oliver Upton , Marc Zyngier , kernel-team@android.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 37/89] KVM: arm64: Explicitly map kvm_vgic_global_state at EL2 Date: Thu, 19 May 2022 14:41:12 +0100 Message-Id: <20220519134204.5379-38-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220519134204.5379-1-will@kernel.org> References: <20220519134204.5379-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220519_064454_900885_38BE9365 X-CRM114-Status: GOOD ( 13.83 ) 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 From: Quentin Perret The pkvm hypervisor may need to read the kvm_vgic_global_state variable at EL2. Make sure to explicitly map it in its stage-1 page-table rather than relying on mapping all of the host .rodata section. Signed-off-by: Quentin Perret --- arch/arm64/kvm/hyp/nvhe/setup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/kvm/hyp/nvhe/setup.c b/arch/arm64/kvm/hyp/nvhe/setup.c index 59a478dde533..a851de624074 100644 --- a/arch/arm64/kvm/hyp/nvhe/setup.c +++ b/arch/arm64/kvm/hyp/nvhe/setup.c @@ -136,6 +136,11 @@ static int recreate_hyp_mappings(phys_addr_t phys, unsigned long size, if (ret) return ret; + ret = pkvm_create_mappings(&kvm_vgic_global_state, + &kvm_vgic_global_state + 1, prot); + if (ret) + return ret; + return 0; }