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: 914873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jC3KxFBB"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40mP8Q40BPz9s1B for ; Thu, 17 May 2018 05:07:50 +1000 (AEST) Received: from localhost ([::1]:34262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1m8-0006su-56 for incoming@patchwork.ozlabs.org; Wed, 16 May 2018 15:07:48 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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