All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: BALATON Zoltan <balaton@eik.bme.hu>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: Greg Kurz <groug@kaod.org>,
	Daniel Henrique Barboza <danielhb413@gmail.com>
Subject: Re: [PATCH 3/7] target/ppc: Move ppcemb_tlb_search() to mmu_common.c
Date: Thu, 1 Jun 2023 10:39:27 +0200	[thread overview]
Message-ID: <2cacf6ae-6a05-d885-2d28-bab96ab32bf6@kaod.org> (raw)
In-Reply-To: <b64fd712a773558dea9b84945c57785546c0ae2e.1685448535.git.balaton@eik.bme.hu>

On 5/30/23 15:28, BALATON Zoltan wrote:
> This function is the only reason why ppcemb_tlb_check() is not static
> to mmu_common.c but it also better fits in mmu_common.c so move it
> there.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

> ---
>   target/ppc/cpu.h        |  4 +---
>   target/ppc/mmu_common.c | 22 +++++++++++++++++++++-
>   target/ppc/mmu_helper.c | 21 ---------------------
>   3 files changed, 22 insertions(+), 25 deletions(-)
> 
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index 5cd1b442b4..77eb5edea2 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -1428,9 +1428,7 @@ void cpu_ppc_set_vhyp(PowerPCCPU *cpu, PPCVirtualHypervisor *vhyp);
>   int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb,
>                               hwaddr *raddrp, target_ulong address,
>                               uint32_t pid);
> -int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
> -                            hwaddr *raddrp,
> -                            target_ulong address, uint32_t pid, int i);
> +int ppcemb_tlb_search(CPUPPCState *env, target_ulong address, uint32_t pid);
>   hwaddr booke206_tlb_to_page_size(CPUPPCState *env,
>                                           ppcmas_tlb_t *tlb);
>   #endif
> diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c
> index 21a353c51a..845eee4c6f 100644
> --- a/target/ppc/mmu_common.c
> +++ b/target/ppc/mmu_common.c
> @@ -489,7 +489,7 @@ static int get_segment_6xx_tlb(CPUPPCState *env, mmu_ctx_t *ctx,
>   }
>   
>   /* Generic TLB check function for embedded PowerPC implementations */
> -int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
> +static int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
>                               hwaddr *raddrp,
>                               target_ulong address, uint32_t pid, int i)
>   {
> @@ -516,6 +516,26 @@ int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
>       return 0;
>   }
>   
> +/* Generic TLB search function for PowerPC embedded implementations */
> +int ppcemb_tlb_search(CPUPPCState *env, target_ulong address, uint32_t pid)
> +{
> +    ppcemb_tlb_t *tlb;
> +    hwaddr raddr;
> +    int i, ret;
> +
> +    /* Default return value is no match */
> +    ret = -1;
> +    for (i = 0; i < env->nb_tlb; i++) {
> +        tlb = &env->tlb.tlbe[i];
> +        if (ppcemb_tlb_check(env, tlb, &raddr, address, pid, i) == 0) {
> +            ret = i;
> +            break;
> +        }
> +    }
> +
> +    return ret;
> +}
> +
>   static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
>                                          target_ulong address,
>                                          MMUAccessType access_type)
> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> index e7275eaec1..d3ea7588f9 100644
> --- a/target/ppc/mmu_helper.c
> +++ b/target/ppc/mmu_helper.c
> @@ -112,27 +112,6 @@ static void ppc6xx_tlb_store(CPUPPCState *env, target_ulong EPN, int way,
>       env->last_way = way;
>   }
>   
> -/* Generic TLB search function for PowerPC embedded implementations */
> -static int ppcemb_tlb_search(CPUPPCState *env, target_ulong address,
> -                             uint32_t pid)
> -{
> -    ppcemb_tlb_t *tlb;
> -    hwaddr raddr;
> -    int i, ret;
> -
> -    /* Default return value is no match */
> -    ret = -1;
> -    for (i = 0; i < env->nb_tlb; i++) {
> -        tlb = &env->tlb.tlbe[i];
> -        if (ppcemb_tlb_check(env, tlb, &raddr, address, pid, i) == 0) {
> -            ret = i;
> -            break;
> -        }
> -    }
> -
> -    return ret;
> -}
> -
>   /* Helpers specific to PowerPC 40x implementations */
>   static inline void ppc4xx_tlb_invalidate_all(CPUPPCState *env)
>   {



  reply	other threads:[~2023-06-01  8:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 13:28 [PATCH 0/7] Embedded PPC misc clean up and optimisation BALATON Zoltan
2023-05-30 13:28 ` [PATCH 1/7] target/ppc: Remove single use function BALATON Zoltan
2023-06-01  8:39   ` Cédric Le Goater
2023-05-30 13:28 ` [PATCH 2/7] target/ppc: Remove "ext" parameter of ppcemb_tlb_check() BALATON Zoltan
2023-06-01  8:39   ` Cédric Le Goater
2023-05-30 13:28 ` [PATCH 3/7] target/ppc: Move ppcemb_tlb_search() to mmu_common.c BALATON Zoltan
2023-06-01  8:39   ` Cédric Le Goater [this message]
2023-05-30 13:28 ` [PATCH 4/7] target/ppc: Remove some unneded line breaks BALATON Zoltan
2023-06-01  8:39   ` Cédric Le Goater
2023-05-30 13:28 ` [PATCH 5/7] target/ppc: Simplify ppcemb_tlb_search() BALATON Zoltan
2023-06-01  8:39   ` Cédric Le Goater
2023-05-30 13:28 ` [PATCH 6/7] target/ppc: Change ppcemb_tlb_check() to return bool BALATON Zoltan
2023-06-01  8:39   ` Cédric Le Goater
2023-05-30 13:28 ` [PATCH 7/7] target/ppc: Eliminate goto in mmubooke_check_tlb() BALATON Zoltan
2023-06-05 13:37   ` Daniel Henrique Barboza
2023-06-05 13:37 ` [PATCH 0/7] Embedded PPC misc clean up and optimisation Daniel Henrique Barboza

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=2cacf6ae-6a05-d885-2d28-bab96ab32bf6@kaod.org \
    --to=clg@kaod.org \
    --cc=balaton@eik.bme.hu \
    --cc=danielhb413@gmail.com \
    --cc=groug@kaod.org \
    --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.