From patchwork Wed May 16 18:51:34 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: 914879 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="DVROAP1L"; 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 40mPCq5YWVz9s1w for ; Thu, 17 May 2018 05:10:47 +1000 (AEST) Received: from localhost ([::1]:34278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1oz-0000mw-C4 for incoming@patchwork.ozlabs.org; Wed, 16 May 2018 15:10:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJ1XM-0003Pz-EL for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJ1XL-0000sx-Cb for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:32 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:36096) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJ1XL-0000sM-5Y for qemu-devel@nongnu.org; Wed, 16 May 2018 14:52:31 -0400 Received: by mail-wr0-x243.google.com with SMTP id p4-v6so2785599wrh.3 for ; Wed, 16 May 2018 11:52:30 -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=qX1PEmeLBFPGq2zdwN6kiMMwoESHL+lKVoMVf6OgQ5U=; b=DVROAP1LQWGk2e7pTdCDLXHKv4JUBFD3kyaq8uatwRtwEFiod5T/QeK3RP1/XvD6Kg DDipIQdmAAG/T1Hamosd05Ca0C821FzKWiLnqGBr4RycLelNDVpzFBtX5iUxzuz0jZMU 1NVhrcxIPUL//54wLgyKJB8m233dHNcs1a4jw6bBU/s+ypdLPAktyC7Em69kFn5Ytqll 5vLOjmVozpKyvNZ7r3CrFpthfqWdAAcwcB8kpRwVw0o+vpu9CBIR8Jfv6dG+juasx4lO gK/agfXUbYiXZnwPru9G+BXkTBtptdI7Mt+ce5E7NYaE3a5iRqgyyfK1zDUhipd2D4Ol DrxA== 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=qX1PEmeLBFPGq2zdwN6kiMMwoESHL+lKVoMVf6OgQ5U=; b=blpVcCauVg/gkumj5jx1Zs2AT+4HWtJILfzLa5NKLlJZ+Kno244EsyvaacsQJVzCTE ZBHBWV2RIgXa6rX78U2iKTTB+GHiVh8Sc0xjF8wvH4GdgAVF6v4/Sr2Smjb50egdufB6 kxu/Q6kFjoPjUPpMYrbYG23/JJ6LsrW0UdqWnAQTXmdwCMaatKsp+4+A0/cp/9a4XncY ZcoVgTthzrDtWXs7kHQLr0inuzdDIk8ZuLVbSI/WCqZPe3T+xwEYleup5BpB5NQu5Ujk GZXeCE3E10Ml090cROlIu3603aK/cZUJf/PzDCiHi6Kmv14DKLTS/ur+fL9Xc1ceLjjZ D18w== X-Gm-Message-State: ALKqPwely9VtL29XKsiXv/UwhxRlLet542w7wsB+tIs0q3hhJ7Gr+/ae utHJdsdyPwm8IGU9DV5xxCM3Lg== X-Google-Smtp-Source: AB8JxZoFlaKpCYqaIseYqdvylS0eTw9YIsXSNQfa6NlY+TBLGiICH5IrehWXqiiL4o28eXZ7zXRMGA== X-Received: by 2002:a19:c9d1:: with SMTP id z200-v6mr16483173lff.0.1526496749772; Wed, 16 May 2018 11:52:29 -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 h13-v6sm777909lfg.20.2018.05.16.11.52.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 11:52:28 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Wed, 16 May 2018 20:51:34 +0200 Message-Id: <20180516185146.30708-27-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::243 Subject: [Qemu-devel] [PATCH v3 26/38] target-microblaze: mmu: Prepare for 64-bit addresses 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" Prepare for 64-bit addresses. This makes no functional difference as the upper parts of the 64-bit addresses are not yet reachable. Reviewed-by: Richard Henderson Signed-off-by: Edgar E. Iglesias --- target/microblaze/mmu.c | 14 +++++++------- target/microblaze/mmu.h | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/microblaze/mmu.c b/target/microblaze/mmu.c index 231803ceea..a379968618 100644 --- a/target/microblaze/mmu.c +++ b/target/microblaze/mmu.c @@ -81,16 +81,16 @@ unsigned int mmu_translate(struct microblaze_mmu *mmu, { unsigned int i, hit = 0; unsigned int tlb_ex = 0, tlb_wr = 0, tlb_zsel; - unsigned int tlb_size; - uint32_t tlb_tag, tlb_rpn, mask, t0; + uint64_t tlb_tag, tlb_rpn, mask; + uint32_t tlb_size, t0; lu->err = ERR_MISS; for (i = 0; i < ARRAY_SIZE(mmu->rams[RAM_TAG]); i++) { - uint32_t t, d; + uint64_t t, d; /* Lookup and decode. */ t = mmu->rams[RAM_TAG][i]; - D(qemu_log("TLB %d valid=%d\n", i, t & TLB_VALID)); + D(qemu_log("TLB %d valid=%" PRId64 "\n", i, t & TLB_VALID)); if (t & TLB_VALID) { tlb_size = tlb_decode_size((t & TLB_PAGESZ_MASK) >> 7); if (tlb_size < TARGET_PAGE_SIZE) { @@ -98,10 +98,10 @@ unsigned int mmu_translate(struct microblaze_mmu *mmu, abort(); } - mask = ~(tlb_size - 1); + mask = ~((uint64_t)tlb_size - 1); tlb_tag = t & TLB_EPN_MASK; if ((vaddr & mask) != (tlb_tag & mask)) { - D(qemu_log("TLB %d vaddr=%x != tag=%x\n", + D(qemu_log("TLB %d vaddr=%" PRIx64 " != tag=%" PRIx64 "\n", i, vaddr & mask, tlb_tag & mask)); continue; } @@ -173,7 +173,7 @@ unsigned int mmu_translate(struct microblaze_mmu *mmu, } } done: - D(qemu_log("MMU vaddr=%x rw=%d tlb_wr=%d tlb_ex=%d hit=%d\n", + D(qemu_log("MMU vaddr=%" PRIx64 " rw=%d tlb_wr=%d tlb_ex=%d hit=%d\n", vaddr, rw, tlb_wr, tlb_ex, hit)); return hit; } diff --git a/target/microblaze/mmu.h b/target/microblaze/mmu.h index 624becfded..1714caf82e 100644 --- a/target/microblaze/mmu.h +++ b/target/microblaze/mmu.h @@ -28,7 +28,7 @@ #define RAM_TAG 0 /* Tag portion */ -#define TLB_EPN_MASK 0xFFFFFC00 /* Effective Page Number */ +#define TLB_EPN_MASK MAKE_64BIT_MASK(10, 64 - 10) #define TLB_PAGESZ_MASK 0x00000380 #define TLB_PAGESZ(x) (((x) & 0x7) << 7) #define PAGESZ_1K 0 @@ -42,7 +42,7 @@ #define TLB_VALID 0x00000040 /* Entry is valid */ /* Data portion */ -#define TLB_RPN_MASK 0xFFFFFC00 /* Real Page Number */ +#define TLB_RPN_MASK MAKE_64BIT_MASK(10, 64 - 10) #define TLB_PERM_MASK 0x00000300 #define TLB_EX 0x00000200 /* Instruction execution allowed */ #define TLB_WR 0x00000100 /* Writes permitted */ @@ -63,7 +63,7 @@ struct microblaze_mmu { /* Data and tag brams. */ - uint32_t rams[2][TLB_ENTRIES]; + uint64_t rams[2][TLB_ENTRIES]; /* We keep a separate ram for the tids to avoid the 48 bit tag width. */ uint8_t tids[TLB_ENTRIES]; /* Control flops. */