From patchwork Tue Sep 17 18:12:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 173909 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1463073ill; Tue, 17 Sep 2019 11:14:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkGKca55zNR9R3IxEOoRTHloAQ+zZeEQ5sfPfZ0zKILm7aLZPWHJXSeOu56jOVP6HUqneT X-Received: by 2002:a6b:bb86:: with SMTP id l128mr98179iof.18.1568744062217; Tue, 17 Sep 2019 11:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568744062; cv=none; d=google.com; s=arc-20160816; b=ChH6KTpE8KccSHCoEa8X3kEvSy6yO6yuzM2mFrKKpdB7mH+KBcFBYJ4/NTWxiA21ME LyG4sm5JkV/aGCSRV3c0CxzAoI1LYG2BZ71v3mj7jA2s18H0GEnC42NZPNmPxJfmd0vN wQKgVDQ6YSdWn0PbX61yKD2gVWl+zLTJBJ/O/LickKe6ICyjomDtHEudBaWM6iXUcfdM 7d6nrwDeNBRq+M4PaOpVxgUfDXxF3PFhCbRWmYhgnTQfsq8/XZHcIVhEJ3DVWPxLeGyQ Iif6SmuVmQXiiT8Je4uHGrBswnzft3wAPOPr8siR40Lw2RL2b3CrlzZYuwK0F8N7xJ+P v5LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=1Q+8aL6pIfOCEXeMs13KNWjNzevsh18XrcTZjkfXnog=; b=zbTtMS160VX19Yjyj3XGuizpGiA+MXV++Mum1kZWELCu1djl75tKjioYWeFDEIGHPS 0dFE8bK7REPowKqiH555aeA+KWsEa6+v/Gt8eiGZb9Vq+gFb1BBaN5i/ITGOnfQvOsI8 +eyHfboUT8Hmy6E246QwXxaLhItPqGbWn6z7lG0HQgMUpglI0vKu6ccR4jIs5kyHACko b0Ny+S79aKr6G2erjT4hRxqNK4agSWeRkaXyikXx11XMgq6CQ8YdN6HIWMUrRXKb0Xjn NZ52GF36M/YZA42Js2zaf5gpnUQL6orMln+5+QoMRTI5hATEcTIUnLQdUvGbDkBv5ciK QQ5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id p142si3783617iod.88.2019.09.17.11.14.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Sep 2019 11:14:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iAHyC-00084r-Vr; Tue, 17 Sep 2019 18:12:56 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iAHyC-00084c-4M for xen-devel@lists.xenproject.org; Tue, 17 Sep 2019 18:12:56 +0000 X-Inumbo-ID: c4dc6fea-d976-11e9-b76c-bc764e2007e4 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id c4dc6fea-d976-11e9-b76c-bc764e2007e4; Tue, 17 Sep 2019 18:12:54 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2D0AC1650; Tue, 17 Sep 2019 11:12:54 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7BB223F67D; Tue, 17 Sep 2019 11:12:53 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 17 Sep 2019 19:12:38 +0100 Message-Id: <20190917181244.30027-3-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190917181244.30027-1-julien.grall@arm.com> References: <20190917181244.30027-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v4 2/8] xen/arm64: head: Rework and document setup_fixmap() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , Stefano Stabellini , Volodymyr Babchuk MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" At the moment, the fixmap table is only hooked when earlyprintk is used. This is fine today because in C land, the fixmap is not used by anyone until the the boot CPU is switching to the runtime page-tables. In the future, the boot CPU will not switch between page-tables to avoid TLB incoherency. Thus, the fixmap table will need to be always hooked before any use. Let's start doing it now in setup_fixmap(). Lastly, document the behavior and the main registers usage within the function. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v3: - Fix typo in the commit message - Add Stefano's Acked-by Changes in v2: - Update the comment to reflect that we clobbers x1 - x4 and not x0 - x1. - Add the list of input registers - s/ID map/1:1 mapping/ - Reword the commit message --- xen/arch/arm/arm64/head.S | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 4c9a69be63..177cec4e45 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -720,8 +720,21 @@ identity_mapping_removed: ret ENDPROC(remove_identity_mapping) +/* + * Map the UART in the fixmap (when earlyprintk is used) and hook the + * fixmap table in the page tables. + * + * The fixmap cannot be mapped in create_page_tables because it may + * clash with the 1:1 mapping. + * + * Inputs: + * x20: Physical offset + * x23: Early UART base physical address + * + * Clobbers x1 - x4 + */ setup_fixmap: -#if defined(CONFIG_EARLY_PRINTK) /* Fixmap is only used by early printk */ +#ifdef CONFIG_EARLY_PRINTK /* Add UART to the fixmap table */ ldr x1, =xen_fixmap /* x1 := vaddr (xen_fixmap) */ lsr x2, x23, #THIRD_SHIFT @@ -729,6 +742,7 @@ setup_fixmap: mov x3, #PT_DEV_L3 orr x2, x2, x3 /* x2 := 4K dev map including UART */ str x2, [x1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */ +#endif /* Map fixmap into boot_second */ ldr x4, =boot_second /* x4 := vaddr (boot_second) */ @@ -741,7 +755,7 @@ setup_fixmap: /* Ensure any page table updates made above have occurred. */ dsb nshst -#endif + ret ENDPROC(setup_fixmap)