From patchwork Tue Sep 17 18:12:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 173911 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1463141ill; Tue, 17 Sep 2019 11:14:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfa/GwZwXi44g+9l5k5Ygl/avw2wDRxEqwZW0ibpgEJjx+dVi7JxwuvdYC2QO5Egd1BjQ4 X-Received: by 2002:a6b:dc0b:: with SMTP id s11mr33351ioc.127.1568744066418; Tue, 17 Sep 2019 11:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568744066; cv=none; d=google.com; s=arc-20160816; b=qD2axSerm32vd6ejxl4UBakq1wzlaJ7hl6UgXi1mQAHaDaxMidrzt+6pxJhbc73ttF K45y9519EiE0LffLkP8pXjjVLpmpCGxfvnHwkKxb0jhtCLs1CUFQSJwjNJ4ulyOlKUtu 278sj0F265C8VKZtyfP3PuOhpjy9j0aXFxRWpOWsrrxgQSotw/4gSdh+yGMsmS7Fy8jC Ech1sLXkg5RbHAueGazGwlKpqjZxZ1qu4l/aLWMfO/R1Eq/kfhFCu0A/3Qt+3SWS5pfd QAqdAxHX+Rlq22FsFMLlBNkJw27SMOH5E30Fjl1WtqVwTBNR76IrPL5EMRjGX8kLsMku eI3w== 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=zZMwVCZX9qh/OgiGzKCSvi/GBjmXx01DkK6ExofNJUM=; b=qVAAcdaUYyhiIjCvotnEtkrlR9V2egS+SxWHj0dlhOdj22XVQp29f9tnOnCQiaecud R/z+HK6HhhNDXcmv1+71XmBAWuVMOrIvIUqBUAExdwiiApEdhtczHUTE9GEx2Hm768GN Z+R1+RGc/qs76TOqmzLXSmTBvcjyP3NDM/u/g2fIeNL7Y4UZbXVgxnvzXFPztbX5HSUt WXEP2JOb/XmslnW0ysFobw/VZ9Q7ye9plZIWIEgtNLX03vuAkLvebNCqu0ZGo41chsXq 3Ebijl4GuyYglZVXlXGexbIAotBTUAn1+KB3zJqueBClbQSCsedzHQG2eQBUqyqe79RY YWXA== 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 o3si4088690jam.41.2019.09.17.11.14.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Sep 2019 11:14:26 -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 1iAHyH-00086Z-So; Tue, 17 Sep 2019 18:13:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iAHyH-000863-3x for xen-devel@lists.xenproject.org; Tue, 17 Sep 2019 18:13:01 +0000 X-Inumbo-ID: c5efc576-d976-11e9-b76c-bc764e2007e4 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id c5efc576-d976-11e9-b76c-bc764e2007e4; Tue, 17 Sep 2019 18:12:56 +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 F14F1168F; Tue, 17 Sep 2019 11:12:55 -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 4BDDA3F67D; Tue, 17 Sep 2019 11:12:55 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 17 Sep 2019 19:12:40 +0100 Message-Id: <20190917181244.30027-5-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 4/8] xen/arm32: 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 Reviewed-by: Stefano Stabellini --- Changes in v3: - The unused label is now removed in the previous patch - Add Stefano's reviewed-by Changes in v2: - Patch added --- xen/arch/arm/arm32/head.S | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 65b7e0d711..f58d0fcb80 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -546,8 +546,21 @@ identity_mapping_removed: mov pc, lr 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: + * r10: Physical offset + * r11: Early UART base physical address + * + * Clobbers r1 - r4 + */ setup_fixmap: -#if defined(CONFIG_EARLY_PRINTK) /* Fixmap is only used by early printk */ +#if defined(CONFIG_EARLY_PRINTK) /* Add UART to the fixmap table */ ldr r1, =xen_fixmap /* r1 := vaddr (xen_fixmap) */ lsr r2, r11, #THIRD_SHIFT @@ -556,6 +569,7 @@ setup_fixmap: orr r2, r2, #PT_LOWER(DEV_L3) /* r2:r3 := 4K dev map including UART */ mov r3, #0x0 strd r2, r3, [r1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */ +#endif /* Map fixmap into boot_second */ ldr r1, =boot_second /* r1 := vaddr (boot_second) */ @@ -570,7 +584,7 @@ setup_fixmap: /* Ensure any page table updates made above have occurred. */ dsb nshst -#endif + mov pc, lr ENDPROC(setup_fixmap)