From patchwork Mon Aug 12 17:29:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 171153 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp511537ily; Mon, 12 Aug 2019 23:54:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFi8YDBhHadZ+iwmvY+9SZLXRjzjoWByvQTDU0zUObTzJePWkVSamExhQMk+yd553UhEL9 X-Received: by 2002:a5e:da48:: with SMTP id o8mr26535382iop.252.1565679269366; Mon, 12 Aug 2019 23:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565679269; cv=none; d=google.com; s=arc-20160816; b=XfTOMdUAe66q9dn3oRon0djjFeBnxuPSt00D2wJCoQ2orgMPleH5B9wUSIuXTi3+Fc QhbE3unXR4NsZk18XpGDlb8SgH26Wg8gJx6WQR7ecazTLHuTtCXdRQxG5zaumDgAwT8r plxTfHIPRts35XzdqgZo6EFZpwyuEF+ZJaWjxQ9X/Ac6jRkaW6eq+A+vT1JrxhRd0hl7 aGk7GQk9u4aykmyBeLbYOS00IDeLKgYAnZ2nJY+iVDGFGA+qyATufeQCnyCKfpthxTHj dtwhZJwQOCZNwBa89ZbE0l549myFnrCywDFfQOYEGBl3qluAw/17M0DFdQ/EK3KW3vhM p8Vw== 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=NnEO8pGjdWBgR6+OU6qvQov8sBT+IABu4d12Ujs2vBg=; b=C3GVCHt1MGVMpe2wKDbVh2FbsVYg6G3ZP9KuKsLxMzS35//CAH1EI3Yo8+KZRdPU2I F5lbwn99jQfwBm9SsRVE9EYkoChpDHOKk5/0KBP/Y02ZqZHIfAoJW7l3oLEI0IuHZGmh pon9/TfgntNn2zOkDnjWUr3dJmqsoEziVU0mdQViZwRaUPxGS6qRixm6l24LAsWOVa5V sKBTyk2jMK1fq6dkbrAt2Dgc76vpF25QmafrPh6WzkbPk7014Id9q411kpnn7/e3ztT/ 8xXvaKt1iV7Zcwqi0j6puxHqt4ZgCjVaTLT47S4yDMxU79cIUUS3L4Le/AnhfUx7Fg1U /uVg== 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 x14si23150822jao.84.2019.08.12.23.54.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Aug 2019 23:54:29 -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 1hxQgl-0002Cg-H3; Tue, 13 Aug 2019 06:53:47 +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 1hxQgk-0002CC-Ll for xen-devel@lists.xenproject.org; Tue, 13 Aug 2019 06:53:46 +0000 X-Inumbo-ID: e19da1ba-bd26-11e9-a064-c7d14abe968e Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id e19da1ba-bd26-11e9-a064-c7d14abe968e; Mon, 12 Aug 2019 17:30:30 +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 EEF6D1993; Mon, 12 Aug 2019 10:30:29 -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 487E93F706; Mon, 12 Aug 2019 10:30:29 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 12 Aug 2019 18:29:54 +0100 Message-Id: <20190812173019.11956-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190812173019.11956-1-julien.grall@arm.com> References: <20190812173019.11956-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH v3 03/28] 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 ec138aae3e..7b6b820726 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -702,8 +702,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 @@ -711,6 +724,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) */ @@ -723,7 +737,7 @@ setup_fixmap: /* Ensure any page table updates made above have occurred. */ dsb nshst -#endif + ret ENDPROC(setup_fixmap)