Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp608240pxv; Thu, 15 Jul 2021 11:23:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRvRlVXZSATl/iVeKI4zIhG88mSnSyoaHXi0mNTwb3dpyagniefH0nx/sDbKodJcbqeDwz X-Received: by 2002:a6b:4905:: with SMTP id u5mr3995568iob.55.1626373435299; Thu, 15 Jul 2021 11:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626373435; cv=none; d=google.com; s=arc-20160816; b=Scm8DR4QBfIG7XFEdTvP9FcGpMVNlX94/R7Wf8mP8Fzs35M7xzbjy2VnGvBwkzemor FfyQN+gQ8wzMuCNcg8P7JyCYxzT6dq+SJ8B14yOO4Knt1bjnbBrUnLpCZlOtFBmZz3No 2rW4mBoTMsr6iRz3tElhySOL/2NfyhIDm9+36LhS1a6ougZ24C0E4jZRj4fGTCZIQnPT YnGGhMkeupGy5IY5hbMWq+MZq80Ll5x68dA+S0M8AIvMHNXU2tPFk/5EWg4rlhGY+4ac uwKPbaQbQxN6lB3WPdZZprlYI9mG65Dicmw2WXSuXqVuAVq1KMUFwLr11ucgYmgD+uoW 2T+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6V0pK8ucyVCX6PRtm05DOcEnScRKa1wgxhpvyI16xvU=; b=mPUNDy973CM/cuEJ7OxoUov/EdGzYZY5/wHbMcDVN2g+F4PVWEq9u7h7/m/cAimBtw Q9ey7pJn9rAAaZqpUegoTwjpPRjE+BdpjMfuZAJHMtj/nQ+ol0A21RI20rpayF4g1paO +O8nsRZEU+YhUurStYw07K298gpyp96FlwTvaVaUD5rpCfdaO066ecQ6OAVuGcfKAWqU V5avSu6X0KtO0ckszLQoAM1SrFj7m2edUYha1gDGyBIuCKg83lzrKbdK5/QuroT2gB/7 p4yQ3qdee/SyqarOJAvw+Ys5fcvnORczdcIFJHqRzpYbnpPnAD8glPNuF0eG535wiNhq Vxog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f11si7629385jav.53.2021.07.15.11.23.43; Thu, 15 Jul 2021 11:23:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236383AbhGOQ4z (ORCPT + 99 others); Thu, 15 Jul 2021 12:56:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:48488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236183AbhGOQ4y (ORCPT ); Thu, 15 Jul 2021 12:56:54 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A312F6128D; Thu, 15 Jul 2021 16:54:01 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m44Hc-00DYjr-3c; Thu, 15 Jul 2021 17:32:20 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: will@kernel.org, qperret@google.com, dbrazdil@google.com, Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: [PATCH 16/16] arm64: Register earlycon fixmap with the MMIO guard Date: Thu, 15 Jul 2021 17:31:59 +0100 Message-Id: <20210715163159.1480168-17-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210715163159.1480168-1-maz@kernel.org> References: <20210715163159.1480168-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, will@kernel.org, qperret@google.com, dbrazdil@google.com, vatsa@codeaurora.org, sdonthineni@nvidia.com, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On initialising the MMIO guard infrastructure, register the earlycon mapping if present. Signed-off-by: Marc Zyngier --- arch/arm64/mm/ioremap.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c index d82b63bcc554..a27b58e03c93 100644 --- a/arch/arm64/mm/ioremap.c +++ b/arch/arm64/mm/ioremap.c @@ -32,6 +32,18 @@ static int __init ioremap_guard_setup(char *str) } early_param("ioremap_guard", ioremap_guard_setup); +static void fixup_fixmap(void) +{ + unsigned long addr = __fix_to_virt(FIX_EARLYCON_MEM_BASE); + pte_t *ptep = __get_fixmap_pte(FIX_EARLYCON_MEM_BASE); + + if (!ptep) + return; + + ioremap_page_range_hook(addr, addr + PAGE_SIZE, __pte_to_phys(*ptep), + __pgprot(pte_val(*ptep) & PTE_ATTRINDX_MASK)); +} + void kvm_init_ioremap_services(void) { struct arm_smccc_res res; @@ -55,6 +67,7 @@ void kvm_init_ioremap_services(void) &res); if (res.a0 == SMCCC_RET_SUCCESS) { static_branch_enable(&ioremap_guard_key); + fixup_fixmap(); pr_info("Using KVM MMIO guard for ioremap\n"); } else { pr_warn("KVM MMIO guard registration failed (%ld)\n", res.a0); -- 2.30.2