From patchwork Wed Jan 18 22:38:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9524917 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 068FB601B7 for ; Wed, 18 Jan 2017 23:00:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB4EF27C7A for ; Wed, 18 Jan 2017 23:00:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC16A285E7; Wed, 18 Jan 2017 23:00:24 +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 5368E27C7A for ; Wed, 18 Jan 2017 23:00:24 +0000 (UTC) Received: from localhost ([::1]:44879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTzDK-00070p-R7 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Jan 2017 18:00:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTytM-0006kl-07 for qemu-devel@nongnu.org; Wed, 18 Jan 2017 17:39:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTytK-0002t2-KC for qemu-devel@nongnu.org; Wed, 18 Jan 2017 17:39:44 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34327) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cTytK-0002sX-Aj for qemu-devel@nongnu.org; Wed, 18 Jan 2017 17:39:42 -0500 Received: by mail-wm0-x244.google.com with SMTP id c85so7558355wmi.1 for ; Wed, 18 Jan 2017 14:39:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cTvR506pE3qwYZaSIsQkvG9RRokeCv9NzehxUFbF0D8=; b=EJWA5BoV1hZ1uG1RgNrjy4hIO9P0pVfNN/wj8NDpIJtNaBWUCx/Em8mgwMUTncZP+k yXdu1rhJqgwRjIExcK2lqX5cwL88WwKRd5DmGnzqQG/rp464WYCz65LMKoJ7GN0BroAA +hKbcB1FsQ7dwDGr9WsBvIVN96sGUmpU/ZJ2vSCbcTl6Tz4mnmK6wiIM6ysVuYVXiW/z 4+YoF+Ab7jLya6SNoapTqSHBSm9ECwbjSuHhp4mO6vau0aGd6Yyg9el++JRW6baa9IMr WXxCF2m33oLoEMYKwPw/Gd6lfGhB+A/KHLZZ3eA379CkfholNQJnCMjbqR5Rc0l7nWZt z2YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cTvR506pE3qwYZaSIsQkvG9RRokeCv9NzehxUFbF0D8=; b=n8nxFApJYmV7PZpiTt3ymnJB3mYyqZPbAeQTIRvqppO7gTIpJtFU2AKRkC2TYau5Nw x9roZCeAzfg5BoesSLqGArqFDmMSstVw1Rwotm1uhBpIM7mF8hEP2ZQeULnXctbTK2Fo fMvgD5zkfWi1u9rJGM78y95nw4AL7pxlAcckdL7HIrRM8zg2cRMTRam/IGlAxio+7fvX Q7e4KOM9pd4hxkH2vN3TjTZZ2M8JUuy/VxsibCNkUsPj1zB/QgoIBcw/LbadoMGdl0id GQbdDcUhEjtqFLH4U6OFbMS6bI6aS3f45P4nCGP6/7FdZeUPXDXoe0Kc6lV+7/gA+U7y 3/pQ== X-Gm-Message-State: AIkVDXJUU2gJ3I26hfJUt83DPuo8HER4jau3L6M6iEEvTmP3MYi/ZPTHnbGhWWC/XD9hIw== X-Received: by 10.223.167.130 with SMTP id j2mr4735285wrc.154.1484779181296; Wed, 18 Jan 2017 14:39:41 -0800 (PST) Received: from localhost (x4e33e2b8.dyn.telefonica.de. [78.51.226.184]) by smtp.gmail.com with ESMTPSA id f76sm7956001wmd.15.2017.01.18.14.39.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2017 14:39:40 -0800 (PST) From: Artyom Tarasenko To: peter.maydell@linaro.org Date: Wed, 18 Jan 2017 23:38:32 +0100 Message-Id: <1484779123-18968-20-git-send-email-atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1484779123-18968-1-git-send-email-atar4qemu@gmail.com> References: <1484779123-18968-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] [PULL 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@ilande.co.uk, qemu-devel@nongnu.org, Artyom Tarasenko , rth@twiddle.net 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 c1d5eb4..94a636f 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 53afa18..c92bd25 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 */ @@ -457,35 +472,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 029120d..a96b031 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -1483,7 +1483,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; @@ -1514,7 +1514,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]); } @@ -1548,7 +1548,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: @@ -1591,7 +1591,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,