From patchwork Mon Jul 22 21:39:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169453 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8012636ilk; Mon, 22 Jul 2019 14:41:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKomrvUy4UW+CwmRTTG9pnUjpWMVG/Z3yxYRy0mZKBCumWC4/GrQz7YThCMpjZwcgPhN9F X-Received: by 2002:a5d:9c46:: with SMTP id 6mr7796918iof.6.1563831701727; Mon, 22 Jul 2019 14:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563831701; cv=none; d=google.com; s=arc-20160816; b=hr1K6KtSpKwvs91IpPb/HBqLC9q2D6ldzW1ELtvkcRwcRS717KsKBu9NB72ZouvmIW 8B2p8saY76cDo5ssBCNU6lq9exUX8jvKiJwH93cbnYYNe3Yc3r+DXAOZju2kucKNX7mj nXzsqAmnTl9wiabGMaIJDF9smFSZRwPM1zG6h7MKsXkyu0HXw+jVvLIftvXjgfavGeIi hw6dG2kx0zvcZt9Qvo4yrIl/HomKjyp6782FOp1wxGimfq3HAbFr8EO8L3XwMMSYXa0W 5/lzv7pdDZOQQtTbUJiQsvFsEF9UNaUBxQZNihYkW0rzBzEUZujgo/ENwAzJBNSN8/MW 5Obw== 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=eehCvmI7FD6bzmNDzHFAXWZ07IalZxjsvxtVD3zE2/I=; b=JaLOvTId+HJ8naJSXLkZJ1y0da0INLBn4Ym47Jw/XeWdOReZUfTX44MghaixlxeUP+ ozyBzDEnS74x0bUAtPECVne7gcSKuVJAbl2H+spSntnmnEETIEiXB/lfIUz/QrXULt37 o3tqmXqwvjWdRNrZ6bpl2UjOEH/vQEm+4LcfA1uCcs3CA1h0RVhRtcrQhCvC1nEaNU+j JJsrt3nyrqCSQjmbxG1K5hQmGneEGZihpOZi/CR3Ky1acGN4EgpxqzUqnrbrxzM35OhU i5GzjyPNhkhzWXdFiS52tSGU2QFg2fKv7M8zeco2natAv12cWMgOzkK1yCOkMSTQzOkt GGkQ== 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 r1si68198599jac.1.2019.07.22.14.41.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 14:41:41 -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 1hpg2e-0002db-Pm; Mon, 22 Jul 2019 21:40:20 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hpg2c-0002aX-W2 for xen-devel@lists.xenproject.org; Mon, 22 Jul 2019 21:40:19 +0000 X-Inumbo-ID: 4c0bbbe4-acc9-11e9-8980-bc764e045a96 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 4c0bbbe4-acc9-11e9-8980-bc764e045a96; Mon, 22 Jul 2019 21:40:17 +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 7F340153B; Mon, 22 Jul 2019 14:40:17 -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 B1ECC3F71F; Mon, 22 Jul 2019 14:40:16 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Jul 2019 22:39:36 +0100 Message-Id: <20190722213958.5761-14-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 13/35] xen/arm64: head: Don't setup the fixmap on secondary CPUs 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 , Stefano Stabellini MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" setup_fixmap() will setup the fixmap in the boot page tables in order to use earlyprintk and also update the register x23 holding the address to the UART. However, secondary CPUs are not using earlyprintk between turning the MMU on and switching to the runtime page table. So setting up the fixmap in the boot pages table is pointless. This means most of setup_fixmap() is not necessary for the secondary CPUs. The update of UART address is now moved out of setup_fixmap() and duplicated in the CPU boot and secondary CPUs boot. Additionally, the call to setup_fixmap() is removed from secondary CPUs boot. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Fix typo - Clarify the commit message - Add Stefano's reviewed-by --- xen/arch/arm/arm64/head.S | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 4ce4895a0d..28efe9230c 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -301,6 +301,10 @@ real_start_efi: br x0 primary_switched: bl setup_fixmap +#ifdef CONFIG_EARLY_PRINTK + /* Use a virtual address to access the UART. */ + ldr x23, =EARLY_UART_VIRTUAL_ADDRESS +#endif b launch ENDPROC(real_start) @@ -343,8 +347,6 @@ GLOBAL(init_secondary) ldr x0, =secondary_switched br x0 secondary_switched: - bl setup_fixmap - /* * Non-boot CPUs need to move on to the proper pagetables, which were * setup in init_secondary_pagetables. @@ -361,6 +363,10 @@ secondary_switched: dsb sy /* Ensure completion of TLB flush */ isb +#ifdef CONFIG_EARLY_PRINTK + /* Use a virtual address to access the UART. */ + ldr x23, =EARLY_UART_VIRTUAL_ADDRESS +#endif b launch ENDPROC(init_secondary) @@ -624,10 +630,6 @@ setup_fixmap: * don't need the 1:1 map any more */ dsb sy #if defined(CONFIG_EARLY_PRINTK) /* Fixmap is only used by early printk */ - /* Non-boot CPUs don't need to rebuild the fixmap itself, just - * the mapping from boot_second to xen_fixmap */ - cbnz x22, 1f - /* Add UART to the fixmap table */ ldr x1, =xen_fixmap /* x1 := vaddr (xen_fixmap) */ lsr x2, x23, #THIRD_SHIFT @@ -635,7 +637,6 @@ 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 */ -1: /* Map fixmap into boot_second */ ldr x4, =boot_second /* x4 := vaddr (boot_second) */ @@ -645,9 +646,6 @@ setup_fixmap: ldr x1, =FIXMAP_ADDR(0) lsr x1, x1, #(SECOND_SHIFT - 3) /* x1 := Slot for FIXMAP(0) */ str x2, [x4, x1] /* Map it in the fixmap's slot */ - - /* Use a virtual address to access the UART. */ - ldr x23, =EARLY_UART_VIRTUAL_ADDRESS #endif /*