From patchwork Mon Apr 22 16:49:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162602 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801159jan; Mon, 22 Apr 2019 09:51:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqypx/9RolTpjQdvpDLYpMEZxJyuagRhAbTgFt7XSdiANZgVkJ3tt++gBNGdUNT52Xg4xLlT X-Received: by 2002:a81:378a:: with SMTP id e132mr16335188ywa.137.1555951866889; Mon, 22 Apr 2019 09:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951866; cv=none; d=google.com; s=arc-20160816; b=LrcLI+oEME2CAbntMrR+SgEmM+pdWqvB1KkN6a2XOlmSgqrSmSDnvI+NdGCj5Y7Wug jJY2/9HvYA6CkdVGRt3GD25Cf7Bc0/fSTNCmzM5IXu0jrXlEFcVRgqB84DKOk+x59cqP lRZmYP+gyFT+Yu0zL6czgvelFBcX3HaYLo7YU+s9tkf0Vi1F3cFO65jGTPfX5hweFuMW hUj9Q/e7+EGiD6EN+G3/p1tcJR5RBSGddxNRe2jUnFfTBmYyLbn8+wur9umQCXHGx/ne qNASPLRQFS1IVeeFvJb/dqSUqCayl9l3F52z6LndrNoG8yAJHaitXdVNZLLyHqnEvt7n esOg== 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=rylKIrqsmmwYqcWzDXVKtxkqacZVek60Bbn77HQ64eM=; b=IBqsoYXvtCud0Hf1w6gPQllxS+N/bWqI1GYU4UkDUAREV0ISFNUSlSjDiOP3t0GViN ilWVpqdApGi2FtWX9Higd+M+CklpYlly3wNL8pYIAmdgUVCQPqh8JRvFZz1KXloFd9Jg 07RPymt97UZyue3d9UAC1AUJTqYSIfmsX89lEo1NxeiH5zQKUt8i1kWFENCG6YHuJ6Pl ZYjK87bJsfUXPsxrrHhK863UpMzIMVt++MkNopB5apnbA8ZVsmPlUxaxSMJMwyZIdmTo +Vg+srwECamcPDQdGHwRn5+JYyx2VxbWbzYuhPYk8q+AeTEY/DQ9Dy98B8CT3mYrLAri 39vg== 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 b3si1011127ywf.100.2019.04.22.09.51.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:06 -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 1hIc92-0005NO-FM; Mon, 22 Apr 2019 16:50:16 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc90-0005KN-Pt for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:14 +0000 X-Inumbo-ID: b3115267-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id b3115267-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:14 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C9312EBD; Mon, 22 Apr 2019 09:50:13 -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 B94403F557; Mon, 22 Apr 2019 09:50:12 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:34 +0100 Message-Id: <20190422164937.21350-18-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 17/20] xen/arm: mm: Initialize page-tables earlier 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: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Since commit f60658c6ae "xen/arm: Stop relocating Xen", the function setup_page_tables() does not require any information from the FDT. So the initialization of the page-tables can be done much earlier in the boot process. The earliest setup_page_tables() can be called is after traps have been initialized, so we can get backtrace if an error occurred. Moving the initialization of the page-tables also avoid the dance to map the FDT again in the new set of page-tables. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/mm.c | 12 +++--------- xen/arch/arm/setup.c | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index ecde4e34df..ee541a38e3 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -545,7 +545,7 @@ static inline lpae_t pte_of_xenaddr(vaddr_t va) return mfn_to_xen_entry(maddr_to_mfn(ma), MT_NORMAL); } -/* Map the FDT in the early boot page table */ +/* Map the FDT in the runtime page table */ void * __init early_fdt_map(paddr_t fdt_paddr) { /* We are using 2MB superpage for mapping the FDT */ @@ -568,7 +568,7 @@ void * __init early_fdt_map(paddr_t fdt_paddr) /* The FDT is mapped using 2MB superpage */ BUILD_BUG_ON(BOOT_FDT_VIRT_START % SZ_2M); - create_mappings(boot_second, BOOT_FDT_VIRT_START, paddr_to_pfn(base_paddr), + create_mappings(xen_second, BOOT_FDT_VIRT_START, paddr_to_pfn(base_paddr), SZ_2M >> PAGE_SHIFT, SZ_2M); offset = fdt_paddr % SECOND_SIZE; @@ -583,7 +583,7 @@ void * __init early_fdt_map(paddr_t fdt_paddr) if ( (offset + size) > SZ_2M ) { - create_mappings(boot_second, BOOT_FDT_VIRT_START + SZ_2M, + create_mappings(xen_second, BOOT_FDT_VIRT_START + SZ_2M, paddr_to_pfn(base_paddr + SZ_2M), SZ_2M >> PAGE_SHIFT, SZ_2M); } @@ -694,12 +694,6 @@ void __init setup_pagetables(unsigned long boot_phys_offset) pte.pt.table = 1; xen_second[second_table_offset(FIXMAP_ADDR(0))] = pte; - /* ... DTB */ - pte = boot_second[second_table_offset(BOOT_FDT_VIRT_START)]; - xen_second[second_table_offset(BOOT_FDT_VIRT_START)] = pte; - pte = boot_second[second_table_offset(BOOT_FDT_VIRT_START + SZ_2M)]; - xen_second[second_table_offset(BOOT_FDT_VIRT_START + SZ_2M)] = pte; - #ifdef CONFIG_ARM_64 ttbr = (uintptr_t) xen_pgtable + phys_offset; #else diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 6dfbba2927..f7a399ce89 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -754,6 +754,8 @@ void __init start_xen(unsigned long boot_phys_offset, /* Initialize traps early allow us to get backtrace when an error occurred */ init_traps(); + setup_pagetables(boot_phys_offset); + smp_clear_cpu_maps(); device_tree_flattened = early_fdt_map(fdt_paddr); @@ -775,8 +777,6 @@ void __init start_xen(unsigned long boot_phys_offset, (paddr_t)(uintptr_t)(_end - _start + 1), false); BUG_ON(!xen_bootmodule); - setup_pagetables(boot_phys_offset); - setup_mm(fdt_paddr, fdt_size); /* Parse the ACPI tables for possible boot-time configuration */