From patchwork Tue May 29 10:50:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 10434999 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 8DE7C603B5 for ; Tue, 29 May 2018 11:10:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DE79286E3 for ; Tue, 29 May 2018 11:10:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F838286EB; Tue, 29 May 2018 11:10: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=-3.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FSL_HELO_FAKE, MAILING_LIST_MULTI, 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 D2A4C286E3 for ; Tue, 29 May 2018 11:10:04 +0000 (UTC) Received: from localhost ([::1]:60186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNcVv-0008Vz-MO for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 May 2018 07:10:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNcDY-0001nT-72 for qemu-devel@nongnu.org; Tue, 29 May 2018 06:51:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNcDU-0004DJ-0V for qemu-devel@nongnu.org; Tue, 29 May 2018 06:51:04 -0400 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]:46349) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNcDT-0004Cb-Pr for qemu-devel@nongnu.org; Tue, 29 May 2018 06:50:59 -0400 Received: by mail-wr0-x22b.google.com with SMTP id v13-v6so13000780wrp.13 for ; Tue, 29 May 2018 03:50:59 -0700 (PDT) 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=MIkh3jvdbvNRVV8XMUmatpJYuuygfFkJjRxlf7IlfKw=; b=VSLOWVMshQQRK9jzxfaa/WnDmEj8Hr4ULDfF92kfzc1UBnSZTP8bMFmWDD9mb4oKft xY9t1hYCYHV+GYgzwSchHsKIfXkAJDw7Dq+3vsQBjGIOcbB4ABjhHHXPBFbbz7SAZYix h4fjtqNDT56sxrfdjAbyYpVpuwdSQ5ZlkLo6kSMqyq37anqog0XzIYhMPtX2LI/YLakU G/aiERv6hBSUKd9fcOSwxzTZEN2eFKe8Ir5kn3DzwnD4AJIxkwDw/N8EAnpvpU9bKXxv ETuwYFni7RxMQ7kJqz37oVuTm3e6wItOyaJs5zrBQIrQWknZ6hyxNacEx6+Co9a19tlO xoJA== 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=MIkh3jvdbvNRVV8XMUmatpJYuuygfFkJjRxlf7IlfKw=; b=OK9HDYQz4T7gsif0ftp8r6R3e8rMyj21nt1TM95Qnpc6h0gC++I1aJ7yo8JMi+bVI9 N97mmrPidInDL+B+jYYy1uo90EitNWwSD0KWVZ/G5rMZWe+sIvll+jPF9yiTbUp5bYnd 8lcRQdBiY7zg7GnOChA6+aHajl+lnzBMsgPswADFzfXSruZh7HFI5wuPbCy9y+XHUwU6 k9G2TKgu5wCPH06Rxft0sZN04g53RPgwSHtD3EFoe0nQ/qB/mkAv5IH6FWXSudcZl1aF +0JstcEyCbkI1LxUEDt8tot4nX2ZIfviGQG6qjsXFAEwP3eFvUegwSZgnvH4DJvUP0DY k8Dg== X-Gm-Message-State: ALKqPweSCoDkM5GoroEAVeBTyuTVash4XUgduyNKJE4ywQ0b4m418IoT V6jhB6kMPThURT8I53H2kdnJsg== X-Google-Smtp-Source: ADUXVKJC00/jFa4udpqV4y9+EFD7MxvJvqcv/OJGxmjn4oK3iemmdUvIIX1qjtohvaK3xuxN4qmQyw== X-Received: by 2002:a19:f205:: with SMTP id q5-v6mr8899919lfh.125.1527591058398; Tue, 29 May 2018 03:50:58 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id v3-v6sm6403027ljj.71.2018.05.29.03.50.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 03:50:57 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Tue, 29 May 2018 12:50:00 +0200 Message-Id: <20180529105011.1914-28-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180529105011.1914-1-edgar.iglesias@gmail.com> References: <20180529105011.1914-1-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22b Subject: [Qemu-devel] [PULL v1 27/38] target-microblaze: mmu: Add a configurable output address mask 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: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Add a configurable output address mask, used to mimic the configurable physical address bit width. Reviewed-by: Alistair Francis Reviewed-by: Richard Henderson Signed-off-by: Edgar E. Iglesias --- target/microblaze/cpu.c | 1 + target/microblaze/mmu.c | 1 + target/microblaze/mmu.h | 1 + 3 files changed, 3 insertions(+) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 6ee15ac800..71fc8d09fe 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -128,6 +128,7 @@ static void mb_cpu_reset(CPUState *s) env->mmu.c_mmu = 3; env->mmu.c_mmu_tlb_access = 3; env->mmu.c_mmu_zones = 16; + env->mmu.c_addr_mask = MAKE_64BIT_MASK(0, cpu->cfg.addr_size); #endif } diff --git a/target/microblaze/mmu.c b/target/microblaze/mmu.c index a379968618..166c79908c 100644 --- a/target/microblaze/mmu.c +++ b/target/microblaze/mmu.c @@ -164,6 +164,7 @@ unsigned int mmu_translate(struct microblaze_mmu *mmu, tlb_rpn = d & TLB_RPN_MASK; lu->vaddr = tlb_tag; + lu->paddr = tlb_rpn & mmu->c_addr_mask; lu->paddr = tlb_rpn; lu->size = tlb_size; lu->err = ERR_HIT; diff --git a/target/microblaze/mmu.h b/target/microblaze/mmu.h index 1714caf82e..9fbdf38f36 100644 --- a/target/microblaze/mmu.h +++ b/target/microblaze/mmu.h @@ -72,6 +72,7 @@ struct microblaze_mmu int c_mmu; int c_mmu_tlb_access; int c_mmu_zones; + uint64_t c_addr_mask; /* Mask to apply to physical addresses. */ }; struct microblaze_mmu_lookup