From patchwork Mon Jul 22 21:39: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: 169454 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8012242ilk; Mon, 22 Jul 2019 14:41:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzO/GumzElyB/RGyuanUoQqdXE7V9+jg4aIGgi10ShZg02Z3ABcpWP2NkoUsYPkA2B40pGu X-Received: by 2002:a5d:948f:: with SMTP id v15mr51905299ioj.93.1563831674779; Mon, 22 Jul 2019 14:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563831674; cv=none; d=google.com; s=arc-20160816; b=pjiXu2o7HQP0+qA+vhjja8vfwE9NdPudgiXA/dKiVuKPHkpDOAkk3RpO8D8/5kDicj R49A9bOpH0hGsjO1/UII97leabpC7cBiFMYMvTazM17gWRmuLjD1h+crnpYad/leyJH8 Me6biuO6AJNJ19bYmH+C5soowVsnKHjXpFAfSsnxIUgtQtd/j3KlcRBTtEDEg3klDF9o YmuWNTQpd6EhKdFmqD8u0vjqmLRw3amPRDOiCck06RL/PXzU9dKVmiy6xvH28sJXqb4S CWjZPd5NL1MghgRo+luA3Hp+t8jfGEVV3gb6pjbuENpX217GV4HYmau9K0yR/TZ1sMrk yK3w== 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=SUdgnjKljTfOn2ms0FQyKn9fCxKNdfk6/roCe8b+CL0=; b=VtsrXuhihAhguoiZ/Y1hI+rcO89fGmf7fH7GiGqVojKiFtTj924xd9jBTEhUzdhQdN eU2jsRtrZ/8h9me+yjPji3sDyypIfFcYe7M2zWQMrf8tJxXbGtTfmamL6v+P7cMBz+d9 bZK+/mB0PugEN+QJGRr6pZgOVusr8T0RM6af26hFRmN0nuHO+uvZP/ns5v6bFUnxyRnd Zy2ST3ElCmmVm7Vr+zsJB3vj7EAiPfxZ2BGDp4m91205kI+I58Ck7uGQF16SpcDoArGL JGVxtWtEkjCDDFNr3RyNgrW0FHiv0NYv547ke6FnOeTOhfxXWEQGsgh2pFlG9k26VhNc n7pA== 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 r19si53641842iom.118.2019.07.22.14.41.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 14:41:14 -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 1hpg2i-0002ju-67; Mon, 22 Jul 2019 21:40:24 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hpg2g-0002fp-9W for xen-devel@lists.xenproject.org; Mon, 22 Jul 2019 21:40:22 +0000 X-Inumbo-ID: 4d2341ec-acc9-11e9-bcc2-f3c6d6cef6ca Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 4d2341ec-acc9-11e9-bcc2-f3c6d6cef6ca; Mon, 22 Jul 2019 21:40:19 +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 4B8251509; Mon, 22 Jul 2019 14:40:19 -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 9951C3F71F; Mon, 22 Jul 2019 14:40:18 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Jul 2019 22:39:38 +0100 Message-Id: <20190722213958.5761-16-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190722213958.5761-1-julien.grall@arm.com> References: <20190722213958.5761-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v2 15/35] 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 beofre 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 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 a607b3bdb1..f165dd61ca 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -693,8 +693,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 @@ -702,6 +715,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) */ @@ -714,7 +728,7 @@ setup_fixmap: /* Ensure any page table updates made above have occurred. */ dsb nshst -#endif + ret ENDPROC(setup_fixmap)