[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/3] xen/riscv: read/save hart_id and dtb_base passed by bootloader
- To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Thu, 2 Mar 2023 14:02:42 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VvqA6WQT2Yeg9LN8RGiebZ8QHXq/FrR2euFGk1faUqQ=; b=IQ4Jk41R2AyHykmthc1WhulpftpLnfKIgbNwuNz3MbpLmE/Eu2Gup3v82JLrAPGi13gH13NtkPyM3x9GoFa2/C1u/xYXJH8Ddz0kD3TwxdqkuW1G7C59orxtFZW95nnLnQht7BOTqNzpyBDctR6LDVZuasb8MrzaJM0gyIxN7N42aIV/MDgbTKcB0i5NyvQ+ahj0cafQ1/A+w9M6SUP4WAtDzNUuSAVwNOp1M5zn/SU2Cqut36UlS/fRc0v21+S1Wba18DfYEe0Rs5rqu7HZ0F/Hox6vbIOIF9dgDtd+7+W2LMMQwzbNo1JAh8PiYUercIoh6FuOWZ/VyfNbpml7wA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iCwuhjeAKZfijH6hzmzZUQdCWPQEeErE8oz7T2DF3NqBuX7EKO526evXegLYcFbj0MYYn7IDlPZ7kIDpx5noiXfK05COUVXfUHE0rkev/Hvp0Qh1n55tpHjEmyF0fGOI2iP4jH0A8ZrAJqJ4uZpqeue2j/6lATFp8jS1CIGZqVvbqUq9vuAevspgxW5Va75Qb7oBX2vYNMAhv+QtVRA0km2JeAanj5Ebvg943/psyD7WG61qQ7PkRz91YcmXSCHsUPIolhoY2v/ShYuWXwDZVsX2Q4/eX3QNrab7xi0VgSyRzPu6oMoTOQerS7NOiB4NRCZvn4OEbowzxAl7vdrawg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Jan Beulich <jbeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gianluca Guida <gianluca@xxxxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>
- Delivery-date: Thu, 02 Mar 2023 14:03:10 +0000
- Ironport-data: A9a23:fPucw6P8lknZjX/vrR0QlsFynXyQoLVcMsEvi/4bfWQNrUorhTYFx 2IdWDqPMqyON2OgLohwbYm/8ElSuZfQyddlGwto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQAOKnUoYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9SuvLrRC9H5qyo42tD5gZmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0sBSB2Bot vUjEh4qQDOC3NCEzJSGa8A506zPLOGzVG8ekldJ6GiBSNwAHtXESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+vJxujCCpOBy+OGF3N79U9qGX8hK2G2fo XrL5T/RCRAGLt2PjzGC9xpAg8eezHqrBtlJTtVU8NZbmGzOnVYNByYIVFKm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S1rdN2Gyj2MSaAtAnWu4NjD8ATgMy4eFOrC1zNdLkWqbrhnx1FaferH8 paO/ptcorexCXVaMF0NjbFKupvwEklIbwoU+kAKiKzS+LwW/rXX7/gAYDuDYuoNwoYcUXCJV ZGdATPBax7nzKWsznD8VTsZ08=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 02/03/2023 1:23 pm, Oleksii Kurochko wrote:
> diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
> index ffd95f9f89..851b4691a5 100644
> --- a/xen/arch/riscv/riscv64/head.S
> +++ b/xen/arch/riscv/riscv64/head.S
> @@ -6,8 +7,31 @@ ENTRY(start)
> /* Mask all interrupts */
> csrw CSR_SIE, zero
>
> + /* Save HART ID and DTB base */
> + lla a6, _bootcpu_id
> + REG_S a0, (a6)
> + lla a6, _dtb_base
> + REG_S a1, (a6)
> +
> la sp, cpu0_boot_stack
> li t0, STACK_SIZE
> add sp, sp, t0
>
> + lla a6, _bootcpu_id
> + REG_L a0, (a6)
> + lla a6, _dtb_base
> + REG_L a1, (a6)
This is overkill.
Put a comment at start identifying which parameters are in which
registers, and just make sure not to clobber them - RISCV has plenty of
registers.
Right now, we don't touch the a registers at all, which is why your v1
patch worked. (a0 and a1 still have the same value when we get into C).
If we do need to start calling more complex things here (and I'm not
sure that we do), we could either store the parameters in s2-11, or
spill them onto the stack; both of which are preferable to spilling to
global variables like this.
> +
> tail start_xen
> +
> + /*
> + * Boot cpu id is passed by a bootloader
> + */
> +_bootcpu_id:
> + RISCV_PTR 0x0
Just a note (as you want to delete this anyway), this isn't a PTR, it's
a LONG.
> +
> + /*
> + * DTB base is passed by a bootloader
> + */
> +_dtb_base:
> + RISCV_PTR 0x0
> diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
> index 1c87899e8e..d9723fe1c0 100644
> --- a/xen/arch/riscv/setup.c
> +++ b/xen/arch/riscv/setup.c
> @@ -7,7 +7,8 @@
> unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
> __aligned(STACK_SIZE);
>
> -void __init noreturn start_xen(void)
> +void __init noreturn start_xen(unsigned long bootcpu_id,
> + unsigned long dtb_base)
To be clear, this change should be this hunk exactly as it is, and a
comment immediately ahead of ENTRY(start) describing the entry ABI.
There is no need currently to change any of the asm code.
~Andrew
|