From nobody Thu Nov 6 19:08:53 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1488343865297903.6736275356074; Tue, 28 Feb 2017 20:51:05 -0800 (PST) Received: from localhost ([::1]:38361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciwEB-0004Y5-H7 for importer@patchew.org; Tue, 28 Feb 2017 23:51:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciw7l-0007yV-Gj for qemu-devel@nongnu.org; Tue, 28 Feb 2017 23:44:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciw7j-0008W6-Cq for qemu-devel@nongnu.org; Tue, 28 Feb 2017 23:44:25 -0500 Received: from ozlabs.org ([103.22.144.67]:33689) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ciw7i-0008U6-VK; Tue, 28 Feb 2017 23:44:23 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 3vY2sR6cdNz9sNm; Wed, 1 Mar 2017 15:44:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1488343451; bh=DPdRpLCFXPYzeW8+rXS5CucvOgakdkzEZAbM6ppiX4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abF2a8JcPGrIFHZei/m6g47j/4B7079aIjbo/vPiqjjp0VOBld6BfXp2KzCzn69a6 ZC45W2j+sxfCfksGia0GafClOyRKSZzkz6fIT15KzDPOerrV/KUl3zo2ExDJQ6BKyu kuA8Wv0VMCHpN1hXs5LnmkzC8opOPT2kQdaLBOy8= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 1 Mar 2017 15:43:29 +1100 Message-Id: <20170301044405.1792-15-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170301044405.1792-1-david@gibson.dropbear.id.au> References: <20170301044405.1792-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 14/50] target/ppc: Remove the function ppc_hash64_set_sdr1() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-ppc@nongnu.org, Suraj Jitindar Singh , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suraj Jitindar Singh The function ppc_hash64_set_sdr1 basically checked the htabsize and set an error if it was too big, otherwise it just stored the value in SPR_SDR1. Given that the only function which calls ppc_hash64_set_sdr1() is ppc_store_sdr1(), why not handle the checking in ppc_store_sdr1() to avoid the extra function call. Note that ppc_store_sdr1() already stores the value in SPR_SDR1 anyway, so we were doing it twice. Signed-off-by: Suraj Jitindar Singh [dwg: Remove unnecessary error temporary] Signed-off-by: David Gibson --- target/ppc/mmu-hash64.c | 18 ------------------ target/ppc/mmu-hash64.h | 3 --- target/ppc/mmu_helper.c | 11 +++++------ 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 8fe0e78..d44f2bb 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -289,24 +289,6 @@ target_ulong helper_load_slb_vsid(CPUPPCState *env, ta= rget_ulong rb) return rt; } =20 -/* - * 64-bit hash table MMU handling - */ -void ppc_hash64_set_sdr1(PowerPCCPU *cpu, target_ulong value, - Error **errp) -{ - CPUPPCState *env =3D &cpu->env; - target_ulong htabsize =3D value & SDR_64_HTABSIZE; - - if (htabsize > 28) { - error_setg(errp, - "Invalid HTABSIZE 0x" TARGET_FMT_lx" stored in SDR1", - htabsize); - return; - } - env->spr[SPR_SDR1] =3D value; -} - static int ppc_hash64_pte_prot(PowerPCCPU *cpu, ppc_slb_t *slb, ppc_hash_pte64_t pte) { diff --git a/target/ppc/mmu-hash64.h b/target/ppc/mmu-hash64.h index c8d3458..9c74823 100644 --- a/target/ppc/mmu-hash64.h +++ b/target/ppc/mmu-hash64.h @@ -109,9 +109,6 @@ static inline hwaddr ppc_hash64_hpt_mask(PowerPCCPU *cp= u) return (1ULL << ((cpu->env.spr[SPR_SDR1] & SDR_64_HTABSIZE) + 18 - 7))= - 1; } =20 -void ppc_hash64_set_sdr1(PowerPCCPU *cpu, target_ulong value, - Error **errp); - struct ppc_hash_pte64 { uint64_t pte0, pte1; }; diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index 0176ab6..3bc8030 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -28,6 +28,7 @@ #include "exec/cpu_ldst.h" #include "exec/log.h" #include "helper_regs.h" +#include "qemu/error-report.h" =20 //#define DEBUG_MMU //#define DEBUG_BATS @@ -2006,13 +2007,11 @@ void ppc_store_sdr1(CPUPPCState *env, target_ulong = value) assert(!cpu->vhyp); #if defined(TARGET_PPC64) if (env->mmu_model & POWERPC_MMU_64) { - PowerPCCPU *cpu =3D ppc_env_get_cpu(env); - Error *local_err =3D NULL; + target_ulong htabsize =3D value & SDR_64_HTABSIZE; =20 - ppc_hash64_set_sdr1(cpu, value, &local_err); - if (local_err) { - error_report_err(local_err); - error_free(local_err); + if (htabsize > 28) { + error_report("Invalid HTABSIZE 0x" TARGET_FMT_lx" stored in SD= R1", + htabsize); return; } } --=20 2.9.3