Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp677997pxb; Tue, 14 Sep 2021 06:30:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/cRSfEG22ZPz8GQ94HUCtv/BdiDIf9A9UA8c9mdd8eLbpvmyF51w1qqGdcwbg9VUrcJSE X-Received: by 2002:a92:c70a:: with SMTP id a10mr11439634ilp.109.1631626230842; Tue, 14 Sep 2021 06:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631626230; cv=none; d=google.com; s=arc-20160816; b=m0Nn7ZgqC0L6J8Q97GaK+aJ51HeMbjjci+TVQl3XcRp+7dd6/eW6EOl8GqWIi0hGVq COZT9ZnquP7qmYmx9Zx7+6bERH76/2CGDrQw3mvhjSBA5/DzyGRILvEZ1iVQxwTdzLHr 1dItZlJDnjexvk/pC3JXmaLnHET4qJhHQGvnl2oF5uMZfhSjk4KhMMocI5suGvhS9IfV 8F2iaXRUMvfmRC1mbG90tdDp5XA5sBQt49cKnrcUaKd+XUEVq2XKILmDoR+JJPbXU+It mKpUDpWSFga4eVdZI80WAX2/Xkdcb0G8eYfdxJFQaM7NEWCs4+M/kTdVg9fNuPd7hsCV S4vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=j9vUGQm8IoZhCKNFmiI4S6Is2zu+5YV9tr4eWICr7gE=; b=ObwF78xgPb8Be/k/akcnTOeW0RkLzEM11WIfAGN9FV8rEVvkwYp5E5jovRivug4gzY o7sdfPsB8sphfpnEbhzmECfSE50XGUkJ4ConmXzbtJdqvh/dtGDlntW9mrBLwDYmDZyM c4AO0P+PR0XrItx+klzVV9c8tF+Z/PpfSgnFoKIH/K15IJSV9n3bY5p/uPkn4w3K89U0 B3IjKIxRf6FjEabQG8xxfssUWeE3CqT7nymxm3GF/V4J2+Mz9N1MWiAojrROVGZM2y6R qvWrHDWbFx3d7slhK7LTRcWC/h9lKk8qQXDOEGpRwqWruwoA7kKZhRzaTUsmXykI01Zl p9CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hyvjBRZc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r195si9960415ior.17.2021.09.14.06.30.18; Tue, 14 Sep 2021 06:30:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hyvjBRZc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233196AbhINNah (ORCPT + 99 others); Tue, 14 Sep 2021 09:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232420AbhINNag (ORCPT ); Tue, 14 Sep 2021 09:30:36 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C33D8C061574; Tue, 14 Sep 2021 06:29:18 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id a4so28833611lfg.8; Tue, 14 Sep 2021 06:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=j9vUGQm8IoZhCKNFmiI4S6Is2zu+5YV9tr4eWICr7gE=; b=hyvjBRZc51tx6C8lodT1wPEfBnGbEjZlr5JRMIeXOpiDpw7zvSF8MSAbHxiG/A3kRK 6PNlGKJAieG36HSvsfWH/KLxxRIZ7ueoKi/bnOf/2JAakhjhrC1Oe35yRpcRdmd3f/4W nO7pR0eimcsgqk5qFx8dJ1xWuGupZwysHTNDU8IveON6+uDYogDhd4Avga/7NZjSoRMp O/iPL8IfEHual5wep8JyYQdkBRoE1YulGTylHGdGz/Lf57EM9z6exBxnsfjC12vF99TF mFc+bK+gaCrdOVb4L3pvTLfzLOuAu6yoE3fKogKPb/Hv/f7XMENqudQz8GVOETsovPdi eE+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=j9vUGQm8IoZhCKNFmiI4S6Is2zu+5YV9tr4eWICr7gE=; b=fLHdkylgIOoIKA20exxSsObLsXbKEJaM9dM0dcVgnEZcpGZzKwQoEiHq0CgUSgKk6h 4JYYtNiRcuqWMG5CLoTFbmLuHuO7bPx6PN3PmfISYTlOn3G9uy4tky0Z6APGNtsETNHG R570Wr87wJLgrkm3/97Tj3JsF7GqUekSFBxr032xGXQOiQO6VesCwtsSKcx0zhCjbDsy pOiNHraK9pwOV8MEgulMHNVhxtYDWjFYMkufuhwb/X7skKkS+aYeKGhwvQMiJXrIhyCS vEIG2hqiDPdagAj5iyoq0f/tsB4+thbHPsXM1mSZQL5wSuG+yQJ/dUMnLHHOyppLDgVb p3WA== X-Gm-Message-State: AOAM533R7YydHtV0vtci9Bntxcd7EnXGFKiSoTM8lWIoHe8aU8z6+4Kv TBu/I0j7yWeluip1Wu7NgZAXup4Tt6E= X-Received: by 2002:ac2:46d3:: with SMTP id p19mr13120562lfo.689.1631626156958; Tue, 14 Sep 2021 06:29:16 -0700 (PDT) Received: from [192.168.2.145] (46-138-83-36.dynamic.spd-mgts.ru. [46.138.83.36]) by smtp.googlemail.com with ESMTPSA id b12sm1122236lfb.42.2021.09.14.06.29.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Sep 2021 06:29:16 -0700 (PDT) Subject: Re: [PATCH v6 6/6] iommu/tegra-smmu: Add pagetable mappings to debugfs To: Nicolin Chen , thierry.reding@gmail.com, joro@8bytes.org, will@kernel.org Cc: vdumpa@nvidia.com, jonathanh@nvidia.com, linux-tegra@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org References: <20210914013858.31192-1-nicoleotsuka@gmail.com> <20210914013858.31192-7-nicoleotsuka@gmail.com> From: Dmitry Osipenko Message-ID: <31501a62-3312-9f04-3bb8-790d0481746c@gmail.com> Date: Tue, 14 Sep 2021 16:29:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210914013858.31192-7-nicoleotsuka@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 14.09.2021 04:38, Nicolin Chen пишет: > +static unsigned long pd_pt_index_iova(unsigned int pd_index, unsigned int pt_index) > +{ > + return ((dma_addr_t)pd_index & (SMMU_NUM_PDE - 1)) << SMMU_PDE_SHIFT | > + ((dma_addr_t)pt_index & (SMMU_NUM_PTE - 1)) << SMMU_PTE_SHIFT; > +} We know that IOVA is fixed to u32 for this controller. Can we avoid all these dma_addr_t castings? It should make code cleaner a tad, IMO.