From patchwork Wed May 16 18:51:35 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: 10404715 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 A36B4601F9 for ; Wed, 16 May 2018 19:08:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9394728607 for ; Wed, 16 May 2018 19:08:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 881E428613; Wed, 16 May 2018 19:08:31 +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=-4.0 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 316DE28607 for ; Wed, 16 May 2018 19:08:31 +0000 (UTC) Received: from localhost ([::1]:34271 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1mo-000840-CH for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 May 2018 15:08:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1XO-0003Sg-TQ for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ1XO-0000uf-0O for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:34 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:36095) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ1XN-0000tq-Fn for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:33 -0400 Received: by mail-wr0-x241.google.com with SMTP id p4-v6so2785765wrh.3 for ; Wed, 16 May 2018 11:52:33 -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=8A4VroJ9P6pbNBefwi080ShqsrXhTgNuRwQiVvnYssM=; b=jC3KxFBBltcPo3OFXYyPnVUnP2S3AebIFS3HkgFLE0efmv8ZHKpYT6JsItmqnLlwXP WGstz5F3qGcOa2DgOvEDchNrZURzT7CL97ztBt2QhsrV3TpmXOxcnFGLRnM6/5Nicp9R +MDW2QqzEv/t7gPMmBPpRpHgB2vUBcKV8NQNzOO0a6pLgaS0aPF4ZUnye6qcjx7TPfgl OQU5QiXsQgQCkgQQw9Dpi9J/ZERXBKAFfcoKUxfEQkq1wBOoLGe9oCKghacU6YO/57we IjZBk76vqeL+Q+YUAjpiFmtgLSKBx/tyTiYqaQfHoj1YsIsmTp0JXQjhsyA8ZUU+4VFU iTww== 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=8A4VroJ9P6pbNBefwi080ShqsrXhTgNuRwQiVvnYssM=; b=t/dxuOvuJGGY0CoChLLq+RK2Jgdn5SDD5oox4pwpA+Ku4tPmn46Gj9DuhfW4Hw2r8A piMtdgGOABxncGV1RAXB4BPGlVttWKUguZtKkuvXcU7FK6OYRW2r/QsSi9Q4AG+6tCvb aOztuFZjVAe43M2Wjdli/UpxcU5DsVJC6w23Eul0dtr1ESOUPSTKS1r+j4S/UWSi24/J UrutIjCI8Su2fGY9Hm2DwjFKVLYGYWJe7NJESARaR5Ryy0c+hgMDbQJRkRkbz2v4BJHT unJiFbeXVqTUGELvPYPcm8bg9NqmOXU05YoPsDD51bSG80+5ljFXidEPv4eGNFsDB4Op X7TQ== X-Gm-Message-State: ALKqPwdbRgMBnRsRxyHVH05ntjFmU+7lY04MMnjml4ClFPNcW+YG1frw STdZDUWP62z3dlZAO28yw17jHQ== X-Google-Smtp-Source: AB8JxZpdWgorHiOogWBb85uUWP+9Tiw+K4eOKShjKZOGPOpTkiQ+Yz/s/dSCnlLxH0esUYsqug4DBw== X-Received: by 2002:a19:25c5:: with SMTP id l188-v6mr15150387lfl.124.1526496751318; Wed, 16 May 2018 11:52:31 -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 s137-v6sm769100lfs.67.2018.05.16.11.52.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 11:52:30 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 20:51:35 +0200 Message-Id: <20180516185146.30708-28-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180516185146.30708-1-edgar.iglesias@gmail.com> References: <20180516185146.30708-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::241 Subject: [Qemu-devel] [PATCH v3 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, sstabellini@kernel.org, sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com, alistair@alistair23.me, richard.henderson@linaro.org, frederic.konrad@adacore.com 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 2b3f8fa374..d0649fdaaa 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