From patchwork Mon Jul 22 21:39:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 169461 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8013699ilk; Mon, 22 Jul 2019 14:43:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSqzaZClkeYl1H/CwrHWBi4ZF4tXbCG+N0QZlk4SpXojtPsDiMkz5W9BLfYi5D0mjwbwS/ X-Received: by 2002:a5e:9e42:: with SMTP id j2mr70953212ioq.133.1563831786705; Mon, 22 Jul 2019 14:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563831786; cv=none; d=google.com; s=arc-20160816; b=hIJNAsXvvAQp+csrX45yT5wgpINuQ+ycsf6/rHGPmg+lK9Na9sl0/59hWMcRl61CVF pNqTfnb9QKBwf7dLy/RU6o3FXDi91fW3GoNgrZWeWDP+6rrxnVPhxHs9eXuArJXHNUHU NhxP8NsxArwId/Ej6Ofa0/qhMg+JQaET56b+19RZ0plvY2QEGzpI79O5KHWxeeBznjfa vm8StYJbtPyRL7vMtxxsLNy0KYiisOpR1peE6/qLyQv0iNKqUoNA2ZFeXrahiepE5YGq u8Wa1YvqU2DIrNIo0YPhxlZtD8sFC8v9r7qFkyYvqUKEzGz1DMvZ76hyLVBTZDTaLF1v /7eQ== 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=Geqm5qW5jXfHQLBeqqIa43haMdeJ2G24/7A6JRTCq7g=; b=B0lu6Dn4R3Mh6GdIRHIxIpfSgJXmbQG0sghHLqGa0aYeZJzjs5LjILoZZ4RL6w1U4+ Dk5eZ2GZbSObRtru/a9R4XR1LWdUYJIkGQbchuwGKHSb7zCqqQT3px0nMfkylgiMk2Vw DNb9MF276IyuZ6Egv/+jNGwZbPJIjhpBczq13UTqaybnwNOFQSCERfCiAGnVSqLrzRKf l94r8Bi5HO0pnJAN3GcPo5+uofmBh4sdQEXwfQkT2Wwzw7oAcNIZPu6dUAv1W8XnLUjk +BjDEzFEwCKWjf3B/C02LaPJnTEroDXJY3Yd0qcaw4zLH6hehVgKJUuZ55mnub4jKUHx mBfg== 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 i9si56265765jam.38.2019.07.22.14.43.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2019 14:43: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 1hpg34-0003bm-OX; Mon, 22 Jul 2019 21:40:46 +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 1hpg2v-0003FY-KM for xen-devel@lists.xenproject.org; Mon, 22 Jul 2019 21:40:37 +0000 X-Inumbo-ID: 56e18d9c-acc9-11e9-a3cc-5319c96131f2 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 56e18d9c-acc9-11e9-a3cc-5319c96131f2; Mon, 22 Jul 2019 21:40:35 +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 7D1291597; Mon, 22 Jul 2019 14:40:35 -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 CB1EA3F71F; Mon, 22 Jul 2019 14:40:34 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Jul 2019 22:39:56 +0100 Message-Id: <20190722213958.5761-34-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 33/35] 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 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 e0f8c2e0cb..6d55a2119a 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -170,6 +170,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) @@ -234,6 +239,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) @@ -578,19 +586,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 */