From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA249C63697 for ; Thu, 26 Nov 2020 16:06:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 469E9206B7 for ; Thu, 26 Nov 2020 16:06:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B67Xie+C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 469E9206B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YQ8p6vKDBJ7VJVqX6k9ZcktRvA46aQV+HzNsYs5qMAE=; b=B67Xie+CbJQD+ar4NNrpRsIWt 4l1noLiNhhVhvIEcjDf6FT0NPuKovuWonqjezcq7bBcA1aA8XTJ3GYmcZERlKsTBj3ydVgMh3JM9n Ox87ZyY5oRBad0saITRzLVXPW7zE/WTaJDqKPZ2HCYgpF50L02Zx2VEXpU4s6LiI1M0K7bvU+E5kL LWpuEaczhu40L1dVTVBlEvcHunBkyIk8ZF1Zz8mOnOKZGG0Alt35j415OhRVTPeTqDEip3CcFgWkQ vDUDLJB5eZxpioSuSUT2o9RoaOKj2j1Of56pO4wIZ37nXMRC7+JHeLLVbYLP8UKKpWh1jekmpyXfm zhvOjRPxQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiJl9-0003lv-Th; Thu, 26 Nov 2020 16:04:41 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiJkT-0003Xo-5J; Thu, 26 Nov 2020 16:04:04 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3DFA631B; Thu, 26 Nov 2020 08:03:55 -0800 (PST) Received: from [10.57.59.159] (unknown [10.57.59.159]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 67D063F23F; Thu, 26 Nov 2020 08:03:50 -0800 (PST) Subject: Re: [PATCH v4 09/24] iommu/io-pgtable-arm-v7s: Clear LVL_SHIFT/BITS macro instead of the formula To: Yong Wu , Joerg Roedel , Matthias Brugger , Rob Herring , Will Deacon References: <20201111123838.15682-1-yong.wu@mediatek.com> <20201111123838.15682-10-yong.wu@mediatek.com> From: Robin Murphy Message-ID: <13599074-25d5-721f-ea7b-1ea6badfd14f@arm.com> Date: Thu, 26 Nov 2020 16:03:49 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201111123838.15682-10-yong.wu@mediatek.com> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201126_110357_574550_78D74859 X-CRM114-Status: GOOD ( 21.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: youlin.pei@mediatek.com, devicetree@vger.kernel.org, Nicolas Boichat , srv_heupstream@mediatek.com, Tomasz Figa , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Evan Green , chao.hao@mediatek.com, iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Krzysztof Kozlowski , anan.sun@mediatek.com, kernel-team@android.com, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-11-11 12:38, Yong Wu wrote: > The current _ARM_V7S_LVL_BITS/ARM_V7S_LVL_SHIFT use a formula to calculate > the corresponding value for level1 and level2 to pretend the code sane. > Actually their level1 and level2 values are different from each other. > This patch only clear the two macro. No functional change. Grammar nit: to "clear" the macro sounds like you're making it empty or removing it entirely; I think you mean to say "clarify" here. English is the worst language sometimes... :) Reviewed-by: Robin Murphy > Suggested-by: Robin Murphy > Signed-off-by: Yong Wu > --- > drivers/iommu/io-pgtable-arm-v7s.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c > index 4d0aa079470f..58cc201c10a3 100644 > --- a/drivers/iommu/io-pgtable-arm-v7s.c > +++ b/drivers/iommu/io-pgtable-arm-v7s.c > @@ -44,13 +44,11 @@ > > /* > * We have 32 bits total; 12 bits resolved at level 1, 8 bits at level 2, > - * and 12 bits in a page. With some carefully-chosen coefficients we can > - * hide the ugly inconsistencies behind these macros and at least let the > - * rest of the code pretend to be somewhat sane. > + * and 12 bits in a page. > */ > #define ARM_V7S_ADDR_BITS 32 > -#define _ARM_V7S_LVL_BITS(lvl) (16 - (lvl) * 4) > -#define ARM_V7S_LVL_SHIFT(lvl) (ARM_V7S_ADDR_BITS - (4 + 8 * (lvl))) > +#define _ARM_V7S_LVL_BITS(lvl) ((lvl) == 1 ? 12 : 8) > +#define ARM_V7S_LVL_SHIFT(lvl) ((lvl) == 1 ? 20 : 12) > #define ARM_V7S_TABLE_SHIFT 10 > > #define ARM_V7S_PTES_PER_LVL(lvl) (1 << _ARM_V7S_LVL_BITS(lvl)) > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel