Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4057465pxb; Mon, 4 Oct 2021 16:23:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx94PvEZ9Gy+ed6euah/uXJ0DajrjwmI6ae75aaxHvJwDFP6+h2RYlJEdwsFVQg2p3+y678 X-Received: by 2002:aa7:c3c8:: with SMTP id l8mr21431683edr.138.1633389826882; Mon, 04 Oct 2021 16:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633389826; cv=none; d=google.com; s=arc-20160816; b=AVDU6LxNQ+qhxmwc4irpO/FgVA5UxsCDkf/fswwn5VJmtWC2ZKCF0KnRSEnGJM2Mrw qWL6yoi2xdauIq1tHUHk7d+HvOvqhJfCaBQyl+i5ir2f+8C826VBHEoZR58ZPoYH3XUO S3/HGQTRCL7F/tJpSBOoO5NRw9p+noLJ287jadFocSHoG3/p6NuhxQVoY3zCx+d85cTw /kKP3wMY5wX3XZEawqX1hj+ot+SAAI2HvI0YpHujcqVd+dxCngun8hoHSBTRoAG/ff7v Oz2mE4PnP6vvygA77BQHhPDro34zLtTDdibgvqB/CHsY3dax80ZYxvjHecZnvfYvOZcm JZcw== 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=Pk1VCotIivjHviLFC3SxamqrVEgk+aUrL0RJySZPDL8=; b=MXFf6I/OJ573Ak436gHOKdW0Gth1PDf8Vk+nh5nslC94OxJkAcJCsJBqiWJF+jYxmi 0iiVUKniBGBciM3OJt/Mth91VhiyD3Ok0dtnyueom3gAeOwDLCEjNtemJuBP4ZoXEIMN dvxp8fw3tKFty4QIuwfx8eB0OpcEmip1/X8aTJqGHMCDciWs5U9AyUO0HFR0AoMNZMFl LzqbCoUyDoOeCco2mdz9aXa8/sHI9F3Re9YzipDkWWIGw+kXbhP4JF1EI0OSnD6StZUB tzeGMnAGOvtua+/kSOcrurtGNnmZqsSclBstRMFcoHmgP5MXuu7drWVAQISb43ozxA/L OQOw== 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 o18si21723213edi.300.2021.10.04.16.23.23; Mon, 04 Oct 2021 16:23:46 -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 S235809AbhJDR66 (ORCPT + 99 others); Mon, 4 Oct 2021 13:58:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:36412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235573AbhJDR6z (ORCPT ); Mon, 4 Oct 2021 13:58:55 -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 DB6736115C; Mon, 4 Oct 2021 17:57:05 +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 1mXS5J-00EhBv-2j; Mon, 04 Oct 2021 18:49:05 +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, Steven Price , Andrew Jones , Fuad Tabba , Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: [PATCH v2 16/16] arm64: Register earlycon fixmap with the MMIO guard Date: Mon, 4 Oct 2021 18:48:49 +0100 Message-Id: <20211004174849.2831548-17-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211004174849.2831548-1-maz@kernel.org> References: <20211004174849.2831548-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, steven.price@arm.com, drjones@redhat.com, tabba@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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/mm/ioremap.c b/arch/arm64/mm/ioremap.c index 62b715ea31e5..0e10b788500c 100644 --- a/arch/arm64/mm/ioremap.c +++ b/arch/arm64/mm/ioremap.c @@ -39,6 +39,17 @@ static int __init ioremap_guard_setup(char *str) } early_param("ioremap_guard", ioremap_guard_setup); +static void fixup_fixmap(void) +{ + pte_t *ptep = __get_fixmap_pte(FIX_EARLYCON_MEM_BASE); + + if (!ptep) + return; + + ioremap_phys_range_hook(__pte_to_phys(*ptep), PAGE_SIZE, + __pgprot(pte_val(*ptep) & PTE_ATTRINDX_MASK)); +} + void kvm_init_ioremap_services(void) { struct arm_smccc_res res; @@ -62,6 +73,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