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 6/7] target/ppc: Change ppcemb_tlb_check() to return bool
Date: Thu, 1 Jun 2023 10:39:50 +0200	[thread overview]
Message-ID: <bd9b6f7d-a837-0086-3c77-e1c88dca7de8@kaod.org> (raw)
In-Reply-To: <bacd1bcbe99c07930c29a9815915da9ac75f6920.1685448535.git.balaton@eik.bme.hu>

On 5/30/23 15:28, BALATON Zoltan wrote:
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>


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

Thanks,

C.


> ---
>   target/ppc/mmu_common.c | 26 +++++++++++++-------------
>   1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c
> index ff7f987546..bd7d7d5257 100644
> --- a/target/ppc/mmu_common.c
> +++ b/target/ppc/mmu_common.c
> @@ -489,15 +489,15 @@ static int get_segment_6xx_tlb(CPUPPCState *env, mmu_ctx_t *ctx,
>   }
>   
>   /* Generic TLB check function for embedded PowerPC implementations */
> -static int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
> -                            hwaddr *raddrp,
> -                            target_ulong address, uint32_t pid, int i)
> +static bool ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
> +                             hwaddr *raddrp,
> +                             target_ulong address, uint32_t pid, int i)
>   {
>       target_ulong mask;
>   
>       /* Check valid flag */
>       if (!(tlb->prot & PAGE_VALID)) {
> -        return -1;
> +        return false;
>       }
>       mask = ~(tlb->size - 1);
>       qemu_log_mask(CPU_LOG_MMU, "%s: TLB %d address " TARGET_FMT_lx
> @@ -506,14 +506,14 @@ static int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
>                     mask, (uint32_t)tlb->PID, tlb->prot);
>       /* Check PID */
>       if (tlb->PID != 0 && tlb->PID != pid) {
> -        return -1;
> +        return false;
>       }
>       /* Check effective address */
>       if ((address & mask) != tlb->EPN) {
> -        return -1;
> +        return false;
>       }
>       *raddrp = (tlb->RPN & mask) | (address & ~mask);
> -    return 0;
> +    return true;
>   }
>   
>   /* Generic TLB search function for PowerPC embedded implementations */
> @@ -525,7 +525,7 @@ int ppcemb_tlb_search(CPUPPCState *env, target_ulong address, uint32_t pid)
>   
>       for (i = 0; i < env->nb_tlb; i++) {
>           tlb = &env->tlb.tlbe[i];
> -        if (ppcemb_tlb_check(env, tlb, &raddr, address, pid, i) == 0) {
> +        if (ppcemb_tlb_check(env, tlb, &raddr, address, pid, i)) {
>               return i;
>           }
>       }
> @@ -545,8 +545,8 @@ static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
>       pr = FIELD_EX64(env->msr, MSR, PR);
>       for (i = 0; i < env->nb_tlb; i++) {
>           tlb = &env->tlb.tlbe[i];
> -        if (ppcemb_tlb_check(env, tlb, &raddr, address,
> -                             env->spr[SPR_40x_PID], i) < 0) {
> +        if (!ppcemb_tlb_check(env, tlb, &raddr, address,
> +                              env->spr[SPR_40x_PID], i)) {
>               continue;
>           }
>           zsel = (tlb->attr >> 4) & 0xF;
> @@ -608,7 +608,7 @@ static int mmubooke_check_tlb(CPUPPCState *env, ppcemb_tlb_t *tlb,
>       int prot2;
>   
>       if (ppcemb_tlb_check(env, tlb, raddr, address,
> -                         env->spr[SPR_BOOKE_PID], i) >= 0) {
> +                         env->spr[SPR_BOOKE_PID], i)) {
>           if (!env->nb_pids) {
>               /* Extend the physical address to 36 bits */
>               *raddr |= (uint64_t)(tlb->RPN & 0xF) << 32;
> @@ -618,13 +618,13 @@ static int mmubooke_check_tlb(CPUPPCState *env, ppcemb_tlb_t *tlb,
>   
>       if (env->spr[SPR_BOOKE_PID1] &&
>           ppcemb_tlb_check(env, tlb, raddr, address,
> -                         env->spr[SPR_BOOKE_PID1], i) >= 0) {
> +                         env->spr[SPR_BOOKE_PID1], i)) {
>           goto found_tlb;
>       }
>   
>       if (env->spr[SPR_BOOKE_PID2] &&
>           ppcemb_tlb_check(env, tlb, raddr, address,
> -                         env->spr[SPR_BOOKE_PID2], i) >= 0) {
> +                         env->spr[SPR_BOOKE_PID2], i)) {
>           goto found_tlb;
>       }
>   



  reply	other threads:[~2023-06-01  8:41 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
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 [this message]
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=bd9b6f7d-a837-0086-3c77-e1c88dca7de8@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.