From patchwork Tue Jun 28 00:38:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 641268 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rdnD24sFNz9s4q for ; Tue, 28 Jun 2016 10:45:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=j7TfivC5; dkim-atps=neutral Received: from localhost ([::1]:33481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHhA0-0004W2-Cl for incoming@patchwork.ozlabs.org; Mon, 27 Jun 2016 20:45:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHh4B-0002gg-1F for qemu-devel@nongnu.org; Mon, 27 Jun 2016 20:39:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHh48-0004O5-Ix for qemu-devel@nongnu.org; Mon, 27 Jun 2016 20:39:49 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:33560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHh48-0004O0-ER for qemu-devel@nongnu.org; Mon, 27 Jun 2016 20:39:48 -0400 Received: by mail-qk0-x242.google.com with SMTP id n132so338539qka.0 for ; Mon, 27 Jun 2016 17:39:48 -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=NCiIiG97QW3+/WcrHMNN1r/WrOy34wEdHyUsRfMj38w=; b=j7TfivC5GsinByL1DH57g2Vb1yjdUma5dBU6wi3A/S8FdPMPDQ8wj83TZFoOf0+Qwu IJOOLFCRJq2ldJUD1nPJPRRqjAl/eXSDpSE5QLgvH7rQYFotfaOLVV0tQjIZohAKG7Vp s4HXtFg9yxCVFoDra//2lolHhN0Jxyad/uCUmbmJMnOYzhirUpA/zj5DfMLK6iFx4OjR nb0FQ/PlHMcajMEVuknHstQtPFsNkd6OsCw/unwwV+x73x5Td8FVAlQsCmhRFOi3ej3u nyXXaUN4w4ucB3dIJHI5FZKYMl8Zue7hOLxxzFRxiLGK7PwkHCVHrJ6SZwpL0MM9WOD4 IJNw== 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=NCiIiG97QW3+/WcrHMNN1r/WrOy34wEdHyUsRfMj38w=; b=ijfz3ZfjUen7MR8ROVoNq+y61IX+NvHDC09+ToRICLXn6H6TE7Y74jQ/Snrur7Jw5O YSGLKg01TVP7Hs84Zuszn/h/czwkva0E9k9279SKM8dXCJrOUZ+ssch3FQQWb1VRTVMg hl+PKEKWacKp+YncHiOReAFwomGiS82hrX2nBueXUn7OfGlzn7GblPwXLh9cwAVrgaCD wzXfL30e3ADlJgpZY8j+k5JRPG+ptYrB0vLimv3tr7dlOeXGK0/vUOEkuOH3B4YfmtJ3 8cq86kuN5Fy4A58RF6p+ML4/sxeeuL6hk/VPrHtGaWLjvzzTgW05xrKK2Py2LOdm4no0 W59g== X-Gm-Message-State: ALyK8tIExiyqsIlKDmPKxMSDP/pE/IDhs5PUsE8eEgegvQsib1WULkU194J/ng/aTPAHjw== X-Received: by 10.55.207.209 with SMTP id v78mr154276qkl.183.1467074387972; Mon, 27 Jun 2016 17:39:47 -0700 (PDT) Received: from bigtime.com (71-37-54-227.tukw.qwest.net. [71.37.54.227]) by smtp.gmail.com with ESMTPSA id 128sm190406qke.10.2016.06.27.17.39.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2016 17:39:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 27 Jun 2016 17:38:52 -0700 Message-Id: <1467074353-26130-4-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1467074353-26130-1-git-send-email-rth@twiddle.net> References: <1467074353-26130-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::242 Subject: [Qemu-devel] [PATCH v4 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. Reviewed-By: Artyom Tarasenko 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 fc220ed..9000e9b 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -5248,7 +5248,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);