From patchwork Mon Jul 22 21:39:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169447 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8012500ilk; Mon, 22 Jul 2019 14:41:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6pZcOPy5OwRpqO783HnfkLsy5Cny4XiqGj5s2MnO55Vq/clc8axm8X8Qg/PzhJVl9muy8 X-Received: by 2002:a6b:dd18:: with SMTP id f24mr32365185ioc.97.1563831692978; Mon, 22 Jul 2019 14:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563831692; cv=none; d=google.com; s=arc-20160816; b=BmqwTFPlD43ZZSfHtkUYNZp0D+WgPnf8JY5efe/S1Ab6AxwRq2XI+LuQvFQq3TMOc3 sIMllVFp3hsfZOt/XRYQfmAVU8Iq564o2Bkb9S98+rsrHlE9rlVXaZ15XXLEpoGc3wd0 N+wZyY5sVzYyatVAygKU/zGJpr20rJQI1ObfcgXyEcV9llTC2qtDCLGyxz+CALVovqpG ZPdRQFcj/f063a/G7H34m09Fq2cInbnVguc+0S/kuBC3TA5rOQOwhJxHD4Ml/nKcNYyN nRHmlCr1/UkYu4ozHvUHDQYU1BOiQTGTJY6deEJsM3m+JZCqYgFme9delcqX/t5Gzg6G ovtg== 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=DCmIypgc7y/L6oRbAH292dF0S+4SvcEIpKHMbHEYseE=; b=gnlcQ52rqRp1d4vul7jvsS/2c21zWGr42m0tMtrAGV6Vlq6OjyEmhHDRIB8KTZLAfr 8/ZA4PTxIdOKhsFfADJmBr4YMaXJFbZHE4I6dVC1fO7XIUqmSo7U+FdmaDbt/6JLgqRf ZoW9hlKI0d5AONS4WVRAdkI2JKVTmZPffRGxHFuuNyEPaNbERoCl74bMewsdkJs/818T RNBvxY65CF8tdmfaSjYPcI2TuqS3iiukjOvWKeOEZK1YiHbtDcPmL6ntcNL1AVg4h6p9 BK+HKYxrXCoY7oWllZhoJe01kksRYyiojFR9ryXBZYFXp508xW1ZZtaBSHEya7vSGVHa 2Aow== 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 v5si53062454ioq.60.2019.07.22.14.41.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 14:41:32 -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 1hpg2Z-0002UK-D9; Mon, 22 Jul 2019 21:40:15 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hpg2Y-0002Sg-BD for xen-devel@lists.xenproject.org; Mon, 22 Jul 2019 21:40:14 +0000 X-Inumbo-ID: 495e8108-acc9-11e9-8980-bc764e045a96 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 495e8108-acc9-11e9-8980-bc764e045a96; Mon, 22 Jul 2019 21:40:13 +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 E390A1595; Mon, 22 Jul 2019 14:40:12 -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 37EB73F71F; Mon, 22 Jul 2019 14:40:12 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Jul 2019 22:39:31 +0100 Message-Id: <20190722213958.5761-9-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 08/35] xen/arm64: head: Rework and document zero_bss() 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" On secondary CPUs, zero_bss() will be a NOP because BSS only need to be zeroed once at boot. So the call in the secondary CPUs path can be removed. It also means that x26 does not need to be set for secondary CPU. Note that we will need to keep x26 around for the boot CPU as BSS should not be reset when booting via UEFI. Lastly, document the behavior and the main registers usage within the function. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Clarify the commit message - Mention x20 is used as an input --- xen/arch/arm/arm64/head.S | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index fbcc792ade..92c8338d71 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -71,7 +71,7 @@ * x23 - UART address * x24 - * x25 - identity map in place - * x26 - skip_zero_bss + * x26 - skip_zero_bss (boot cpu only) * x27 - * x28 - * x29 - @@ -313,8 +313,6 @@ GLOBAL(init_secondary) sub x20, x19, x0 /* x20 := phys-offset */ mov x22, #1 /* x22 := is_secondary_cpu */ - /* Boot CPU already zero BSS so skip it on secondary CPUs. */ - mov x26, #1 /* X26 := skip_zero_bss */ mrs x0, mpidr_el1 ldr x13, =(~MPIDR_HWID_MASK) @@ -337,7 +335,6 @@ GLOBAL(init_secondary) PRINT(" booting -\r\n") #endif bl check_cpu_mode - bl zero_bss bl cpu_init bl create_page_tables bl enable_mmu @@ -375,6 +372,15 @@ check_cpu_mode: b fail ENDPROC(check_cpu_mode) +/* + * Zero BSS + * + * Inputs: + * x20: Physical offset + * x26: Do we need to zero BSS? + * + * Clobbers x0 - x3 + */ zero_bss: /* Zero BSS only when requested */ cbnz x26, skip_bss