Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA3B9C433EF for ; Fri, 4 Feb 2022 13:16:34 +0000 (UTC) Received: from localhost ([::1]:44496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFyS1-0007ya-Id for qemu-devel@archiver.kernel.org; Fri, 04 Feb 2022 08:16:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFy3Z-0005dw-Pm; Fri, 04 Feb 2022 07:51:18 -0500 Received: from [2001:738:2001:2001::2001] (port=26584 helo=zero.eik.bme.hu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFy3W-0007xw-Q5; Fri, 04 Feb 2022 07:51:17 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 5828C745708; Fri, 4 Feb 2022 13:51:09 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 36C5A745706; Fri, 4 Feb 2022 13:51:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 354FE7456E3; Fri, 4 Feb 2022 13:51:09 +0100 (CET) Date: Fri, 4 Feb 2022 13:51:09 +0100 (CET) From: BALATON Zoltan To: Fabiano Rosas Subject: Re: [PATCH 10/11] target/ppc: 6xx: Software TLB exceptions cleanup In-Reply-To: <20220203200957.1434641-11-farosas@linux.ibm.com> Message-ID: <4bb49bac-12a7-b3ae-e719-e257366d15d5@eik.bme.hu> References: <20220203200957.1434641-1-farosas@linux.ibm.com> <20220203200957.1434641-11-farosas@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:738:2001:2001::2001 (failed) Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: danielhb413@gmail.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Thu, 3 Feb 2022, Fabiano Rosas wrote: > This code applies only to the 6xx CPUs, so we can remove the switch > statement. > > Signed-off-by: Fabiano Rosas > --- > target/ppc/excp_helper.c | 31 +++++++++++-------------------- > 1 file changed, 11 insertions(+), 20 deletions(-) > > diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c > index 538905c4dd..80168355bd 100644 > --- a/target/ppc/excp_helper.c > +++ b/target/ppc/excp_helper.c > @@ -553,7 +553,6 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) > { > CPUState *cs = CPU(cpu); > CPUPPCState *env = &cpu->env; > - int excp_model = env->excp_model; > target_ulong msr, new_msr, vector; > int srr0, srr1; > > @@ -695,26 +694,18 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp) > case POWERPC_EXCP_IFTLB: /* Instruction fetch TLB error */ > case POWERPC_EXCP_DLTLB: /* Data load TLB miss */ > case POWERPC_EXCP_DSTLB: /* Data store TLB miss */ > - switch (excp_model) { > - case POWERPC_EXCP_6xx: > - /* Swap temporary saved registers with GPRs */ > - if (!(new_msr & ((target_ulong)1 << MSR_TGPR))) { > - new_msr |= (target_ulong)1 << MSR_TGPR; > - hreg_swap_gpr_tgpr(env); > - } > - /* fall through */ > - case POWERPC_EXCP_7x5: > - ppc_excp_debug_sw_tlb(env, excp); > - > - msr |= env->crf[0] << 28; > - msr |= env->error_code; /* key, D/I, S/L bits */ > - /* Set way using a LRU mechanism */ > - msr |= ((env->last_way + 1) & (env->nb_ways - 1)) << 17; > - break; > - default: > - cpu_abort(cs, "Invalid TLB miss exception\n"); > - break; > + /* Swap temporary saved registers with GPRs */ > + if (!(new_msr & ((target_ulong)1 << MSR_TGPR))) { > + new_msr |= (target_ulong)1 << MSR_TGPR; > + hreg_swap_gpr_tgpr(env); I get this one... > } > + > + ppc_excp_debug_sw_tlb(env, excp); > + > + msr |= env->crf[0] << 28; > + msr |= env->error_code; /* key, D/I, S/L bits */ > + /* Set way using a LRU mechanism */ > + msr |= ((env->last_way + 1) & (env->nb_ways - 1)) << 17; ...but not why this can be moved out from case or if. Is POWERPC_EXCP_7x5 the same as POWERPC_EXCP_6xx now? Regards, BALATON Zoltan > break; > case POWERPC_EXCP_FPA: /* Floating-point assist exception */ > case POWERPC_EXCP_DABR: /* Data address breakpoint */ >