From patchwork Thu Nov 10 19:02:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 13039233 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 48961C433FE for ; Thu, 10 Nov 2022 19:23:14 +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=tyHKcfRjHHMGht3n39NLTUcE7hrtzXLPC/xfO2VeX3k=; b=PCE2KOAm4pjmew yWJ8j6a1PrkKYTNm6NYmUJ7EUE9OJJYdoobBAhoEbm4TyyK9o+bA5ckzhie0rmQ7fYc2+VQo9TeVG ld6Qwlj7tXzgDoT16CKSNModhZ2WSr3nOCgbCZOUQZQWV+gwQL6Lt5/n7OEZWQwVmdXeDJMWQ0UsY lrnSqE54BM5RrL37vBwnJxEaVppgUftVJMgylpdGdblfaNWc1lesNgObsoYjgP+kKx1ExbreDge6/ FkuuPwiKhs3PiLe5Z+cFoeNEerHSeP3/1RkqaJYPdewsrBqGAw11ofDOu0VVAx9SFZ4jXJ1YkRoGr dJvG06iob/19nX5YA93Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1otD7e-008f4E-O2; Thu, 10 Nov 2022 19:21:59 +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 1otCqq-008Ssk-SE for linux-arm-kernel@lists.infradead.org; Thu, 10 Nov 2022 19:04:38 +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 7A8D4B822E0; Thu, 10 Nov 2022 19:04:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42773C43470; Thu, 10 Nov 2022 19:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668107073; bh=uMN1ArbeWfWv/O62zqeOvGb2y8HJShuBsCnPS3/+2oo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGSF2KOfbI+NWNMYpuXJdMn6sjtgosjF+/5m9yJhsUPw/ZH3VFTzaNbPtP7Sl5Wa1 SZl7d/7QEFymJH3kpjrlXSa6DUCmYB+6RRNioh3gU42wCWnDRNr8LfM/vUodD8ZFyi gtSDPJaEZTmUG95nz6yT6j/Rg/tzVcIavidHRaKAGyWwd8qo6TkI0O3AZTq3p/iU+z PCLUQ2RRuJ8NteBq5+XVe12xmbxTZXTlj576Cf8jwwpSaLA9HC5eeVlmckiBccvSiF QqtR3Lt6SA6xyPdhpWBbIJKfgpkY3C0knsrGdy0EjweMYS1QAXoNmPmbn/tkTtCn3o 0uE9uWeQF5ZFg== From: Will Deacon To: kvmarm@lists.linux.dev Cc: Will Deacon , Sean Christopherson , Vincent Donnefort , Alexandru Elisei , Catalin Marinas , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , 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 v6 23/26] KVM: arm64: Explicitly map 'kvm_vgic_global_state' at EL2 Date: Thu, 10 Nov 2022 19:02:56 +0000 Message-Id: <20221110190259.26861-24-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221110190259.26861-1-will@kernel.org> References: <20221110190259.26861-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221110_110437_092705_B72D5BC0 X-CRM114-Status: GOOD ( 13.25 ) 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 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. Tested-by: Vincent Donnefort 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; }