From patchwork Sat Oct 1 10:05:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9359183 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 420FE607D6 for ; Sat, 1 Oct 2016 10:45:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28C3728D74 for ; Sat, 1 Oct 2016 10:45:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1ABD029478; Sat, 1 Oct 2016 10:45:38 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 7C37928D74 for ; Sat, 1 Oct 2016 10:45:37 +0000 (UTC) Received: from localhost ([::1]:55147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqHnU-0003wR-B6 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Oct 2016 06:45:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqHCw-0006k2-WF for qemu-devel@nongnu.org; Sat, 01 Oct 2016 06:07:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqHCs-0007vC-IF for qemu-devel@nongnu.org; Sat, 01 Oct 2016 06:07:49 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34456) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqHCs-0007uu-7y for qemu-devel@nongnu.org; Sat, 01 Oct 2016 06:07:46 -0400 Received: by mail-wm0-x244.google.com with SMTP id b201so1582858wmb.1 for ; Sat, 01 Oct 2016 03:07:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=u2l7Z4df+216QHZPHuma4bgg/mJnPcd85iUCLcaIQRo=; b=S0F6+wV8e5KvFlSNVrdREP4PUekb0ccKlfCitZJuyGU1NdPTHsTpEaIH8LGr126830 0ckBA6zAvMUe4ecvE62OYuSBIrESE7FXaDf+sjQtHJQx38Pvyz+k2IkILdISIZf8n0uk VUr3XIES6Fp71vkmW65iouwz4zLFq0LcP0hEIME675VfPr7BZvjNrZeXxgXVxJAnPh1K +DdIhRT13PLBsQNHRvNHLH9V1F4Sw/SqeAuVEoVSDIGvpiSxdsykIaQWD/Y8Ztud2/dJ j2sPz9/cgScnKK7gbQODzfZIHWvzTP61XjcKIy/DIQA3s1J6aZ/3F47v9saQVzx2qJoe pfjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u2l7Z4df+216QHZPHuma4bgg/mJnPcd85iUCLcaIQRo=; b=Os2YEzsN5DdsEUUYGlF//NLTN4mkonSSnx/Jp6m7kM/HR4OMENOp0aIWsJ3l6wEpAF mBEUnO1Hzd9h3hHJ3mqMZs7wjEq0U1+OJ4i+7iEluQNGa1a8G+gtn+6ajZIFqes3X/5v 72fzOkm0bVOK+OCFaFOtUERO2kpkfrtC40e7B8MVvzCK4vw+8ZWMcHnCDASkYZ9NxPD9 vs0e0C+bAoX+78PQ9BQZw5gbVBGziwEpI+KxB8haZ1qnlqDatwl8VVrOZ/q4znGZFTxH aVs9Rf4uFHfshLrrOXA1loXfbonPTmAOmqAS5By9QruA4Lx3o2z/6Jg0etWE9be1h4zx QCeA== X-Gm-Message-State: AA6/9RllaWUVwHn1nlLtx4pALFxAiVHvYewfpMdLy2o7/lpjv/x9I5LvHdjK+M53Ko/sFQ== X-Received: by 10.28.151.68 with SMTP id z65mr1644283wmd.5.1475316465524; Sat, 01 Oct 2016 03:07:45 -0700 (PDT) Received: from localhost (x55b4da19.dyn.telefonica.de. [85.180.218.25]) by smtp.gmail.com with ESMTPSA id w9sm23759752wjf.47.2016.10.01.03.07.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Oct 2016 03:07:44 -0700 (PDT) From: Artyom Tarasenko To: qemu-devel@nongnu.org Date: Sat, 1 Oct 2016 12:05:30 +0200 Message-Id: <1475316333-9776-27-git-send-email-atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1475316333-9776-1-git-send-email-atar4qemu@gmail.com> References: <1475316333-9776-1-git-send-email-atar4qemu@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH 26/29] target-sparc: store the UA2005 entries in sun4u format 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 , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP According to chapter 13.3 of the UltraSPARC T1 Supplement to the UltraSPARC Architecture 2005, only the sun4u format is available for data-access loads. Store UA2005 entries in the sun4u format to simplify processing. Signed-off-by: Artyom Tarasenko --- target-sparc/ldst_helper.c | 51 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c index efdbabc..e267195 100644 --- a/target-sparc/ldst_helper.c +++ b/target-sparc/ldst_helper.c @@ -204,12 +204,33 @@ static void demap_tlb(SparcTLBEntry *tlb, target_ulong demap_addr, } } +static uint64_t sun4v_tte_to_sun4u(CPUSPARCState *env, uint64_t tag, + uint64_t sun4v_tte) +{ + uint64_t sun4u_tte; + if (!(cpu_has_hypervisor(env) && (tag & TLB_UST1_IS_SUN4V_BIT))) { + /* is already in the sun4u format */ + return sun4v_tte; + } + sun4u_tte = TTE_PA(sun4v_tte) | (sun4v_tte & TTE_VALID_BIT); + sun4u_tte |= (sun4v_tte & 3ULL) << 61; + sun4u_tte |= (sun4v_tte & TTE_NFO_BIT_UA2005) >> 2; + sun4u_tte |= (sun4v_tte & TTE_USED_BIT_UA2005) >> 6; + sun4u_tte |= (sun4v_tte & TTE_W_OK_BIT_UA2005) >> 5; + sun4u_tte |= (sun4v_tte & TTE_SIDEEFFECT_BIT_UA2005) >> 8; + sun4u_tte |= (sun4v_tte & TTE_PRIV_BIT_UA2005) >> 6; + sun4u_tte |= (sun4v_tte & TTE_LOCKED_BIT_UA2005) >> 55; + return sun4u_tte; +} + static void replace_tlb_1bit_lru(SparcTLBEntry *tlb, uint64_t tlb_tag, uint64_t tlb_tte, - const char *strmmu, CPUSPARCState *env1) + const char *strmmu, CPUSPARCState *env1, + uint64_t addr) { unsigned int i, replace_used; + tlb_tte = sun4v_tte_to_sun4u(env1, addr, tlb_tte); if (cpu_has_hypervisor(env1)) { uint64_t new_vaddr = tlb_tag & ~0x1fffULL; uint64_t new_size = 1024ULL * (8 << 3 * TTE_PGSIZE(tlb_tte)); @@ -2075,7 +2096,11 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, return; } case ASI_ITLB_DATA_IN: /* I-MMU data in */ - replace_tlb_1bit_lru(env->itlb, env->immu.tag_access, val, "immu", env); + /* ignore real translation entries */ + if (!(addr & TLB_UST1_IS_REAL_BIT)) { + replace_tlb_1bit_lru(env->itlb, env->immu.tag_access, + val, "immu", env, addr); + } return; case ASI_ITLB_DATA_ACCESS: /* I-MMU data access */ { @@ -2083,8 +2108,11 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, unsigned int i = (addr >> 3) & 0x3f; - replace_tlb_entry(&env->itlb[i], env->immu.tag_access, val, env); - + /* ignore real translation entries */ + if (!(addr & TLB_UST1_IS_REAL_BIT)) { + replace_tlb_entry(&env->itlb[i], env->immu.tag_access, + sun4v_tte_to_sun4u(env, addr, val), env); + } #ifdef DEBUG_MMU DPRINTF_MMU("immu data access replaced entry [%i]\n", i); dump_mmu(stdout, fprintf, env); @@ -2152,14 +2180,21 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, return; } case ASI_DTLB_DATA_IN: /* D-MMU data in */ - replace_tlb_1bit_lru(env->dtlb, env->dmmu.tag_access, val, "dmmu", env); - return; + /* ignore real translation entries */ + if (!(addr & TLB_UST1_IS_REAL_BIT)) { + replace_tlb_1bit_lru(env->dtlb, env->dmmu.tag_access, + val, "dmmu", env, addr); + } + return; case ASI_DTLB_DATA_ACCESS: /* D-MMU data access */ { unsigned int i = (addr >> 3) & 0x3f; - replace_tlb_entry(&env->dtlb[i], env->dmmu.tag_access, val, env); - + /* ignore real translation entries */ + if (!(addr & TLB_UST1_IS_REAL_BIT)) { + replace_tlb_entry(&env->dtlb[i], env->dmmu.tag_access, + sun4v_tte_to_sun4u(env, addr, val), env); + } #ifdef DEBUG_MMU DPRINTF_MMU("dmmu data access replaced entry [%i]\n", i); dump_mmu(stdout, fprintf, env);