From patchwork Mon Oct 26 13:01:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 535941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 078BF14017E for ; Tue, 27 Oct 2015 00:09:21 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Bns2iHIt; dkim-atps=neutral Received: from localhost ([::1]:52815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqhWZ-0002QW-3v for incoming@patchwork.ozlabs.org; Mon, 26 Oct 2015 09:09:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqhQG-0007uB-0e for qemu-devel@nongnu.org; Mon, 26 Oct 2015 09:02:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZqhQ9-0002az-Sw for qemu-devel@nongnu.org; Mon, 26 Oct 2015 09:02:47 -0400 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]:33827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqhQ9-0002av-Lx for qemu-devel@nongnu.org; Mon, 26 Oct 2015 09:02:41 -0400 Received: by padhk11 with SMTP id hk11so188567098pad.1 for ; Mon, 26 Oct 2015 06:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Fy5vc5gxlI7JT7vkmQOCk/bGHBfHZ8pwo/Lfu/BJvpE=; b=Bns2iHItAf8vTuuJTJSw1LzGeiw//bWyjzTiMSruScnFG3EHdfIjr/H15RWvyFFadQ v1iSw9m+AqlB2+ZWQeX/mYJ4janqX7ye7lj/e1Rs1LiFRv4tMlKTh8m7lN6kbe9/V1+S k8ly548KDSPKmz8idhGGsv1sL3+MSQPj5XGqtJTc7kiP6whxvkyeIylPcynJHNiqc/l6 SwUQRRrr0PSOtJD1uTW1lmVrDED0WLmLRab+60tVxOWGbOBs5eLkQRcSM0l0PxUgSyYH rO0WlayQGdQuQlOXRHuCLcYfhqRqiTSRgFlvpf88m7j8R0Vn4ivXKAYyJO0Lf84xTGjA gTtA== X-Received: by 10.68.173.133 with SMTP id bk5mr22153886pbc.133.1445864561229; Mon, 26 Oct 2015 06:02:41 -0700 (PDT) Received: from localhost (ec2-52-8-89-49.us-west-1.compute.amazonaws.com. [52.8.89.49]) by smtp.gmail.com with ESMTPSA id oi3sm16804025pbb.53.2015.10.26.06.02.39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 26 Oct 2015 06:02:40 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 26 Oct 2015 14:01:59 +0100 Message-Id: <1445864527-14520-7-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445864527-14520-1-git-send-email-edgar.iglesias@gmail.com> References: <1445864527-14520-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22f Cc: laurent.desnogues@gmail.com, serge.fdrv@gmail.com, edgar.iglesias@xilinx.com, alex.bennee@linaro.org, agraf@suse.de Subject: [Qemu-devel] [PATCH v5 06/14] target-arm: lpae: Rename granule_sz to stride X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Edgar E. Iglesias" Rename granule_sz to stride to better match the reference manuals. No functional change. Reviewed-by: Peter Maydell Signed-off-by: Edgar E. Iglesias --- target-arm/helper.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index c4a97ca..80a1539 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -6472,7 +6472,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, uint32_t tableattrs; target_ulong page_size; uint32_t attrs; - int32_t granule_sz = 9; + int32_t stride = 9; int32_t va_size = 32; int inputsize; int32_t tbi = 0; @@ -6581,10 +6581,10 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, tg = extract32(tcr->raw_tcr, 14, 2); if (tg == 1) { /* 64KB pages */ - granule_sz = 13; + stride = 13; } if (tg == 2) { /* 16KB pages */ - granule_sz = 11; + stride = 11; } } else { /* We should only be here if TTBR1 is valid */ @@ -6596,15 +6596,15 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, tg = extract32(tcr->raw_tcr, 30, 2); if (tg == 3) { /* 64KB pages */ - granule_sz = 13; + stride = 13; } if (tg == 1) { /* 16KB pages */ - granule_sz = 11; + stride = 11; } } /* Here we should have set up all the parameters for the translation: - * va_size, inputsize, ttbr, epd, granule_sz, tbi + * va_size, inputsize, ttbr, epd, stride, tbi */ if (epd) { @@ -6616,16 +6616,16 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, /* The starting level depends on the virtual address size (which can be * up to 48 bits) and the translation granule size. It indicates the number - * of strides (granule_sz bits at a time) needed to consume the bits + * of strides (stride bits at a time) needed to consume the bits * of the input address. In the pseudocode this is: * level = 4 - RoundUp((inputsize - grainsize) / stride) * where their 'inputsize' is our 'inputsize', 'grainsize' is - * our 'granule_sz + 3' and 'stride' is our 'granule_sz'. + * our 'stride + 3' and 'stride' is our 'stride'. * Applying the usual "rounded up m/n is (m+n-1)/n" and simplifying: - * = 4 - (inputsize - granule_sz - 3 + granule_sz - 1) / granule_sz - * = 4 - (inputsize - 4) / granule_sz; + * = 4 - (inputsize - stride - 3 + stride - 1) / stride + * = 4 - (inputsize - 4) / stride; */ - level = 4 - (inputsize - 4) / granule_sz; + level = 4 - (inputsize - 4) / stride; /* Clear the vaddr bits which aren't part of the within-region address, * so that we don't have to special case things when calculating the @@ -6635,11 +6635,11 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, address &= (1ULL << inputsize) - 1; } - descmask = (1ULL << (granule_sz + 3)) - 1; + descmask = (1ULL << (stride + 3)) - 1; /* Now we can extract the actual base address from the TTBR */ descaddr = extract64(ttbr, 0, 48); - descaddr &= ~((1ULL << (inputsize - (granule_sz * (4 - level)))) - 1); + descaddr &= ~((1ULL << (inputsize - (stride * (4 - level)))) - 1); /* Secure accesses start with the page table in secure memory and * can be downgraded to non-secure at any step. Non-secure accesses @@ -6651,7 +6651,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, uint64_t descriptor; bool nstable; - descaddr |= (address >> (granule_sz * (4 - level))) & descmask; + descaddr |= (address >> (stride * (4 - level))) & descmask; descaddr &= ~7ULL; nstable = extract32(tableattrs, 4, 1); descriptor = arm_ldq_ptw(cs, descaddr, !nstable); @@ -6676,7 +6676,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, * These are basically the same thing, although the number * of bits we pull in from the vaddr varies. */ - page_size = (1ULL << ((granule_sz * (4 - level)) + 3)); + page_size = (1ULL << ((stride * (4 - level)) + 3)); descaddr |= (address & (page_size - 1)); /* Extract attributes from the descriptor and merge with table attrs */ attrs = extract64(descriptor, 2, 10)