From patchwork Wed Sep 14 08:34:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 12975802 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74D91C6FA89 for ; Wed, 14 Sep 2022 08:36:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229831AbiINIg5 (ORCPT ); Wed, 14 Sep 2022 04:36:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbiINIgi (ORCPT ); Wed, 14 Sep 2022 04:36:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24DCD5F7E2 for ; Wed, 14 Sep 2022 01:36:33 -0700 (PDT) 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 EBEFBB81689 for ; Wed, 14 Sep 2022 08:36:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6C97C433D7; Wed, 14 Sep 2022 08:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663144590; bh=nabgJXIV5TCp67knXjzIafDEUmrxwmyp5lgXbjeYsoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BwGpsQIvXIaeqxGaEkCBcSLb4v5uClChYPe4/xrdni5T7IvhEWhFIsJGg2uWI9EY3 Dl8olJqZj8iNC4C4y8k0mCdn61+zqZnf2/SweHQTYieLDhWhR3U1wHHqU5FaG7whpP gG2jgoJ/RJv/qrnU0c7n6XkV/wamvKHDLIZdw1N+yBogyDcIO3vW+8xp+XVqi3ggPa 1/FXgsXlLURhZgrIFMVEGMJkWLj89JwuNd7FvfTYLXXkZUR6mdcmRInbi5IUViLZuZ BVNBrY0S13M7AtNf8xqpMbWiIJuXF07OOf5FPIljurWSGQ6rsMMFP6NiGD3mexmhZe Ez5UsxTUafc4w== From: Will Deacon To: kvmarm@lists.cs.columbia.edu Cc: Will Deacon , Sean Christopherson , Vincent Donnefort , Alexandru Elisei , Catalin Marinas , James Morse , Chao Peng , Quentin Perret , Suzuki K Poulose , Mark Rutland , Fuad Tabba , Oliver Upton , Marc Zyngier , kernel-team@android.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 23/25] KVM: arm64: Explicitly map 'kvm_vgic_global_state' at EL2 Date: Wed, 14 Sep 2022 09:34:58 +0100 Message-Id: <20220914083500.5118-24-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220914083500.5118-1-will@kernel.org> References: <20220914083500.5118-1-will@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Quentin Perret The pkvm hypervisor at EL2 may need to read the 'kvm_vgic_global_state' variable from the host, for example when saving and restoring the state of the virtual GIC. Explicitly map 'kvm_vgic_global_state' in the stage-1 page-table of the pKVM hypervisor rather than relying on mapping all of the host '.rodata' section. Signed-off-by: Quentin Perret Signed-off-by: Will Deacon --- 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 0f69c1393416..5a371ab236db 100644 --- a/arch/arm64/kvm/hyp/nvhe/setup.c +++ b/arch/arm64/kvm/hyp/nvhe/setup.c @@ -161,6 +161,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; }