From patchwork Fri Nov 4 20:50:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9413301 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 A102D6022E for ; Fri, 4 Nov 2016 21:13:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 924E72B09D for ; Fri, 4 Nov 2016 21:13:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86DC12B0BA; Fri, 4 Nov 2016 21:13:47 +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 0D7D32B09D for ; Fri, 4 Nov 2016 21:13:47 +0000 (UTC) Received: from localhost ([::1]:40815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2lo2-0002tt-7X for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 Nov 2016 17:13:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2lSi-00015G-NH for qemu-devel@nongnu.org; Fri, 04 Nov 2016 16:51:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2lSh-0004I9-FW for qemu-devel@nongnu.org; Fri, 04 Nov 2016 16:51:44 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35943) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c2lSh-0004H5-6h for qemu-devel@nongnu.org; Fri, 04 Nov 2016 16:51:43 -0400 Received: by mail-wm0-x244.google.com with SMTP id c17so5606700wmc.3 for ; Fri, 04 Nov 2016 13:51:43 -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 :in-reply-to:references; bh=yYJVhfIa5rQ1p8xJyVehQf41lc1ASC760ufftUAqynk=; b=UX3+MyMArbnBlw8gmownGT+9FlZS4oh+VGA5q4Zj3xHtS7SuT/msLvooiAkUo9JYGM KRlTqWcPZ/O0ZQNkQcA/mxmxtAsJoQ8RnutGMySQbuD6dgP2HqQTgESwyU4Z6NN41MHz HifMqq6RxeHmYgVxboNqTSNWlFY284r10Qg/X1pCryvhrn1SZL6U9k032G7VyuXm5x6e TOHek1ig5ZeB1aXx2kFy6SLJPtEaswKKyXiFzy6LIIO0UB0ejJmT4FMhcTrzWtWuuJAZ NDh24PzJpFUnZdC7o3XxLSbbj7+btKrtf2UuDf8hWUIICflimToXA+5JajZbyLd6MUpC 8GcA== 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:in-reply-to:references; bh=yYJVhfIa5rQ1p8xJyVehQf41lc1ASC760ufftUAqynk=; b=DLhg1oThDiOcg1/0FO6QeRFN3ksfweEUsSBh3J3Qy/3uFWwVO1LsbU59rTAgFKeVxF Pc6YHxr597c3oY8Fnigb1LHcsp+w73/kXGqVpPYg9Mk8JlXAkD0kLPdfbYfSUPqSTCO7 tQCqJ02Z+z6wXh2oKx3LMHHCoGPNUWM62Sa+uwq/erPvB85bFbWlub4qh1PAzcfGPmDO Y+LNRNo5Of/xz+LHpiFk/4CAndFabea3xRNHsbJHH65FYoEznSBz+RBRj8Mod4WnuEbw skSRwC2cwRMK0F2tIovf79iugguxJOUFlx+0IQyHQvvIEjGnYNlmak80BWa23yCn97cF bi+w== X-Gm-Message-State: ABUngveQx5oeyCLtEvnPxUQ7rpHjpxdR9+uBKt/jr/ODXgjL6gGdTMc7eIl3yXfjYn0I0w== X-Received: by 10.194.5.137 with SMTP id s9mr16682391wjs.133.1478292702096; Fri, 04 Nov 2016 13:51:42 -0700 (PDT) Received: from localhost (x55b4b5cf.dyn.telefonica.de. [85.180.181.207]) by smtp.gmail.com with ESMTPSA id m194sm6472789wmg.11.2016.11.04.13.51.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Nov 2016 13:51:41 -0700 (PDT) From: Artyom Tarasenko To: qemu-devel@nongnu.org Date: Fri, 4 Nov 2016 21:50:20 +0100 Message-Id: <8b72c1655b808991c513714c0b42b065f041a7e8.1478291230.git.atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: 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 v1 19/30] target-sparc: use SparcV9MMU type for sparc64 I/D-MMUs 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 Signed-off-by: Artyom Tarasenko --- linux-user/main.c | 2 +- target-sparc/cpu.h | 48 +++++++++++++++++----------------------------- target-sparc/ldst_helper.c | 8 ++++---- target-sparc/machine.c | 4 ++-- 4 files changed, 25 insertions(+), 37 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 75b199f..cd56f2a 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1166,7 +1166,7 @@ void cpu_loop (CPUSPARCState *env) /* XXX: check env->error_code */ info.si_code = TARGET_SEGV_MAPERR; if (trapnr == TT_DFAULT) - info._sifields._sigfault._addr = env->dmmuregs[4]; + info._sifields._sigfault._addr = env->dmmu.mmuregs[4]; else info._sifields._sigfault._addr = cpu_tsptr(env)->tpc; queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 6fc81e8..8ce7197 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -404,7 +404,22 @@ struct CPUTimer typedef struct CPUTimer CPUTimer; typedef struct CPUSPARCState CPUSPARCState; - +#if defined(TARGET_SPARC64) +typedef union { + uint64_t mmuregs[16]; + struct { + uint64_t tsb_tag_target; + uint64_t mmu_primary_context; + uint64_t mmu_secondary_context; + uint64_t sfsr; + uint64_t sfar; + uint64_t tsb; + uint64_t tag_access; + uint64_t virtual_watchpoint; + uint64_t physical_watchpoint; + }; +} SparcV9MMU; +#endif struct CPUSPARCState { target_ulong gregs[8]; /* general registers */ target_ulong *regwptr; /* pointer to current register window */ @@ -454,35 +469,8 @@ struct CPUSPARCState { uint64_t lsu; #define DMMU_E 0x8 #define IMMU_E 0x4 - //typedef struct SparcMMU - union { - uint64_t immuregs[16]; - struct { - uint64_t tsb_tag_target; - uint64_t unused_mmu_primary_context; // use DMMU - uint64_t unused_mmu_secondary_context; // use DMMU - uint64_t sfsr; - uint64_t sfar; - uint64_t tsb; - uint64_t tag_access; - uint64_t virtual_watchpoint; - uint64_t physical_watchpoint; - } immu; - }; - union { - uint64_t dmmuregs[16]; - struct { - uint64_t tsb_tag_target; - uint64_t mmu_primary_context; - uint64_t mmu_secondary_context; - uint64_t sfsr; - uint64_t sfar; - uint64_t tsb; - uint64_t tag_access; - uint64_t virtual_watchpoint; - uint64_t physical_watchpoint; - } dmmu; - }; + SparcV9MMU immu; + SparcV9MMU dmmu; SparcTLBEntry itlb[64]; SparcTLBEntry dtlb[64]; uint32_t mmu_version; diff --git a/target-sparc/ldst_helper.c b/target-sparc/ldst_helper.c index 8cc8bb1..8e01260 100644 --- a/target-sparc/ldst_helper.c +++ b/target-sparc/ldst_helper.c @@ -1481,7 +1481,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, int reg = (addr >> 3) & 0xf; uint64_t oldreg; - oldreg = env->immuregs[reg]; + oldreg = env->immu.mmuregs[reg]; switch (reg) { case 0: /* RO */ return; @@ -1512,7 +1512,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, break; } - if (oldreg != env->immuregs[reg]) { + if (oldreg != env->immu.mmuregs[reg]) { DPRINTF_MMU("immu change reg[%d]: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", reg, oldreg, env->immuregs[reg]); } @@ -1546,7 +1546,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, int reg = (addr >> 3) & 0xf; uint64_t oldreg; - oldreg = env->dmmuregs[reg]; + oldreg = env->dmmu.mmuregs[reg]; switch (reg) { case 0: /* RO */ case 4: @@ -1589,7 +1589,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, break; } - if (oldreg != env->dmmuregs[reg]) { + if (oldreg != env->dmmu.mmuregs[reg]) { DPRINTF_MMU("dmmu change reg[%d]: 0x%016" PRIx64 " -> 0x%016" PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]); } diff --git a/target-sparc/machine.c b/target-sparc/machine.c index aea6397..39e262c 100644 --- a/target-sparc/machine.c +++ b/target-sparc/machine.c @@ -148,8 +148,8 @@ const VMStateDescription vmstate_sparc_cpu = { VMSTATE_UINT64_ARRAY(env.mmubpregs, SPARCCPU, 4), #else VMSTATE_UINT64(env.lsu, SPARCCPU), - VMSTATE_UINT64_ARRAY(env.immuregs, SPARCCPU, 16), - VMSTATE_UINT64_ARRAY(env.dmmuregs, SPARCCPU, 16), + VMSTATE_UINT64_ARRAY(env.immu.mmuregs, SPARCCPU, 16), + VMSTATE_UINT64_ARRAY(env.dmmu.mmuregs, SPARCCPU, 16), VMSTATE_STRUCT_ARRAY(env.itlb, SPARCCPU, 64, 0, vmstate_tlb_entry, SparcTLBEntry), VMSTATE_STRUCT_ARRAY(env.dtlb, SPARCCPU, 64, 0,