public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Jason Baron <jbaron@akamai.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Naveen N Rao <naveen@kernel.org>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 2/4] objtool/powerpc: Add support for decoding all types of uncond branches
Date: Wed, 4 Dec 2024 08:09:33 -0600	[thread overview]
Message-ID: <20241204140933.GV29862@gate.crashing.org> (raw)
In-Reply-To: <0ca71a4b0ac679ea52bd9fdd1f607195d72b499f.1733245362.git.christophe.leroy@csgroup.eu>

On Tue, Dec 03, 2024 at 08:44:50PM +0100, Christophe Leroy wrote:
> Add support for 'bla' instruction.
> 
> This is done by 'flagging' the address as an absolute address so that
> arch_jump_destination() can calculate it as expected. Because code is
> _always_ 4 bytes aligned, use bit 30 as flag.

The AA field already is there, so why not, eh :-)

> Also add support for 'b' and 'ba' instructions. Objtool call them jumps.

> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Reviewed-by: Segher Boessenkool <segher@kewrnel.crashing.org>

> --- a/tools/objtool/arch/powerpc/decode.c
> +++ b/tools/objtool/arch/powerpc/decode.c
> @@ -55,12 +55,15 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec
>  
>  	switch (opcode) {
>  	case 18: /* b[l][a] */
> -		if ((ins & 3) == 1) /* bl */
> +		if (ins & 1)	/* bl[a] */
>  			typ = INSN_CALL;
> +		else		/* b[a] */
> +			typ = INSN_JUMP_UNCONDITIONAL;
>  
>  		imm = ins & 0x3fffffc;
>  		if (imm & 0x2000000)
>  			imm -= 0x4000000;
> +		imm |= ins & 2;	/* AA flag */

You could of course put that together with the 3fffffc thing, but you
can leave that to the compiler as well :-)


Segher

  reply	other threads:[~2024-12-04 14:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 19:44 [PATCH v4 0/4] Implement inline static calls on PPC32 - v4 Christophe Leroy
2024-12-03 19:44 ` [PATCH v4 1/4] static_call_inline: Provide trampoline address when updating sites Christophe Leroy
2024-12-03 19:44 ` [PATCH v4 2/4] objtool/powerpc: Add support for decoding all types of uncond branches Christophe Leroy
2024-12-04 14:09   ` Segher Boessenkool [this message]
2025-02-25  8:05   ` [PATCH v5 " Christophe Leroy
2024-12-03 19:44 ` [PATCH v4 3/4] powerpc: Prepare arch_static_call_transform() for supporting inline static calls Christophe Leroy
2024-12-03 19:44 ` [PATCH v4 4/4] powerpc/static_call: Implement " Christophe Leroy
2024-12-04 20:09   ` kernel test robot
2025-03-02  4:40 ` [PATCH v4 0/4] Implement inline static calls on PPC32 - v4 Madhavan Srinivasan

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=20241204140933.GV29862@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=naveen@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sshegde@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox