From patchwork Thu Jun 2 05:56:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9149135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6C4D660467 for ; Thu, 2 Jun 2016 06:03:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F5B42654B for ; Thu, 2 Jun 2016 06:03:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 531B9269DA; Thu, 2 Jun 2016 06:03:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B86972654B for ; Thu, 2 Jun 2016 06:03:04 +0000 (UTC) Received: from localhost ([::1]:45357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8Lih-000872-P9 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 02 Jun 2016 02:03:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8Ldr-0004Kw-6M for qemu-devel@nongnu.org; Thu, 02 Jun 2016 01:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8Ldk-00035y-28 for qemu-devel@nongnu.org; Thu, 02 Jun 2016 01:58:02 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:33525) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8Ldj-00035q-Uh for qemu-devel@nongnu.org; Thu, 02 Jun 2016 01:57:56 -0400 Received: by mail-qk0-x244.google.com with SMTP id q184so4325854qkf.0 for ; Wed, 01 Jun 2016 22:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=46VrKCRlcorz2tp+ucczEBeeUr61oOPZazxxsPJZT40=; b=fAeTPzUer0hfHdfV0eRc61T9xBzXL4/GEUgK9H84NqD0UFkFATGZ3XiqCfyAVwaqhj +RBhDerZIUK7+Hsd8PrEtnq49BYLiZXpffqKoQipZjsKiHhWpzOG85dhSm8YtOK29hYW rXigS9lQJxq3wFPbfEJe9GUU+A9/pFc2UCVR8hP+fQ7UydmF8WIso1UvPMAs0Tpx+y6N vUu8V5Ee/8YcRHHrP0xWFnHGgOR9aEuu/rKfou2+WYBawH40M238w84jXAExLpa2I2nB qiPHKZfy4aMkItel9sl4g4GZdGNqWrqf+AKMuZu4pBBCrlE4UalupVWDuwVIW0XcpJcs A88w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=46VrKCRlcorz2tp+ucczEBeeUr61oOPZazxxsPJZT40=; b=kfDyaR+3m4GwhXwRhY02IUYr2yvzYgm4nwgiCfHR1FadfU5kmhF/8Nl1F2byUJZrqy 84onxJalvtxeGWhAECVxZvJbRINPjXBXTIrSExkonwkJYm6sgTq42oDdK5VUVOmEnVFK MQkh2LR320jct249OSFF/+lakLqyS7SE5KWHRlsRkt/0VVJ3U9imMEwJ9xG9TEBs6f2d trSIUdVD7xtXF2hfyLV6hawMMNZSh2ItAlhx3AgPHY8/a3Yxnjz5wFHnuP9AmuKENsfl SHBV0sGjB2A0HK45N2fwe6eqTrZMUWDN6FrjXIdtBM5jygyvxfnM5mbgYvh9QljSVhCZ vj+w== X-Gm-Message-State: ALyK8tK68xt41iwlnY2sYupMNXIsS4GKrWxHZAATmsGtF5jM6oaDXAsKhz+zC3S8wx/ffA== X-Received: by 10.55.17.134 with SMTP id 6mr42085442qkr.207.1464847075469; Wed, 01 Jun 2016 22:57:55 -0700 (PDT) Received: from anchor.com (71-37-54-227.tukw.qwest.net. [71.37.54.227]) by smtp.gmail.com with ESMTPSA id b10sm11631835qta.3.2016.06.01.22.57.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jun 2016 22:57:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 1 Jun 2016 22:56:59 -0700 Message-Id: <1464847040-22536-4-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464847040-22536-1-git-send-email-rth@twiddle.net> References: <1464847040-22536-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PATCH v3 03/24] target-sparc: Store mmu index in TB flags 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: mark.cave-ayland@ilande.co.uk, atar4qemu@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Doing this instead of saving the raw PS_PRIV and TL. This means that all nucleus mode TBs (TL > 0) can be shared. This fixes a bug in that we didn't include HS_PRIV in the TB flags, and so could produce incorrect TB matches for hypervisor state. The LSU and DMMU states were unused by the translator. Including them in TB flags meant unnecessary mismatches from tb_find_fast. Signed-off-by: Richard Henderson --- target-sparc/cpu.h | 26 ++++++++++++-------------- target-sparc/translate.c | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index ba37f4b..31ea65b 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -720,34 +720,32 @@ void cpu_tick_set_limit(CPUTimer *timer, uint64_t limit); trap_state* cpu_tsptr(CPUSPARCState* env); #endif -#define TB_FLAG_FPU_ENABLED (1 << 4) -#define TB_FLAG_AM_ENABLED (1 << 5) +#define TB_FLAG_MMU_MASK 7 +#define TB_FLAG_FPU_ENABLED (1 << 4) +#define TB_FLAG_AM_ENABLED (1 << 5) static inline void cpu_get_tb_cpu_state(CPUSPARCState *env, target_ulong *pc, - target_ulong *cs_base, uint32_t *flags) + target_ulong *cs_base, uint32_t *pflags) { + uint32_t flags; *pc = env->pc; *cs_base = env->npc; + flags = cpu_mmu_index(env, false); #ifdef TARGET_SPARC64 - // AM . Combined FPU enable bits . PRIV . DMMU enabled . IMMU enabled - *flags = (env->pstate & PS_PRIV) /* 2 */ - | ((env->lsu & (DMMU_E | IMMU_E)) >> 2) /* 1, 0 */ - | ((env->tl & 0xff) << 8) - | (env->dmmu.mmu_primary_context << 16); /* 16... */ if (env->pstate & PS_AM) { - *flags |= TB_FLAG_AM_ENABLED; + flags |= TB_FLAG_AM_ENABLED; } - if ((env->def->features & CPU_FEATURE_FLOAT) && (env->pstate & PS_PEF) + if ((env->def->features & CPU_FEATURE_FLOAT) + && (env->pstate & PS_PEF) && (env->fprs & FPRS_FEF)) { - *flags |= TB_FLAG_FPU_ENABLED; + flags |= TB_FLAG_FPU_ENABLED; } #else - // FPU enable . Supervisor - *flags = env->psrs; if ((env->def->features & CPU_FEATURE_FLOAT) && env->psref) { - *flags |= TB_FLAG_FPU_ENABLED; + flags |= TB_FLAG_FPU_ENABLED; } #endif + *pflags = flags; } static inline bool tb_fpu_enabled(int tb_flags) diff --git a/target-sparc/translate.c b/target-sparc/translate.c index bfeef35..fb3938a 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -5245,7 +5245,7 @@ void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb) last_pc = dc->pc; dc->npc = (target_ulong) tb->cs_base; dc->cc_op = CC_OP_DYNAMIC; - dc->mem_idx = cpu_mmu_index(env, false); + dc->mem_idx = tb->flags & TB_FLAG_MMU_MASK; dc->def = env->def; dc->fpu_enabled = tb_fpu_enabled(tb->flags); dc->address_mask_32bit = tb_am_enabled(tb->flags);