From patchwork Mon Aug 12 17:30:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 171106 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3120265ily; Mon, 12 Aug 2019 10:31:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcQdYDjxWgHyQT2uY84F9AwwA05AIgXwXS/HHPdBCxcWt6RiVEstHNoceccH5ABgR6qkqd X-Received: by 2002:a5e:9403:: with SMTP id q3mr15968187ioj.63.1565631109239; Mon, 12 Aug 2019 10:31:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565631109; cv=none; d=google.com; s=arc-20160816; b=ZmeglCLOGDLG+ywb/SrJ+2w8AjADb/UPfAuyUKAYfdfG5FLk8l1Sc2dmnDBDJcDmew lZ003KWlmnO3yQH2C29rKhJqYIwFH7IPNZ8ZUA6GFtHOeKSni5aPlzvokuK5n6zUMpMM 2Rsao4FVP0sYdYxMk8YTQqmubG9eFq+C5y9BIbkc0yRZYIZaYPX/HKCwFosQaI8zBl+B lkg4JEfeC6LIM9hSTJtfgnsIptOC1udcG4ukx7ar2cNiAPBInN1qnwIEONMMkLoRoh9U WqGosq6Nglihf4LUFkTzaYtjjhB8WdyjF+Bf2qagAyQmGRQfJ9aOIdC4OCQUAdPjNam5 Odww== 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=vPVhfdN+RjUhqrdYR7UDIk3OFs6iLNzvte4HvESXzFo=; b=WA11GqZEtDD3PtXkBdpUok5jOuCMHUV/0nQU3/86VuErayKEeui9nUOTu2lmkey1w9 9spaaQwuDO9d/4VGXlQCQDOZ9dg7PfRDpwfFfKN1JwjYcCAz3JUIFA0ZCXO676AYOawe UR6ADP8c4bzZL8RIRDrkEYbLySNtLXUcYNoYN+/3emljBMpd8NaBDmyF0HI43zhAkOFL 3fBLDPANBDgGfnf6ha5vGYXPMc0IGg2nXXQ+dBTBitFbAm/dsoXKqyseYswm/f2ErX6Q DUlINtVILmvS1+wQ/vshZqfiUEUUjWbYmkp4U6LunJYa196LP7wAIKMNAOuCdpZihcp+ eMNA== 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 k12si19948386jan.9.2019.08.12.10.31.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Aug 2019 10:31:49 -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 1hxE9h-0006vt-8I; Mon, 12 Aug 2019 17:30:49 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxE9f-0006tg-RC for xen-devel@lists.xenproject.org; Mon, 12 Aug 2019 17:30:47 +0000 X-Inumbo-ID: ebaaf76d-bd26-11e9-8980-bc764e045a96 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id ebaaf76d-bd26-11e9-8980-bc764e045a96; Mon, 12 Aug 2019 17:30:47 +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 223711715; Mon, 12 Aug 2019 10:30:47 -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 70C5A3F706; Mon, 12 Aug 2019 10:30:46 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 12 Aug 2019 18:30:13 +0100 Message-Id: <20190812173019.11956-23-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 22/28] xen/arm32: head: Rework and document launch() 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" Boot CPU and secondary CPUs will use different entry point to C code. At the moment, the decision on which entry to use is taken within launch(). In order to avoid using conditional instruction and make the call clearer, launch() is reworked to take in parameters the entry point and its arguments. Lastly, document the behavior and the main registers usage within the function. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v3: - Add Stefano's reviewed-by Changes in v2: - Patch added --- xen/arch/arm/arm32/head.S | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index ee5c3d2af8..3c18037575 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -174,6 +174,11 @@ primary_switched: /* Use a virtual address to access the UART. */ mov_w r11, EARLY_UART_VIRTUAL_ADDRESS #endif + PRINT("- Ready -\r\n") + /* Setup the arguments for start_xen and jump to C world */ + mov r0, r10 /* r0 := Physical offset */ + mov r1, r8 /* r1 := paddr(FDT) */ + ldr r2, =start_xen b launch ENDPROC(start) @@ -238,6 +243,9 @@ secondary_switched: /* Use a virtual address to access the UART. */ mov_w r11, EARLY_UART_VIRTUAL_ADDRESS #endif + PRINT("- Ready -\r\n") + /* Jump to C world */ + ldr r2, =start_secondary b launch ENDPROC(init_secondary) @@ -583,19 +591,25 @@ setup_fixmap: mov pc, lr ENDPROC(setup_fixmap) +/* + * Setup the initial stack and jump to the C world + * + * Inputs: + * r0 : Argument 0 of the C function to call + * r1 : Argument 1 of the C function to call + * r2 : C entry point + * + * Clobbers r3 + */ launch: - PRINT("- Ready -\r\n") - - ldr r0, =init_data - add r0, #INITINFO_stack /* Find the boot-time stack */ - ldr sp, [r0] + ldr r3, =init_data + add r3, #INITINFO_stack /* Find the boot-time stack */ + ldr sp, [r3] add sp, #STACK_SIZE /* (which grows down from the top). */ sub sp, #CPUINFO_sizeof /* Make room for CPU save record */ - teq r12, #0 - moveq r0, r10 /* Marshal args: - phys_offset */ - moveq r1, r8 /* - DTB address */ - beq start_xen /* and disappear into the land of C */ - b start_secondary /* (to the appropriate entry point) */ + + /* Jump to C world */ + bx r2 ENDPROC(launch) /* Fail-stop */