All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>
Subject: Re: [PATCH for-4.20 2/3] RISCV/asm: Use CALL rather than JAL
Date: Mon, 10 Feb 2025 09:57:45 +0100	[thread overview]
Message-ID: <f434e5a7-756f-4d7b-8e0a-bcd5a924a285@gmail.com> (raw)
In-Reply-To: <20250207220122.380214-3-andrew.cooper3@citrix.com>

[-- Attachment #1: Type: text/plain, Size: 3203 bytes --]


On 2/7/25 11:01 PM, Andrew Cooper wrote:
> JAL has a maximium displacement of 2M.  To branch further, it needs pairing
> with an AUIPC instruction.  CALL is a pseudo-op which allows the linker to
> pick the appropriate sequence while processing relaxations.
>
> This avoids a build failure of the form:
>
>    prelink.o: in function `start':
>    xen/xen/arch/riscv/riscv64/head.S:28:(.text.header+0x2c):
>    relocation truncated to fit: R_RISCV_JAL against symbol `calc_phys_offset' defined in .init.text section in prelink.o
>    make[3]: *** [arch/riscv/Makefile:18: xen-syms] Error 1
>
> when Xen gets large enough, e.g. with CONFIG_UBSAN enabled.
>
> Signed-off-by: Andrew Cooper<andrew.cooper3@citrix.com>

LGTM: Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>

Thanks.

~ Oleksii

> ---
> CC: Oleksii Kurochko<oleksii.kurochko@gmail.com>
> CC: Anthony PERARD<anthony.perard@vates.tech>
> CC: Michal Orzel<michal.orzel@amd.com>
> CC: Jan Beulich<jbeulich@suse.com>
> CC: Julien Grall<julien@xen.org>
> CC: Roger Pau Monné<roger.pau@citrix.com>
> CC: Stefano Stabellini<sstabellini@kernel.org>
> ---
>   xen/arch/riscv/entry.S        |  2 +-
>   xen/arch/riscv/riscv64/head.S | 12 ++++++------
>   2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/xen/arch/riscv/entry.S b/xen/arch/riscv/entry.S
> index bf974655f8b3..4db818ba8d24 100644
> --- a/xen/arch/riscv/entry.S
> +++ b/xen/arch/riscv/entry.S
> @@ -49,7 +49,7 @@ save_to_stack:
>           REG_S   t0, CPU_USER_REGS_SSTATUS(sp)
>   
>           mv      a0, sp
> -        jal     do_trap
> +        call    do_trap
>   
>   restore_registers:
>           /* Restore stack_cpu_regs */
> diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
> index 2a1b3dad9191..9c40512e612e 100644
> --- a/xen/arch/riscv/riscv64/head.S
> +++ b/xen/arch/riscv/riscv64/head.S
> @@ -28,7 +28,7 @@ FUNC(start)
>           add     t3, t3, __SIZEOF_POINTER__
>           bltu    t3, t4, .L_clear_bss
>   
> -        jal     reset_stack
> +        call    reset_stack
>   
>           /*
>            * save hart_id ( bootcpu_id ) and dtb_base as a0 and a1 register can
> @@ -37,16 +37,16 @@ FUNC(start)
>           mv      s0, a0
>           mv      s1, a1
>   
> -        jal     calc_phys_offset
> +        call    calc_phys_offset
>           mv      s2, a0
>   
> -        jal     setup_initial_pagetables
> +        call    setup_initial_pagetables
>   
>           /* Calculate proper VA after jump from 1:1 mapping */
>           la      a0, .L_primary_switched
>           sub     a0, a0, s2
>   
> -        jal     turn_on_mmu
> +        call    turn_on_mmu
>   
>   .L_primary_switched:
>           /*
> @@ -54,11 +54,11 @@ FUNC(start)
>            * recalculated after jump from 1:1 mapping world as 1:1 mapping
>            * will be removed soon in start_xen().
>            */
> -        jal     reset_stack
> +        call    reset_stack
>   
>           /* Xen's boot cpu id is equal to 0 so setup TP register for it */
>           li      a0, 0
> -        jal     setup_tp
> +        call    setup_tp
>   
>           /* restore hart_id ( bootcpu_id ) and dtb address */
>           mv      a0, s0

[-- Attachment #2: Type: text/html, Size: 4273 bytes --]

  reply	other threads:[~2025-02-10  8:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07 22:01 [PATCH for-4.20 0/3] RISCV: Bugfixes and UBSAN Andrew Cooper
2025-02-07 22:01 ` [PATCH for-4.20 1/3] RISCV/boot: Run constructors during setup Andrew Cooper
2025-02-10  8:49   ` Oleksii Kurochko
2025-02-07 22:01 ` [PATCH for-4.20 2/3] RISCV/asm: Use CALL rather than JAL Andrew Cooper
2025-02-10  8:57   ` Oleksii Kurochko [this message]
2025-02-07 22:01 ` [PATCH for-4.20 3/3] RISCV: Activate UBSAN in testing Andrew Cooper
2025-02-08  2:39   ` Stefano Stabellini
2025-02-10  9:03   ` Oleksii Kurochko
2025-02-10 23:39     ` Andrew Cooper
2025-02-10  9:05 ` [PATCH for-4.20 0/3] RISCV: Bugfixes and UBSAN Oleksii Kurochko

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=f434e5a7-756f-4d7b-8e0a-bcd5a924a285@gmail.com \
    --to=oleksii.kurochko@gmail.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.