mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Jones <ajones@ventanamicro.com>
To: "Clément Léger" <cleger@rivosinc.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Anup Patel <anup@brainfault.org>,
	Atish Patra <atishp@atishpatra.org>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, kvm-riscv@lists.infradead.org
Subject: Re: [PATCH 2/5] riscv: Use SYM_*() assembly macros instead of deprecated ones
Date: Mon, 23 Oct 2023 11:59:07 +0200	[thread overview]
Message-ID: <20231023-136cad6e15a2c5c27b6176af@orel> (raw)
In-Reply-To: <20231004143054.482091-3-cleger@rivosinc.com>

On Wed, Oct 04, 2023 at 04:30:51PM +0200, Clément Léger wrote:
...
> diff --git a/arch/riscv/lib/memmove.S b/arch/riscv/lib/memmove.S
> index 1930b388c3a0..5130033e3e02 100644
> --- a/arch/riscv/lib/memmove.S
> +++ b/arch/riscv/lib/memmove.S
> @@ -7,7 +7,6 @@
>  #include <asm/asm.h>
>  
>  SYM_FUNC_START(__memmove)
> -SYM_FUNC_START_WEAK(memmove)
>  	/*
>  	 * Returns
>  	 *   a0 - dest
> @@ -314,5 +313,6 @@ SYM_FUNC_START_WEAK(memmove)
>  
>  SYM_FUNC_END(memmove)

Should this one above be removed?

>  SYM_FUNC_END(__memmove)
> +SYM_FUNC_ALIAS_WEAK(memmove, __memmove)
>  SYM_FUNC_ALIAS(__pi_memmove, __memmove)
>  SYM_FUNC_ALIAS(__pi___memmove, __memmove)
> diff --git a/arch/riscv/lib/memset.S b/arch/riscv/lib/memset.S
> index 34c5360c6705..35f358e70bdb 100644
> --- a/arch/riscv/lib/memset.S
> +++ b/arch/riscv/lib/memset.S
> @@ -8,8 +8,7 @@
>  #include <asm/asm.h>
>  
>  /* void *memset(void *, int, size_t) */
> -ENTRY(__memset)
> -WEAK(memset)
> +SYM_FUNC_START(__memset)
>  	move t0, a0  /* Preserve return value */
>  
>  	/* Defer to byte-oriented fill for small sizes */
> @@ -110,4 +109,5 @@ WEAK(memset)
>  	bltu t0, a3, 5b
>  6:
>  	ret
> -END(__memset)
> +SYM_FUNC_END(__memset)
> +SYM_FUNC_ALIAS_WEAK(memset, __memset)
> diff --git a/arch/riscv/lib/uaccess.S b/arch/riscv/lib/uaccess.S
> index 09b47ebacf2e..3ab438f30d13 100644
> --- a/arch/riscv/lib/uaccess.S
> +++ b/arch/riscv/lib/uaccess.S
> @@ -10,8 +10,7 @@
>  	_asm_extable	100b, \lbl
>  	.endm
>  
> -ENTRY(__asm_copy_to_user)
> -ENTRY(__asm_copy_from_user)
> +SYM_FUNC_START(__asm_copy_to_user)
>  
>  	/* Enable access to user memory */
>  	li t6, SR_SUM
> @@ -181,13 +180,13 @@ ENTRY(__asm_copy_from_user)
>  	csrc CSR_STATUS, t6
>  	sub a0, t5, a0
>  	ret
> -ENDPROC(__asm_copy_to_user)
> -ENDPROC(__asm_copy_from_user)
> +SYM_FUNC_END(__asm_copy_to_user)
>  EXPORT_SYMBOL(__asm_copy_to_user)
> +SYM_FUNC_ALIAS(__asm_copy_from_user, __asm_copy_to_user)

IIUC, we'll only have debug information for __asm_copy_to_user. I'm not
sure what that means for debugging. Is it possible to generate something
confusing?

>  EXPORT_SYMBOL(__asm_copy_from_user)
>  
>  
> -ENTRY(__clear_user)
> +SYM_FUNC_START(__clear_user)
>  
>  	/* Enable access to user memory */
>  	li t6, SR_SUM
> @@ -233,5 +232,5 @@ ENTRY(__clear_user)
>  	csrc CSR_STATUS, t6
>  	sub a0, a3, a0
>  	ret
> -ENDPROC(__clear_user)
> +SYM_FUNC_END(__clear_user)
>  EXPORT_SYMBOL(__clear_user)
> diff --git a/arch/riscv/purgatory/entry.S b/arch/riscv/purgatory/entry.S
> index 0194f4554130..7befa276fb01 100644
> --- a/arch/riscv/purgatory/entry.S
> +++ b/arch/riscv/purgatory/entry.S
> @@ -7,15 +7,11 @@
>   * Author: Li Zhengyu (lizhengyu3@huawei.com)
>   *
>   */
> -
> -.macro	size, sym:req
> -	.size \sym, . - \sym
> -.endm
> +#include <linux/linkage.h>
>  
>  .text
>  
> -.globl purgatory_start
> -purgatory_start:
> +SYM_CODE_START(purgatory_start)
>  
>  	lla	sp, .Lstack
>  	mv	s0, a0	/* The hartid of the current hart */
> @@ -28,8 +24,7 @@ purgatory_start:
>  	mv	a1, s1
>  	ld	a2, riscv_kernel_entry
>  	jr	a2
> -
> -size purgatory_start
> +SYM_CODE_END(purgatory_start)
>  
>  .align 4
>  	.rept	256
> @@ -39,9 +34,8 @@ size purgatory_start
>  
>  .data
>  
> -.globl riscv_kernel_entry
> -riscv_kernel_entry:
> +SYM_DATA_START(riscv_kernel_entry)
>  	.quad	0
> -size riscv_kernel_entry
> +SYM_DATA_END(riscv_kernel_entry)

I think we could also use the shorthand version for this one-liner.

SYM_DATA(riscv_kernel_entry, quad 0)

Thanks,
drew

  reply	other threads:[~2023-10-23  9:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04 14:30 [PATCH 0/5] riscv: cleanup assembly usage of ENTRY()/END() and use local labels Clément Léger
2023-10-04 14:30 ` [PATCH 1/5] riscv: use ".L" local labels in assembly when applicable Clément Léger
2023-10-23  9:59   ` Andrew Jones
2023-10-04 14:30 ` [PATCH 2/5] riscv: Use SYM_*() assembly macros instead of deprecated ones Clément Léger
2023-10-23  9:59   ` Andrew Jones [this message]
2023-10-23 10:08     ` Clément Léger
2023-10-04 14:30 ` [PATCH 3/5] riscv: kernel: Use correct SYM_DATA_*() macro for data Clément Léger
2023-10-23 10:03   ` Andrew Jones
2023-10-04 14:30 ` [PATCH 4/5] riscv: kvm: Use SYM_*() assembly macros instead of deprecated ones Clément Léger
2023-10-23 10:03   ` Andrew Jones
2023-10-04 14:30 ` [PATCH 5/5] riscv: kvm: use ".L" local labels in assembly when applicable Clément Léger
2023-10-23 10:03   ` Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231023-136cad6e15a2c5c27b6176af@orel \
    --to=ajones@ventanamicro.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atishp@atishpatra.org \
    --cc=cleger@rivosinc.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®