From: David Gibson <david@gibson.dropbear.id.au>
To: Lucas Mateus Martins Araujo e Castro <lucas.araujo@eldorado.org.br>
Cc: qemu-devel@nongnu.org, luis.pires@eldorado.org.br,
fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org,
matheus.ferst@eldorado.org.br
Subject: Re: [RFC PATCH 2/4] target/ppc: divided mmu_helper.c in 2 files
Date: Thu, 10 Jun 2021 15:32:10 +1000 [thread overview]
Message-ID: <YMGj2oz12mFSGibL@yekko> (raw)
In-Reply-To: <e0aac42a-21e3-928a-b18c-39f55d132af9@eldorado.org.br>
[-- Attachment #1: Type: text/plain, Size: 4235 bytes --]
On Mon, Jun 07, 2021 at 03:35:06PM -0300, Lucas Mateus Martins Araujo e Castro wrote:
>
> On 06/06/2021 23:31, David Gibson wrote:
> > On Wed, Jun 02, 2021 at 04:26:02PM -0300, Lucas Mateus Castro (alqotel) wrote:
> > > Moved functions in mmu_helper.c that should be compiled in build to
> > > mmu_common.c, moved declaration of functions that both files use to
> > > cpu.h and moved struct declarations and inline functions needed by
> > > both to target/ppc/internal.h. Updated meson.build to compile the
> > > new file.
> > >
> > > Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
> > > ---
> > > Had to turn a few functions non static as it was used by both
> > > mmu_common.c and mmu_helper.c. Added the declaration of mmu_ctx_t to
> > > cpu.h so functions there can reference it and added the definition to
> > > internal.h so functions in both mmu_* files can access it.
> > > And maybe the tlb functions should be declared in internal.h instead of
> > > cpu.h.
> > > ---
> > > target/ppc/cpu.h | 35 +
> > > target/ppc/internal.h | 26 +
> > > target/ppc/meson.build | 6 +-
> > > target/ppc/mmu_common.c | 1606 ++++++++++++++++++++++++++++++++++
> > > target/ppc/mmu_helper.c | 1814 +++------------------------------------
> > > 5 files changed, 1774 insertions(+), 1713 deletions(-)
> > > create mode 100644 target/ppc/mmu_common.c
> > >
> > > diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> > > index b0934d9be4..cfc35ef83e 100644
> > > --- a/target/ppc/cpu.h
> > > +++ b/target/ppc/cpu.h
> > > @@ -1329,6 +1329,41 @@ void store_booke_tsr(CPUPPCState *env, target_ulong val);
> > > void ppc_tlb_invalidate_all(CPUPPCState *env);
> > > void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr);
> > > void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp);
> > > +
> > > +typedef struct mmu_ctx_t mmu_ctx_t;
> > > +int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
> > > + hwaddr *raddrp,
> > > + target_ulong address, uint32_t pid, int ext,
> > > + int i);
> > > +int get_physical_address_wtlb(CPUPPCState *env, mmu_ctx_t *ctx,
> > > + target_ulong eaddr,
> > > + MMUAccessType access_type, int type,
> > > + int mmu_idx);
> > > +hwaddr booke206_tlb_to_page_size(CPUPPCState *env,
> > > + ppcmas_tlb_t *tlb);
> > > +int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb,
> > > + hwaddr *raddrp, target_ulong address,
> > > + uint32_t pid);
> > > +int get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
> > > + target_ulong eaddr, MMUAccessType access_type,
> > > + int type);
> > > +static inline int ppc6xx_tlb_getnum(CPUPPCState *env, target_ulong eaddr,
> > > + int way, int is_code)
> > > +{
> > > + int nr;
> > > +
> > > + /* Select TLB num in a way from address */
> > > + nr = (eaddr >> TARGET_PAGE_BITS) & (env->tlb_per_way - 1);
> > > + /* Select TLB way */
> > > + nr += env->tlb_per_way * way;
> > > + /* 6xx have separate TLBs for instructions and data */
> > > + if (is_code && env->id_tlbs == 1) {
> > > + nr += env->nb_tlb;
> > > + }
> > > +
> > > + return nr;
> > > +}
> > This is a rather complex and model specific function to have inline in
> > a header.
> What is the best way to deal with this function? It's used by both
> mmu_helper.c and mmu_common.c so I put it there as a way to keep it being an
> inline function, so it would be best to put it in target/ppc/internal.h or
> maybe just turn it into a not inline function?
There's no good reason for this to be inline. Just put it in
mmu_common.c and export.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-06-10 6:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 19:26 [RFC PATCH 0/4] target/ppc: mmu cleanup Lucas Mateus Castro (alqotel)
2021-06-02 19:26 ` [RFC PATCH 1/4] target/ppc: Don't compile ppc_tlb_invalid_all without TCG Lucas Mateus Castro (alqotel)
2021-06-02 20:54 ` Fabiano Rosas
2021-06-07 2:28 ` David Gibson
2021-06-02 19:26 ` [RFC PATCH 2/4] target/ppc: divided mmu_helper.c in 2 files Lucas Mateus Castro (alqotel)
2021-06-07 2:31 ` David Gibson
2021-06-07 18:35 ` Lucas Mateus Martins Araujo e Castro
2021-06-10 5:32 ` David Gibson [this message]
2021-06-02 19:26 ` [RFC PATCH 3/4] target/ppc: moved ppc_store_sdr1 to mmu_common.c Lucas Mateus Castro (alqotel)
2021-06-07 2:32 ` David Gibson
2021-06-02 19:26 ` [RFC PATCH 4/4] target/ppc: Moved helpers to mmu_helper.c Lucas Mateus Castro (alqotel)
2021-06-07 2:34 ` David Gibson
2021-06-09 14:13 ` [RFC PATCH 0/4] target/ppc: mmu cleanup no-reply
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=YMGj2oz12mFSGibL@yekko \
--to=david@gibson.dropbear.id.au \
--cc=fernando.valle@eldorado.org.br \
--cc=lucas.araujo@eldorado.org.br \
--cc=luis.pires@eldorado.org.br \
--cc=matheus.ferst@eldorado.org.br \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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.