From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: Jordan Niethe <jniethe5@gmail.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/3] powerpc/bpf: Use helper for mapping bpf to ppc registers on PPC64
Date: Fri, 07 Jan 2022 22:55:37 +0530 [thread overview]
Message-ID: <1641575636.et67byesmr.naveen@linux.ibm.com> (raw)
In-Reply-To: <20210727065539.299598-2-jniethe5@gmail.com>
Jordan Niethe wrote:
> Prepare for doing commit 40272035e1d0 ("powerpc/bpf: Reallocate BPF
> registers to volatile registers when possible on PPC32") on PPC64 in a
> later patch. Instead of directly accessing the const b2p[] array for
> mapping bpf to ppc registers use bpf_to_ppc() which allows per struct
> codegen_context mappings.
>
> Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
> ---
> arch/powerpc/net/bpf_jit.h | 5 ++
> arch/powerpc/net/bpf_jit64.h | 30 +++++-----
> arch/powerpc/net/bpf_jit_comp32.c | 5 --
> arch/powerpc/net/bpf_jit_comp64.c | 96 ++++++++++++++++---------------
> 4 files changed, 71 insertions(+), 65 deletions(-)
>
> diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
> index 99fad093f43e..db86fa37f1dd 100644
> --- a/arch/powerpc/net/bpf_jit.h
> +++ b/arch/powerpc/net/bpf_jit.h
> @@ -172,6 +172,11 @@ void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx);
> void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx);
> void bpf_jit_realloc_regs(struct codegen_context *ctx);
>
> +static inline int bpf_to_ppc(struct codegen_context *ctx, int reg)
> +{
> + return ctx->b2p[reg];
> +}
> +
> #endif
You are following what has been done on ppc32 here, but since ctx is
almost always available where b2p[] is used, I'm thinking it might be
simpler to convert it into a macro:
#define b2p(i) ctx->cb2p[i]
We will just need to rename the global b2p array, as well as the one in
codegen_context. Everywhere else, it will be a simple b2p[] -> b2p()
change.
- Naveen
next prev parent reply other threads:[~2022-01-07 17:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 6:55 [PATCH 1/3] powerpc64/bpf: Store temp registers' bpf to ppc mapping Jordan Niethe
2021-07-27 6:55 ` [PATCH 2/3] powerpc/bpf: Use helper for mapping bpf to ppc registers on PPC64 Jordan Niethe
2022-01-07 17:25 ` Naveen N. Rao [this message]
2021-07-27 6:55 ` [PATCH 3/3] powerpc/bpf: Reallocate BPF registers to volatile registers when possible " Jordan Niethe
2021-08-05 8:21 ` Christophe Leroy
2022-01-07 17:58 ` Naveen N. Rao
2022-02-22 14:23 ` Christophe Leroy
2022-03-02 16:40 ` Naveen N. Rao
2022-01-07 17:13 ` [PATCH 1/3] powerpc64/bpf: Store temp registers' bpf to ppc mapping Naveen N. Rao
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=1641575636.et67byesmr.naveen@linux.ibm.com \
--to=naveen.n.rao@linux.vnet.ibm.com \
--cc=jniethe5@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).